|
|
|
|
|
|
|
|
|
|
xen-api
[Xen-API] [PATCH] CA-47144: PIFs were not recreated correctly after pool
# HG changeset patch
# User Rob Hoes <rob.hoes@xxxxxxxxxx>
CA-47144: PIFs were not recreated correctly after pool.eject
Problems arose when the slave had a plugged bond, especially if management was
on the bond, but only when the bridging backend is in use.
The linux bonding driver sets the MAC addresses of the bond interface, as well
as the slave interfaces, all to same MAC when the bond is up. The "real" MAC
adresses of the slaves can be found in /proc/net/bonding/<bond if>. This patch
fixes the Netdev.get_address function to take this into account.
Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>
diff -r de0776a9ff18 netdev/netdev.ml
--- a/netdev/netdev.ml
+++ b/netdev/netdev.ml
@@ -354,7 +354,28 @@
let getpath dev attr = Printf.sprintf "/sys/class/net/%s/%s" dev attr
-let get_address name = Internal.read_one_line (getpath name "address")
+let get_address name =
+ try
+ let master_path = Unix.readlink (getpath name "master") in
+ let master = List.hd (List.rev (String.split '/' master_path))
in
+ let proc ac line =
+ try
+ let a = String.index line ':' in
+ let k = String.sub line 0 a in
+ let v = String.sub_to_end line (a + 2) in
+ if k = "Slave Interface" && v = name then
+ Some ""
+ else if ac = Some "" && k = "Permanent HW addr"
then
+ Some v
+ else
+ ac
+ with _ -> ac
+ in
+ match Unixext.file_lines_fold proc None ("/proc/net/bonding/" ^
master) with
+ | None -> raise Not_found
+ | Some address -> address
+ with _ ->
+ Internal.read_one_line (getpath name "address")
let get_mtu name = Internal.read_one_line (getpath name "mtu")
let set_mtu name mtu =
bond-slave-mac
Description: Text document
_______________________________________________
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] CA-47144: PIFs were not recreated correctly after pool.eject,
Rob Hoes <=
|
|
|
|
|