Signed-off-by: Jon Ludlam <[email protected]>

 ocaml/xapi/xapi_mgmt_iface.ml |  21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)


# HG changeset patch
# User Jonathan Ludlam <[email protected]>
# Date 1269364563 0
# Node ID 82dda39e1b8b83c0e5d262698f9cf0dc9ac0d151
# Parent  fa2832ca1a1d2c62fb9dad976c7142e57fd48478
CA-36244: Broadcast the management_ip_cond condition variable unconditionally in the 'on_dom0_networking_change' - the only thing waiting on this is immediately above, where we're waiting for a management IP. If the IP obtained by DHCP was the same as we had before, the old logic wouldn't have signalled, and therefore the loop would never have woken.

Signed-off-by: Jon Ludlam <[email protected]>

diff -r fa2832ca1a1d -r 82dda39e1b8b ocaml/xapi/xapi_mgmt_iface.ml
--- a/ocaml/xapi/xapi_mgmt_iface.ml	Tue Mar 23 17:15:58 2010 +0000
+++ b/ocaml/xapi/xapi_mgmt_iface.ml	Tue Mar 23 17:16:03 2010 +0000
@@ -66,10 +66,12 @@
 
 let wait_for_management_ip () = 
     let ip = ref (match Helpers.get_management_ip_addr () with Some x -> x | None -> "") in
-    while !ip = "" do
-      Condition.wait management_ip_cond management_ip_mutex;
-      ip := (match Helpers.get_management_ip_addr () with Some x -> x | None -> "");
-    done;
+    Mutex.execute management_ip_mutex (fun () -> begin
+      while !ip = "" do
+	Condition.wait management_ip_cond management_ip_mutex;
+	ip := (match Helpers.get_management_ip_addr () with Some x -> x | None -> "")
+      done;
+    end);
     !ip
 
 let on_dom0_networking_change ~__context =
@@ -90,17 +92,18 @@
 	debug "Changing Host.address in database to: %s" ip;
 	Db.Host.set_address ~__context ~self:localhost ~value:ip;
 	debug "Refreshing console URIs";
-	Dbsync_master.refresh_console_urls ~__context;
-	debug "Signalling anyone waiting for the management IP address to change";
-	Mutex.execute management_ip_mutex
-	  (fun () -> Condition.broadcast management_ip_cond)
+	Dbsync_master.refresh_console_urls ~__context
       end
   | None ->
       if Db.Host.get_address ~__context ~self:localhost <> "" then begin
 	debug "Changing Host.address in database to: '' (host has no management IP address)";
 	Db.Host.set_address ~__context ~self:localhost ~value:""
       end
-  end
+  end;
+  debug "Signalling anyone waiting for the management IP address to change";
+  Mutex.execute management_ip_mutex
+    (fun () -> Condition.broadcast management_ip_cond)
+
 
 let change_ip interface ip = Mutex.execute management_m (fun () -> change (interface, ip))
 
_______________________________________________
xen-api mailing list
[email protected]
http://lists.xensource.com/mailman/listinfo/xen-api

Reply via email to