Currently this enum is defined in domain_conf.h and named
virDomainHostdevSubsysPCIDriverType. I want to use it in parts of the
network and networkport config, so am moving its definition to
device_conf.h which is / can be included by all interested parties,
and renaming it to match the name of the corresponding XML attribute
("driver name"). The name change (which includes enum values) does cause a
lot of churn, but it's all mechanical.
Signed-off-by: Laine Stump <laine(a)redhat.com>
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>
---
Change from V2: the name of the enum and its values has changed
(due to my decision to no longer repurpose the driver name attribute)
src/conf/device_conf.c | 9 ++++++++
src/conf/device_conf.h | 12 +++++++++++
src/conf/domain_capabilities.c | 2 +-
src/conf/domain_capabilities.h | 2 +-
src/conf/domain_conf.c | 36 ++++++++++++--------------------
src/conf/domain_conf.h | 14 +------------
src/hypervisor/virhostdev.c | 8 +++----
src/libvirt_private.syms | 2 +-
src/libxl/libxl_capabilities.c | 3 +--
src/libxl/libxl_domain.c | 6 +++---
src/libxl/libxl_driver.c | 4 ++--
src/qemu/qemu_capabilities.c | 4 ++--
src/qemu/qemu_command.c | 12 +++++------
src/qemu/qemu_domain.c | 22 +++++++++----------
src/qemu/qemu_validate.c | 2 +-
src/security/security_apparmor.c | 2 +-
src/security/security_dac.c | 4 ++--
src/security/security_selinux.c | 4 ++--
src/security/virt-aa-helper.c | 7 ++++---
src/test/test_driver.c | 14 ++++++-------
tests/domaincapstest.c | 4 ++--
tests/virhostdevtest.c | 2 +-
tools/virsh-completer-nodedev.c | 4 ++--
23 files changed, 89 insertions(+), 90 deletions(-)
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index f3d977f2b7..a80b901214 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -29,6 +29,15 @@
#define VIR_FROM_THIS VIR_FROM_DEVICE
+VIR_ENUM_IMPL(virDeviceHostdevPCIDriverName,
+ VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST,
+ "default",
+ "kvm",
+ "vfio",
+ "xen",
+);
+
+
VIR_ENUM_IMPL(virDomainDeviceAddress,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST,
"none",
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index a83377417a..18aa4125fa 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -31,6 +31,18 @@
#include "virnetdev.h"
#include "virenum.h"
+/* the backend driver used for PCI hostdev devices */
+typedef enum {
+ VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT = 0, /* detect automatically, prefer VFIO
*/
+ VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_KVM, /* force legacy kvm style */
+ VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO, /* force vfio */
+ VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN, /* force legacy xen style, use pciback */
+
+ VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST
+} virDeviceHostdevPCIDriverName;
+
+VIR_ENUM_DECL(virDeviceHostdevPCIDriverName);
+
typedef enum {
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE = 0,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI,
diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index f6e09dc584..68eb3c9797 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -524,7 +524,7 @@ virDomainCapsDeviceHostdevFormat(virBuffer *buf,
ENUM_PROCESS(hostdev, startupPolicy, virDomainStartupPolicyTypeToString);
ENUM_PROCESS(hostdev, subsysType, virDomainHostdevSubsysTypeToString);
ENUM_PROCESS(hostdev, capsType, virDomainHostdevCapsTypeToString);
- ENUM_PROCESS(hostdev, pciBackend, virDomainHostdevSubsysPCIBackendTypeToString);
+ ENUM_PROCESS(hostdev, pciBackend, virDeviceHostdevPCIDriverNameTypeToString);
FORMAT_EPILOGUE(hostdev);
}
diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h
index 01bcfa2e39..fadc30cdd7 100644
--- a/src/conf/domain_capabilities.h
+++ b/src/conf/domain_capabilities.h
@@ -99,7 +99,7 @@ STATIC_ASSERT_ENUM(VIR_DOMAIN_HOSTDEV_MODE_LAST);
STATIC_ASSERT_ENUM(VIR_DOMAIN_STARTUP_POLICY_LAST);
STATIC_ASSERT_ENUM(VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST);
STATIC_ASSERT_ENUM(VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST);
-STATIC_ASSERT_ENUM(VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST);
+STATIC_ASSERT_ENUM(VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST);
typedef struct _virDomainCapsDeviceHostdev virDomainCapsDeviceHostdev;
struct _virDomainCapsDeviceHostdev {
virTristateBool supported;
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 22ad43e1d7..e7e6296f9c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1054,13 +1054,6 @@ VIR_ENUM_IMPL(virDomainHostdevSubsys,
"mdev",
);
-VIR_ENUM_IMPL(virDomainHostdevSubsysPCIBackend,
- VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST,
- "default",
- "kvm",
- "vfio",
- "xen",
-);
VIR_ENUM_IMPL(virDomainHostdevSubsysSCSIProtocol,
VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST,
@@ -6290,7 +6283,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
driver_node = virXPathNode("./driver", ctxt);
if (virXMLPropEnum(driver_node, "name",
- virDomainHostdevSubsysPCIBackendTypeFromString,
+ virDeviceHostdevPCIDriverNameTypeFromString,
VIR_XML_PROP_NONZERO,
&pcisrc->backend) < 0)
return -1;
@@ -23387,8 +23380,8 @@ virDomainHostdevDefFormatSubsysPCI(virBuffer *buf,
virBufferAsprintf(&sourceAttrBuf, "
writeFiltering='%s'",
virTristateBoolTypeToString(def->writeFiltering));
- if (pcisrc->backend != VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
- const char *backend =
virDomainHostdevSubsysPCIBackendTypeToString(pcisrc->backend);
+ if (pcisrc->backend != VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT) {
+ const char *backend =
virDeviceHostdevPCIDriverNameTypeToString(pcisrc->backend);
if (!backend) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -29919,18 +29912,15 @@ virDomainNetDefActualFromNetworkPort(virDomainNetDef *iface,
actual->data.hostdev.def.source.subsys.u.pci.addr =
port->plug.hostdevpci.addr;
switch ((virNetworkForwardDriverNameType)port->plug.hostdevpci.driver) {
case VIR_NETWORK_FORWARD_DRIVER_NAME_DEFAULT:
- actual->data.hostdev.def.source.subsys.u.pci.backend =
- VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT;
+ actual->data.hostdev.def.source.subsys.u.pci.backend =
VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT;
break;
case VIR_NETWORK_FORWARD_DRIVER_NAME_KVM:
- actual->data.hostdev.def.source.subsys.u.pci.backend =
- VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM;
+ actual->data.hostdev.def.source.subsys.u.pci.backend =
VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_KVM;
break;
case VIR_NETWORK_FORWARD_DRIVER_NAME_VFIO:
- actual->data.hostdev.def.source.subsys.u.pci.backend =
- VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO;
+ actual->data.hostdev.def.source.subsys.u.pci.backend =
VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO;
break;
case VIR_NETWORK_FORWARD_DRIVER_NAME_LAST:
@@ -30041,26 +30031,26 @@ virDomainNetDefActualToNetworkPort(virDomainDef *dom,
port->plug.hostdevpci.managed =
virTristateBoolFromBool(actual->data.hostdev.def.managed);
port->plug.hostdevpci.addr =
actual->data.hostdev.def.source.subsys.u.pci.addr;
switch (actual->data.hostdev.def.source.subsys.u.pci.backend) {
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT:
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT:
port->plug.hostdevpci.driver = VIR_NETWORK_FORWARD_DRIVER_NAME_DEFAULT;
break;
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM:
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_KVM:
port->plug.hostdevpci.driver = VIR_NETWORK_FORWARD_DRIVER_NAME_KVM;
break;
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO:
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO:
port->plug.hostdevpci.driver = VIR_NETWORK_FORWARD_DRIVER_NAME_VFIO;
break;
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN:
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Unexpected PCI backend 'xen'"));
break;
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST:
default:
- virReportEnumRangeError(virDomainHostdevSubsysPCIBackendType,
+ virReportEnumRangeError(virDeviceHostdevPCIDriverName,
actual->data.hostdev.def.source.subsys.u.pci.backend);
return NULL;
}
@@ -31005,7 +30995,7 @@ virHostdevIsVFIODevice(const virDomainHostdevDef *hostdev)
{
return hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
- hostdev->source.subsys.u.pci.backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO;
+ hostdev->source.subsys.u.pci.backend ==
VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO;
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ed07859bc5..0582cc928d 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -201,18 +201,6 @@ typedef enum {
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST
} virDomainHostdevSubsysType;
-/* the backend driver used for PCI hostdev devices */
-typedef enum {
- VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT = 0, /* detect automatically, prefer VFIO */
- VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM, /* force legacy kvm style */
- VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO, /* force vfio */
- VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN, /* force legacy xen style, use pciback */
-
- VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST
-} virDomainHostdevSubsysPCIBackendType;
-
-VIR_ENUM_DECL(virDomainHostdevSubsysPCIBackend);
-
typedef enum {
VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE,
VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI,
@@ -247,7 +235,7 @@ struct _virDomainHostdevSubsysUSB {
struct _virDomainHostdevSubsysPCI {
virPCIDeviceAddress addr; /* host address */
- virDomainHostdevSubsysPCIBackendType backend;
+ virDeviceHostdevPCIDriverName backend;
virBitmap *origstates;
};
diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c
index 4672bd8785..26c9ac3c28 100644
--- a/src/hypervisor/virhostdev.c
+++ b/src/hypervisor/virhostdev.c
@@ -243,14 +243,14 @@ virHostdevGetPCIHostDevice(const virDomainHostdevDef *hostdev,
virPCIDeviceSetManaged(actual, hostdev->managed);
- if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
+ if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_VFIO);
- } else if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN) {
+ } else if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN) {
virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_XEN);
} else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("pci backend driver '%1$s' is not
supported"),
-
virDomainHostdevSubsysPCIBackendTypeToString(pcisrc->backend));
+ _("pci backend driver type '%1$s' is not
supported"),
+ virDeviceHostdevPCIDriverNameTypeToString(pcisrc->backend));
return -1;
}
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 553b01b8c0..002a3986d1 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -126,6 +126,7 @@ virCPUModeTypeToString;
# conf/device_conf.h
virCCWDeviceAddressParseXML;
+virDeviceHostdevPCIDriverNameTypeToString;
virDeviceInfoPCIAddressExtensionIsPresent;
virDeviceInfoPCIAddressExtensionIsWanted;
virDeviceInfoPCIAddressIsPresent;
@@ -467,7 +468,6 @@ virDomainHostdevInsert;
virDomainHostdevMatch;
virDomainHostdevModeTypeToString;
virDomainHostdevRemove;
-virDomainHostdevSubsysPCIBackendTypeToString;
virDomainHostdevSubsysSCSIVHostModelTypeFromString;
virDomainHostdevSubsysSCSIVHostModelTypeToString;
virDomainHostdevSubsysTypeToString;
diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
index 177e8b988e..de88c00e15 100644
--- a/src/libxl/libxl_capabilities.c
+++ b/src/libxl/libxl_capabilities.c
@@ -630,8 +630,7 @@ libxlMakeDomainDeviceHostdevCaps(virDomainCapsDeviceHostdev *dev)
virDomainCapsEnumClear(&dev->capsType);
virDomainCapsEnumClear(&dev->pciBackend);
- VIR_DOMAIN_CAPS_ENUM_SET(dev->pciBackend,
- VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN);
+ VIR_DOMAIN_CAPS_ENUM_SET(dev->pciBackend,
VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN);
return 0;
}
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 0c4beffd6a..88d977e79b 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -160,8 +160,8 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDef *dev,
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI
&&
- pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT)
- pcisrc->backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN;
+ pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT)
+ pcisrc->backend = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN;
}
if (dev->type == VIR_DOMAIN_DEVICE_VIDEO) {
@@ -997,7 +997,7 @@ libxlNetworkPrepareDevices(virDomainDef *def)
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
- pcisrc->backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN;
+ pcisrc->backend = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN;
if (virDomainHostdevInsert(def, hostdev) < 0)
return -1;
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index c98d2d737a..d7f79089c3 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -3398,12 +3398,12 @@ libxlDomainAttachNetDevice(libxlDriverPrivate *driver,
virDomainHostdevSubsysPCI *pcisrc = &hostdev->source.subsys.u.pci;
/* For those just allocated from a network pool whose backend is
- * still VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT, we need to set
+ * still VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT, we need to set
* backend correctly.
*/
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
- pcisrc->backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN;
+ pcisrc->backend = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN;
/* This is really a "smart hostdev", so it should be attached
* as a hostdev (the hostdev code will reach over into the
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 83119e871a..1a3d75eeab 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -6352,8 +6352,8 @@ virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCaps *qemuCaps,
if (supportsPassthroughVFIO &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) {
VIR_DOMAIN_CAPS_ENUM_SET(hostdev->pciBackend,
- VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT,
- VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO);
+ VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT,
+ VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO);
}
}
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 23909dbbab..2f0b1d0acd 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4709,16 +4709,16 @@ qemuBuildPCIHostdevDevProps(const virDomainDef *def,
/* caller has to assign proper passthrough backend type */
switch (pcisrc->backend) {
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO:
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO:
break;
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM:
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT:
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN:
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_KVM:
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT:
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN:
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("invalid PCI passthrough type '%1$s'"),
-
virDomainHostdevSubsysPCIBackendTypeToString(pcisrc->backend));
+ virDeviceHostdevPCIDriverNameTypeToString(pcisrc->backend));
return NULL;
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 953808fcfe..1e2b74af02 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -10531,7 +10531,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDef *dev,
case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS:
switch (dev->source.subsys.type) {
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
- if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
+ if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
if (!(tmpPath =
virPCIDeviceAddressGetIOMMUGroupDev(&pcisrc->addr)))
return -1;
@@ -11302,14 +11302,14 @@ qemuDomainPrepareHostdevPCI(virDomainHostdevDef *hostdev,
virQEMUCaps *qemuCaps)
{
bool supportsPassthroughVFIO = qemuHostdevHostSupportsPassthroughVFIO();
- virDomainHostdevSubsysPCIBackendType *backend =
&hostdev->source.subsys.u.pci.backend;
+ virDeviceHostdevPCIDriverName *driverName =
&hostdev->source.subsys.u.pci.backend;
/* assign defaults for hostdev passthrough */
- switch (*backend) {
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT:
+ switch (*driverName) {
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT:
if (supportsPassthroughVFIO) {
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) {
- *backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO;
+ *driverName = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO;
} else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("VFIO PCI device assignment is not supported by
this version of QEMU"));
@@ -11322,7 +11322,7 @@ qemuDomainPrepareHostdevPCI(virDomainHostdevDef *hostdev,
}
break;
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO:
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO:
if (!supportsPassthroughVFIO) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("host doesn't support VFIO PCI
passthrough"));
@@ -11330,20 +11330,20 @@ qemuDomainPrepareHostdevPCI(virDomainHostdevDef *hostdev,
}
break;
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM:
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_KVM:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("host doesn't support legacy PCI passthrough"));
return false;
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN:
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("QEMU does not support device assignment mode
'%1$s'"),
- virDomainHostdevSubsysPCIBackendTypeToString(*backend));
+ virDeviceHostdevPCIDriverNameTypeToString(*driverName));
return false;
default:
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
- virReportEnumRangeError(virDomainHostdevSubsysPCIBackendType, *backend);
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST:
+ virReportEnumRangeError(virDeviceHostdevPCIDriverName, *driverName);
break;
}
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index e475ad035e..2aab0d9db2 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -2464,7 +2464,7 @@ qemuValidateDomainDeviceDefHostdev(const virDomainHostdevDef
*hostdev,
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
backend = hostdev->source.subsys.u.pci.backend;
- if (backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
+ if (backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("VFIO PCI device assignment is not supported by
this version of qemu"));
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 6fd0aedacf..a1cbbc77e9 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -869,7 +869,7 @@ AppArmorSetSecurityHostdevLabel(virSecurityManager *mgr,
if (!pci)
goto done;
- if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
+ if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
if (!vfioGroupDev) {
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index c07e488db7..cb8b72b289 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -1257,7 +1257,7 @@ virSecurityDACSetHostdevLabel(virSecurityManager *mgr,
if (!pci)
return -1;
- if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
+ if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
g_autofree char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
if (!vfioGroupDev)
@@ -1418,7 +1418,7 @@ virSecurityDACRestoreHostdevLabel(virSecurityManager *mgr,
if (!pci)
return -1;
- if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
+ if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
g_autofree char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
if (!vfioGroupDev)
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 84c5ce75ed..2ee542f6a4 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -2201,7 +2201,7 @@ virSecuritySELinuxSetHostdevSubsysLabel(virSecurityManager *mgr,
if (!pci)
return -1;
- if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
+ if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
g_autofree char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
if (!vfioGroupDev)
@@ -2437,7 +2437,7 @@ virSecuritySELinuxRestoreHostdevSubsysLabel(virSecurityManager
*mgr,
if (!pci)
return -1;
- if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
+ if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
g_autofree char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
if (!vfioGroupDev)
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index be13979cef..d01df8710d 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -1092,9 +1092,10 @@ get_files(vahControl * ctl)
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
virPCIDevice *pci =
virPCIDeviceNew(&dev->source.subsys.u.pci.addr);
- virDomainHostdevSubsysPCIBackendType backend =
dev->source.subsys.u.pci.backend;
- if (backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO ||
- backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
+ virDeviceHostdevPCIDriverName driverName =
dev->source.subsys.u.pci.backend;
+
+ if (driverName == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO ||
+ driverName == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT) {
needsVfio = true;
}
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 67f8e75296..63e1f743c3 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -10045,16 +10045,16 @@ testDomainAttachHostPCIDevice(testDriver *driver G_GNUC_UNUSED,
int backend = hostdev->source.subsys.u.pci.backend;
switch (backend) {
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO:
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT:
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM:
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO:
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT:
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_KVM:
break;
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN:
- case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN:
+ case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("test hypervisor does not support device assignment mode
'%1$s'"),
- virDomainHostdevSubsysPCIBackendTypeToString(backend));
+ virDeviceHostdevPCIDriverNameTypeToString(backend));
return -1;
}
@@ -10080,7 +10080,7 @@ testDomainAttachHostDevice(testDriver *driver,
if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("hotplug is not supported for hostdev subsys type
'%1$s'"),
-
virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type));
+
virDeviceHostdevPCIDriverNameTypeToString(hostdev->source.subsys.type));
return -1;
}
diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
index c4a4508430..97b306f652 100644
--- a/tests/domaincapstest.c
+++ b/tests/domaincapstest.c
@@ -109,8 +109,8 @@ fillQemuCaps(virDomainCaps *domCaps,
* successfully mocked as they are not exposed as internal APIs. Therefore,
* instead of mocking set the expected values here by hand. */
VIR_DOMAIN_CAPS_ENUM_SET(domCaps->hostdev.pciBackend,
- VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT,
- VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO);
+ VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT,
+ VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO);
/* As of f05b6a918e28 we are expecting to see OVMF_CODE.fd file which
* may not exists everywhere. */
diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c
index 04e6c00908..89b4fb5e7c 100644
--- a/tests/virhostdevtest.c
+++ b/tests/virhostdevtest.c
@@ -134,7 +134,7 @@ myInit(void)
subsys->u.pci.addr.bus = 0;
subsys->u.pci.addr.slot = i + 1;
subsys->u.pci.addr.function = 0;
- subsys->u.pci.backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO;
+ subsys->u.pci.backend = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO;
}
for (i = 0; i < nhostdevs; i++) {
diff --git a/tools/virsh-completer-nodedev.c b/tools/virsh-completer-nodedev.c
index d743df460e..72951a54f6 100644
--- a/tools/virsh-completer-nodedev.c
+++ b/tools/virsh-completer-nodedev.c
@@ -110,6 +110,6 @@ virshNodeDevicePCIBackendCompleter(vshControl *ctl G_GNUC_UNUSED,
{
virCheckFlags(0, NULL);
- return virshEnumComplete(VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST,
- virDomainHostdevSubsysPCIBackendTypeToString);
+ return virshEnumComplete(VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST,
+ virDeviceHostdevPCIDriverNameTypeToString);
}
--
2.43.0