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@xxxxxxxxxx> > --- > 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,
Attachment:
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list