Skip to content

Commit 4d32d77

Browse files
authored
xapi-cli-server: set name description for SRs, when given (8.3) (#7067)
Previously the parameter was ignored and this was confusing users that expected the parameter to be used. (cherry picked from commit 19b0ea2)
2 parents 96fc621 + e3ff1b2 commit 4d32d77

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

ocaml/xapi-cli-server/cli_frontend.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2240,7 +2240,8 @@ let rec cmdtable_data : (string * cmd_spec) list =
22402240
reqd= ["name-label"; "type"]
22412241
; optn=
22422242
[
2243-
"host-uuid"
2243+
"name-description"
2244+
; "host-uuid"
22442245
; "device-config:"
22452246
; "shared"
22462247
; "physical-size"
@@ -2292,7 +2293,7 @@ let rec cmdtable_data : (string * cmd_spec) list =
22922293
; ( "sr-introduce"
22932294
, {
22942295
reqd= ["name-label"; "type"; "uuid"]
2295-
; optn= ["shared"; "content-type"]
2296+
; optn= ["name-description"; "shared"; "content-type"]
22962297
; help= "Introduces an SR (but does not create any PBDs)."
22972298
; implementation= No_fd Cli_operations.sr_introduce
22982299
; flags= []

ocaml/xapi-cli-server/cli_operations.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2573,6 +2573,7 @@ let parse_host_uuid ?(default_master = true) rpc session_id params =
25732573
25742574
let sr_create fd _printer rpc session_id params =
25752575
let name_label = List.assoc "name-label" params in
2576+
let name_description = Listext.assoc_default "name-description" params "" in
25762577
let shared = get_bool_param params "shared" in
25772578
let host = parse_host_uuid ~default_master:shared rpc session_id params in
25782579
let physical_size =
@@ -2607,21 +2608,21 @@ let sr_create fd _printer rpc session_id params =
26072608
let sm_config = read_map_params "sm-config" params in
26082609
let sr =
26092610
Client.SR.create ~rpc ~session_id ~host ~device_config ~name_label
2610-
~name_description:"" ~physical_size ~_type ~content_type ~shared
2611-
~sm_config
2611+
~name_description ~physical_size ~_type ~content_type ~shared ~sm_config
26122612
in
26132613
let sr_uuid = Client.SR.get_uuid ~rpc ~session_id ~self:sr in
26142614
marshal fd (Command (Print sr_uuid))
26152615
26162616
let sr_introduce printer rpc session_id params =
26172617
let name_label = List.assoc "name-label" params in
2618+
let name_description = Listext.assoc_default "name-description" params "" in
26182619
let _type = List.assoc "type" params in
26192620
let content_type = Listext.assoc_default "content-type" params "" in
26202621
let uuid = List.assoc "uuid" params in
26212622
let shared = get_bool_param params "shared" in
26222623
let sm_config = read_map_params "sm-config" params in
26232624
let _ =
2624-
Client.SR.introduce ~rpc ~session_id ~uuid ~name_label ~name_description:""
2625+
Client.SR.introduce ~rpc ~session_id ~uuid ~name_label ~name_description
26252626
~_type ~content_type ~shared ~sm_config
26262627
in
26272628
printer (Cli_printer.PList [uuid])

0 commit comments

Comments
 (0)