device: remove the "can_reapply_change_ovs_external_ids" device field
NMDevices have a special "can_reapply_change_ovs_external_ids" boolean field indicating whether the device type supports reapplying the ovs-external-ids and ovs-other-config settings. Remove this field and use the standard can_reapply_change() method. No change in behavior is expected.
This commit is contained in:
@@ -14020,15 +14020,6 @@ can_reapply_change(NMDevice *self,
|
|||||||
goto out_fail;
|
goto out_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NM_IN_STRSET(setting_name,
|
|
||||||
NM_SETTING_OVS_EXTERNAL_IDS_SETTING_NAME,
|
|
||||||
NM_SETTING_OVS_OTHER_CONFIG_SETTING_NAME)
|
|
||||||
&& NM_DEVICE_GET_CLASS(self)->can_reapply_change_ovs_external_ids) {
|
|
||||||
/* TODO: this means, you cannot reapply changes to the external-ids for
|
|
||||||
* OVS system interfaces. */
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
out_fail:
|
out_fail:
|
||||||
g_set_error(error,
|
g_set_error(error,
|
||||||
NM_DEVICE_ERROR,
|
NM_DEVICE_ERROR,
|
||||||
|
@@ -209,8 +209,6 @@ typedef struct _NMDeviceClass {
|
|||||||
|
|
||||||
bool act_stage1_prepare_set_hwaddr_ethernet : 1;
|
bool act_stage1_prepare_set_hwaddr_ethernet : 1;
|
||||||
|
|
||||||
bool can_reapply_change_ovs_external_ids : 1;
|
|
||||||
|
|
||||||
bool allow_autoconnect_on_external : 1;
|
bool allow_autoconnect_on_external : 1;
|
||||||
|
|
||||||
NMRfkillType rfkill_type : 4;
|
NMRfkillType rfkill_type : 4;
|
||||||
|
@@ -162,6 +162,11 @@ can_reapply_change(NMDevice *device,
|
|||||||
NM_SETTING_OVS_BRIDGE_STP_ENABLE);
|
NM_SETTING_OVS_BRIDGE_STP_ENABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (NM_IN_STRSET(setting_name,
|
||||||
|
NM_SETTING_OVS_EXTERNAL_IDS_SETTING_NAME,
|
||||||
|
NM_SETTING_OVS_OTHER_CONFIG_SETTING_NAME))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
return device_class->can_reapply_change(device, setting_name, s_old, s_new, diffs, error);
|
return device_class->can_reapply_change(device, setting_name, s_old, s_new, diffs, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,16 +199,15 @@ nm_device_ovs_bridge_class_init(NMDeviceOvsBridgeClass *klass)
|
|||||||
device_class->connection_type_check_compatible = NM_SETTING_OVS_BRIDGE_SETTING_NAME;
|
device_class->connection_type_check_compatible = NM_SETTING_OVS_BRIDGE_SETTING_NAME;
|
||||||
device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES();
|
device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES();
|
||||||
|
|
||||||
device_class->is_controller = TRUE;
|
device_class->is_controller = TRUE;
|
||||||
device_class->get_type_description = get_type_description;
|
device_class->get_type_description = get_type_description;
|
||||||
device_class->create_and_realize = create_and_realize;
|
device_class->create_and_realize = create_and_realize;
|
||||||
device_class->unrealize = unrealize;
|
device_class->unrealize = unrealize;
|
||||||
device_class->get_generic_capabilities = get_generic_capabilities;
|
device_class->get_generic_capabilities = get_generic_capabilities;
|
||||||
device_class->act_stage3_ip_config = act_stage3_ip_config;
|
device_class->act_stage3_ip_config = act_stage3_ip_config;
|
||||||
device_class->ready_for_ip_config = ready_for_ip_config;
|
device_class->ready_for_ip_config = ready_for_ip_config;
|
||||||
device_class->attach_port = attach_port;
|
device_class->attach_port = attach_port;
|
||||||
device_class->detach_port = detach_port;
|
device_class->detach_port = detach_port;
|
||||||
device_class->can_reapply_change = can_reapply_change;
|
device_class->can_reapply_change = can_reapply_change;
|
||||||
device_class->can_reapply_change_ovs_external_ids = TRUE;
|
device_class->reapply_connection = nm_device_ovs_reapply_connection;
|
||||||
device_class->reapply_connection = nm_device_ovs_reapply_connection;
|
|
||||||
}
|
}
|
||||||
|
@@ -16,6 +16,8 @@
|
|||||||
#include "nm-setting-ovs-bridge.h"
|
#include "nm-setting-ovs-bridge.h"
|
||||||
#include "nm-setting-ovs-interface.h"
|
#include "nm-setting-ovs-interface.h"
|
||||||
#include "nm-setting-ovs-port.h"
|
#include "nm-setting-ovs-port.h"
|
||||||
|
#include "nm-setting-ovs-external-ids.h"
|
||||||
|
#include "nm-setting-ovs-other-config.h"
|
||||||
|
|
||||||
#define _NMLOG_DEVICE_TYPE NMDeviceOvsInterface
|
#define _NMLOG_DEVICE_TYPE NMDeviceOvsInterface
|
||||||
#include "devices/nm-device-logging.h"
|
#include "devices/nm-device-logging.h"
|
||||||
@@ -647,6 +649,28 @@ can_update_from_platform_link(NMDevice *device, const NMPlatformLink *plink)
|
|||||||
return !plink || nm_device_get_state(device) != NM_DEVICE_STATE_DEACTIVATING;
|
return !plink || nm_device_get_state(device) != NM_DEVICE_STATE_DEACTIVATING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
can_reapply_change(NMDevice *device,
|
||||||
|
const char *setting_name,
|
||||||
|
NMSetting *s_old,
|
||||||
|
NMSetting *s_new,
|
||||||
|
GHashTable *diffs,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
NMDeviceClass *device_class = NM_DEVICE_CLASS(nm_device_ovs_interface_parent_class);
|
||||||
|
|
||||||
|
if (NM_IN_STRSET(setting_name,
|
||||||
|
NM_SETTING_OVS_EXTERNAL_IDS_SETTING_NAME,
|
||||||
|
NM_SETTING_OVS_OTHER_CONFIG_SETTING_NAME)) {
|
||||||
|
/* TODO: it's currently not possible to reapply those settings on OVS
|
||||||
|
* system interfaces because they have type != "ovs-interface" (e.g.
|
||||||
|
* "ethernet") */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return device_class->can_reapply_change(device, setting_name, s_old, s_new, diffs, error);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -712,21 +736,21 @@ nm_device_ovs_interface_class_init(NMDeviceOvsInterfaceClass *klass)
|
|||||||
device_class->connection_type_check_compatible = NM_SETTING_OVS_INTERFACE_SETTING_NAME;
|
device_class->connection_type_check_compatible = NM_SETTING_OVS_INTERFACE_SETTING_NAME;
|
||||||
device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES(NM_LINK_TYPE_OPENVSWITCH);
|
device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES(NM_LINK_TYPE_OPENVSWITCH);
|
||||||
|
|
||||||
device_class->can_auto_connect = can_auto_connect;
|
device_class->can_auto_connect = can_auto_connect;
|
||||||
device_class->can_update_from_platform_link = can_update_from_platform_link;
|
device_class->can_update_from_platform_link = can_update_from_platform_link;
|
||||||
device_class->deactivate = deactivate;
|
device_class->deactivate = deactivate;
|
||||||
device_class->deactivate_async = deactivate_async;
|
device_class->deactivate_async = deactivate_async;
|
||||||
device_class->get_type_description = get_type_description;
|
device_class->get_type_description = get_type_description;
|
||||||
device_class->create_and_realize = create_and_realize;
|
device_class->create_and_realize = create_and_realize;
|
||||||
device_class->get_generic_capabilities = get_generic_capabilities;
|
device_class->get_generic_capabilities = get_generic_capabilities;
|
||||||
device_class->is_available = is_available;
|
device_class->is_available = is_available;
|
||||||
device_class->check_connection_compatible = check_connection_compatible;
|
device_class->check_connection_compatible = check_connection_compatible;
|
||||||
device_class->link_changed = link_changed;
|
device_class->link_changed = link_changed;
|
||||||
device_class->act_stage3_ip_config = act_stage3_ip_config;
|
device_class->act_stage3_ip_config = act_stage3_ip_config;
|
||||||
device_class->ready_for_ip_config = ready_for_ip_config;
|
device_class->ready_for_ip_config = ready_for_ip_config;
|
||||||
device_class->can_unmanaged_external_down = can_unmanaged_external_down;
|
device_class->can_unmanaged_external_down = can_unmanaged_external_down;
|
||||||
device_class->set_platform_mtu = set_platform_mtu;
|
device_class->set_platform_mtu = set_platform_mtu;
|
||||||
device_class->get_configured_mtu = nm_device_get_configured_mtu_for_wired;
|
device_class->get_configured_mtu = nm_device_get_configured_mtu_for_wired;
|
||||||
device_class->can_reapply_change_ovs_external_ids = TRUE;
|
device_class->can_reapply_change = can_reapply_change;
|
||||||
device_class->reapply_connection = nm_device_ovs_reapply_connection;
|
device_class->reapply_connection = nm_device_ovs_reapply_connection;
|
||||||
}
|
}
|
||||||
|
@@ -16,6 +16,8 @@
|
|||||||
#include "nm-setting-connection.h"
|
#include "nm-setting-connection.h"
|
||||||
#include "nm-setting-ovs-port.h"
|
#include "nm-setting-ovs-port.h"
|
||||||
#include "nm-setting-ovs-interface.h"
|
#include "nm-setting-ovs-interface.h"
|
||||||
|
#include "nm-setting-ovs-external-ids.h"
|
||||||
|
#include "nm-setting-ovs-other-config.h"
|
||||||
#include "nm-setting-wired.h"
|
#include "nm-setting-wired.h"
|
||||||
|
|
||||||
#define _NMLOG_DEVICE_TYPE NMDeviceOvsPort
|
#define _NMLOG_DEVICE_TYPE NMDeviceOvsPort
|
||||||
@@ -279,6 +281,11 @@ can_reapply_change(NMDevice *device,
|
|||||||
NM_SETTING_OVS_PORT_TRUNKS);
|
NM_SETTING_OVS_PORT_TRUNKS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (NM_IN_STRSET(setting_name,
|
||||||
|
NM_SETTING_OVS_EXTERNAL_IDS_SETTING_NAME,
|
||||||
|
NM_SETTING_OVS_OTHER_CONFIG_SETTING_NAME))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
return device_class->can_reapply_change(device, setting_name, s_old, s_new, diffs, error);
|
return device_class->can_reapply_change(device, setting_name, s_old, s_new, diffs, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,15 +318,14 @@ nm_device_ovs_port_class_init(NMDeviceOvsPortClass *klass)
|
|||||||
device_class->connection_type_check_compatible = NM_SETTING_OVS_PORT_SETTING_NAME;
|
device_class->connection_type_check_compatible = NM_SETTING_OVS_PORT_SETTING_NAME;
|
||||||
device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES();
|
device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES();
|
||||||
|
|
||||||
device_class->is_controller = TRUE;
|
device_class->is_controller = TRUE;
|
||||||
device_class->get_type_description = get_type_description;
|
device_class->get_type_description = get_type_description;
|
||||||
device_class->create_and_realize = create_and_realize;
|
device_class->create_and_realize = create_and_realize;
|
||||||
device_class->get_generic_capabilities = get_generic_capabilities;
|
device_class->get_generic_capabilities = get_generic_capabilities;
|
||||||
device_class->act_stage3_ip_config = act_stage3_ip_config;
|
device_class->act_stage3_ip_config = act_stage3_ip_config;
|
||||||
device_class->ready_for_ip_config = ready_for_ip_config;
|
device_class->ready_for_ip_config = ready_for_ip_config;
|
||||||
device_class->attach_port = attach_port;
|
device_class->attach_port = attach_port;
|
||||||
device_class->detach_port = detach_port;
|
device_class->detach_port = detach_port;
|
||||||
device_class->can_reapply_change = can_reapply_change;
|
device_class->can_reapply_change = can_reapply_change;
|
||||||
device_class->can_reapply_change_ovs_external_ids = TRUE;
|
device_class->reapply_connection = nm_device_ovs_reapply_connection;
|
||||||
device_class->reapply_connection = nm_device_ovs_reapply_connection;
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user