From ce24e0a8fbbab5e84a2c0a380ba22e1d6bdf67a3 Mon Sep 17 00:00:00 2001 From: Ming Lu Date: Tue, 13 Aug 2024 16:47:12 +0800 Subject: [PATCH] CA-397268: vbd.create failed: The device name is invalid 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 --- ocaml/xapi/xapi_vbd_helpers.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocaml/xapi/xapi_vbd_helpers.ml b/ocaml/xapi/xapi_vbd_helpers.ml index 1285c740c27..94471108e41 100644 --- a/ocaml/xapi/xapi_vbd_helpers.ml +++ b/ocaml/xapi/xapi_vbd_helpers.ml @@ -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 ->