-
-
Notifications
You must be signed in to change notification settings - Fork 15k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NixOS: services.{openiscsi, target}, boot.iscsi-initiator: init #115590
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm probably mostly complaining about my own code here and reviewing that is kind of awkward, but it's probably been long enough that I don't remember much of it.
|
||
postMountCommands = '' | ||
ln -sfn /nix/var/nix/profiles/system/init /mnt-root/init | ||
stage2Init=/init |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might not want to do that. Or do you? Hm. Ah, I remember why I implemented this: The problem is that, normally you get the stage2Init
from the initrd. The problem is, that you're probably network booting and if you deploy the system and reboot, you want the system that you deployed and not what the server that serves the initrd has.
Anyways, this is kind of weird for that reason and might confuse users, if they do want to start the system defined in the initrd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm. Good point, I don't want this. My use case is actually where only /nix is on iscsi and an initrd is on the disk itself. I'll look at this further.
type = attrs; | ||
default = {}; | ||
description = '' | ||
Content of /etc/target/saveconfig.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no documentation for the contents of this file and the format is kind of strange. The parse is also handwritten in python. Not sure if that should be mentioned here, but this description isn't too helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did you come up with the data in the test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used targetcli and cut as much away from the config it generates as I could, without it breaking.
nixos/tests/iscsi-root.nix
Outdated
|
||
services.openiscsi = { | ||
enable = true; | ||
name = initiatorName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need to be set, does it? Why can this even be set? Shouldn't this conflict with https://github.com/NixOS/nixpkgs/pull/115590/files#diff-ac6c7fcd6eac914a135de918524bd345db855c25ac7563fe066cf2a550182544R126? Maybe not, because it's being set to the same value?
a8a2892
to
1b92dde
Compare
I've pushed some WIP commits for password support, I'm marking this PR as WIP for now. |
This should probably support multiple targets. |
Just a small user report: I was looking for a module to help set up iscsi and found this and tried it out. I rebased it on nixos-20.09. I'm doing the simplest possible thing: starting an initiator for one remote volume, manually, not at boot time (so only using If I may make the smallest nitpick: |
6092f26
to
f08bd45
Compare
Co-authored-by: Graham Christensen <graham@floxdev.com>
Co-authored-by: Graham Christensen <graham@floxdev.com>
Co-authored-by: Graham Christensen <graham@floxdev.com>
Co-authored-by: Graham Christensen <graham@floxdev.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good enough for me, I think
Some questions here if you don't mind. I have a similar use case so I cherry-picked those modules to 20.09.
services.openiscsi = {
enable = true;
enableAutoLoginOut = true;
discoverPortal = "10.77.1.119";
name = "iqn.2021-05.org.linux-iscsi.initiatorhost:laborfactory";
}; And the $ systemctl status iscsid.service
● iscsid.service
Loaded: bad-setting (Reason: Unit iscsid.service has a bad unit file setting.)
Active: inactive (dead)
TriggeredBy: ● iscsid.socket Do you have any suggetions on how to debug? My attempt so far was to locate the unit file by $ systemctl show -p FragmentPath iscsid.service
FragmentPath=/nix/store/ly6smc6spj2qncrck9sb9kh8kmmwgcpi-unit-iscsid.service/iscsid.service And the unit file looks like:
Thanks! Just FYI, when I ran the following command: $ sudo iscsiadm --mode discoverydb --type sendtargets --portal 10.77.1.119 --discover
[sudo] password for breakds:
iscsiadm: iscsid is not running. Could not start it up automatically using the startup command in the /etc/iscsi/iscsid.conf iscsid.startup setting. Please check that the file exists or that your init scripts have started iscsid.
iscsiadm: can not connect to iSCSI daemon (111)!
iscsiadm: Cannot perform discovery. Initiatorname required.
iscsiadm: Could not perform SendTargets discovery: could not connect to iscsid It complains about not being able to connect to iSCSI daemon, which I believe it means |
Motivation for this change
I'm deploying some machines using iscsi to host / and /nix, found these modules in #101015 via @ajs124. I took their work plus some additional patches they hadn't pushed, and fixed up the tests.
Includes #115584
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)