On 10/21/2024 3:36 PM, Peter Xu wrote:
On Thu, Oct 17, 2024 at 08:14:15AM -0700, Steve Sistare wrote:
Allow various migration commands during the precreate and preconfig phases
so migration may be set up and initiated at that time.

Signed-off-by: Steve Sistare <steven.sist...@oracle.com>
---
  hmp-commands.hx     |  2 ++
  qapi/migration.json | 16 +++++++++++-----
  qapi/misc.json      |  3 ++-
  3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/hmp-commands.hx b/hmp-commands.hx
index 06746f0..c0f34e9 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -959,6 +959,7 @@ ERST
          .params     = "uri",
          .help       = "Continue an incoming migration from an -incoming 
defer",
          .cmd        = hmp_migrate_incoming,
+        .flags      = "p",
      },
SRST
@@ -1000,6 +1001,7 @@ ERST
          .help       = "Enable/Disable the usage of a capability for 
migration",
          .cmd        = hmp_migrate_set_capability,
          .command_completion = migrate_set_capability_completion,
+        .flags      = "p",
      },

How about "info migrate_capabilities / migrate_parameters"?

That's hard to do cleanly for hmp.  I would need to allow all info sub-commands,
then check and return an error for everything except migrate_capabilities and
migrate_parameters.  It is not safe to allow any info command, because some of
them reference state that is not initialized yet.

  SRST
diff --git a/qapi/migration.json b/qapi/migration.json
index 3af6aa1..0468c07 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
@@ -373,7 +373,8 @@
  #           }
  #        }
  ##
-{ 'command': 'query-migrate', 'returns': 'MigrationInfo' }
+{ 'command': 'query-migrate', 'returns': 'MigrationInfo',
+  'allow-preconfig': true }
##
  # @MigrationCapability:
@@ -527,7 +528,8 @@
  #     <- { "return": {} }
  ##
  { 'command': 'migrate-set-capabilities',
-  'data': { 'capabilities': ['MigrationCapabilityStatus'] } }
+  'data': { 'capabilities': ['MigrationCapabilityStatus'] },
+  'allow-preconfig': true }

migrate-set-parameters?

Sure, I'll add it.

- Steve

  ##
  # @query-migrate-capabilities:
@@ -551,7 +553,9 @@
  #           {"state": false, "capability": "x-colo"}
  #        ]}
  ##
-{ 'command': 'query-migrate-capabilities', 'returns':   
['MigrationCapabilityStatus']}
+{ 'command': 'query-migrate-capabilities',
+  'returns':   ['MigrationCapabilityStatus'],
+  'allow-preconfig': true }
##
  # @MultiFDCompression:
@@ -1297,7 +1301,8 @@
  #        }
  ##
  { 'command': 'query-migrate-parameters',
-  'returns': 'MigrationParameters' }
+  'returns': 'MigrationParameters',
+  'allow-preconfig': true }
##
  # @migrate-start-postcopy:
@@ -1751,7 +1756,8 @@
  { 'command': 'migrate-incoming',
               'data': {'*uri': 'str',
                        '*channels': [ 'MigrationChannel' ],
-                      '*exit-on-error': 'bool' } }
+                      '*exit-on-error': 'bool' },
+  'allow-preconfig': true }
##
  # @xen-save-devices-state:
diff --git a/qapi/misc.json b/qapi/misc.json
index 559b66f..ce60493 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -241,7 +241,8 @@
  { 'command': 'human-monitor-command',
    'data': {'command-line': 'str', '*cpu-index': 'int'},
    'returns': 'str',
-  'features': [ 'savevm-monitor-nodes' ] }
+  'features': [ 'savevm-monitor-nodes' ],
+  'allow-preconfig': true }
##
  # @getfd:
--
1.8.3.1




Reply via email to