Recreate virsh xml

Sean Mooney smooney at
Tue May 24 10:26:11 UTC 2022

On Tue, 2022-05-24 at 10:06 +0000, Szabo, Istvan (Agoda) wrote:
> Hi,
> I have a node which has been live-migrated to another node and it is running on the new node BUT there isn't any xml definition file (/etc/libvirt/qemu/instance-*.xml) of it which is automatically generated.
> How I solve this issue normally is to respawn that vm with the same disk and ip that it has before, but I wonder is there any easier way to just simply recreate the automatically generated definition file.
you normally would jsut regenerate the xml by hard rebooting the instance
but the instace-id can change when you live migate so if you check with teh admin clint it might be presenct jsut with a differnt name.

if you want stable xml path you can change the template we use to say use the instance uuid.

the default is "instance-%08x"
i prefer to use "instance-%(uuid)s"

we proably should change that default at some point.
there is currently an upgrade impact to changing this but with a minor code chage we coudl actully workaroudn that
we just need to store the current namein the instance_system_metadata table and only use the new default for new isntances.

> The file which I'm talking about auto generated is this one: /etc/libvirt/qemu/instance-*.xml starts like this so I guess I can't create by myself.
> <!--
> OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
>   virsh edit instance-00006580
> or other application using the libvirt API.
> -->
> <domain type='kvm'>
>   <name>instance-00006580</name>
>   <uuid>ac8cf83e-6819-417a-9f83-de73c28567e9</uuid>
>   <metadata>
> ....
> Thank you
> ________________________________
> This message is confidential and is for the sole use of the intended recipient(s). It may also be privileged or otherwise protected by copyright or other legal rules. If you have received it by mistake please let us know by reply email and delete it from your system. It is prohibited to copy this message or disclose its content to anyone. Any confidentiality or privilege is not waived or lost by any mistaken delivery or unauthorized disclosure of the message. All messages sent to and from Agoda may be monitored to ensure compliance with company policies, to protect the company's interests and to remove potential malware. Electronic messages may be intercepted, amended, lost or deleted, or contain viruses.

More information about the openstack-discuss mailing list