File tree Expand file tree Collapse file tree 3 files changed +14
-8
lines changed
Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -383,11 +383,7 @@ let detect_rolling_upgrade ~__context =
383383 (* If my platform version is different to any host (including myself) then we're in a rolling upgrade mode *)
384384 (* NB: it is critical this code runs once in the master of a pool of one before the dbsync, since this
385385 is the only time at which the master's Version will be out of sync with its database record *)
386- let all_hosts = Db.Host. get_all ~__context in
387- let platform_versions = List. map (fun host -> Helpers. version_string_of ~__context host) all_hosts in
388-
389- let is_different_to_me platform_version = platform_version <> Version. platform_version in
390- let actually_in_progress = List. fold_left (|| ) false (List. map is_different_to_me platform_versions) in
386+ let actually_in_progress = Helpers. pool_has_different_host_platform_versions ~__context in
391387 (* Check the current state of the Pool as indicated by the Pool.other_config:rolling_upgrade_in_progress *)
392388 let pools = Db.Pool. get_all ~__context in
393389 match pools with
@@ -398,6 +394,7 @@ let detect_rolling_upgrade ~__context =
398394 List. mem_assoc Xapi_globs. rolling_upgrade_in_progress (Db.Pool. get_other_config ~__context ~self: pool) in
399395 (* Resynchronise *)
400396 if actually_in_progress <> pool_says_in_progress then begin
397+ let platform_versions = List. map (fun host -> Helpers. version_string_of ~__context host) (Db.Host. get_all ~__context) in
401398 debug " xapi platform version = %s; host platform versions = [ %s ]"
402399 Version. platform_version (String. concat " ; " platform_versions);
403400
Original file line number Diff line number Diff line change @@ -556,6 +556,12 @@ let assert_host_versions_not_decreasing :
556556 if not (host_versions_not_decreasing ~__context ~host_from ~host_to ) then
557557 raise (Api_errors. Server_error (Api_errors. not_supported_during_upgrade, [] ))
558558
559+ let pool_has_different_host_platform_versions ~__context =
560+ let all_hosts = Db.Host. get_all ~__context in
561+ let platform_versions = List. map (fun host -> version_string_of ~__context host) all_hosts in
562+ let is_different_to_me platform_version = platform_version <> Version. platform_version in
563+ List. fold_left (|| ) false (List. map is_different_to_me platform_versions)
564+
559565(* * Indicates whether ballooning is enabled for the given virtual machine. *)
560566let ballooning_enabled_for_vm ~__context vm_record =
561567 not vm_record.API. vM_is_control_domain
@@ -992,3 +998,4 @@ let force_loopback_vbd ~__context =
992998 let pool = get_pool ~__context in
993999 let other_config = Db.Pool. get_other_config ~__context ~self: pool in
9941000 List. mem_assoc " force_loopback_vbd" other_config
1001+
Original file line number Diff line number Diff line change @@ -1133,13 +1133,15 @@ let slave_network_report ~__context ~phydevs ~dev_to_mac ~dev_to_mtu ~slave_host
11331133(*
11341134 Dbsync_slave.create_physical_networks ~__context phydevs dev_to_mac dev_to_mtu slave_host
11351135*)
1136-
11371136(* Let's only process one enable/disable at a time. I would have used an allowed_operation for this but
11381137 it would involve a datamodel change and it's too late for Orlando. *)
11391138let enable_disable_m = Mutex. create ()
11401139let enable_ha ~__context ~heartbeat_srs ~configuration =
1141- Helpers. assert_rolling_upgrade_not_in_progress ~__context;
1142- Mutex. execute enable_disable_m (fun () -> Xapi_ha. enable __context heartbeat_srs configuration)
1140+ if not (Helpers. pool_has_different_host_platform_versions ~__context)
1141+ then Mutex. execute enable_disable_m (fun () -> Xapi_ha. enable __context heartbeat_srs configuration)
1142+ else
1143+ raise (Api_errors. Server_error (Api_errors. not_supported_during_upgrade, [] ))
1144+
11431145let disable_ha ~__context = Mutex. execute enable_disable_m (fun () -> Xapi_ha. disable __context)
11441146
11451147let ha_prevent_restarts_for ~__context ~seconds = Xapi_ha. ha_prevent_restarts_for __context seconds
You can’t perform that action at this time.
0 commit comments