mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
sysupdate: also mention patterns to match in error log on failure
The gpt uuid is not the only thing that needs to match, the pattern does as well, so mention it in the error log if present
This commit is contained in:
@@ -769,21 +769,32 @@ int transfer_vacuum(
|
|||||||
limit = instances_max - space;
|
limit = instances_max - space;
|
||||||
|
|
||||||
if (t->target.type == RESOURCE_PARTITION && space != UINT64_MAX) {
|
if (t->target.type == RESOURCE_PARTITION && space != UINT64_MAX) {
|
||||||
|
_cleanup_free_ char *patterns = NULL;
|
||||||
uint64_t rm, remain;
|
uint64_t rm, remain;
|
||||||
|
|
||||||
|
patterns = strv_join(t->target.patterns, "|");
|
||||||
|
if (!patterns)
|
||||||
|
(void) log_oom_debug();
|
||||||
|
|
||||||
/* If we are looking at a partition table, we also have to take into account how many
|
/* If we are looking at a partition table, we also have to take into account how many
|
||||||
* partition slots of the right type are available */
|
* partition slots of the right type are available */
|
||||||
|
|
||||||
if (t->target.n_empty + t->target.n_instances < 2)
|
if (t->target.n_empty + t->target.n_instances < 2)
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(ENOSPC),
|
return log_error_errno(SYNTHETIC_ERRNO(ENOSPC),
|
||||||
"Partition table has less than two partition slots of the right type " SD_ID128_UUID_FORMAT_STR " (%s), refusing.",
|
"Partition table has less than two partition slots of the right type " SD_ID128_UUID_FORMAT_STR " (%s)%s%s%s, refusing.",
|
||||||
SD_ID128_FORMAT_VAL(t->target.partition_type.uuid),
|
SD_ID128_FORMAT_VAL(t->target.partition_type.uuid),
|
||||||
gpt_partition_type_uuid_to_string(t->target.partition_type.uuid));
|
gpt_partition_type_uuid_to_string(t->target.partition_type.uuid),
|
||||||
|
!isempty(patterns) ? " and matching the expected pattern '" : "",
|
||||||
|
strempty(patterns),
|
||||||
|
!isempty(patterns) ? "'" : "");
|
||||||
if (space > t->target.n_empty + t->target.n_instances)
|
if (space > t->target.n_empty + t->target.n_instances)
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(ENOSPC),
|
return log_error_errno(SYNTHETIC_ERRNO(ENOSPC),
|
||||||
"Partition table does not have enough partition slots of right type " SD_ID128_UUID_FORMAT_STR " (%s) for operation.",
|
"Partition table does not have enough partition slots of right type " SD_ID128_UUID_FORMAT_STR " (%s)%s%s%s for operation.",
|
||||||
SD_ID128_FORMAT_VAL(t->target.partition_type.uuid),
|
SD_ID128_FORMAT_VAL(t->target.partition_type.uuid),
|
||||||
gpt_partition_type_uuid_to_string(t->target.partition_type.uuid));
|
gpt_partition_type_uuid_to_string(t->target.partition_type.uuid),
|
||||||
|
!isempty(patterns) ? " and matching the expected pattern '" : "",
|
||||||
|
strempty(patterns),
|
||||||
|
!isempty(patterns) ? "'" : "");
|
||||||
if (space == t->target.n_empty + t->target.n_instances)
|
if (space == t->target.n_empty + t->target.n_instances)
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(ENOSPC),
|
return log_error_errno(SYNTHETIC_ERRNO(ENOSPC),
|
||||||
"Asked to empty all partition table slots of the right type " SD_ID128_UUID_FORMAT_STR " (%s), can't allow that. One instance must always remain.",
|
"Asked to empty all partition table slots of the right type " SD_ID128_UUID_FORMAT_STR " (%s), can't allow that. One instance must always remain.",
|
||||||
|
|||||||
Reference in New Issue
Block a user