WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH] Netdev.is_physical was accidentally returning true for

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] Netdev.is_physical was accidentally returning true for vif backend devices
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Wed, 7 Apr 2010 17:44:34 +0100
Delivery-date: Wed, 07 Apr 2010 09:41:40 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1270658636 -3600
# Node ID 27bad449e0035f08da470f6bda2ba69c987f8452
# Parent  cce821ec37aece522f4d78684c464ad9563477f7
CA-38463: backend vifs now have proper "device" symlinks in /sys so to tell the 
difference between them and a real "physical" interface, look to see whether 
they link to devices/xen-backend/...

This prevents PIF.scan from accidentally introducing vifX.Y as PIFs...

Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx>

diff -r cce821ec37ae -r 27bad449e003 ocaml/netdev/netdev.ml
--- a/ocaml/netdev/netdev.ml    Wed Apr 07 17:06:31 2010 +0100
+++ b/ocaml/netdev/netdev.ml    Wed Apr 07 17:43:56 2010 +0100
@@ -385,7 +385,12 @@
        read_id_from (getpath name "device/vendor"),
        read_id_from (getpath name "device/device")
 
-let is_physical name = try Unix.access (getpath name "device") [ Unix.F_OK ]; 
true with _ -> false
+let is_physical name = 
+  try 
+       let link = Unix.readlink (getpath name "device") in
+       (* filter out device symlinks which look like 
/../../../devices/xen-backend/vif- *)
+       not(List.mem "xen-backend" (String.split '/' link))
+  with _ -> false
 
 (* Dispatch network backend operations. *)
 
1 file changed, 6 insertions(+), 1 deletion(-)
ocaml/netdev/netdev.ml |    7 ++++++-


Attachment: xen-api.hg.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] [PATCH] Netdev.is_physical was accidentally returning true for vif backend devices, David Scott <=