mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-30 17:45:23 +00:00
Avoid crash when LXC start fails with no interface target
If the <interface> device did not contain any <target>
element, LXC would crash on a NULL pointer if starting
the container failed
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 68dceb635d
)
This commit is contained in:
parent
49ed3cd1f6
commit
74aa3ffec2
@ -254,6 +254,7 @@ static void virLXCProcessCleanup(virLXCDriverPtr driver,
|
|||||||
for (i = 0 ; i < vm->def->nnets ; i++) {
|
for (i = 0 ; i < vm->def->nnets ; i++) {
|
||||||
virDomainNetDefPtr iface = vm->def->nets[i];
|
virDomainNetDefPtr iface = vm->def->nets[i];
|
||||||
vport = virDomainNetGetActualVirtPortProfile(iface);
|
vport = virDomainNetGetActualVirtPortProfile(iface);
|
||||||
|
if (iface->ifname)
|
||||||
ignore_value(virNetDevSetOnline(iface->ifname, false));
|
ignore_value(virNetDevSetOnline(iface->ifname, false));
|
||||||
if (vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH)
|
if (vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH)
|
||||||
ignore_value(virNetDevOpenvswitchRemovePort(
|
ignore_value(virNetDevOpenvswitchRemovePort(
|
||||||
|
Loading…
Reference in New Issue
Block a user