Skip to content

Commit 42e8478

Browse files
committed
CA-88840:User Friendly error message when cross/intrapool migration fails
Signed-off-by: Akshay Ramani <[email protected]>
1 parent 8b46fb8 commit 42e8478

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

ocaml/idl/api_errors.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,3 +462,4 @@ let vm_has_checkpoint = "VM_HAS_CHECKPOINT"
462462

463463
let mirror_failed = "MIRROR_FAILED"
464464
let too_many_storage_migrates = "TOO_MANY_STORAGE_MIGRATES"
465+
let unimplemented_in_sm_backend = "UNIMPLEMENTED_IN_SM_BACKEND"

ocaml/idl/datamodel.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,8 @@ let _ =
410410
~doc:"You attempted an operation that was explicitly blocked (see the blocked_operations field of the given object)." ();
411411
error Api_errors.not_implemented ["function"]
412412
~doc:"The function is not implemented" ();
413-
413+
error Api_errors.unimplemented_in_sm_backend ["message"]
414+
~doc:"You have attempted a function which is not implemented" ();
414415
(* DB errors *)
415416
error Api_errors.handle_invalid ["class"; "handle"]
416417
~doc:"You gave an invalid object reference. The object may have recently been deleted. The class parameter gives the type of reference given, and the handle parameter echoes the bad value given." ();

ocaml/xapi/storage_migrate.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,8 @@ let wrap ~dbg f =
651651
| Backend_error(code, params)
652652
| Api_errors.Server_error(code, params) ->
653653
raise (Backend_error(code, params))
654-
| e ->
654+
| Unimplemented msg -> raise (Unimplemented msg)
655+
| e ->
655656
raise (Internal_error(Printexc.to_string e))) in
656657
let _ = Thread.create
657658
(Debug.with_thread_associated dbg (fun () ->

ocaml/xapi/xapi_vm_migrate.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,7 @@ let migrate_send' ~__context ~vm ~dest ~live ~vdi_map ~vif_map ~options =
536536
TaskHelper.exn_if_cancelling ~__context;
537537
begin match e with
538538
| Storage_interface.Backend_error(code, params) -> raise (Api_errors.Server_error(code, params))
539+
| Storage_interface.Unimplemented(code) -> raise (Api_errors.Server_error(Api_errors.unimplemented_in_sm_backend, [code]))
539540
| _ -> raise e
540541
end
541542

0 commit comments

Comments
 (0)