1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 12:46:49 +00:00

test: a LUN of an iSCSI pool attaches live as a block disk

The Vagrant computes serve a 1 GiB LUN on 127.0.0.1 (targetcli). A live
test, run with TEST_LIBVIRT_ISCSI_TARGET, starts a transient iSCSI pool
on it and attaches the LUN from the VM page to a stopped and a running
VM: both definitions get a raw block disk on its /dev/disk/by-path link.
This commit is contained in:
catborise 2026-10-18 14:03:46 +03:00
parent c46212bb38
commit 8d175bbd54
3 changed files with 121 additions and 3 deletions

15
Vagrantfile vendored
View file

@ -2,7 +2,8 @@
# that migration runs between them: AlmaLinux 10 with nested KVM, set up by
# dev/libvirt-bootstrap.sh, with a SASL user for TCP and the host user's SSH
# key for root (SASL user wvc, password wvc-test). The empty second disk
# /dev/vdb is for the LVM tests (TEST_LIBVIRT_LVM_DEVICE).
# /dev/vdb is for the LVM tests (TEST_LIBVIRT_LVM_DEVICE); each also serves a
# 1 GiB iSCSI LUN on 127.0.0.1 for the iSCSI tests (TEST_LIBVIRT_ISCSI_TARGET).
Vagrant.configure(2) do |config|
config.vm.box = "almalinux/10"
@ -29,5 +30,17 @@ Vagrant.configure(2) do |config|
echo wvc-test | saslpasswd2 -a libvirt -p wvc
install -d -m 700 /root/.ssh
cat /tmp/wvc/key.pub >> /root/.ssh/authorized_keys
dnf -y install targetcli
systemctl enable --now target
T=iqn.2026-10.test.wvc:lun
targetcli ls /iscsi/$T > /dev/null 2>&1 || {
targetcli /backstores/fileio create wvc /var/lib/wvc-iscsi.img 1G
targetcli /iscsi create $T
targetcli /iscsi/$T/tpg1/portals delete 0.0.0.0 3260
targetcli /iscsi/$T/tpg1/portals create 127.0.0.1 3260
targetcli /iscsi/$T/tpg1/luns create /backstores/fileio/wvc
targetcli /iscsi/$T/tpg1 set attribute generate_node_acls=1 demo_mode_write_protect=0
targetcli saveconfig
}
SHELL
end