[libvirt] [PATCH v2 0/5] qemu: hostdev: Unify naming

Changes in v2: * make new names consistent with virHostdev (thanks John) * rename virHostdevUpdateDomainActiveDevices() as well - this was the only function in virHostdev that didn't conform to the module's naming conventions Cheers. Andrea Bolognani (5): hostdev: Rename virHostdevUpdateDomainActiveDevices() qemu: hostdev: Unify naming for qemuHostdevPrepare*Devices() qemu: hostdev: Unify naming for qemuHostdevReAttach*Devices() qemu: hostdev: Unify naming for qemuHostdevUpdateActive*Devices() qemu: hostdev: Introduce qemuHostdevUpdateActiveDomainDevices() src/libvirt_private.syms | 2 +- src/libxl/libxl_driver.c | 2 +- src/qemu/qemu_hostdev.c | 108 +++++++++++++++++++++++++++-------------------- src/qemu/qemu_hostdev.h | 69 +++++++++++++++--------------- src/qemu/qemu_hotplug.c | 20 ++++----- src/qemu/qemu_process.c | 14 ++---- src/util/virhostdev.c | 2 +- src/util/virhostdev.h | 2 +- 8 files changed, 117 insertions(+), 102 deletions(-) -- 2.4.3

The new name, virHostdevUpdateActiveDomainDevices(), follows the same naming conventions used by the rest of the module. No functional changes. --- src/libvirt_private.syms | 2 +- src/libxl/libxl_driver.c | 2 +- src/util/virhostdev.c | 2 +- src/util/virhostdev.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index be6ee19..4b7e165 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1534,10 +1534,10 @@ virHostdevReAttachDomainDevices; virHostdevReAttachPCIDevices; virHostdevReAttachSCSIDevices; virHostdevReAttachUSBDevices; +virHostdevUpdateActiveDomainDevices; virHostdevUpdateActivePCIDevices; virHostdevUpdateActiveSCSIDevices; virHostdevUpdateActiveUSBDevices; -virHostdevUpdateDomainActiveDevices; # util/viridentity.h diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index fc6dcec..fcdcbdb 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -377,7 +377,7 @@ libxlReconnectDomain(virDomainObjPtr vm, vm->def->id = d_info.domid; /* Update hostdev state */ - if (virHostdevUpdateDomainActiveDevices(hostdev_mgr, LIBXL_DRIVER_NAME, + if (virHostdevUpdateActiveDomainDevices(hostdev_mgr, LIBXL_DRIVER_NAME, vm->def, VIR_HOSTDEV_SP_PCI) < 0) goto out; diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index 0bc5120..de029a0 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -1704,7 +1704,7 @@ virHostdevReAttachDomainDevices(virHostdevManagerPtr mgr, } int -virHostdevUpdateDomainActiveDevices(virHostdevManagerPtr mgr, +virHostdevUpdateActiveDomainDevices(virHostdevManagerPtr mgr, const char *driver, virDomainDefPtr def, unsigned int flags) diff --git a/src/util/virhostdev.h b/src/util/virhostdev.h index 2036430..c451981 100644 --- a/src/util/virhostdev.h +++ b/src/util/virhostdev.h @@ -125,7 +125,7 @@ virHostdevUpdateActiveSCSIDevices(virHostdevManagerPtr mgr, const char *dom_name) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5); int -virHostdevUpdateDomainActiveDevices(virHostdevManagerPtr mgr, +virHostdevUpdateActiveDomainDevices(virHostdevManagerPtr mgr, const char *driver, virDomainDefPtr def, unsigned int flags) -- 2.4.3

