summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-12-20 17:52:34 +0100
committerThomas Haller <thaller@redhat.com>2019-12-21 11:33:59 +0100
commit785da51d83bf5b76835c457683bb2a4543386338 (patch)
treed71b7890614ed2aa725d1126539edaea618673ad
parentd65aabd5180b9d668610a9deb230d1baecb71a52 (diff)
downloadNetworkManager-785da51d83bf5b76835c457683bb2a4543386338.tar.gz
core: add and indicate NM_CAPABILITY_OVS capability on D-Bus
https://bugzilla.redhat.com/show_bug.cgi?id=1785147
-rw-r--r--libnm-core/nm-dbus-interface.h6
-rw-r--r--shared/nm-libnm-core-intern/nm-libnm-core-utils.h4
-rw-r--r--src/devices/ovs/nm-ovs-factory.c1
-rw-r--r--src/nm-manager.c2
4 files changed, 11 insertions, 2 deletions
diff --git a/libnm-core/nm-dbus-interface.h b/libnm-core/nm-dbus-interface.h
index 3e4c1b616c..d5f17f1428 100644
--- a/libnm-core/nm-dbus-interface.h
+++ b/libnm-core/nm-dbus-interface.h
@@ -89,7 +89,10 @@
/**
* NMCapability:
- * @NM_CAPABILITY_TEAM: Teams can be managed
+ * @NM_CAPABILITY_TEAM: Teams can be managed. This means the team device plugin
+ * is loaded.
+ * @NM_CAPABILITY_OVS: OpenVSwitch can be managed. This means the OVS device plugin
+ * is loaded. Since: 1.24
*
* #NMCapability names the numbers in the Capabilities property.
* Capabilities are positive numbers. They are part of stable API
@@ -101,6 +104,7 @@
*/
typedef enum {
NM_CAPABILITY_TEAM = 1,
+ NM_CAPABILITY_OVS = 2,
} NMCapability;
/**
diff --git a/shared/nm-libnm-core-intern/nm-libnm-core-utils.h b/shared/nm-libnm-core-intern/nm-libnm-core-utils.h
index 65a6e74ef0..a35a5e15bf 100644
--- a/shared/nm-libnm-core-intern/nm-libnm-core-utils.h
+++ b/shared/nm-libnm-core-intern/nm-libnm-core-utils.h
@@ -97,6 +97,10 @@ nm_setting_ip_config_get_addr_family (NMSettingIPConfig *s_ip)
/*****************************************************************************/
+#define _NM_CAPABILITY_MAX NM_CAPABILITY_OVS
+
+/*****************************************************************************/
+
extern const char *const nm_auth_permission_names_by_idx[NM_CLIENT_PERMISSION_LAST];
extern const NMClientPermission nm_auth_permission_sorted[NM_CLIENT_PERMISSION_LAST];
diff --git a/src/devices/ovs/nm-ovs-factory.c b/src/devices/ovs/nm-ovs-factory.c
index d6dd13eb04..d1d79a1cf0 100644
--- a/src/devices/ovs/nm-ovs-factory.c
+++ b/src/devices/ovs/nm-ovs-factory.c
@@ -59,6 +59,7 @@ NM_DEVICE_FACTORY_DECLARE_TYPES (
G_MODULE_EXPORT NMDeviceFactory *
nm_device_factory_create (GError **error)
{
+ nm_manager_set_capability (NM_MANAGER_GET, NM_CAPABILITY_OVS);
return (NMDeviceFactory *) g_object_new (NM_TYPE_OVS_FACTORY, NULL);
}
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 13e01c0b7c..be61d7dcfa 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -7324,7 +7324,7 @@ nm_manager_set_capability (NMManager *self,
gssize idx;
g_return_if_fail (NM_IS_MANAGER (self));
- if (cap < 1 || cap > NM_CAPABILITY_TEAM)
+ if (cap < 1 || cap > _NM_CAPABILITY_MAX)
g_return_if_reached ();
cap_i = (guint32) cap;