All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhanghailiang <zhang.zhanghailiang@huawei.com>
To: qemu-devel@nongnu.org
Cc: lizhijian@cn.fujitsu.com, quintela@redhat.com,
	yunhong.jiang@intel.com, eddie.dong@intel.com,
	peter.huangpeng@huawei.com, dgilbert@redhat.com,
	zhanghailiang <zhang.zhanghailiang@huawei.com>,
	arei.gonglei@huawei.com, amit.shah@redhat.com,
	david@gibson.dropbear.id.au
Subject: [Qemu-devel] [RFC PATCH v4 17/28] COLO: Add new command parameter 'colo_nicname' 'colo_script' for net
Date: Thu, 26 Mar 2015 13:29:23 +0800	[thread overview]
Message-ID: <1427347774-8960-18-git-send-email-zhang.zhanghailiang@huawei.com> (raw)
In-Reply-To: <1427347774-8960-1-git-send-email-zhang.zhanghailiang@huawei.com>

The 'colo_nicname' should be assigned with network name,
for exmple, 'eth2'. It will be parameter of 'colo_script',
'colo_script' should be assigned with an scirpt path.

We parse these parameter in tap.

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
---
 include/net/net.h |  4 ++++
 net/tap.c         | 27 ++++++++++++++++++++++++---
 qapi-schema.json  |  8 +++++++-
 qemu-options.hx   | 10 +++++++++-
 4 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/include/net/net.h b/include/net/net.h
index 50ffcb9..6cc575f 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -84,6 +84,10 @@ struct NetClientState {
     char *model;
     char *name;
     char info_str[256];
+    char colo_script[1024];
+    char colo_nicname[128];
+    char ifname[128];
+    char ifb[2][128];
     unsigned receive_disabled : 1;
     NetClientDestructor *destructor;
     unsigned int queue_index;
diff --git a/net/tap.c b/net/tap.c
index 968df46..823f78e 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -608,6 +608,7 @@ static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
     Error *err = NULL;
     TAPState *s;
     int vhostfd;
+    NetClientState *nc = NULL;
 
     s = net_tap_fd_init(peer, model, name, fd, vnet_hdr);
     if (!s) {
@@ -635,6 +636,17 @@ static int net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
         }
     }
 
+    nc = &(s->nc);
+    snprintf(nc->ifname, sizeof(nc->ifname), "%s", ifname);
+    if (tap->has_colo_script) {
+        snprintf(nc->colo_script, sizeof(nc->colo_script), "%s",
+                 tap->colo_script);
+    }
+    if (tap->has_colo_nicname) {
+        snprintf(nc->colo_nicname, sizeof(nc->colo_nicname), "%s",
+                 tap->colo_nicname);
+    }
+
     if (tap->has_vhost ? tap->vhost :
         vhostfdname || (tap->has_vhostforce && tap->vhostforce)) {
         VhostNetOptions options;
@@ -754,9 +766,10 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
 
         if (tap->has_ifname || tap->has_script || tap->has_downscript ||
             tap->has_vnet_hdr || tap->has_helper || tap->has_queues ||
-            tap->has_vhostfd) {
+            tap->has_vhostfd || tap->has_colo_script || tap->has_colo_nicname) {
             error_report("ifname=, script=, downscript=, vnet_hdr=, "
                          "helper=, queues=, and vhostfd= "
+                         "colo_script=, and colo_nicname= "
                          "are invalid with fds=");
             return -1;
         }
@@ -796,9 +809,11 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
         }
     } else if (tap->has_helper) {
         if (tap->has_ifname || tap->has_script || tap->has_downscript ||
-            tap->has_vnet_hdr || tap->has_queues || tap->has_vhostfds) {
+            tap->has_vnet_hdr || tap->has_queues || tap->has_vhostfds ||
+            tap->has_colo_script || tap->has_colo_nicname) {
             error_report("ifname=, script=, downscript=, and vnet_hdr= "
-                         "queues=, and vhostfds= are invalid with helper=");
+                         "queues=, vhostfds=, colo_script=, and "
+                         "colo_nicname= are invalid with helper=");
             return -1;
         }
 
@@ -817,6 +832,12 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
             return -1;
         }
     } else {
+        if (queues > 1 && (tap->has_colo_script || tap->has_colo_nicname)) {
+            error_report("queues > 1 is invalid if colo_script or "
+                         "colo_nicname is specified");
+            return -1;
+        }
+
         if (tap->has_vhostfds) {
             error_report("vhostfds= is invalid if fds= wasn't specified");
             return -1;
diff --git a/qapi-schema.json b/qapi-schema.json
index e11c152..8abc367 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2143,6 +2143,10 @@
 #
 # @queues: #optional number of queues to be created for multiqueue capable tap
 #
+# @colo_nicname: #optional the host physical nic for QEMU (Since 2.3)
+#
+# @colo_script: #optional the script file which used by COLO (Since 2.3)
+#
 # Since 1.2
 ##
 { 'type': 'NetdevTapOptions',
@@ -2159,7 +2163,9 @@
     '*vhostfd':    'str',
     '*vhostfds':   'str',
     '*vhostforce': 'bool',
-    '*queues':     'uint32'} }
+    '*queues':     'uint32',
+    '*colo_nicname':  'str',
+    '*colo_script':   'str'} }
 
 ##
 # @NetdevSocketOptions
diff --git a/qemu-options.hx b/qemu-options.hx
index 319d971..ff63c50 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1466,7 +1466,11 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
     "-net tap[,vlan=n][,name=str],ifname=name\n"
     "                connect the host TAP network interface to VLAN 'n'\n"
 #else
