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/
Home Products Support Community News


[Xen-API] [PATCH] Add biosdevname call to Netdev

To: xen-api <xen-api@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-API] [PATCH] Add biosdevname call to Netdev
From: Rob Hoes <rob.hoes@xxxxxxxxxx>
Date: Thu, 3 Jun 2010 11:10:18 +0100
Delivery-date: Thu, 03 Jun 2010 03:10:30 -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 Rob Hoes <rob.hoes@xxxxxxxxxx>
Add biosdevname call to Netdev

biosdevname is a tool used to find out the "real" device name of a network 
interface, according to the BIOS. This name is not affected by manual device 
renaming or changes in the Linux kernel.

Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>

diff -r 8d1a037cb063 netdev/netdev.ml
--- a/netdev/netdev.ml
+++ b/netdev/netdev.ml
@@ -397,6 +397,12 @@
        not(List.mem "xen-backend" (String.split '/' link))
   with _ -> false
+let get_bios_name name =
+       try
+               let output, _ = Forkhelpers.execute_command_get_output 
"biosdevname" ["-i"; name] in
+               output
+       with _ -> name
 (* Dispatch network backend operations. *)
 let network_config_file = "/etc/xensource/network.conf"
diff -r 8d1a037cb063 netdev/netdev.mli
--- a/netdev/netdev.mli
+++ b/netdev/netdev.mli
@@ -131,8 +131,13 @@
 (** Returns PCI vendor and device ID for network device. *)
 val get_ids : string -> string * string
-(** Indicates whether the given interface is a physical interface *)
+(** Indicates whether the given interface is a physical interface. *)
 val is_physical : string -> bool
-(** Dispatch operation to correct backend device *)
+(** Returns the device name of the given interface according to [biosdevname]. 
This is a name
+ *  that is based on the BIOS name and should not be affected by changes in 
the Linux kernel or
+ *  manual device renaming. *)
+val get_bios_name : string -> string
+(** Dispatch operation to correct backend device. *)
 val network : network_ops

Attachment: netdev-biosdevname
Description: Text document

xen-api mailing list
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] [PATCH] Add biosdevname call to Netdev, Rob Hoes <=