1
0
mirror of https://github.com/systemd/systemd synced 2024-07-09 04:26:06 +00:00

import: append % to X_IMPORT_PROGRESS=

Since we parse it on the other side via parse_percent() which requires
that, otherwise we get an error:

[    8.133131] testsuite-13.sh[649]: + machinectl import-raw /tmp/container.raw container-raw
[    8.175035] machinectl[1143]: Enqueued transfer job 1. Press C-c to continue download in background.
[    8.182130] machinectl[1143]: Importing '/tmp/container.raw', saving as 'container-raw'.
[    8.182377] systemd-importd[1144]: Got invalid percent value '0', ignoring.
[    8.182451] machinectl[1143]: Imported 0%.
[    8.282669] systemd-importd[1144]: Got invalid percent value '40', ignoring.
[    8.282746] machinectl[1143]: Imported 40%.
[    8.366448] machinectl[1143]: Wrote 64.0M.
[    8.366519] machinectl[1143]: Operation completed successfully.
[    8.366617] machinectl[1143]: Exiting.
This commit is contained in:
Frantisek Sumsal 2023-11-25 20:42:13 +01:00
parent 60f9c49b16
commit a986de6899
7 changed files with 7 additions and 7 deletions

View File

@ -120,7 +120,7 @@ static void raw_export_report_progress(RawExport *e) {
if (!ratelimit_below(&e->progress_ratelimit))
return;
sd_notifyf(false, "X_IMPORT_PROGRESS=%u", percent);
sd_notifyf(false, "X_IMPORT_PROGRESS=%u%%", percent);
log_info("Exported %u%%.", percent);
e->last_percent = percent;

View File

@ -131,7 +131,7 @@ static void tar_export_report_progress(TarExport *e) {
if (!ratelimit_below(&e->progress_ratelimit))
return;
sd_notifyf(false, "X_IMPORT_PROGRESS=%u", percent);
sd_notifyf(false, "X_IMPORT_PROGRESS=%u%%", percent);
log_info("Exported %u%%.", percent);
e->last_percent = percent;

View File

@ -147,7 +147,7 @@ static void raw_import_report_progress(RawImport *i) {
if (!ratelimit_below(&i->progress_ratelimit))
return;
sd_notifyf(false, "X_IMPORT_PROGRESS=%u", percent);
sd_notifyf(false, "X_IMPORT_PROGRESS=%u%%", percent);
log_info("Imported %u%%.", percent);
i->last_percent = percent;

View File

@ -148,7 +148,7 @@ static void tar_import_report_progress(TarImport *i) {
if (!ratelimit_below(&i->progress_ratelimit))
return;
sd_notifyf(false, "X_IMPORT_PROGRESS=%u", percent);
sd_notifyf(false, "X_IMPORT_PROGRESS=%u%%", percent);
log_info("Imported %u%%.", percent);
i->last_percent = percent;

View File

@ -598,7 +598,7 @@ static int manager_on_notify(sd_event_source *s, int fd, uint32_t revents, void
r = parse_percent(p);
if (r < 0) {
log_warning("Got invalid percent value, ignoring.");
log_warning("Got invalid percent value '%s', ignoring.", p);
return 0;
}

View File

@ -232,7 +232,7 @@ static void raw_pull_report_progress(RawPull *i, RawProgress p) {
assert_not_reached();
}
sd_notifyf(false, "X_IMPORT_PROGRESS=%u", percent);
sd_notifyf(false, "X_IMPORT_PROGRESS=%u%%", percent);
log_debug("Combined progress %u%%", percent);
}

View File

@ -192,7 +192,7 @@ static void tar_pull_report_progress(TarPull *i, TarProgress p) {
assert_not_reached();
}
sd_notifyf(false, "X_IMPORT_PROGRESS=%u", percent);
sd_notifyf(false, "X_IMPORT_PROGRESS=%u%%", percent);
log_debug("Combined progress %u%%", percent);
}