mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-02 13:00:23 +00:00
nixos/iscsi-initiator: add option discoverType (#518475)
This commit is contained in:
@@ -20,6 +20,24 @@ in
|
||||
default = null;
|
||||
description = "Portal to discover targets on";
|
||||
};
|
||||
|
||||
discoverType = mkOption {
|
||||
description = ''
|
||||
Target discovery type.
|
||||
Change this if you want to discover your targes via an iSNS server
|
||||
or use the targets provided via firmware settings.
|
||||
See {manpage}`iscsiadm(8)`.
|
||||
'';
|
||||
default = "sendtargets";
|
||||
example = "sendtargets";
|
||||
type = enum [
|
||||
"st"
|
||||
"sendtargets"
|
||||
"isns"
|
||||
"fw"
|
||||
];
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
type = str;
|
||||
description = "Name of this iscsi initiator";
|
||||
@@ -81,7 +99,7 @@ in
|
||||
wantedBy = [ "remote-fs.target" ];
|
||||
serviceConfig.ExecStartPre =
|
||||
mkIf (cfg.discoverPortal != null)
|
||||
"${cfg.package}/bin/iscsiadm --mode discoverydb --type sendtargets --portal ${escapeShellArg cfg.discoverPortal} --discover";
|
||||
"${cfg.package}/bin/iscsiadm --mode discoverydb --type ${cfg.discoverType} --portal ${escapeShellArg cfg.discoverPortal} --discover";
|
||||
};
|
||||
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
@@ -43,6 +43,23 @@ in
|
||||
type = nullOr str;
|
||||
};
|
||||
|
||||
discoverType = mkOption {
|
||||
description = ''
|
||||
Target discovery type.
|
||||
Change this if you want to discover your targes via an iSNS server
|
||||
or use the targets provided via firmware settings.
|
||||
See {manpage}`iscsiadm(8)`.
|
||||
'';
|
||||
default = "sendtargets";
|
||||
example = "sendtargets";
|
||||
type = enum [
|
||||
"st"
|
||||
"sendtargets"
|
||||
"isns"
|
||||
"fw"
|
||||
];
|
||||
};
|
||||
|
||||
target = mkOption {
|
||||
description = ''
|
||||
Name of the iSCSI target to boot from.
|
||||
@@ -168,7 +185,7 @@ in
|
||||
|
||||
iscsid --foreground --no-pid-file --debug ${toString cfg.logLevel} &
|
||||
iscsiadm --mode discoverydb \
|
||||
--type sendtargets \
|
||||
--type ${cfg.discoverType} \
|
||||
--discover \
|
||||
--portal ${escapeShellArg cfg.discoverPortal} \
|
||||
--debug ${toString cfg.logLevel}
|
||||
|
||||
Reference in New Issue
Block a user