Thanks for confirming this. Hyunwoo Fermicloud From: Carlos Martín Sánchez <cmar...@opennebula.org<mailto:cmar...@opennebula.org>> Date: Wednesday, April 16, 2014 8:08 AM To: Hyunwoo Kim <hyun...@fnal.gov<mailto:hyun...@fnal.gov>> Cc: users <users@lists.opennebula.org<mailto:users@lists.opennebula.org>> Subject: Re: [one-users] onedb upgrade and XML
Hi, Your approach looks correct. The cpu element should also work with simple text instead of cdata. Refer to the REXML docs for more information: http://ruby-doc.org/stdlib-2.1.1/libdoc/rexml/rdoc/index.html Regards -- Carlos Martín, MSc Project Engineer OpenNebula - Flexible Enterprise Cloud Made Simple www.OpenNebula.org<http://www.OpenNebula.org> | cmar...@opennebula.org<mailto:cmar...@opennebula.org> | @OpenNebula<http://twitter.com/opennebula><mailto:cmar...@opennebula.org> On Tue, Apr 15, 2014 at 11:11 PM, Hyun Woo Kim <hyun...@fnal.gov<mailto:hyun...@fnal.gov>> wrote: I have found one possible solution I modified /usr/lib/one/ruby/onedb/3.8.5_to_3.9.30.rb as follows; @db.fetch("SELECT * FROM old_template_pool") do |row| doc = Document.new(row[:body]) template = nil doc.root.each_element("TEMPLATE") do |e| template = e end doc.root.each_element("TEMPLATE") do |e| elem = e.delete_element("REQUIREMENTS") if !elem.nil? template.add_element("SCHED_REQUIREMENTS").text = elem.text end elem = e.delete_element("RANK") if !elem.nil? template.add_element("SCHED_RANK").text = elem.text end # NEW> e.add_element("CPU").text = "1" end # NEW> doc.root.each_element("TEMPLATE/GRAPHICS") { |e| # NEW> e.delete_element("PORT") # NEW > } The second part to delete PORT works! The issue is the first part. With the above code, the body field of template_pool shows a new entry <CPU>1</CPU> while I expect it to be <CPU><![CDATA[1]]></CPU> So, I am thinking of modifying as follows instead; e.add_element("CPU").text = "<![CDATA[1]]>" I believe this will result in the DB as <CPU><![CDATA[1]]></CPU> What do you ON developers think? Thanks, Hyunwoo FermiCloud From: Hyunwoo Kim <hyun...@fnal.gov<mailto:hyun...@fnal.gov>> Date: Tuesday, April 15, 2014 10:08 AM To: users <users@lists.opennebula.org<mailto:users@lists.opennebula.org>> Cc: Hyunwoo Kim <hyun...@fnal.gov<mailto:hyun...@fnal.gov>> Subject: onedb upgrade and XML Hello, onedb upgrade command of ON44 against an old DB fails to do the following two tasks. 1. <CPU> </CPU> should have been inserted, but missing 2. <PORT> </PORT> in /VMTEMPLATE/TEMPLATE/GRAPHICS/ should have been removed, but still there.. What should I do about these? I am investigating a possibility to use xpath command with mysql -h localhost -u root -e "select body from template_pool limit 1" open nebula or something, but I am not sure if this is any good solution.. Any advice will be very appreciated. Thanks, Hyunwoo KIM FermiCloud _______________________________________________ Users mailing list Users@lists.opennebula.org<mailto:Users@lists.opennebula.org> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
_______________________________________________ Users mailing list Users@lists.opennebula.org http://lists.opennebula.org/listinfo.cgi/users-opennebula.org