[one-users] bug in image.rb HOOK? ('onevm saveas' command)
Carlos Martín Sánchez
cmartin at opennebula.org
Fri Feb 11 02:50:10 PST 2011
Hi,
If I'm understanding right, you first log into your VM, shutdown it
yourself, and then issue the "onevm shutdown <id>".
Is this right?
onevm shutdown command assumes the VM is still running, and sends the ACPI
signal to the machine. Your virtualized OS is supposed to shutdown itself
with this shutdown signal.
If the VM Life Cycle is managed manually, OpenNebula will lose track of what
happened, that's why the VM is seen as UNKNOWN.
Regards,
Carlos
--
Carlos Martín, Engineer, MSc
Project Major Contributor
OpenNebula - The Open Source Toolkit for Cloud Computing
www.OpenNebula.org <http://www.opennebula.org/> | cmartin at opennebula.org
2011/2/11 Marco Strutz <marco.strutz at desy.de>
> Hi Carlos.
>
> A shutdown doesn't work for me. Even with 'acpi=yes' and a *graceful*
> shutdown inside the vm (via vnc) the VM state always remains "RUNNING"
> (ACTIVE) although it was already successfully removed by libvirt.
>
> If I then manually execute "onevm shutdown 345" (see [1]) the state
> changed to "UNKNOWN" (ACTIVE). The "onevm shutdown" doesn't seem to affect
> my vm, perhaps this feature is not supported by kvm? Therefore "onevm
> delete" currently is my only option to trigger the image-hook.
>
> What do you suggest?
>
>
> [1] $ONE_LOCATION/var/345/vm.log
>
> ###############################################################################
> Fri Feb 11 10:20:11 2011 [LCM][I]: New VM state is SHUTDOWN
> Fri Feb 11 10:20:11 2011 [VMM][I]: Command execution fail: 'if [ -x
> "/var/tmp/one/vmm/kvm/shutdown" ]; then /var/tmp/one/vmm/kvm/shutdown
> one-345; else exit 42; fi'
> Fri Feb 11 10:20:11 2011 [VMM][I]: STDERR follows.
> Fri Feb 11 10:20:11 2011 [VMM][I]: error: failed to get domain 'one-345'
> Fri Feb 11 10:20:11 2011 [VMM][I]: error: Domain not found: no domain with
> matching name 'one-345'
> Fri Feb 11 10:20:11 2011 [VMM][I]: ExitCode: 1
> Fri Feb 11 10:20:11 2011 [VMM][E]: Error shuting down VM, error: failed to
> get domain 'one-345'
> Fri Feb 11 10:20:11 2011 [LCM][I]: Fail to shutdown VM. Assuming that the
> VM is still RUNNING (will poll VM).
> Fri Feb 11 10:20:12 2011 [VMM][I]: VM running but it was not found. Restart
> and delete actions available or try to recover it manually
> Fri Feb 11 10:20:12 2011 [LCM][I]: New VM state is UNKNOWN
> Fri Feb 11 10:20:58 2011 [DiM][I]: New VM state is DONE
> Fri Feb 11 10:20:58 2011 [VMM][W]: Ignored: LOG - 345 Driver command for
> 345 cancelled
> Fri Feb 11 10:20:58 2011 [TM][W]: Ignored: LOG - 345 tm_delete.sh: Deleting
> /srv/cloud/one/var//345/images
> Fri Feb 11 10:20:58 2011 [TM][W]: Ignored: LOG - 345 tm_delete.sh: Executed
> "rm -rf /srv/cloud/one/var//345/images".
> Fri Feb 11 10:20:58 2011 [TM][W]: Ignored: TRANSFER SUCCESS 345 -
> Fri Feb 11 10:20:58 2011 [HKM][I]: Command execution fail:
> /srv/cloud/one/share/hooks/image.rb 345
> Fri Feb 11 10:20:58 2011 [HKM][I]: STDERR follows.
> Fri Feb 11 10:20:58 2011 [HKM][I]: ExitCode: 255
> Fri Feb 11 10:20:58 2011 [HKM][E]: Error executing Hook: image.
> Fri Feb 11 10:20:58 2011 [VMM][W]: Ignored: LOG - 345 Command execution
> fail: 'if [ -x "/var/tmp/one/vmm/kvm/cancel" ]; then
> /var/tmp/one/vmm/kvm/cancel one-345; else exit
> 42; fi'
>
> Fri Feb 11 10:20:58 2011 [VMM][W]: Ignored: LOG - 345 STDERR follows.
> Fri Feb 11 10:20:58 2011 [VMM][W]: Ignored: LOG - 345 error: failed to get
> domain 'one-345'
> Fri Feb 11 10:20:58 2011 [VMM][W]: Ignored: LOG - 345 error: Domain not
> found: no domain with matching name 'one-345'
> Fri Feb 11 10:20:58 2011 [VMM][W]: Ignored: LOG - 345 ExitCode: 1
> Fri Feb 11 10:20:58 2011 [VMM][W]: Ignored: CANCEL FAILURE 345 error:
> failed to get domain 'one-345'
>
>
>
>
> Thanks
> Marco
>
>
>
> On 02/10/2011 04:32 PM, Carlos Martín Sánchez wrote:
>
> Hi Marco,
>
> After a *graceful* shutdown, the disk images marked to be saved
> are transferred back from var/<vm_id>/images/XX to var/<vm_id>/disk.XX
>
> Try using 'onevm shutdown' instead of delete, that will probably solve
> your problem.
>
> Regards.
> --
> Carlos Martín, Engineer, MSc
> Project Major Contributor
> OpenNebula - The Open Source Toolkit for Cloud Computing
> www.OpenNebula.org <http://www.opennebula.org/> | cmartin at opennebula.org
>
>
> 2011/2/10 Marco Strutz <marco.strutz at desy.de>
>
>> Hi Carlos.
>>
>> Very strange: After running ttylinux and enabling the saveas-feature
>> ('onevm saveas 318 0 "318_archived"') I get the following error message
>> (vm.log) after deleting this instance:
>> Thu Feb 10 12:24:31 2011 [VMM][W]: Ignored: CANCEL SUCCESS 318 Domain
>> one-318 destroyed
>> Thu Feb 10 12:24:31 2011 [HKM][I]: Command execution fail:
>> /srv/cloud/one/share/hooks/image.rb 318
>> Thu Feb 10 12:24:31 2011 [HKM][I]: STDERR follows.
>> Thu Feb 10 12:24:31 2011 [HKM][I]: ExitCode: 255
>> Thu Feb 10 12:24:31 2011 [HKM][E]: Error executing Hook: image.
>>
>> After debugging $ONE_LOCATION/share/hooks/image.rb there might be a
>> problem with the proper image location:
>> line 75 in $ONE_LOCATION/share/hooks/image.rb (result =
>> img_repo.update_source(image, source_path) outputs
>> "No such file or directory - /srv/cloud/one/var/318/disk.0 or
>> /srv/cloud/one/var//images/7c6f81fcb5b4dec12ab3fa63913b16b4ba1e2d12"
>>
>> All disk images of my vm's are deployed to
>> $ONE_LOCATION/var/<vm_id>/images/
>> If I get the error message right, it tries to lookup for the disks in
>> $ONE_LOCATION/var/<vm_id>/
>>
>> I need your help. Can that be right?
>>
>> (detailed logs see below)
>>
>>
>> Thanks in advance
>> Marco
>>
>>
>>
>>
>> $ cat ttylinux.one
>>
>> ###############################################################################
>> NAME = ttylinux
>> CPU = 0.1
>> MEMORY = 64
>>
>> DISK = [
>> source = "/srv/cloud/one/testing/ttylinux.img",
>> target = "hda",
>> readonly = "no" ]
>>
>> FEATURES=[ acpi="no" ]
>>
>> GRAPHICS = [
>> type = "vnc",
>> listen = "0.0.0.0",
>> port = "5901" ]
>>
>>
>>
>> $ onevm create ttylinux.one
>>
>> ###############################################################################
>>
>>
>>
>> $ onevm list
>>
>> ###############################################################################
>> ID USER NAME STAT CPU MEM HOSTNAME TIME
>> 318 oneadmin ttylinux runn 0 0K testbed07 00 00:00:08
>>
>>
>>
>> $ onevm show 318
>>
>> ###############################################################################
>> VIRTUAL MACHINE 318
>> INFORMATION
>> ID : 318
>> NAME : ttylinux
>> STATE : ACTIVE
>> LCM_STATE : RUNNING
>> START TIME : 02/10 12:20:34
>> END TIME : -
>> DEPLOY ID: : one-318
>>
>> VIRTUAL MACHINE
>> MONITORING
>> NET_TX : 0
>> NET_RX : 0
>> USED MEMORY : 0
>> USED CPU : 0
>>
>> VIRTUAL MACHINE
>> TEMPLATE
>> CPU=0.1
>> DISK=[
>> DISK_ID=0,
>> READONLY=no,
>> SOURCE=/srv/cloud/one/testing/ttylinux.img,
>> TARGET=hda ]
>> FEATURES=[
>> ACPI=no ]
>> GRAPHICS=[
>> LISTEN=0.0.0.0,
>> PORT=5901,
>> TYPE=vnc ]
>> MEMORY=64
>> NAME=ttylinux
>> VMID=318
>>
>>
>>
>> $ ls -la var/318/
>>
>> ###############################################################################
>> total 24
>> drwxrwxrwx 3 oneadmin cloud 75 2011-02-10 12:20 .
>> drwxr-xr-x 323 oneadmin cloud 8192 2011-02-10 12:20 ..
>> -rw-r--r-- 1 oneadmin cloud 416 2011-02-10 12:20 deployment.0
>> drwxrwxrwx 2 oneadmin cloud 38 2011-02-10 12:20 images
>> -rw-r--r-- 1 oneadmin cloud 104 2011-02-10 12:20 transfer.0.prolog
>> -rw-r--r-- 1 oneadmin cloud 1266 2011-02-10 12:20 vm.log
>> $ ls -la var/318/images/
>> total 40964
>> drwxrwxrwx 2 oneadmin cloud 38 2011-02-10 12:20 .
>> drwxrwxrwx 3 oneadmin cloud 75 2011-02-10 12:20 ..
>> -rw-r--r-- 1 oneadmin cloud 416 2011-02-10 12:20 deployment.0
>> -rw-rw-rw- 1 oneadmin cloud 41943040 2011-02-10 12:21 disk.0
>>
>>
>>
>> $ onevm saveas 318 0 "318_archived"
>>
>> ###############################################################################
>>
>>
>>
>> $ onevm show 318
>>
>> ###############################################################################
>> VIRTUAL MACHINE 318
>> INFORMATION
>> ID : 318
>> NAME : ttylinux
>> STATE : ACTIVE
>> LCM_STATE : RUNNING
>> START TIME : 02/10 12:20:34
>> END TIME : -
>> DEPLOY ID: : one-318
>>
>> VIRTUAL MACHINE
>> MONITORING
>> NET_TX : 0
>> NET_RX : 0
>> USED MEMORY : 0
>> USED CPU : 0
>>
>> VIRTUAL MACHINE
>> TEMPLATE
>> CPU=0.1
>> DISK=[
>> DISK_ID=0,
>> READONLY=no,
>> SAVE=YES,
>> SAVE_AS=37,
>> SOURCE=/srv/cloud/one/testing/ttylinux.img,
>> TARGET=hda ]
>> FEATURES=[
>> ACPI=no ]
>> GRAPHICS=[
>> LISTEN=0.0.0.0,
>> PORT=5901,
>> TYPE=vnc ]
>> MEMORY=64
>> NAME=ttylinux
>> VMID=318
>>
>>
>>
>> $ oneimage show 37
>>
>> ###############################################################################
>> IMAGE
>> INFORMATION
>> ID : 37
>> NAME : 318_archived
>> TYPE : OS
>> REGISTER TIME : 02/10 12:22:50
>> PUBLIC : No
>> PERSISTENT : No
>> SOURCE :
>> /srv/cloud/one/var//images/7c6f81fcb5b4dec12ab3fa63913b16b4ba1e2d12
>> STATE : disa
>> RUNNING_VMS : 0
>>
>> IMAGE
>> TEMPLATE
>> DEV_PREFIX=hd
>> NAME=318_archived
>>
>>
>>
>> $ ls -la
>> /srv/cloud/one/var//images/7c6f81fcb5b4dec12ab3fa63913b16b4ba1e2d12
>>
>> ###############################################################################
>> ls: cannot access
>> /srv/cloud/one/var//images/7c6f81fcb5b4dec12ab3fa63913b16b4ba1e2d12: No such
>> file or directory
>>
>>
>>
>> $ onevm delete 318
>>
>> ###############################################################################
>>
>>
>> $ onevm list
>>
>> ###############################################################################
>> ID USER NAME STAT CPU MEM HOSTNAME TIME
>>
>>
>> $ oneimage show 37
>>
>> ###############################################################################
>> IMAGE
>> INFORMATION
>> ID : 37
>> NAME : 318_archived
>> TYPE : OS
>> REGISTER TIME : 02/10 12:22:50
>> PUBLIC : No
>> PERSISTENT : No
>> SOURCE :
>> /srv/cloud/one/var//images/7c6f81fcb5b4dec12ab3fa63913b16b4ba1e2d12
>> STATE : rdy
>> RUNNING_VMS : 0
>>
>> IMAGE
>> TEMPLATE
>> DEV_PREFIX=hd
>> NAME=318_archived
>>
>>
>>
>> $ ls -la
>> /srv/cloud/one/var//images/7c6f81fcb5b4dec12ab3fa63913b16b4ba1e2d12
>>
>> ###############################################################################
>> ls: cannot access
>> /srv/cloud/one/var//images/7c6f81fcb5b4dec12ab3fa63913b16b4ba1e2d12: No such
>> file or directory
>>
>>
>>
>> $ cat $ONE_LOCATION/var/318/vm.log
>>
>> ###############################################################################
>> Thu Feb 10 12:20:36 2011 [DiM][I]: New VM state is ACTIVE.
>> Thu Feb 10 12:20:36 2011 [LCM][I]: New VM state is PROLOG.
>> Thu Feb 10 12:20:36 2011 [VM][I]: Virtual Machine has no context
>> Thu Feb 10 12:20:36 2011 [TM][I]: tm_clone.sh:
>> testbed00:/srv/cloud/one/testing/ttylinux.img
>> testbed07:/srv/cloud/one/var//318/images/disk.0
>> Thu Feb 10 12:20:36 2011 [TM][I]: tm_clone.sh: DST:
>> /srv/cloud/one/var//318/images/disk.0
>> Thu Feb 10 12:20:36 2011 [TM][I]: tm_clone.sh: Creating directory
>> /srv/cloud/one/var//318/images
>> Thu Feb 10 12:20:36 2011 [TM][I]: tm_clone.sh: Executed "mkdir -p
>> /srv/cloud/one/var//318/images".
>> Thu Feb 10 12:20:36 2011 [TM][I]: tm_clone.sh: Executed "chmod a+w
>> /srv/cloud/one/var//318/images".
>> Thu Feb 10 12:20:36 2011 [TM][I]: tm_clone.sh: Cloning
>> /srv/cloud/one/testing/ttylinux.img
>> Thu Feb 10 12:20:36 2011 [TM][I]: tm_clone.sh: Executed "cp -r
>> /srv/cloud/one/testing/ttylinux.img /srv/cloud/one/var//318/images/disk.0".
>> Thu Feb 10 12:20:36 2011 [TM][I]: tm_clone.sh: Executed "chmod a+rw
>> /srv/cloud/one/var//318/images/disk.0".
>> Thu Feb 10 12:20:36 2011 [LCM][I]: New VM state is BOOT
>> Thu Feb 10 12:20:36 2011 [VMM][I]: Generating deployment file:
>> /srv/cloud/one/var/318/deployment.0
>> Thu Feb 10 12:20:37 2011 [LCM][I]: New VM state is RUNNING
>> Thu Feb 10 12:24:31 2011 [VMM][W]: Ignored: LOG - 318 Driver command for
>> 318 cancelled
>>
>> Thu Feb 10 12:24:31 2011 [DiM][I]: New VM state is DONE
>> Thu Feb 10 12:24:31 2011 [TM][W]: Ignored: LOG - 318 tm_delete.sh:
>> Deleting /srv/cloud/one/var//318/images
>>
>> Thu Feb 10 12:24:31 2011 [TM][W]: Ignored: LOG - 318 tm_delete.sh:
>> Executed "rm -rf /srv/cloud/one/var//318/images".
>>
>> Thu Feb 10 12:24:31 2011 [TM][W]: Ignored: TRANSFER SUCCESS 318 -
>>
>> Thu Feb 10 12:24:31 2011 [VMM][W]: Ignored: CANCEL SUCCESS 318 Domain
>> one-318 destroyed
>>
>> Thu Feb 10 12:24:31 2011 [HKM][I]: Command execution fail:
>> /srv/cloud/one/share/hooks/image.rb 318
>> Thu Feb 10 12:24:31 2011 [HKM][I]: STDERR follows.
>> Thu Feb 10 12:24:31 2011 [HKM][I]: ExitCode: 255
>> Thu Feb 10 12:24:31 2011 [HKM][E]: Error executing Hook: image.
>>
>>
>>
>>
>> line 75 in $ONE_LOCATION/share/hooks/image.rb (result =
>> img_repo.update_source(image, source_path) outputs
>>
>> ###############################################################################
>> "No such file or directory - /srv/cloud/one/var/318/disk.0 or
>> /srv/cloud/one/var//images/7c6f81fcb5b4dec12ab3fa63913b16b4ba1e2d12"
>>
>>
>>
>>
>> On 02/10/2011 10:11 AM, Marco Strutz wrote:
>>
>> Hi.
>>
>> Thanks Carlos! I have managed to reproduce the behaviour by xmlrpc calls.
>> But for the long term it would be very handy to access the "saveas"
>> feature in one single xmlrpc call too so that it won't be necessary to
>> duplicate (onevm ruby) source code and validate it for each new Opennebula
>> release.
>>
>>
>> regards
>> Marco
>>
>> On 02/09/2011 11:20 AM, Carlos Martín Sánchez wrote:
>>
>> Hi Marco,
>>
>> The XML-RPC call requests an image id because the image has to be
>> created beforehand.
>> You can check how it is done in the oneimage command (it's a straight
>> forward ruby script), and then replicate the same steps in your code.
>>
>> Regards,
>> Carlos.
>> --
>> Carlos Martín, Engineer, MSc
>> Project Major Contributor
>> OpenNebula - The Open Source Toolkit for Cloud Computing
>> www.OpenNebula.org <http://www.opennebula.org/> | cmartin at opennebula.org
>>
>>
>> On 8 February 2011 17:03, Marco Strutz <marco.strutz at desy.de> wrote:
>>
>>> Hello.
>>>
>>> What is the best way to map the "onevm saveas" command [1] to OCCI or
>>> XMLRPC-Request? I need to save vm images but want to avoid using the
>>> command line interface.
>>>
>>> I cannot simply use the xmlrpc-call "one.vm.savedisk" [2] since I then
>>> would need to know the "image id where the disk will be saved". But this
>>> ID will be dynamically created by the "onevm saveas" command, right?
>>> Furthermore where should I place the <image_name> in the XMLRPC-call?
>>> The same problem with OCCI: Are there any attributes (perhaps for the
>>> <CONTEXTUALISATION> section) I can use for the "onevm saveas"?
>>>
>>>
>>>
>>> Thanks
>>> Marco
>>>
>>>
>>> [1]
>>> onevm saveas <vm_id> <disk_id> <image_name>
>>>
>>>
>>> [2]
>>> one.vm.savedisk
>>> ****************
>>> Type Data Type Description
>>> IN String the session string associated to the connected user. *
>>> *
>>> IN Int the virtual machine Id (vid) of the instance.
>>> IN Int disk id of the disk we want to save.
>>> IN Int image id where the disk will be saved.
>>> OUT Boolean true or false whenever is successful or not
>>> OUT String if an error occurs this is error message, otherwise
>>> it does not exist.
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opennebula.org
>>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>>
>>
>>
>>
>> _______________________________________________
>> Users mailing listUsers at lists.opennebula.orghttp://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20110211/84d5adf8/attachment-0002.htm>
More information about the Users
mailing list