mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-24 21:34:01 +03:00
more bugs in image handling
This commit is contained in:
parent
a8fedc350b
commit
4823b0b5d1
@ -35,6 +35,7 @@ if !(vm_id=ARGV[0])
|
||||
exit -1
|
||||
end
|
||||
|
||||
|
||||
client = Client.new()
|
||||
|
||||
vm = VirtualMachine.new(
|
||||
@ -57,14 +58,15 @@ vm.each('TEMPLATE/DISK') do |disk|
|
||||
client)
|
||||
|
||||
result = image.info
|
||||
exit -1 if !is_successful?(result)
|
||||
exit -1 if OpenNebula.is_error?(result)
|
||||
|
||||
# Disable the Image for a safe overwriting
|
||||
image.disable
|
||||
|
||||
# Save the image file
|
||||
result = image.move(source_path, image['SOURCE'])
|
||||
exit -1 if !is_successful?(result)
|
||||
|
||||
exit -1 if OpenNebula.is_error?(result)
|
||||
|
||||
image.enable
|
||||
end
|
||||
|
@ -349,7 +349,7 @@ Commands:
|
||||
|
||||
* save (Set the specified vm's disk to be saved, overwriting the original image
|
||||
when the vm shutdowns)
|
||||
onevm saveas <vm_id> <disk_id>
|
||||
onevm save <vm_id> <disk_id>
|
||||
|
||||
* delete (Deletes a VM from the pool and DB)
|
||||
onevm delete <vm_id>
|
||||
@ -751,7 +751,7 @@ when "save"
|
||||
|
||||
image_id = vm["TEMPLATE/DISK[DISK_ID=\"#{disk_id}\"]/IMAGE_ID"]
|
||||
|
||||
result = vm.save_as(disk_id.to_i, image_id)
|
||||
result = vm.save_as(disk_id.to_i, image_id.to_i)
|
||||
|
||||
when "show"
|
||||
check_parameters("get_info", 1)
|
||||
|
@ -102,6 +102,10 @@ module OpenNebula
|
||||
@immanager.copy(path, source)
|
||||
end
|
||||
|
||||
def move(path, source)
|
||||
@immanager.move(path, source)
|
||||
end
|
||||
|
||||
def mk_datablock(size, fstype, source)
|
||||
rc = @immanager.dd(size, source)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user