mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 11:19:16 +02:00
ovs/factory: improve logging
Be clearer about the progress of creating the device and ways it can end up failing. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2207
This commit is contained in:
parent
4ec06e1eaa
commit
5ef3cfa4d0
1 changed files with 17 additions and 6 deletions
|
|
@ -75,8 +75,10 @@ new_device_from_type(const char *name, NMDeviceType device_type)
|
||||||
const char *type_desc;
|
const char *type_desc;
|
||||||
NMLinkType link_type = NM_LINK_TYPE_NONE;
|
NMLinkType link_type = NM_LINK_TYPE_NONE;
|
||||||
|
|
||||||
if (nm_manager_get_device(NM_MANAGER_GET, name, device_type))
|
if (nm_manager_get_device(NM_MANAGER_GET, name, device_type)) {
|
||||||
|
_LOGT(name, NULL, "Device already registered with manager, skipping.");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (device_type == NM_DEVICE_TYPE_OVS_INTERFACE) {
|
if (device_type == NM_DEVICE_TYPE_OVS_INTERFACE) {
|
||||||
type = NM_TYPE_DEVICE_OVS_INTERFACE;
|
type = NM_TYPE_DEVICE_OVS_INTERFACE;
|
||||||
|
|
@ -89,6 +91,7 @@ new_device_from_type(const char *name, NMDeviceType device_type)
|
||||||
type = NM_TYPE_DEVICE_OVS_BRIDGE;
|
type = NM_TYPE_DEVICE_OVS_BRIDGE;
|
||||||
type_desc = "Open vSwitch Bridge";
|
type_desc = "Open vSwitch Bridge";
|
||||||
} else {
|
} else {
|
||||||
|
_LOGT(name, NULL, "Unrecognized link type: %d", device_type);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -288,23 +291,31 @@ create_device(NMDeviceFactory *self,
|
||||||
{
|
{
|
||||||
NMDeviceType device_type = NM_DEVICE_TYPE_UNKNOWN;
|
NMDeviceType device_type = NM_DEVICE_TYPE_UNKNOWN;
|
||||||
const char *connection_type = NULL;
|
const char *connection_type = NULL;
|
||||||
|
const char *connection_uuid = NULL;
|
||||||
|
|
||||||
if (g_strcmp0(iface, "ovs-system") == 0) {
|
if (g_strcmp0(iface, "ovs-system") == 0) {
|
||||||
*out_ignore = TRUE;
|
*out_ignore = TRUE;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connection)
|
if (connection) {
|
||||||
connection_type = nm_connection_get_connection_type(connection);
|
connection_type = nm_connection_get_connection_type(connection);
|
||||||
|
connection_uuid = nm_connection_get_uuid(connection);
|
||||||
|
}
|
||||||
|
|
||||||
if (plink)
|
if (plink) {
|
||||||
|
_LOGD(iface, connection_uuid, "creating OVS interface (from a platform link)");
|
||||||
device_type = NM_DEVICE_TYPE_OVS_INTERFACE;
|
device_type = NM_DEVICE_TYPE_OVS_INTERFACE;
|
||||||
else if (g_strcmp0(connection_type, NM_SETTING_OVS_INTERFACE_SETTING_NAME) == 0)
|
} else if (nm_streq0(connection_type, NM_SETTING_OVS_INTERFACE_SETTING_NAME)) {
|
||||||
|
_LOGD(iface, connection_uuid, "creating OVS interface (from setting)");
|
||||||
device_type = NM_DEVICE_TYPE_OVS_INTERFACE;
|
device_type = NM_DEVICE_TYPE_OVS_INTERFACE;
|
||||||
else if (g_strcmp0(connection_type, NM_SETTING_OVS_PORT_SETTING_NAME) == 0)
|
} else if (nm_streq0(connection_type, NM_SETTING_OVS_PORT_SETTING_NAME)) {
|
||||||
|
_LOGD(iface, connection_uuid, "creating OVS port (from setting)");
|
||||||
device_type = NM_DEVICE_TYPE_OVS_PORT;
|
device_type = NM_DEVICE_TYPE_OVS_PORT;
|
||||||
else if (g_strcmp0(connection_type, NM_SETTING_OVS_BRIDGE_SETTING_NAME) == 0)
|
} else if (nm_streq0(connection_type, NM_SETTING_OVS_BRIDGE_SETTING_NAME)) {
|
||||||
|
_LOGD(iface, connection_uuid, "creating OVS bridge (from setting)");
|
||||||
device_type = NM_DEVICE_TYPE_OVS_BRIDGE;
|
device_type = NM_DEVICE_TYPE_OVS_BRIDGE;
|
||||||
|
}
|
||||||
|
|
||||||
return new_device_from_type(iface, device_type);
|
return new_device_from_type(iface, device_type);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue