]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
import: append % to X_IMPORT_PROGRESS=
authorFrantisek Sumsal <frantisek@sumsal.cz>
Sat, 25 Nov 2023 19:42:13 +0000 (20:42 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Sat, 25 Nov 2023 19:42:13 +0000 (20:42 +0100)
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
src/import/export-tar.c
src/import/import-raw.c
src/import/import-tar.c
src/import/importd.c
src/import/pull-raw.c
src/import/pull-tar.c

index 5c9c2bbcd947c295b6df831f992a524148fa82f3..f4253962615c0327bee5571f67bbef335552e4b0 100644 (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;
index 2f54cd811486b4fffcb8642b51b917b0f69c7d89..9e92badfef37ac1374fda55782009332c1bc9034 100644 (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;
index 2db3198ba6123fa32c7580ba3e3a9ffe6a15ae9f..f7ed163d86461270b3ad8f6059274b77d2e3abbb 100644 (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;
index 8c1845781692372d5e584ff6492defb1cd9829b2..90202709ecc80bca3732ccdd57d5f48cfed92d8c 100644 (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;
index cb5156bf063e2ee883de57930fc494ad63119850..e1a1ddc2ee186bf3b716dfda28fccaa7ac83f798 100644 (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;
         }
 
index e96be4dd7dbb6de241c51fbb1478b2ddc82b30b2..66c3f656656a8678e78a1057aa83b5a5249e3299 100644 (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);
 }
 
index 2db25192da10e8095fbb3bdc1cbf0f5f34ea5d18..c32fc290143e37536d0acb7e6e30d0b6b587461e 100644 (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);
 }