mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-05 09:17:41 +03:00
* F #6505: Fix volatile disk backup and restore * F #6578: Skip backup of CDROM
This commit is contained in:
parent
420162da67
commit
c8c66b1d8f
@ -174,9 +174,9 @@ module TransferManager
|
||||
|
||||
DISK_LIST = ['ALLOW_ORPHANS', 'CLONE', 'CLONE_TARGET', 'CLUSTER_ID', 'DATASTORE',
|
||||
'DATASTORE_ID', 'DISK_SNAPSHOT_TOTAL_SIZE', 'DISK_TYPE', 'DRIVER',
|
||||
'IMAGE', 'IMAGE_ID', 'IMAGE_STATE', 'IMAGE_UID', 'IMAGE_UNAME',
|
||||
'IMAGE', 'IMAGE_STATE', 'IMAGE_UID', 'IMAGE_UNAME',
|
||||
'LN_TARGET', 'OPENNEBULA_MANAGED', 'ORIGINAL_SIZE', 'PERSISTENT',
|
||||
'READONLY', 'SAVE', 'SIZE', 'SOURCE', 'TARGET', 'TM_MAD', 'TYPE', 'FORMAT']
|
||||
'READONLY', 'SAVE', 'SOURCE', 'TARGET', 'TM_MAD', 'FORMAT']
|
||||
|
||||
NIC_LIST = ['AR_ID', 'BRIDGE', 'BRIDGE_TYPE', 'CLUSTER_ID', 'NAME', 'NETWORK_ID', 'NIC_ID',
|
||||
'TARGET', 'VLAN_ID', 'VN_MAD', 'VLAN_TAGGED_ID', 'PHYDEV']
|
||||
@ -334,11 +334,25 @@ module TransferManager
|
||||
|
||||
disks.each do |d|
|
||||
id = d['DISK_ID']
|
||||
type = d['TYPE'].upcase
|
||||
next unless id
|
||||
next unless bck_disks[id]
|
||||
|
||||
d.delete('DISK_ID')
|
||||
|
||||
if type == 'FS'
|
||||
# Volatile disk
|
||||
d.delete('IMAGE_ID')
|
||||
|
||||
# If not included in backup, keep TYPE and SIZE to create new volatile disk
|
||||
next unless bck_disks[id]
|
||||
end
|
||||
|
||||
d.delete('TYPE')
|
||||
d.delete('SIZE')
|
||||
|
||||
# CDROM keeps original image_id
|
||||
next if type == 'CDROM'
|
||||
|
||||
d['IMAGE_ID'] = bck_disks[id][:image_id].to_s
|
||||
end
|
||||
|
||||
|
@ -726,7 +726,7 @@ class KVMDomain
|
||||
@vm.elements.each 'TEMPLATE/DISK' do |d|
|
||||
did = d.elements['DISK_ID'].text
|
||||
tgt = d.elements['TARGET'].text
|
||||
per = d.elements['SAVE'].text.casecmp('YES') == 0
|
||||
per = d.elements['SAVE'].nil? ? false : d.elements['SAVE'].text.casecmp('YES') == 0
|
||||
ssh = d.elements['TM_MAD'].text.casecmp('SSH') == 0
|
||||
|
||||
next unless disks.include? did
|
||||
@ -798,10 +798,13 @@ class KVMDomain
|
||||
@vm.elements.each 'TEMPLATE/DISK' do |d|
|
||||
did = d.elements['DISK_ID'].text
|
||||
tgt = d.elements['TARGET'].text
|
||||
per = d.elements['SAVE'].text.casecmp('YES') == 0
|
||||
per = d.elements['SAVE'].nil? ? false : d.elements['SAVE'].text.casecmp('YES') == 0
|
||||
ssh = d.elements['TM_MAD'].text.casecmp('SSH') == 0
|
||||
|
||||
next unless disks.include? did
|
||||
unless disks.include? did
|
||||
dspec << "#{tgt},snapshot=no"
|
||||
next
|
||||
end
|
||||
|
||||
disk_path = "#{@vm_dir}/disk.#{did}"
|
||||
disk_opts = {
|
||||
@ -941,7 +944,7 @@ class KVMDomain
|
||||
|
||||
@vm.elements.each 'TEMPLATE/DISK' do |d|
|
||||
did = d.elements['DISK_ID'].text
|
||||
per = d.elements['SAVE'].text.casecmp('YES') == 0
|
||||
per = d.elements['SAVE'].nil? ? false : d.elements['SAVE'].text.casecmp('YES') == 0
|
||||
ssh = d.elements['TM_MAD'].text.casecmp('SSH') == 0
|
||||
|
||||
next unless disks.include? did
|
||||
@ -1028,7 +1031,7 @@ class KVMDomain
|
||||
|
||||
@vm.elements.each 'TEMPLATE/DISK' do |d|
|
||||
did = d.elements['DISK_ID'].text
|
||||
per = d.elements['SAVE'].text.casecmp('YES') == 0
|
||||
per = d.elements['SAVE'].nil? ? false : d.elements['SAVE'].text.casecmp('YES') == 0
|
||||
ssh = d.elements['TM_MAD'].text.casecmp('SSH') == 0
|
||||
|
||||
next unless disks.include? did
|
||||
|
@ -1632,7 +1632,9 @@ void VirtualMachineDisks::backup_disk_ids(bool do_volatile, std::vector<int>& id
|
||||
|
||||
one_util::toupper(type);
|
||||
|
||||
if ((type == "SWAP") || ((type == "FS") && !do_volatile))
|
||||
if ((type == "SWAP") ||
|
||||
(type == "CDROM") ||
|
||||
((type == "FS") && !do_volatile))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user