All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] migration: Fixes and cleanups aroung migrate-set-parameters
@ 2021-02-02 14:17 Markus Armbruster
  2021-02-02 14:17 ` [PATCH v2 1/4] migration: Fix migrate-set-parameters argument validation Markus Armbruster
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Markus Armbruster @ 2021-02-02 14:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: berrange, dgilbert, quintela

v2:
* Rebased
* PATCH 1 dropped.  Fixes a crash bug.  Daniel asked me to modify the
  fix.  Unfortunately, I don't understand this anymore, and don't have
  the time & energy to start over.
* PATCH 4 dropped.  Plugs a hole in input validation.  David pointed
  asked me to additionally fix an error message, but I don't quite
  understand what he wants.

We can discuss what to do about the dropped patches, but I don't want
to hold the remainder of the series any longer just for that.

Markus Armbruster (4):
  migration: Fix migrate-set-parameters argument validation
  migration: Clean up signed vs. unsigned XBZRLE cache-size
  migration: Fix cache_init()'s "Failed to allocate" error messages
  migration: Fix a few absurdly defective error messages

 qapi/migration.json    | 32 ++++++++++++++++----------------
 migration/migration.h  |  2 +-
 migration/page_cache.h |  2 +-
 migration/ram.h        |  2 +-
 migration/migration.c  | 27 +++++++++++++--------------
 migration/page_cache.c |  8 +++-----
 migration/ram.c        |  2 +-
 monitor/hmp-cmds.c     | 24 ++++++++++++------------
 8 files changed, 48 insertions(+), 51 deletions(-)

-- 
2.26.2



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/4] migration: Fix migrate-set-parameters argument validation
  2021-02-02 14:17 [PATCH v2 0/4] migration: Fixes and cleanups aroung migrate-set-parameters Markus Armbruster
@ 2021-02-02 14:17 ` Markus Armbruster
  2021-02-02 14:17 ` [PATCH v2 2/4] migration: Clean up signed vs. unsigned XBZRLE cache-size Markus Armbruster
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Markus Armbruster @ 2021-02-02 14:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: berrange, dgilbert, quintela

Commit 741d4086c8 "migration: Use proper types in json" (v2.12.0)
switched MigrationParameters to narrower integer types, and removed
the simplified qmp_migrate_set_parameters()'s argument checking
accordingly.

Good idea, except qmp_migrate_set_parameters() takes
MigrateSetParameters, not MigrationParameters.  Its job is updating
migrate_get_current()->parameters (which *is* of type
MigrationParameters) according to its argument.  The integers now get
truncated silently.  Reproducer:

    ---> {'execute': 'query-migrate-parameters'}
    <--- {"return": {[...] "compress-threads": 8, [...]}}
    ---> {"execute": "migrate-set-parameters", "arguments": {"compress-threads": 257}}
    <--- {"return": {}}
    ---> {'execute': 'query-migrate-parameters'}
    <--- {"return": {[...] "compress-threads": 1, [...]}}

Fix by resynchronizing MigrateSetParameters with MigrationParameters.

Fixes: 741d4086c856320807a2575389d7c0505578270b
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 qapi/migration.json | 28 ++++++++++++++--------------
 monitor/hmp-cmds.c  | 24 ++++++++++++------------
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/qapi/migration.json b/qapi/migration.json
index d1d9632c2a..2c101eb0eb 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
@@ -885,28 +885,28 @@
             '*announce-max': 'size',
             '*announce-rounds': 'size',
             '*announce-step': 'size',
-            '*compress-level': 'int',
-            '*compress-threads': 'int',
+            '*compress-level': 'uint8',
+            '*compress-threads': 'uint8',
             '*compress-wait-thread': 'bool',
-            '*decompress-threads': 'int',
-            '*throttle-trigger-threshold': 'int',
-            '*cpu-throttle-initial': 'int',
-            '*cpu-throttle-increment': 'int',
+            '*decompress-threads': 'uint8',
+            '*throttle-trigger-threshold': 'uint8',
+            '*cpu-throttle-initial': 'uint8',
+            '*cpu-throttle-increment': 'uint8',
             '*cpu-throttle-tailslow': 'bool',
             '*tls-creds': 'StrOrNull',
             '*tls-hostname': 'StrOrNull',
             '*tls-authz': 'StrOrNull',
-            '*max-bandwidth': 'int',
-            '*downtime-limit': 'int',
-            '*x-checkpoint-delay': 'int',
+            '*max-bandwidth': 'size',
+            '*downtime-limit': 'uint64',
+            '*x-checkpoint-delay': 'uint32',
             '*block-incremental': 'bool',
-            '*multifd-channels': 'int',
+            '*multifd-channels': 'uint8',
             '*xbzrle-cache-size': 'size',
             '*max-postcopy-bandwidth': 'size',
-            '*max-cpu-throttle': 'int',
+            '*max-cpu-throttle': 'uint8',
             '*multifd-compression': 'MultiFDCompression',
-            '*multifd-zlib-level': 'int',
-            '*multifd-zstd-level': 'int',
+            '*multifd-zlib-level': 'uint8',
+            '*multifd-zstd-level': 'uint8',
             '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ] } }
 
 ##
@@ -1093,7 +1093,7 @@
             '*max-bandwidth': 'size',
             '*downtime-limit': 'uint64',
             '*x-checkpoint-delay': 'uint32',
-            '*block-incremental': 'bool' ,
+            '*block-incremental': 'bool',
             '*multifd-channels': 'uint8',
             '*xbzrle-cache-size': 'size',
             '*max-postcopy-bandwidth': 'size',
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index a48bc1e904..509d6b01ee 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -1294,11 +1294,11 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
     switch (val) {
     case MIGRATION_PARAMETER_COMPRESS_LEVEL:
         p->has_compress_level = true;
-        visit_type_int(v, param, &p->compress_level, &err);
+        visit_type_uint8(v, param, &p->compress_level, &err);
         break;
     case MIGRATION_PARAMETER_COMPRESS_THREADS:
         p->has_compress_threads = true;
-        visit_type_int(v, param, &p->compress_threads, &err);
+        visit_type_uint8(v, param, &p->compress_threads, &err);
         break;
     case MIGRATION_PARAMETER_COMPRESS_WAIT_THREAD:
         p->has_compress_wait_thread = true;
@@ -1306,19 +1306,19 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
         break;
     case MIGRATION_PARAMETER_DECOMPRESS_THREADS:
         p->has_decompress_threads = true;
-        visit_type_int(v, param, &p->decompress_threads, &err);
+        visit_type_uint8(v, param, &p->decompress_threads, &err);
         break;
     case MIGRATION_PARAMETER_THROTTLE_TRIGGER_THRESHOLD:
         p->has_throttle_trigger_threshold = true;
-        visit_type_int(v, param, &p->throttle_trigger_threshold, &err);
+        visit_type_uint8(v, param, &p->throttle_trigger_threshold, &err);
         break;
     case MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL:
         p->has_cpu_throttle_initial = true;
-        visit_type_int(v, param, &p->cpu_throttle_initial, &err);
+        visit_type_uint8(v, param, &p->cpu_throttle_initial, &err);
         break;
     case MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT:
         p->has_cpu_throttle_increment = true;
-        visit_type_int(v, param, &p->cpu_throttle_increment, &err);
+        visit_type_uint8(v, param, &p->cpu_throttle_increment, &err);
         break;
     case MIGRATION_PARAMETER_CPU_THROTTLE_TAILSLOW:
         p->has_cpu_throttle_tailslow = true;
@@ -1326,7 +1326,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
         break;
     case MIGRATION_PARAMETER_MAX_CPU_THROTTLE:
         p->has_max_cpu_throttle = true;
-        visit_type_int(v, param, &p->max_cpu_throttle, &err);
+        visit_type_uint8(v, param, &p->max_cpu_throttle, &err);
         break;
     case MIGRATION_PARAMETER_TLS_CREDS:
         p->has_tls_creds = true;
@@ -1362,11 +1362,11 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
         break;
     case MIGRATION_PARAMETER_DOWNTIME_LIMIT:
         p->has_downtime_limit = true;
-        visit_type_int(v, param, &p->downtime_limit, &err);
+        visit_type_size(v, param, &p->downtime_limit, &err);
         break;
     case MIGRATION_PARAMETER_X_CHECKPOINT_DELAY:
         p->has_x_checkpoint_delay = true;
-        visit_type_int(v, param, &p->x_checkpoint_delay, &err);
+        visit_type_uint32(v, param, &p->x_checkpoint_delay, &err);
         break;
     case MIGRATION_PARAMETER_BLOCK_INCREMENTAL:
         p->has_block_incremental = true;
@@ -1374,7 +1374,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
         break;
     case MIGRATION_PARAMETER_MULTIFD_CHANNELS:
         p->has_multifd_channels = true;
-        visit_type_int(v, param, &p->multifd_channels, &err);
+        visit_type_uint8(v, param, &p->multifd_channels, &err);
         break;
     case MIGRATION_PARAMETER_MULTIFD_COMPRESSION:
         p->has_multifd_compression = true;
@@ -1383,11 +1383,11 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
         break;
     case MIGRATION_PARAMETER_MULTIFD_ZLIB_LEVEL:
         p->has_multifd_zlib_level = true;
-        visit_type_int(v, param, &p->multifd_zlib_level, &err);
+        visit_type_uint8(v, param, &p->multifd_zlib_level, &err);
         break;
     case MIGRATION_PARAMETER_MULTIFD_ZSTD_LEVEL:
         p->has_multifd_zstd_level = true;
-        visit_type_int(v, param, &p->multifd_zstd_level, &err);
+        visit_type_uint8(v, param, &p->multifd_zstd_level, &err);
         break;
     case MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE:
         p->has_xbzrle_cache_size = true;
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/4] migration: Clean up signed vs. unsigned XBZRLE cache-size
  2021-02-02 14:17 [PATCH v2 0/4] migration: Fixes and cleanups aroung migrate-set-parameters Markus Armbruster
  2021-02-02 14:17 ` [PATCH v2 1/4] migration: Fix migrate-set-parameters argument validation Markus Armbruster
