[Libvir] Proposal for virtual devices described in XML

michel.ponceau at bull.net michel.ponceau at bull.net
Thu Sep 28 15:23:11 UTC 2006

When specified at device creation, vifname is put in XenStore directory 
/local/domain/0/backend/vif/<domID>/<vif_number>. All vifnames used in a 
domain are returned by Get "/xend/domain/<domID>?detail=1" and converted 
into XML "target" by virDomainGetXMLDesc.
For convenience, we could force the vifname, either at domain creation or 
in Attach, and ignore any "target" in "interface", except for Detach. The 
vifname value could be the sequence number of network device creation in 
domain (for Xen, it would be equal to vif number).

Veuillez répondre à "Daniel P. Berrange" <berrange at redhat.com>
Pour :  michel.ponceau at bull.net
cc :    libvir-list at redhat.com 
Objet : Re: [Libvir] Proposal for virtual devices described in XML

On Wed, Sep 27, 2006 at 05:21:33PM +0200, michel.ponceau at bull.net wrote:
> After comments from Daniel P. Berrange and from Bull people, my proposal 

> is reduced to following 2 functions:
> /* Create a virtual device attachment to backend */
> int virDomainAttachDevice(virDomainPtr domain, char *xml);

This is definitely a good way forward - it lets us re-use the existing
code for parsing device descriptions very easily.

> /* Destroy a virtual device attachment to backend */
> int virDomainDetachDevice(virDomainPtr domain, char *xml);
> /* @domain: pointer to domain object
> * @xml: pointer to XML description of one device
> * Returns 0 in case of success, -1 in case of failure. */

I was wondering whether we need to have the full XML block passed in
for detaching devices. Perhaps it is sufficient to just pass i nthe
target name of the device. Then again, some implementations may prefer
to have the full XML blob available to allow greater sanity checking
when detaching, so its probably worth while.

> The XML would be in same form as the part of domain description for a 
> single device, either <disk.../disk> or <interface.../interface>.

Very nice.

> The device is identified by its target name. This attribute is optional 
> for "interface" in domain description, but would become mandatory in 
> Attach/Detach description. It is not yet processed in Libvirt-0.1.6 
> xml.c (function virDomainParseXMLIfDesc). I have successfully tried the 
attached patch, which tranlates "target" 
> into Xen "vifname". (It processes "ip" attribute in same way, but my try 

> failed, maybe because address value was invalid for Xen).

I'm not sure I like the idea of having to explicitly set a vif name for
every guest NIC we define - principally because there's no straightforward
way for a user of this API to determine what VIF names are already in use,
vs free. It also seems XenD does not tell us what the vifname for running
domains are - although I think the info is in xenstore somewhere. I can 
why we need the vifname to detach the device though.

If we can find a way to fill in the vifname when dumping the XML, then 
would let a caller uniquely identify an existing device, without us 
requireing that vifnames are used when creating a domain/attaching a new
device (& thus let Xen still auto-allocate them)

|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20060928/695e4a78/attachment-0001.htm>

More information about the libvir-list mailing list