@@ -826,9 +826,10 @@ ETEXI
{
.name = "migrate",
- .args_type = "detach:-d,blk:-b,inc:-i,postcopy:-p,movebg:-m,nobg:-n,uri:s,"
- "forward:i?,backward:i?",
- .params = "[-d] [-b] [-i] [-p [-n] [-m]] uri [forward] [backword]",
+ .args_type = "detach:-d,blk:-b,inc:-i,postcopy:-p,movebg:-m,nobg:-n,"
+ "uri:s,precopy_count:i?,forward:i?,backward:i?",
+ .params = "[-d] [-b] [-i] [-p [-n] [-m]] uri "
+ "[precopy_count] [forward] [backword]",
.help = "migrate to URI (using -d to not wait for completion)"
"\n\t\t\t -b for migration without shared storage with"
" full copy of disk\n\t\t\t -i for migration without "
@@ -837,6 +838,7 @@ ETEXI
"\n\t\t\t-p for migration with postcopy mode enabled"
"\n\t\t\t-m for move background transfer of postcopy mode"
"\n\t\t\t-n for no background transfer of postcopy mode"
+ "\n\t\t\tprecopy_count: loop of precopy when postcopy"
"\n\t\t\tforward: the number of pages to "
"forward-prefault when postcopy (default 0)"
"\n\t\t\tbackward: the number of pages to "
@@ -846,7 +848,7 @@ ETEXI
STEXI
-@item migrate [-d] [-b] [-i] [-p [-n] [-m]] @var{uri} @var{forward} @var{backward}
+@item migrate [-d] [-b] [-i] [-p [-n] [-m]] @var{uri} @var{precopy_count} @var{forward} @var{backward}
@findex migrate
Migrate to @var{uri} (using -d to not wait for completion).
-b for migration with full copy of disk
@@ -1038,6 +1038,7 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
int postcopy = qdict_get_try_bool(qdict, "postcopy", 0);
int movebg = qdict_get_try_bool(qdict, "movebg", 0);
int nobg = qdict_get_try_bool(qdict, "nobg", 0);
+ int precopy_count = qdict_get_try_int(qdict, "precopy_count", 0);
int forward = qdict_get_try_int(qdict, "forward", 0);
int backward = qdict_get_try_int(qdict, "backward", 0);
const char *uri = qdict_get_str(qdict, "uri");
@@ -1045,6 +1046,7 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
qmp_migrate(uri, !!blk, blk, !!inc, inc, false, false,
!!postcopy, postcopy, !!movebg, movebg, !!nobg, nobg,
+ !!precopy_count, precopy_count,
!!forward, forward, !!backward, backward,
&err);
if (err) {
@@ -319,7 +319,7 @@ int postcopy_outgoing_create_read_socket(MigrationState *s)
return 0;
}
-void postcopy_outgoing_state_begin(QEMUFile *f)
+void postcopy_outgoing_state_begin(QEMUFile *f, const MigrationParams *params)
{
uint64_t options = 0;
qemu_put_ubyte(f, QEMU_VM_POSTCOPY_INIT);
@@ -513,6 +513,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
bool has_postcopy, bool postcopy,
bool has_movebg, bool movebg,
bool has_nobg, bool nobg,
+ bool has_precopy_count, int64_t precopy_count,
bool has_forward, int64_t forward,
bool has_backward, int64_t backward,
Error **errp)
@@ -527,6 +528,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
params.postcopy = postcopy;
params.nobg = nobg;
params.movebg = movebg;
+ params.precopy_count = precopy_count,
params.prefault_forward = 0;
if (has_forward) {
if (forward < 0) {
@@ -27,6 +27,7 @@ struct MigrationParams {
bool postcopy;
bool nobg;
bool movebg;
+ int precopy_count;
int64_t prefault_forward;
int64_t prefault_backward;
};
@@ -150,7 +151,7 @@ int64_t xbzrle_cache_resize(int64_t new_size);
/* For outgoing postcopy */
int postcopy_outgoing_create_read_socket(MigrationState *s);
-void postcopy_outgoing_state_begin(QEMUFile *f);
+void postcopy_outgoing_state_begin(QEMUFile *f, const MigrationParams *params);
void postcopy_outgoing_state_complete(
QEMUFile *f, const uint8_t *buffer, size_t buffer_size);
int postcopy_outgoing_ram_save_iterate(QEMUFile *f, void *opaque);
@@ -2089,6 +2089,8 @@
# @detach: this argument exists only for compatibility reasons and
# is ignored by QEMU
#
+# @precopy_count: #optional the number of loops of precopy when postcopy
+#
# Returns: nothing on success
#
# Since: 0.14.0
@@ -2096,7 +2098,7 @@
{ 'command': 'migrate',
'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', '*detach': 'bool' ,
'*postcopy': 'bool', '*movebg': 'bool', '*nobg': 'bool',
- '*forward': 'int', '*backward': 'int'} }
+ '*precopy_count': 'int', '*forward': 'int', '*backward': 'int'} }
# @xen-save-devices-state:
#
@@ -518,7 +518,7 @@ EQMP
{
.name = "migrate",
- .args_type = "detach:-d,blk:-b,inc:-i,postcopy:-p,movebg:-m,nobg:-n,uri:s",
+ .args_type = "detach:-d,blk:-b,inc:-i,postcopy:-p,movebg:-m,nobg:-n,uri:s,precopy_cout:i?",
.mhandler.cmd_new = qmp_marshal_input_migrate,
},
@@ -1650,7 +1650,7 @@ int qemu_savevm_state_begin(QEMUFile *f,
if (params->postcopy) {
/* tell this is postcopy */
qemu_put_byte(f, QEMU_VM_POSTCOPY);
- postcopy_outgoing_state_begin(f);
+ postcopy_outgoing_state_begin(f, params);
}
QTAILQ_FOREACH(se, &savevm_handlers, entry) {
@@ -1839,6 +1839,7 @@ static int qemu_savevm_state(QEMUFile *f)
.blk = 0,
.shared = 0,
.postcopy = 0,
+ .precopy_count = 0,
.movebg = 0,
.nobg = 0,
};
Precopy with this loop number before postcopy mode. This will be implemented by the next patch. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> --- hmp-commands.hx | 10 ++++++---- hmp.c | 2 ++ migration-postcopy.c | 2 +- migration.c | 2 ++ migration.h | 3 ++- qapi-schema.json | 4 +++- qmp-commands.hx | 2 +- savevm.c | 3 ++- 8 files changed, 19 insertions(+), 9 deletions(-)