[openlmi-networking] Fix LMI_IPElementSettingData refering bridging master setting instead of slave setting
Radek Novacek
rnovacek at fedoraproject.org
Wed Feb 12 14:53:11 UTC 2014
commit 26e7376657a27de8ba27e1282d5dbf171500817e
Author: Radek Novacek <rnovacek at redhat.com>
Date: Wed Feb 12 15:53:48 2014 +0100
Fix LMI_IPElementSettingData refering bridging master setting instead of slave setting
- Support connections that has interface-name option specified
- Fix that bond slave names are not going above 2
- allow virtual device name change for bonds
...2.2-bond-allow-to-change-bond-device-name.patch | 31 ++++++++++
...assoc-between-device-and-bridging-setting.patch | 29 +++++++++
...0.2.2-make-enslave-setting-caption-unique.patch | 61 ++++++++++++++++++++
...0.2.2-support-for-specifying-port-by-name.patch | 34 +++++++++++
openlmi-networking.spec | 21 +++++++-
5 files changed, 175 insertions(+), 1 deletions(-)
---
diff --git a/openlmi-networking-0.2.2-bond-allow-to-change-bond-device-name.patch b/openlmi-networking-0.2.2-bond-allow-to-change-bond-device-name.patch
new file mode 100644
index 0000000..406304c
--- /dev/null
+++ b/openlmi-networking-0.2.2-bond-allow-to-change-bond-device-name.patch
@@ -0,0 +1,31 @@
+From d6e15dbeee8b623a5a28baf38f68bb295ff1f7b2 Mon Sep 17 00:00:00 2001
+From: Radek Novacek <rnovacek at redhat.com>
+Date: Wed, 12 Feb 2014 14:00:58 +0100
+Subject: [PATCH 3/4] bond: Allow to change bond device name
+
+---
+ src/LMI_BondingMasterSettingDataProvider.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/src/LMI_BondingMasterSettingDataProvider.c b/src/LMI_BondingMasterSettingDataProvider.c
+index 26e53ca..d8ca80d 100644
+--- a/src/LMI_BondingMasterSettingDataProvider.c
++++ b/src/LMI_BondingMasterSettingDataProvider.c
+@@ -112,6 +112,14 @@ static CMPIStatus LMI_BondingMasterSettingDataModifyInstance(
+ KReturn2(_cb, ERR_FAILED, "Invalid type of the SettingData");
+ }
+ BondSetting *bond = setting_get_bond_setting(setting);
++ if (w.InterfaceName.exists && !w.InterfaceName.null) {
++ free(bond->interface_name);
++ if ((bond->interface_name = strdup(w.InterfaceName.chars)) == NULL) {
++ connection_free(connection);
++ network_unlock(network);
++ KReturn2(_cb, ERR_FAILED, "Memory allocation failed");
++ }
++ }
+ if (w.Mode.exists && !w.Mode.null) {
+ if (w.Mode.value > 6) {
+ connection_free(connection);
+--
+1.8.5.3
+
diff --git a/openlmi-networking-0.2.2-fix-assoc-between-device-and-bridging-setting.patch b/openlmi-networking-0.2.2-fix-assoc-between-device-and-bridging-setting.patch
new file mode 100644
index 0000000..6899462
--- /dev/null
+++ b/openlmi-networking-0.2.2-fix-assoc-between-device-and-bridging-setting.patch
@@ -0,0 +1,29 @@
+From bfbaeef31859683de63af29d101451b11789cf33 Mon Sep 17 00:00:00 2001
+From: Radek Novacek <rnovacek at redhat.com>
+Date: Wed, 12 Feb 2014 10:10:06 +0100
+Subject: [PATCH 1/4] Fix association between device and its bridging setting
+
+There was wrong InstanceId - using LMI_BridgingMasterSettingData class
+name instead of proper LMI_BridgingSlaveSettingData.
+---
+ src/LMI_IPElementSettingDataProvider.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/LMI_IPElementSettingDataProvider.c b/src/LMI_IPElementSettingDataProvider.c
+index 91dffd8..ac596e7 100644
+--- a/src/LMI_IPElementSettingDataProvider.c
++++ b/src/LMI_IPElementSettingDataProvider.c
+@@ -121,8 +121,8 @@ static CMPIStatus LMI_IPElementSettingDataEnumInstances(
+ settingDataOP = CIM_IPAssignmentSettingDataRefOP(instanceid, LMI_BondingSlaveSettingData_ClassName, _cb, ns);
+ break;
+ case CONNECTION_TYPE_BRIDGE:
+- instanceid = id_to_instanceid(connection_get_id(connection), LMI_BridgingMasterSettingData_ClassName);
+- settingDataOP = CIM_IPAssignmentSettingDataRefOP(instanceid, LMI_BridgingMasterSettingData_ClassName, _cb, ns);
++ instanceid = id_to_instanceid(connection_get_id(connection), LMI_BridgingSlaveSettingData_ClassName);
++ settingDataOP = CIM_IPAssignmentSettingDataRefOP(instanceid, LMI_BridgingSlaveSettingData_ClassName, _cb, ns);
+ break;
+ default:
+ error("Wrong master setting data type: %d", connection_get_type(master));
+--
+1.8.5.3
+
diff --git a/openlmi-networking-0.2.2-make-enslave-setting-caption-unique.patch b/openlmi-networking-0.2.2-make-enslave-setting-caption-unique.patch
new file mode 100644
index 0000000..ffd0b7a
--- /dev/null
+++ b/openlmi-networking-0.2.2-make-enslave-setting-caption-unique.patch
@@ -0,0 +1,61 @@
+From 8f0c500bbff649bce9511415217984716d30f8ec Mon Sep 17 00:00:00 2001
+From: Radek Novacek <rnovacek at redhat.com>
+Date: Wed, 12 Feb 2014 14:51:12 +0100
+Subject: [PATCH 4/4] bridge/bond: make sure that the enslaved setting has
+ unique name
+
+Previous way for getting automatic slave setting caption was fragile and
+could result in duplicated setting captions.
+---
+ src/LMI_IPNetworkConnectionCapabilitiesProvider.c | 33 +++++++++++++++--------
+ 1 file changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/src/LMI_IPNetworkConnectionCapabilitiesProvider.c b/src/LMI_IPNetworkConnectionCapabilitiesProvider.c
+index 0f9b5c3..30d543c 100644
+--- a/src/LMI_IPNetworkConnectionCapabilitiesProvider.c
++++ b/src/LMI_IPNetworkConnectionCapabilitiesProvider.c
+@@ -239,19 +239,30 @@ static int get_bridge_id(Network *network)
+ static LMIResult enslave(Network *network, Connection *master_connection, Port *port, char **slave_id)
+ {
+ LMIResult res;
+- // find number of slaves of master_connection
++
++ // find the name for connection - take the lower number that is not taken
++ // and has format '<master> Slave <nr>'
+ const Connections *connections = network_get_connections(network);
+- const char *master_id = connection_get_id(master_connection);
+- size_t count = 0;
+- for (size_t i = 0; i < connections_length(connections); ++i) {
+- if (strcmp(connection_get_id(connections_index(connections, i)), master_id) ==0) {
+- count++;
++ char *name = NULL;
++ size_t i;
++ bool free_name;
++ // We must limit the number of tries somehow, 1024 should be enough
++ for (size_t count = 1; count <= 1024; count++) {
++ free(name);
++ if (asprintf(&name, "%s Slave %zu", connection_get_name(master_connection), count) < 0) {
++ res = LMI_ERROR_MEMORY;
++ return res;
++ }
++ free_name = true;
++ for (i = 0; i < connections_length(connections); ++i) {
++ if (strcmp(connection_get_name(connections_index(connections, i)), name) == 0) {
++ free_name = false;
++ break;
++ }
++ }
++ if (free_name) {
++ break;
+ }
+- }
+- char *name;
+- if (asprintf(&name, "%s Slave %ld", connection_get_name(master_connection), count + 1) < 0) {
+- res = LMI_ERROR_MEMORY;
+- return res;
+ }
+ Connection *connection = connection_new(network, NULL, name);
+ free(name);
+--
+1.8.5.3
+
diff --git a/openlmi-networking-0.2.2-support-for-specifying-port-by-name.patch b/openlmi-networking-0.2.2-support-for-specifying-port-by-name.patch
new file mode 100644
index 0000000..af29f1e
--- /dev/null
+++ b/openlmi-networking-0.2.2-support-for-specifying-port-by-name.patch
@@ -0,0 +1,34 @@
+From b148ae7463f5f3817015c06b1a0256d4ce4530ee Mon Sep 17 00:00:00 2001
+From: Radek Novacek <rnovacek at redhat.com>
+Date: Wed, 12 Feb 2014 13:56:22 +0100
+Subject: [PATCH 2/4] Support for specifying port by name in connection
+
+It's possible to specify network by its name when creating a connection
+in NetworkManager. This commit adds support for it to the provider.
+---
+ src/connection_nm.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/src/connection_nm.c b/src/connection_nm.c
+index cca8b8f..18e7f8a 100644
+--- a/src/connection_nm.c
++++ b/src/connection_nm.c
+@@ -201,6 +201,15 @@ LMIResult connection_read_properties(Connection *connection, GHashTable *hash)
+ }
+ }
+ }
++ v = g_hash_table_lookup(connection_map, "interface-name");
++ if (v) {
++ s = g_value_get_string(v);
++ if (s != NULL) {
++ const Ports *ports = network_get_ports(connection->network);
++ Port *port = ports_find_by_id(ports, s);
++ connection->port = port;
++ }
++ }
+ } else if (strcmp(key, "802-3-ethernet") == 0) {
+ v = g_hash_table_lookup((GHashTable *) value, "mac-address");
+ if (v != NULL) {
+--
+1.8.5.3
+
diff --git a/openlmi-networking.spec b/openlmi-networking.spec
index 19dab62..32d7a9b 100644
--- a/openlmi-networking.spec
+++ b/openlmi-networking.spec
@@ -2,7 +2,7 @@
Name: openlmi-networking
Version: 0.2.2
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: CIM providers for network management
License: LGPLv2+
@@ -25,6 +25,15 @@ BuildRequires: libuuid-devel
BuildRequires: python-sphinx
BuildRequires: python-sphinx-theme-openlmi
+# Fix association between device and its bridging setting
+Patch0: openlmi-networking-0.2.2-fix-assoc-between-device-and-bridging-setting.patch
+# Support for specifying port by name in connection
+Patch1: openlmi-networking-0.2.2-support-for-specifying-port-by-name.patch
+# bond: Allow to change bond device name
+Patch2: openlmi-networking-0.2.2-bond-allow-to-change-bond-device-name.patch
+# bridge/bond: make sure that the enslaved setting has unique name
+Patch3: openlmi-networking-0.2.2-make-enslave-setting-caption-unique.patch
+
# For openlmi-register-pegasus script
Requires: python2
# sblim-sfcb or tog-pegasus
@@ -48,6 +57,10 @@ BuildArch: noarch
%prep
%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
%build
@@ -132,6 +145,12 @@ fi >> %logfile 2>&1
%changelog
+* Wed Feb 12 2014 Radek Novacek <rnovacek at redhat.com> 0.2.2-3
+- Fix LMI_IPElementSettingData refering bridging master setting instead of slave setting
+- Support connections that has interface-name option specified
+- Fix that bond slave names are not going above 2
+- allow virtual device name change for bonds
+
* Fri Jan 24 2014 Radek Novacek <rnovacek at redhat.com> 0.2.2-2
- Fix conflict between base and -doc packages
More information about the scm-commits
mailing list