提交 d384a88b 编写于 作者: J Jiri Denemark

qemu: Refactor qemuMigrationParams

Adding support for new migration parameter requires a lot of places to
be changed (most likely by copy&paste engineering): new variables to
store the parameter value and the associated *_set bool, JSON formatter
and parser, XML formatter and parser (to be added soon), and the actual
code to set the parameter. It's pretty easy to forget about some of the
places which need to be updated and end up with incorrect support. The
goal of this patch is to let most of the places do their job without any
modifications when new parameters are added.

To achieve the goal, a new qemuMigrationParam enum is introduced and all
parameters are stored in an array indexed by the items of this enum.
This will also allow us to automatically set the migration parameters
which directly correspond to libvirt's typed parameters accepted by
virDomainMigrate* APIs.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 b57c9850
此差异已折叠。
......@@ -27,6 +27,21 @@
# include "qemu_monitor.h"
# include "qemu_conf.h"
typedef enum {
QEMU_MIGRATION_PARAM_COMPRESS_LEVEL,
QEMU_MIGRATION_PARAM_COMPRESS_THREADS,
QEMU_MIGRATION_PARAM_DECOMPRESS_THREADS,
QEMU_MIGRATION_PARAM_THROTTLE_INITIAL,
QEMU_MIGRATION_PARAM_THROTTLE_INCREMENT,
QEMU_MIGRATION_PARAM_TLS_CREDS,
QEMU_MIGRATION_PARAM_TLS_HOSTNAME,
QEMU_MIGRATION_PARAM_MAX_BANDWIDTH,
QEMU_MIGRATION_PARAM_DOWNTIME_LIMIT,
QEMU_MIGRATION_PARAM_BLOCK_INCREMENTAL,
QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE,
QEMU_MIGRATION_PARAM_LAST
} qemuMigrationParam;
typedef struct _qemuMigrationParams qemuMigrationParams;
typedef qemuMigrationParams *qemuMigrationParamsPtr;
......@@ -79,6 +94,11 @@ qemuMigrationParamsFetch(virQEMUDriverPtr driver,
int asyncJob,
qemuMigrationParamsPtr *migParams);
int
qemuMigrationParamsSetString(qemuMigrationParamsPtr migParams,
qemuMigrationParam param,
const char *value);
int
qemuMigrationParamsGetDowntimeLimit(qemuMigrationParamsPtr migParams,
unsigned long long *value);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册