summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-04-08 09:32:16 +0200
committerLubomir Rintel <lkundrak@v3.sk>2019-04-08 09:32:16 +0200
commit5b0b432d68f77156f7f2d055e59902b3f85ddd84 (patch)
tree797825809cb0e6d62a09c9a332cf2d4569f1b875
parentbfe75c957578f9b8949f905c4d0fe2612aeceb7a (diff)
parentc5539c2931eb2799de48e6ad62f66f5678adb7e9 (diff)
downloadNetworkManager-5b0b432d68f77156f7f2d055e59902b3f85ddd84.tar.gz
merge: branch 'lr/multi-level-master-slave'
https://github.com/NetworkManager/NetworkManager/pull/333
-rw-r--r--src/devices/nm-device.c7
-rw-r--r--src/devices/ovs/nm-device-ovs-interface.c11
-rw-r--r--src/devices/ovs/nm-device-ovs-port.c6
-rw-r--r--src/devices/ovs/nm-ovs-factory.c9
4 files changed, 15 insertions, 18 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 1b594ce000..06ad2ce821 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -5075,7 +5075,6 @@ nm_device_slave_notify_release (NMDevice *self, NMDeviceStateReason reason)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
NMConnection *connection = nm_device_get_applied_connection (self);
- NMDeviceState new_state;
const char *master_status;
g_return_if_fail (priv->master);
@@ -5084,21 +5083,17 @@ nm_device_slave_notify_release (NMDevice *self, NMDeviceStateReason reason)
&& priv->state <= NM_DEVICE_STATE_ACTIVATED) {
switch (nm_device_state_reason_check (reason)) {
case NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED:
- new_state = NM_DEVICE_STATE_FAILED;
master_status = "failed";
break;
case NM_DEVICE_STATE_REASON_USER_REQUESTED:
- new_state = NM_DEVICE_STATE_DEACTIVATING;
reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED;
master_status = "deactivated by user request";
break;
case NM_DEVICE_STATE_REASON_CONNECTION_REMOVED:
- new_state = NM_DEVICE_STATE_DEACTIVATING;
reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED;
master_status = "deactivated because master was removed";
break;
default:
- new_state = NM_DEVICE_STATE_DISCONNECTED;
master_status = "deactivated";
break;
}
@@ -5109,7 +5104,7 @@ nm_device_slave_notify_release (NMDevice *self, NMDeviceStateReason reason)
/* Cancel any pending activation sources */
_cancel_activation (self);
- nm_device_queue_state (self, new_state, reason);
+ nm_device_queue_state (self, NM_DEVICE_STATE_DEACTIVATING, reason);
} else
_LOGI (LOGD_DEVICE, "released from master device %s", nm_device_get_iface (priv->master));
diff --git a/src/devices/ovs/nm-device-ovs-interface.c b/src/devices/ovs/nm-device-ovs-interface.c
index 87c4b11f97..e3d3f9ee5f 100644
--- a/src/devices/ovs/nm-device-ovs-interface.c
+++ b/src/devices/ovs/nm-device-ovs-interface.c
@@ -118,16 +118,6 @@ link_changed (NMDevice *device,
}
}
-static void
-state_changed (NMDevice *device,
- NMDeviceState new_state,
- NMDeviceState old_state,
- NMDeviceStateReason reason)
-{
- if (new_state <= NM_DEVICE_STATE_DISCONNECTED)
- nm_device_update_from_platform_link (device, NULL);
-}
-
static gboolean
_is_internal_interface (NMDevice *device)
{
@@ -200,7 +190,6 @@ nm_device_ovs_interface_class_init (NMDeviceOvsInterfaceClass *klass)
device_class->is_available = is_available;
device_class->check_connection_compatible = check_connection_compatible;
device_class->link_changed = link_changed;
- device_class->state_changed = state_changed;
device_class->act_stage3_ip_config_start = act_stage3_ip_config_start;
device_class->can_unmanaged_external_down = can_unmanaged_external_down;
}
diff --git a/src/devices/ovs/nm-device-ovs-port.c b/src/devices/ovs/nm-device-ovs-port.c
index b96eba686a..35eb739f9a 100644
--- a/src/devices/ovs/nm-device-ovs-port.c
+++ b/src/devices/ovs/nm-device-ovs-port.c
@@ -20,6 +20,7 @@
#include "nm-default.h"
#include "nm-device-ovs-port.h"
+#include "nm-device-ovs-interface.h"
#include "nm-ovsdb.h"
#include "devices/nm-device-private.h"
@@ -141,6 +142,11 @@ release_slave (NMDevice *device, NMDevice *slave, gboolean configure)
{
nm_ovsdb_del_interface (nm_ovsdb_get (), nm_device_get_iface (slave),
del_iface_cb, g_object_ref (slave));
+
+ /* Open VSwitch is going to delete this one. We must ignore what happens
+ * next with the interface. */
+ if (NM_IS_DEVICE_OVS_INTERFACE (slave))
+ nm_device_update_from_platform_link (slave, NULL);
}
/*****************************************************************************/
diff --git a/src/devices/ovs/nm-ovs-factory.c b/src/devices/ovs/nm-ovs-factory.c
index 0c85123f81..2124b2a0b1 100644
--- a/src/devices/ovs/nm-ovs-factory.c
+++ b/src/devices/ovs/nm-ovs-factory.c
@@ -120,13 +120,20 @@ ovsdb_device_removed (NMOvsdb *ovsdb, const char *name, NMDeviceType device_type
NMDeviceFactory *self)
{
NMDevice *device;
+ NMDeviceState device_state;
device = nm_manager_get_device (nm_manager_get (), name, device_type);
if (!device)
return;
+ device_state = nm_device_get_state (device);
if ( device_type == NM_DEVICE_TYPE_OVS_INTERFACE
- || nm_device_get_state (device) == NM_DEVICE_STATE_UNMANAGED) {
+ && device_state > NM_DEVICE_STATE_DISCONNECTED
+ && device_state < NM_DEVICE_STATE_DEACTIVATING) {
+ nm_device_state_changed (device,
+ NM_DEVICE_STATE_DEACTIVATING,
+ NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED);
+ } else if (device_state == NM_DEVICE_STATE_UNMANAGED) {
nm_device_unrealize (device, TRUE, NULL);
}
}