]> xenbits.xensource.com Git - libvirt.git/commitdiff
Use 'vnet' as prefix for veth devices
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 2 Oct 2013 11:24:54 +0000 (12:24 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 3 Oct 2013 10:28:44 +0000 (11:28 +0100)
The XML parser reserves 'vnet' as a prefix for automatically
generated NIC device names. Switch the veth device creation
to use this prefix, so it does not have to worry about clashes
with user specified names in the XML.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/util/virnetdevveth.c

index 1ccfc547a2c8e0b9f851f8ab20251dc615056c5a..403961bf53ed8a587b9e807543afe9b48ae42784 100644 (file)
@@ -43,10 +43,10 @@ static int virNetDevVethExists(int devNum)
 {
     int ret;
     char *path = NULL;
-    if (virAsprintf(&path, "/sys/class/net/veth%d/", devNum) < 0)
+    if (virAsprintf(&path, "/sys/class/net/vnet%d/", devNum) < 0)
         return -1;
     ret = virFileExists(path) ? 1 : 0;
-    VIR_DEBUG("Checked dev veth%d usage: %d", devNum, ret);
+    VIR_DEBUG("Checked dev vnet%d usage: %d", devNum, ret);
     VIR_FREE(path);
     return ret;
 }
@@ -125,7 +125,7 @@ int virNetDevVethCreate(char** veth1, char** veth2)
             if ((veth1num = virNetDevVethGetFreeNum(vethNum)) < 0)
                 goto cleanup;
 
-            if (virAsprintf(&veth1auto, "veth%d", veth1num) < 0)
+            if (virAsprintf(&veth1auto, "vnet%d", veth1num) < 0)
                 goto cleanup;
             vethNum = veth1num + 1;
         }
@@ -134,7 +134,7 @@ int virNetDevVethCreate(char** veth1, char** veth2)
             if ((veth2num = virNetDevVethGetFreeNum(vethNum)) < 0)
                 goto cleanup;
 
-            if (virAsprintf(&veth2auto, "veth%d", veth2num) < 0)
+            if (virAsprintf(&veth2auto, "vnet%d", veth2num) < 0)
                 goto cleanup;
             vethNum = veth2num + 1;
         }