[libvirt] [PATCH] conf: Validate device on update-device

Michal Privoznik mprivozn at redhat.com
Tue Sep 5 14:37:23 UTC 2017


https://bugzilla.redhat.com/show_bug.cgi?id=1439991

Whenever a device is being updated via
virDomainUpdateDeviceFlags() API, we parse the device XML and
ideally run some generic checks to validate the configuration
(e.g. if device defines per-device boot order but the domain has
os/boot element already). Well, that's the theory - due to a
missing check we've jumped early from that check function.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/conf/domain_conf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f7574d77b..0064a71f5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -26026,7 +26026,8 @@ virDomainDefCompatibleDevice(virDomainDefPtr def,
 {
     virDomainDeviceInfoPtr info = virDomainDeviceGetInfo(dev);
 
-    if (action != VIR_DOMAIN_DEVICE_ACTION_ATTACH)
+    if (action != VIR_DOMAIN_DEVICE_ACTION_ATTACH &&
+        action != VIR_DOMAIN_DEVICE_ACTION_UPDATE)
         return 0;
 
     if (!virDomainDefHasUSB(def) &&
-- 
2.13.5




More information about the libvir-list mailing list