User Tools

Site Tools


Sidebar

software:iscsi:virsh_iscsi_vm

defining virsh iscsi pools

How to use iscsi to store virtual machines?

  • requires already setup iscsi target
cat >/root/iscsi_target.xml<<EOT
<pool type='iscsi'>
    <name>iscsi_target</name>
    <source>
        <host name='192.168.4.1'/>
        <device path='iqn.2009-11.com.example:storage.disk1'/>
    </source>
    <target>
        <path>/dev/disk/by-path</path>
    </target>
</pool>
EOT

pool-define /root/iscsi_target.xml

# shows the pool as inactive:
pool-list --all

pool-start iscsi_target
vol-list iscsi_target
vol-info /dev/disk/by-path/ip-192.168.4.1:3260-iscsi-iqn.2009-11.com.example:storage.disk1-lun-1
vol-dumpxml /dev/disk/by-path/ip-192.168.4.1:3260-iscsi-iqn.2009-11.com.example:storage.disk1-lun-1
pool-autostart iscsi_target

using virsh iscsi pool

virt-install -n $HOSTNAME -r 1024 --cpu host --disk vol=iscsi_target/unit:0:0:1 \
        --location /mnt/store/cobbler/x86_64/$DISTRO/  \
        --vcpus 2 -w bridge=virbr0 --os-variant rhel5.4 --graphics vnc \
        --extra-args "ip=$IPADDR netmask=255.255.255.0 ks=http://192.168.4.1/ks/$HOSTNAME repo=http://192.168.4.1/x86_64/$DISTRO"
software/iscsi/virsh_iscsi_vm.txt ยท Last modified: 2021/03/23 12:22 (external edit)