Ask Your Question
0

how to add feature flag to libvirt.xml

asked 2014-08-22 02:34:08 -0500

alissa gravatar image

Hi,

I am using Xen + libvirt combination. I can create linux instances without any problem. When i create windows os with Openstack, it gives 64-bit error or not found suitable host error. But when i use virt-manager, vb. to create windows vm on the same host, it operates normally.

when i compare two vm definition xml, there is a slight difference. they are a cpu flag which is "pae" and vm_mode. i have modified glance image to change the vm_mode. and i change it to "hvm". After this change suitable host error is gone, but 64-bit error continues.

libvirt.xml (created by openstack )

<features>
   <acpi/>
   <apic/>                                                                                            </features>

libvirt.xml (created by virt-manager )

<features>
   <acpi/>
   <pae/>
   <apic/>                                                                                            </features>

As you see "pae" feature flag does not exist in libvirt.xml file which is created created by openstack. If i manually add that flag to libvirt.xml, problem solves. But whenever i restart the instance, openstack removes that feature flag.

Can i add that flag with modifying glance image definition like vm_mode? Or how can i add it persistently while creating instance using that image?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2014-08-22 11:22:11 -0500

SamYaple gravatar image

updated 2014-08-22 12:50:05 -0500

There is no openstack method to allow for this. However, if you don't mind pae applying to _all_ guest, you can change the default config to include pae.

The file exists at nova/virt/libvirt/config.py. I have not tested it, but you should be able to patch it to the following and have it work

def __init__(self, **kwargs):
    super(LibvirtConfigGuest, self).__init__(root_name="domain",
                                             **kwargs)

    self.virt_type = None
    self.uuid = None
    self.name = None
    self.memory = 1024 * 1024 * 500
    self.vcpus = 1
    self.cpuset = None
    self.cpu = None
    self.cpu_shares = None
    self.cpu_quota = None
    self.cpu_period = None
    self.pae = True
    self.acpi = True
    self.apic = True
    self.clock = None
    self.sysinfo = None
    self.os_type = None
    self.os_loader = None
    self.os_kernel = None
    self.os_initrd = None
    self.os_cmdline = None
    self.os_root = None
    self.os_init_path = None
    self.os_boot_dev = None
    self.os_smbios = None
    self.devices = []

def _format_features(self, root):
    if self.acpi or self.apic or self.pae:
        features = etree.Element("features")
        if self.acpi:
            features.append(etree.Element("acpi"))
        if self.apic:
            features.append(etree.Element("apic"))
        if self.pae:
            features.append(etree.Element("pae"))
        root.append(features)
edit flag offensive delete link more

Comments

i think problem roots from libvirt driver, i research that. pea flag should add automatically to libvirt.xml openstack libvirt+xen driver does not add that. but virt-manager does that. may be it is a bug. i found that: http://www.redhat.com/archives/libvir-list/2010-August/msg00626.html (http://www.redhat.com/archives/libvir...)

alissa gravatar imagealissa ( 2014-08-23 04:58:25 -0500 )edit

Yea I noticed, the above changes should add pae. That file is what actually generates the libvirt.xml so making the changes and starting a new instance (or rebuilding an old one) you should see the pae flag.

SamYaple gravatar imageSamYaple ( 2014-08-23 15:29:42 -0500 )edit

do i have to make the changes from all config.py ? (on computes?, on controller?)

alissa gravatar imagealissa ( 2014-08-27 08:01:57 -0500 )edit

Good question. I want to say it is only needed on each compute. However! If you are goign to be changing the source, you should probably package the change and apply it everywhere for consistency.

SamYaple gravatar imageSamYaple ( 2014-08-27 11:51:33 -0500 )edit
0

answered 2014-08-22 06:21:14 -0500

dbaxps gravatar image

updated 2014-08-22 12:59:57 -0500

Before nova resume VMNAME update libvirt.xml via shell script based on substitution

   [root@icehouse1 ~(keystone_admin)]# cat pae.txt
    <features>
       <acpi/>
       <apic/>                                                                                           
    </features>
    [root@icehouse1 ~(keystone_admin)]# perl -plne 'print "<pae/>" if(/apic/);' pae.txt
    <features>
       <acpi/>
    <pae/>
       <apic/>                                                                                           
    </features>

PAE stands for P-hysical A-ddress E-xtension to access 4 GiB RAM on 32-bit systems

edit flag offensive delete link more

Comments

hi, thanks for reply. in xen documents, they clarify the pae feature flag as;

In 64-bit Xen, the pae flag indicates whether the CPU exposed supports long mode. So if you don't set the PAE flag on 64-bit Xen, you get a 32-bit PAE guest. If you do set the PAE flag, you get a 64-bit guest.

alissa gravatar imagealissa ( 2014-08-23 04:55:04 -0500 )edit
dbaxps gravatar imagedbaxps ( 2014-08-23 07:36:22 -0500 )edit

Run on Compute Node

#!/bin/bash
source  keystonerc_boris
V=`nova list | grep $1 | awk '{print $2}'`
perl -plne 'print "<pae/>" if(/apic/);' /var/lib/nova/instances/$V/libvirt.xml
echo "Starting "$1
nova resume $1
dbaxps gravatar imagedbaxps ( 2014-08-23 11:19:15 -0500 )edit

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

Stats

Asked: 2014-08-22 02:34:08 -0500

Seen: 1,130 times

Last updated: Aug 22 '14