1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-20 14:03:36 +03:00

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

Signed-off-by: ArnauGabrielAtienza <agabriel@opennebula.io>
This commit is contained in:
ArnauGabrielAtienza 2024-09-16 17:36:31 +02:00 committed by GitHub
parent 263cba6749
commit a95a94b5a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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