1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

F OpenNebula/one#6624: Fix no snapshots available bug (#3229)

Signed-off-by: ArnauGabrielAtienza <agabriel@opennebula.io>
(cherry picked from commit a95a94b5a61c6b3b137fb89c39ff3fe7343fe51c)
This commit is contained in:
ArnauGabrielAtienza 2024-09-16 17:36:31 +02:00 committed by Tino Vázquez
parent c8dbd9ae79
commit e705cb7e32
No known key found for this signature in database
GPG Key ID: 14201E424D02047E

View File

@ -1290,21 +1290,23 @@ CommandParser::CmdParser.new(ARGV) do
vm = helper.retrieve_resource(args[0])
vm.info
filtered = []
vm_hash = vm.to_hash
vm_snapshots = [vm_hash['VM']['SNAPSHOTS']].flatten
vm_snapshots.each do |snap|
if snap['DISK_ID'] == args[1]
filtered << snap
end
end
vm_hash['VM']['SNAPSHOTS'] = filtered
if vm.has_elements?('/VM/SNAPSHOTS')
filtered = []
vm_hash = vm.to_hash
vm_snapshots = [vm_hash['VM']['SNAPSHOTS']].flatten
vm_snapshots.each do |snap|
if snap['DISK_ID'] == args[1]
filtered << snap
end
end
vm_hash['VM']['SNAPSHOTS'] = filtered
CLIHelper.print_header('VM DISK SNAPSHOTS'.ljust(80), false)
helper.format_snapshots(vm_hash)
else
puts 'No snapshots available in this disk'
end
0
end