aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
Diffstat (limited to 'migration')
-rw-r--r--migration/migration-hmp-cmds.c6
-rw-r--r--migration/migration.c56
2 files changed, 54 insertions, 8 deletions
diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
index a170440..6ec778a 100644
--- a/migration/migration-hmp-cmds.c
+++ b/migration/migration-hmp-cmds.c
@@ -452,7 +452,7 @@ void hmp_migrate_incoming(Monitor *mon, const QDict *qdict)
Error *err = NULL;
const char *uri = qdict_get_str(qdict, "uri");
- qmp_migrate_incoming(uri, &err);
+ qmp_migrate_incoming(uri, false, NULL, &err);
hmp_handle_error(mon, err);
}
@@ -764,8 +764,8 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
" use blockdev-mirror with NBD instead");
}
- qmp_migrate(uri, !!blk, blk, !!inc, inc,
- false, false, true, resume, &err);
+ qmp_migrate(uri, false, NULL, !!blk, blk, !!inc, inc,
+ false, false, true, resume, &err);
if (hmp_handle_error(mon, err)) {
return;
}
diff --git a/migration/migration.c b/migration/migration.c
index 04037b3..a9cd5e2 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -506,11 +506,34 @@ static bool migrate_uri_parse(const char *uri,
return true;
}
-static void qemu_start_incoming_migration(const char *uri, Error **errp)
+static void qemu_start_incoming_migration(const char *uri, bool has_channels,
+ MigrationChannelList *channels,
+ Error **errp)
{
g_autoptr(MigrationAddress) channel = NULL;
MigrationIncomingState *mis = migration_incoming_get_current();
+ /*
+ * Having preliminary checks for uri and channel
+ */
+ if (has_channels) {
+ error_setg(errp, "'channels' argument should not be set yet.");
+ return;
+ }
+
+ if (uri && has_channels) {
+ error_setg(errp, "'uri' and 'channels' arguments are mutually "
+ "exclusive; exactly one of the two should be present in "
+ "'migrate-incoming' qmp command ");
+ return;
+ }
+
+ if (!uri && !has_channels) {
+ error_setg(errp, "neither 'uri' or 'channels' argument are "
+ "specified in 'migrate-incoming' qmp command ");
+ return;
+ }
+
/* URI is not suitable for migration? */
if (!migration_channels_and_uri_compatible(uri, errp)) {
return;
@@ -1681,7 +1704,8 @@ void migrate_del_blocker(Error **reasonp)
}
}
-void qmp_migrate_incoming(const char *uri, Error **errp)
+void qmp_migrate_incoming(const char *uri, bool has_channels,
+ MigrationChannelList *channels, Error **errp)
{
Error *local_err = NULL;
static bool once = true;
@@ -1699,7 +1723,7 @@ void qmp_migrate_incoming(const char *uri, Error **errp)
return;
}
- qemu_start_incoming_migration(uri, &local_err);
+ qemu_start_incoming_migration(uri, has_channels, channels, &local_err);
if (local_err) {
yank_unregister_instance(MIGRATION_YANK_INSTANCE);
@@ -1735,7 +1759,7 @@ void qmp_migrate_recover(const char *uri, Error **errp)
* only re-setup the migration stream and poke existing migration
* to continue using that newly established channel.
*/
- qemu_start_incoming_migration(uri, errp);
+ qemu_start_incoming_migration(uri, false, NULL, errp);
}
void qmp_migrate_pause(Error **errp)
@@ -1892,7 +1916,8 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,
return true;
}
-void qmp_migrate(const char *uri, bool has_blk, bool blk,
+void qmp_migrate(const char *uri, bool has_channels,
+ MigrationChannelList *channels, bool has_blk, bool blk,
bool has_inc, bool inc, bool has_detach, bool detach,
bool has_resume, bool resume, Error **errp)
{
@@ -1901,6 +1926,27 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
MigrationState *s = migrate_get_current();
g_autoptr(MigrationAddress) channel = NULL;
+ /*
+ * Having preliminary checks for uri and channel
+ */
+ if (has_channels) {
+ error_setg(errp, "'channels' argument should not be set yet.");
+ return;
+ }
+
+ if (uri && has_channels) {
+ error_setg(errp, "'uri' and 'channels' arguments are mutually "
+ "exclusive; exactly one of the two should be present in "
+ "'migrate' qmp command ");
+ return;
+ }
+
+ if (!uri && !has_channels) {
+ error_setg(errp, "neither 'uri' or 'channels' argument are "
+ "specified in 'migrate' qmp command ");
+ return;
+ }
+
/* URI is not suitable for migration? */
if (!migration_channels_and_uri_compatible(uri, errp)) {
return;