From dbb853b24a6a6e1733c06c5c2742d55f8aeb6a0e Mon Sep 17 00:00:00 2001 Message-Id: From: "Daniel P. Berrange" Date: Mon, 7 Oct 2013 17:17:31 +0100 Subject: [PATCH] Use 'vnet' as prefix for veth devices For https://bugzilla.redhat.com/show_bug.cgi?id=1014604 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 (cherry picked from commit fe3f108d85be7bffc0bfe08eaa10e24179797724) Signed-off-by: Jiri Denemark --- src/util/virnetdevveth.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/virnetdevveth.c b/src/util/virnetdevveth.c index 1ccfc54..403961b 100644 --- a/src/util/virnetdevveth.c +++ b/src/util/virnetdevveth.c @@ -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; } -- 1.8.3.2