mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
F #-: Fix Ceph VM restore ignoring EC_POOL_NAME
Signed-off-by: Guillermo Ramos <gramos@opennebula.io> (cherry picked from commit ad24f286169826c69f564d5b36801937b7b65077)
This commit is contained in:
parent
25a094155e
commit
d486ee1ae4
@ -130,7 +130,7 @@ begin
|
||||
if file $tmpimg | grep -q gzip; then
|
||||
cd $tmpdir
|
||||
tar zxf $tmpimg
|
||||
#{ceph_disk.restore_sh(info[ceph_disk][:new], info[ceph_disk][:br])}
|
||||
#{ceph_disk.restore_sh(info[ceph_disk][:new], ceph_ds, info[ceph_disk][:br])}
|
||||
cd -
|
||||
else
|
||||
qemu-img convert -m 4 -O raw $tmpimg $tmpimg.raw && \
|
||||
@ -184,7 +184,7 @@ begin
|
||||
:nostdout => false,
|
||||
:nostderr => false)
|
||||
|
||||
warn 'cannot restore disk backup' if rc.code != 0
|
||||
raise StandardError, 'cannot restore disk backup' if rc.code != 0
|
||||
end
|
||||
rescue StandardError => e
|
||||
STDERR.puts "Error restoring VM disks: #{e.message}"
|
||||
|
@ -256,10 +256,23 @@ module TransferManager
|
||||
}
|
||||
end
|
||||
|
||||
def restore_sh(target, bridge = nil)
|
||||
# @param target [String] the RBD image name where to import
|
||||
# @param ds [TransferManager::Datastore] the target datastore
|
||||
# @param bridge [Boolean, nil] host from where to execute this operation
|
||||
# @return [String] the script
|
||||
def restore_sh(target, ds, bridge = nil)
|
||||
ec_pool_name = ds['TEMPLATE/EC_POOL_NAME']
|
||||
|
||||
# EC parameters (--data-pool) are only accepted in some `rbd` commands. It's not
|
||||
# officially documented but at least the following ones require it:
|
||||
# - create
|
||||
# - import
|
||||
rbdec_cmd = @rbd_cmd.clone
|
||||
rbdec_cmd << " --data-pool #{ec_pool_name}" unless ec_pool_name.empty?
|
||||
|
||||
<<~EOF
|
||||
# Upload base image and snapshot
|
||||
#{Disk.sshwrap(bridge, "#{@rbd_cmd} import --export-format 2 - #{target}")} < disk.*.rbd2
|
||||
#{Disk.sshwrap(bridge, "#{rbdec_cmd} import --export-format 2 - #{target}")} < disk.*.rbd2
|
||||
|
||||
# Apply increments
|
||||
for f in $(ls disk.*.*.rbdiff | sort -k3 -t.); do
|
||||
|
Loading…
x
Reference in New Issue
Block a user