提交 00229955 编写于 作者: L Laine Stump 提交者: Matthias Bolte

Support bond interfaces attached to bridges in interface xml.

This was accomplished in xml parsing by doing away with the
stripped-down virInterfaceBareDef object, and just always using
virInterfaceDef, but with restrictions in certain places (eg, the type
of subordinate interface allowed in parsing depends on the parent
interface).

xml formatting was similarly adjusted. In addition, the formatting
functions keep track of the level of interface nesting, and insert
extra leading spaces on each line accordingly (using %*s).

The only change in formatted xml from previous (aside frmo supporting
new combinations of interface types) is that the subordinate ethernet
interfaces take up 2 lines rather than one, eg:

   <interface type='ethernet' name='eth0'>
   </interface>

instead of:

   <interface type='ethernet' name='eth0'/>
上级 86304e35
此差异已折叠。
......@@ -84,14 +84,7 @@ enum virInterfaceBondArpValid {
VIR_INTERFACE_BOND_ARP_ALL, /* validate all */
};
typedef struct _virInterfaceBareDef virInterfaceBareDef;
typedef virInterfaceBareDef *virInterfaceBareDefPtr;
struct _virInterfaceBareDef {
int type; /* should be only ethernet or vlan */
char *name; /* the interface name */
char *mac_or_tag; /* MAC address for ethernet, TAG for vlan */
char *devname; /* device name for vlan */
};
struct _virInterfaceDef; /* forward declaration required for bridge/bond */
typedef struct _virInterfaceBridgeDef virInterfaceBridgeDef;
typedef virInterfaceBridgeDef *virInterfaceBridgeDefPtr;
......@@ -99,7 +92,7 @@ struct _virInterfaceBridgeDef {
int stp; /* 0, 1 or -1 if undefined */
char *delay;
int nbItf; /* number of defined interfaces */
virInterfaceBareDefPtr *itf;/* interfaces */
struct _virInterfaceDef **itf;/* interfaces */
};
typedef struct _virInterfaceBondDef virInterfaceBondDef;
......@@ -115,7 +108,7 @@ struct _virInterfaceBondDef {
char *target; /* arp monitoring target */
int validate; /* virInterfaceBondArpmValid */
int nbItf; /* number of defined interfaces */
virInterfaceBareDefPtr *itf; /* interfaces ethernet only */
struct _virInterfaceDef **itf; /* interfaces ethernet only */
};
typedef struct _virInterfaceVlanDef virInterfaceVlanDef;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册