On 09/12/2017 03:26 PM, John Ferlan wrote: > > > On 09/05/2017 07:45 AM, Michal Privoznik wrote: >> https://bugzilla.redhat.com/show_bug.cgi?id=1447169 >> >> With this patch users can cold plug a watchdog. Things are pretty >> simple because a domain can have at most one watchdog device. >> >> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> >> --- >> src/qemu/qemu_driver.c | 13 ++++++++++++- >> 1 file changed, 12 insertions(+), 1 deletion(-) >> >> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c >> index b7824512c..583908972 100644 >> --- a/src/qemu/qemu_driver.c >> +++ b/src/qemu/qemu_driver.c >> @@ -7842,6 +7842,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, >> virDomainFSDefPtr fs; >> virDomainRedirdevDefPtr redirdev; >> virDomainShmemDefPtr shmem; >> + virDomainWatchdogDefPtr watchdog; >> >> switch ((virDomainDeviceType) dev->type) { >> case VIR_DOMAIN_DEVICE_DISK: >> @@ -7978,10 +7979,20 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, >> dev->data.shmem = NULL; >> break; >> >> + case VIR_DOMAIN_DEVICE_WATCHDOG: >> + watchdog = dev->data.watchdog; >> + if (vmdef->watchdog) { >> + virReportError(VIR_ERR_OPERATION_INVALID, "%s", >> + _("domain already has a watchdog")); >> + return -1; >> + } >> + vmdef->watchdog = watchdog; >> + dev->data.watchdog = NULL; > > Couldn't this just simply be: > > VIR_STEAL_PTR(vmdef->watchdog, dev->data.watchdog); > > the local @watchdog wouldn't be necessary then either... Oh right. For some reason I can not get used to these macros. > > Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx> Fixed and pushed, thanks. Michal -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list