@ 2021-02-02 14:17 ` Markus Armbruster
  2021-02-02 14:17 ` [PATCH v2 3/4] migration: Fix cache_init()'s "Failed to allocate" error messages Markus Armbruster
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Markus Armbruster @ 2021-02-02 14:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: berrange, dgilbert, quintela

73af8dd8d7 "migration: Make xbzrle_cache_size a migration
parameter" (v2.11.0) made the new parameter unsigned (QAPI type
'size', uint64_t in C).  It neglected to update existing code, which
continues to use int64_t.

migrate_xbzrle_cache_size() returns the new parameter.  Adjust its
return type.

QMP query-migrate-cache-size returns migrate_xbzrle_cache_size().
Adjust its return type.

migrate-set-parameters passes the new parameter to
xbzrle_cache_resize().  Adjust its parameter type.

xbzrle_cache_resize() passes it on to cache_init().  Adjust its
parameter type.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 qapi/migration.json    | 4 ++--
 migration/migration.h  | 2 +-
 migration/page_cache.h | 2 +-
 migration/ram.h        | 2 +-
 migration/migration.c  | 4 ++--
 migration/page_cache.c | 2 +-
 migration/ram.c        | 2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/qapi/migration.json b/qapi/migration.json
index 2c101eb0eb..fd04123ddf 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
@@ -78,7 +78,7 @@
 # Since: 1.2
 ##
 { 'struct': 'XBZRLECacheStats',
-  'data': {'cache-size': 'int', 'bytes': 'int', 'pages': 'int',
+  'data': {'cache-size': 'size', 'bytes': 'int', 'pages': 'int',
            'cache-miss': 'int', 'cache-miss-rate': 'number',
            'encoding-rate': 'number', 'overflow': 'int' } }
 
@@ -1465,7 +1465,7 @@
 # <- { "return": 67108864 }
 #
 ##
-{ 'command': 'query-migrate-cache-size', 'returns': 'int',
+{ 'command': 'query-migrate-cache-size', 'returns': 'size',
   'features': [ 'deprecated' ] }
 
 ##
diff --git a/migration/migration.h b/migration/migration.h
index d096b77f74..0387dc40d6 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -324,7 +324,7 @@ int migrate_multifd_zlib_level(void);
 int migrate_multifd_zstd_level(void);
 
 int migrate_use_xbzrle(void);
-int64_t migrate_xbzrle_cache_size(void);
+uint64_t migrate_xbzrle_cache_size(void);
 bool migrate_colo_enabled(void);
 
 bool migrate_use_block(void);
diff --git a/migration/page_cache.h b/migration/page_cache.h
index 0cb94498a0..8733b4df6e 100644
--- a/migration/page_cache.h
+++ b/migration/page_cache.h
@@ -28,7 +28,7 @@ typedef struct PageCache PageCache;
  * @page_size: cache page size
  * @errp: set *errp if the check failed, with reason
  */
-PageCache *cache_init(int64_t cache_size, size_t page_size, Error **errp);
+PageCache *cache_init(uint64_t cache_size, size_t page_size, Error **errp);
 /**
  * cache_fini: free all cache resources
  * @cache pointer to the PageCache struct
diff --git a/migration/ram.h b/migration/ram.h
index 011e85414e..016eaa3378 100644
--- a/migration/ram.h
+++ b/migration/ram.h
@@ -47,7 +47,7 @@ bool ramblock_is_ignored(RAMBlock *block);
     INTERNAL_RAMBLOCK_FOREACH(block)                   \
         if (!qemu_ram_is_migratable(block)) {} else
 
-int xbzrle_cache_resize(int64_t new_size, Error **errp);
+int xbzrle_cache_resize(uint64_t new_size, Error **errp);
 uint64_t ram_bytes_remaining(void);
 uint64_t ram_bytes_total(void);
 
diff --git a/migration/migration.c b/migration/migration.c
index 1986cb8573..8f28e0af99 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2216,7 +2216,7 @@ void qmp_migrate_set_cache_size(int64_t value, Error **errp)
     qmp_migrate_set_parameters(&p, errp);
 }
 
-int64_t qmp_query_migrate_cache_size(Error **errp)
+uint64_t qmp_query_migrate_cache_size(Error **errp)
 {
     return migrate_xbzrle_cache_size();
 }
@@ -2446,7 +2446,7 @@ int migrate_use_xbzrle(void)
     return s->enabled_capabilities[MIGRATION_CAPABILITY_XBZRLE];
 }
 
-int64_t migrate_xbzrle_cache_size(void)
+uint64_t migrate_xbzrle_cache_size(void)
 {
     MigrationState *s;
 
diff --git a/migration/page_cache.c b/migration/page_cache.c
index 098b436223..b384f265fb 100644
--- a/migration/page_cache.c
+++ b/migration/page_cache.c
@@ -38,7 +38,7 @@ struct PageCache {
     size_t num_items;
 };
 
-PageCache *cache_init(int64_t new_size, size_t page_size, Error **errp)
+PageCache *cache_init(uint64_t new_size, size_t page_size, Error **errp)
 {
     int64_t i;
     size_t num_pages = new_size / page_size;
diff --git a/migration/ram.c b/migration/ram.c
index 7811cde643..fd7e9d2295 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -126,7 +126,7 @@ static void XBZRLE_cache_unlock(void)
  * @new_size: new cache size
  * @errp: set *errp if the check failed, with reason
  */
-int xbzrle_cache_resize(int64_t new_size, Error **errp)
+int xbzrle_cache_resize(uint64_t new_size, Error **errp)
 {
     PageCache *new_cache;
     int64_t ret = 0;
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/4] migration: Fix cache_init()'s "Failed to allocate" error messages
  2021-02-02 14:17 [PATCH v2 0/4] migration: Fixes and cleanups aroung migrate-set-parameters Markus Armbruster
  2021-02-02 14:17 ` [PATCH v2 1/4] migration: Fix migrate-set-parameters argument validation Markus Armbruster
  2021-02-02 14:17 ` [PATCH v2 2/4] migration: Clean up signed vs. unsigned XBZRLE cache-size Markus Armbruster
@ 2021-02-02 14:17 ` Markus Armbruster
  2021-02-02 14:23   ` Eric Blake
  2021-02-02 14:17 ` [PATCH v2 4/4] migration: Fix a few absurdly defective " Markus Armbruster
  2021-02-04 15:08 ` [PATCH v2 0/4] migration: Fixes and cleanups aroung migrate-set-parameters Dr. David Alan Gilbert
  4 siblings, 1 reply; 9+ messages in thread
From: Markus Armbruster @ 2021-02-02 14:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: berrange, dgilbert, quintela

cache_init() attempts to handle allocation failure..  The two error
messages are garbage, as untested error messages commonly are:

    Parameter 'cache size' expects Failed to allocate cache
    Parameter 'cache size' expects Failed to allocate page cache

Fix them to just

    Failed to allocate cache
    Failed to allocate page cache

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 migration/page_cache.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/migration/page_cache.c b/migration/page_cache.c
index b384f265fb..6d4f7a9bbc 100644
--- a/migration/page_cache.c
+++ b/migration/page_cache.c
@@ -60,8 +60,7 @@ PageCache *cache_init(uint64_t new_size, size_t page_size, Error **errp)
     /* We prefer not to abort if there is no memory */
     cache = g_try_malloc(sizeof(*cache));
     if (!cache) {
-        error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
-                   "Failed to allocate cache");
+        error_setg(errp, "Failed to allocate cache");
         return NULL;
     }
     cache->page_size = page_size;
@@ -74,8 +73,7 @@ PageCache *cache_init(uint64_t new_size, size_t page_size, Error **errp)
     cache->page_cache = g_try_malloc((cache->max_num_items) *
                                      sizeof(*cache->page_cache));
     if (!cache->page_cache) {
-        error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
-                   "Failed to allocate page cache");
+        error_setg(errp, "Failed to allocate page cache");
         g_free(cache);
         return NULL;
     }
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 4/4] migration: Fix a few absurdly defective error messages
  2021-02-02 14:17 [PATCH v2 0/4] migration: Fixes and cleanups aroung migrate-set-parameters Markus Armbruster
                   ` (2 preceding siblings ...)
  2021-02-02 14:17 ` [PATCH v2 3/4] migration: Fix cache_init()'s "Failed to allocate" error messages Markus Armbruster
