1
0
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:
Jaime Melis 2010-07-23 18:12:26 +02:00
parent a8fedc350b
commit 4823b0b5d1
3 changed files with 12 additions and 6 deletions

View File

@ -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

View File

@ -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)

View File

@ -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)