mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
wiping: log_warn instead of log_error if blkid wipe ignored for a signature
Comply with the rules we have for log_error and log_warn... $ pvcreate /dev/sda1 Failed to get offset of the xfs_external_log signature on /dev/sda1. 1 existing signature left on the device. Aborting pvcreate on /dev/sda1. $ pvcreate /dev/sda1 --force WARNING: Failed to get offset of the xfs_external_log signature on /dev/sda1. Physical volume "/dev/sda1" successfully created
This commit is contained in:
parent
2a7c2539c6
commit
697fb353dc
@ -528,12 +528,13 @@ static inline int _type_in_flag_list(const char *type, uint32_t flag_list)
|
|||||||
((flag_list & TYPE_DM_SNAPSHOT_COW) && !strcmp(type, "DM_snapshot_cow")));
|
((flag_list & TYPE_DM_SNAPSHOT_COW) && !strcmp(type, "DM_snapshot_cow")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MSG_FAILED_SIG_OFFSET "Failed to get offset of the %s signature on %s."
|
||||||
|
#define MSG_FAILED_SIG_LENGTH "Failed to get length of the %s signature on %s."
|
||||||
|
|
||||||
static int _blkid_wipe(blkid_probe probe, struct device *dev, const char *name,
|
static int _blkid_wipe(blkid_probe probe, struct device *dev, const char *name,
|
||||||
uint32_t types_to_exclude, uint32_t types_no_prompt,
|
uint32_t types_to_exclude, uint32_t types_no_prompt,
|
||||||
int yes, force_t force)
|
int yes, force_t force)
|
||||||
{
|
{
|
||||||
static const char _msg_failed_offset[] = "Failed to get offset of the %s signature on %s.";
|
|
||||||
static const char _msg_failed_length[] = "Failed to get length of the %s signature on %s.";
|
|
||||||
static const char _msg_wiping[] = "Wiping %s signature on %s.";
|
static const char _msg_wiping[] = "Wiping %s signature on %s.";
|
||||||
const char *offset = NULL, *type = NULL, *magic = NULL,
|
const char *offset = NULL, *type = NULL, *magic = NULL,
|
||||||
*usage = NULL, *label = NULL, *uuid = NULL;
|
*usage = NULL, *label = NULL, *uuid = NULL;
|
||||||
@ -544,21 +545,41 @@ static int _blkid_wipe(blkid_probe probe, struct device *dev, const char *name,
|
|||||||
if (_type_in_flag_list(type, types_to_exclude))
|
if (_type_in_flag_list(type, types_to_exclude))
|
||||||
return 2;
|
return 2;
|
||||||
if (blkid_probe_lookup_value(probe, "SBMAGIC_OFFSET", &offset, NULL)) {
|
if (blkid_probe_lookup_value(probe, "SBMAGIC_OFFSET", &offset, NULL)) {
|
||||||
log_error(_msg_failed_offset, type, name);
|
if (force < DONT_PROMPT) {
|
||||||
return (force < DONT_PROMPT) ? 0 : 2;
|
log_error(MSG_FAILED_SIG_OFFSET, type, name);
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
log_error("WARNING: " MSG_FAILED_SIG_OFFSET, type, name);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (blkid_probe_lookup_value(probe, "SBMAGIC", &magic, &len)) {
|
if (blkid_probe_lookup_value(probe, "SBMAGIC", &magic, &len)) {
|
||||||
log_error(_msg_failed_length, type, name);
|
if (force < DONT_PROMPT) {
|
||||||
return (force < DONT_PROMPT) ? 0 : 2;
|
log_error(MSG_FAILED_SIG_LENGTH, type, name);
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
log_warn("WARNING: " MSG_FAILED_SIG_LENGTH, type, name);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (!blkid_probe_lookup_value(probe, "PTTYPE", &type, NULL)) {
|
} else if (!blkid_probe_lookup_value(probe, "PTTYPE", &type, NULL)) {
|
||||||
if (blkid_probe_lookup_value(probe, "PTMAGIC_OFFSET", &offset, NULL)) {
|
if (blkid_probe_lookup_value(probe, "PTMAGIC_OFFSET", &offset, NULL)) {
|
||||||
log_error(_msg_failed_offset, type, name);
|
if (force < DONT_PROMPT) {
|
||||||
return (force < DONT_PROMPT) ? 0 : 2;
|
log_error(MSG_FAILED_SIG_OFFSET, type, name);
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
log_warn("WARNING: " MSG_FAILED_SIG_OFFSET, type, name);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (blkid_probe_lookup_value(probe, "PTMAGIC", &magic, &len)) {
|
if (blkid_probe_lookup_value(probe, "PTMAGIC", &magic, &len)) {
|
||||||
log_error(_msg_failed_length, type, name);
|
if (force < DONT_PROMPT) {
|
||||||
return (force < DONT_PROMPT) ? 0 : 2;
|
log_error(MSG_FAILED_SIG_LENGTH, type, name);
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
log_warn("WARNING: " MSG_FAILED_SIG_LENGTH, type, name);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
usage = "partition table";
|
usage = "partition table";
|
||||||
} else
|
} else
|
||||||
|
Loading…
Reference in New Issue
Block a user