-    "-net tap[,vlan=n][,name=str][,fd=h][,fds=x:y:...:z][,ifname=name][,script=file][,downscript=dfile][,helper=helper][,sndbuf=nbytes][,vnet_hdr=on|off][,vhost=on|off][,vhostfd=h][,vhostfds=x:y:...:z][,vhostforce=on|off][,queues=n]\n"
+    "-net tap[,vlan=n][,name=str][,fd=h][,fds=x:y:...:z][,ifname=name][,script=file][,downscript=dfile][,helper=helper][,sndbuf=nbytes][,vnet_hdr=on|off][,vhost=on|off][,vhostfd=h][,vhostfds=x:y:...:z][,vhostforce=on|off][,queues=n]"
+#ifdef CONFIG_COLO
+    "[,colo_nicname=nicname][,colo_script=scriptfile]"
+#endif
+    "\n"
     "                connect the host TAP network interface to VLAN 'n'\n"
     "                use network scripts 'file' (default=" DEFAULT_NETWORK_SCRIPT ")\n"
     "                to configure it and 'dfile' (default=" DEFAULT_NETWORK_DOWN_SCRIPT ")\n"
@@ -1486,6 +1490,10 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
     "                use 'vhostfd=h' to connect to an already opened vhost net device\n"
     "                use 'vhostfds=x:y:...:z to connect to multiple already opened vhost net devices\n"
     "                use 'queues=n' to specify the number of queues to be created for multiqueue TAP\n"
+#ifdef CONFIG_COLO
+    "                use 'colo_nicname=nicname' to specify the host physical nic for QEMU\n"
+    "                use 'colo_script=scriptfile' to specify script file when colo is enabled\n"
+#endif
     "-net bridge[,vlan=n][,name=str][,br=bridge][,helper=helper]\n"
     "                connects a host TAP network interface to a host bridge device 'br'\n"
     "                (default=" DEFAULT_BRIDGE_INTERFACE ") using the program 'helper'\n"
-- 
1.7.12.4

  parent reply	other threads:[~2015-03-26  5:34 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-26  5:29 [Qemu-devel] [RFC PATCH v4 00/28] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 01/28] configure: Add parameter for configure to enable/disable COLO support zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 02/28] migration: Introduce capability 'colo' to migration zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 03/28] COLO: migrate colo related info to slave zhanghailiang
2015-05-15 11:38   ` Dr. David Alan Gilbert
2015-05-18  5:04     ` zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 04/28] migration: Integrate COLO checkpoint process into migration zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 05/28] migration: Integrate COLO checkpoint process into loadvm zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 06/28] COLO: Implement colo checkpoint protocol zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 07/28] COLO: Add a new RunState RUN_STATE_COLO zhanghailiang
2015-05-15 11:28   ` Dr. David Alan Gilbert
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 08/28] QEMUSizedBuffer: Introduce two help functions for qsb zhanghailiang
2015-05-15 11:56   ` Dr. David Alan Gilbert
2015-05-18  5:10     ` zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 09/28] COLO: Save VM state to slave when do checkpoint zhanghailiang
2015-05-15 12:09   ` Dr. David Alan Gilbert
2015-05-18  9:11     ` zhanghailiang
2015-05-18 12:10       ` Dr. David Alan Gilbert
2015-05-18 12:22         ` zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 10/28] COLO RAM: Load PVM's dirty page into SVM's RAM cache temporarily zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 11/28] COLO VMstate: Load VM state into qsb before restore it zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 12/28] arch_init: Start to trace dirty pages of SVM zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 13/28] COLO RAM: Flush cached RAM into SVM's memory zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 14/28] COLO failover: Introduce a new command to trigger a failover zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 15/28] COLO failover: Implement COLO master/slave failover work zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 16/28] COLO failover: Don't do failover during loading VM's state zhanghailiang
2015-03-26  5:29 ` zhanghailiang [this message]
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 18/28] COLO NIC: Init/remove colo nic devices when add/cleanup tap devices zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 19/28] COLO NIC: Implement colo nic device interface configure() zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 20/28] COLO NIC : Implement colo nic init/destroy function zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 21/28] COLO NIC: Some init work related with proxy module zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 22/28] COLO: Do checkpoint according to the result of net packets comparing zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 23/28] COLO: Improve checkpoint efficiency by do additional periodic checkpoint zhanghailiang
2015-05-18 16:48   ` Dr. David Alan Gilbert
2015-05-19  6:08     ` zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 24/28] COLO: Add colo-set-checkpoint-period command zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 25/28] COLO NIC: Implement NIC checkpoint and failover zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 26/28] COLO: Disable qdev hotplug when VM is in COLO mode zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 27/28] COLO: Implement shutdown checkpoint zhanghailiang
2015-03-26  5:29 ` [Qemu-devel] [RFC PATCH v4 28/28] COLO: Add block replication into colo process zhanghailiang
2015-04-08  8:16 ` [Qemu-devel] [RFC PATCH v4 00/28] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service zhanghailiang
2015-04-22 11:18   ` Dr. David Alan Gilbert
2015-04-24  7:25     ` Wen Congyang
2015-04-24  8:35       ` Dr. David Alan Gilbert
2015-04-28 10:51         ` zhanghailiang
2015-05-06 17:11           ` Dr. David Alan Gilbert
2015-04-24  8:52     ` zhanghailiang
2015-04-24  8:56       ` Dr. David Alan Gilbert
2015-05-14 12:14 ` Dr. David Alan Gilbert
2015-05-14 12:58   ` zhanghailiang
2015-05-14 16:09     ` Dr. David Alan Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1427347774-8960-18-git-send-email-zhang.zhanghailiang@huawei.com \
    --to=zhang.zhanghailiang@huawei.com \
    --cc=amit.shah@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=dgilbert@redhat.com \
    --cc=eddie.dong@intel.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=yunhong.jiang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.