mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-27 18:03:50 +03:00
lxc: skip the netdev autogenerated name counter past existing devices
the lxc driver uses virNetDevGenerateName() for its veth device names since patch 2dd0fb492, so it should be using virNetDevReserveName() during daemon restart/reconnect to skip over the device names that are in use. Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
4974872abc
commit
4252318bb3
@ -1640,6 +1640,30 @@ virLXCProcessReconnectNotifyNets(virDomainDefPtr def)
|
|||||||
for (i = 0; i < def->nnets; i++) {
|
for (i = 0; i < def->nnets; i++) {
|
||||||
virDomainNetDefPtr net = def->nets[i];
|
virDomainNetDefPtr net = def->nets[i];
|
||||||
|
|
||||||
|
/* type='bridge|network|ethernet' interfaces may be using an
|
||||||
|
* autogenerated netdev name, so we should update the counter
|
||||||
|
* for autogenerated names to skip past this one.
|
||||||
|
*/
|
||||||
|
switch (virDomainNetGetActualType(net)) {
|
||||||
|
case VIR_DOMAIN_NET_TYPE_BRIDGE:
|
||||||
|
case VIR_DOMAIN_NET_TYPE_NETWORK:
|
||||||
|
case VIR_DOMAIN_NET_TYPE_ETHERNET:
|
||||||
|
virNetDevReserveName(net->ifname);
|
||||||
|
break;
|
||||||
|
case VIR_DOMAIN_NET_TYPE_DIRECT:
|
||||||
|
case VIR_DOMAIN_NET_TYPE_USER:
|
||||||
|
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
|
||||||
|
case VIR_DOMAIN_NET_TYPE_SERVER:
|
||||||
|
case VIR_DOMAIN_NET_TYPE_CLIENT:
|
||||||
|
case VIR_DOMAIN_NET_TYPE_MCAST:
|
||||||
|
case VIR_DOMAIN_NET_TYPE_INTERNAL:
|
||||||
|
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
|
||||||
|
case VIR_DOMAIN_NET_TYPE_UDP:
|
||||||
|
case VIR_DOMAIN_NET_TYPE_VDPA:
|
||||||
|
case VIR_DOMAIN_NET_TYPE_LAST:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
|
if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
|
||||||
if (!conn && !(conn = virGetConnectNetwork()))
|
if (!conn && !(conn = virGetConnectNetwork()))
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user