From: "Michael R. Hines" <mrhi...@us.ibm.com>
Signed-off-by: Michael R. Hines <mrhi...@us.ibm.com> --- hmp-commands.hx | 28 ++++++++++++++++++++++++++++ hmp.c | 12 ++++++++++++ hmp.h | 2 ++ include/migration/qemu-file.h | 1 + include/qapi/qmp/qerror.h | 6 ++++++ qapi-schema.json | 34 ++++++++++++++++++++++++++++++++-- qemu-options.hx | 10 ++++++++++ 7 files changed, 91 insertions(+), 2 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 0934b9b..4466c2e 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -910,6 +910,34 @@ Set maximum speed to @var{value} (in bytes) for migrations. ETEXI { + .name = "migrate_set_rdma_port", + .args_type = "port:i", + .params = "port", + .help = "set RDMA port for migration", + .mhandler.cmd = hmp_migrate_set_rdma_port, + }, + +STEXI +@item migrate_set_rdma_port @var{value} +@findex migrate_set_rdma_port +Set RDMA migration port to @var{value}. +ETEXI + + { + .name = "migrate_set_rdma_host", + .args_type = "host:s", + .params = "host", + .help = "set RDMA host name for migration", + .mhandler.cmd = hmp_migrate_set_rdma_host, + }, + +STEXI +@item migrate_set_rdma_host @var{value} +@findex migrate_set_rdma_host +Set RDMA migration host name to @var{value}. +ETEXI + + { .name = "migrate_set_downtime", .args_type = "value:T", .params = "value", diff --git a/hmp.c b/hmp.c index c7b6ba0..67c1d4a 100644 --- a/hmp.c +++ b/hmp.c @@ -848,6 +848,18 @@ void hmp_migrate_set_cache_size(Monitor *mon, const QDict *qdict) } } +void hmp_migrate_set_rdma_port(Monitor *mon, const QDict *qdict) +{ + int port = qdict_get_int(qdict, "port"); + qmp_migrate_set_rdma_port(port, NULL); +} + +void hmp_migrate_set_rdma_host(Monitor *mon, const QDict *qdict) +{ + const char *host = qdict_get_str(qdict, "host"); + qmp_migrate_set_rdma_host(host, NULL); +} + void hmp_migrate_set_speed(Monitor *mon, const QDict *qdict) { int64_t value = qdict_get_int(qdict, "value"); diff --git a/hmp.h b/hmp.h index 44be683..4ee5b92 100644 --- a/hmp.h +++ b/hmp.h @@ -55,6 +55,8 @@ void hmp_drive_mirror(Monitor *mon, const QDict *qdict); void hmp_migrate_cancel(Monitor *mon, const QDict *qdict); void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict); void hmp_migrate_set_speed(Monitor *mon, const QDict *qdict); +void hmp_migrate_set_rdma_port(Monitor *mon, const QDict *qdict); +void hmp_migrate_set_rdma_host(Monitor *mon, const QDict *qdict); void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict); void hmp_migrate_set_cache_size(Monitor *mon, const QDict *qdict); void hmp_set_password(Monitor *mon, const QDict *qdict); diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h index 68deefb..7c9968e 100644 --- a/include/migration/qemu-file.h +++ b/include/migration/qemu-file.h @@ -112,6 +112,7 @@ int qemu_file_rate_limit(QEMUFile *f); int64_t qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate); int64_t qemu_file_get_rate_limit(QEMUFile *f); int qemu_file_get_error(QEMUFile *f); +void qemu_file_set_error(QEMUFile *f, int ret); static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv) { diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h index 6c0a18d..6ae8b8c 100644 --- a/include/qapi/qmp/qerror.h +++ b/include/qapi/qmp/qerror.h @@ -165,6 +165,12 @@ void assert_no_error(Error *err); #define QERR_MIGRATION_ACTIVE \ ERROR_CLASS_GENERIC_ERROR, "There's a migration process in progress" +#define QERR_MIGRATION_RDMA_NOT_CONFIGURED \ + ERROR_CLASS_GENERIC_ERROR, "RMDA-based migration is missing port/hostname information %s:%d" + +#define QERR_MIGRATION_RDMA_NOT_ENABLED \ + ERROR_CLASS_GENERIC_ERROR, "RMDA-based migration has not been compiled/enabled." + #define QERR_MIGRATION_NOT_SUPPORTED \ ERROR_CLASS_GENERIC_ERROR, "State blocked by non-migratable device '%s'" diff --git a/qapi-schema.json b/qapi-schema.json index 6d7252b..5ce56f1 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -483,7 +483,7 @@ # Since: 1.2 ## { 'enum': 'MigrationCapability', - 'data': ['xbzrle'] } + 'data': ['xbzrle', 'rdma'] } ## # @MigrationCapabilityStatus @@ -502,7 +502,7 @@ ## # @migrate-set-capabilities # -# Enable/Disable the following migration capabilities (like xbzrle) +# Enable/Disable the following migration capabilities (like xbzrle or RDMA) # # @capabilities: json array of capability modifications to make # @@ -1695,6 +1695,36 @@ { 'command': 'migrate_set_speed', 'data': {'value': 'int'} } ## +# @migrate_set_rdma_port +# +# Set rdma communication port. +# +# @port: rdma communication port. +# +# Returns: nothing on success +# +# Notes: Nothing. +# +# Since: 1.3.0 +## +{ 'command': 'migrate_set_rdma_port', 'data': {'port': 'int'} } + +## +# @migrate_set_rdma_host +# +# Set rdma communication host address. +# +# @host: rdma communication host address. +# +# Returns: nothing on success +# +# Notes: Nothing. +# +# Since: 1.3.0 +## +{ 'command': 'migrate_set_rdma_host', 'data': {'host': 'str'} } + +## # @migrate-set-cache-size # # Set XBZRLE cache size diff --git a/qemu-options.hx b/qemu-options.hx index 4e2b499..dbd033b 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2796,6 +2796,16 @@ CD-ROM drive and others. The @code{-nodefaults} option will disable all those default devices. ETEXI +DEF("rdmaport", HAS_ARG, QEMU_OPTION_rdmaport, \ + "-rdmaport p port for RDMA migration\n", QEMU_ARCH_ALL) +STEXI +ETEXI + +DEF("rdmahost", HAS_ARG, QEMU_OPTION_rdmahost, \ + "-rdmahost p host name for RDMA migration\n", QEMU_ARCH_ALL) +STEXI +ETEXI + #ifndef _WIN32 DEF("chroot", HAS_ARG, QEMU_OPTION_chroot, \ "-chroot dir chroot to dir just before starting the VM\n", -- 1.7.10.4