[PATCH 2/2] bhyve: do not cleanup unallocated networks on fail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



virBhyveProcessStart() calls bhyveNetCleanup() if it fails. However,
it might fail earlier than networks are allocated, so modify
bhyveNetCleanup() to check if net->ifname is not NULL before
going further with the cleanup.
---
 src/bhyve/bhyve_process.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index a5ad68d..b8db076 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -78,10 +78,12 @@ bhyveNetCleanup(virDomainObjPtr vm)
         int actualType = virDomainNetGetActualType(net);
 
         if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) {
-            ignore_value(virNetDevBridgeRemovePort(
-                            virDomainNetGetActualBridgeName(net),
-                            net->ifname));
-            ignore_value(virNetDevTapDelete(net->ifname));
+            if (net->ifname) {
+                ignore_value(virNetDevBridgeRemovePort(
+                                virDomainNetGetActualBridgeName(net),
+                                net->ifname));
+                ignore_value(virNetDevTapDelete(net->ifname));
+            }
         }
     }
 }
-- 
1.9.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]