Adopt the same names used for virHostdevPrepare*Devices() for consistency's sake and to make it easier to jump between the two. No functional changes. --- src/qemu/qemu_hostdev.c | 38 +++++++++++++++++++------------------- src/qemu/qemu_hostdev.h | 24 ++++++++++++------------ src/qemu/qemu_hotplug.c | 8 ++++---- src/qemu/qemu_process.c | 4 ++-- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index 706db0c..8886407 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -156,9 +156,9 @@ qemuHostdevHostSupportsPassthroughLegacy(void) static bool -qemuPrepareHostdevPCICheckSupport(virDomainHostdevDefPtr *hostdevs, - size_t nhostdevs, - virQEMUCapsPtr qemuCaps) +qemuHostdevPreparePCIDevicesCheckSupport(virDomainHostdevDefPtr *hostdevs, + size_t nhostdevs, + virQEMUCapsPtr qemuCaps) { bool supportsPassthroughKVM = qemuHostdevHostSupportsPassthroughLegacy(); bool supportsPassthroughVFIO = qemuHostdevHostSupportsPassthroughVFIO(); @@ -219,7 +219,7 @@ qemuPrepareHostdevPCICheckSupport(virDomainHostdevDefPtr *hostdevs, } int -qemuPrepareHostdevPCIDevices(virQEMUDriverPtr driver, +qemuHostdevPreparePCIDevices(virQEMUDriverPtr driver, const char *name, const unsigned char *uuid, virDomainHostdevDefPtr *hostdevs, @@ -230,7 +230,7 @@ qemuPrepareHostdevPCIDevices(virQEMUDriverPtr driver, int ret = -1; virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr; - if (!qemuPrepareHostdevPCICheckSupport(hostdevs, nhostdevs, qemuCaps)) + if (!qemuHostdevPreparePCIDevicesCheckSupport(hostdevs, nhostdevs, qemuCaps)) goto out; ret = virHostdevPreparePCIDevices(hostdev_mgr, QEMU_DRIVER_NAME, @@ -241,11 +241,11 @@ qemuPrepareHostdevPCIDevices(virQEMUDriverPtr driver, } int -qemuPrepareHostUSBDevices(virQEMUDriverPtr driver, - const char *name, - virDomainHostdevDefPtr *hostdevs, - int nhostdevs, - unsigned int flags) +qemuHostdevPrepareUSBDevices(virQEMUDriverPtr driver, + const char *name, + virDomainHostdevDefPtr *hostdevs, + int nhostdevs, + unsigned int flags) { virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr; @@ -254,7 +254,7 @@ qemuPrepareHostUSBDevices(virQEMUDriverPtr driver, } int -qemuPrepareHostdevSCSIDevices(virQEMUDriverPtr driver, +qemuHostdevPrepareSCSIDevices(virQEMUDriverPtr driver, const char *name, virDomainHostdevDefPtr *hostdevs, int nhostdevs) @@ -284,24 +284,24 @@ qemuPrepareHostdevSCSIDevices(virQEMUDriverPtr driver, int -qemuPrepareHostDevices(virQEMUDriverPtr driver, - virDomainDefPtr def, - virQEMUCapsPtr qemuCaps, - unsigned int flags) +qemuHostdevPrepareDomainDevices(virQEMUDriverPtr driver, + virDomainDefPtr def, + virQEMUCapsPtr qemuCaps, + unsigned int flags) { if (!def->nhostdevs) return 0; - if (qemuPrepareHostdevPCIDevices(driver, def->name, def->uuid, + if (qemuHostdevPreparePCIDevices(driver, def->name, def->uuid, def->hostdevs, def->nhostdevs, qemuCaps, flags) < 0) return -1; - if (qemuPrepareHostUSBDevices(driver, def->name, - def->hostdevs, def->nhostdevs, flags) < 0) + if (qemuHostdevPrepareUSBDevices(driver, def->name, + def->hostdevs, def->nhostdevs, flags) < 0) return -1; - if (qemuPrepareHostdevSCSIDevices(driver, def->name, + if (qemuHostdevPrepareSCSIDevices(driver, def->name, def->hostdevs, def->nhostdevs) < 0) return -1; diff --git a/src/qemu/qemu_hostdev.h b/src/qemu/qemu_hostdev.h index 05bd965..e1f7998 100644 --- a/src/qemu/qemu_hostdev.h +++ b/src/qemu/qemu_hostdev.h @@ -35,27 +35,27 @@ int qemuUpdateActiveSCSIHostdevs(virQEMUDriverPtr driver, virDomainDefPtr def); bool qemuHostdevHostSupportsPassthroughLegacy(void); bool qemuHostdevHostSupportsPassthroughVFIO(void); -int qemuPrepareHostdevPCIDevices(virQEMUDriverPtr driver, + +int qemuHostdevPreparePCIDevices(virQEMUDriverPtr driver, const char *name, const unsigned char *uuid, virDomainHostdevDefPtr *hostdevs, int nhostdevs, virQEMUCapsPtr qemuCaps, unsigned int flags); -int -qemuPrepareHostUSBDevices(virQEMUDriverPtr driver, - const char *name, - virDomainHostdevDefPtr *hostdevs, - int nhostdevs, - unsigned int flags); -int qemuPrepareHostdevSCSIDevices(virQEMUDriverPtr driver, +int qemuHostdevPrepareUSBDevices(virQEMUDriverPtr driver, + const char *name, + virDomainHostdevDefPtr *hostdevs, + int nhostdevs, + unsigned int flags); +int qemuHostdevPrepareSCSIDevices(virQEMUDriverPtr driver, const char *name, virDomainHostdevDefPtr *hostdevs, int nhostdevs); -int qemuPrepareHostDevices(virQEMUDriverPtr driver, - virDomainDefPtr def, - virQEMUCapsPtr qemuCaps, - unsigned int flags); +int qemuHostdevPrepareDomainDevices(virQEMUDriverPtr driver, + virDomainDefPtr def, + virQEMUCapsPtr qemuCaps, + unsigned int flags); void qemuDomainReAttachHostUSBDevices(virQEMUDriverPtr driver, const char *name, diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 470ab6a..507883c 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1263,11 +1263,11 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, if (!cfg->relaxedACS) flags |= VIR_HOSTDEV_STRICT_ACS_CHECK; - if (qemuPrepareHostdevPCIDevices(driver, vm->def->name, vm->def->uuid, + if (qemuHostdevPreparePCIDevices(driver, vm->def->name, vm->def->uuid, &hostdev, 1, priv->qemuCaps, flags) < 0) goto cleanup; - /* this could have been changed by qemuPrepareHostdevPCIDevices */ + /* this could have been changed by qemuHostdevPreparePCIDevices */ backend = hostdev->source.subsys.u.pci.backend; switch ((virDomainHostdevSubsysPCIBackendType) backend) { @@ -1885,7 +1885,7 @@ qemuDomainAttachHostUSBDevice(virQEMUDriverPtr driver, bool teardownlabel = false; int ret = -1; - if (qemuPrepareHostUSBDevices(driver, vm->def->name, &hostdev, 1, 0) < 0) + if (qemuHostdevPrepareUSBDevices(driver, vm->def->name, &hostdev, 1, 0) < 0) goto cleanup; added = true; @@ -1968,7 +1968,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn, if (!cont) return -1; - if (qemuPrepareHostdevSCSIDevices(driver, vm->def->name, + if (qemuHostdevPrepareSCSIDevices(driver, vm->def->name, &hostdev, 1)) { virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi; if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) { diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 07e41f0..daeeaf2 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4490,8 +4490,8 @@ int qemuProcessStart(virConnectPtr conn, hostdev_flags |= VIR_HOSTDEV_STRICT_ACS_CHECK; if (!migrateFrom) hostdev_flags |= VIR_HOSTDEV_COLD_BOOT; - if (qemuPrepareHostDevices(driver, vm->def, priv->qemuCaps, - hostdev_flags) < 0) + if (qemuHostdevPrepareDomainDevices(driver, vm->def, priv->qemuCaps, + hostdev_flags) < 0) goto cleanup; VIR_DEBUG("Preparing chr devices"); -- 2.4.3