@ 2021-02-02 14:17 ` Markus Armbruster
  2021-02-04 15:08 ` [PATCH v2 0/4] migration: Fixes and cleanups aroung migrate-set-parameters Dr. David Alan Gilbert
  4 siblings, 0 replies; 9+ messages in thread
From: Markus Armbruster @ 2021-02-02 14:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: berrange, dgilbert, quintela

migrate_params_check() has a number of error messages of the form

    Parameter 'NAME' expects is invalid, it should be ...

Fix them to something like

    Parameter 'NAME' expects a ...

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 migration/migration.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/migration/migration.c b/migration/migration.c
index 8f28e0af99..55a1a82d7a 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1226,21 +1226,21 @@ static bool migrate_params_check(MigrationParameters *params, Error **errp)
     if (params->has_compress_level &&
         (params->compress_level > 9)) {
         error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level",
-                   "is invalid, it should be in the range of 0 to 9");
+                   "a value between 0 and 9");
         return false;
     }
 
     if (params->has_compress_threads && (params->compress_threads < 1)) {
         error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
                    "compress_threads",
-                   "is invalid, it should be in the range of 1 to 255");
+                   "a value between 1 and 255");
         return false;
     }
 
     if (params->has_decompress_threads && (params->decompress_threads < 1)) {
         error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
                    "decompress_threads",
-                   "is invalid, it should be in the range of 1 to 255");
+                   "a value between 1 and 255");
         return false;
     }
 
