All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.9 V3 0/3] Add new qmp commands to suppurt Xen COLO
@ 2016-12-09  6:04 Zhang Chen
  2016-12-09  6:04 ` [Qemu-devel] [PATCH for-2.9 V3 1/3] Migration: Don't load vmdesc when xen is enabled Zhang Chen
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Zhang Chen @ 2016-12-09  6:04 UTC (permalink / raw)
  To: qemu devel, Jason Wang, Eric Blake
  Cc: Zhang Chen, Li Zhijian, zhanghailiang, eddie . dong,
	Bian Naimeng, Changlong Xie

Xen COLO depend on qemu COLO replication function.
So, We need new qmp commands for Xen to use qemu replication.

Corresponding libxl patches already in xen.git.
Commit ID:

ed37ef1f91c20f0ab162ce60f8c38400b917fa64
COLO: introduce new API to prepare/start/do/get_error/stop replication

a0ddc0b359375b2418213966dfbdbfab593ecc6f
tools/libxl: introduction of libxl__qmp_restore to load qemu state


Zhang Chen (3):
  Migration: Don't load vmdesc when xen is enabled
  Add a new qmp command to start/stop replication
  Add a new qmp command to do checkpoint, get replication error

 docs/qmp-commands.txt | 42 ++++++++++++++++++++++++++++++++++++++++++
 migration/colo.c      | 33 +++++++++++++++++++++++++++++++++
 migration/savevm.c    |  4 ++++
 qapi-schema.json      | 41 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 120 insertions(+)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH for-2.9 V3 1/3] Migration: Don't load vmdesc when xen is enabled
  2016-12-09  6:04 [Qemu-devel] [PATCH for-2.9 V3 0/3] Add new qmp commands to suppurt Xen COLO Zhang Chen
@ 2016-12-09  6:04 ` Zhang Chen
  2016-12-14  1:00   ` Stefano Stabellini
  2016-12-09  6:04 ` [Qemu-devel] [PATCH for-2.9 V3 2/3] Add a new qmp command to start/stop replication Zhang Chen
  2016-12-09  6:04 ` [Qemu-devel] [PATCH for-2.9 V3 3/3] Add a new qmp command to do checkpoint, get replication error Zhang Chen
  2 siblings, 1 reply; 7+ messages in thread
From: Zhang Chen @ 2016-12-09  6:04 UTC (permalink / raw)
  To: qemu devel, Jason Wang, Eric Blake
  Cc: Zhang Chen, Li Zhijian, zhanghailiang, eddie . dong,
	Bian Naimeng, Changlong Xie

Xen doesn't need this.

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
---
 migration/savevm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/migration/savevm.c b/migration/savevm.c
index 0363372..bec6c7e 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1973,6 +1973,10 @@ int qemu_loadvm_state(QEMUFile *f)
         ret = qemu_file_get_error(f);
     }
 
+    if (xen_enabled()) {
+        return ret;
+    }
+
     /*
      * Try to read in the VMDESC section as well, so that dumping tools that
      * intercept our migration stream have the chance to see it.
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH for-2.9 V3 2/3] Add a new qmp command to start/stop replication
  2016-12-09  6:04 [Qemu-devel] [PATCH for-2.9 V3 0/3] Add new qmp commands to suppurt Xen COLO Zhang Chen
  2016-12-09  6:04 ` [Qemu-devel] [PATCH for-2.9 V3 1/3] Migration: Don't load vmdesc when xen is enabled Zhang Chen
@ 2016-12-09  6:04 ` Zhang Chen
  2016-12-09  6:04 ` [Qemu-devel] [PATCH for-2.9 V3 3/3] Add a new qmp command to do checkpoint, get replication error Zhang Chen
  2 siblings, 0 replies; 7+ messages in thread
From: Zhang Chen @ 2016-12-09  6:04 UTC (permalink / raw)
  To: qemu devel, Jason Wang, Eric Blake
  Cc: Zhang Chen, Li Zhijian, zhanghailiang, eddie . dong,
	Bian Naimeng, Changlong Xie

We can call this qmp command to start/stop replication outside of qemu.
Like Xen colo need this function.

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
---
 docs/qmp-commands.txt | 18 ++++++++++++++++++
 migration/colo.c      | 23 +++++++++++++++++++++++
 qapi-schema.json      | 19 +++++++++++++++++++
 3 files changed, 60 insertions(+)

