From 9930e5893b8a53aeb49811f877b147b6143e53ab Mon Sep 17 00:00:00 2001 From: Akshay Ramani Date: Thu, 4 Jul 2013 07:35:39 +0100 Subject: [PATCH 1/3] CA-58172:Better text for VDI_ON_BOOT_MODE_INCOMPATABLE_WITH_OPERATION error Signed-off-by: Akshay Ramani --- ocaml/idl/datamodel.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ocaml/idl/datamodel.ml b/ocaml/idl/datamodel.ml index d905b30f2e7..3d3c97bd716 100644 --- a/ocaml/idl/datamodel.ml +++ b/ocaml/idl/datamodel.ml @@ -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_incompatable_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." (); From fbf7d580dab19154ee0009c491aa60113ee3884e Mon Sep 17 00:00:00 2001 From: Akshay Ramani Date: Thu, 4 Jul 2013 10:03:08 +0100 Subject: [PATCH 2/3] Correct the spelling of vdi_on_boot_mode_incompatable_with_operation --- ocaml/idl/api_errors.ml | 2 +- ocaml/idl/datamodel.ml | 2 +- ocaml/xapi/xapi_vdi.ml | 2 +- ocaml/xapi/xapi_vm_lifecycle.ml | 4 ++-- ocaml/xapi/xapi_vm_migrate.ml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ocaml/idl/api_errors.ml b/ocaml/idl/api_errors.ml index 334f6130016..d0a7c7320be 100644 --- a/ocaml/idl/api_errors.ml +++ b/ocaml/idl/api_errors.ml @@ -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" let vdi_not_in_map = "VDI_NOT_IN_MAP" let cannot_create_state_file = "CANNOT_CREATE_STATE_FILE" diff --git a/ocaml/idl/datamodel.ml b/ocaml/idl/datamodel.ml index 3d3c97bd716..709be312f65 100644 --- a/ocaml/idl/datamodel.ml +++ b/ocaml/idl/datamodel.ml @@ -890,7 +890,7 @@ let _ = ~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" (); - error Api_errors.vdi_on_boot_mode_incompatable_with_operation [] + 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." (); diff --git a/ocaml/xapi/xapi_vdi.ml b/ocaml/xapi/xapi_vdi.ml index 376c3ead7b1..07d2743fa75 100644 --- a/ocaml/xapi/xapi_vdi.ml +++ b/ocaml/xapi/xapi_vdi.ml @@ -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)."]) diff --git a/ocaml/xapi/xapi_vm_lifecycle.ml b/ocaml/xapi/xapi_vm_lifecycle.ml index de51b5d777e..a9653b2871f 100644 --- a/ocaml/xapi/xapi_vm_lifecycle.ml +++ b/ocaml/xapi/xapi_vm_lifecycle.ml @@ -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 diff --git a/ocaml/xapi/xapi_vm_migrate.ml b/ocaml/xapi/xapi_vm_migrate.ml index ec0d511fdf5..6c10b8b0df8 100644 --- a/ocaml/xapi/xapi_vm_migrate.ml +++ b/ocaml/xapi/xapi_vm_migrate.ml @@ -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 From 2b113103ba55d4627c9c4ff58c9e83a9afcc7ba0 Mon Sep 17 00:00:00 2001 From: Akshay Ramani Date: Fri, 5 Jul 2013 05:34:30 +0100 Subject: [PATCH 3/3] Fix spelling --- ocaml/idl/api_errors.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocaml/idl/api_errors.ml b/ocaml/idl/api_errors.ml index d0a7c7320be..4bc1d1bf9d5 100644 --- a/ocaml/idl/api_errors.ml +++ b/ocaml/idl/api_errors.ml @@ -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_incompatible_with_operation = "VDI_ON_BOOT_MODE_INCOMPATABLE_WITH_OPERATION" +let vdi_on_boot_mode_incompatible_with_operation = "VDI_ON_BOOT_MODE_INCOMPATIBLE_WITH_OPERATION" let vdi_not_in_map = "VDI_NOT_IN_MAP" let cannot_create_state_file = "CANNOT_CREATE_STATE_FILE"