[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RFC v3 17/27] COLO: Add new command parameter 'colo_
From: |
zhanghailiang |
Subject: |
[Qemu-devel] [PATCH RFC v3 17/27] COLO: Add new command parameter 'colo_nicname' 'colo_script' for net |
Date: |
Thu, 12 Feb 2015 11:17:04 +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: Gao feng <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 008d610..6095c28 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 1fe0edf..f744dcc 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -607,6 +607,7 @@ static int net_init_tap_one(const NetdevTapOptions *tap,
NetClientState *peer,
{
TAPState *s;
int vhostfd;
+ NetClientState *nc = NULL;
s = net_tap_fd_init(peer, model, name, fd, vnet_hdr);
if (!s) {
@@ -634,6 +635,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;
@@ -750,9 +762,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;
}
@@ -791,9 +804,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;
}
@@ -812,6 +827,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 4873561..779acd2 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2101,6 +2101,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',
@@ -2117,7 +2121,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 85ca3ad..3e9757c 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1418,7 +1418,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"
@@ -1438,6 +1442,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] [PATCH RFC v3 07/27] COLO: Implement colo checkpoint protocol, (continued)
- [Qemu-devel] [PATCH RFC v3 07/27] COLO: Implement colo checkpoint protocol, zhanghailiang, 2015/02/11
- [Qemu-devel] [PATCH RFC v3 04/27] migration: Integrate COLO checkpoint process into migration, zhanghailiang, 2015/02/11
- [Qemu-devel] [PATCH RFC v3 09/27] QEMUSizedBuffer: Introduce two help functions for qsb, zhanghailiang, 2015/02/11
- [Qemu-devel] [PATCH RFC v3 12/27] COLO VMstate: Load VM state into qsb before restore it, zhanghailiang, 2015/02/11
- [Qemu-devel] [PATCH RFC v3 10/27] COLO: Save VM state to slave when do checkpoint, zhanghailiang, 2015/02/11
- [Qemu-devel] [PATCH RFC v3 13/27] COLO RAM: Flush cached RAM into SVM's memory, zhanghailiang, 2015/02/11
- [Qemu-devel] [PATCH RFC v3 16/27] COLO failover: Don't do failover during loading VM's state, zhanghailiang, 2015/02/11
- [Qemu-devel] [PATCH RFC v3 15/27] COLO failover: Implement COLO master/slave failover work, zhanghailiang, 2015/02/11
- [Qemu-devel] [PATCH RFC v3 17/27] COLO: Add new command parameter 'colo_nicname' 'colo_script' for net,
zhanghailiang <=
- Re: [Qemu-devel] [PATCH RFC v3 17/27] COLO: Add new command parameter 'colo_nicname' 'colo_script' for net, Eric Blake, 2015/02/16
- Re: [Qemu-devel] [PATCH RFC v3 17/27] COLO: Add new command parameter 'colo_nicname' 'colo_script' for net, Wen Congyang, 2015/02/24
- Re: [Qemu-devel] [PATCH RFC v3 17/27] COLO: Add new command parameter 'colo_nicname' 'colo_script' for net, Eric Blake, 2015/02/24
- Re: [Qemu-devel] [PATCH RFC v3 17/27] COLO: Add new command parameter 'colo_nicname' 'colo_script' for net, Daniel P. Berrange, 2015/02/24
- Re: [Qemu-devel] [PATCH RFC v3 17/27] COLO: Add new command parameter 'colo_nicname' 'colo_script' for net, zhanghailiang, 2015/02/25
- Re: [Qemu-devel] [PATCH RFC v3 17/27] COLO: Add new command parameter 'colo_nicname' 'colo_script' for net, Daniel P. Berrange, 2015/02/25
- Re: [Qemu-devel] [PATCH RFC v3 17/27] COLO: Add new command parameter 'colo_nicname' 'colo_script' for net, zhanghailiang, 2015/02/25
[Qemu-devel] [PATCH RFC v3 18/27] COLO NIC: Init/remove colo nic devices when add/cleanup tap devices, zhanghailiang, 2015/02/11
[Qemu-devel] [PATCH RFC v3 21/27] COLO NIC: Some init work related with proxy module, zhanghailiang, 2015/02/11
[Qemu-devel] [PATCH RFC v3 19/27] COLO NIC: Implement colo nic device interface configure(), zhanghailiang, 2015/02/11