# VM creation failure on XEN host

**URL:** <https://forum.opennebula.io/t/vm-creation-failure-on-xen-host/2313>\
**Category:** Product Support\
**Created:** [May 31, 2016, 1:09pm UTC](https://forum.opennebula.io/t/vm-creation-failure-on-xen-host/2313 "2016-05-31T13:09:32Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![jojo](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/jojo/32/4953_2.png) [@jojo](https://forum.opennebula.io/u/jojo)\
**Post date:** [July 6, 2016, 3:28pm UTC](https://forum.opennebula.io/t/vm-creation-failure-on-xen-host/2313/21 "2016-07-06T15:28:25Z")

</div>

Hi Hector,  
thanks so much for your post. This clarifies a lot!!!

And because you mentioned a manual edit of deployment file:

I recently tried to edit deployment files manually (actually because of another issue) and could not figure out how I should actually do it without having OpenNebula write a new deyployment file and change it back to the original contents (iterations of file deployment.0 deployment.1 .2… after shutting off and on the VM)

I don’t have a system at hand at the moment to try it out again, but may I ask you to confirm that it should work in this order:

First, edit the currently used deployment.X file, then destroy the original one vm:

`virsh destroy one-xxx`  
`virsh undefine one-xxx`

then

`virsh define /var/lib/one/...../deployment.X`  
`virsh start one-xxx`

then recover the failed vm (using which version of recover? --retry?):

`onevm recover --????? one-xxx`

And BTW do you know where exactely the deployment.X file is coming from?  
Obviously it is once generated from information in the onetemplate, oneimage, etc., ok.

Is it then copied into the database? And on every fresh VM start/define it is pulled from the database and depyloyment.X is regenerated from there?

It is definitely never again pulled out of the onetemplate, etc informations again. That’s what I already found out.

Maybe you can shed some light on this as well. I am curious.

Thanks again!  
all the best  
Jojo

---

<div class="post-metadata">

**Author:** ![hsanjuan](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/hsanjuan/32/4372_2.png) [@hsanjuan](https://forum.opennebula.io/u/hsanjuan)\
**Post date:** [July 6, 2016, 4:28pm UTC](https://forum.opennebula.io/t/vm-creation-failure-on-xen-host/2313/22 "2016-07-06T16:28:40Z")

</div>

> I recently tried to edit deployment files manually (actually because of another issue) and could not figure out how I should actually do it without having OpenNebula write a new deyployment file and change it back to the original contents (iterations of file deployment.0 deployment.1 .2… after shutting off and on the VM)

Right… The quick-dirty way I have thought of to achieve a fix without needing manual intervention every time would be to patch the remote/vmm/xen/deploy script and do a `sed -i` in the deployment file right before the `xl create` command is called. This would be a way to fix the deployment file every time it is used to create the VMs which does not require the recompile OpenNebula and can be distributed easily (`onehost sync --force` if I remember well). I haven’t tried it though, it’s just a solution I have in mind.

> And BTW do you know where exactely the deployment.X file is coming from?

From XenDriver.cc (`deployment_description()`) function it seems. If you feel like rolling out your own custom-built OpenNebula, then you can change the relevant line on that file to make all context disks in HVM writeable.

> I don’t have a system at hand at the moment to try it out again, but may I ask you to confirm that it should work in this order:

I haven’t used `virsh` in a long time, and OpenNebula Xen drivers use `xl` or `xm` directly. They run `xl create path/to/deployment.X` but this fails, so the manual fix is editing `deployment.X` and then running `xl create` manually. Then `onevm recover $id --success` for the VM, which then turns from FAILED to RUNNING state correctly.

---

<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:** [July 6, 2016, 10:03pm UTC](https://forum.opennebula.io/t/vm-creation-failure-on-xen-host/2313/23 "2016-07-06T22:03:14Z")

</div>

Hi,

> [@hsanjuan](#):
>
> > I recently tried to edit deployment files manually (actually because of another issue) and could not figure out how I should actually do it without having OpenNebula write a new deyployment file and change it back to the original contents (iterations of file deployment.0 deployment.1 .2… after shutting off and on the VM)
> 
> Right… The quick-dirty way I have thought of to achieve a fix without needing manual intervention every time would be to patch the remote/vmm/xen/deploy script and do a sed -i in the deployment file right before the xl create command is called. This would be a way to fix the deployment file every time it is used to create the VMs which does not require the recompile OpenNebula and can be distributed easily (onehost sync --force if I remember well). I haven’t tried it though, it’s just a solution I have in mind.

I can confirm that patching the deploy script and adding custom tweaking is working.

For more advanced editing you can use more complicated scripts. For example, here is my work to enable virtio-blk-data-plane on KVM hosts:

> <https://github.com/OpenNebula/addon-storpool/blob/master/vmm/kvm/vmTweakVirtioBlkDataPlane.py>

Kind Regards,  
Anton Todorov

---

<div class="post-metadata">

**Author:** ![jojo](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/jojo/32/4953_2.png) [@jojo](https://forum.opennebula.io/u/jojo)\
**Post date:** [July 7, 2016, 8:12am UTC](https://forum.opennebula.io/t/vm-creation-failure-on-xen-host/2313/24 "2016-07-07T08:12:39Z")

</div>

Hi Hector

sorry for the confusion, actually i tried editing deployment files by hand on a kvm system recently! that’s why I mentioned the virsh commands. my experience though was that after the recovery of the vm the settings in the deployment file where changed back to the original state. perhaps I should experiment with this once more and also use the --success option.

thanks for the hint to the xendriver function, i will try to find the similar function in the kvm driver.

I actually did a lot of testing with Xen Hypervisors but then found a way to migrate my customers existing xen vms to kvm with minimal effort and decided to go this way. that’s why i am mixing things up a little here 😉

Hi Anton,  
I’ll read your code later today! Thanks!

all the best  
Jojo

[Previous page](https://forum.opennebula.io/t/vm-creation-failure-on-xen-host/2313.md?page=1)
