Add lioadm cinder iscsi helper support
The Linux-IO is a modern way of handling targets.
Per the IRC discussions lioadm as default
seams like a better default for everyone, for now it will be
optional, but the tgtadm admin support expected to be removed when
lioadm works well with all CI (including third party).
Change-Id: Ia54c59914c1d3ff2ef5f00ecf819426bc448d0a9
diff --git a/lib/lvm b/lib/lvm
index d0322c7..519e82c 100644
--- a/lib/lvm
+++ b/lib/lvm
@@ -108,15 +108,20 @@
if is_fedora || is_suse; then
# services is not started by default
start_service lvm2-lvmetad
- start_service tgtd
+ if [ "$CINDER_ISCSI_HELPER" = "tgtadm" ]; then
+ start_service tgtd
+ fi
fi
# Start with a clean volume group
_create_lvm_volume_group $vg $size
# Remove iscsi targets
- sudo tgtadm --op show --mode target | grep Target | cut -f3 -d ' ' | sudo xargs -n1 tgt-admin --delete || true
-
+ if [ "$CINDER_ISCSI_HELPER" = "lioadm" ]; then
+ sudo cinder-rtstool get-targets | sudo xargs -rn 1 cinder-rtstool delete
+ else
+ sudo tgtadm --op show --mode target | grep Target | cut -f3 -d ' ' | sudo xargs -n1 tgt-admin --delete || true
+ fi
_clean_lvm_volume_group $vg
}