Skip to content

Commit 3a45bf4

Browse files
committed
CA-260245: Fix SXM: old host choking on new op (2)
When populating VDI.allowed_operations, consider only the operations that existed before the Ely release (corresponding to XenServer 7.1). (Ely contained the first additions since 2009 or earlier.) (The previous commit marked CA-260245 was insufficient to fix the SXM.) Signed-off-by: Thomas Sanders <[email protected]>
1 parent d94fe48 commit 3a45bf4

File tree

3 files changed

+22
-40
lines changed

3 files changed

+22
-40
lines changed

ocaml/xapi/xapi_globs.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,10 @@ let rpu_allowed_vm_operations = [
454454
`update_allowed_operations;
455455
]
456456

457-
let rpu_allowed_vdi_operations = [
457+
(* Until the Ely release, the vdi_operations enum had stayed unchanged
458+
* since 2009 or earlier, but then Ely and some subsequent releases
459+
* added new members to the enum. *)
460+
let pre_ely_vdi_operations = [
458461
`clone;
459462
`copy;
460463
`resize;
@@ -468,6 +471,9 @@ let rpu_allowed_vdi_operations = [
468471
`blocked;
469472
]
470473

474+
(* We might consider restricting this further. *)
475+
let rpu_allowed_vdi_operations = pre_ely_vdi_operations
476+
471477
(* Viridian key name (goes in platform flags) *)
472478
let viridian_key_name = "viridian"
473479
(* Viridian key value (set in new templates, in built-in templates on upgrade and when Orlando PV drivers up-to-date first detected) *)

ocaml/xapi/xapi_vdi.ml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,23 @@ let update_allowed_operations_internal ~__context ~self ~sr_records ~pbd_records
253253
let pool = Helpers.get_pool ~__context in
254254
let ha_enabled = Db.Pool.get_ha_enabled ~__context ~self:pool in
255255

256+
(* CA-260245: older XenServer versions do not know about newer operations,
257+
* and therefore cannot do storage migration to a XenServer that lists them
258+
* in a VDI's allowed_operations field.
259+
* As a temporary measure, we are fixing the symptom by excluding newer ops
260+
* from the allowed_operations list. This is a hack: TECHNICAL DEBT.
261+
* We would prefer to do a more general fix for this class of problems with
262+
* no age-based exclusion of VDI operations from allowed_operations.
263+
* We have one or two approaches in mind.
264+
* If/when we do this, we can update test_vdi_allowed_operations.ml to
265+
* re-enable (and maybe alter) the relevant part of
266+
* test_update_allowed_operations.
267+
*)
256268
let all_ops = Listext.List.set_difference
257269
(* Older XenServers choke on ops they don't recognise during SXM, so
258-
* filter out the recently added ones: CA-260245 *)
259-
Xapi_vdi_helpers.all_ops
260-
(`blocked :: Xapi_vdi_helpers.recently_added_ops)
270+
* until we have a better solution we consider only old ones: CA-260245 *)
271+
Xapi_globs.pre_ely_vdi_operations
272+
[`blocked]
261273
in
262274
let all = Db.VDI.get_record_internal ~__context ~self in
263275
let allowed =

ocaml/xapi/xapi_vdi_helpers.ml

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -24,42 +24,6 @@ open Threadext
2424
module D=Debug.Make(struct let name="xapi" end)
2525
open D
2626

27-
let all_ops: API.vdi_operations list =
28-
[ `blocked
29-
; `clone
30-
; `copy
31-
; `destroy
32-
; `disable_cbt
33-
; `enable_cbt
34-
; `force_unlock
35-
; `forget
36-
; `generate_config
37-
; `mirror
38-
; `resize
39-
; `resize_online
40-
; `set_on_boot
41-
; `snapshot
42-
; `update
43-
]
44-
45-
(* CA-260245: older XenServer versions do not know about these operations,
46-
* and therefore cannot do storage migration to a XenServer that lists them
47-
* in a VDI's allowed_operations field.
48-
* As a temporary measure, we are fixing the symptom by excluding these ops
49-
* from the allowed_operations list. This is a hack: TECHNICAL DEBT.
50-
* If we were to continue with this mechanism then any additional new ops would
51-
* have to be added to this recently_added_ops list, and we would be able to
52-
* remove items when old-but-supported XenServer versions know about them.
53-
* We would prefer to do a more general fix for this class of problems; we have
54-
* one or two approaches in mind. *)
55-
let recently_added_ops: API.vdi_operations list =
56-
(* If/when items are removed from this list, update
57-
* test_vdi_allowed_operations.ml to re-enable (and maybe alter)
58-
* the relevant part of test_update_allowed_operations. *)
59-
[ `enable_cbt
60-
; `disable_cbt
61-
]
62-
6327
(* CA-26514: Block operations on 'unmanaged' VDIs *)
6428
let assert_managed ~__context ~vdi =
6529
if not (Db.VDI.get_managed ~__context ~self:vdi)

0 commit comments

Comments
 (0)