Template from ON for KVM Node

Hello.
I have Opennebula on Cent OS 7 and KVM Node on Cent OS.
I create a template with the help of ON (image cd + image hdd ), and i noted that, when i stop VM with help of ON button “Power off HARD” (Simple Power off doesn’t work at all) , my VM was deleted from KVM Node.
When first i try to stop VM from KVM and after push Power Off HARD in ON, now VM exists.
But When i start VM from ON , it try to create one more machine with the same name.
In Log,when i try start VM from ON
Tue Dec 19 01:26:08 2017 [Z0][VM][I]: New state is ACTIVE
Tue Dec 19 01:26:08 2017 [Z0][VM][I]: New LCM state is BOOT_POWEROFF
Tue Dec 19 01:26:08 2017 [Z0][VMM][I]: Generating deployment file: /var/lib/one/vms/21/deployment.13
Tue Dec 19 01:26:09 2017 [Z0][VMM][I]: Successfully execute transfer manager driver operation: tm_context.
Tue Dec 19 01:26:09 2017 [Z0][VMM][I]: Successfully execute network driver operation: pre.
Tue Dec 19 01:26:09 2017 [Z0][VMM][I]: Command execution fail: cat << EOT | /var/tmp/one/vmm/kvm/deploy ‘/var/lib/one//datastores/112/21/deployment.13’ ‘80.249.81.234’ 21 80.249.81.234
Tue Dec 19 01:26:09 2017 [Z0][VMM][I]: error: Failed to create domain from /var/lib/one//datastores/112/21/deployment.13
Tue Dec 19 01:26:09 2017 [Z0][VMM][I]: error: operation failed: domain ‘one-21’ already exists with uuid b821c234-f6b4-44cb-b39d-61d8608fb54b
Tue Dec 19 01:26:09 2017 [Z0][VMM][E]: Could not create domain from /var/lib/one//datastores/112/21/deployment.13
Tue Dec 19 01:26:09 2017 [Z0][VMM][I]: ExitCode: 255
Tue Dec 19 01:26:09 2017 [Z0][VMM][I]: Failed to execute virtualization driver operation: deploy.
Tue Dec 19 01:26:09 2017 [Z0][VMM][E]: Error deploying virtual machine: Could not create domain from /var/lib/one//datastores/112/21/deployment.13
Tue Dec 19 01:26:09 2017 [Z0][VM][I]: New state is POWEROFF
Tue Dec 19 01:26:09 2017 [Z0][VM][I]: New LCM state is LCM_INIT

Please, describe, how i can create correct template from ON , which will be work as expected

When you click on poweroff your vm has to know how to deal with ACPI poweroff signal. If you use the CentOS 7.x template from marketplace it’s the case.

When you poweroff a VM it is expected that the VM is deleted from the KVM node. Then when you resume it, it will be back on your KVM node. So I don’t understand your question. Please read the documentation first. Or be more precise when you say the VM is deleted from the KVM node, what does it mean ? virsh list --all doesn’t show it anymore (which is normal behavior), or the images are deleted from the datastore ? Btw what kind of datastore are you using ? (local or shared)

Did you install the contextalisation RPM inside your VM ?

sorry, i thought , that it should show all my vm, with state shutoff too.
when install with template, after poweroff/power on disk become empty.
if it was discribed in documentation, please, give me link, cause i don’t note this moment

you can find the doc here http://docs.opennebula.org/5.4/operation/vm_management/vm_instances.html

ex:
Prolog The system is transferring the VM files (disk images and the recovery file) to the host in which the virtual machine will be running.

Epilog In this phase the system cleans up the Host used to virtualize the VM, and additionally disk images to be saved are copied back to the system datastore.

1 Like

Hi,

I would like to clarify - epilog is called on undeploy(-hard) and terminate(-hard), _prolog_is called on deploy. It is shown in the graph at the beginning of the link provided by @madko.

There are no storage related operations issued on suspend and poweroff(-hard) so it is weird to have VM disk files disappear on poweroff

Best Regards,
Anton Todorov