← Back to team overview

openstack team mailing list archive

Re: How to set vcpupin in guest XML?


Hi Daniel,

Thanks for your suggestion. I made some changes in config and it works fine. One more thing I wanted to ask is I want to add an attribute to xml. But I am not able to figure out how exactly libvirt is defining xml. I understand that config can only add the attributes that are defined in the xml. But how do I add a new attribute?

~Peeyush Gupta

 From: Daniel P. Berrange <berrange@xxxxxxxxxx>
To: Peeyush Gupta <gpeeyush@xxxxxxxxx> 
Cc: "openstack@xxxxxxxxxxxxxxxxxxx" <openstack@xxxxxxxxxxxxxxxxxxx> 
Sent: Tuesday, 23 July 2013 4:34 PM
Subject: Re: [Openstack] How to set vcpupin in guest XML?

On Tue, Jul 23, 2013 at 05:31:25PM +0800, Peeyush Gupta wrote:
> Hi all,
> I am working with openstack and I want to pin vcpus to pcpus in
> guest xml. Now, the pinning operation can be done using
> virsh vcpupin guestname vcpu pcpu
> But I want to do it using python API. I investigated the openstack
> code and found out that get_guest_config function in libvirt/driver.py
> is responsible for generation of guest XML file. Now, I tried to put
> vcpupin attribute here by guest.vcpupin or guest.cputune_vcpupin but
> none of them is working. Any idea what am I doing wrong? Or is this
> functionality not available with openstack?

The get_guest_config() function returns an instance of the
nova.virt.libvirt.config.LibvirtConfigGuest object. That class
has defined attributes for setting various parts of the XML
config. You can't simply set arbitrary attributes and expect
it to work - you'll need to define how it is exposed in the
LibvirtConfigGuest object (or one of the related classes
that it uses) and then impl the code to generate the XML dom
from that attribute.

|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-            http://virt-manager.org :|
|: http://autobuild.org       -o-        http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-      http://live.gnome.org/gtk-vnc :|

Follow ups