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] fix an upgrade race in the Host_patch record update lo

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] fix an upgrade race in the Host_patch record update logic
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Thu, 21 Jan 2010 15:45:41 +0000
Delivery-date: Thu, 21 Jan 2010 07:38:55 -0800
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 1264088709 0
# Node ID 22cd3f304b9e0818b80ac5a40e6d4c6438c5e58a
# Parent  d062b05c786746edc58629bf4128aa5444f853d9
CA-35549: fix a race in the Host_patch record update logic

The master checks every 30s if we've just finished a rolling upgrade by 
noticing when
all the Host.software_version:product_version strings match. It then calls a 
script

  /opt/xensource/libexec/xapi-rolling-upgrade stop

which currently deletes pool-wide patch records if all the per-host links are 
gone.
Unfortunately the dbsync code on the slave was updating the software_version 
before
deleting the per-host links, creating a race which could result in old patch 
records
lingering, confusingly around.

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

diff -r d062b05c7867 -r 22cd3f304b9e ocaml/xapi/dbsync_slave.ml
--- a/ocaml/xapi/dbsync_slave.ml        Tue Jan 19 15:17:14 2010 +0000
+++ b/ocaml/xapi/dbsync_slave.ml        Thu Jan 21 15:45:09 2010 +0000
@@ -86,6 +86,7 @@
   Xapi_globs.localhost_software_version := software_version; (* Cache this *)
 
   (* Xapi_ha_flags.resync_host_armed_flag __context host; *)
+  debug "Updating host software_version";
 
     Db.Host.set_software_version ~__context ~self:host ~value:software_version;
     Db.Host.set_API_version_major ~__context ~self:host 
~value:Xapi_globs.api_version_major;
@@ -664,11 +665,6 @@
   (* Load the host rrd *)
   Monitor_rrds.load_rrd ~__context (Helpers.get_localhost_uuid ()) true;
 
-  (* refresh host info fields *)
-  switched_sync Xapi_globs.sync_refresh_localhost_info (fun () -> 
-    refresh_localhost_info ~__context;
-  );
-
   (* maybe record host memory properties in database *)
   switched_sync Xapi_globs.sync_record_host_memory_properties (fun () ->
     record_host_memory_properties ~__context;
@@ -741,3 +737,13 @@
     if Db.Host.get_bios_strings ~__context ~self:localhost = [] then
       Bios_strings.set_host_bios_strings ~__context ~host:localhost
   );
+
+  (* CA-35549: In a pool rolling upgrade, the master will detect the end of 
upgrade when the software versions
+        of all the hosts are the same. It will then assume that (for example) 
per-host patch records have
+        been tidied up and attempt to delete orphaned pool-wide patch records. 
*)
+
+  (* refresh host info fields *)
+  switched_sync Xapi_globs.sync_refresh_localhost_info (fun () -> 
+    refresh_localhost_info ~__context;
+  );
+
diff -r d062b05c7867 -r 22cd3f304b9e scripts/xapi-rolling-upgrade-miami
--- a/scripts/xapi-rolling-upgrade-miami        Tue Jan 19 15:17:14 2010 +0000
+++ b/scripts/xapi-rolling-upgrade-miami        Thu Jan 21 15:45:09 2010 +0000
@@ -24,8 +24,6 @@
     
   ;;
   stop)
-    logger -t upgrade "Sleeping for 30s"
-    sleep 30s
     for i in $($XE sr-list other-config:xenserver_tools_sr=true params=uuid 
--minimal | sed 's/,/ /g'); do
       echo Renaming $i
       $XE sr-param-set uuid=$i name-label="XenServer Tools" 
name-description="XenServer Tools ISOs"
2 files changed, 11 insertions(+), 7 deletions(-)
ocaml/xapi/dbsync_slave.ml         |   16 +++++++++++-----
scripts/xapi-rolling-upgrade-miami |    2 --


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] fix an upgrade race in the Host_patch record update logic, David Scott <=