提交 767e01ce 编写于 作者: D Daniel P. Berrange

Rename virVirtualPortProfileParams & APIs

Rename the virVirtualPortProfileParams struct to be
virNetDevVPortProfile, and rename the APIs to match
this prefix.

* src/util/network.c, src/util/network.h: Rename port profile
  APIs
* src/conf/domain_conf.c, src/conf/domain_conf.h,
  src/conf/network_conf.c, src/conf/network_conf.h,
  src/network/bridge_driver.c, src/qemu/qemu_hotplug.c,
  src/util/macvtap.c, src/util/macvtap.h: Update for
  renamed APIs/structs
上级 b1451b6c
......@@ -3112,8 +3112,8 @@ virDomainActualNetDefParseXML(xmlNodePtr node,
virtPortNode = virXPathNode("./virtualport", ctxt);
if (virtPortNode &&
virVirtualPortProfileParseXML(virtPortNode,
&actual->data.direct.virtPortProfile) < 0) {
virNetDevVPortProfileParse(virtPortNode,
&actual->data.direct.virtPortProfile) < 0) {
goto error;
}
}
......@@ -3169,7 +3169,7 @@ virDomainNetDefParseXML(virCapsPtr caps,
char *mode = NULL;
char *linkstate = NULL;
virNWFilterHashTablePtr filterparams = NULL;
virVirtualPortProfileParamsPtr virtPort = NULL;
virNetDevVPortProfilePtr virtPort = NULL;
virDomainActualNetDefPtr actual = NULL;
xmlNodePtr oldnode = ctxt->node;
int ret;
......@@ -3221,7 +3221,7 @@ virDomainNetDefParseXML(virCapsPtr caps,
((def->type == VIR_DOMAIN_NET_TYPE_DIRECT) ||
(def->type == VIR_DOMAIN_NET_TYPE_NETWORK)) &&
xmlStrEqual(cur->name, BAD_CAST "virtualport")) {
if (virVirtualPortProfileParseXML(cur, &virtPort) < 0)
if (virNetDevVPortProfileParse(cur, &virtPort) < 0)
goto error;
} else if ((network == NULL) &&
((def->type == VIR_DOMAIN_NET_TYPE_SERVER) ||
......@@ -9722,7 +9722,7 @@ virDomainActualNetDefFormat(virBufferPtr buf,
}
virBufferAsprintf(buf, " mode='%s'/>\n", mode);
virBufferAdjustIndent(buf, 8);
virVirtualPortProfileFormat(buf, def->data.direct.virtPortProfile);
virNetDevVPortProfileFormat(def->data.direct.virtPortProfile, buf);
virBufferAdjustIndent(buf, -8);
break;
default:
......@@ -9769,7 +9769,7 @@ virDomainNetDefFormat(virBufferPtr buf,
def->data.network.portgroup);
virBufferAddLit(buf, "/>\n");
virBufferAdjustIndent(buf, 6);
virVirtualPortProfileFormat(buf, def->data.network.virtPortProfile);
virNetDevVPortProfileFormat(def->data.network.virtPortProfile, buf);
virBufferAdjustIndent(buf, -6);
if ((flags & VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET) &&
(virDomainActualNetDefFormat(buf, def->data.network.actual) < 0))
......@@ -9819,7 +9819,7 @@ virDomainNetDefFormat(virBufferPtr buf,
virMacvtapModeTypeToString(def->data.direct.mode));
virBufferAddLit(buf, "/>\n");
virBufferAdjustIndent(buf, 6);
virVirtualPortProfileFormat(buf, def->data.direct.virtPortProfile);
virNetDevVPortProfileFormat(def->data.direct.virtPortProfile, buf);
virBufferAdjustIndent(buf, -6);
break;
......@@ -13079,7 +13079,7 @@ virDomainNetGetActualDirectMode(virDomainNetDefPtr iface)
return iface->data.network.actual->data.direct.mode;
}
virVirtualPortProfileParamsPtr
virNetDevVPortProfilePtr
virDomainNetGetActualDirectVirtPortProfile(virDomainNetDefPtr iface)
{
if (iface->type == VIR_DOMAIN_NET_TYPE_DIRECT)
......
......@@ -508,7 +508,7 @@ struct _virDomainActualNetDef {
struct {
char *linkdev;
int mode; /* enum virMacvtapMode from util/macvtap.h */
virVirtualPortProfileParamsPtr virtPortProfile;
virNetDevVPortProfilePtr virtPortProfile;
} direct;
} data;
virNetDevBandwidthPtr bandwidth;
......@@ -542,7 +542,7 @@ struct _virDomainNetDef {
struct {
char *name;
char *portgroup;
virVirtualPortProfileParamsPtr virtPortProfile;
virNetDevVPortProfilePtr virtPortProfile;
/* actual has info about the currently used physical
* device (if the network is of type
* bridge/private/vepa/passthrough). This is saved in the
......@@ -564,7 +564,7 @@ struct _virDomainNetDef {
struct {
char *linkdev;
int mode; /* enum virMacvtapMode from util/macvtap.h */
virVirtualPortProfileParamsPtr virtPortProfile;
virNetDevVPortProfilePtr virtPortProfile;
} direct;
} data;
struct {
......@@ -1795,7 +1795,7 @@ int virDomainNetGetActualType(virDomainNetDefPtr iface);
char *virDomainNetGetActualBridgeName(virDomainNetDefPtr iface);
char *virDomainNetGetActualDirectDev(virDomainNetDefPtr iface);
int virDomainNetGetActualDirectMode(virDomainNetDefPtr iface);
virVirtualPortProfileParamsPtr
virNetDevVPortProfilePtr
virDomainNetGetActualDirectVirtPortProfile(virDomainNetDefPtr iface);
virNetDevBandwidthPtr
virDomainNetGetActualBandwidth(virDomainNetDefPtr iface);
......
......@@ -790,8 +790,8 @@ virNetworkPortGroupParseXML(virPortGroupDefPtr def,
virtPortNode = virXPathNode("./virtualport", ctxt);
if (virtPortNode &&
(virVirtualPortProfileParseXML(virtPortNode,
&def->virtPortProfile) < 0)) {
(virNetDevVPortProfileParse(virtPortNode,
&def->virtPortProfile) < 0)) {
goto error;
}
......@@ -894,8 +894,8 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
virtPortNode = virXPathNode("./virtualport", ctxt);
if (virtPortNode &&
(virVirtualPortProfileParseXML(virtPortNode,
&def->virtPortProfile) < 0)) {
(virNetDevVPortProfileParse(virtPortNode,
&def->virtPortProfile) < 0)) {
goto error;
}
......@@ -1268,7 +1268,7 @@ virPortGroupDefFormat(virBufferPtr buf,
}
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 4);
virVirtualPortProfileFormat(buf, def->virtPortProfile);
virNetDevVPortProfileFormat(def->virtPortProfile, buf);
virNetDevBandwidthFormat(def->bandwidth, buf);
virBufferAdjustIndent(buf, -4);
virBufferAddLit(buf, " </portgroup>\n");
......@@ -1354,7 +1354,7 @@ char *virNetworkDefFormat(const virNetworkDefPtr def)
}
virBufferAdjustIndent(&buf, 2);
virVirtualPortProfileFormat(&buf, def->virtPortProfile);
virNetDevVPortProfileFormat(def->virtPortProfile, &buf);
virBufferAdjustIndent(&buf, -2);
for (ii = 0; ii < def->nPortGroups; ii++)
......
......@@ -122,7 +122,7 @@ typedef virPortGroupDef *virPortGroupDefPtr;
struct _virPortGroupDef {
char *name;
bool isDefault;
virVirtualPortProfileParamsPtr virtPortProfile;
virNetDevVPortProfilePtr virtPortProfile;
virNetDevBandwidthPtr bandwidth;
};
......@@ -151,7 +151,7 @@ struct _virNetworkDef {
virNetworkIpDefPtr ips; /* ptr to array of IP addresses on this network */
virNetworkDNSDefPtr dns; /* ptr to dns related configuration */
virVirtualPortProfileParamsPtr virtPortProfile;
virNetDevVPortProfilePtr virtPortProfile;
size_t nPortGroups;
virPortGroupDefPtr portGroups;
......
......@@ -786,9 +786,9 @@ virSocketAddrParseIPv4;
virSocketAddrParseIPv6;
virSocketAddrPrefixToNetmask;
virSocketAddrSetPort;
virVirtualPortProfileEqual;
virVirtualPortProfileFormat;
virVirtualPortProfileParseXML;
virNetDevVPortProfileEqual;
virNetDevVPortProfileFormat;
virNetDevVPortProfileParse;
# network_conf.h
......
......@@ -2766,7 +2766,7 @@ networkAllocateActualDevice(virDomainNetDefPtr iface)
(netdef->forwardType == VIR_NETWORK_FORWARD_PRIVATE) ||
(netdef->forwardType == VIR_NETWORK_FORWARD_VEPA) ||
(netdef->forwardType == VIR_NETWORK_FORWARD_PASSTHROUGH)) {
virVirtualPortProfileParamsPtr virtport = NULL;
virNetDevVPortProfilePtr virtport = NULL;
/* <forward type='bridge|private|vepa|passthrough'> are all
* VIR_DOMAIN_NET_TYPE_DIRECT.
......@@ -2838,7 +2838,7 @@ networkAllocateActualDevice(virDomainNetDefPtr iface)
((netdef->forwardType == VIR_NETWORK_FORWARD_PRIVATE) &&
iface->data.network.actual->data.direct.virtPortProfile &&
(iface->data.network.actual->data.direct.virtPortProfile->virtPortType
== VIR_VIRTUALPORT_8021QBH))) {
== VIR_NETDEV_VPORT_PROFILE_8021QBH))) {
/* pick first dev with 0 usageCount */
for (ii = 0; ii < netdef->nForwardIfs; ii++) {
......@@ -2965,7 +2965,7 @@ networkNotifyActualDevice(virDomainNetDefPtr iface)
((netdef->forwardType == VIR_NETWORK_FORWARD_PRIVATE) &&
iface->data.network.actual->data.direct.virtPortProfile &&
(iface->data.network.actual->data.direct.virtPortProfile->virtPortType
== VIR_VIRTUALPORT_8021QBH)))) {
== VIR_NETDEV_VPORT_PROFILE_8021QBH)))) {
networkReportError(VIR_ERR_INTERNAL_ERROR,
_("network '%s' claims dev='%s' is already in use by a different domain"),
netdef->name, actualDev);
......
......@@ -1238,7 +1238,7 @@ int qemuDomainChangeNet(struct qemud_driver *driver,
case VIR_DOMAIN_NET_TYPE_NETWORK:
if (STRNEQ_NULLABLE(olddev->data.network.name, dev->data.network.name) ||
STRNEQ_NULLABLE(olddev->data.network.portgroup, dev->data.network.portgroup) ||
!virVirtualPortProfileEqual(olddev->data.network.virtPortProfile, dev->data.network.virtPortProfile)) {
!virNetDevVPortProfileEqual(olddev->data.network.virtPortProfile, dev->data.network.virtPortProfile)) {
qemuReportError(VIR_ERR_NO_SUPPORT,
_("cannot modify network device configuration"));
return -1;
......@@ -1257,7 +1257,7 @@ int qemuDomainChangeNet(struct qemud_driver *driver,
case VIR_DOMAIN_NET_TYPE_DIRECT:
if (STRNEQ_NULLABLE(olddev->data.direct.linkdev, dev->data.direct.linkdev) ||
olddev->data.direct.mode != dev->data.direct.mode ||
!virVirtualPortProfileEqual(olddev->data.direct.virtPortProfile, dev->data.direct.virtPortProfile)) {
!virNetDevVPortProfileEqual(olddev->data.direct.virtPortProfile, dev->data.direct.virtPortProfile)) {
qemuReportError(VIR_ERR_NO_SUPPORT,
_("cannot modify direct network device configuration"));
return -1;
......
......@@ -89,11 +89,11 @@ VIR_ENUM_IMPL(virMacvtapMode, VIR_MACVTAP_MODE_LAST,
# define LLDPAD_PID_FILE "/var/run/lldpad.pid"
enum virVirtualPortOp {
ASSOCIATE = 0x1,
DISASSOCIATE = 0x2,
PREASSOCIATE = 0x3,
PREASSOCIATE_RR = 0x4,
enum virNetDevVPortProfileLinkOp {
VIR_NETDEV_VPORT_PROFILE_LINK_OP_ASSOCIATE = 0x1,
VIR_NETDEV_VPORT_PROFILE_LINK_OP_DISASSOCIATE = 0x2,
VIR_NETDEV_VPORT_PROFILE_LINK_OP_PREASSOCIATE = 0x3,
VIR_NETDEV_VPORT_PROFILE_LINK_OP_PREASSOCIATE_RR = 0x4,
};
......@@ -267,7 +267,7 @@ openMacvtapTap(const char *tgifname,
enum virMacvtapMode mode,
int vnet_hdr,
const unsigned char *vmuuid,
virVirtualPortProfileParamsPtr virtPortProfile,
virNetDevVPortProfilePtr virtPortProfile,
char **res_ifname,
enum virVMOperationType vmOp,
char *stateDir,
......@@ -404,7 +404,7 @@ delMacvtap(const char *ifname,
const unsigned char *macaddr,
const char *linkdev,
int mode,
virVirtualPortProfileParamsPtr virtPortProfile,
virNetDevVPortProfilePtr virtPortProfile,
char *stateDir)
{
if (mode == VIR_MACVTAP_MODE_PASSTHRU) {
......@@ -866,8 +866,8 @@ getPhysdevAndVlan(const char *ifname, int *root_ifindex, char *root_ifname,
static int
doPortProfileOp8021Qbg(const char *ifname,
const unsigned char *macaddr,
const virVirtualPortProfileParamsPtr virtPort,
enum virVirtualPortOp virtPortOp)
const virNetDevVPortProfilePtr virtPort,
enum virNetDevVPortProfileLinkOp virtPortOp)
{
int rc = 0;
......@@ -908,13 +908,13 @@ doPortProfileOp8021Qbg(const char *ifname,
portVsi.vsi_type_id[0] = virtPort->u.virtPort8021Qbg.typeID;
switch (virtPortOp) {
case PREASSOCIATE:
case VIR_NETDEV_VPORT_PROFILE_LINK_OP_PREASSOCIATE:
op = PORT_REQUEST_PREASSOCIATE;
break;
case ASSOCIATE:
case VIR_NETDEV_VPORT_PROFILE_LINK_OP_ASSOCIATE:
op = PORT_REQUEST_ASSOCIATE;
break;
case DISASSOCIATE:
case VIR_NETDEV_VPORT_PROFILE_LINK_OP_DISASSOCIATE:
op = PORT_REQUEST_DISASSOCIATE;
break;
default:
......@@ -983,9 +983,9 @@ err_exit:
static int
doPortProfileOp8021Qbh(const char *ifname,
const unsigned char *macaddr,
const virVirtualPortProfileParamsPtr virtPort,
const virNetDevVPortProfilePtr virtPort,
const unsigned char *vm_uuid,
enum virVirtualPortOp virtPortOp)
enum virNetDevVPortProfileLinkOp virtPortOp)
{
int rc = 0;
......@@ -1018,8 +1018,8 @@ doPortProfileOp8021Qbh(const char *ifname,
goto err_exit;
switch (virtPortOp) {
case PREASSOCIATE_RR:
case ASSOCIATE:
case VIR_NETDEV_VPORT_PROFILE_LINK_OP_PREASSOCIATE_RR:
case VIR_NETDEV_VPORT_PROFILE_LINK_OP_ASSOCIATE:
errno = virGetHostUUID(hostuuid);
if (errno) {
rc = -1;
......@@ -1034,7 +1034,7 @@ doPortProfileOp8021Qbh(const char *ifname,
vm_uuid,
hostuuid,
vf,
(virtPortOp == PREASSOCIATE_RR) ?
(virtPortOp == VIR_NETDEV_VPORT_PROFILE_LINK_OP_PREASSOCIATE_RR) ?
PORT_REQUEST_PREASSOCIATE_RR
: PORT_REQUEST_ASSOCIATE);
if (rc == -2)
......@@ -1050,7 +1050,7 @@ doPortProfileOp8021Qbh(const char *ifname,
PORT_REQUEST_DISASSOCIATE);
break;
case DISASSOCIATE:
case VIR_NETDEV_VPORT_PROFILE_LINK_OP_DISASSOCIATE:
rc = doPortProfileOpCommon(nltarget_kernel, NULL, ifindex,
NULL,
vlanid,
......@@ -1097,7 +1097,7 @@ int
vpAssociatePortProfileId(const char *macvtap_ifname,
const unsigned char *macvtap_macaddr,
const char *linkdev,
const virVirtualPortProfileParamsPtr virtPort,
const virNetDevVPortProfilePtr virtPort,
const unsigned char *vmuuid,
enum virVMOperationType vmOp)
{
......@@ -1112,24 +1112,24 @@ vpAssociatePortProfileId(const char *macvtap_ifname,
return 0;
switch (virtPort->virtPortType) {
case VIR_VIRTUALPORT_NONE:
case VIR_VIRTUALPORT_TYPE_LAST:
case VIR_NETDEV_VPORT_PROFILE_NONE:
case VIR_NETDEV_VPORT_PROFILE_LAST:
break;
case VIR_VIRTUALPORT_8021QBG:
case VIR_NETDEV_VPORT_PROFILE_8021QBG:
rc = doPortProfileOp8021Qbg(macvtap_ifname, macvtap_macaddr,
virtPort,
(vmOp == VIR_VM_OP_MIGRATE_IN_START)
? PREASSOCIATE
: ASSOCIATE);
? VIR_NETDEV_VPORT_PROFILE_LINK_OP_PREASSOCIATE
: VIR_NETDEV_VPORT_PROFILE_LINK_OP_ASSOCIATE);
break;
case VIR_VIRTUALPORT_8021QBH:
case VIR_NETDEV_VPORT_PROFILE_8021QBH:
rc = doPortProfileOp8021Qbh(linkdev, macvtap_macaddr,
virtPort, vmuuid,
(vmOp == VIR_VM_OP_MIGRATE_IN_START)
? PREASSOCIATE_RR
: ASSOCIATE);
? VIR_NETDEV_VPORT_PROFILE_LINK_OP_PREASSOCIATE_RR
: VIR_NETDEV_VPORT_PROFILE_LINK_OP_ASSOCIATE);
if (vmOp != VIR_VM_OP_MIGRATE_IN_START && !rc)
ifaceUp(linkdev);
break;
......@@ -1154,7 +1154,7 @@ int
vpDisassociatePortProfileId(const char *macvtap_ifname,
const unsigned char *macvtap_macaddr,
const char *linkdev,
const virVirtualPortProfileParamsPtr virtPort,
const virNetDevVPortProfilePtr virtPort,
enum virVMOperationType vmOp)
{
int rc = 0;
......@@ -1168,22 +1168,23 @@ vpDisassociatePortProfileId(const char *macvtap_ifname,
return 0;
switch (virtPort->virtPortType) {
case VIR_VIRTUALPORT_NONE:
case VIR_VIRTUALPORT_TYPE_LAST:
case VIR_NETDEV_VPORT_PROFILE_NONE:
case VIR_NETDEV_VPORT_PROFILE_LAST:
break;
case VIR_VIRTUALPORT_8021QBG:
case VIR_NETDEV_VPORT_PROFILE_8021QBG:
rc = doPortProfileOp8021Qbg(macvtap_ifname, macvtap_macaddr,
virtPort, DISASSOCIATE);
virtPort, VIR_NETDEV_VPORT_PROFILE_LINK_OP_DISASSOCIATE);
break;
case VIR_VIRTUALPORT_8021QBH:
case VIR_NETDEV_VPORT_PROFILE_8021QBH:
/* avoid disassociating twice */
if (vmOp == VIR_VM_OP_MIGRATE_IN_FINISH)
break;
ifaceDown(linkdev);
rc = doPortProfileOp8021Qbh(linkdev, macvtap_macaddr,
virtPort, NULL, DISASSOCIATE);
virtPort, NULL,
VIR_NETDEV_VPORT_PROFILE_LINK_OP_DISASSOCIATE);
break;
}
......
......@@ -59,7 +59,7 @@ int openMacvtapTap(const char *ifname,
enum virMacvtapMode mode,
int vnet_hdr,
const unsigned char *vmuuid,
virVirtualPortProfileParamsPtr virtPortProfile,
virNetDevVPortProfilePtr virtPortProfile,
char **res_ifname,
enum virVMOperationType vmop,
char *stateDir,
......@@ -69,20 +69,20 @@ void delMacvtap(const char *ifname,
const unsigned char *macaddress,
const char *linkdev,
int mode,
virVirtualPortProfileParamsPtr virtPortProfile,
virNetDevVPortProfilePtr virtPortProfile,
char *stateDir);
int vpAssociatePortProfileId(const char *macvtap_ifname,
const unsigned char *macvtap_macaddr,
const char *linkdev,
const virVirtualPortProfileParamsPtr virtPort,
const virNetDevVPortProfilePtr virtPort,
const unsigned char *vmuuid,
enum virVMOperationType vmOp);
int vpDisassociatePortProfileId(const char *macvtap_ifname,
const unsigned char *macvtap_macaddr,
const char *linkdev,
const virVirtualPortProfileParamsPtr virtPort,
const virNetDevVPortProfilePtr virtPort,
enum virVMOperationType vmOp);
# endif /* WITH_MACVTAP */
......
......@@ -679,14 +679,14 @@ error:
/* virtualPortProfile utilities */
VIR_ENUM_IMPL(virVirtualPort, VIR_VIRTUALPORT_TYPE_LAST,
VIR_ENUM_IMPL(virNetDevVPort, VIR_NETDEV_VPORT_PROFILE_LAST,
"none",
"802.1Qbg",
"802.1Qbh")
int
virVirtualPortProfileParseXML(xmlNodePtr node,
virVirtualPortProfileParamsPtr *def)
virNetDevVPortProfileParse(xmlNodePtr node,
virNetDevVPortProfilePtr *def)
{
int ret = -1;
char *virtPortType;
......@@ -695,7 +695,7 @@ virVirtualPortProfileParseXML(xmlNodePtr node,
char *virtPortTypeIDVersion = NULL;
char *virtPortInstanceID = NULL;
char *virtPortProfileID = NULL;
virVirtualPortProfileParamsPtr virtPort = NULL;
virNetDevVPortProfilePtr virtPort = NULL;
xmlNodePtr cur = node->children;
if (VIR_ALLOC(virtPort) < 0) {
......@@ -725,11 +725,11 @@ virVirtualPortProfileParseXML(xmlNodePtr node,
cur = cur->next;
}
virtPort->virtPortType = VIR_VIRTUALPORT_NONE;
virtPort->virtPortType = VIR_NETDEV_VPORT_PROFILE_NONE;
switch (virVirtualPortTypeFromString(virtPortType)) {
switch (virNetDevVPortTypeFromString(virtPortType)) {
case VIR_VIRTUALPORT_8021QBG:
case VIR_NETDEV_VPORT_PROFILE_8021QBG:
if (virtPortManagerID != NULL && virtPortTypeID != NULL &&
virtPortTypeIDVersion != NULL) {
unsigned int val;
......@@ -791,7 +791,7 @@ virVirtualPortProfileParseXML(xmlNodePtr node,
}
}
virtPort->virtPortType = VIR_VIRTUALPORT_8021QBG;
virtPort->virtPortType = VIR_NETDEV_VPORT_PROFILE_8021QBG;
} else {
virSocketError(VIR_ERR_XML_ERROR, "%s",
......@@ -800,11 +800,11 @@ virVirtualPortProfileParseXML(xmlNodePtr node,
}
break;
case VIR_VIRTUALPORT_8021QBH:
case VIR_NETDEV_VPORT_PROFILE_8021QBH:
if (virtPortProfileID != NULL) {
if (virStrcpyStatic(virtPort->u.virtPort8021Qbh.profileID,
virtPortProfileID) != NULL) {
virtPort->virtPortType = VIR_VIRTUALPORT_8021QBH;
virtPort->virtPortType = VIR_NETDEV_VPORT_PROFILE_8021QBH;
} else {
virSocketError(VIR_ERR_XML_ERROR, "%s",
_("profileid parameter too long"));
......@@ -819,8 +819,8 @@ virVirtualPortProfileParseXML(xmlNodePtr node,
default:
case VIR_VIRTUALPORT_NONE:
case VIR_VIRTUALPORT_TYPE_LAST:
case VIR_NETDEV_VPORT_PROFILE_NONE:
case VIR_NETDEV_VPORT_PROFILE_LAST:
virSocketError(VIR_ERR_XML_ERROR, "%s",
_("unknown virtualport type"));
goto error;
......@@ -843,7 +843,7 @@ error:
}
bool
virVirtualPortProfileEqual(virVirtualPortProfileParamsPtr a, virVirtualPortProfileParamsPtr b)
virNetDevVPortProfileEqual(virNetDevVPortProfilePtr a, virNetDevVPortProfilePtr b)
{
/* NULL resistant */
if (!a && !b)
......@@ -856,10 +856,10 @@ virVirtualPortProfileEqual(virVirtualPortProfileParamsPtr a, virVirtualPortProfi
return false;
switch (a->virtPortType) {
case VIR_VIRTUALPORT_NONE:
case VIR_NETDEV_VPORT_PROFILE_NONE:
break;
case VIR_VIRTUALPORT_8021QBG:
case VIR_NETDEV_VPORT_PROFILE_8021QBG:
if (a->u.virtPort8021Qbg.managerID != b->u.virtPort8021Qbg.managerID ||
a->u.virtPort8021Qbg.typeID != b->u.virtPort8021Qbg.typeID ||
a->u.virtPort8021Qbg.typeIDVersion != b->u.virtPort8021Qbg.typeIDVersion ||
......@@ -867,7 +867,7 @@ virVirtualPortProfileEqual(virVirtualPortProfileParamsPtr a, virVirtualPortProfi
return false;
break;
case VIR_VIRTUALPORT_8021QBH:
case VIR_NETDEV_VPORT_PROFILE_8021QBH:
if (STRNEQ(a->u.virtPort8021Qbh.profileID, b->u.virtPort8021Qbh.profileID))
return false;
break;
......@@ -880,23 +880,23 @@ virVirtualPortProfileEqual(virVirtualPortProfileParamsPtr a, virVirtualPortProfi
}
void
virVirtualPortProfileFormat(virBufferPtr buf,
virVirtualPortProfileParamsPtr virtPort)
virNetDevVPortProfileFormat(virNetDevVPortProfilePtr virtPort,
virBufferPtr buf)
{
char uuidstr[VIR_UUID_STRING_BUFLEN];
if (!virtPort || virtPort->virtPortType == VIR_VIRTUALPORT_NONE)
if (!virtPort || virtPort->virtPortType == VIR_NETDEV_VPORT_PROFILE_NONE)
return;
virBufferAsprintf(buf, "<virtualport type='%s'>\n",
virVirtualPortTypeToString(virtPort->virtPortType));
virNetDevVPortTypeToString(virtPort->virtPortType));
switch (virtPort->virtPortType) {
case VIR_VIRTUALPORT_NONE:
case VIR_VIRTUALPORT_TYPE_LAST:
case VIR_NETDEV_VPORT_PROFILE_NONE:
case VIR_NETDEV_VPORT_PROFILE_LAST:
break;
case VIR_VIRTUALPORT_8021QBG:
case VIR_NETDEV_VPORT_PROFILE_8021QBG:
virUUIDFormat(virtPort->u.virtPort8021Qbg.instanceID,
uuidstr);
virBufferAsprintf(buf,
......@@ -908,7 +908,7 @@ virVirtualPortProfileFormat(virBufferPtr buf,
uuidstr);
break;
case VIR_VIRTUALPORT_8021QBH:
case VIR_NETDEV_VPORT_PROFILE_8021QBH:
virBufferAsprintf(buf,
" <parameters profileid='%s'/>\n",
virtPort->u.virtPort8021Qbh.profileID);
......
......@@ -114,21 +114,21 @@ int virSocketAddrPrefixToNetmask(unsigned int prefix,
# define LIBVIRT_IFLA_VF_PORT_PROFILE_MAX 40
# endif
enum virVirtualPortType {
VIR_VIRTUALPORT_NONE,
VIR_VIRTUALPORT_8021QBG,
VIR_VIRTUALPORT_8021QBH,
enum virNetDevVPortProfile {
VIR_NETDEV_VPORT_PROFILE_NONE,
VIR_NETDEV_VPORT_PROFILE_8021QBG,
VIR_NETDEV_VPORT_PROFILE_8021QBH,
VIR_VIRTUALPORT_TYPE_LAST,
VIR_NETDEV_VPORT_PROFILE_LAST,
};
VIR_ENUM_DECL(virVirtualPort)
VIR_ENUM_DECL(virNetDevVPort)
/* profile data for macvtap (VEPA) */
typedef struct _virVirtualPortProfileParams virVirtualPortProfileParams;
typedef virVirtualPortProfileParams *virVirtualPortProfileParamsPtr;
struct _virVirtualPortProfileParams {
enum virVirtualPortType virtPortType;
typedef struct _virNetDevVPortProfile virNetDevVPortProfile;
typedef virNetDevVPortProfile *virNetDevVPortProfilePtr;
struct _virNetDevVPortProfile {
enum virNetDevVPortProfile virtPortType;
union {
struct {
uint8_t managerID;
......@@ -143,14 +143,15 @@ struct _virVirtualPortProfileParams {
};
int
virVirtualPortProfileParseXML(xmlNodePtr node,
virVirtualPortProfileParamsPtr *virtPort);
virNetDevVPortProfileParse(xmlNodePtr node,
virNetDevVPortProfilePtr *def);
void
virVirtualPortProfileFormat(virBufferPtr buf,
virVirtualPortProfileParamsPtr virtPort);
virNetDevVPortProfileFormat(virNetDevVPortProfilePtr virtPort,
virBufferPtr buf);
bool virVirtualPortProfileEqual(virVirtualPortProfileParamsPtr a,
virVirtualPortProfileParamsPtr b);
bool virNetDevVPortProfileEqual(virNetDevVPortProfilePtr a,
virNetDevVPortProfilePtr b);
virNetDevBandwidthPtr virNetDevBandwidthParse(xmlNodePtr node)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册