diff --git a/docs/qmp-commands.txt b/docs/qmp-commands.txt
index abf210a..a8e9eb6 100644
--- a/docs/qmp-commands.txt
+++ b/docs/qmp-commands.txt
@@ -432,6 +432,24 @@ Example:
      "arguments": { "enable": true } }
 <- { "return": {} }
 
+xen-set-replication
+-------------------
+
+Enable or disable replication.
+
+Arguments:
+
+- "enable": Enable it or disable it.
+- "primary": True for primary or false for secondary.
+- "failover": Enable failover when stopping replication, but cannot be
+              specified if 'enable' is true (optional, default false).
+
+Example:
+
+-> { "execute": "xen-set-replicate",
+     "arguments": {"enable": true, "primary": false} }
+<- { "return": {} }
+
 migrate
 -------
 
diff --git a/migration/colo.c b/migration/colo.c
index 93c85c5..6fc2ade 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -19,6 +19,8 @@
 #include "qemu/error-report.h"
 #include "qapi/error.h"
 #include "migration/failover.h"
+#include "replication.h"
+#include "qmp-commands.h"
 
 #define COLO_BUFFER_BASE_SIZE (4 * 1024 * 1024)
 
@@ -104,6 +106,27 @@ void colo_do_failover(MigrationState *s)
     }
 }
 
+void qmp_xen_set_replication(bool enable, bool primary,
+                             bool has_failover, bool failover,
+                             Error **errp)
+{
+    ReplicationMode mode = primary ?
+                           REPLICATION_MODE_PRIMARY :
+                           REPLICATION_MODE_SECONDARY;
+
+    if (has_failover && enable) {
+        error_setg(errp, "Parameter 'failover' is only for"
+                   " stopping replication");
+        return;
+    }
+
+    if (enable) {
+        replication_start_all(mode, errp);
+    } else {
+        replication_stop_all(failover, failover ? NULL : errp);
+    }
+}
+
 static void colo_send_message(QEMUFile *f, COLOMessage msg,
                               Error **errp)
 {
diff --git a/qapi-schema.json b/qapi-schema.json
index f3e9bfc..78802f4 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -4676,6 +4676,25 @@
 { 'command': 'xen-load-devices-state', 'data': {'filename': 'str'} }
 
 ##
+# @xen-set-replication
+#
+# Enable or disable replication.
+#
+# @enable: true to enable, false to disable.
+#
+# @primary: true for primary or false for secondary.
+#
+# @failover: #optional true to do failover, false to stop. but cannot be
+#            specified if 'enable' is true. default value is false.
+#
+# Returns: nothing.
+#
+# Since: 2.9
+##
+{ 'command': 'xen-set-replication',
+  'data': { 'enable': 'bool', 'primary': 'bool', '*failover' : 'bool' } }
+
+##
 # @GICCapability:
 #
 # The struct describes capability for a specific GIC (Generic
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH for-2.9 V3 3/3] Add a new qmp command to do checkpoint, get replication error
  2016-12-09  6:04 [Qemu-devel] [PATCH for-2.9 V3 0/3] Add new qmp commands to suppurt Xen COLO Zhang Chen
  2016-12-09  6:04 ` [Qemu-devel] [PATCH for-2.9 V3 1/3] Migration: Don't load vmdesc when xen is enabled Zhang Chen
  2016-12-09  6:04 ` [Qemu-devel] [PATCH for-2.9 V3 2/3] Add a new qmp command to start/stop replication Zhang Chen
