summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kletzander <mkletzan@redhat.com>2023-04-19 13:52:01 +0200
committerMartin Kletzander <mkletzan@redhat.com>2023-04-20 10:17:35 +0200
commit18f7dd6f1fc332438719b7e35841990bdc48622b (patch)
tree3111f315142da95fefc1ad4fe0be5d253c3a5d66
parent623d074e444eb9e5a037b78e1288fda12ba131b5 (diff)
downloadlibvirt-18f7dd6f1fc332438719b7e35841990bdc48622b.tar.gz
qemu: Forbid device attach of existing platform watchdog
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
-rw-r--r--src/qemu/qemu_driver.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 28e470e4a2..523a83682c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7315,6 +7315,19 @@ qemuDomainAttachDeviceConfig(virDomainDef *vmdef,
return -1;
}
+ if (dev->data.watchdog->model != VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB) {
+ size_t i;
+
+ for (i = 0; i < vmdef->nwatchdogs; i++) {
+ if (vmdef->watchdogs[i]->model == dev->data.watchdog->model) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("domain can only have one watchdog with model '%1$s'"),
+ virDomainWatchdogModelTypeToString(vmdef->watchdogs[i]->model));
+ return -1;
+ }
+ }
+ }
+
VIR_APPEND_ELEMENT(vmdef->watchdogs, vmdef->nwatchdogs, dev->data.watchdog);
break;