[PATCH 07/10] Ensure failure to create macvtap device aborts LXC start

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

A mistaken initialization of 'ret' caused failure to create
macvtap devices to be ignored. The libvirt_lxc process
would later fail to start due to missing devices

Also make sure code checks '< 0' and not '!= 0' since only
-1 is considered an error condition

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 src/lxc/lxc_process.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 954cb9e..6cfbb0d 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -360,7 +360,7 @@ static int virLXCProcessSetupInterfaceDirect(virConnectPtr conn,
                                              unsigned int *nveths,
                                              char ***veths)
 {
-    int ret = 0;
+    int ret = -1;
     char *res_ifname = NULL;
     virLXCDriverPtr driver = conn->privateData;
     virNetDevBandwidthPtr bw;
@@ -539,10 +539,10 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn,
         }
     }
 
-    ret= 0;
+    ret = 0;
 
 cleanup:
-    if (ret != 0) {
+    if (ret < 0) {
         for (i = 0 ; i < def->nnets ; i++) {
             virDomainNetDefPtr iface = def->nets[i];
             virNetDevVPortProfilePtr vport = virDomainNetGetActualVirtPortProfile(iface);
@@ -1046,7 +1046,7 @@ int virLXCProcessStart(virConnectPtr conn,
         }
     }
 
-    if (virLXCProcessSetupInterfaces(conn, vm->def, &nveths, &veths) != 0)
+    if (virLXCProcessSetupInterfaces(conn, vm->def, &nveths, &veths) < 0)
         goto cleanup;
 
     /* Save the configuration for the controller */
-- 
1.7.11.2

--
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]