diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 58f4d0f6a196fb30abd830a87cee1b9cf988e240..78bcb05061ff0bca26774f11f4d205cf2a4aeaf0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index a3cb834e5c39aea529b774b37f4d1c7634fcd90b..255d8fd8bbbead10466886b1c35810423a60fe5f 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -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); diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index a70b5a20a1a1164746309da775a09bbd01a04cf8..023eb9ff955df114bc275ab90f2277450a38f0b2 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -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, " \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++) diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h index 2cfbe46f1f4d56145294fa40f9f71bab0af3811d..57ad6377ab286896bd1476f841cc74c3983d0d85 100644 --- a/src/conf/network_conf.h +++ b/src/conf/network_conf.h @@ -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; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index b15a8db92188ee6c2f7deb895d0dc4fa05db3e05..a30db17726f5510b306e936b83fff3f7dcf88932 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -786,9 +786,9 @@ virSocketAddrParseIPv4; virSocketAddrParseIPv6; virSocketAddrPrefixToNetmask; virSocketAddrSetPort; -virVirtualPortProfileEqual; -virVirtualPortProfileFormat; -virVirtualPortProfileParseXML; +virNetDevVPortProfileEqual; +virNetDevVPortProfileFormat; +virNetDevVPortProfileParse; # network_conf.h diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 258f7c76ffd04f580efffe41fe9f11b296e59310..ee1c46a97ec42bb50e74416ef7eeb98fe1e8c30b 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -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; /* 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); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 135bdd17dfa0a144d89ef069d56e7159b87a9f4d..959fa853a464cdc0e15c9c59eef5cb70276429fa 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -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; diff --git a/src/util/macvtap.c b/src/util/macvtap.c index cb13d2b3cb96d7c85c8c932117bff6224a563d67..d4370e682eb0857f87c15ab3734af68fa027deee 100644 --- a/src/util/macvtap.c +++ b/src/util/macvtap.c @@ -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; } diff --git a/src/util/macvtap.h b/src/util/macvtap.h index 330e5e282fe40fc19cb013e68a5a666477c392c6..d685ab9e18f4f4c3782f32fdce75979a994111d8 100644 --- a/src/util/macvtap.h +++ b/src/util/macvtap.h @@ -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 */ diff --git a/src/util/network.c b/src/util/network.c index 1ecbce3b9834474395c58159a982c83d32fbd57a..f7f5d6c461b39def266dcf262f6f97dfcf870fa8 100644 --- a/src/util/network.c +++ b/src/util/network.c @@ -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, "\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, " \n", virtPort->u.virtPort8021Qbh.profileID); diff --git a/src/util/network.h b/src/util/network.h index 1f3a53f5063a10ebf9a2f3fca2aa6957d7589d26..c3ab6231d0e1bb9fc04da14661cf2fa1233b308e 100644 --- a/src/util/network.h +++ b/src/util/network.h @@ -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;