]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Ensure failure to create macvtap device aborts LXC start
authorDaniel P. Berrange <berrange@redhat.com>
Fri, 23 Nov 2012 16:38:01 +0000 (16:38 +0000)
committerCole Robinson <crobinso@redhat.com>
Sun, 9 Dec 2012 21:53:39 +0000 (16:53 -0500)
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@redhat.com>
(cherry picked from commit 43db9cf4ed72e20021907073a656b5f3d7fd1f28)

src/lxc/lxc_process.c

index 70513c2e83fb4cc189f8d1b7abebe863a568eda7..e611634e087cdbd0c1d48d2ae066e05620d64b3d 100644 (file)
@@ -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);
@@ -1031,7 +1031,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 */