mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-30 17:45:23 +00:00
Ensure failure to create macvtap device aborts LXC start
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 43db9cf4ed
)
This commit is contained in:
parent
74aa3ffec2
commit
f928284b85
@ -360,7 +360,7 @@ static int virLXCProcessSetupInterfaceDirect(virConnectPtr conn,
|
|||||||
unsigned int *nveths,
|
unsigned int *nveths,
|
||||||
char ***veths)
|
char ***veths)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = -1;
|
||||||
char *res_ifname = NULL;
|
char *res_ifname = NULL;
|
||||||
virLXCDriverPtr driver = conn->privateData;
|
virLXCDriverPtr driver = conn->privateData;
|
||||||
virNetDevBandwidthPtr bw;
|
virNetDevBandwidthPtr bw;
|
||||||
@ -539,10 +539,10 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret= 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (ret != 0) {
|
if (ret < 0) {
|
||||||
for (i = 0 ; i < def->nnets ; i++) {
|
for (i = 0 ; i < def->nnets ; i++) {
|
||||||
virDomainNetDefPtr iface = def->nets[i];
|
virDomainNetDefPtr iface = def->nets[i];
|
||||||
virNetDevVPortProfilePtr vport = virDomainNetGetActualVirtPortProfile(iface);
|
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;
|
goto cleanup;
|
||||||
|
|
||||||
/* Save the configuration for the controller */
|
/* Save the configuration for the controller */
|
||||||
|
Loading…
Reference in New Issue
Block a user