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

debug: fix message severity levels

Add some missing WARNS and correct some severity levels.
This commit is contained in:
Zdenek Kabelac 2023-10-06 00:00:36 +02:00
parent 1901a47df1
commit 44f86d38f9
2 changed files with 20 additions and 19 deletions

View File

@ -50,8 +50,10 @@ static int _get_crypt_path(dev_t lv_devt, char *lv_path, char *crypt_path)
int ret = 0; int ret = 0;
if (dm_snprintf(holders_path, sizeof(holders_path), "%sdev/block/%d:%d/holders", if (dm_snprintf(holders_path, sizeof(holders_path), "%sdev/block/%d:%d/holders",
dm_sysfs_dir(), (int)MAJOR(lv_devt), (int)MINOR(lv_devt)) < 0) dm_sysfs_dir(), (int)MAJOR(lv_devt), (int)MINOR(lv_devt)) < 0) {
return_0; log_error("Couldn't create holder path for %s.", lv_path);
return 0;
}
/* If the crypt dev is not active, there will be no LV holder. */ /* If the crypt dev is not active, there will be no LV holder. */
if (stat(holders_path, &st)) { if (stat(holders_path, &st)) {
@ -557,17 +559,16 @@ int fs_extend_script(struct cmd_context *cmd, struct logical_volume *lv, struct
devpath = fsi->needs_crypt ? crypt_path : (char *)display_lvname(lv); devpath = fsi->needs_crypt ? crypt_path : (char *)display_lvname(lv);
log_print("Extending file system %s to %s (%llu bytes) on %s...", log_print_unless_silent("Extending file system %s to %s (%llu bytes) on %s...",
fsi->fstype, display_size(cmd, newsize_bytes_fs/512), fsi->fstype, display_size(cmd, newsize_bytes_fs/512),
(unsigned long long)newsize_bytes_fs, devpath); (unsigned long long)newsize_bytes_fs, devpath);
if (!exec_cmd(cmd, argv, &status, 1)) { if (!exec_cmd(cmd, argv, &status, 1)) {
log_error("Failed to extend file system with lvresize_fs_helper."); log_error("Failed to extend file system with lvresize_fs_helper.");
return 0; return 0;
} }
log_print("Extended file system %s on %s.", fsi->fstype, devpath); log_print_unless_silent("Extended file system %s on %s.", fsi->fstype, devpath);
return 1; return 1;
} }

View File

@ -68,7 +68,7 @@ int online_pvid_file_read(char *path, int *major, int *minor, char *vgname, char
fd = open(path, O_RDONLY); fd = open(path, O_RDONLY);
if (fd < 0) { if (fd < 0) {
log_warn("Failed to open %s", path); log_warn("WARNING: Failed to open %s.", path);
return 0; return 0;
} }
@ -76,13 +76,13 @@ int online_pvid_file_read(char *path, int *major, int *minor, char *vgname, char
if (close(fd)) if (close(fd))
log_sys_debug("close", path); log_sys_debug("close", path);
if (!rv || rv < 0) { if (!rv || rv < 0) {
log_warn("No info in %s", path); log_warn("WARNING: No info in %s.", path);
return 0; return 0;
} }
buf[rv] = 0; /* \0 terminated buffer */ buf[rv] = 0; /* \0 terminated buffer */
if (sscanf(buf, "%d:%d", major, minor) != 2) { if (sscanf(buf, "%d:%d", major, minor) != 2) {
log_warn("No device numbers in %s", path); log_warn("WARNING: No device numbers in %s.", path);
return 0; return 0;
} }
@ -94,13 +94,13 @@ int online_pvid_file_read(char *path, int *major, int *minor, char *vgname, char
} }
if (!_copy_pvid_file_field("vg:", buf, MAX_PVID_FILE_SIZE, vgname, NAME_LEN)) { if (!_copy_pvid_file_field("vg:", buf, MAX_PVID_FILE_SIZE, vgname, NAME_LEN)) {
log_warn("Ignoring invalid vg field in %s", path); log_warn("WARNING: Ignoring invalid vg field in %s.", path);
vgname[0] = '\0'; vgname[0] = '\0';
goto copy_dev; goto copy_dev;
} }
if (!validate_name(vgname)) { if (!validate_name(vgname)) {
log_warn("Ignoring invalid vgname in %s (%s)", path, vgname); log_warn("WARNING: Ignoring invalid vgname in %s (%s).", path, vgname);
vgname[0] = '\0'; vgname[0] = '\0';
goto copy_dev; goto copy_dev;
} }
@ -115,13 +115,13 @@ int online_pvid_file_read(char *path, int *major, int *minor, char *vgname, char
} }
if (!_copy_pvid_file_field("dev:", buf, MAX_PVID_FILE_SIZE, devname, NAME_LEN)) { if (!_copy_pvid_file_field("dev:", buf, MAX_PVID_FILE_SIZE, devname, NAME_LEN)) {
log_warn("Ignoring invalid devname field in %s", path); log_warn("WARNING: Ignoring invalid devname field in %s.", path);
devname[0] = '\0'; devname[0] = '\0';
goto out; goto out;
} }
if (strncmp(devname, "/dev/", 5)) { if (strncmp(devname, "/dev/", 5)) {
log_warn("Ignoring invalid devname in %s (%s)", path, devname); log_warn("WARNING: Ignoring invalid devname in %s (%s).", path, devname);
devname[0] = '\0'; devname[0] = '\0';
goto out; goto out;
} }
@ -208,7 +208,7 @@ void online_vg_file_remove(const char *vgname)
char path[PATH_MAX]; char path[PATH_MAX];
if (dm_snprintf(path, sizeof(path), "%s/%s", VGS_ONLINE_DIR, vgname) < 0) { if (dm_snprintf(path, sizeof(path), "%s/%s", VGS_ONLINE_DIR, vgname) < 0) {
log_error("Path %s/%s is too long.", VGS_ONLINE_DIR, vgname); log_debug("Path %s/%s is too long.", VGS_ONLINE_DIR, vgname);
return; return;
} }
@ -422,7 +422,7 @@ int get_pvs_lookup(struct dm_list *pvs_online, const char *vgname)
if (vgname && file_vgname[0] && strcmp(file_vgname, vgname)) { if (vgname && file_vgname[0] && strcmp(file_vgname, vgname)) {
/* Should never happen */ /* Should never happen */
log_error("Incorrect VG lookup file %s PVID %s %s.", vgname, pvid, file_vgname); log_error("Incorrect VG lookup file %s PVID %s %s.", vgname, pvid, file_vgname);
goto_bad; goto bad;
} }
if (!(po = zalloc(sizeof(*po)))) if (!(po = zalloc(sizeof(*po))))
@ -436,11 +436,11 @@ int get_pvs_lookup(struct dm_list *pvs_online, const char *vgname)
if (file_devname[0]) if (file_devname[0])
strncpy(po->devname, file_devname, NAME_LEN-1); strncpy(po->devname, file_devname, NAME_LEN-1);
log_debug("Found PV online lookup %s for VG %s on %s", path, vgname, file_devname); log_debug("Found PV online lookup %s for VG %s on %s.", path, vgname, file_devname);
dm_list_add(pvs_online, &po->list); dm_list_add(pvs_online, &po->list);
} }
log_debug("Found PVs online lookup %d for %s", dm_list_size(pvs_online), vgname); log_debug("Found PVs online lookup %d for %s.", dm_list_size(pvs_online), vgname);
if (fclose(fp)) if (fclose(fp))
log_sys_debug("fclose", lookup_path); log_sys_debug("fclose", lookup_path);
@ -513,7 +513,7 @@ void online_lookup_file_remove(const char *vgname)
char path[PATH_MAX]; char path[PATH_MAX];
if (dm_snprintf(path, sizeof(path), "%s/%s", PVS_LOOKUP_DIR, vgname) < 0) { if (dm_snprintf(path, sizeof(path), "%s/%s", PVS_LOOKUP_DIR, vgname) < 0) {
log_error("Path %s/%s is too long.", PVS_LOOKUP_DIR, vgname); log_debug("Path %s/%s is too long.", PVS_LOOKUP_DIR, vgname);
return; return;
} }