From a986de6899e218a838c6dff93b8ebacb36d1ddf5 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Sat, 25 Nov 2023 20:42:13 +0100 Subject: [PATCH] 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. --- src/import/export-raw.c | 2 +- src/import/export-tar.c | 2 +- src/import/import-raw.c | 2 +- src/import/import-tar.c | 2 +- src/import/importd.c | 2 +- src/import/pull-raw.c | 2 +- src/import/pull-tar.c | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/import/export-raw.c b/src/import/export-raw.c index 5c9c2bbcd9..f425396261 100644 --- a/src/import/export-raw.c +++ b/src/import/export-raw.c @@ -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; diff --git a/src/import/export-tar.c b/src/import/export-tar.c index 2f54cd8114..9e92badfef 100644 --- a/src/import/export-tar.c +++ b/src/import/export-tar.c @@ -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; diff --git a/src/import/import-raw.c b/src/import/import-raw.c index 2db3198ba6..f7ed163d86 100644 --- a/src/import/import-raw.c +++ b/src/import/import-raw.c @@ -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; diff --git a/src/import/import-tar.c b/src/import/import-tar.c index 8c18457816..90202709ec 100644 --- a/src/import/import-tar.c +++ b/src/import/import-tar.c @@ -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; diff --git a/src/import/importd.c b/src/import/importd.c index cb5156bf06..e1a1ddc2ee 100644 --- a/src/import/importd.c +++ b/src/import/importd.c @@ -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; } diff --git a/src/import/pull-raw.c b/src/import/pull-raw.c index e96be4dd7d..66c3f65665 100644 --- a/src/import/pull-raw.c +++ b/src/import/pull-raw.c @@ -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); } diff --git a/src/import/pull-tar.c b/src/import/pull-tar.c index 2db25192da..c32fc29014 100644 --- a/src/import/pull-tar.c +++ b/src/import/pull-tar.c @@ -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); }