ifcfg-rh: support the autoconnect-retries property
This commit is contained in:
@@ -1606,6 +1606,15 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class)
|
|||||||
* giving up. Zero means forever, -1 means the global default (4 times if not
|
* giving up. Zero means forever, -1 means the global default (4 times if not
|
||||||
* overridden).
|
* overridden).
|
||||||
*/
|
*/
|
||||||
|
/* ---ifcfg-rh---
|
||||||
|
* property: autoconnect-retries
|
||||||
|
* variable: AUTOCONNECT_RETRIES(+)
|
||||||
|
* description: The number of times a connection should be autoactivated
|
||||||
|
* before giving up and switching to the next one.
|
||||||
|
* values: -1 (use global default), 0 (forever) or a positive value
|
||||||
|
* example: AUTOCONNECT_RETRIES=1
|
||||||
|
* ---end---
|
||||||
|
*/
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(object_class, PROP_AUTOCONNECT_RETRIES,
|
(object_class, PROP_AUTOCONNECT_RETRIES,
|
||||||
g_param_spec_int (NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES, "", "",
|
g_param_spec_int (NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES, "", "",
|
||||||
|
@@ -292,6 +292,7 @@ global:
|
|||||||
nm_setting_connection_add_secondary;
|
nm_setting_connection_add_secondary;
|
||||||
nm_setting_connection_get_autoconnect;
|
nm_setting_connection_get_autoconnect;
|
||||||
nm_setting_connection_get_autoconnect_priority;
|
nm_setting_connection_get_autoconnect_priority;
|
||||||
|
nm_setting_connection_get_autoconnect_retries;
|
||||||
nm_setting_connection_get_autoconnect_slaves;
|
nm_setting_connection_get_autoconnect_slaves;
|
||||||
nm_setting_connection_get_connection_type;
|
nm_setting_connection_get_connection_type;
|
||||||
nm_setting_connection_get_gateway_ping_timeout;
|
nm_setting_connection_get_gateway_ping_timeout;
|
||||||
|
@@ -184,6 +184,9 @@ make_connection_setting (const char *file,
|
|||||||
NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_MIN,
|
NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_MIN,
|
||||||
NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_MAX,
|
NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_MAX,
|
||||||
NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_DEFAULT),
|
NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_DEFAULT),
|
||||||
|
NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES,
|
||||||
|
(gint) svGetValueInt64 (ifcfg, "AUTOCONNECT_RETRIES", 10,
|
||||||
|
-1, G_MAXINT32, -1),
|
||||||
NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES,
|
NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES,
|
||||||
svGetValueBoolean (ifcfg, "AUTOCONNECT_SLAVES", NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT),
|
svGetValueBoolean (ifcfg, "AUTOCONNECT_SLAVES", NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT),
|
||||||
NM_SETTING_CONNECTION_LLDP, lldp,
|
NM_SETTING_CONNECTION_LLDP, lldp,
|
||||||
|
@@ -1767,6 +1767,11 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
|
|||||||
svSetValue (ifcfg, "AUTOCONNECT_PRIORITY", tmp, FALSE);
|
svSetValue (ifcfg, "AUTOCONNECT_PRIORITY", tmp, FALSE);
|
||||||
g_free (tmp);
|
g_free (tmp);
|
||||||
|
|
||||||
|
i_int = nm_setting_connection_get_autoconnect_retries (s_con);
|
||||||
|
tmp = i_int != -1 ? g_strdup_printf ("%d", i_int) : NULL;
|
||||||
|
svSetValue (ifcfg, "AUTOCONNECT_RETRIES", tmp, FALSE);
|
||||||
|
g_free (tmp);
|
||||||
|
|
||||||
/* Only save the value for master connections */
|
/* Only save the value for master connections */
|
||||||
svUnsetValue (ifcfg, "AUTOCONNECT_SLAVES");
|
svUnsetValue (ifcfg, "AUTOCONNECT_SLAVES");
|
||||||
type = nm_setting_connection_get_connection_type (s_con);
|
type = nm_setting_connection_get_connection_type (s_con);
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
DEVICE=eth0
|
DEVICE=eth0
|
||||||
HWADDR_BLACKLIST="00:16:41:11:22:88 00:16:41:11:22:99 XX:aa:invalid 6A:5D:5A:FA:DD:F0"
|
HWADDR_BLACKLIST="00:16:41:11:22:88 00:16:41:11:22:99 XX:aa:invalid 6A:5D:5A:FA:DD:F0"
|
||||||
|
AUTOCONNECT_RETRIES=100
|
||||||
|
|
||||||
|
@@ -273,6 +273,7 @@ test_read_basic (void)
|
|||||||
g_assert_cmpstr (nm_setting_connection_get_id (s_con), ==, "System test-minimal");
|
g_assert_cmpstr (nm_setting_connection_get_id (s_con), ==, "System test-minimal");
|
||||||
g_assert_cmpint (nm_setting_connection_get_timestamp (s_con), ==, 0);
|
g_assert_cmpint (nm_setting_connection_get_timestamp (s_con), ==, 0);
|
||||||
g_assert (nm_setting_connection_get_autoconnect (s_con));
|
g_assert (nm_setting_connection_get_autoconnect (s_con));
|
||||||
|
g_assert_cmpint (nm_setting_connection_get_autoconnect_retries (s_con), ==, -1);
|
||||||
|
|
||||||
/* UUID can't be tested if the ifcfg does not contain the UUID key, because
|
/* UUID can't be tested if the ifcfg does not contain the UUID key, because
|
||||||
* the UUID is generated on the full path of the ifcfg file, which can change
|
* the UUID is generated on the full path of the ifcfg file, which can change
|
||||||
@@ -326,6 +327,7 @@ test_read_miscellaneous_variables (void)
|
|||||||
g_assert (s_con);
|
g_assert (s_con);
|
||||||
g_assert_cmpint (nm_setting_connection_get_timestamp (s_con), ==, expected_timestamp);
|
g_assert_cmpint (nm_setting_connection_get_timestamp (s_con), ==, expected_timestamp);
|
||||||
g_assert (nm_setting_connection_get_autoconnect (s_con));
|
g_assert (nm_setting_connection_get_autoconnect (s_con));
|
||||||
|
g_assert_cmpint (nm_setting_connection_get_autoconnect_retries (s_con), ==, 100);
|
||||||
|
|
||||||
/* ===== WIRED SETTING ===== */
|
/* ===== WIRED SETTING ===== */
|
||||||
s_wired = nm_connection_get_setting_wired (connection);
|
s_wired = nm_connection_get_setting_wired (connection);
|
||||||
@@ -3535,6 +3537,7 @@ test_write_wired_static (void)
|
|||||||
NM_SETTING_CONNECTION_ID, "Test Write Wired Static",
|
NM_SETTING_CONNECTION_ID, "Test Write Wired Static",
|
||||||
NM_SETTING_CONNECTION_UUID, uuid,
|
NM_SETTING_CONNECTION_UUID, uuid,
|
||||||
NM_SETTING_CONNECTION_AUTOCONNECT, TRUE,
|
NM_SETTING_CONNECTION_AUTOCONNECT, TRUE,
|
||||||
|
NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES, 1,
|
||||||
NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRED_SETTING_NAME,
|
NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRED_SETTING_NAME,
|
||||||
NULL);
|
NULL);
|
||||||
g_free (uuid);
|
g_free (uuid);
|
||||||
|
Reference in New Issue
Block a user