diff --git a/src/onedb/fsck.rb b/src/onedb/fsck.rb index f5940c23aa..9d6aa64cbb 100644 --- a/src/onedb/fsck.rb +++ b/src/onedb/fsck.rb @@ -115,6 +115,16 @@ EOT end end + def add_element(elem, name) + return elem.add_child(elem.document.create_element(name)) + end + + def add_cdata(elem, name, text) + # The cleaner doc.create_cdata(txt) is not supported in + # old versions of nokogiri + return add_element(elem, name).add_child( + Nokogiri::XML::CDATA.new(elem.document(), text)) + end ######################################################################## # Acl diff --git a/src/onedb/fsck/network.rb b/src/onedb/fsck/network.rb index ad757bd506..3802c0edce 100644 --- a/src/onedb/fsck/network.rb +++ b/src/onedb/fsck/network.rb @@ -417,10 +417,10 @@ module OneDBFsck new_used_leases += new_leases.size + allocated_e.remove if allocated_e + if new_leases.size > 0 - allocated_e.content = " #{new_leases.join(" ")}" - else - allocated_e.remove if !allocated_e.nil? + add_cdata(net_ar, "ALLOCATED", " #{new_leases.join(" ")}") end end diff --git a/src/onedb/local/4.90.0_to_5.3.80.rb b/src/onedb/local/4.90.0_to_5.3.80.rb index a84cb2d4c7..394ab51c27 100644 --- a/src/onedb/local/4.90.0_to_5.3.80.rb +++ b/src/onedb/local/4.90.0_to_5.3.80.rb @@ -261,5 +261,25 @@ module Migrator ############################################################################ def feature_4809 create_table(:logdb) + + @db.run "ALTER TABLE zone_pool RENAME TO old_zone_pool;" + create_table(:zone_pool) + + @db.transaction do + @db.fetch("SELECT * FROM old_zone_pool") do |row| + doc = Nokogiri::XML(row[:body], nil, NOKOGIRI_ENCODING) { |c| + c.default_xml.noblanks + } + + server_pool = doc.create_element "SERVER_POOL" + doc.root.add_child(server_pool) + + row[:body] = doc.root.to_s + + @db[:zone_pool].insert(row) + end + end + + @db.run "DROP TABLE old_zone_pool;" end end diff --git a/src/onedb/onedb.rb b/src/onedb/onedb.rb index bd660e0147..a2e47255aa 100644 --- a/src/onedb/onedb.rb +++ b/src/onedb/onedb.rb @@ -559,7 +559,6 @@ is preserved. file = "#{RUBY_LIB_LOCATION}/onedb/vcenter_one54.rb" if File.exists? file - load(file) @backend.extend One54Vcenter diff --git a/src/onedb/vcenter_one54.rb b/src/onedb/vcenter_one54.rb index 6844fef949..5437fc6810 100644 --- a/src/onedb/vcenter_one54.rb +++ b/src/onedb/vcenter_one54.rb @@ -20,10 +20,8 @@ else LOG_LOCATION = ONE_LOCATION + "/var" end -LOG = LOG_LOCATION + "/onedb-vcenter-one54.log" - -TMP_DIR = "/tmp" - +LOG = LOG_LOCATION + "/onedb-vcenter-one54.log" +TMP_DIR = "/var/tmp/vcenter_one54" module One54Vcenter VERSION = "5.3.80"