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

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



# 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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.