I have seen several messages asking for VDE networking support.
There is an item also in your todo web page.
http://libvirt.org/todo.html
I have developed a patch to provide a basic support for VDE.
It defines and manages the syntax:
<domain ....>
<device>
<interface type='vde'>
...
<switch path='/tmp/vde.ctl'/>
</interface>
</device>
</domain>
the switch tag can be omitted: vde uses the default switch.
I have tested the qemu/kvm support.
user-mode linux support is included but not tested yet.
libvirt vde support for virtualbox has not been coded yet (virtualbox
itself supports vde).
The patch is against libvirt-0.8.7.
renzo
(designer/developer of VDE, university of bologna,
wiki.virtualsquare.org)
(I have not subscribed the ML, please Cc: to me your reply messages)
Signed-off-by: Renzo Davoli <renzo(a)cs.unibo.it>
---
--- a/src/lxc/lxc_driver.c 2011-01-10 11:49:49.000000000 +0100
+++ b/src/lxc/lxc_driver.c 2011-01-10 11:50:03.000000000 +0100
@@ -1083,6 +1083,7 @@
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_DIRECT:
case VIR_DOMAIN_NET_TYPE_LAST:
+ case VIR_DOMAIN_NET_TYPE_VDE:
break;
}
--- a/src/uml/uml_conf.c 2011-01-10 12:03:54.000000000 +0100
+++ b/src/uml/uml_conf.c 2011-01-10 13:26:08.000000000 +0100
@@ -269,6 +269,14 @@
virBufferVSprintf(&buf, "tuntap,%s", def->ifname);
break;
+ case VIR_DOMAIN_NET_TYPE_VDE:
+ /* ethNNN=vde,vde_switch,macaddr,port,group,mode,description */
+ if (def->data.vde.vdeswitch) {
+ virBufferVSprintf(&buf, "vde,%s", def->data.vde.vdeswitch);
+ } else
+ virBufferAddLit(&buf, "vde");
+ break;
+
case VIR_DOMAIN_NET_TYPE_INTERNAL:
umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("internal networking type not supported"));
--- a/src/conf/domain_conf.h 2011-01-10 11:41:07.000000000 +0100
+++ b/src/conf/domain_conf.h 2011-01-10 13:21:08.000000000 +0100
@@ -288,6 +288,7 @@
VIR_DOMAIN_NET_TYPE_BRIDGE,
VIR_DOMAIN_NET_TYPE_INTERNAL,
VIR_DOMAIN_NET_TYPE_DIRECT,
+ VIR_DOMAIN_NET_TYPE_VDE,
VIR_DOMAIN_NET_TYPE_LAST,
};
@@ -336,6 +337,9 @@
int mode;
virVirtualPortProfileParams virtPortProfile;
} direct;
+ struct {
+ char *vdeswitch;
+ } vde;
} data;
char *ifname;
virDomainDeviceInfo info;
--- a/src/conf/domain_conf.c 2011-01-10 11:42:04.000000000 +0100
+++ b/src/conf/domain_conf.c 2011-01-10 14:49:46.000000000 +0100
@@ -182,7 +182,8 @@
"network",
"bridge",
"internal",
- "direct")
+ "direct",
+ "vde")
VIR_ENUM_IMPL(virDomainChrChannelTarget,
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST,
@@ -598,6 +599,10 @@
VIR_FREE(def->data.direct.linkdev);
break;
+ case VIR_DOMAIN_NET_TYPE_VDE:
+ VIR_FREE(def->data.vde.vdeswitch);
+ break;
+
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
@@ -2293,6 +2298,7 @@
char *internal = NULL;
char *devaddr = NULL;
char *mode = NULL;
+ char *vdeswitch = NULL;
virNWFilterHashTablePtr filterparams = NULL;
virVirtualPortProfileParams virtPort;
bool virtPortParsed = false;
@@ -2379,7 +2385,11 @@
xmlStrEqual(cur->name, BAD_CAST "state")) {
/* Legacy back-compat. Don't add any more attributes here */
devaddr = virXMLPropString(cur, "devaddr");
- }
+ } else if ((vdeswitch == NULL) &&
+ def->type == VIR_DOMAIN_NET_TYPE_VDE &&
+ xmlStrEqual(cur->name, BAD_CAST "switch")) {
+ vdeswitch = virXMLPropString(cur, "path");
+ }
}
cur = cur->next;
}
@@ -2529,6 +2539,11 @@
break;
+ case VIR_DOMAIN_NET_TYPE_VDE:
+ def->data.vde.vdeswitch = vdeswitch;
+ vdeswitch = NULL;
+ break;
+
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
@@ -6263,6 +6278,12 @@
" ");
break;
+ case VIR_DOMAIN_NET_TYPE_VDE:
+ if (def->data.vde.vdeswitch)
+ virBufferEscapeString(buf, " <switch
path='%s'/>\n",
+ def->data.vde.vdeswitch);
+ break;
+
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
--- a/src/qemu/qemu_command.c 2011-01-10 13:11:17.000000000 +0100
+++ b/src/qemu/qemu_command.c 2011-01-10 13:26:28.000000000 +0100
@@ -1602,12 +1602,21 @@
case VIR_DOMAIN_NET_TYPE_BRIDGE:
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_DIRECT:
+ case VIR_DOMAIN_NET_TYPE_VDE:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
type_sep = ',';
break;
+ case VIR_DOMAIN_NET_TYPE_VDE:
+ virBufferAddLit(&buf, "vde");
+ if (net->data.vde.vdeswitch)
+ virBufferVSprintf(&buf, "%csock=%s",
+ type_sep,
+ net->data.vde.vdeswitch);
+ break;
+
case VIR_DOMAIN_NET_TYPE_USER:
default:
virBufferAddLit(&buf, "user");