[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 38/41] postcopy/outgoing: add forward, backward o
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH v2 38/41] postcopy/outgoing: add forward, backward option to specify the size of prefault |
Date: |
Mon, 4 Jun 2012 18:57:40 +0900 |
Signed-off-by: Isaku Yamahata <address@hidden>
---
hmp-commands.hx | 15 ++++++++++-----
hmp.c | 3 +++
migration.c | 20 ++++++++++++++++++++
migration.h | 2 ++
qapi-schema.json | 3 ++-
5 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 3c647f7..38e5c95 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -798,26 +798,31 @@ ETEXI
{
.name = "migrate",
- .args_type = "detach:-d,blk:-b,inc:-i,postcopy:-p,nobg:-n,uri:s",
- .params = "[-d] [-b] [-i] [-p [-n]] uri",
+ .args_type = "detach:-d,blk:-b,inc:-i,postcopy:-p,nobg:-n,uri:s,"
+ "forward:i?,backward:i?",
+ .params = "[-d] [-b] [-i] [-p [-n] uri [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 "
"shared storage with incremental copy of disk "
"(base image shared between src and destination)"
"\n\t\t\t-p for migration with postcopy mode enabled"
- "\n\t\t\t-n for no background transfer of postcopy mode",
+ "\n\t\t\t-n for no background transfer of postcopy mode"
+ "\n\t\t\tforward: the number of pages to "
+ "forward-prefault when postcopy (default 0)"
+ "\n\t\t\tbackward: the number of pages to "
+ "backward-prefault when postcopy (default 0)",
.mhandler.cmd = hmp_migrate,
},
STEXI
address@hidden migrate [-d] [-b] [-i] [-p [-n]] @var{uri}
address@hidden migrate [-d] [-b] [-i] [-p [-n]] @var{uri} @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
-i for migration with incremental copy of disk (base image is shared)
- -p for migration with postcopy mode enabled
+ -p for migration with postcopy mode enabled (forward/backward is
prefault size when postcopy)
-n for migration with postcopy mode enabled without background transfer
ETEXI
diff --git a/hmp.c b/hmp.c
index d546a52..79a9c86 100644
--- a/hmp.c
+++ b/hmp.c
@@ -913,11 +913,14 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
int inc = qdict_get_try_bool(qdict, "inc", 0);
int postcopy = qdict_get_try_bool(qdict, "postcopy", 0);
int nobg = qdict_get_try_bool(qdict, "nobg", 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");
Error *err = NULL;
qmp_migrate(uri, !!blk, blk, !!inc, inc, false, false,
!!postcopy, postcopy, !!nobg, nobg,
+ !!forward, forward, !!backward, backward,
&err);
if (err) {
monitor_printf(mon, "migrate: %s\n", error_get_pretty(err));
diff --git a/migration.c b/migration.c
index e8be0d1..e026085 100644
--- a/migration.c
+++ b/migration.c
@@ -423,6 +423,8 @@ void migrate_del_blocker(Error *reason)
void qmp_migrate(const char *uri, bool has_blk, bool blk,
bool has_inc, bool inc, bool has_detach, bool detach,
bool has_postcopy, bool postcopy, bool has_nobg, bool nobg,
+ bool has_forward, int64_t forward,
+ bool has_backward, int64_t backward,
Error **errp)
{
MigrationState *s = migrate_get_current();
@@ -431,6 +433,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
.shared = false,
.postcopy = false,
.nobg = false,
+ .prefault_forward = 0,
+ .prefault_backward = 0,
};
const char *p;
int ret;
@@ -447,6 +451,22 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
if (has_nobg) {
params.nobg = nobg;
}
+ if (has_forward) {
+ if (forward < 0) {
+ error_set(errp, QERR_INVALID_PARAMETER_VALUE,
+ "forward", "forward >= 0");
+ return;
+ }
+ params.prefault_forward = forward;
+ }
+ if (has_backward) {
+ if (backward < 0) {
+ error_set(errp, QERR_INVALID_PARAMETER_VALUE,
+ "backward", "backward >= 0");
+ return;
+ }
+ params.prefault_backward = backward;
+ }
if (s->state == MIG_STATE_ACTIVE) {
error_set(errp, QERR_MIGRATION_ACTIVE);
diff --git a/migration.h b/migration.h
index 90f3bdf..9a9b9c6 100644
--- a/migration.h
+++ b/migration.h
@@ -24,6 +24,8 @@ struct MigrationParams {
int shared;
int postcopy;
int nobg;
+ int64_t prefault_forward;
+ int64_t prefault_backward;
};
typedef struct MigrationState MigrationState;
diff --git a/qapi-schema.json b/qapi-schema.json
index 5861fb9..83c2170 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1718,7 +1718,8 @@
##
{ 'command': 'migrate',
'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', '*detach': 'bool' ,
- '*postcopy': 'bool', '*nobg': 'bool'} }
+ '*postcopy': 'bool', '*nobg': 'bool',
+ '*forward': 'int', '*backward': 'int'} }
# @xen-save-devices-state:
#
--
1.7.1.1
- [Qemu-devel] [PATCH v2 11/41] arch_init: factor out counting transferred bytes, (continued)
- [Qemu-devel] [PATCH v2 11/41] arch_init: factor out counting transferred bytes, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 27/41] buffered_file: Introduce QEMUFileNonblock for nonblock write, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 07/41] arch_init/ram_save_live: factor out ram_save_limit, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 23/41] migration.c: remove redundant line in migrate_init(), Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 29/41] umem.h: import Linux umem.h, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 19/41] savevm/QEMUFile: drop qemu_stdio_fd, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 32/41] savevm: add new section that is used by postcopy, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 15/41] savevm: export qemu_peek_buffer, qemu_peek_byte, qemu_file_skip, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 25/41] migration: factor out parameters into MigrationParams, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 30/41] update-linux-headers.sh: teach umem.h to update-linux-headers.sh, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 38/41] postcopy/outgoing: add forward, backward option to specify the size of prefault,
Isaku Yamahata <=
- [Qemu-devel] [PATCH v2 10/41] arch_init: simplify a bit by ram_find_block(), Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 34/41] postcopy outgoing: add -p and -n option to migrate command, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 39/41] postcopy/outgoing: implement prefault, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 26/41] buffered_file: factor out buffer management logic, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 14/41] exec.c: export last_ram_offset(), Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 08/41] arch_init/ram_load: refactor ram_load, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 28/41] buffered_file: add qemu_file to read/write to buffer in memory, Isaku Yamahata, 2012/06/04
- [Qemu-devel] [PATCH v2 33/41] postcopy: introduce -postcopy and -postcopy-flags option, Isaku Yamahata, 2012/06/04