@ 2016-12-09  6:04 ` Zhang Chen
  2 siblings, 0 replies; 7+ messages in thread
From: Zhang Chen @ 2016-12-09  6:04 UTC (permalink / raw)
  To: qemu devel, Jason Wang, Eric Blake
  Cc: Zhang Chen, Li Zhijian, zhanghailiang, eddie . dong,
	Bian Naimeng, Changlong Xie

We can call this qmp command to do checkpoint outside of qemu.
Like Xen colo need this function.

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
---
 docs/qmp-commands.txt | 24 ++++++++++++++++++++++++
 migration/colo.c      | 10 ++++++++++
 qapi-schema.json      | 22 ++++++++++++++++++++++
 3 files changed, 56 insertions(+)

diff --git a/docs/qmp-commands.txt b/docs/qmp-commands.txt
index a8e9eb6..093b7eb 100644
--- a/docs/qmp-commands.txt
+++ b/docs/qmp-commands.txt
@@ -450,6 +450,30 @@ Example:
      "arguments": {"enable": true, "primary": false} }
 <- { "return": {} }
 
+xen-get-replication-error
+-------------------------
+
+Get replication error that occurs when vm is running.
+
+Arguments: None.
+
+Example:
+
+-> { "execute": "xen-get-replication-error" }
+<- { "return": {} }
+
+xen-do-checkpoint
+-----------------
+
+Do checkpoint.
+
+Arguments: None.
+
+Example:
+
+-> { "execute": "xen-do-checkpoint" }
+<- { "return": {} }
+
 migrate
 -------
 
diff --git a/migration/colo.c b/migration/colo.c
index 6fc2ade..1e962f6 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -127,6 +127,16 @@ void qmp_xen_set_replication(bool enable, bool primary,
     }
 }
 
+void qmp_xen_get_replication_error(Error **errp)
+    {
+        replication_get_error_all(errp);
+    }
+
+void qmp_xen_do_checkpoint(Error **errp)
+    {
+        replication_do_checkpoint_all(errp);
+    }
+
 static void colo_send_message(QEMUFile *f, COLOMessage msg,
                               Error **errp)
 {
diff --git a/qapi-schema.json b/qapi-schema.json
index 78802f4..79fe4dd 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -4695,6 +4695,28 @@
   'data': { 'enable': 'bool', 'primary': 'bool', '*failover' : 'bool' } }
 
 ##
+# @xen-get-replication-error
+#
+# Get replication error that occurs when the vm is running.
+#
+# Returns: nothing.
+#
+# Since: 2.9
+##
+{ 'command': 'xen-get-replication-error' }
+
+##
+# @xen-do-checkpoint
+#
+# Do checkpoint.
+#
+# Returns: nothing.
+#
+# Since: 2.9
+##
+{ 'command': 'xen-do-checkpoint' }
+
+##
 # @GICCapability:
 #
 # The struct describes capability for a specific GIC (Generic
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.9 V3 1/3] Migration: Don't load vmdesc when xen is enabled
  2016-12-09  6:04 ` [Qemu-devel] [PATCH for-2.9 V3 1/3] Migration: Don't load vmdesc when xen is enabled Zhang Chen
@ 2016-12-14  1:00   ` Stefano Stabellini
  2016-12-15  6:46     ` Zhang Chen
  0 siblings, 1 reply; 7+ messages in thread
From: Stefano Stabellini @ 2016-12-14  1:00 UTC (permalink / raw)
  To: Zhang Chen
  Cc: qemu devel, Jason Wang, Eric Blake, Changlong Xie, Li Zhijian,
	eddie . dong, Bian Naimeng, zhanghailiang

On Fri, 9 Dec 2016, Zhang Chen wrote:
> Xen doesn't need this.

Could you please elaborate a bit more on what is the problem exactly,
and why we don't have any issues with migration with Xen today (COLO
use-case aside)?


> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
> ---
>  migration/savevm.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 0363372..bec6c7e 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -1973,6 +1973,10 @@ int qemu_loadvm_state(QEMUFile *f)
>          ret = qemu_file_get_error(f);
>      }
>  
> +    if (xen_enabled()) {
> +        return ret;
> +    }
> +
>      /*
>       * Try to read in the VMDESC section as well, so that dumping tools that
>       * intercept our migration stream have the chance to see it.
> -- 
> 2.7.4
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.9 V3 1/3] Migration: Don't load vmdesc when xen is enabled
  2016-12-14  1:00   ` Stefano Stabellini
@ 2016-12-15  6:46     ` Zhang Chen
  2016-12-15  8:46       ` Zhang Chen
  0 siblings, 1 reply; 7+ messages in thread
From: Zhang Chen @ 2016-12-15  6:46 UTC (permalink / raw)
  To: Stefano Stabellini, Wen Congyang
  Cc: qemu devel, Jason Wang, Eric Blake, Li Zhijian, eddie . dong,
	Bian Naimeng



On 12/14/2016 09:00 AM, Stefano Stabellini wrote:
> On Fri, 9 Dec 2016, Zhang Chen wrote:
>> Xen doesn't need this.
> Could you please elaborate a bit more on what is the problem exactly,
> and why we don't have any issues with migration with Xen today (COLO
> use-case aside)?
>

I test COLO without this patch, it seems run normally.
And I review the codes not find why we need this too.
So, I cc the original author wency about this.

CC. wency.

Thanks
Zhang Chen

>> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
>> ---
>>   migration/savevm.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/migration/savevm.c b/migration/savevm.c
>> index 0363372..bec6c7e 100644
>> --- a/migration/savevm.c
>> +++ b/migration/savevm.c
>> @@ -1973,6 +1973,10 @@ int qemu_loadvm_state(QEMUFile *f)
>>           ret = qemu_file_get_error(f);
>>       }
>>   
>> +    if (xen_enabled()) {
>> +        return ret;
>> +    }
>> +
>>       /*
>>        * Try to read in the VMDESC section as well, so that dumping tools that
>>        * intercept our migration stream have the chance to see it.
>> -- 
>> 2.7.4
>>
>>
>>
>>
>
> .
>

-- 
Thanks
Zhang Chen

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.9 V3 1/3] Migration: Don't load vmdesc when xen is enabled
  2016-12-15  6:46     ` Zhang Chen
@ 2016-12-15  8:46       ` Zhang Chen
  0 siblings, 0 replies; 7+ messages in thread
From: Zhang Chen @ 2016-12-15  8:46 UTC (permalink / raw)
  To: Stefano Stabellini, Wen Congyang
  Cc: qemu devel, Jason Wang, Eric Blake, Li Zhijian, eddie . dong,
	Bian Naimeng



On 12/15/2016 02:46 PM, Zhang Chen wrote:
>
>
> On 12/14/2016 09:00 AM, Stefano Stabellini wrote:
>> On Fri, 9 Dec 2016, Zhang Chen wrote:
>>> Xen doesn't need this.
>> Could you please elaborate a bit more on what is the problem exactly,
>> and why we don't have any issues with migration with Xen today (COLO
>> use-case aside)?
>>
>
> I test COLO without this patch, it seems run normally.
> And I review the codes not find why we need this too.
> So, I cc the original author wency about this.
>
> CC. wency.
>

I contacted wency, Here we can ignore this patch.
I will remove this patch in next version.

Thanks
Zhang Chen

> Thanks
> Zhang Chen
>
>>> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
>>> ---
>>>   migration/savevm.c | 4 ++++
>>>   1 file changed, 4 insertions(+)
>>>
>>> diff --git a/migration/savevm.c b/migration/savevm.c
>>> index 0363372..bec6c7e 100644
>>> --- a/migration/savevm.c
>>> +++ b/migration/savevm.c
>>> @@ -1973,6 +1973,10 @@ int qemu_loadvm_state(QEMUFile *f)
>>>           ret = qemu_file_get_error(f);
>>>       }
>>>   +    if (xen_enabled()) {
>>> +        return ret;
>>> +    }
>>> +
>>>       /*
>>>        * Try to read in the VMDESC section as well, so that dumping 
>>> tools that
>>>        * intercept our migration stream have the chance to see it.
>>> -- 
>>> 2.7.4
>>>
>>>
>>>
>>>
>>
>> .
>>
>

-- 
Thanks
Zhang Chen

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-12-15  8:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-09  6:04 [Qemu-devel] [PATCH for-2.9 V3 0/3] Add new qmp commands to suppurt Xen COLO Zhang Chen
2016-12-09  6:04 ` [Qemu-devel] [PATCH for-2.9 V3 1/3] Migration: Don't load vmdesc when xen is enabled Zhang Chen
2016-12-14  1:00   ` Stefano Stabellini
2016-12-15  6:46     ` Zhang Chen
2016-12-15  8:46       ` Zhang Chen
2016-12-09  6:04 ` [Qemu-devel] [PATCH for-2.9 V3 2/3] Add a new qmp command to start/stop replication Zhang Chen
2016-12-09  6:04 ` [Qemu-devel] [PATCH for-2.9 V3 3/3] Add a new qmp command to do checkpoint, get replication error Zhang Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.