Skip to content
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

targetcli could use a systemd service file #152

Open
gonzoleeman opened this issue Oct 10, 2019 · 2 comments
Open

targetcli could use a systemd service file #152

gonzoleeman opened this issue Oct 10, 2019 · 2 comments

Comments

@gonzoleeman
Copy link
Contributor

Targetcli can use the "service" concept of systemd to ensure it's configuration is restored at startup tie and cleared at shutdown time. It can also be handy for other services to be able to sequence themselves before or after targetcli is usable.

For example, openSUSE is using:

[Unit]
Description="Generic Target-Mode Service (fb)"
DefaultDependencies=No
After=network.target target.service
Before=remote-fs-pre.target

[Service]
Type=oneshot
Environment=CONFIG_FILE=/etc/target/saveconfig.json
EnvironmentFile=-/etc/sysconfig/targetcli
ExecStart=-/usr/bin/targetcli restoreconfig $CONFIG_FILE
RemainAfterExit=true
ExecStop=/usr/bin/targetcli clearconfig confirm=True
ExecReload=/usr/bin/targetcli restoreconfig $CONFIG_FILE clearexisting

[Install]
WantedBy=remote-fs.target

This not only manages targetcli configuration, but it also allows overriding the configuration file

@pkalever
Copy link
Contributor

@gonzoleeman
Copy link
Contributor Author

gonzoleeman commented Oct 23, 2019

@gonzoleeman have you came across https://github.com/open-iscsi/rtslib-fb/blob/master/systemd/target.service ?

This is what we use at gluster, https://github.com/gluster/gluster-block/blob/master/systemd/gluster-block-target.service.in

No, I was not familiar with that. Interesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants