1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-26 10:03:37 +03:00

F #4913: Minor fixes in the premigrator and migrator:

- SERVER_POOL must exist in the Zone
- Add ALLOCATED section to the AR
- Update temporary migrator files location
This commit is contained in:
Jaime Melis 2017-07-07 17:23:16 +02:00
parent 01da98de37
commit d77ecc3df3
5 changed files with 35 additions and 8 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -559,7 +559,6 @@ is preserved.
file = "#{RUBY_LIB_LOCATION}/onedb/vcenter_one54.rb"
if File.exists? file
load(file)
@backend.extend One54Vcenter

View File

@ -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"