[one-users] onedb upgrade and XML

Hyun Woo Kim hyunwoo at fnal.gov
Tue Apr 15 14:11:54 PDT 2014


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 <hyunwoo at fnal.gov<mailto:hyunwoo at fnal.gov>>
Date: Tuesday, April 15, 2014 10:08 AM
To: users <users at lists.opennebula.org<mailto:users at lists.opennebula.org>>
Cc: Hyunwoo Kim <hyunwoo at fnal.gov<mailto:hyunwoo at 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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20140415/395fefce/attachment-0002.htm>


More information about the Users mailing list