merge: branch 'bg/ovs-restart-part2-rh1733709'

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/216

https://bugzilla.redhat.com/show_bug.cgi?id=1733709
(cherry picked from commit 5f668b81d3)
(cherry picked from commit 0581a53a46)
(cherry picked from commit e066ac5545)
(cherry picked from commit ba48493987)
(cherry picked from commit 05858995d1)
This commit is contained in:
Beniamino Galvani 2019-08-01 10:45:32 +02:00
commit 836154dee3
4 changed files with 23 additions and 8 deletions

View file

@ -436,6 +436,12 @@ release_slave (NMDevice *device,
NMDeviceBond *self = NM_DEVICE_BOND (device);
gboolean success, no_firmware = FALSE;
gs_free char *address = NULL;
int ifindex;
ifindex = nm_device_get_ifindex (device);
if ( ifindex <= 0
|| !nm_platform_link_get (nm_device_get_platform (device), ifindex))
configure = FALSE;
if (configure) {
/* When the last slave is released the bond MAC will be set to a random

View file

@ -403,6 +403,12 @@ release_slave (NMDevice *device,
{
NMDeviceBridge *self = NM_DEVICE_BRIDGE (device);
gboolean success;
int ifindex;
ifindex = nm_device_get_ifindex (device);
if ( ifindex <= 0
|| !nm_platform_link_get (nm_device_get_platform (device), ifindex))
configure = FALSE;
if (configure) {
success = nm_platform_link_release (nm_device_get_platform (device),

View file

@ -3848,13 +3848,14 @@ nm_device_create_and_realize (NMDevice *self,
{
nm_auto_nmpobj const NMPObject *plink_keep_alive = NULL;
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
const NMPlatformLink *plink = NULL;
const NMPlatformLink *plink;
/* Must be set before device is realized */
priv->nm_owned = !nm_platform_link_get_by_ifname (nm_device_get_platform (self), priv->iface);
plink = nm_platform_link_get_by_ifname (nm_device_get_platform (self), priv->iface);
priv->nm_owned = !plink || !link_type_compatible (self, plink->type, NULL, NULL);
_LOGD (LOGD_DEVICE, "create (is %snm-owned)", priv->nm_owned ? "" : "not ");
plink = NULL;
/* Create any resources the device needs */
if (NM_DEVICE_GET_CLASS (self)->create_and_realize) {
if (!NM_DEVICE_GET_CLASS (self)->create_and_realize (self, connection, parent, &plink, error))
@ -4579,7 +4580,6 @@ nm_device_master_release_slaves (NMDevice *self)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
NMDeviceStateReason reason;
gboolean configure = TRUE;
CList *iter, *safe;
/* Don't release the slaves if this connection doesn't belong to NM. */
@ -4590,13 +4590,10 @@ nm_device_master_release_slaves (NMDevice *self)
if (priv->state == NM_DEVICE_STATE_FAILED)
reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED;
if (!nm_platform_link_get (nm_device_get_platform (self), priv->ifindex))
configure = FALSE;
c_list_for_each_safe (iter, safe, &priv->slaves) {
SlaveInfo *info = c_list_entry (iter, SlaveInfo, lst_slave);
nm_device_master_release_one_slave (self, info->slave, configure, reason);
nm_device_master_release_one_slave (self, info->slave, TRUE, reason);
}
}

View file

@ -763,6 +763,12 @@ release_slave (NMDevice *device,
NMDeviceTeam *self = NM_DEVICE_TEAM (device);
NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (self);
gboolean success, no_firmware = FALSE;
int ifindex;
ifindex = nm_device_get_ifindex (device);
if ( ifindex <= 0
|| !nm_platform_link_get (nm_device_get_platform (device), ifindex))
configure = FALSE;
if (configure) {
success = nm_platform_link_release (nm_device_get_platform (device),