Skip to content

Commit

Permalink
CA-397268: vbd.create failed: The device name is invalid
Browse files Browse the repository at this point in the history
In the commit 62db5cb, the device name validation was consolidated with
the function which converts name to device number. Particularly, the
function "Device_number.of_string" is used for both the validation and
the conversion.

But one issue was introduced in the validation is that the "None" value
returned from "Device_number.of_string" is considered as valid. This
causes the error "the device name is invalid".

This commit just fixes this issue.

Signed-off-by: Ming Lu <[email protected]>
  • Loading branch information
minglumlu authored and lindig committed Aug 14, 2024
1 parent 09fe917 commit ce24e0a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ocaml/xapi/xapi_vbd_helpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ let clear_current_operations ~__context ~self =
(** Check if the device string has the right form *)
let valid_device dev ~_type =
dev = "autodetect"
|| Option.is_none (Device_number.of_string dev ~hvm:false)
|| Option.is_some (Device_number.of_string dev ~hvm:false)
||
match _type with
| `Floppy ->
Expand Down

0 comments on commit ce24e0a

Please sign in to comment.