Skip to content

Commit 00576e1

Browse files
CA-187693: Make logging of VDI to SR mapping more consistent
Signed-off-by: Si Beaumont <[email protected]>
1 parent 1497638 commit 00576e1

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

ocaml/xapi/xapi_vm_migrate.ml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -423,21 +423,28 @@ let migrate_send' ~__context ~vm ~dest ~live ~vdi_map ~vif_map ~options =
423423
TaskHelper.exn_if_cancelling ~__context;
424424
let open Storage_access in
425425
let dest_sr_ref =
426+
let log_prefix =
427+
Printf.sprintf "Resolving VDI->SR map for VDI %s:" (Db.VDI.get_uuid ~__context ~self:vdi) in
426428
match List.mem_assoc vdi vdi_map, List.mem_assoc snapshot_of vdi_map with
427429
| true, _ ->
428-
debug "VDI has been specified in the vdi_map";
430+
debug "%s VDI has been specified in the map" log_prefix;
429431
List.assoc vdi vdi_map
430432
| false, true ->
431-
debug "snapshot VDI's snapshot_of has been specified in the vdi_map";
433+
debug "%s Snapshot VDI has entry in map for it's snapshot_of link" log_prefix;
432434
List.assoc snapshot_of vdi_map
433435
| false, false ->
434436
begin match List.mem vconf suspends_vdis, suspend_sr_ref <> Ref.null, default_sr_ref <> Ref.null with
435-
| true, true, _ -> suspend_sr_ref
436-
| true, false, true
437-
| false, _, true -> default_sr_ref
437+
| true, true, _ ->
438+
debug "%s Mapping suspend VDI to remote suspend SR" log_prefix;
439+
suspend_sr_ref
440+
| true, false, true ->
441+
debug "%s Remote suspend SR not set, mapping suspend VDI to remote default SR" log_prefix;
442+
default_sr_ref
443+
| false, _, true ->
444+
debug "Mapping unspecified VDI to remote default SR";
445+
default_sr_ref
438446
| _ ->
439-
let vdi_uuid = Db.VDI.get_uuid ~__context ~self:vdi in
440-
error "VDI:SR map not fully specified for VDI %s" vdi_uuid;
447+
error "%s VDI not in VDI->SR map and no remote default SR is set" log_prefix;
441448
raise (Api_errors.Server_error(Api_errors.vdi_not_in_map, [ Ref.string_of vdi ]))
442449
end
443450
in

0 commit comments

Comments
 (0)