Since the address element is much easier extendible by attributes adding
more and more elements, starting with <uuid>, to the <source> element
once we find out we need more data to identify a mediated device. By
introducing a new address type rather than using plain elements, we also
remain consistent with all other devices that can make use of the
address element.
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
src/conf/device_conf.h | 1 +
src/conf/domain_conf.c | 11 +++++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index f435fb5..8b67208 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -47,6 +47,7 @@ typedef enum {
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM,
+ VIR_DOMAIN_DEVICE_ADDRESS_TYPE_MDEV,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST
} virDomainDeviceAddressType;
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 4911b0b..053f3cb 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -259,7 +259,8 @@ VIR_ENUM_IMPL(virDomainDeviceAddress,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST,
"ccw",
"virtio-mmio",
"isa",
- "dimm")
+ "dimm",
+ "mdev")
VIR_ENUM_IMPL(virDomainDiskDevice, VIR_DOMAIN_DISK_DEVICE_LAST,
"disk",
@@ -3289,6 +3290,7 @@ int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
return virDomainDeviceCCWAddressIsValid(&info->addr.ccw);
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB:
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_MDEV:
return 1;
}
@@ -3381,6 +3383,7 @@ virDomainDeviceInfoAddressIsEqual(const virDomainDeviceInfo *a,
/* address types below don't have any specific data */
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO:
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390:
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_MDEV:
break;
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
@@ -5129,7 +5132,8 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
}
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE ||
- info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)
+ info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390 ||
+ info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_MDEV)
return 0;
/* We'll be in domain/devices/[device type]/ so 3 level indent */
@@ -5212,6 +5216,7 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
break;
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390:
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_MDEV:
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE:
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST:
break;
@@ -5773,6 +5778,7 @@ virDomainDeviceInfoParseXML(xmlNodePtr node,
goto cleanup;
break;
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_MDEV:
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE:
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST:
break;
@@ -18540,6 +18546,7 @@ virDomainDeviceInfoCheckABIStability(virDomainDeviceInfoPtr src,
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390:
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW:
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO:
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_MDEV:
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE:
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST:
break;
--
2.10.2