Adopt the same names used for virHostdevReAttach*Devices() for consistency's sake and to make it easier to jump between the two. No functional changes. --- src/qemu/qemu_hostdev.c | 40 ++++++++++++++++++++-------------------- src/qemu/qemu_hostdev.h | 30 +++++++++++++++--------------- src/qemu/qemu_hotplug.c | 12 ++++++------ src/qemu/qemu_process.c | 2 +- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index 8886407..16945c7 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -309,10 +309,10 @@ qemuHostdevPrepareDomainDevices(virQEMUDriverPtr driver, } void -qemuDomainReAttachHostdevDevices(virQEMUDriverPtr driver, - const char *name, - virDomainHostdevDefPtr *hostdevs, - int nhostdevs) +qemuHostdevReAttachPCIDevices(virQEMUDriverPtr driver, + const char *name, + virDomainHostdevDefPtr *hostdevs, + int nhostdevs) { virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); const char *oldStateDir = cfg->stateDir; @@ -325,10 +325,10 @@ qemuDomainReAttachHostdevDevices(virQEMUDriverPtr driver, } void -qemuDomainReAttachHostUSBDevices(virQEMUDriverPtr driver, - const char *name, - virDomainHostdevDefPtr *hostdevs, - int nhostdevs) +qemuHostdevReAttachUSBDevices(virQEMUDriverPtr driver, + const char *name, + virDomainHostdevDefPtr *hostdevs, + int nhostdevs) { virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr; @@ -337,10 +337,10 @@ qemuDomainReAttachHostUSBDevices(virQEMUDriverPtr driver, } void -qemuDomainReAttachHostSCSIDevices(virQEMUDriverPtr driver, - const char *name, - virDomainHostdevDefPtr *hostdevs, - int nhostdevs) +qemuHostdevReAttachSCSIDevices(virQEMUDriverPtr driver, + const char *name, + virDomainHostdevDefPtr *hostdevs, + int nhostdevs) { size_t i; virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr; @@ -360,18 +360,18 @@ qemuDomainReAttachHostSCSIDevices(virQEMUDriverPtr driver, } void -qemuDomainReAttachHostDevices(virQEMUDriverPtr driver, - virDomainDefPtr def) +qemuHostdevReAttachDomainDevices(virQEMUDriverPtr driver, + virDomainDefPtr def) { if (!def->nhostdevs) return; - qemuDomainReAttachHostdevDevices(driver, def->name, def->hostdevs, - def->nhostdevs); + qemuHostdevReAttachPCIDevices(driver, def->name, def->hostdevs, + def->nhostdevs); - qemuDomainReAttachHostUSBDevices(driver, def->name, def->hostdevs, - def->nhostdevs); + qemuHostdevReAttachUSBDevices(driver, def->name, def->hostdevs, + def->nhostdevs); - qemuDomainReAttachHostSCSIDevices(driver, def->name, def->hostdevs, - def->nhostdevs); + qemuHostdevReAttachSCSIDevices(driver, def->name, def->hostdevs, + def->nhostdevs); } diff --git a/src/qemu/qemu_hostdev.h b/src/qemu/qemu_hostdev.h index e1f7998..b4514dc 100644 --- a/src/qemu/qemu_hostdev.h +++ b/src/qemu/qemu_hostdev.h @@ -56,20 +56,20 @@ int qemuHostdevPrepareDomainDevices(virQEMUDriverPtr driver, virDomainDefPtr def, virQEMUCapsPtr qemuCaps, unsigned int flags); -void -qemuDomainReAttachHostUSBDevices(virQEMUDriverPtr driver, - const char *name, - virDomainHostdevDefPtr *hostdevs, - int nhostdevs); -void qemuDomainReAttachHostSCSIDevices(virQEMUDriverPtr driver, - const char *name, - virDomainHostdevDefPtr *hostdevs, - int nhostdevs); -void qemuDomainReAttachHostdevDevices(virQEMUDriverPtr driver, - const char *name, - virDomainHostdevDefPtr *hostdevs, - int nhostdevs); -void qemuDomainReAttachHostDevices(virQEMUDriverPtr driver, - virDomainDefPtr def); + +void qemuHostdevReAttachPCIDevices(virQEMUDriverPtr driver, + const char *name, + virDomainHostdevDefPtr *hostdevs, + int nhostdevs); +void qemuHostdevReAttachUSBDevices(virQEMUDriverPtr driver, + const char *name, + virDomainHostdevDefPtr *hostdevs, + int nhostdevs); +void qemuHostdevReAttachSCSIDevices(virQEMUDriverPtr driver, + const char *name, + virDomainHostdevDefPtr *hostdevs, + int nhostdevs); +void qemuHostdevReAttachDomainDevices(virQEMUDriverPtr driver, + virDomainDefPtr def); #endif /* __QEMU_HOSTDEV_H__ */ diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 507883c..8f2fda9 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1383,7 +1383,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, if (releaseaddr) qemuDomainReleaseDeviceAddress(vm, hostdev->info, NULL); - qemuDomainReAttachHostdevDevices(driver, vm->def->name, &hostdev, 1); + qemuHostdevReAttachPCIDevices(driver, vm->def->name, &hostdev, 1); VIR_FREE(devstr); VIR_FREE(configfd_name); @@ -1936,7 +1936,7 @@ qemuDomainAttachHostUSBDevice(virQEMUDriverPtr driver, vm->def, hostdev, NULL) < 0) VIR_WARN("Unable to restore host device labelling on hotplug fail"); if (added) - qemuDomainReAttachHostUSBDevices(driver, vm->def->name, &hostdev, 1); + qemuHostdevReAttachUSBDevices(driver, vm->def->name, &hostdev, 1); } VIR_FREE(devstr); return ret; @@ -2036,7 +2036,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn, ret = 0; cleanup: if (ret < 0) { - qemuDomainReAttachHostSCSIDevices(driver, vm->def->name, &hostdev, 1); + qemuHostdevReAttachSCSIDevices(driver, vm->def->name, &hostdev, 1); if (teardowncgroup && qemuTeardownHostdevCgroup(vm, hostdev) < 0) VIR_WARN("Unable to remove host device cgroup ACL on hotplug fail"); if (teardownlabel && @@ -2969,7 +2969,7 @@ qemuDomainRemovePCIHostDevice(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainHostdevDefPtr hostdev) { - qemuDomainReAttachHostdevDevices(driver, vm->def->name, &hostdev, 1); + qemuHostdevReAttachPCIDevices(driver, vm->def->name, &hostdev, 1); qemuDomainReleaseDeviceAddress(vm, hostdev->info, NULL); } @@ -2978,7 +2978,7 @@ qemuDomainRemoveUSBHostDevice(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainHostdevDefPtr hostdev) { - qemuDomainReAttachHostUSBDevices(driver, vm->def->name, &hostdev, 1); + qemuHostdevReAttachUSBDevices(driver, vm->def->name, &hostdev, 1); } static void @@ -2986,7 +2986,7 @@ qemuDomainRemoveSCSIHostDevice(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainHostdevDefPtr hostdev) { - qemuDomainReAttachHostSCSIDevices(driver, vm->def->name, &hostdev, 1); + qemuHostdevReAttachSCSIDevices(driver, vm->def->name, &hostdev, 1); } static int diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index daeeaf2..2608a16 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5342,7 +5342,7 @@ void qemuProcessStop(virQEMUDriverPtr driver, priv->vioserialaddrs = NULL; } - qemuDomainReAttachHostDevices(driver, vm->def); + qemuHostdevReAttachDomainDevices(driver, vm->def); def = vm->def; for (i = 0; i < def->nnets; i++) { -- 2.4.3