@@ -1293,21 +1293,21 @@ static bool migrate_params_check(MigrationParameters *params, Error **errp)
     if (params->has_multifd_channels && (params->multifd_channels < 1)) {
         error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
                    "multifd_channels",
-                   "is invalid, it should be in the range of 1 to 255");
+                   "a value between 1 and 255");
         return false;
     }
 
     if (params->has_multifd_zlib_level &&
         (params->multifd_zlib_level > 9)) {
         error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zlib_level",
-                   "is invalid, it should be in the range of 0 to 9");
+                   "a value between 0 and 9");
         return false;
     }
 
     if (params->has_multifd_zstd_level &&
         (params->multifd_zstd_level > 20)) {
         error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zstd_level",
-                   "is invalid, it should be in the range of 0 to 20");
+                   "a value between 0 and 20");
         return false;
     }
 
@@ -1316,8 +1316,7 @@ static bool migrate_params_check(MigrationParameters *params, Error **errp)
          !is_power_of_2(params->xbzrle_cache_size))) {
         error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
                    "xbzrle_cache_size",
-                   "is invalid, it should be bigger than target page size"
-                   " and a power of 2");
+                   "a power of two no less than the target page size");
         return false;
     }
 
@@ -1334,21 +1333,21 @@ static bool migrate_params_check(MigrationParameters *params, Error **errp)
         params->announce_initial > 100000) {
         error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
                    "announce_initial",
-                   "is invalid, it must be less than 100000 ms");
+                   "a value between 0 and 100000");
         return false;
     }
     if (params->has_announce_max &&
         params->announce_max > 100000) {
         error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
                    "announce_max",
-                   "is invalid, it must be less than 100000 ms");
+                   "a value between 0 and 100000");
        return false;
     }
     if (params->has_announce_rounds &&
         params->announce_rounds > 1000) {
         error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
                    "announce_rounds",
-                   "is invalid, it must be in the range of 0 to 1000");
+                   "a value between 0 and 1000");
        return false;
     }
     if (params->has_announce_step &&
@@ -1356,7 +1355,7 @@ static bool migrate_params_check(MigrationParameters *params, Error **errp)
         params->announce_step > 10000)) {
         error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
                    "announce_step",
-                   "is invalid, it must be in the range of 1 to 10000 ms");
+                   "a value between 0 and 10000");
        return false;
     }
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/4] migration: Fix cache_init()'s "Failed to allocate" error messages
  2021-02-02 14:17 ` [PATCH v2 3/4] migration: Fix cache_init()'s "Failed to allocate" error messages Markus Armbruster
@ 2021-02-02 14:23   ` Eric Blake
  2021-02-02 15:21     ` Markus Armbruster
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Blake @ 2021-02-02 14:23 UTC (permalink / raw)
  To: Markus Armbruster, qemu-devel; +Cc: berrange, dgilbert, quintela

On 2/2/21 8:17 AM, Markus Armbruster wrote:
> cache_init() attempts to handle allocation failure..  The two error

The double . looks odd.

> messages are garbage, as untested error messages commonly are:
> 
>     Parameter 'cache size' expects Failed to allocate cache
>     Parameter 'cache size' expects Failed to allocate page cache
> 
> Fix them to just
> 
>     Failed to allocate cache
>     Failed to allocate page cache
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  migration/page_cache.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/4] migration: Fix cache_init()'s "Failed to allocate" error messages
  2021-02-02 14:23   ` Eric Blake
