]> sourceware.org Git - lvm2.git/commitdiff
device_mapper: suppress warns about inactive query
authorZdenek Kabelac <zkabelac@redhat.com>
Thu, 7 Nov 2024 17:46:24 +0000 (18:46 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Fri, 8 Nov 2024 18:41:50 +0000 (19:41 +0100)
When command prints warning about suppressing query
for inactive table, because this is not supported
by kernel - 1 printed message is just enough, no
reason to 'spam' command output all the time, message
will remain only in debug log.

Also drop 'WARNING:' from real 'error' message.
WARNIGS are supposed to be just warning and command
then exists with 'success'.

device_mapper/ioctl/libdm-iface.c
libdm/ioctl/libdm-iface.c

index 3f8a3e4ebfa472f69568d6d5bad8bf322e0e02b0..235857426f9b94e061348f7a3ddd43aa69c186aa 100644 (file)
@@ -70,6 +70,7 @@ static unsigned _dm_version_minor = 0;
 static unsigned _dm_version_patchlevel = 0;
 static int _log_suppress = 0;
 static struct dm_timestamp *_dm_ioctl_timestamp = NULL;
+static int _dm_warn_inactive_suppress = 0;
 
 /*
  * If the kernel dm driver only supports one major number
@@ -1412,22 +1413,23 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
        }
        if (dmt->query_inactive_table) {
                if (!_dm_inactive_supported())
-                       log_warn("WARNING: Inactive table query unsupported "
-                                "by kernel.  It will use live table.");
+                       log_warn_suppress(_dm_warn_inactive_suppress++,
+                                         "WARNING: Inactive table query unsupported by kernel. "
+                                         "It will use live table.");
                dmi->flags |= DM_QUERY_INACTIVE_TABLE_FLAG;
        }
        if (dmt->new_uuid) {
                if (_dm_version_minor < 19) {
-                       log_error("WARNING: Setting UUID unsupported by "
-                                 "kernel.  Aborting operation.");
+                       log_error("Setting UUID unsupported by kernel. "
+                                 "Aborting operation.");
                        goto bad;
                }
                dmi->flags |= DM_UUID_FLAG;
        }
        if (dmt->ima_measurement) {
                if (_dm_version_minor < 45) {
-                       log_error("WARNING: IMA measurement unsupported by "
-                                 "kernel.  Aborting operation.");
+                       log_error("IMA measurement unsupported by kernel. "
+                                 "Aborting operation.");
                        goto bad;
                }
                dmi->flags |= DM_IMA_MEASUREMENT_FLAG;
index d100858810c91c8d7a1f3fcbfadbc13ab59f8bcc..7e42f275246ef5f0e8962e08eaddccbf0278d29c 100644 (file)
@@ -69,6 +69,7 @@ static unsigned _dm_version_minor = 0;
 static unsigned _dm_version_patchlevel = 0;
 static int _log_suppress = 0;
 static struct dm_timestamp *_dm_ioctl_timestamp = NULL;
+static int _dm_warn_inactive_suppress = 0;
 
 /*
  * If the kernel dm driver only supports one major number
@@ -1307,22 +1308,23 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
        }
        if (dmt->query_inactive_table) {
                if (!_dm_inactive_supported())
-                       log_warn("WARNING: Inactive table query unsupported "
-                                "by kernel.  It will use live table.");
+                       log_warn_suppress(_dm_warn_inactive_suppress++,
+                                         "WARNING: Inactive table query unsupported by kernel. "
+                                         "It will use live table.");
                dmi->flags |= DM_QUERY_INACTIVE_TABLE_FLAG;
        }
        if (dmt->new_uuid) {
                if (_dm_version_minor < 19) {
-                       log_error("WARNING: Setting UUID unsupported by "
-                                 "kernel.  Aborting operation.");
+                       log_error("Setting UUID unsupported by kernel. "
+                                 "Aborting operation.");
                        goto bad;
                }
                dmi->flags |= DM_UUID_FLAG;
        }
        if (dmt->ima_measurement) {
                if (_dm_version_minor < 45) {
-                       log_error("WARNING: IMA measurement unsupported by "
-                                 "kernel.  Aborting operation.");
+                       log_error("IMA measurement unsupported by kernel. "
+                                 "Aborting operation.");
                        goto bad;
                }
                dmi->flags |= DM_IMA_MEASUREMENT_FLAG;
This page took 0.044749 seconds and 5 git commands to generate.