Adopt the same names used for virHostdevUpdateActive*Devices() for consistency's sake and to make it easier to jump between the two. No functional changes. --- src/qemu/qemu_hostdev.c | 12 ++++++------ src/qemu/qemu_hostdev.h | 13 +++++++------ src/qemu/qemu_process.c | 6 +++--- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index 16945c7..7c920c9 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -45,8 +45,8 @@ VIR_LOG_INIT("qemu.qemu_hostdev"); int -qemuUpdateActivePCIHostdevs(virQEMUDriverPtr driver, - virDomainDefPtr def) +qemuHostdevUpdateActivePCIDevices(virQEMUDriverPtr driver, + virDomainDefPtr def) { virHostdevManagerPtr mgr = driver->hostdevMgr; @@ -58,8 +58,8 @@ qemuUpdateActivePCIHostdevs(virQEMUDriverPtr driver, } int -qemuUpdateActiveUSBHostdevs(virQEMUDriverPtr driver, - virDomainDefPtr def) +qemuHostdevUpdateActiveUSBDevices(virQEMUDriverPtr driver, + virDomainDefPtr def) { virHostdevManagerPtr mgr = driver->hostdevMgr; @@ -71,8 +71,8 @@ qemuUpdateActiveUSBHostdevs(virQEMUDriverPtr driver, } int -qemuUpdateActiveSCSIHostdevs(virQEMUDriverPtr driver, - virDomainDefPtr def) +qemuHostdevUpdateActiveSCSIDevices(virQEMUDriverPtr driver, + virDomainDefPtr def) { virHostdevManagerPtr mgr = driver->hostdevMgr; diff --git a/src/qemu/qemu_hostdev.h b/src/qemu/qemu_hostdev.h index b4514dc..c1a0a57 100644 --- a/src/qemu/qemu_hostdev.h +++ b/src/qemu/qemu_hostdev.h @@ -27,15 +27,16 @@ # include "qemu_conf.h" # include "domain_conf.h" -int qemuUpdateActivePCIHostdevs(virQEMUDriverPtr driver, - virDomainDefPtr def); -int qemuUpdateActiveUSBHostdevs(virQEMUDriverPtr driver, - virDomainDefPtr def); -int qemuUpdateActiveSCSIHostdevs(virQEMUDriverPtr driver, - virDomainDefPtr def); bool qemuHostdevHostSupportsPassthroughLegacy(void); bool qemuHostdevHostSupportsPassthroughVFIO(void); +int qemuHostdevUpdateActivePCIDevices(virQEMUDriverPtr driver, + virDomainDefPtr def); +int qemuHostdevUpdateActiveUSBDevices(virQEMUDriverPtr driver, + virDomainDefPtr def); +int qemuHostdevUpdateActiveSCSIDevices(virQEMUDriverPtr driver, + virDomainDefPtr def); + int qemuHostdevPreparePCIDevices(virQEMUDriverPtr driver, const char *name, const unsigned char *uuid, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 2608a16..6f3214e 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3769,13 +3769,13 @@ qemuProcessReconnect(void *opaque) priv->agentError = true; } - if (qemuUpdateActivePCIHostdevs(driver, obj->def) < 0) + if (qemuHostdevUpdateActivePCIDevices(driver, obj->def) < 0) goto error; - if (qemuUpdateActiveUSBHostdevs(driver, obj->def) < 0) + if (qemuHostdevUpdateActiveUSBDevices(driver, obj->def) < 0) goto error; - if (qemuUpdateActiveSCSIHostdevs(driver, obj->def) < 0) + if (qemuHostdevUpdateActiveSCSIDevices(driver, obj->def) < 0) goto error; if (qemuConnectCgroup(driver, obj) < 0) -- 2.4.3

