
"Daniel P. Berrange" <berrange@redhat.com> wrote on 02/08/2010 11:59:52 AM:
Please respond to "Daniel P. Berrange"
On Thu, Feb 04, 2010 at 08:02:42AM -0500, Stefan Berger wrote:
This part adds support to domain_conf.{c|h} for parsing the new interface XML of type 'direct'.
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
Index: libvirt-macvtap/src/conf/domain_conf.c =================================================================== --- libvirt-macvtap.orig/src/conf/domain_conf.c +++ libvirt-macvtap/src/conf/domain_conf.c @@ -41,6 +41,7 @@ #include "c-ctype.h" #include "logging.h" #include "network.h" +#include "macvtap.h"
#define VIR_FROM_THIS VIR_FROM_DOMAIN
@@ -140,7 +141,8 @@ VIR_ENUM_IMPL(virDomainNet, VIR_DOMAIN_N "mcast", "network", "bridge", - "internal") + "internal", + "direct")
VIR_ENUM_IMPL(virDomainChrTarget, VIR_DOMAIN_CHR_TARGET_TYPE_LAST, "null", @@ -222,6 +224,12 @@ VIR_ENUM_IMPL(virDomainSeclabel, VIR_DOM "dynamic", "static")
+VIR_ENUM_IMPL(virDomainNetdevMacvtap,
VIR_DOMAIN_NETDEV_MACVTAP_MODE_LAST,
+ MACVTAP_MODE_PRIVATE_STR, + MACVTAP_MODE_VEPA_STR, + MACVTAP_MODE_BRIDGE_STR)
These strings should really be included here directly - other areas of the code should only ever see the parsed enum integer value, never the string form which is for the XML only.
Ok. The reason why I did not use the returned 'int's is because the translated value will be passed to the driver and linux/if_link.h unfortunately defines those as follows: enum macvlan_mode { MACVLAN_MODE_PRIVATE = 1, MACVLAN_MODE_VEPA = 2, MACVLAN_MODE_BRIDGE = 4, }; Should I use those values in the array and fill the 0 and 3 with dummy values or have another function that translates the ones returned by the XYZTypeFromString() call in the actual 'enum macvlan_mode'? Stefan