@ 2021-02-02 15:21     ` Markus Armbruster
  2021-02-02 15:37       ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 9+ messages in thread
From: Markus Armbruster @ 2021-02-02 15:21 UTC (permalink / raw)
  To: Eric Blake; +Cc: quintela, berrange, qemu-devel, dgilbert

Eric Blake <eblake@redhat.com> writes:

> On 2/2/21 8:17 AM, Markus Armbruster wrote:
>> cache_init() attempts to handle allocation failure..  The two error
>
> The double . looks odd.

Typo.  Perhaps the maintainer can take care of it.

>> messages are garbage, as untested error messages commonly are:
>> 
>>     Parameter 'cache size' expects Failed to allocate cache
>>     Parameter 'cache size' expects Failed to allocate page cache
>> 
>> Fix them to just
>> 
>>     Failed to allocate cache
>>     Failed to allocate page cache
>> 
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>> ---
>>  migration/page_cache.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/4] migration: Fix cache_init()'s "Failed to allocate" error messages
  2021-02-02 15:21     ` Markus Armbruster
@ 2021-02-02 15:37       ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 9+ messages in thread
From: Dr. David Alan Gilbert @ 2021-02-02 15:37 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: berrange, qemu-devel, quintela

* Markus Armbruster (armbru@redhat.com) wrote:
> Eric Blake <eblake@redhat.com> writes:
> 
> > On 2/2/21 8:17 AM, Markus Armbruster wrote:
> >> cache_init() attempts to handle allocation failure..  The two error
> >
> > The double . looks odd.
> 
> Typo.  Perhaps the maintainer can take care of it.