This calls the PCI-, USB- and SCSI-specific functions just like qemuHostdev{Prepare,ReAttach}DomainDevices() already do, and was the missing piece for the qemuHostdev API to nicely mirror the virHostdev API. Update qemuProcessReconnect() to use the new function. --- src/qemu/qemu_hostdev.c | 18 ++++++++++++++++++ src/qemu/qemu_hostdev.h | 2 ++ src/qemu/qemu_process.c | 8 +------- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index 7c920c9..ca38a06 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -83,6 +83,24 @@ qemuHostdevUpdateActiveSCSIDevices(virQEMUDriverPtr driver, QEMU_DRIVER_NAME, def->name); } +int +qemuHostdevUpdateActiveDomainDevices(virQEMUDriverPtr driver, + virDomainDefPtr def) +{ + if (!def->nhostdevs) + return 0; + + if (qemuHostdevUpdateActivePCIDevices(driver, def) < 0) + return -1; + + if (qemuHostdevUpdateActiveUSBDevices(driver, def) < 0) + return -1; + + if (qemuHostdevUpdateActiveSCSIDevices(driver, def) < 0) + return -1; + + return 0; +} bool qemuHostdevHostSupportsPassthroughVFIO(void) diff --git a/src/qemu/qemu_hostdev.h b/src/qemu/qemu_hostdev.h index c1a0a57..0a3c715 100644 --- a/src/qemu/qemu_hostdev.h +++ b/src/qemu/qemu_hostdev.h @@ -36,6 +36,8 @@ int qemuHostdevUpdateActiveUSBDevices(virQEMUDriverPtr driver, virDomainDefPtr def); int qemuHostdevUpdateActiveSCSIDevices(virQEMUDriverPtr driver, virDomainDefPtr def); +int qemuHostdevUpdateActiveDomainDevices(virQEMUDriverPtr driver, + virDomainDefPtr def); int qemuHostdevPreparePCIDevices(virQEMUDriverPtr driver, const char *name, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 6f3214e..f744419 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3769,13 +3769,7 @@ qemuProcessReconnect(void *opaque) priv->agentError = true; } - if (qemuHostdevUpdateActivePCIDevices(driver, obj->def) < 0) - goto error; - - if (qemuHostdevUpdateActiveUSBDevices(driver, obj->def) < 0) - goto error; - - if (qemuHostdevUpdateActiveSCSIDevices(driver, obj->def) < 0) + if (qemuHostdevUpdateActiveDomainDevices(driver, obj->def) < 0) goto error; if (qemuConnectCgroup(driver, obj) < 0) -- 2.4.3

