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

feat: rework iscsi-tools #577

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
13 changes: 7 additions & 6 deletions storage/iscsi-tools/iscsid-wrapper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@ func main() {

cmd.Stdout = &cmdOut

if _, err := os.Stat("/etc/iscsi/initiatorname.iscsi"); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how would this work on upgrades? if there already was a name provided?

if _, err := os.Stat("/system/etc/iscsi/initiatorname.iscsi"); err != nil {
if errors.Is(err, os.ErrNotExist) {
log.Println("iscsid-wrapper: /etc/iscsi/initiatorname.iscsi does not exist, creating")
log.Println("iscsid-wrapper: /system/etc/iscsi/initiatorname.iscsi does not exist, creating")

if err := cmd.Run(); err != nil {
log.Printf("iscsi-iname: error generating iscsi initiatorname %v\n", err)
log.Fatalf("iscsi-iname: error generating iscsi initiatorname %v\n", err)
}

initiatorName := fmt.Sprintf("InitiatorName=%s", cmdOut.String())
log.Printf("iscsid-wrapper: writing %s to /etc/iscsi/initiatorname.iscsi", initiatorName)
log.Printf("iscsid-wrapper: writing %s to /system/etc/iscsi/initiatorname.iscsi", initiatorName)

if err := os.WriteFile("/etc/iscsi/initiatorname.iscsi", []byte(initiatorName), 0o644); err != nil {
log.Printf("iscsi-iname: error saving iscsi initiatorname %v\n", err)
if err := os.WriteFile("/system/etc/iscsi/initiatorname.iscsi", []byte(initiatorName), 0o644); err != nil {
log.Fatalf("iscsi-iname: error saving iscsi initiatorname %v\n", err)
}
}
}
Expand Down
17 changes: 2 additions & 15 deletions storage/iscsi-tools/iscsid.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: iscsid
depends:
- service: cri
- service: ext-tgtd
- network:
- addresses
- connectivity
Expand Down Expand Up @@ -42,25 +41,13 @@ container:
- bind
- ro
# persistent storage for iscsi
- source: /system/iscsi
destination: /etc/iscsi
- source: /system/etc/iscsi
destination: /system/etc/iscsi
type: bind
options:
- rshared
- rbind
- rw
- source: /usr/local/etc/iscsi/iscsid.conf
destination: /etc/iscsi/iscsid.conf
type: bind
options:
- bind
- ro
- source: /usr/local/etc/passwd
destination: /etc/passwd
type: bind
options:
- bind
- ro
- source: /var/lib/iscsi
destination: /var/lib/iscsi
type: bind
Expand Down
1 change: 0 additions & 1 deletion storage/iscsi-tools/open-iscsi/files/passwd

This file was deleted.

12 changes: 5 additions & 7 deletions storage/iscsi-tools/open-iscsi/pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ dependencies:
- image: "{{ .BUILD_ARG_PKGS_PREFIX }}/kmod:{{ .BUILD_ARG_PKGS }}"
- image: "{{ .BUILD_ARG_PKGS_PREFIX }}/openssl:{{ .BUILD_ARG_PKGS }}"
- image: "{{ .BUILD_ARG_PKGS_PREFIX }}/util-linux:{{ .BUILD_ARG_PKGS }}"
- stage: open-isns
from: /rootfs
steps:
- sources:
- url: https://github.com/open-iscsi/open-iscsi/archive/refs/tags/{{ .OPEN_ISCSI_VERSION }}.tar.gz
Expand Down Expand Up @@ -49,10 +47,11 @@ steps:
meson setup \
-Db_lto=true \
-Dno_systemd=true \
-Disns=disabled \
-Dhomedir=/system/etc/iscsi \
-Dprefix=/usr/local \
-Discsi_sbindir=/usr/local/sbin \
-Drulesdir=/usr/lib/udev/rules.d \
-Dc_args="$CFLAGS -I/usr/local/include -DNO_SYSTEMD -DGLOB_ONLYDIR=0" \
output

ninja -C output
Expand All @@ -63,10 +62,9 @@ steps:

# cleanup
# we generate a one time initiatorname.iscsi when the iscsid-wrapper starts.
rm -rf /rootfs/usr/local/{etc/iscsi/initiatorname.iscsi,share,include,pkgconfig}
rm -rf /rootfs/var/lib/iscsi

cp /pkg/files/passwd /rootfs/usr/local/etc/passwd
rm -rf /rootfs/system
rm -rf /rootfs/usr/local/{etc,share,include,pkgconfig}
rm -rf /rootfs/var
finalize:
- from: /rootfs
to: /rootfs
45 changes: 0 additions & 45 deletions storage/iscsi-tools/open-isns/pkg.yaml

This file was deleted.

5 changes: 1 addition & 4 deletions storage/iscsi-tools/pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ dependencies:
# `base` dependency is used for doing cleanups
# not copied to rootfs
- stage: base
- stage: open-isns
- stage: open-iscsi
- stage: tgt
- stage: iscsid-wrapper
steps:
- install:
- |
mkdir -p /rootfs/usr/local/lib/containers/{iscsid,tgtd}
mkdir -p /rootfs/usr/local/lib/containers/iscsid

sed -i 's#$VERSION#{{ .VERSION }}#' /pkg/manifest.yaml

Expand All @@ -23,7 +21,6 @@ steps:
mkdir -p /rootfs/usr/local/etc/containers

cp /pkg/iscsid.yaml /rootfs/usr/local/etc/containers/iscsid.yaml
cp /pkg/tgtd.yaml /rootfs/usr/local/etc/containers/tgtd.yaml
test:
- |
mkdir -p /extensions-validator-rootfs
Expand Down
25 changes: 0 additions & 25 deletions storage/iscsi-tools/tgt/musl.patch

This file was deleted.

28 changes: 0 additions & 28 deletions storage/iscsi-tools/tgt/pkg.yaml

This file was deleted.

43 changes: 0 additions & 43 deletions storage/iscsi-tools/tgtd.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion storage/iscsi-tools/vars.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION: v0.1.6
VERSION: v0.2.0
# renovate: datasource=github-tags depName=open-iscsi/open-iscsi
OPEN_ISCSI_VERSION: 2.1.10
# renovate: datasource=github-tags extractVersion=^v(?<version>.*)$ depName=open-iscsi/open-isns
Expand Down