Blame SOURCES/0034-rh1273879-fix-software-device-unmanaged.patch

ab7d06
From 4c9d7e7797274b4eeecad89811afbea424d417c0 Mon Sep 17 00:00:00 2001
ab7d06
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
ab7d06
Date: Wed, 21 Oct 2015 14:57:23 +0200
ab7d06
Subject: [PATCH] vlan: fix unmanaged VLAN interface problem (rh #1273879)
ab7d06
MIME-Version: 1.0
ab7d06
Content-Type: text/plain; charset=UTF-8
ab7d06
Content-Transfer-Encoding: 8bit
ab7d06
ab7d06
Commit 285ee1fda2052e5b59110a323082c9423bf882e0 added NM_UNMANAGED_PLATFORM_INIT
ab7d06
flag marking platform uninitialized devices. The flags is set by
ab7d06
NM_DEVICE_PLATFORM_DEVICE property and on link changes. However, for virtual
ab7d06
devices, the platform device property was not set at NM device construction time
ab7d06
and link change event happened even before. That resulted in the device having
ab7d06
platform_link_initialized=FALSE and thus it was left unmanaged.
ab7d06
ab7d06
Make the change for other software devices too.
ab7d06
ab7d06
https://bugzilla.redhat.com/show_bug.cgi?id=1273879
ab7d06
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
ab7d06
---
ab7d06
 src/devices/nm-device-bond.c       | 14 ++++++++------
ab7d06
 src/devices/nm-device-bridge.c     |  4 +++-
ab7d06
 src/devices/nm-device-infiniband.c |  4 +++-
ab7d06
 src/devices/nm-device-vlan.c       |  4 +++-
ab7d06
 src/devices/team/nm-device-team.c  |  4 +++-
ab7d06
 5 files changed, 20 insertions(+), 10 deletions(-)
ab7d06
ab7d06
diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c
ab7d06
index 7f13942..afcba3b 100644
ab7d06
--- a/src/devices/nm-device-bond.c
ab7d06
+++ b/src/devices/nm-device-bond.c
ab7d06
@@ -572,6 +572,7 @@ create_virtual_device_for_connection (NMDeviceFactory *factory,
ab7d06
 {
ab7d06
 	const char *iface = nm_connection_get_interface_name (connection);
ab7d06
 	NMPlatformError plerr;
ab7d06
+	const NMPlatformLink *plink;
ab7d06
 
ab7d06
 	g_assert (iface);
ab7d06
 
ab7d06
@@ -584,14 +585,15 @@ create_virtual_device_for_connection (NMDeviceFactory *factory,
ab7d06
 		             nm_platform_error_to_string (plerr));
ab7d06
 		return NULL;
ab7d06
 	}
ab7d06
+	plink = nm_platform_link_get_by_ifname (NM_PLATFORM_GET, iface);
ab7d06
 
ab7d06
 	return (NMDevice *) g_object_new (NM_TYPE_DEVICE_BOND,
ab7d06
-		                              NM_DEVICE_IFACE, iface,
ab7d06
-		                              NM_DEVICE_DRIVER, "bonding",
ab7d06
-		                              NM_DEVICE_TYPE_DESC, "Bond",
ab7d06
-		                              NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_BOND,
ab7d06
-		                              NM_DEVICE_IS_MASTER, TRUE,
ab7d06
-		                              NULL);
ab7d06
+	                                  NM_DEVICE_PLATFORM_DEVICE, plink,
ab7d06
+	                                  NM_DEVICE_DRIVER, "bonding",
ab7d06
+	                                  NM_DEVICE_TYPE_DESC, "Bond",
ab7d06
+	                                  NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_BOND,
ab7d06
+	                                  NM_DEVICE_IS_MASTER, TRUE,
ab7d06
+	                                  NULL);
ab7d06
 }
ab7d06
 