On 10/26/2015 08:58 AM, Andrea Bolognani wrote:
Changes in v2:
* make new names consistent with virHostdev (thanks John) * rename virHostdevUpdateDomainActiveDevices() as well - this was the only function in virHostdev that didn't conform to the module's naming conventions
Cheers.
Andrea Bolognani (5): hostdev: Rename virHostdevUpdateDomainActiveDevices() qemu: hostdev: Unify naming for qemuHostdevPrepare*Devices() qemu: hostdev: Unify naming for qemuHostdevReAttach*Devices() qemu: hostdev: Unify naming for qemuHostdevUpdateActive*Devices() qemu: hostdev: Introduce qemuHostdevUpdateActiveDomainDevices()
src/libvirt_private.syms | 2 +- src/libxl/libxl_driver.c | 2 +- src/qemu/qemu_hostdev.c | 108 +++++++++++++++++++++++++++-------------------- src/qemu/qemu_hostdev.h | 69 +++++++++++++++--------------- src/qemu/qemu_hotplug.c | 20 ++++----- src/qemu/qemu_process.c | 14 ++---- src/util/virhostdev.c | 2 +- src/util/virhostdev.h | 2 +- 8 files changed, 117 insertions(+), 102 deletions(-)
ACK series - John

On Mon, 2015-10-26 at 18:15 -0400, John Ferlan wrote:
hostdev: Rename virHostdevUpdateDomainActiveDevices() qemu: hostdev: Unify naming for qemuHostdevPrepare*Devices() qemu: hostdev: Unify naming for qemuHostdevReAttach*Devices() qemu: hostdev: Unify naming for qemuHostdevUpdateActive*Devices() qemu: hostdev: Introduce qemuHostdevUpdateActiveDomainDevices()
src/libvirt_private.syms | 2 +- src/libxl/libxl_driver.c | 2 +- src/qemu/qemu_hostdev.c | 108 +++++++++++++++++++++++++++-------- ------------ src/qemu/qemu_hostdev.h | 69 +++++++++++++++--------------- src/qemu/qemu_hotplug.c | 20 ++++----- src/qemu/qemu_process.c | 14 ++---- src/util/virhostdev.c | 2 +- src/util/virhostdev.h | 2 +- 8 files changed, 117 insertions(+), 102 deletions(-)
ACK series -
Pushed, thanks :) -- Andrea Bolognani Software Engineer - Virtualization Team
participants (2)
-
Andrea Bolognani
-
John Ferlan