[PATCH] qemu: hotplug: Fix the condition check for net->downscript

Yi Wang wang.yi59 at zte.com.cn
Fri May 29 15:52:24 UTC 2020


From: Liao Pingfang <liao.pingfang at zte.com.cn>

According to the context, here we are checking net->downscript's validity,

Signed-off-by: Liao Pingfang <liao.pingfang at zte.com.cn>
---
 src/qemu/qemu_hotplug.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index d1a2be1..8c99dfc 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -4672,9 +4672,8 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver,
             virDomainNetReleaseActualDevice(conn, vm->def, net);
         else
             VIR_WARN("Unable to release network device '%s'", NULLSTR(net->ifname));
-    } else if (net->type == VIR_DOMAIN_NET_TYPE_ETHERNET) {
-        if (net->script)
-           virNetDevRunEthernetScript(net->ifname, net->downscript);
+    } else if (net->type == VIR_DOMAIN_NET_TYPE_ETHERNET && net->downscript) {
+        virNetDevRunEthernetScript(net->ifname, net->downscript);
     }
     virDomainNetDefFree(net);
     return 0;
-- 
2.9.5




More information about the libvir-list mailing list