# Template from ON for KVM Node

**URL:** <https://forum.opennebula.io/t/template-from-on-for-kvm-node/5452>\
**Category:** Product Support\
**Created:** [December 18, 2017, 10:41pm UTC](https://forum.opennebula.io/t/template-from-on-for-kvm-node/5452 "2017-12-18T22:41:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![1115](https://avatars.discourse-cdn.com/v4/letter/1/9f8e36/32.png) [@1115](https://forum.opennebula.io/u/1115)\
**Post date:** [December 18, 2017, 10:41pm UTC](https://forum.opennebula.io/t/template-from-on-for-kvm-node/5452/1 "2017-12-18T22:41:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![madko](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/madko/32/4195_2.png) [@madko](https://forum.opennebula.io/u/madko)\
**Post date:** [December 19, 2017, 10:24am UTC](https://forum.opennebula.io/t/template-from-on-for-kvm-node/5452/2 "2017-12-19T10:24:16Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![1115](https://avatars.discourse-cdn.com/v4/letter/1/9f8e36/32.png) [@1115](https://forum.opennebula.io/u/1115)\
**Post date:** [December 19, 2017, 11:22am UTC](https://forum.opennebula.io/t/template-from-on-for-kvm-node/5452/3 "2017-12-19T11:22:19Z")

</div>

> [@madko](#):
>
> virsh list --all doesn’t show it anymore (which is normal behavior)

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

---

<div class="post-metadata">

**Author:** ![madko](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/madko/32/4195_2.png) [@madko](https://forum.opennebula.io/u/madko)\
**Post date:** [December 19, 2017, 2:56pm UTC](https://forum.opennebula.io/t/template-from-on-for-kvm-node/5452/4 "2017-12-19T14:56:03Z")

</div>

you can find the doc here [http://docs.opennebula.org/5.4/operation/vm\_management/vm\_instances.html](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.

---

<div class="post-metadata">

**Author:** ![atodorov\_storpool](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/atodorov_storpool/32/5327_2.png) [@atodorov\_storpool](https://forum.opennebula.io/u/atodorov_storpool)\
**Post date:** [December 20, 2017, 3:27pm UTC](https://forum.opennebula.io/t/template-from-on-for-kvm-node/5452/5 "2017-12-20T15:27:25Z")

</div>

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
