Ask Your Question
1

How to customize libvirt.xml for an instance ?

asked 2014-04-12 07:17:51 -0500

emanuele gravatar image

updated 2014-04-14 12:36:54 -0500

larsks gravatar image

Hello

I'm following the procedure at https://ask.openstack.org/en/question/5415/customize-libvirtxml-for-an-instance/ (https://ask.openstack.org/en/question...) but it doesn't seem to work. I'm on Havana.

This is what I see:

(1) No instance on the compute node

    root@node-12:~# virsh
    Welcome to virsh, the virtualization interactive terminal.

    Type:  'help' for help with commands
           'quit' to quit

virsh # list
 Id    Name                           State
----------------------------------------------------

(2) Create and boot an instance via Horizon, find the libvirt file and check it

virsh # list
 Id    Name                           State
----------------------------------------------------
 20    instance-0000000d              running

virsh #

root@node-12:~# ls -la /var/lib/nova/instances/
total 8
drwxr-xr-x  6 nova nova  136 Apr 12 11:50 .
drwxr-xr-x 10 nova nova  123 Mar 31 11:18 ..
drwxr-xr-x  2 nova nova   53 Apr 12 11:51 760a2891-da1a-40e1-b6de-ef6b9f029b09
more /var/lib/nova/instances/760a2891-da1a-40e1-b6de-ef6b9f029b09/libvirt.xml
    <system>
      <entry name="manufacturer">OpenStack Foundation</entry>
      <entry name="product">OpenStack Nova</entry>
      <entry name="version">2013.2.2</entry>
      <entry name="serial">d289170a-baff-42d0-b858-2268192cc682</entry>
      <entry name="uuid">760a2891-da1a-40e1-b6de-ef6b9f029b09</entry>
    </system>

(3) Modify the libvirt file of the instance ( changed the value of entry name "product" ) and save the file

more /var/lib/nova/instances/760a2891-da1a-40e1-b6de-ef6b9f029b09/libvirt.xml
<system>
      <entry name="manufacturer">OpenStack Foundation</entry>
      <entry name="product">Router in OpenStack Nova</entry>
      <entry name="version">2013.2.2</entry>
      <entry name="serial">d289170a-baff-42d0-b858-2268192cc682</entry>
      <entry name="uuid">760a2891-da1a-40e1-b6de-ef6b9f029b09</entry>
    </system>

(4) Follow the procedure explained at https://ask.openstack.org/en/question/5415/customize-libvirtxml-for-an-instance/ (https://ask.openstack.org/en/question...)

virsh # destroy instance-0000000d
Domain instance-0000000d destroyed

virsh # undefine instance-0000000d
Domain instance-0000000d has been undefined

virsh # define /var/lib/nova/instances/760a2891-da1a-40e1-b6de-ef6b9f029b09/libvirt.xml
Domain instance-0000000d defined from /var/lib/nova/instances/760a2891-da1a-40e1-b6de-ef6b9f029b09/libvirt.xml

virsh # start instance-0000000d
Domain instance-0000000d started

virsh # exit

(5) Check that the libvirt file is still modified, and then soft reboot (via Horizon) the instance

more /var/lib/nova/instances/760a2891-da1a-40e1-b6de-ef6b9f029b09/libvirt.xml
    <system>
      <entry name="manufacturer">OpenStack Foundation</entry>
      <entry name="product">Router in OpenStack Nova</entry>
      <entry name="version">2013.2.2</entry>
      <entry name="serial">d289170a-baff-42d0-b858-2268192cc682</entry>
      <entry name="uuid">760a2891-da1a-40e1-b6de-ef6b9f029b09</entry>
    </system>

( soft reboot via Horizon )

(6) After soft reboot check the libvirt file; entry name "product" is back to the original value

more /var/lib/nova/instances/760a2891-da1a-40e1-b6de-ef6b9f029b09/libvirt.xml
    <system>
      <entry name="manufacturer">OpenStack Foundation</entry>
      <entry name="product">OpenStack Nova</entry>
      <entry name="version">2013.2.2</entry>
      <entry name="serial">d289170a-baff-42d0-b858-2268192cc682</entry>
      <entry name="uuid">760a2891-da1a-40e1-b6de-ef6b9f029b09</entry>
    </system>

Of course I don't really care about changing the entry name "product", but this is just to show that even what I believe was a cosmetic change is not possible (at least in my scenario)

Any suggestion ? Anybody able to reproduce the same behavior ?

E.

edit retag flag offensive close merge delete

Comments

Hi, have you resolved the issue? I've the same problem.

UgoGio gravatar imageUgoGio ( 2015-12-01 13:05:17 -0500 )edit

4 answers

Sort by ยป oldest newest most voted
0

answered 2015-02-15 00:04:10 -0500

some settings, such as hardware video driver cirrus, vesa, or qxl. can be defined in the glance image metadata. However, this likely will need to be supported through libvirt. I have been able to get qxl and video ram modified this way in Icehouse.

I also had to modify the flavor's max video ram size.

edit flag offensive delete link more

Comments

hmmm, do you have any more detail informations? is there an given list for valid metadata? maybe you can give an example how to change the system product name?

Volker gravatar imageVolker ( 2019-02-14 14:48:59 -0500 )edit
0

answered 2019-02-16 11:03:19 -0500

Volker gravatar image

checkout this file: /etc/nova/release

here you can change in global style the given "product name", maybe its helps...

greez, volker...

edit flag offensive delete link more
0

answered 2014-04-14 00:05:45 -0500

waqasriaz gravatar image

updated 2014-04-15 10:16:38 -0500

I faced the same problem. I found out that restarting VM via openstack drops the changes in libvirt xml.

Rebooting from virsh after changing libvirt xml will not undo the changes. e.g

virsh reboot instance-0000000d

However if you want to add your customization through openstack, you may add your changes in following files.

libvirt xml is created in nova/virt/libvirt/driver.py and its configuration classes are defined in nova/virt/libvirt/config.py

edit flag offensive delete link more

Comments

Ok ... for the records here is the result

virsh # reboot instance-0000000d
error: Failed to reboot domain instance-0000000d
error: Requested operation is not valid: Reboot is not supported without the JSON monitor

virsh # list
Id    Name                           State
----------------------------------------------------

Googling around it seems I would need to rebuilt libvirt manually to include yajl-devel libraries ....

Before I go on and try to do that, allow me one question: where does Openstack define the libvirt.xml template that is enforced everytime an instance is booted/rebooted ?

emanuele gravatar imageemanuele ( 2014-04-15 02:17:53 -0500 )edit

libvirt xml is created in nova/virt/libvirt/driver.py and its configuration classes are defined in nova/virt/libvirt/config.py .... if you want to add your customization through openstack, you may add your changes in these files.

waqasriaz gravatar imagewaqasriaz ( 2014-04-15 10:17:16 -0500 )edit

Perfect, nova resize may fail while increasing the memory(RAM) with CPU pinning. Updated /usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py function _get_cpu_numa_config_from_instance with a if condition to match memory.

kranthi.guttikonda9@gmail.com gravatar imagekranthi.guttikonda9@gmail.com ( 2017-04-12 16:19:30 -0500 )edit
0

answered 2014-12-16 01:30:59 -0500

LainesStack gravatar image

Is there any update on this? Facing the same issue and don't want to edit the code when it could be so easy to just edit the XML file...

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

3 followers

Stats

Asked: 2014-04-12 07:17:51 -0500

Seen: 12,049 times

Last updated: Feb 15 '15