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;
|
||||
}
|
||||
|
||||
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:
|
||||
g_set_error(error,
|
||||
NM_DEVICE_ERROR,
|
||||
|
@@ -209,8 +209,6 @@ typedef struct _NMDeviceClass {
|
||||
|
||||
bool act_stage1_prepare_set_hwaddr_ethernet : 1;
|
||||
|
||||
bool can_reapply_change_ovs_external_ids : 1;
|
||||
|
||||
bool allow_autoconnect_on_external : 1;
|
||||
|
||||
NMRfkillType rfkill_type : 4;
|
||||
|
@@ -162,6 +162,11 @@ can_reapply_change(NMDevice *device,
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -204,6 +209,5 @@ nm_device_ovs_bridge_class_init(NMDeviceOvsBridgeClass *klass)
|
||||
device_class->attach_port = attach_port;
|
||||
device_class->detach_port = detach_port;
|
||||
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;
|
||||
}
|
||||
|
@@ -16,6 +16,8 @@
|
||||
#include "nm-setting-ovs-bridge.h"
|
||||
#include "nm-setting-ovs-interface.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
|
||||
#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;
|
||||
}
|
||||
|
||||
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
|
||||
@@ -727,6 +751,6 @@ nm_device_ovs_interface_class_init(NMDeviceOvsInterfaceClass *klass)
|
||||
device_class->can_unmanaged_external_down = can_unmanaged_external_down;
|
||||
device_class->set_platform_mtu = set_platform_mtu;
|
||||
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;
|
||||
}
|
||||
|
@@ -16,6 +16,8 @@
|
||||
#include "nm-setting-connection.h"
|
||||
#include "nm-setting-ovs-port.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"
|
||||
|
||||
#define _NMLOG_DEVICE_TYPE NMDeviceOvsPort
|
||||
@@ -279,6 +281,11 @@ can_reapply_change(NMDevice *device,
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -320,6 +327,5 @@ nm_device_ovs_port_class_init(NMDeviceOvsPortClass *klass)
|
||||
device_class->attach_port = attach_port;
|
||||
device_class->detach_port = detach_port;
|
||||
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user