* [Qemu-devel] [PATCH 3/3 v4] Enable migration without shared storage from the monitor
@ 2009-10-12 15:04 lirans
0 siblings, 0 replies; 4+ messages in thread
From: lirans @ 2009-10-12 15:04 UTC (permalink / raw)
To: qemu-devel; +Cc: Liran Schour
This patch adds the option to activate non-shared storage migration from the
monitor.
The migration command is as follows:
(qemu) migrate -d tcp:0:4444 # for ordinary live migration
(qemu) migrate -d -b tcp:0:4444 # for live migration with complete storage copy
(qemu) migrate -d -i tcp:0:4444 # for live migration with incremental storage copy, storage is cow based.
Signed-off-by: Liran Schour <lirans@il.ibm.com>
---
diff --git a/monitor.c b/monitor.c
index 3424e60..ae29181 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2907,6 +2907,18 @@ static int default_fmt_size = 4;
#define MAX_ARGS 16
+static int is_valid_option(const char *c, const char *typestr)
+{
+ char option[3];
+
+ option[0] = '-';
+ option[1] = *c;
+ option[2] = '\0';
+
+ typestr = strstr(typestr, option);
+ return (typestr != NULL);
+}
+
static const mon_cmd_t *monitor_parse_command(Monitor *mon,
const char *cmdline,
QDict *qdict)
@@ -3099,8 +3111,9 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon,
break;
case '-':
{
- int has_option;
- /* option */
+ const char *tmp = p;
+ int has_option, skip_key = 0;
+ /* option */
c = *typestr++;
if (c == '\0')
@@ -3110,15 +3123,24 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon,
has_option = 0;
if (*p == '-') {
p++;
- if (*p != c) {
- monitor_printf(mon, "%s: unsupported option -%c\n",
+ if(c != *p) {
+ if(!is_valid_option(p, typestr)) {
+
+ monitor_printf(mon, "%s: unsupported option -%c\n",
cmdname, *p);
- goto fail;
+ goto fail;
+ } else {
+ skip_key = 1;
+ }
}
- p++;
- has_option = 1;
+ if(skip_key) {
+ p = tmp;
+ } else {
+ p++;
+ has_option = 1;
+ }
}
- qdict_put(qdict, key, qint_from_int(has_option));
+ qdict_put(qdict, key, qint_from_int(has_option));
}
break;
default:
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index 29999c6..ec856d9 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -721,15 +721,22 @@ ETEXI
{
.name = "migrate",
- .args_type = "detach:-d,uri:s",
- .params = "[-d] uri",
- .help = "migrate to URI (using -d to not wait for completion)",
+ .args_type = "detach:-d,blk:-b,inc:-i,uri:s",
+ .params = "[-d] [-b] [-i] uri",
+ .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)",
.mhandler.cmd = do_migrate,
},
+
STEXI
@item migrate [-d] @var{uri}
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)
ETEXI
{
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 3/3 v4] Enable migration without shared storage from the monitor
@ 2009-10-12 16:12 lirans
2009-10-21 18:27 ` Anthony Liguori
0 siblings, 1 reply; 4+ messages in thread
From: lirans @ 2009-10-12 16:12 UTC (permalink / raw)
To: qemu-devel; +Cc: Liran Schour
This patch adds the option to activate non-shared storage migration from the
monitor.
The migration command is as follows:
(qemu) migrate -d tcp:0:4444 # for ordinary live migration
(qemu) migrate -d -b tcp:0:4444 # for live migration with complete storage copy
(qemu) migrate -d -i tcp:0:4444 # for live migration with incremental storage copy, storage is cow based.
Signed-off-by: Liran Schour <lirans@il.ibm.com>
---
diff --git a/monitor.c b/monitor.c
index 3424e60..ae29181 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2907,6 +2907,18 @@ static int default_fmt_size = 4;
#define MAX_ARGS 16
+static int is_valid_option(const char *c, const char *typestr)
+{
+ char option[3];
+
+ option[0] = '-';
+ option[1] = *c;
+ option[2] = '\0';
+
+ typestr = strstr(typestr, option);
+ return (typestr != NULL);
+}
+
static const mon_cmd_t *monitor_parse_command(Monitor *mon,
const char *cmdline,
QDict *qdict)
@@ -3099,8 +3111,9 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon,
break;
case '-':
{
- int has_option;
- /* option */
+ const char *tmp = p;
+ int has_option, skip_key = 0;
+ /* option */
c = *typestr++;
if (c == '\0')
@@ -3110,15 +3123,24 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon,
has_option = 0;
if (*p == '-') {
p++;
- if (*p != c) {
- monitor_printf(mon, "%s: unsupported option -%c\n",
+ if(c != *p) {
+ if(!is_valid_option(p, typestr)) {
+
+ monitor_printf(mon, "%s: unsupported option -%c\n",
cmdname, *p);
- goto fail;
+ goto fail;
+ } else {
+ skip_key = 1;
+ }
}
- p++;
- has_option = 1;
+ if(skip_key) {
+ p = tmp;
+ } else {
+ p++;
+ has_option = 1;
+ }
}
- qdict_put(qdict, key, qint_from_int(has_option));
+ qdict_put(qdict, key, qint_from_int(has_option));
}
break;
default:
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index 29999c6..ec856d9 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -721,15 +721,22 @@ ETEXI
{
.name = "migrate",
- .args_type = "detach:-d,uri:s",
- .params = "[-d] uri",
- .help = "migrate to URI (using -d to not wait for completion)",
+ .args_type = "detach:-d,blk:-b,inc:-i,uri:s",
+ .params = "[-d] [-b] [-i] uri",
+ .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)",
.mhandler.cmd = do_migrate,
},
+
STEXI
@item migrate [-d] @var{uri}
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)
ETEXI
{
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 3/3 v4] Enable migration without shared storage from the monitor
2009-10-12 16:12 [Qemu-devel] [PATCH 3/3 v4] Enable migration without shared storage from the monitor lirans
@ 2009-10-21 18:27 ` Anthony Liguori
2009-10-22 8:05 ` Liran Schour
0 siblings, 1 reply; 4+ messages in thread
From: Anthony Liguori @ 2009-10-21 18:27 UTC (permalink / raw)
To: lirans; +Cc: qemu-devel
lirans@il.ibm.com wrote:
> This patch adds the option to activate non-shared storage migration from the
> monitor.
> The migration command is as follows:
> (qemu) migrate -d tcp:0:4444 # for ordinary live migration
> (qemu) migrate -d -b tcp:0:4444 # for live migration with complete storage copy
> (qemu) migrate -d -i tcp:0:4444 # for live migration with incremental storage copy, storage is cow based.
>
> Signed-off-by: Liran Schour <lirans@il.ibm.com>
> ---
> diff --git a/monitor.c b/monitor.c
> index 3424e60..ae29181 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -2907,6 +2907,18 @@ static int default_fmt_size = 4;
>
> #define MAX_ARGS 16
>
> +static int is_valid_option(const char *c, const char *typestr)
> +{
> + char option[3];
> +
> + option[0] = '-';
> + option[1] = *c;
> + option[2] = '\0';
> +
> + typestr = strstr(typestr, option);
> + return (typestr != NULL);
> +}
>
This is pretty darn funky. Can you explain why this is needed?
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 3/3 v4] Enable migration without shared storage from the monitor
2009-10-21 18:27 ` Anthony Liguori
@ 2009-10-22 8:05 ` Liran Schour
0 siblings, 0 replies; 4+ messages in thread
From: Liran Schour @ 2009-10-22 8:05 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-devel
- Liran
Anthony Liguori <anthony@codemonkey.ws> wrote on 21/10/2009 20:27:39:
> Anthony Liguori <anthony@codemonkey.ws>
> 21/10/2009 20:27
>
> To
>
> Liran Schour/Haifa/IBM@IBMIL
>
> cc
>
> qemu-devel@nongnu.org
>
> Subject
>
> Re: [Qemu-devel] [PATCH 3/3 v4] Enable migration without shared
> storage from the monitor
>
> lirans@il.ibm.com wrote:
> > This patch adds the option to activate non-shared storage migration
from the
> > monitor.
> > The migration command is as follows:
> > (qemu) migrate -d tcp:0:4444 # for ordinary live migration
> > (qemu) migrate -d -b tcp:0:4444 # for live migration with complete
> storage copy
> > (qemu) migrate -d -i tcp:0:4444 # for live migration with
> incremental storage copy, storage is cow based.
> >
> > Signed-off-by: Liran Schour <lirans@il.ibm.com>
> > ---
> > diff --git a/monitor.c b/monitor.c
> > index 3424e60..ae29181 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -2907,6 +2907,18 @@ static int default_fmt_size = 4;
> >
> > #define MAX_ARGS 16
> >
> > +static int is_valid_option(const char *c, const char *typestr)
> > +{
> > + char option[3];
> > +
> > + option[0] = '-';
> > + option[1] = *c;
> > + option[2] = '\0';
> > +
> > + typestr = strstr(typestr, option);
> > + return (typestr != NULL);
> > +}
> >
>
> This is pretty darn funky. Can you explain why this is needed?
>
Migrate is the first command that uses more then one '-x' option. The code
was not
prepared for that.
The code assumes that there is only one '-x' option. So in our case we want
to be able to do 'migrate -d -b tcp:....' and also 'migrate -b tcp:.....'
in the
second case the origin code will look for '-d' when it will see a different
'-b'
it will shout "unsupported option -b". I have added the code that in case
that
'-d' != '-b' the code will look if '-b' is still a valid option in typestr
and
then will only skip this key and continue.
- Liran
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-10-22 8:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-12 16:12 [Qemu-devel] [PATCH 3/3 v4] Enable migration without shared storage from the monitor lirans
2009-10-21 18:27 ` Anthony Liguori
2009-10-22 8:05 ` Liran Schour
-- strict thread matches above, loose matches on Subject: below --
2009-10-12 15:04 lirans
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).