From c778d9a252debf4cee02df51400a3b33e5afa304 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Thu, 18 Jan 2018 10:13:43 +0100 Subject: [PATCH] ifcfg: don't forget master of ovs interfaces https://bugzilla.redhat.com/show_bug.cgi?id=1519179 (cherry picked from commit 1440fe6a8804c0d2da162ebc91d35a55c5e83f42) --- src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c | 17 +++++++++++++++++ src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c index b9900eec3..bdd3ee0a1 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c @@ -293,6 +293,23 @@ make_connection_setting (const char *file, check_if_bond_slave (ifcfg, s_con); check_if_team_slave (ifcfg, s_con); + nm_clear_g_free (&value); + v = svGetValueStr (ifcfg, "OVS_PORT_UUID", &value); + if (!v) + v = svGetValueStr (ifcfg, "OVS_PORT", &value); + if (v) { + const char *old_value; + + if ((old_value = nm_setting_connection_get_master (s_con))) { + PARSE_WARNING ("Already configured as slave of %s. Ignoring OVS_PORT=\"%s\"", + old_value, v); + } else { + g_object_set (s_con, NM_SETTING_CONNECTION_MASTER, v, NULL); + g_object_set (s_con, NM_SETTING_CONNECTION_SLAVE_TYPE, + NM_SETTING_OVS_PORT_SETTING_NAME, NULL); + } + } + nm_clear_g_free (&value); v = svGetValueStr (ifcfg, "GATEWAY_PING_TIMEOUT", &value); if (v) { diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c index 5cb8ee98f..e9dd08b7d 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -1832,6 +1832,12 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) NM_SETTING_WIRED_SETTING_NAME, NM_SETTING_VLAN_SETTING_NAME)) svUnsetValue (ifcfg, "TYPE"); + } else if (nm_setting_connection_is_slave_type (s_con, NM_SETTING_OVS_PORT_SETTING_NAME)) { + svSetValueStr (ifcfg, "OVS_PORT_UUID", master); + svSetValueStr (ifcfg, "OVS_PORT", master_iface); + } else { + _LOGW ("don't know how to set master for a %s slave", + nm_setting_connection_get_slave_type (s_con)); } } -- 2.14.3