Re: [PATCH 4/5] netdev: Enable virNetDevGenerateName to support veth

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

 



On 12/4/20 2:01 AM, Shi Lei wrote:
Signed-off-by: Shi Lei <shi_lei@xxxxxxxxxxxxxx>
---
  src/util/virnetdev.c | 2 ++
  src/util/virnetdev.h | 3 +++
  2 files changed, 5 insertions(+)

diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 5ff8e35f..ff1b1fa0 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -102,6 +102,7 @@ VIR_ENUM_IMPL(virNetDevGenNameType,
                "tap",
                "macvtap",
                "macvlan",
+              "veth",


As discussed in patch 1, this ENUM_IMPL is unnecessary.


  );
static virNetDevGenName
@@ -110,6 +111,7 @@ virNetDevGenNames[VIR_NET_DEV_GEN_NAME_LAST] = {
      {-1, VIR_NET_GENERATED_TAP_PREFIX, VIR_MUTEX_INITIALIZER},
      {-1, VIR_NET_GENERATED_MACVTAP_PREFIX, VIR_MUTEX_INITIALIZER},
      {-1, VIR_NET_GENERATED_MACVLAN_PREFIX, VIR_MUTEX_INITIALIZER},
+    {-1, VIR_NET_GENERATED_VETH_PREFIX, VIR_MUTEX_INITIALIZER},
  };
typedef enum {
diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
index 19f37b61..097d0f8e 100644
--- a/src/util/virnetdev.h
+++ b/src/util/virnetdev.h
@@ -40,6 +40,8 @@ typedef void virIfreq;
   */
  #define VIR_NET_GENERATED_TAP_PREFIX "vnet"
+#define VIR_NET_GENERATED_VETH_PREFIX "veth"


Up until now, libvirt has named the veth devices as "vnetN", not "vethN". I don't know that it would cause any problem to change to using "vethN" (since already-running domains would have their "vnetN" device name available in the domain status - only newly started domains would use  "vethN"). However I don't see any concrete reason for making that change.


That being the case, I think you can just drop this patch, and use the TAP prefix in the next patch (actually that's a good indication that it shouldn't be called VIR_NET_DEV_GEN_NAME_TAP, but should instead be called VIR_NET_DEV_GEN_NAME_VNET).


+
  /* libvirt will start macvtap/macvlan interface names with one of
   * these prefixes when it auto-generates the name
   */
@@ -156,6 +158,7 @@ typedef enum {
      VIR_NET_DEV_GEN_NAME_TAP,
      VIR_NET_DEV_GEN_NAME_MACVTAP,
      VIR_NET_DEV_GEN_NAME_MACVLAN,
+    VIR_NET_DEV_GEN_NAME_VETH,
      VIR_NET_DEV_GEN_NAME_LAST
  } virNetDevGenNameType;





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux