Skip to content

Commit 1a14b55

Browse files
committed
fixup! Allow selection of image format during VM migration
1 parent b4aa82e commit 1a14b55

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ocaml/xapi/xapi_vm_migrate.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,16 @@ let assert_vdi_format_is_supported ~__context ~vdi_map ~vdi_format_map =
245245
Db.SM.get_refs_where ~__context
246246
~expr:(Eq (Field "type", Literal sr_type))
247247
in
248+
(* We expect that one sr_type matches one sm_ref *)
248249
match sm_refs with
249250
| [sm_ref] ->
250251
debug "GTNDEBUG: read vdi %s, sr %s. Type is %s" vdi_uuid sr_uuid
251252
ty ;
252253
let sm_formats =
253254
Db.SM.get_supported_image_formats ~__context ~self:sm_ref
254255
in
255-
if sm_formats <> [] && not (List.mem ty sm_formats) then
256+
if ty <> "" && sm_formats <> [] && not (List.mem ty sm_formats)
257+
then
256258
raise
257259
Api_errors.(
258260
Server_error
@@ -271,7 +273,7 @@ let assert_vdi_format_is_supported ~__context ~vdi_map ~vdi_format_map =
271273
, [
272274
Printf.sprintf
273275
"Found more than one SM ref (%d) when checking type \
274-
(%s)of VDI."
276+
(%s) of VDI."
275277
(List.length sm_refs) ty
276278
]
277279
)

0 commit comments

Comments
 (0)