Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ocaml/xapi/xapi_host.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2790,6 +2790,7 @@ let set_uefi_certificates ~__context ~host:_ ~value:_ =
let set_iscsi_iqn ~__context ~host ~value =
if value = "" then
raise Api_errors.(Server_error (invalid_value, ["value"; value])) ;
D.debug "%s: iqn=%S" __FUNCTION__ value ;
(* Note, the following sequence is carefully written - see the
other-config watcher thread in xapi_host_helpers.ml *)
Db.Host.remove_from_other_config ~__context ~self:host ~key:"iscsi_iqn" ;
Expand Down
4 changes: 4 additions & 0 deletions ocaml/xapi/xapi_host_helpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,13 @@ module Configuration = struct
[iqn; hostname_chopped]

let set_initiator_name iqn =
if iqn = "" then
raise Api_errors.(Server_error (invalid_value, ["iqn"; iqn])) ;
let hostname = Unix.gethostname () in
(* CA-377454 - robustness, create dir if necessary *)
Unixext.mkdir_rec "/var/lock/sm/iscsiadm" 0o700 ;
let args = make_set_initiator_args iqn hostname in
D.debug "%s: iqn=%S" __FUNCTION__ iqn ;
ignore (Helpers.call_script !Xapi_globs.set_iSCSI_initiator_script args)

let set_multipathing enabled =
Expand Down Expand Up @@ -541,6 +544,7 @@ module Configuration = struct
| Some "" ->
()
| Some iqn when iqn <> host_rec.API.host_iscsi_iqn ->
D.debug "%s: iqn=%S" __FUNCTION__ iqn ;
Client.Client.Host.set_iscsi_iqn ~rpc ~session_id ~host:host_ref
~value:iqn
| _ ->
Expand Down
Loading