[libvirt] [PATCH v2 3/3] qemu: hot-unplug of watchdog
Peter Krempa
pkrempa at redhat.com
Wed Sep 27 09:15:39 UTC 2017
On Wed, Sep 27, 2017 at 09:33:17 +0200, Michal Privoznik wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1447169
>
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
> src/qemu/qemu_driver.c | 4 +-
> src/qemu/qemu_hotplug.c | 61 ++++++++++++++++++++++
> src/qemu/qemu_hotplug.h | 3 ++
> tests/qemuhotplugtest.c | 7 ++-
> .../qemuhotplug-watchdog-full.xml | 3 ++
> 5 files changed, 76 insertions(+), 2 deletions(-)
> create mode 100644 tests/qemuhotplugtestdevices/qemuhotplug-watchdog-full.xml
[...]
> @@ -5049,6 +5069,47 @@ qemuDomainDetachShmemDevice(virQEMUDriverPtr driver,
> }
>
>
> +int
> +qemuDomainDetachWatchdog(virQEMUDriverPtr driver,
> + virDomainObjPtr vm,
> + virDomainWatchdogDefPtr dev)
> +{
> + int ret = -1;
> + virDomainWatchdogDefPtr watchdog = vm->def->watchdog;
> + qemuDomainObjPrivatePtr priv = vm->privateData;
> +
> + /* While domains can have up to one watchdog, the one supplied by the user
> + * doesn't necessarily match the one domain has. Refuse to detach in such
> + * case. */
> + if (!(watchdog &&
> + STREQ_NULLABLE(dev->info.alias, watchdog->info.alias) &&
So this mandates that the alias is provided in the detach XML.
> + watchdog->model == dev->model &&
> + watchdog->action == dev->action)) {
But e.g. does not check whether the device info matches. For other
devices we don't mandate most fields. (especially the alias)
> + virReportError(VIR_ERR_OPERATION_INVALID, "%s",
> + _("watchdog device not present in domain configuration"));
> + return -1;
> + }
> +
> + qemuDomainMarkDeviceForRemoval(vm, &watchdog->info);
> + qemuDomainObjEnterMonitor(driver, vm);
> +
> + ret = qemuMonitorDelDevice(priv->mon, watchdog->info.alias);
> +
> + if (qemuDomainObjExitMonitor(driver, vm) < 0)
> + ret = -1;
> +
> + if (ret == 0) {
> + if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1) {
> + qemuDomainReleaseDeviceAddress(vm, &watchdog->info, NULL);
> + ret = qemuDomainRemoveWatchdog(driver, vm, watchdog);
> + }
> + }
> + qemuDomainResetDeviceRemoval(vm);
> +
> + return ret;
> +}
> +
> +
> int
> qemuDomainDetachNetDevice(virQEMUDriverPtr driver,
> virDomainObjPtr vm,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170927/a58a10e6/attachment-0001.sig>
More information about the libvir-list
mailing list