On Fri, Jan 08, 2010 at 05:23:13PM +0000, Daniel P. Berrange wrote:
This patch introduces the support for giving all devices a short,
unique name, henceforth known as a 'device alias'. These aliases
are not set by the end user, instead being assigned by the hypervisor
if it decides it want to support this concept.
The QEMU driver sets them whenever using the -device arg syntax
and uses them for improved hotplug/hotunplug. it is the intent
that other APIs (block / interface stats & device hotplug) be
able to accept device alias names in the future.
The XML syntax is
<alias name="video0"/>
This may appear in any type of device that supports device info.
[...]
-static void virDomainDeviceInfoClearField(virDomainDeviceInfoPtr
info)
+static void virDomainDeviceInfoClearField(virDomainDeviceInfoPtr info, int alias, int
pciaddr)
{
- if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
+ if (alias)
+ VIR_FREE(info->alias);
+ if (pciaddr &&
+ info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
memset(&info->addr, 0, sizeof(info->addr));
info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE;
}
}
okay, now this routine really makes sense :-)
[...]
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index a6f7ab2..87fbba7 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -92,6 +92,7 @@ struct _virDomainDeviceDriveAddress {
typedef struct _virDomainDeviceInfo virDomainDeviceInfo;
typedef virDomainDeviceInfo *virDomainDeviceInfoPtr;
struct _virDomainDeviceInfo {
+ char *alias;
int type;
union {
virDomainDevicePCIAddress pci;
@@ -246,8 +247,6 @@ struct _virDomainNetDef {
char *ifname;
virDomainDeviceInfo info;
/* XXX figure out how to remove this */
- char *nic_name;
- /* XXX figure out how to remove this */
char *hostnet_name;
/* XXX figure out how to remove this */
int vlan;
and that gives a clear example of use, okay
ACK,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/