[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v4 17/28] COLO: Add new command parameter 'colo_
From: |
zhanghailiang |
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 |
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 <address@hidden>
Signed-off-by: Li Zhijian <address@hidden>
---
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
- [Qemu-devel] [RFC PATCH v4 28/28] COLO: Add block replication into colo process, (continued)
- [Qemu-devel] [RFC PATCH v4 28/28] COLO: Add block replication into colo process, zhanghailiang, 2015/03/26
- [Qemu-devel] [RFC PATCH v4 22/28] COLO: Do checkpoint according to the result of net packets comparing, zhanghailiang, 2015/03/26
- [Qemu-devel] [RFC PATCH v4 27/28] COLO: Implement shutdown checkpoint, zhanghailiang, 2015/03/26
- [Qemu-devel] [RFC PATCH v4 20/28] COLO NIC : Implement colo nic init/destroy function, zhanghailiang, 2015/03/26
- [Qemu-devel] [RFC PATCH v4 25/28] COLO NIC: Implement NIC checkpoint and failover, zhanghailiang, 2015/03/26
- [Qemu-devel] [RFC PATCH v4 24/28] COLO: Add colo-set-checkpoint-period command, zhanghailiang, 2015/03/26
- [Qemu-devel] [RFC PATCH v4 14/28] COLO failover: Introduce a new command to trigger a failover, zhanghailiang, 2015/03/26
- [Qemu-devel] [RFC PATCH v4 13/28] COLO RAM: Flush cached RAM into SVM's memory, zhanghailiang, 2015/03/26
- [Qemu-devel] [RFC PATCH v4 16/28] COLO failover: Don't do failover during loading VM's state, zhanghailiang, 2015/03/26
- [Qemu-devel] [RFC PATCH v4 15/28] COLO failover: Implement COLO master/slave failover work, zhanghailiang, 2015/03/26
- [Qemu-devel] [RFC PATCH v4 17/28] COLO: Add new command parameter 'colo_nicname' 'colo_script' for net,
zhanghailiang <=
- [Qemu-devel] [RFC PATCH v4 21/28] COLO NIC: Some init work related with proxy module, zhanghailiang, 2015/03/26
- [Qemu-devel] [RFC PATCH v4 10/28] COLO RAM: Load PVM's dirty page into SVM's RAM cache temporarily, zhanghailiang, 2015/03/26
- [Qemu-devel] [RFC PATCH v4 03/28] COLO: migrate colo related info to slave, zhanghailiang, 2015/03/26
- [Qemu-devel] [RFC PATCH v4 06/28] COLO: Implement colo checkpoint protocol, zhanghailiang, 2015/03/26