diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2017-05-24 14:26:53 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2017-05-24 14:26:53 +0200 |
commit | 1157024c2955e80e27abb19402b01ab1b33c8a11 (patch) | |
tree | 3a3782fde8837117695c66945055ea7b22956274 | |
parent | 415bc712bb05a47aca4a315dbc08e53b7f8c0a04 (diff) | |
download | NetworkManager-lr/sriov-num-vfs.tar.gz |
ifcfg: add support for NUM_VFS keylr/sriov-num-vfs
-rw-r--r-- | libnm-core/nm-setting-wired.c | 7 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c | 5 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c | 7 |
3 files changed, 19 insertions, 0 deletions
diff --git a/libnm-core/nm-setting-wired.c b/libnm-core/nm-setting-wired.c index 580d7de03f..6523800fe8 100644 --- a/libnm-core/nm-setting-wired.c +++ b/libnm-core/nm-setting-wired.c @@ -1462,6 +1462,13 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_wired_class) * * Since: 1.10 **/ + /* ---ifcfg-rh--- + * property: num-vfs + * variable: NUM_VFS + * description: Number of virtual functions for a SR-IOV capable hardware. + * example: NUM_VFS=4 + * ---end--- + */ g_object_class_install_property (object_class, PROP_NUM_VFS, g_param_spec_int (NM_SETTING_WIRED_NUM_VFS, "", "", 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 17a0467de7..4f298a10bc 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c @@ -4198,6 +4198,11 @@ make_wired_setting (shvarFile *ifcfg, svGetValue (ifcfg, "ETHTOOL_OPTS", &value)); nm_clear_g_free (&value); + g_object_set (s_wired, + NM_SETTING_WIRED_NUM_VFS, + (gint) svGetValueInt64 (ifcfg, "NUM_VFS", 10, -1, G_MAXINT32, -1), + NULL); + return (NMSetting *) g_steal_pointer (&s_wired); } 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 fabff68fe2..863bc55d66 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -991,6 +991,7 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) gboolean auto_negotiate; NMSettingWiredWakeOnLan wol; const char *wol_password; + gint32 num_vfs; s_wired = nm_connection_get_setting_wired (connection); if (!s_wired) { @@ -1139,6 +1140,12 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) } /* End ETHTOOL_OPT stuffing */ + num_vfs = nm_setting_wired_get_num_vfs (s_wired); + if (num_vfs == -1) + svUnsetValue (ifcfg, "NUM_VFS"); + else + svSetValueInt64 (ifcfg, "NUM_VFS", num_vfs); + svSetValueStr (ifcfg, "TYPE", TYPE_ETHERNET); return TRUE; |