Yeh I can try and remember to take it out on the merge.

> >> messages are garbage, as untested error messages commonly are:
> >> 
> >>     Parameter 'cache size' expects Failed to allocate cache
> >>     Parameter 'cache size' expects Failed to allocate page cache
> >> 
> >> Fix them to just
> >> 
> >>     Failed to allocate cache
> >>     Failed to allocate page cache
> >> 
> >> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> >> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> >> ---
> >>  migration/page_cache.c | 6 ++----
> >>  1 file changed, 2 insertions(+), 4 deletions(-)
> >> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 0/4] migration: Fixes and cleanups aroung migrate-set-parameters
  2021-02-02 14:17 [PATCH v2 0/4] migration: Fixes and cleanups aroung migrate-set-parameters Markus Armbruster
                   ` (3 preceding siblings ...)
  2021-02-02 14:17 ` [PATCH v2 4/4] migration: Fix a few absurdly defective " Markus Armbruster
@ 2021-02-04 15:08 ` Dr. David Alan Gilbert
  4 siblings, 0 replies; 9+ messages in thread
From: Dr. David Alan Gilbert @ 2021-02-04 15:08 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: berrange, qemu-devel, quintela

* Markus Armbruster (armbru@redhat.com) wrote:
> v2:
> * Rebased
> * PATCH 1 dropped.  Fixes a crash bug.  Daniel asked me to modify the
>   fix.  Unfortunately, I don't understand this anymore, and don't have
>   the time & energy to start over.
> * PATCH 4 dropped.  Plugs a hole in input validation.  David pointed
>   asked me to additionally fix an error message, but I don't quite
>   understand what he wants.
> 
> We can discuss what to do about the dropped patches, but I don't want
> to hold the remainder of the series any longer just for that.

Queued (with double . removed)

> 
> Markus Armbruster (4):
>   migration: Fix migrate-set-parameters argument validation
>   migration: Clean up signed vs. unsigned XBZRLE cache-size
>   migration: Fix cache_init()'s "Failed to allocate" error messages
>   migration: Fix a few absurdly defective error messages
> 
>  qapi/migration.json    | 32 ++++++++++++++++----------------
>  migration/migration.h  |  2 +-
>  migration/page_cache.h |  2 +-
>  migration/ram.h        |  2 +-
>  migration/migration.c  | 27 +++++++++++++--------------
>  migration/page_cache.c |  8 +++-----
>  migration/ram.c        |  2 +-
>  monitor/hmp-cmds.c     | 24 ++++++++++++------------
>  8 files changed, 48 insertions(+), 51 deletions(-)
> 
> -- 
> 2.26.2
> 
> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-02-04 15:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02 14:17 [PATCH v2 0/4] migration: Fixes and cleanups aroung migrate-set-parameters Markus Armbruster
2021-02-02 14:17 ` [PATCH v2 1/4] migration: Fix migrate-set-parameters argument validation Markus Armbruster
2021-02-02 14:17 ` [PATCH v2 2/4] migration: Clean up signed vs. unsigned XBZRLE cache-size Markus Armbruster
2021-02-02 14:17 ` [PATCH v2 3/4] migration: Fix cache_init()'s "Failed to allocate" error messages Markus Armbruster
2021-02-02 14:23   ` Eric Blake
2021-02-02 15:21     ` Markus Armbruster
2021-02-02 15:37       ` Dr. David Alan Gilbert
2021-02-02 14:17 ` [PATCH v2 4/4] migration: Fix a few absurdly defective " Markus Armbruster
2021-02-04 15:08 ` [PATCH v2 0/4] migration: Fixes and cleanups aroung migrate-set-parameters Dr. David Alan Gilbert

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.