43fe83
From dbb853b24a6a6e1733c06c5c2742d55f8aeb6a0e Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <dbb853b24a6a6e1733c06c5c2742d55f8aeb6a0e.1381871411.git.jdenemar@redhat.com>
43fe83
From: "Daniel P. Berrange" <berrange@redhat.com>
43fe83
Date: Mon, 7 Oct 2013 17:17:31 +0100
43fe83
Subject: [PATCH] Use 'vnet' as prefix for veth devices
43fe83
43fe83
For
43fe83
43fe83
  https://bugzilla.redhat.com/show_bug.cgi?id=1014604
43fe83
43fe83
The XML parser reserves 'vnet' as a prefix for automatically
43fe83
generated NIC device names. Switch the veth device creation
43fe83
to use this prefix, so it does not have to worry about clashes
43fe83
with user specified names in the XML.
43fe83
43fe83
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
43fe83
(cherry picked from commit fe3f108d85be7bffc0bfe08eaa10e24179797724)
43fe83
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
43fe83
---
43fe83
 src/util/virnetdevveth.c | 8 ++++----
43fe83
 1 file changed, 4 insertions(+), 4 deletions(-)
43fe83
43fe83
diff --git a/src/util/virnetdevveth.c b/src/util/virnetdevveth.c
43fe83
index 1ccfc54..403961b 100644
43fe83
--- a/src/util/virnetdevveth.c
43fe83
+++ b/src/util/virnetdevveth.c
43fe83
@@ -43,10 +43,10 @@ static int virNetDevVethExists(int devNum)
43fe83
 {
43fe83
     int ret;
43fe83
     char *path = NULL;
43fe83
-    if (virAsprintf(&path, "/sys/class/net/veth%d/", devNum) < 0)
43fe83
+    if (virAsprintf(&path, "/sys/class/net/vnet%d/", devNum) < 0)
43fe83
         return -1;
43fe83
     ret = virFileExists(path) ? 1 : 0;
43fe83
-    VIR_DEBUG("Checked dev veth%d usage: %d", devNum, ret);
43fe83
+    VIR_DEBUG("Checked dev vnet%d usage: %d", devNum, ret);
43fe83
     VIR_FREE(path);
43fe83
     return ret;
43fe83
 }
43fe83
@@ -125,7 +125,7 @@ int virNetDevVethCreate(char** veth1, char** veth2)
43fe83
             if ((veth1num = virNetDevVethGetFreeNum(vethNum)) < 0)
43fe83
                 goto cleanup;
43fe83
 
43fe83
-            if (virAsprintf(&veth1auto, "veth%d", veth1num) < 0)
43fe83
+            if (virAsprintf(&veth1auto, "vnet%d", veth1num) < 0)
43fe83
                 goto cleanup;
43fe83
             vethNum = veth1num + 1;
43fe83
         }
43fe83
@@ -134,7 +134,7 @@ int virNetDevVethCreate(char** veth1, char** veth2)
43fe83
             if ((veth2num = virNetDevVethGetFreeNum(vethNum)) < 0)
43fe83
                 goto cleanup;
43fe83
 
43fe83
-            if (virAsprintf(&veth2auto, "veth%d", veth2num) < 0)
43fe83
+            if (virAsprintf(&veth2auto, "vnet%d", veth2num) < 0)
43fe83
                 goto cleanup;
43fe83
             vethNum = veth2num + 1;
43fe83
         }
43fe83
-- 
43fe83
1.8.3.2
43fe83