cloud-setup: add a chicken bit variable for creation of new connections

Make it possible to opt in or out of the behavior of creating
connections for disconnected devices. It's not clear why such policy was
in place, and the feature might come useful outside OCI.

Let's add an (undocumented) knob to configure the behavior. We might
remove it (and perhaps make the behaviour default everywhere), or
document and keep it if it turns out we need to use it.
This commit is contained in:
Lubomir Rintel
2025-04-07 13:04:37 +02:00
parent 93960639e8
commit 0540b3c9bc
2 changed files with 8 additions and 1 deletions

View File

@@ -882,6 +882,7 @@ _config_one(SigTermData *sigterm_data,
guint idx)
{
const NMCSProviderGetConfigIfaceData *config_data = result->iface_datas_arr[idx];
gboolean allow_new_connections;
gboolean any_changes;
g_main_context_iteration(NULL, FALSE);
@@ -904,7 +905,12 @@ _config_one(SigTermData *sigterm_data,
return FALSE;
}
if (NMCS_IS_PROVIDER_OCI(provider) && config_data->priv.oci.vlan_tag != 0) {
/* Default on on OCI, with an environment variable serving as a chicken bit. */
allow_new_connections =
_nm_utils_ascii_str_to_bool(g_getenv(NMCS_ENV_NM_CLOUD_SETUP_ALLOW_NEW_CONN),
NMCS_IS_PROVIDER_OCI(provider));
if (allow_new_connections && config_data->priv.oci.vlan_tag != 0) {
if (config_data->priv.oci.parent_hwaddr == NULL) {
_LOGW("config device %s: has vlan id %d but no parent device",
config_data->hwaddr,

View File

@@ -23,6 +23,7 @@
#define NMCS_ENV_NM_CLOUD_SETUP_GCP_HOST "NM_CLOUD_SETUP_GCP_HOST"
#define NMCS_ENV_NM_CLOUD_SETUP_OCI_HOST "NM_CLOUD_SETUP_OCI_HOST"
#define NMCS_ENV_NM_CLOUD_SETUP_MAP_INTERFACES "NM_CLOUD_SETUP_MAP_INTERFACES"
#define NMCS_ENV_NM_CLOUD_SETUP_ALLOW_NEW_CONN "NM_CLOUD_SETUP_ALLOW_NEW_CONN"
/*****************************************************************************/