@@ -274,23 +274,42 @@ let test_cbt =
274274
275275(* * The set of allowed operations must be restricted during rolling pool
276276 upgrade to the enums known by older releases. *)
277- let test_operations_restricted_during_rpu () =
278- let __context = Mock. make_context_with_new_db " Mock context" in
279- let master = Test_common. make_host __context () in
280- let pool = Test_common. make_pool ~__context ~master () in
281- Db.Pool. add_to_other_config ~__context ~self: pool ~key: Xapi_globs. rolling_upgrade_in_progress ~value: " x" ;
282- run_assert_equal_with_vdi
283- ~__context
284- ~sm_fun: (fun sm -> Db.SM. set_features ~__context ~self: sm ~value: [" VDI_MIRROR" ,1L ])
285- `mirror
286- (Some (Api_errors. not_supported_during_upgrade, [] ));
287- Db.Pool. remove_from_other_config ~__context ~self: pool ~key: Xapi_globs. rolling_upgrade_in_progress;
288- run_assert_equal_with_vdi
289- ~__context
290- ~sm_fun: (fun sm -> Db.SM. set_features ~__context ~self: sm ~value: [" VDI_MIRROR" ,1L ])
291- `mirror
292- None
277+ let test_operations_restricted_during_rpu =
278+ let test_check_operation_error () =
279+ let __context = Mock. make_context_with_new_db " Mock context" in
280+ let master = Test_common. make_host __context () in
281+ let pool = Test_common. make_pool ~__context ~master () in
282+ Db.Pool. add_to_other_config ~__context ~self: pool ~key: Xapi_globs. rolling_upgrade_in_progress ~value: " x" ;
283+ run_assert_equal_with_vdi
284+ ~__context
285+ ~sm_fun: (fun sm -> Db.SM. set_features ~__context ~self: sm ~value: [" VDI_MIRROR" ,1L ])
286+ `mirror
287+ (Some (Api_errors. not_supported_during_upgrade, [] ));
288+ Db.Pool. remove_from_other_config ~__context ~self: pool ~key: Xapi_globs. rolling_upgrade_in_progress;
289+ run_assert_equal_with_vdi
290+ ~__context
291+ ~sm_fun: (fun sm -> Db.SM. set_features ~__context ~self: sm ~value: [" VDI_MIRROR" ,1L ])
292+ `mirror
293+ None
294+ in
293295
296+ let test_update_allowed_operations () =
297+ let __context = Mock. make_context_with_new_db " Mock context" in
298+ let master = Test_common. make_host __context () in
299+ let pool = Test_common. make_pool ~__context ~master () in
300+ Db.Pool. add_to_other_config ~__context ~self: pool ~key: Xapi_globs. rolling_upgrade_in_progress ~value: " x" ;
301+ let self, _ = setup_test ~__context ~vdi_fun: (fun vdi -> Db.VDI. set_type ~__context ~self: vdi ~value: `user ) () in
302+ Xapi_vdi. update_allowed_operations ~__context ~self ;
303+ OUnit. assert_bool " update_allowed_operations should exclude `enable_cbt during RPU" (not @@ List. mem `enable_cbt (Db.VDI. get_allowed_operations ~__context ~self ));
304+ Db.Pool. remove_from_other_config ~__context ~self: pool ~key: Xapi_globs. rolling_upgrade_in_progress;
305+ Xapi_vdi. update_allowed_operations ~__context ~self ;
306+ OUnit. assert_bool " update_allowed_operations should consider `enable_cbt when RPU is not running" (List. mem `enable_cbt (Db.VDI. get_allowed_operations ~__context ~self ))
307+ in
308+
309+ " test_operations_restricted_during_rpu" > :::
310+ [ " test_check_operation_error" > :: test_check_operation_error
311+ ; " test_update_allowed_operations" > :: test_update_allowed_operations
312+ ]
294313
295314let test =
296315 " test_vdi_allowed_operations" > :::
@@ -300,5 +319,5 @@ let test =
300319 " test_ca125187" > :: test_ca125187;
301320 " test_ca126097" > :: test_ca126097;
302321 test_cbt;
303- " test_operations_restricted_during_rpu " > :: test_operations_restricted_during_rpu;
322+ test_operations_restricted_during_rpu;
304323 ]
0 commit comments