mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
bug #347: Fix onevm saveas, check VM consistency
This commit is contained in:
parent
fa77c12061
commit
b8812bcf18
@ -707,7 +707,13 @@ when "saveas"
|
||||
else
|
||||
image_id = vm["TEMPLATE/DISK[DISK_ID=\"#{disk_id}\"]/IMAGE_ID"]
|
||||
|
||||
if (image_id != nil)
|
||||
if (image_id != nil)
|
||||
if vm["TEMPLATE/DISK[DISK_ID=\"#{disk_id}\"]/SAVE_AS"]
|
||||
puts "Error: The disk #{disk_id} is already" <<
|
||||
" suppossed to be saved"
|
||||
exit -1
|
||||
end
|
||||
|
||||
# Get the image type
|
||||
image = OpenNebula::Image.new(
|
||||
OpenNebula::Image.build_xml(image_id),
|
||||
@ -718,7 +724,7 @@ when "saveas"
|
||||
puts result.message
|
||||
exit -1
|
||||
end
|
||||
|
||||
|
||||
image_type = image.type_str
|
||||
end
|
||||
end
|
||||
@ -733,13 +739,19 @@ when "saveas"
|
||||
get_one_client)
|
||||
|
||||
result = image.allocate(template)
|
||||
|
||||
if !is_successful?(result)
|
||||
puts result.message
|
||||
exit -1
|
||||
end
|
||||
|
||||
result = vm.save_as(disk_id.to_i, image.id)
|
||||
if is_successful?(result)
|
||||
puts "VM disk with ID #{disk_id} is prepared to be" <<
|
||||
" saved" if ops[:verbose]
|
||||
else
|
||||
image.delete
|
||||
end
|
||||
|
||||
|
||||
when "show"
|
||||
check_parameters("get_info", 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user