Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ocaml/idl/api_errors.ml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ let vdi_missing = "VDI_MISSING"
let vdi_incompatible_type = "VDI_INCOMPATIBLE_TYPE"
let vdi_not_managed = "VDI_NOT_MANAGED"
let vdi_io_error = "VDI_IO_ERROR"
let vdi_on_boot_mode_incompatable_with_operation = "VDI_ON_BOOT_MODE_INCOMPATABLE_WITH_OPERATION"
let vdi_on_boot_mode_incompatible_with_operation = "VDI_ON_BOOT_MODE_INCOMPATABLE_WITH_OPERATION"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spelling is fixed in the name but not in the capital-letters text-string.
I'm confident enough that nothing outside xapi is relying on that string at present, so it should be safe to change.

let vdi_not_in_map = "VDI_NOT_IN_MAP"
let cannot_create_state_file = "CANNOT_CREATE_STATE_FILE"

Expand Down
4 changes: 3 additions & 1 deletion ocaml/idl/datamodel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,9 @@ let _ =
error Api_errors.vdi_not_in_map [ "vdi" ]
~doc:"This VDI was not mapped to a destination SR in VM.migrate_send operation" () ;
error Api_errors.vdi_copy_failed []
~doc:"The VDI copy action has failed" ();
~doc:"The VDI copy action has failed" ();
error Api_errors.vdi_on_boot_mode_incompatible_with_operation []
~doc:"This operation is not permitted on VMs containing VDIs in the 'on-boot=reset' mode" ();
error Api_errors.cannot_create_state_file []
~doc:"An HA statefile could not be created, perhaps because no SR with the appropriate capability was found." ();

Expand Down
2 changes: 1 addition & 1 deletion ocaml/xapi/xapi_vdi.ml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ let check_operation_error ~__context ?(sr_records=[]) ?(pbd_records=[]) ?(vbd_re
| `snapshot when record.Db_actions.vDI_sharable ->
Some (Api_errors.vdi_is_sharable, [ _ref ])
| `snapshot when reset_on_boot ->
Some (Api_errors.vdi_on_boot_mode_incompatable_with_operation, [])
Some (Api_errors.vdi_on_boot_mode_incompatible_with_operation, [])
| `copy ->
if List.mem record.Db_actions.vDI_type [ `ha_statefile; `redo_log ]
then Some (Api_errors.operation_not_allowed, ["VDI containing HA statefile or redo log cannot be copied (check the VDI's allowed operations)."])
Expand Down
4 changes: 2 additions & 2 deletions ocaml/xapi/xapi_vm_lifecycle.ml
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,12 @@ let check_operation_error ~__context ~vmr ~vmgmr ~ref ~clone_suspended_vm_enable
if op = `checkpoint || op = `snapshot || op = `suspend || op = `snapshot_with_quiesce
then (* If any vdi exists with on_boot=reset, then disallow checkpoint, snapshot, suspend *)
if List.exists fst vdis_reset_and_caching
then Some (Api_errors.vdi_on_boot_mode_incompatable_with_operation,[])
then Some (Api_errors.vdi_on_boot_mode_incompatible_with_operation,[])
else None
else if op = `pool_migrate then
(* If any vdi exists with on_boot=reset and caching is enabled, disallow migrate *)
if List.exists (fun (reset,caching) -> reset && caching) vdis_reset_and_caching
then Some (Api_errors.vdi_on_boot_mode_incompatable_with_operation,[])
then Some (Api_errors.vdi_on_boot_mode_incompatible_with_operation,[])
else None
else None) in

Expand Down
2 changes: 1 addition & 1 deletion ocaml/xapi/xapi_vm_migrate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ let migrate_send' ~__context ~vm ~dest ~live ~vdi_map ~vif_map ~options =
(* Block SXM when VM has a VDI with on_boot=reset *)
List.(iter (fun (vdi,_,_,_,_,_,_,_) ->
if (Db.VDI.get_on_boot ~__context ~self:vdi ==`reset) then
raise (Api_errors.Server_error(Api_errors.vdi_on_boot_mode_incompatable_with_operation, [Ref.string_of vdi]))) vdis) ;
raise (Api_errors.Server_error(Api_errors.vdi_on_boot_mode_incompatible_with_operation, [Ref.string_of vdi]))) vdis) ;

let snapshots_vdis = List.filter_map (vdi_filter true) snapshots_vbds in
let total_size = List.fold_left (fun acc (_,_,_,_,_,sz,_,_) -> Int64.add acc sz) 0L (vdis @ snapshots_vdis) in
Expand Down