iscsi: make setup idempotent to tolerate stale state - #19
Conversation
|
before fix: (34/47) type_specific.io-github-autotest-libvirt.virsh.pool_acl.positive_test.non_dir_pool.pool_type_iscsi.undefine_acl.acl_test: ERROR: Command 'targetcli /backstores/fileio/ create device.emulated-iscsi /home/kvmci/tests/data/avocado-vt/emulated-iscsi' failed.\nstdout: b''\nstderr: b'storage object for /home/kvmci/tests/data/avocado-vt/emulated-iscsi already exists: device.emulated-iscsi\n... (19.27 s) logs after fix-- |
27fe4c2 to
348b1dc
Compare
49adb6b to
e054db5
Compare
Handle leftover iSCSI state from unclean runs by reusing existing
resources instead of failing.
- Treat iscsiadm exit 15 (session exists) as success
- Fix target detection regex to correctly match existing IQN
- Initialise file_exists to avoid UnboundLocalError
- Reuse existing backstore objects on "already exists"
- Treat configFS "already exists" target as reusable
v2:
rescan session on exit 15 to restore missing devices
On iscsiadm exit code 15 ("session already exists"), do not treat it as
a no-op success. A stale session may exist without the corresponding
block devices due to an unclean previous teardown.
Trigger `iscsiadm --mode session --rescan` in this case to force the
kernel to re-probe the target and re-create any missing devices, then
proceed as successful login.
This makes setup robust against partially torn-down sessions.
Signed-off-by: Sneh Shikha Yadav <syadav@linux.ibm.com>
348b1dc to
4040e18
Compare
Handle leftover iSCSI state from unclean runs by reusing existing resources instead of failing.
Signed-off-by: Sneh Shikha Yadav syadav@linux.ibm.com