iscsi: replace host targetcli with VM-based iSCSI target#1660
Draft
bruno-fs wants to merge 8 commits into
Draft
Conversation
The iscsi and iscsi-bind tests have been knownfailure since May 2018 because prepare() called targetcli on the host/container, requiring kernel modules unavailable in the container runner. Replace the local targetcli approach with a VM-based iSCSI target using QEMU mcast socket networking. The test is now fully self-contained — no kernel modules, no bridge networking, no special capabilities. Architecture: - Target VM: Fedora cloud image prepared with virt-customize (targetcli + sshd), boots with mcast socket NIC + SLIRP SSH NIC - Test VM: anaconda boots with mcast NIC (iSCSI) + SLIRP user NIC (internet for packages) - Both VMs join the same mcast group (230.0.0.1:PORT) with localaddr=127.0.0.1 The first run downloads and prepares a Fedora cloud image (~2-5 min). The base image is cached at /var/tmp/kstest-iscsi-cache/; subsequent runs create a qcow2 overlay (instant) and configure the target via SSH (~30s). Also adds iscsi-ordering test for INSTALLER-4044 (ignoredisk before iscsi command ordering bug). Related: INSTALLER-4044 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- CRITICAL: Use flock to serialize base image cache creation and PID- qualified temp files to prevent corruption from parallel cold-cache runs - HIGH: Fix broken virsh domstate error detection (was grepping stderr that was suppressed); use dominfo existence check instead - HIGH: Check virt-cat exit code; use .tmp + mv pattern to prevent empty RESULT file on extraction failure - HIGH: Log guestfish errors to guestfish.log instead of suppressing - MEDIUM: Fix anaconda log extraction directory nesting (copy to $disksdir/ not $disksdir/anaconda/) - MEDIUM: Increase target VM shutdown timeout from 30s to 60s - LOW: Fix iscsi-ordering.sh execute permission - LOW: Replace deprecated egrep with grep -E in all kickstart files Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The SSH retry loop suppresses all output, so a missing sshpass binary causes 120 silent iterations before timing out with a misleading "target VM did not become reachable" error. Add an explicit check at the start of create_iscsi_target_vm(). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This reverts commit bf8e718.
Contributor
Author
|
Full disclosure, this PR was cooked entirely on AI autonomously. All I did was
I still need to review/refine this... |
bruno-fs
commented
May 20, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace hardcoded Fedora 42 cloud image URL with dynamic lookup via getfedora.org releases API (falls back to KSTEST_ISCSI_TARGET_IMAGE env var) - Fix ShellCheck SC2155: split local declaration and assignment to avoid masking return values - Fix ShellCheck SC2034: annotate intentionally unused `initiator` parameter, rename loop variable `i` to `_retry` Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
bruno-fs
commented
May 20, 2026
Extract common iSCSI target setup (test ID sanitization, IQN construction, target VM creation, kickstart placeholder substitution) into _prepare_iscsi_target() in iscsi.sh. The iscsi-bind and iscsi-ordering variants now only add their extra sed substitutions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the python3 one-liner with jq for parsing getfedora.org releases.json — simpler, no python dependency in the shell path. Add jq to the kstest-runner Dockerfile. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
targetcliwith a VM-based iSCSI target using QEMU mcast socket networking, making the tests fully self-contained — no kernel modules, no bridge networking, no special capabilitiesknownfailuretag fromiscsiandiscsi-bindtests (disabled since May 2018)iscsi-orderingtest for INSTALLER-4044 (ignorediskbeforeiscsicommand ordering bug)How it works
A second tiny VM acts as the iSCSI disk server. Both VMs talk over a virtual network (QEMU multicast sockets on
localaddr=127.0.0.1). On first run, a Fedora cloud image is downloaded and prepared withvirt-customize(targetcli + sshd), then cached. Subsequent runs create a qcow2 overlay and configure the target via SSH (~30s setup).After installation, the target VM is shut down and RESULT is extracted from the iSCSI backing store via
guestfishon the host side.Test plan
iscsitest passes in devcontainer (run_kickstart_tests.sh)iscsitest passes in kstest-runner container (containers/runner/launch)keyboardsmoke test unaffectediscsi-bindtestiscsi-orderingtest/kickstart-test iscsiRelated: INSTALLER-4044