1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

device_mapper: suppress warns about inactive query

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'.
This commit is contained in:
Zdenek Kabelac 2024-11-07 18:46:24 +01:00
parent 158d3243b6
commit c3ed3f28a2
2 changed files with 16 additions and 12 deletions

View File

@ -70,6 +70,7 @@ static unsigned _dm_version_minor = 0;
static unsigned _dm_version_patchlevel = 0; static unsigned _dm_version_patchlevel = 0;
static int _log_suppress = 0; static int _log_suppress = 0;
static struct dm_timestamp *_dm_ioctl_timestamp = NULL; 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 * 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 (dmt->query_inactive_table) {
if (!_dm_inactive_supported()) if (!_dm_inactive_supported())
log_warn("WARNING: Inactive table query unsupported " log_warn_suppress(_dm_warn_inactive_suppress++,
"by kernel. It will use live table."); "WARNING: Inactive table query unsupported by kernel. "
"It will use live table.");
dmi->flags |= DM_QUERY_INACTIVE_TABLE_FLAG; dmi->flags |= DM_QUERY_INACTIVE_TABLE_FLAG;
} }
if (dmt->new_uuid) { if (dmt->new_uuid) {
if (_dm_version_minor < 19) { if (_dm_version_minor < 19) {
log_error("WARNING: Setting UUID unsupported by " log_error("Setting UUID unsupported by kernel. "
"kernel. Aborting operation."); "Aborting operation.");
goto bad; goto bad;
} }
dmi->flags |= DM_UUID_FLAG; dmi->flags |= DM_UUID_FLAG;
} }
if (dmt->ima_measurement) { if (dmt->ima_measurement) {
if (_dm_version_minor < 45) { if (_dm_version_minor < 45) {
log_error("WARNING: IMA measurement unsupported by " log_error("IMA measurement unsupported by kernel. "
"kernel. Aborting operation."); "Aborting operation.");
goto bad; goto bad;
} }
dmi->flags |= DM_IMA_MEASUREMENT_FLAG; dmi->flags |= DM_IMA_MEASUREMENT_FLAG;

View File

@ -69,6 +69,7 @@ static unsigned _dm_version_minor = 0;
static unsigned _dm_version_patchlevel = 0; static unsigned _dm_version_patchlevel = 0;
static int _log_suppress = 0; static int _log_suppress = 0;
static struct dm_timestamp *_dm_ioctl_timestamp = NULL; 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 * 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 (dmt->query_inactive_table) {
if (!_dm_inactive_supported()) if (!_dm_inactive_supported())
log_warn("WARNING: Inactive table query unsupported " log_warn_suppress(_dm_warn_inactive_suppress++,
"by kernel. It will use live table."); "WARNING: Inactive table query unsupported by kernel. "
"It will use live table.");
dmi->flags |= DM_QUERY_INACTIVE_TABLE_FLAG; dmi->flags |= DM_QUERY_INACTIVE_TABLE_FLAG;
} }
if (dmt->new_uuid) { if (dmt->new_uuid) {
if (_dm_version_minor < 19) { if (_dm_version_minor < 19) {
log_error("WARNING: Setting UUID unsupported by " log_error("Setting UUID unsupported by kernel. "
"kernel. Aborting operation."); "Aborting operation.");
goto bad; goto bad;
} }
dmi->flags |= DM_UUID_FLAG; dmi->flags |= DM_UUID_FLAG;
} }
if (dmt->ima_measurement) { if (dmt->ima_measurement) {
if (_dm_version_minor < 45) { if (_dm_version_minor < 45) {
log_error("WARNING: IMA measurement unsupported by " log_error("IMA measurement unsupported by kernel. "
"kernel. Aborting operation."); "Aborting operation.");
goto bad; goto bad;
} }
dmi->flags |= DM_IMA_MEASUREMENT_FLAG; dmi->flags |= DM_IMA_MEASUREMENT_FLAG;