ab7d06
 NM_DEVICE_FACTORY_DEFINE_INTERNAL (BOND, Bond, bond,
ab7d06
diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c
ab7d06
index e1cafd6..d643553 100644
ab7d06
--- a/src/devices/nm-device-bridge.c
ab7d06
+++ b/src/devices/nm-device-bridge.c
ab7d06
@@ -498,6 +498,7 @@ create_virtual_device_for_connection (NMDeviceFactory *factory,
ab7d06
 	const char *mac_address_str;
ab7d06
 	guint8 mac_address[NM_UTILS_HWADDR_LEN_MAX];
ab7d06
 	NMPlatformError plerr;
ab7d06
+	const NMPlatformLink *plink;
ab7d06
 
ab7d06
 	g_assert (iface);
ab7d06
 
ab7d06
@@ -523,9 +524,10 @@ create_virtual_device_for_connection (NMDeviceFactory *factory,
ab7d06
 		             nm_platform_error_to_string (plerr));
ab7d06
 		return NULL;
ab7d06
 	}
ab7d06
+	plink = nm_platform_link_get_by_ifname (NM_PLATFORM_GET, iface);
ab7d06
 
ab7d06
 	return (NMDevice *) g_object_new (NM_TYPE_DEVICE_BRIDGE,
ab7d06
-	                                  NM_DEVICE_IFACE, iface,
ab7d06
+	                                  NM_DEVICE_PLATFORM_DEVICE, plink,
ab7d06
 	                                  NM_DEVICE_DRIVER, "bridge",
ab7d06
 	                                  NM_DEVICE_TYPE_DESC, "Bridge",
ab7d06
 	                                  NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_BRIDGE,
ab7d06
diff --git a/src/devices/nm-device-infiniband.c b/src/devices/nm-device-infiniband.c
ab7d06
index 2d519f6..c1571fd 100644
ab7d06
--- a/src/devices/nm-device-infiniband.c
ab7d06
+++ b/src/devices/nm-device-infiniband.c
ab7d06
@@ -327,6 +327,7 @@ create_virtual_device_for_connection (NMDeviceFactory *factory,
ab7d06
 	int p_key, parent_ifindex;
ab7d06
 	const char *iface;
ab7d06
 	NMPlatformError plerr;
ab7d06
+	const NMPlatformLink *plink;
ab7d06
 
ab7d06
 	if (!NM_IS_DEVICE_INFINIBAND (parent)) {
ab7d06
 		g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
ab7d06
@@ -352,9 +353,10 @@ create_virtual_device_for_connection (NMDeviceFactory *factory,
ab7d06
 		             nm_platform_error_to_string (plerr));
ab7d06
 		return NULL;
ab7d06
 	}
ab7d06
+	plink = nm_platform_link_get_by_ifname (NM_PLATFORM_GET, iface);
ab7d06
 
ab7d06
 	return (NMDevice *) g_object_new (NM_TYPE_DEVICE_INFINIBAND,
ab7d06
-	                                  NM_DEVICE_IFACE, iface,
ab7d06
+	                                  NM_DEVICE_PLATFORM_DEVICE, plink,
ab7d06
 	                                  NM_DEVICE_DRIVER, nm_device_get_driver (parent),
ab7d06
 	                                  NM_DEVICE_TYPE_DESC, "InfiniBand",
ab7d06
 	                                  NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_INFINIBAND,
ab7d06
diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c
ab7d06
index adfcef3..b330397 100644
ab7d06
--- a/src/devices/nm-device-vlan.c
ab7d06
+++ b/src/devices/nm-device-vlan.c
ab7d06
@@ -698,6 +698,7 @@ create_virtual_device_for_connection (NMDeviceFactory *factory,
ab7d06
 	NMSettingVlan *s_vlan;
ab7d06
 	gs_free char *iface = NULL;
ab7d06
 	NMPlatformError plerr;
ab7d06
+	const NMPlatformLink *plink;
ab7d06
 
ab7d06
 	if (!NM_IS_DEVICE (parent)) {
ab7d06
 		g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
ab7d06
@@ -728,9 +729,10 @@ create_virtual_device_for_connection (NMDeviceFactory *factory,
ab7d06
 		             nm_platform_error_to_string (plerr));
ab7d06
 		return NULL;
ab7d06
 	}
ab7d06
+	plink = nm_platform_link_get_by_ifname (NM_PLATFORM_GET, iface);
ab7d06
 
ab7d06
 	device = (NMDevice *) g_object_new (NM_TYPE_DEVICE_VLAN,
ab7d06
-	                                    NM_DEVICE_IFACE, iface,
ab7d06
+	                                    NM_DEVICE_PLATFORM_DEVICE, plink,
ab7d06
 	                                    NM_DEVICE_VLAN_INT_PARENT_DEVICE, parent,
ab7d06
 	                                    NM_DEVICE_DRIVER, "8021q",
ab7d06
 	                                    NM_DEVICE_TYPE_DESC, "VLAN",
ab7d06
diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c
ab7d06
index 09b2dd7..1950fd2 100644
ab7d06
--- a/src/devices/team/nm-device-team.c
ab7d06
+++ b/src/devices/team/nm-device-team.c
ab7d06
@@ -710,6 +710,7 @@ nm_device_team_new_for_connection (NMConnection *connection, GError **error)
ab7d06
 {
ab7d06
 	const char *iface = nm_connection_get_interface_name (connection);
ab7d06
 	NMPlatformError plerr;
ab7d06
+	const NMPlatformLink *plink;
ab7d06
 
ab7d06
 	g_assert (iface);
ab7d06
 
ab7d06
@@ -722,9 +723,10 @@ nm_device_team_new_for_connection (NMConnection *connection, GError **error)
ab7d06
 		             nm_platform_error_to_string (plerr));
ab7d06
 		return NULL;
ab7d06
 	}
ab7d06
+	plink = nm_platform_link_get_by_ifname (NM_PLATFORM_GET, iface);
ab7d06
 
ab7d06
 	return (NMDevice *) g_object_new (NM_TYPE_DEVICE_TEAM,
ab7d06
-	                                  NM_DEVICE_IFACE, iface,
ab7d06
+	                                  NM_DEVICE_PLATFORM_DEVICE, plink,
ab7d06
 	                                  NM_DEVICE_DRIVER, "team",
ab7d06
 	                                  NM_DEVICE_TYPE_DESC, "Team",
ab7d06
 	                                  NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_TEAM,
ab7d06
-- 
ab7d06
2.1.0
ab7d06