[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 03/16] Rename high level macvlan creation APIs



From: "Daniel P. Berrange" <berrange redhat com>

Rename virNetDevMacVLanCreate to virNetDevMacVLanCreateWithVPortProfile
and virNetDevMacVLanDelete to virNetDevMacVLanDeleteWithVPortProfile

To make way for renaming the other macvlan creation APIs in
interface.c

* util/virnetdevmacvlan.c, util/virnetdevmacvlan.h,
  qemu/qemu_command.c, qemu/qemu_hotplug.c, qemu/qemu_process.c:
  Rename APIs
---
 src/qemu/qemu_command.c     |   17 +++++-----
 src/qemu/qemu_hotplug.c     |   11 +++---
 src/qemu/qemu_process.c     |   11 +++---
 src/util/virnetdevmacvlan.c |   72 +++++++++++++++++++++---------------------
 src/util/virnetdevmacvlan.h |   34 ++++++++++----------
 5 files changed, 74 insertions(+), 71 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4514713..9806c23 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -148,14 +148,15 @@ qemuPhysIfaceConnect(virDomainDefPtr def,
         net->model && STREQ(net->model, "virtio"))
         vnet_hdr = 1;
 
-    rc = virNetDevMacVLanCreate(net->ifname, net->mac,
-                                virDomainNetGetActualDirectDev(net),
-                                virDomainNetGetActualDirectMode(net),
-                                vnet_hdr, def->uuid,
-                                virDomainNetGetActualDirectVirtPortProfile(net),
-                                &res_ifname,
-                                vmop, driver->stateDir,
-                                virDomainNetGetActualBandwidth(net));
+    rc = virNetDevMacVLanCreateWithVPortProfile(
+        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);
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index bbcf9ca..96c0070 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1910,11 +1910,12 @@ int qemuDomainDetachNetDevice(struct qemud_driver *driver,
     virDomainConfNWFilterTeardown(detach);
 
     if (virDomainNetGetActualType(detach) == VIR_DOMAIN_NET_TYPE_DIRECT) {
-        ignore_value(virNetDevMacVLanDelete(detach->ifname, detach->mac,
-                                            virDomainNetGetActualDirectDev(detach),
-                                            virDomainNetGetActualDirectMode(detach),
-                                            virDomainNetGetActualDirectVirtPortProfile(detach),
-                                            driver->stateDir));
+        ignore_value(virNetDevMacVLanDeleteWithVPortProfile(
+                         detach->ifname, detach->mac,
+                         virDomainNetGetActualDirectDev(detach),
+                         virDomainNetGetActualDirectMode(detach),
+                         virDomainNetGetActualDirectVirtPortProfile(detach),
+                         driver->stateDir));
         VIR_FREE(detach->ifname);
     }
 
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index f4096f8..04fcdef 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3411,11 +3411,12 @@ void qemuProcessStop(struct qemud_driver *driver,
     for (i = 0; i < def->nnets; i++) {
         virDomainNetDefPtr net = def->nets[i];
         if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_DIRECT) {
-            ignore_value(virNetDevMacVLanDelete(net->ifname, net->mac,
-                                                virDomainNetGetActualDirectDev(net),
-                                                virDomainNetGetActualDirectMode(net),
-                                                virDomainNetGetActualDirectVirtPortProfile(net),
-                                                driver->stateDir));
+            ignore_value(virNetDevMacVLanDeleteWithVPortProfile(
+                             net->ifname, net->mac,
+                             virDomainNetGetActualDirectDev(net),
+                             virDomainNetGetActualDirectMode(net),
+                             virDomainNetGetActualDirectVirtPortProfile(net),
+                             driver->stateDir));
             VIR_FREE(net->ifname);
         }
         /* release the physical device (or any other resources used by
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index ab111f0..a322ece 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -215,7 +215,7 @@ static const uint32_t modeMap[VIR_NETDEV_MACVLAN_MODE_LAST] = {
 };
 
 /**
- * virNetDevMacVLanCreate:
+ * virNetDevMacVLanCreateWithVPortProfile:
  * Create an instance of a macvtap device and open its tap character
  * device.
  * @tgifname: Interface name that the macvtap is supposed to have. May
@@ -234,17 +234,17 @@ static const uint32_t modeMap[VIR_NETDEV_MACVLAN_MODE_LAST] = {
  * negative value otherwise with error reported.
  *
  */
-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)
+int virNetDevMacVLanCreateWithVPortProfile(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;
@@ -357,7 +357,7 @@ link_del_exit:
 
 
 /**
- * delMacvtap:
+ * virNetDevMacVLanDeleteWithVPortProfile:
  * @ifname : The name of the macvtap interface
  * @linkdev: The interface name of the NIC to connect to the external bridge
  * @virtPortProfile: pointer to object holding the virtual port profile data
@@ -366,12 +366,12 @@ link_del_exit:
  * it with the switch if port profile parameters
  * were provided.
  */
-int virNetDevMacVLanDelete(const char *ifname,
-                           const unsigned char *macaddr,
-                           const char *linkdev,
-                           int mode,
-                           virNetDevVPortProfilePtr virtPortProfile,
-                           char *stateDir)
+int virNetDevMacVLanDeleteWithVPortProfile(const char *ifname,
+                                           const unsigned char *macaddr,
+                                           const char *linkdev,
+                                           int mode,
+                                           virNetDevVPortProfilePtr virtPortProfile,
+                                           char *stateDir)
 {
     int ret = 0;
     if (mode == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) {
@@ -392,29 +392,29 @@ int virNetDevMacVLanDelete(const char *ifname,
 }
 
 #else /* ! WITH_MACVTAP */
-int virNetDevMacVLanCreate(const char *ifname ATTRIBUTE_UNUSED,
-                           const unsigned char *macaddress ATTRIBUTE_UNUSED,
-                           const char *linkdev ATTRIBUTE_UNUSED,
-                           enum virNetDevMacVLanMode mode ATTRIBUTE_UNUSED,
-                           int vnet_hdr ATTRIBUTE_UNUSED,
-                           const unsigned char *vmuuid ATTRIBUTE_UNUSED,
-                           virNetDevVPortProfilePtr virtPortProfile ATTRIBUTE_UNUSED,
-                           char **res_ifname ATTRIBUTE_UNUSED,
-                           enum virNetDevVPortProfileOp vmop ATTRIBUTE_UNUSED,
-                           char *stateDir ATTRIBUTE_UNUSED,
-                           virNetDevBandwidthPtr bandwidth ATTRIBUTE_UNUSED)
+int virNetDevMacVLanCreateWithVPortProfile(const char *ifname ATTRIBUTE_UNUSED,
+                                           const unsigned char *macaddress ATTRIBUTE_UNUSED,
+                                           const char *linkdev ATTRIBUTE_UNUSED,
+                                           enum virNetDevMacVLanMode mode ATTRIBUTE_UNUSED,
+                                           int vnet_hdr ATTRIBUTE_UNUSED,
+                                           const unsigned char *vmuuid ATTRIBUTE_UNUSED,
+                                           virNetDevVPortProfilePtr virtPortProfile ATTRIBUTE_UNUSED,
+                                           char **res_ifname ATTRIBUTE_UNUSED,
+                                           enum virNetDevVPortProfileOp vmop ATTRIBUTE_UNUSED,
+                                           char *stateDir ATTRIBUTE_UNUSED,
+                                           virNetDevBandwidthPtr bandwidth ATTRIBUTE_UNUSED)
 {
     virReportSystemError(ENOSYS, "%s",
                          _("Cannot create macvlan devices on this platform"));
     return -1;
 }
 
-int virNetDevMacVLanDelete(const char *ifname ATTRIBUTE_UNUSED,
-                           const unsigned char *macaddress ATTRIBUTE_UNUSED,
-                           const char *linkdev ATTRIBUTE_UNUSED,
-                           int mode ATTRIBUTE_UNUSED,
-                           virNetDevVPortProfilePtr virtPortProfile ATTRIBUTE_UNUSED,
-                           char *stateDir ATTRIBUTE_UNUSED)
+int virNetDevMacVLanDeleteWithVPortProfile(const char *ifname ATTRIBUTE_UNUSED,
+                                           const unsigned char *macaddress ATTRIBUTE_UNUSED,
+                                           const char *linkdev ATTRIBUTE_UNUSED,
+                                           int mode ATTRIBUTE_UNUSED,
+                                           virNetDevVPortProfilePtr virtPortProfile ATTRIBUTE_UNUSED,
+                                           char *stateDir ATTRIBUTE_UNUSED)
 {
     virReportSystemError(ENOSYS, "%s",
                          _("Cannot create macvlan devices on this platform"));
diff --git a/src/util/virnetdevmacvlan.h b/src/util/virnetdevmacvlan.h
index f3277f9..9498f7b 100644
--- a/src/util/virnetdevmacvlan.h
+++ b/src/util/virnetdevmacvlan.h
@@ -39,26 +39,26 @@ enum virNetDevMacVLanMode {
 };
 VIR_ENUM_DECL(virNetDevMacVLanMode)
 
-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)
+int virNetDevMacVLanCreateWithVPortProfile(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;
 
-int virNetDevMacVLanDelete(const char *ifname,
-                           const unsigned char *macaddress,
-                           const char *linkdev,
-                           int mode,
-                           virNetDevVPortProfilePtr virtPortProfile,
-                           char *stateDir)
+int virNetDevMacVLanDeleteWithVPortProfile(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;
 
-- 
1.7.6.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]