From: "Daniel P. Berrange" <berrange(a)redhat.com>
In preparation for code re-organization, rename the Macvtap
management APIs to have the following patterns
virNetDevMacVLanXXXXX - macvlan/macvtap interface management
virNetDevVPortProfileXXXX - virtual port profile management
* src/util/macvtap.c, src/util/macvtap.h: Rename APIs
* src/conf/domain_conf.c, src/network/bridge_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_command.h,
src/qemu/qemu_driver.c, src/qemu/qemu_hotplug.c,
src/qemu/qemu_migration.c, src/qemu/qemu_process.c,
src/qemu/qemu_process.h: Update for renamed APIs
---
src/conf/domain_conf.c | 10 +-
src/libvirt_private.syms | 4 +-
src/network/bridge_driver.c | 8 +-
src/qemu/qemu_command.c | 30 ++--
src/qemu/qemu_command.h | 4 +-
src/qemu/qemu_driver.c | 12 +-
src/qemu/qemu_hotplug.c | 12 +-
src/qemu/qemu_migration.c | 24 ++--
src/qemu/qemu_process.c | 12 +-
src/qemu/qemu_process.h | 2 +-
src/util/macvtap.c | 386 ++++++++++++++++++++++---------------------
src/util/macvtap.h | 100 ++++++-----
tests/qemuxml2argvtest.c | 2 +-
tests/qemuxmlnstest.c | 2 +-
14 files changed, 312 insertions(+), 296 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b3c3339..f6d2892 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3102,7 +3102,7 @@ virDomainActualNetDefParseXML(xmlNodePtr node,
mode = virXPathString("string(./source[1]/@mode)", ctxt);
if (mode) {
int m;
- if ((m = virMacvtapModeTypeFromString(mode)) < 0) {
+ if ((m = virNetDevMacVLanModeTypeFromString(mode)) < 0) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("Unkown mode '%s' in interface
<actual> element"),
mode);
@@ -3416,14 +3416,14 @@ virDomainNetDefParseXML(virCapsPtr caps,
if (mode != NULL) {
int m;
- if ((m = virMacvtapModeTypeFromString(mode)) < 0) {
+ if ((m = virNetDevMacVLanModeTypeFromString(mode)) < 0) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unkown mode has been specified"));
goto error;
}
def->data.direct.mode = m;
} else
- def->data.direct.mode = VIR_MACVTAP_MODE_VEPA;
+ def->data.direct.mode = VIR_NETDEV_MACVLAN_MODE_VEPA;
def->data.direct.virtPortProfile = virtPort;
virtPort = NULL;
@@ -9712,7 +9712,7 @@ virDomainActualNetDefFormat(virBufferPtr buf,
virBufferEscapeString(buf, " dev='%s'",
def->data.direct.linkdev);
- mode = virMacvtapModeTypeToString(def->data.direct.mode);
+ mode = virNetDevMacVLanModeTypeToString(def->data.direct.mode);
if (!mode) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected source mode %d"),
@@ -9817,7 +9817,7 @@ virDomainNetDefFormat(virBufferPtr buf,
virBufferEscapeString(buf, " <source dev='%s'",
def->data.direct.linkdev);
virBufferAsprintf(buf, " mode='%s'",
- virMacvtapModeTypeToString(def->data.direct.mode));
+ virNetDevMacVLanModeTypeToString(def->data.direct.mode));
virBufferAddLit(buf, "/>\n");
virBufferAdjustIndent(buf, 6);
if (virNetDevVPortProfileFormat(def->data.direct.virtPortProfile, buf) <
0)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 52d2076..85f4064 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -739,8 +739,8 @@ virLogUnlock;
# macvtap.h
-virVMOperationTypeFromString;
-virVMOperationTypeToString;
+virNetDevVPortProfileOpTypeFromString;
+virNetDevVPortProfileOpTypeToString;
# memory.h
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index e68712f..bad5337 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -2780,16 +2780,16 @@ networkAllocateActualDevice(virDomainNetDefPtr iface)
iface->data.network.actual->type = VIR_DOMAIN_NET_TYPE_DIRECT;
switch (netdef->forwardType) {
case VIR_NETWORK_FORWARD_BRIDGE:
- iface->data.network.actual->data.direct.mode =
VIR_MACVTAP_MODE_BRIDGE;
+ iface->data.network.actual->data.direct.mode =
VIR_NETDEV_MACVLAN_MODE_BRIDGE;
break;
case VIR_NETWORK_FORWARD_PRIVATE:
- iface->data.network.actual->data.direct.mode =
VIR_MACVTAP_MODE_PRIVATE;
+ iface->data.network.actual->data.direct.mode =
VIR_NETDEV_MACVLAN_MODE_PRIVATE;
break;
case VIR_NETWORK_FORWARD_VEPA:
- iface->data.network.actual->data.direct.mode = VIR_MACVTAP_MODE_VEPA;
+ iface->data.network.actual->data.direct.mode =
VIR_NETDEV_MACVLAN_MODE_VEPA;
break;
case VIR_NETWORK_FORWARD_PASSTHROUGH:
- iface->data.network.actual->data.direct.mode =
VIR_MACVTAP_MODE_PASSTHRU;
+ iface->data.network.actual->data.direct.mode =
VIR_NETDEV_MACVLAN_MODE_PASSTHRU;
break;
}
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 11ebb69..6d19f95 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -139,7 +139,7 @@ qemuPhysIfaceConnect(virDomainDefPtr def,
struct qemud_driver *driver,
virDomainNetDefPtr net,
virBitmapPtr qemuCaps,
- enum virVMOperationType vmop)
+ enum virNetDevVPortProfileOp vmop)
{
int rc;
#if WITH_MACVTAP
@@ -151,14 +151,14 @@ qemuPhysIfaceConnect(virDomainDefPtr def,
net->model && STREQ(net->model, "virtio"))
vnet_hdr = 1;
- rc = openMacvtapTap(net->ifname, net->mac,
- virDomainNetGetActualDirectDev(net),
- virDomainNetGetActualDirectMode(net),
- vnet_hdr, def->uuid,
- virDomainNetGetActualDirectVirtPortProfile(net),
- &res_ifname,
- vmop, driver->stateDir,
- virDomainNetGetActualBandwidth(net));
+ rc = virNetDevMacVLanCreate(net->ifname, net->mac,
+ virDomainNetGetActualDirectDev(net),
+ virDomainNetGetActualDirectMode(net),
+ vnet_hdr, def->uuid,
+ virDomainNetGetActualDirectVirtPortProfile(net),
+ &res_ifname,
+ vmop, driver->stateDir,
+ virDomainNetGetActualBandwidth(net));
if (rc >= 0) {
virDomainAuditNetDevice(def, net, res_ifname, true);
VIR_FREE(net->ifname);
@@ -178,11 +178,11 @@ qemuPhysIfaceConnect(virDomainDefPtr def,
err = virDomainConfNWFilterInstantiate(conn, net);
if (err) {
VIR_FORCE_CLOSE(rc);
- delMacvtap(net->ifname, net->mac,
- virDomainNetGetActualDirectDev(net),
- virDomainNetGetActualDirectMode(net),
- virDomainNetGetActualDirectVirtPortProfile(net),
- driver->stateDir);
+ ignore_value(virNetDevMacVLanDelete(net->ifname, net->mac,
+ virDomainNetGetActualDirectDev(net),
+
virDomainNetGetActualDirectMode(net),
+
virDomainNetGetActualDirectVirtPortProfile(net),
+ driver->stateDir));
VIR_FREE(net->ifname);
}
}
@@ -3258,7 +3258,7 @@ qemuBuildCommandLine(virConnectPtr conn,
const char *migrateFrom,
int migrateFd,
virDomainSnapshotObjPtr snapshot,
- enum virVMOperationType vmop)
+ enum virNetDevVPortProfileOp vmop)
{
int i;
struct utsname ut;
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 76e67b2..e10e278 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -50,7 +50,7 @@ virCommandPtr qemuBuildCommandLine(virConnectPtr conn,
const char *migrateFrom,
int migrateFd,
virDomainSnapshotObjPtr current_snapshot,
- enum virVMOperationType vmop)
+ enum virNetDevVPortProfileOp vmop)
ATTRIBUTE_NONNULL(1);
/* With vlan == -1, use netdev syntax, else old hostnet */
@@ -136,7 +136,7 @@ int qemuPhysIfaceConnect(virDomainDefPtr def,
struct qemud_driver *driver,
virDomainNetDefPtr net,
virBitmapPtr qemuCaps,
- enum virVMOperationType vmop);
+ enum virNetDevVPortProfileOp vmop);
int qemuOpenVhostNet(virDomainDefPtr def,
virDomainNetDefPtr net,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 628dac1..465640f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1324,7 +1324,7 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char
*xml,
if (qemuProcessStart(conn, driver, vm, NULL,
(flags & VIR_DOMAIN_START_PAUSED) != 0,
(flags & VIR_DOMAIN_START_AUTODESTROY) != 0,
- -1, NULL, NULL, VIR_VM_OP_CREATE) < 0) {
+ -1, NULL, NULL, VIR_NETDEV_VPORT_PROFILE_OP_CREATE) < 0) {
virDomainAuditStart(vm, "booted", false);
if (qemuDomainObjEndJob(driver, vm) > 0)
qemuDomainRemoveInactive(driver, vm);
@@ -4098,7 +4098,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
/* Set the migration source and start it up. */
ret = qemuProcessStart(conn, driver, vm, "stdio", true,
- false, *fd, path, NULL, VIR_VM_OP_RESTORE);
+ false, *fd, path, NULL, VIR_NETDEV_VPORT_PROFILE_OP_RESTORE);
if (intermediatefd != -1) {
if (ret < 0) {
@@ -4618,7 +4618,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
if (!(cmd = qemuBuildCommandLine(conn, driver, def,
&monConfig, monitor_json, qemuCaps,
- NULL, -1, NULL, VIR_VM_OP_NO_OP)))
+ NULL, -1, NULL,
VIR_NETDEV_VPORT_PROFILE_OP_NO_OP)))
goto cleanup;
ret = virCommandToString(cmd);
@@ -4700,7 +4700,7 @@ qemuDomainObjStart(virConnectPtr conn,
}
ret = qemuProcessStart(conn, driver, vm, NULL, start_paused,
- autodestroy, -1, NULL, NULL, VIR_VM_OP_CREATE);
+ autodestroy, -1, NULL, NULL,
VIR_NETDEV_VPORT_PROFILE_OP_CREATE);
virDomainAuditStart(vm, "booted", ret >= 0);
if (ret >= 0) {
virDomainEventPtr event =
@@ -10036,7 +10036,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr
snapshot,
rc = qemuProcessStart(snapshot->domain->conn, driver, vm, NULL,
true, false, -1, NULL, snap,
- VIR_VM_OP_CREATE);
+ VIR_NETDEV_VPORT_PROFILE_OP_CREATE);
virDomainAuditStart(vm, "from-snapshot", rc >= 0);
detail = VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT;
event = virDomainEventNewFromObj(vm,
@@ -10126,7 +10126,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr
snapshot,
qemuDomainEventQueue(driver, event);
rc = qemuProcessStart(snapshot->domain->conn, driver, vm, NULL,
paused, false, -1, NULL, NULL,
- VIR_VM_OP_CREATE);
+ VIR_NETDEV_VPORT_PROFILE_OP_CREATE);
virDomainAuditStart(vm, "from-snapshot", rc >= 0);
if (rc < 0) {
if (!vm->persistent) {
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index ab26e57..a9d9a32 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -678,7 +678,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
} else if (actualType == VIR_DOMAIN_NET_TYPE_DIRECT) {
if ((tapfd = qemuPhysIfaceConnect(vm->def, conn, driver, net,
priv->qemuCaps,
- VIR_VM_OP_CREATE)) < 0)
+ VIR_NETDEV_VPORT_PROFILE_OP_CREATE)) < 0)
goto cleanup;
iface_connected = true;
if (qemuOpenVhostNet(vm->def, net, priv->qemuCaps, &vhostfd) < 0)
@@ -1911,11 +1911,11 @@ int qemuDomainDetachNetDevice(struct qemud_driver *driver,
#if WITH_MACVTAP
if (virDomainNetGetActualType(detach) == VIR_DOMAIN_NET_TYPE_DIRECT) {
- delMacvtap(detach->ifname, detach->mac,
- virDomainNetGetActualDirectDev(detach),
- virDomainNetGetActualDirectMode(detach),
- virDomainNetGetActualDirectVirtPortProfile(detach),
- driver->stateDir);
+ ignore_value(virNetDevMacVLanDelete(detach->ifname, detach->mac,
+ virDomainNetGetActualDirectDev(detach),
+ virDomainNetGetActualDirectMode(detach),
+
virDomainNetGetActualDirectVirtPortProfile(detach),
+ driver->stateDir));
VIR_FREE(detach->ifname);
}
#endif
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 838a31f..fbff29b 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1147,7 +1147,7 @@ qemuMigrationPrepareAny(struct qemud_driver *driver,
*/
if (qemuProcessStart(dconn, driver, vm, migrateFrom, true,
true, dataFD[0], NULL, NULL,
- VIR_VM_OP_MIGRATE_IN_START) < 0) {
+ VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START) < 0) {
virDomainAuditStart(vm, "migrated", false);
/* Note that we don't set an error here because qemuProcessStart
* should have already done that.
@@ -2522,12 +2522,12 @@ qemuMigrationVPAssociatePortProfiles(virDomainDefPtr def) {
for (i = 0; i < def->nnets; i++) {
net = def->nets[i];
if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_DIRECT) {
- if (vpAssociatePortProfileId(net->ifname,
- net->mac,
- virDomainNetGetActualDirectDev(net),
-
virDomainNetGetActualDirectVirtPortProfile(net),
- def->uuid,
- VIR_VM_OP_MIGRATE_IN_FINISH) < 0)
+ if (virNetDevVPortProfileAssociate(net->ifname,
+
virDomainNetGetActualDirectVirtPortProfile(net),
+ net->mac,
+ virDomainNetGetActualDirectDev(net),
+ def->uuid,
+
VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_FINISH) < 0)
goto err_exit;
}
last_good_net = i;
@@ -2539,11 +2539,11 @@ err_exit:
for (i = 0; i < last_good_net; i++) {
net = def->nets[i];
if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_DIRECT) {
- vpDisassociatePortProfileId(net->ifname,
- net->mac,
- virDomainNetGetActualDirectDev(net),
- virDomainNetGetActualDirectVirtPortProfile(net),
- VIR_VM_OP_MIGRATE_IN_FINISH);
+ ignore_value(virNetDevVPortProfileDisassociate(net->ifname,
+
virDomainNetGetActualDirectVirtPortProfile(net),
+ net->mac,
+
virDomainNetGetActualDirectDev(net),
+
VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_FINISH));
}
}
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 2882ef8..4dc9357 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2816,7 +2816,7 @@ int qemuProcessStart(virConnectPtr conn,
int stdin_fd,
const char *stdin_path,
virDomainSnapshotObjPtr snapshot,
- enum virVMOperationType vmop)
+ enum virNetDevVPortProfileOp vmop)
{
int ret;
off_t pos = -1;
@@ -3412,11 +3412,11 @@ void qemuProcessStop(struct qemud_driver *driver,
virDomainNetDefPtr net = def->nets[i];
#if WITH_MACVTAP
if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_DIRECT) {
- delMacvtap(net->ifname, net->mac,
- virDomainNetGetActualDirectDev(net),
- virDomainNetGetActualDirectMode(net),
- virDomainNetGetActualDirectVirtPortProfile(net),
- driver->stateDir);
+ ignore_value(virNetDevMacVLanDelete(net->ifname, net->mac,
+ virDomainNetGetActualDirectDev(net),
+ virDomainNetGetActualDirectMode(net),
+
virDomainNetGetActualDirectVirtPortProfile(net),
+ driver->stateDir));
VIR_FREE(net->ifname);
}
#endif
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
index ef422c4..062d79e 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -53,7 +53,7 @@ int qemuProcessStart(virConnectPtr conn,
int stdin_fd,
const char *stdin_path,
virDomainSnapshotObjPtr snapshot,
- enum virVMOperationType vmop);
+ enum virNetDevVPortProfileOp vmop);
void qemuProcessStop(struct qemud_driver *driver,
virDomainObjPtr vm,
diff --git a/src/util/macvtap.c b/src/util/macvtap.c
index bd3c33c..79bdcaa 100644
--- a/src/util/macvtap.c
+++ b/src/util/macvtap.c
@@ -52,7 +52,7 @@
#include "macvtap.h"
#include "virnetdev.h"
-VIR_ENUM_IMPL(virMacvtapMode, VIR_MACVTAP_MODE_LAST,
+VIR_ENUM_IMPL(virNetDevMacVLanMode, VIR_NETDEV_MACVLAN_MODE_LAST,
"vepa",
"private",
"bridge",
@@ -101,15 +101,17 @@ enum virNetDevVPortOp {
# if WITH_MACVTAP
-/* Open the macvtap's tap device.
+/**
+ * virNetDevMacVLanTapOpen:
+ * Open the macvtap's tap device.
* @ifname: Name of the macvtap interface
* @retries : Number of retries in case udev for example may need to be
* waited for to create the tap chardev
* Returns negative value in case of error, the file descriptor otherwise.
*/
static
-int openTap(const char *ifname,
- int retries)
+int virNetDevMacVLanTapOpen(const char *ifname,
+ int retries)
{
FILE *file;
char path[64];
@@ -173,7 +175,7 @@ int openTap(const char *ifname,
/**
- * configMacvtapTap:
+ * virNetDevMacVLanTapSetup:
* @tapfd: file descriptor of the macvtap tap
* @vnet_hdr: 1 to enable IFF_VNET_HDR, 0 to disable it
*
@@ -187,7 +189,7 @@ int openTap(const char *ifname,
* macvtap device should not be used.
*/
static int
-configMacvtapTap(int tapfd, int vnet_hdr)
+virNetDevMacVLanTapSetup(int tapfd, int vnet_hdr)
{
unsigned int features;
struct ifreq ifreq;
@@ -233,15 +235,15 @@ configMacvtapTap(int tapfd, int vnet_hdr)
}
-static const uint32_t modeMap[VIR_MACVTAP_MODE_LAST] = {
- [VIR_MACVTAP_MODE_VEPA] = MACVLAN_MODE_VEPA,
- [VIR_MACVTAP_MODE_PRIVATE] = MACVLAN_MODE_PRIVATE,
- [VIR_MACVTAP_MODE_BRIDGE] = MACVLAN_MODE_BRIDGE,
- [VIR_MACVTAP_MODE_PASSTHRU] = MACVLAN_MODE_PASSTHRU,
+static const uint32_t modeMap[VIR_NETDEV_MACVLAN_MODE_LAST] = {
+ [VIR_NETDEV_MACVLAN_MODE_VEPA] = MACVLAN_MODE_VEPA,
+ [VIR_NETDEV_MACVLAN_MODE_PRIVATE] = MACVLAN_MODE_PRIVATE,
+ [VIR_NETDEV_MACVLAN_MODE_BRIDGE] = MACVLAN_MODE_BRIDGE,
+ [VIR_NETDEV_MACVLAN_MODE_PASSTHRU] = MACVLAN_MODE_PASSTHRU,
};
/**
- * openMacvtapTap:
+ * virNetDevMacVLanCreate:
* Create an instance of a macvtap device and open its tap character
* device.
* @tgifname: Interface name that the macvtap is supposed to have. May
@@ -260,18 +262,17 @@ static const uint32_t modeMap[VIR_MACVTAP_MODE_LAST] = {
* negative value otherwise with error reported.
*
*/
-int
-openMacvtapTap(const char *tgifname,
- const unsigned char *macaddress,
- const char *linkdev,
- enum virMacvtapMode mode,
- int vnet_hdr,
- const unsigned char *vmuuid,
- virNetDevVPortProfilePtr virtPortProfile,
- char **res_ifname,
- enum virVMOperationType vmOp,
- char *stateDir,
- virNetDevBandwidthPtr bandwidth)
+int virNetDevMacVLanCreate(const char *tgifname,
+ const unsigned char *macaddress,
+ const char *linkdev,
+ enum virNetDevMacVLanMode mode,
+ int vnet_hdr,
+ const unsigned char *vmuuid,
+ virNetDevVPortProfilePtr virtPortProfile,
+ char **res_ifname,
+ enum virNetDevVPortProfileOp vmOp,
+ char *stateDir,
+ virNetDevBandwidthPtr bandwidth)
{
const char *type = "macvtap";
int c, rc;
@@ -285,7 +286,7 @@ openMacvtapTap(const char *tgifname,
*res_ifname = NULL;
- VIR_DEBUG("%s: VM OPERATION: %s", __FUNCTION__,
virVMOperationTypeToString(vmOp));
+ VIR_DEBUG("%s: VM OPERATION: %s", __FUNCTION__,
virNetDevVPortProfileOpTypeToString(vmOp));
/** Note: When using PASSTHROUGH mode with MACVTAP devices the link
* device's MAC address must be set to the VMs MAC address. In
@@ -294,7 +295,7 @@ openMacvtapTap(const char *tgifname,
* This is especially important when using SRIOV capable cards that
* emulate their switch in firmware.
*/
- if (mode == VIR_MACVTAP_MODE_PASSTHRU) {
+ if (mode == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) {
if (ifaceReplaceMacAddress(macaddress, linkdev, stateDir) < 0) {
return -1;
}
@@ -334,11 +335,11 @@ create_name:
cr_ifname = ifname;
}
- if (vpAssociatePortProfileId(cr_ifname,
- macaddress,
- linkdev,
- virtPortProfile,
- vmuuid, vmOp) < 0) {
+ if (virNetDevVPortProfileAssociate(cr_ifname,
+ virtPortProfile,
+ macaddress,
+ linkdev,
+ vmuuid, vmOp) < 0) {
rc = -1;
goto link_del_exit;
}
@@ -348,9 +349,9 @@ create_name:
goto disassociate_exit;
}
- rc = openTap(cr_ifname, 10);
+ rc = virNetDevMacVLanTapOpen(cr_ifname, 10);
if (rc >= 0) {
- if (configMacvtapTap(rc, vnet_hdr) < 0) {
+ if (virNetDevMacVLanTapSetup(rc, vnet_hdr) < 0) {
VIR_FORCE_CLOSE(rc); /* sets rc to -1 */
goto disassociate_exit;
}
@@ -370,11 +371,11 @@ create_name:
return rc;
disassociate_exit:
- vpDisassociatePortProfileId(cr_ifname,
- macaddress,
- linkdev,
- virtPortProfile,
- vmOp);
+ ignore_value(virNetDevVPortProfileDisassociate(cr_ifname,
+ virtPortProfile,
+ macaddress,
+ linkdev,
+ vmOp));
link_del_exit:
ifaceLinkDel(cr_ifname);
@@ -393,25 +394,29 @@ link_del_exit:
* it with the switch if port profile parameters
* were provided.
*/
-void
-delMacvtap(const char *ifname,
- const unsigned char *macaddr,
- const char *linkdev,
- int mode,
- virNetDevVPortProfilePtr virtPortProfile,
- char *stateDir)
+int virNetDevMacVLanDelete(const char *ifname,
+ const unsigned char *macaddr,
+ const char *linkdev,
+ int mode,
+ virNetDevVPortProfilePtr virtPortProfile,
+ char *stateDir)
{
- if (mode == VIR_MACVTAP_MODE_PASSTHRU) {
+ int ret = 0;
+ if (mode == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) {
ifaceRestoreMacAddress(linkdev, stateDir);
}
if (ifname) {
- vpDisassociatePortProfileId(ifname, macaddr,
- linkdev,
- virtPortProfile,
- VIR_VM_OP_DESTROY);
- ifaceLinkDel(ifname);
+ if (virNetDevVPortProfileDisassociate(ifname,
+ virtPortProfile,
+ macaddr,
+ linkdev,
+ VIR_NETDEV_VPORT_PROFILE_OP_DESTROY) <
0)
+ ret = -1;
+ if (ifaceLinkDel(ifname) < 0)
+ ret = -1;
}
+ return ret;
}
# endif /* WITH_MACVTAP */
@@ -425,7 +430,7 @@ static struct nla_policy ifla_port_policy[IFLA_PORT_MAX + 1] =
static uint32_t
-getLldpadPid(void) {
+virNetDevVPortProfileGetLldpadPid(void) {
int fd;
uint32_t pid = 0;
@@ -458,7 +463,7 @@ getLldpadPid(void) {
/**
- * getPortProfileStatus
+ * virNetDevVPortProfileGetStatus:
*
* tb: top level netlink response attributes + values
* vf: The virtual function used in the request
@@ -470,11 +475,11 @@ getLldpadPid(void) {
* case of success, < 0 otherwise with error having been reported
*/
static int
-getPortProfileStatus(struct nlattr **tb, int32_t vf,
- const unsigned char *instanceId,
- bool nltarget_kernel,
- bool is8021Qbg,
- uint16_t *status)
+virNetDevVPortProfileGetStatus(struct nlattr **tb, int32_t vf,
+ const unsigned char *instanceId,
+ bool nltarget_kernel,
+ bool is8021Qbg,
+ uint16_t *status)
{
int rc = -1;
const char *msg = NULL;
@@ -557,16 +562,16 @@ err_exit:
static int
-doPortProfileOpSetLink(bool nltarget_kernel,
- const char *ifname, int ifindex,
- const unsigned char *macaddr,
- int vlanid,
- const char *profileId,
- struct ifla_port_vsi *portVsi,
- const unsigned char *instanceId,
- const unsigned char *hostUUID,
- int32_t vf,
- uint8_t op)
+virNetDevVPortProfileOpSetLink(const char *ifname, int ifindex,
+ bool nltarget_kernel,
+ const unsigned char *macaddr,
+ int vlanid,
+ const char *profileId,
+ struct ifla_port_vsi *portVsi,
+ const unsigned char *instanceId,
+ const unsigned char *hostUUID,
+ int32_t vf,
+ uint8_t op)
{
int rc = -1;
struct nlmsghdr *resp;
@@ -685,7 +690,7 @@ doPortProfileOpSetLink(bool nltarget_kernel,
}
if (!nltarget_kernel) {
- pid = getLldpadPid();
+ pid = virNetDevVPortProfileGetLldpadPid();
if (pid == 0)
goto err_exit;
}
@@ -747,16 +752,16 @@ buffer_too_small:
/* Returns 0 on success, -1 on general failure, and -2 on timeout */
static int
-doPortProfileOpCommon(bool nltarget_kernel,
- const char *ifname, int ifindex,
- const unsigned char *macaddr,
- int vlanid,
- const char *profileId,
- struct ifla_port_vsi *portVsi,
- const unsigned char *instanceId,
- const unsigned char *hostUUID,
- int32_t vf,
- uint8_t op)
+virNetDevVPortProfileOpCommon(const char *ifname, int ifindex,
+ bool nltarget_kernel,
+ const unsigned char *macaddr,
+ int vlanid,
+ const char *profileId,
+ struct ifla_port_vsi *portVsi,
+ const unsigned char *instanceId,
+ const unsigned char *hostUUID,
+ int32_t vf,
+ uint8_t op)
{
int rc;
unsigned char *recvbuf = NULL;
@@ -765,16 +770,16 @@ doPortProfileOpCommon(bool nltarget_kernel,
uint16_t status = 0;
bool is8021Qbg = (profileId == NULL);
- rc = doPortProfileOpSetLink(nltarget_kernel,
- ifname, ifindex,
- macaddr,
- vlanid,
- profileId,
- portVsi,
- instanceId,
- hostUUID,
- vf,
- op);
+ rc = virNetDevVPortProfileOpSetLink(ifname, ifindex,
+ nltarget_kernel,
+ macaddr,
+ vlanid,
+ profileId,
+ portVsi,
+ instanceId,
+ hostUUID,
+ vf,
+ op);
if (rc < 0) {
macvtapError(VIR_ERR_INTERNAL_ERROR, "%s",
_("sending of PortProfileRequest failed."));
@@ -783,12 +788,12 @@ doPortProfileOpCommon(bool nltarget_kernel,
while (--repeats >= 0) {
rc = ifaceMacvtapLinkDump(nltarget_kernel, NULL, ifindex, tb,
- &recvbuf, getLldpadPid);
+ &recvbuf, virNetDevVPortProfileGetLldpadPid);
if (rc < 0)
goto err_exit;
- rc = getPortProfileStatus(tb, vf, instanceId, nltarget_kernel,
- is8021Qbg, &status);
+ rc = virNetDevVPortProfileGetStatus(tb, vf, instanceId, nltarget_kernel,
+ is8021Qbg, &status);
if (rc < 0)
goto err_exit;
if (status == PORT_PROFILE_RESPONSE_SUCCESS ||
@@ -828,8 +833,8 @@ err_exit:
# ifdef IFLA_VF_PORT_MAX
static int
-getPhysdevAndVlan(const char *ifname, int *root_ifindex, char *root_ifname,
- int *vlanid)
+virNetDevVPortProfileGetPhysdevAndVlan(const char *ifname, int *root_ifindex, char
*root_ifname,
+ int *vlanid)
{
int ret;
unsigned int nth;
@@ -858,10 +863,10 @@ getPhysdevAndVlan(const char *ifname, int *root_ifindex, char
*root_ifname,
/* Returns 0 on success, -1 on general failure, and -2 on timeout */
static int
-doPortProfileOp8021Qbg(const char *ifname,
- const unsigned char *macaddr,
- const virNetDevVPortProfilePtr virtPort,
- enum virNetDevVPortOp virtPortOp)
+virNetDevVPortProfileOp8021Qbg(const char *ifname,
+ const unsigned char *macaddr,
+ const virNetDevVPortProfilePtr virtPort,
+ enum virNetDevVPortOp virtPortOp)
{
int rc = 0;
@@ -888,8 +893,8 @@ doPortProfileOp8021Qbg(const char *ifname,
char physdev_ifname[IFNAMSIZ] = { 0, };
int vf = PORT_SELF_VF;
- if (getPhysdevAndVlan(ifname, &physdev_ifindex, physdev_ifname,
- &vlanid) < 0) {
+ if (virNetDevVPortProfileGetPhysdevAndVlan(ifname, &physdev_ifindex,
physdev_ifname,
+ &vlanid) < 0) {
rc = -1;
goto err_exit;
}
@@ -918,16 +923,16 @@ doPortProfileOp8021Qbg(const char *ifname,
goto err_exit;
}
- rc = doPortProfileOpCommon(nltarget_kernel,
- physdev_ifname, physdev_ifindex,
- macaddr,
- vlanid,
- NULL,
- &portVsi,
- virtPort->u.virtPort8021Qbg.instanceID,
- NULL,
- vf,
- op);
+ rc = virNetDevVPortProfileOpCommon(physdev_ifname, physdev_ifindex,
+ nltarget_kernel,
+ macaddr,
+ vlanid,
+ NULL,
+ &portVsi,
+ virtPort->u.virtPort8021Qbg.instanceID,
+ NULL,
+ vf,
+ op);
err_exit:
@@ -939,9 +944,9 @@ err_exit:
# ifdef IFLA_VF_PORT_MAX
static int
-getPhysfnDev(const char *linkdev,
- int32_t *vf,
- char **physfndev)
+virNetDevVPortProfileGetPhysfnDev(const char *linkdev,
+ int32_t *vf,
+ char **physfndev)
{
int rc = -1;
@@ -975,11 +980,11 @@ err_exit:
/* Returns 0 on success, -1 on general failure, and -2 on timeout */
static int
-doPortProfileOp8021Qbh(const char *ifname,
- const unsigned char *macaddr,
- const virNetDevVPortProfilePtr virtPort,
- const unsigned char *vm_uuid,
- enum virNetDevVPortOp virtPortOp)
+virNetDevVPortProfileOp8021Qbh(const char *ifname,
+ const unsigned char *macaddr,
+ const virNetDevVPortProfilePtr virtPort,
+ const unsigned char *vm_uuid,
+ enum virNetDevVPortOp virtPortOp)
{
int rc = 0;
@@ -1003,7 +1008,7 @@ doPortProfileOp8021Qbh(const char *ifname,
int ifindex;
int vlanid = -1;
- rc = getPhysfnDev(ifname, &vf, &physfndev);
+ rc = virNetDevVPortProfileGetPhysfnDev(ifname, &vf, &physfndev);
if (rc < 0)
goto err_exit;
@@ -1020,40 +1025,43 @@ doPortProfileOp8021Qbh(const char *ifname,
goto err_exit;
}
- rc = doPortProfileOpCommon(nltarget_kernel, NULL, ifindex,
- macaddr,
- vlanid,
- virtPort->u.virtPort8021Qbh.profileID,
- NULL,
- vm_uuid,
- hostuuid,
- vf,
- (virtPortOp == PREASSOCIATE_RR) ?
- PORT_REQUEST_PREASSOCIATE_RR
- : PORT_REQUEST_ASSOCIATE);
+ rc = virNetDevVPortProfileOpCommon(NULL, ifindex,
+ nltarget_kernel,
+ macaddr,
+ vlanid,
+ virtPort->u.virtPort8021Qbh.profileID,
+ NULL,
+ vm_uuid,
+ hostuuid,
+ vf,
+ (virtPortOp == PREASSOCIATE_RR) ?
+ PORT_REQUEST_PREASSOCIATE_RR
+ : PORT_REQUEST_ASSOCIATE);
if (rc == -2)
/* Association timed out, disassociate */
- doPortProfileOpCommon(nltarget_kernel, NULL, ifindex,
- NULL,
- vlanid,
- NULL,
- NULL,
- NULL,
- NULL,
- vf,
- PORT_REQUEST_DISASSOCIATE);
+ virNetDevVPortProfileOpCommon(NULL, ifindex,
+ nltarget_kernel,
+ NULL,
+ vlanid,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ vf,
+ PORT_REQUEST_DISASSOCIATE);
break;
case DISASSOCIATE:
- rc = doPortProfileOpCommon(nltarget_kernel, NULL, ifindex,
- NULL,
- vlanid,
- NULL,
- NULL,
- NULL,
- NULL,
- vf,
- PORT_REQUEST_DISASSOCIATE);
+ rc = virNetDevVPortProfileOpCommon(NULL, ifindex,
+ nltarget_kernel,
+ NULL,
+ vlanid,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ vf,
+ PORT_REQUEST_DISASSOCIATE);
break;
default:
@@ -1071,7 +1079,7 @@ err_exit:
}
/**
- * vpAssociatePortProfile
+ * virNetDevVPortProfileAssociate:
*
* @macvtap_ifname: The name of the macvtap device
* @virtPort: pointer to the object holding port profile parameters
@@ -1088,21 +1096,21 @@ err_exit:
* having been reported.
*/
int
-vpAssociatePortProfileId(const char *macvtap_ifname,
- const unsigned char *macvtap_macaddr,
- const char *linkdev,
- const virNetDevVPortProfilePtr virtPort,
- const unsigned char *vmuuid,
- enum virVMOperationType vmOp)
+virNetDevVPortProfileAssociate(const char *macvtap_ifname,
+ const virNetDevVPortProfilePtr virtPort,
+ const unsigned char *macvtap_macaddr,
+ const char *linkdev,
+ const unsigned char *vmuuid,
+ enum virNetDevVPortProfileOp vmOp)
{
int rc = 0;
VIR_DEBUG("Associating port profile '%p' on link device
'%s'",
virtPort, macvtap_ifname);
- VIR_DEBUG("%s: VM OPERATION: %s", __FUNCTION__,
virVMOperationTypeToString(vmOp));
+ VIR_DEBUG("%s: VM OPERATION: %s", __FUNCTION__,
virNetDevVPortProfileOpTypeToString(vmOp));
- if (!virtPort || vmOp == VIR_VM_OP_NO_OP)
+ if (!virtPort || vmOp == VIR_NETDEV_VPORT_PROFILE_OP_NO_OP)
return 0;
switch (virtPort->virtPortType) {
@@ -1111,20 +1119,20 @@ vpAssociatePortProfileId(const char *macvtap_ifname,
break;
case VIR_NETDEV_VPORT_PROFILE_8021QBG:
- rc = doPortProfileOp8021Qbg(macvtap_ifname, macvtap_macaddr,
- virtPort,
- (vmOp == VIR_VM_OP_MIGRATE_IN_START)
- ? PREASSOCIATE
- : ASSOCIATE);
+ rc = virNetDevVPortProfileOp8021Qbg(macvtap_ifname, macvtap_macaddr,
+ virtPort,
+ (vmOp ==
VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START)
+ ? PREASSOCIATE
+ : ASSOCIATE);
break;
case VIR_NETDEV_VPORT_PROFILE_8021QBH:
- rc = doPortProfileOp8021Qbh(linkdev, macvtap_macaddr,
- virtPort, vmuuid,
- (vmOp == VIR_VM_OP_MIGRATE_IN_START)
- ? PREASSOCIATE_RR
- : ASSOCIATE);
- if (vmOp != VIR_VM_OP_MIGRATE_IN_START && !rc) {
+ rc = virNetDevVPortProfileOp8021Qbh(linkdev, macvtap_macaddr,
+ virtPort, vmuuid,
+ (vmOp ==
VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START)
+ ? PREASSOCIATE_RR
+ : ASSOCIATE);
+ if (vmOp != VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START && !rc) {
/* XXX bogus error handling */
ignore_value(virNetDevSetOnline(linkdev, true));
}
@@ -1137,7 +1145,7 @@ vpAssociatePortProfileId(const char *macvtap_ifname,
/**
- * vpDisassociatePortProfile
+ * virNetDevVPortProfileDisassociate:
*
* @macvtap_ifname: The name of the macvtap device
* @macvtap_macaddr : The MAC address of the macvtap
@@ -1148,18 +1156,18 @@ vpAssociatePortProfileId(const char *macvtap_ifname,
* having been reported.
*/
int
-vpDisassociatePortProfileId(const char *macvtap_ifname,
- const unsigned char *macvtap_macaddr,
- const char *linkdev,
- const virNetDevVPortProfilePtr virtPort,
- enum virVMOperationType vmOp)
+virNetDevVPortProfileDisassociate(const char *macvtap_ifname,
+ const virNetDevVPortProfilePtr virtPort,
+ const unsigned char *macvtap_macaddr,
+ const char *linkdev,
+ enum virNetDevVPortProfileOp vmOp)
{
int rc = 0;
VIR_DEBUG("Disassociating port profile id '%p' on link device
'%s' ",
virtPort, macvtap_ifname);
- VIR_DEBUG("%s: VM OPERATION: %s", __FUNCTION__,
virVMOperationTypeToString(vmOp));
+ VIR_DEBUG("%s: VM OPERATION: %s", __FUNCTION__,
virNetDevVPortProfileOpTypeToString(vmOp));
if (!virtPort)
return 0;
@@ -1170,17 +1178,17 @@ vpDisassociatePortProfileId(const char *macvtap_ifname,
break;
case VIR_NETDEV_VPORT_PROFILE_8021QBG:
- rc = doPortProfileOp8021Qbg(macvtap_ifname, macvtap_macaddr,
- virtPort, DISASSOCIATE);
+ rc = virNetDevVPortProfileOp8021Qbg(macvtap_ifname, macvtap_macaddr,
+ virtPort, DISASSOCIATE);
break;
case VIR_NETDEV_VPORT_PROFILE_8021QBH:
/* avoid disassociating twice */
- if (vmOp == VIR_VM_OP_MIGRATE_IN_FINISH)
+ if (vmOp == VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_FINISH)
break;
ignore_value(virNetDevSetOnline(linkdev, false));
- rc = doPortProfileOp8021Qbh(linkdev, macvtap_macaddr,
- virtPort, NULL, DISASSOCIATE);
+ rc = virNetDevVPortProfileOp8021Qbh(linkdev, macvtap_macaddr,
+ virtPort, NULL, DISASSOCIATE);
break;
}
@@ -1189,12 +1197,12 @@ vpDisassociatePortProfileId(const char *macvtap_ifname,
#endif /* WITH_MACVTAP || WITH_NETDEV_VPORT_PROFILE */
-VIR_ENUM_IMPL(virVMOperation, VIR_VM_OP_LAST,
- "create",
- "save",
- "restore",
- "destroy",
- "migrate out",
- "migrate in start",
- "migrate in finish",
- "no-op")
+VIR_ENUM_IMPL(virNetDevVPortProfileOp, VIR_NETDEV_VPORT_PROFILE_OP_LAST,
+ "create",
+ "save",
+ "restore",
+ "destroy",
+ "migrate out",
+ "migrate in start",
+ "migrate in finish",
+ "no-op")
diff --git a/src/util/macvtap.h b/src/util/macvtap.h
index a6b00fe..5c5d84a 100644
--- a/src/util/macvtap.h
+++ b/src/util/macvtap.h
@@ -29,65 +29,73 @@
# include "virnetdevvportprofile.h"
/* the mode type for macvtap devices */
-enum virMacvtapMode {
- VIR_MACVTAP_MODE_VEPA,
- VIR_MACVTAP_MODE_PRIVATE,
- VIR_MACVTAP_MODE_BRIDGE,
- VIR_MACVTAP_MODE_PASSTHRU,
+enum virNetDevMacVLanMode {
+ VIR_NETDEV_MACVLAN_MODE_VEPA,
+ VIR_NETDEV_MACVLAN_MODE_PRIVATE,
+ VIR_NETDEV_MACVLAN_MODE_BRIDGE,
+ VIR_NETDEV_MACVLAN_MODE_PASSTHRU,
- VIR_MACVTAP_MODE_LAST,
+ VIR_NETDEV_MACVLAN_MODE_LAST,
};
-enum virVMOperationType {
- VIR_VM_OP_CREATE,
- VIR_VM_OP_SAVE,
- VIR_VM_OP_RESTORE,
- VIR_VM_OP_DESTROY,
- VIR_VM_OP_MIGRATE_OUT,
- VIR_VM_OP_MIGRATE_IN_START,
- VIR_VM_OP_MIGRATE_IN_FINISH,
- VIR_VM_OP_NO_OP,
+enum virNetDevVPortProfileOp {
+ VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
+ VIR_NETDEV_VPORT_PROFILE_OP_SAVE,
+ VIR_NETDEV_VPORT_PROFILE_OP_RESTORE,
+ VIR_NETDEV_VPORT_PROFILE_OP_DESTROY,
+ VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_OUT,
+ VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START,
+ VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_FINISH,
+ VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
- VIR_VM_OP_LAST
+ VIR_NETDEV_VPORT_PROFILE_OP_LAST
};
# if WITH_MACVTAP
-int openMacvtapTap(const char *ifname,
- const unsigned char *macaddress,
- const char *linkdev,
- enum virMacvtapMode mode,
- int vnet_hdr,
- const unsigned char *vmuuid,
- virNetDevVPortProfilePtr virtPortProfile,
- char **res_ifname,
- enum virVMOperationType vmop,
- char *stateDir,
- virNetDevBandwidthPtr bandwidth);
+int virNetDevMacVLanCreate(const char *ifname,
+ const unsigned char *macaddress,
+ const char *linkdev,
+ enum virNetDevMacVLanMode mode,
+ int vnet_hdr,
+ const unsigned char *vmuuid,
+ virNetDevVPortProfilePtr virtPortProfile,
+ char **res_ifname,
+ enum virNetDevVPortProfileOp vmop,
+ char *stateDir,
+ virNetDevBandwidthPtr bandwidth)
+ ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(6)
+ ATTRIBUTE_NONNULL(8) ATTRIBUTE_NONNULL(10) ATTRIBUTE_RETURN_CHECK;
-void delMacvtap(const char *ifname,
- const unsigned char *macaddress,
- const char *linkdev,
- int mode,
- virNetDevVPortProfilePtr virtPortProfile,
- char *stateDir);
+int virNetDevMacVLanDelete(const char *ifname,
+ const unsigned char *macaddress,
+ const char *linkdev,
+ int mode,
+ virNetDevVPortProfilePtr virtPortProfile,
+ char *stateDir)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
+ ATTRIBUTE_NONNULL(6) ATTRIBUTE_RETURN_CHECK;
-int vpAssociatePortProfileId(const char *macvtap_ifname,
- const unsigned char *macvtap_macaddr,
- const char *linkdev,
- const virNetDevVPortProfilePtr virtPort,
- const unsigned char *vmuuid,
- enum virVMOperationType vmOp);
+int virNetDevVPortProfileAssociate(const char *ifname,
+ const virNetDevVPortProfilePtr virtPort,
+ const unsigned char *macaddr,
+ const char *linkdev,
+ const unsigned char *vmuuid,
+ enum virNetDevVPortProfileOp vmOp)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
+ ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK;
-int vpDisassociatePortProfileId(const char *macvtap_ifname,
- const unsigned char *macvtap_macaddr,
- const char *linkdev,
- const virNetDevVPortProfilePtr virtPort,
- enum virVMOperationType vmOp);
+int virNetDevVPortProfileDisassociate(const char *ifname,
+ const virNetDevVPortProfilePtr virtPort,
+ const unsigned char *macaddr,
+ const char *linkdev,
+ enum virNetDevVPortProfileOp vmOp)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
+ ATTRIBUTE_RETURN_CHECK;
# endif /* WITH_MACVTAP */
-VIR_ENUM_DECL(virVMOperation)
-VIR_ENUM_DECL(virMacvtapMode)
+VIR_ENUM_DECL(virNetDevVPortProfileOp)
+VIR_ENUM_DECL(virNetDevMacVLanMode)
#endif /* __UTIL_MACVTAP_H__ */
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index d9a6e8d..5d3b74c 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -124,7 +124,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
if (!(cmd = qemuBuildCommandLine(conn, &driver,
vmdef, &monitor_chr, json, extraFlags,
migrateFrom, migrateFd, NULL,
- VIR_VM_OP_NO_OP)))
+ VIR_NETDEV_VPORT_PROFILE_OP_NO_OP)))
goto fail;
if (!!virGetLastError() != expectError) {
diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c
index b13b409..ee3ad1b 100644
--- a/tests/qemuxmlnstest.c
+++ b/tests/qemuxmlnstest.c
@@ -124,7 +124,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
if (!(cmd = qemuBuildCommandLine(conn, &driver,
vmdef, &monitor_chr, json, extraFlags,
migrateFrom, migrateFd, NULL,
- VIR_VM_OP_NO_OP)))
+ VIR_NETDEV_VPORT_PROFILE_OP_NO_OP)))
goto fail;
if (!!virGetLastError() != expectError) {
--
1.7.6.4