mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-06 03:58:49 +09:00
Fix wrong handling of the two datastores involved (backup+ceph) Signed-off-by: Guillermo Ramos <gramos@opennebula.io>
This commit is contained in:
1 parent
80dec984d8
commit
cff2bb697b
2 files changed
+18
-7
No files matched your search
+10
-5
@@ -77,11 +77,11 @@ begin
|
||||
bk_img = OpenNebula::Image.new_with_id(bk_img_id, action.one)
|
||||
|
||||
rc = bk_img.info
|
||||
|
||||
raise rc.message.to_s if OpenNebula.is_error?(rc)
|
||||
|
||||
ds = TransferManager::Datastore.from_image_ds(:image => bk_img,
|
||||
:client => action.one)
|
||||
bk_ds = TransferManager::Datastore.from_image_ds(:image => bk_img,
|
||||
:client => action.one)
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Backup information
|
||||
# sample output: {"0":"rsync://100//0:3ffce7/var/lib/one/datastores/100/1/3ffce7/disk.0.0"}
|
||||
@@ -91,7 +91,7 @@ begin
|
||||
#{bk_img.to_xml}
|
||||
EOS
|
||||
|
||||
rc = ds.action("ls -i #{inc_id}", xml_data)
|
||||
rc = bk_ds.action("ls -i #{inc_id}", xml_data)
|
||||
|
||||
raise 'cannot list backup contents' unless rc.code == 0
|
||||
|
||||
@@ -110,8 +110,13 @@ begin
|
||||
ceph_disk = ceph_disks[id.to_i]
|
||||
randsuffix = SecureRandom.hex(5)
|
||||
|
||||
ceph_one_ds = OpenNebula::Datastore.new_with_id(
|
||||
action.vm["/VM/TEMPLATE/DISK[DISK_ID = #{id}]/DATASTORE_ID"].to_i, action.one
|
||||
)
|
||||
ceph_ds = TransferManager::Datastore.new(:ds => ceph_one_ds, :client => action.one)
|
||||
|
||||
info[ceph_disk] = {
|
||||
:br => ds.pick_bridge,
|
||||
:br => ceph_ds.pick_bridge,
|
||||
:bak => "#{ceph_disk.rbd_image}.backup.#{randsuffix}",
|
||||
:old => "#{ceph_disk.rbd_image}.old.#{randsuffix}"
|
||||
}
|
||||
|
||||
@@ -76,6 +76,11 @@ module TransferManager
|
||||
@one ||= OpenNebula::Client.new
|
||||
|
||||
@ds = @options[:ds]
|
||||
if @ds && @ds['NAME'].nil?
|
||||
rc = @ds.info(true)
|
||||
raise rc.message.to_s if OpenNebula.is_error?(rc)
|
||||
end
|
||||
|
||||
@rridx = 0
|
||||
|
||||
@mad = self['DS_MAD', ''].upcase
|
||||
@@ -98,7 +103,6 @@ module TransferManager
|
||||
options[:ds] = OpenNebula::Datastore.new_with_id(did, options[:client])
|
||||
|
||||
rc = options[:ds].info(true)
|
||||
|
||||
raise rc.message.to_s if OpenNebula.is_error?(rc)
|
||||
|
||||
new(options)
|
||||
@@ -116,7 +120,6 @@ module TransferManager
|
||||
options[:ds] = OpenNebula::Datastore.new_with_id(did, options[:client])
|
||||
|
||||
rc = options[:ds].info(true)
|
||||
|
||||
raise rc.message.to_s if OpenNebula.is_error?(rc)
|
||||
|
||||
new(options)
|
||||
@@ -133,6 +136,9 @@ module TransferManager
|
||||
xml = OpenNebula::XMLElement.build_xml(options[:ds_xml], 'DATASTORE')
|
||||
options[:ds] = OpenNebula::Datastore.new(xml, options[:client])
|
||||
|
||||
rc = options[:ds].info(true)
|
||||
raise rc.message.to_s if OpenNebula.is_error?(rc)
|
||||
|
||||
new(options)
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user