技术并艺术着

张华的技术Blog

Test multipath feature by hand (by quqi99)

**作者:张华 发表于:2017-02-16
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明
( http://blog.csdn.net/quqi99 )**

1, Create a VM with one NIC ens3 (10.5.9.40) and the second NIC ens7 (10.5.9.41) and the second disk /dev/vdc as iscsi server

nova keypair-add --pub-key ~/.ssh/id_rsa.pub mykey
nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0

nova boot --key-name mykey --image auto-sync/ubuntu-yakkety-16.10-amd64-server-20161214-disk1.img --flavor m1.small --nic net-id=$(neutron net-list |grep 'zhhuabj_admin_net' |awk '{print $2}') iscsi_server

#add the second NIC ens7
VM_ID=$(nova list |grep 'iscsi_server' |awk '{print $2}')
nova interface-attach $VM_ID --net-id=$(neutron net-list |grep 'zhhuabj_admin_net' |awk '{print $2}')

cinder create --display_name iscsi_server_volume 2
nova volume-attach iscsi_server $(cinder list |grep 'iscsi_server_volume' |awk '{print $2}')

FLOATING_IP=$(nova floating-ip-create |grep 'ext_net' |awk '{print $4}')
nova add-floating-ip iscsi_server $FLOATING_IP
ssh ubuntu@10.230.69.180 -v

ssh ubuntu@10.230.69.180 sudo dhclient ens7

2, Login into iscsi server VM and set up target by hand

sudo apt-get install lvm2
sudo pvcreate /dev/vdc
sudo vgcreate cinder-volumes /dev/vdc
#dd if=/dev/zero of=/tmp/test-volume.img bs=1M count=2048
#sudo losetup -f --show /tmp/test-volume.img
#sudo pvcreate /dev/loop0
#sudo vgcreate cinder-volumes /dev/loop0
sudo lvcreate -L 1.5G -n lv1 cinder-volumes  #will create /dev/cinder-volumes/lv1

sudo apt-get install tgt
sudo tgtadm --lld iscsi --op new --mode target --tid 1 --targetname iqn.2017-02.com.quqi:storage
#Attach a LUN
sudo tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 --backing-store /dev/cinder-volumes/lv1
#persistent
sudo -i
tgt-admin --dump > /etc/tgt/conf.d/my-targets.conf && exit
sudo service tgt restart
cat /etc/tgt/conf.d/my-targets.conf
default-driver iscsi
<target iqn.2017-02.com.quqi:storage>
    backing-store /dev/cinder-volumes/lv1
</target>

#verify
# sudo tgtadm --mode target --op show

3, Create another VM as iscsi client

nova boot --key-name mykey --image auto-sync/ubuntu-yakkety-16.10-amd64-server-20161214-disk1.img --flavor m1.small --nic net-id=$(neutron net-list |grep 'zhhuabj_admin_net' |awk '{print $2}') iscsi_client
FLOATING_IP=$(nova floating-ip-create |grep 'ext_net' |awk '{print $4}')
nova add-floating-ip iscsi_client $FLOATING_IP
ssh ubuntu@10.230.69.181 -v

4, Set up iscsi client

sudo apt-get install open-iscsi multipath-tools
sudo iscsiadm -m discovery -t sendtargets -p 10.5.9.40
sudo iscsiadm -m discovery -t sendtargets -p 10.5.9.41
$ sudo iscsiadm -m node
10.5.9.41:3260,1 iqn.2017-02.com.quqi:storage
10.5.9.40:3260,1 iqn.2017-02.com.quqi:storage

sudo iscsiadm -m node --loginall=all
#sudo iscsiadm -m node --logoutall=all

$ sudo iscsiadm -m session
tcp: [1] 10.5.9.41:3260,1 iqn.2017-02.com.quqi:storage (non-flash)
tcp: [2] 10.5.9.40:3260,1 iqn.2017-02.com.quqi:storage (non-flash)

$ sudo multipath -l
360000000000000000e00000000010001 dm-0 IET,VIRTUAL-DISK
size=1.5G features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=0 status=active
| `- 3:0:0:1 sda 8:0  active undef running
`-+- policy='round-robin 0' prio=0 status=enabled
  `- 2:0:0:1 sdb 8:16 active undef running

sudo fdisk -l
sudo mkfs.ext4 /dev/mapper/360000000000000000e00000000010001
sudo mkdir /test
sudo mount -o _netdev /dev/mapper/360000000000000000e00000000010001 /test
阅读更多
版权声明:本文为博主原创文章,如需转载,请注明出处! https://blog.csdn.net/quqi99/article/details/55270961
文章标签: multipath iscsi
个人分类: Linux Application
想对作者说点什么? 我来说一句

Multipath TCP

Multipath TCP

ztguang ztguang

2016-09-04 20:55:05

阅读数:921

Multipath TCP Test

Multipath TCP Test

ztguang ztguang

2017-02-26 16:37:10

阅读数:500

没有更多推荐了,返回首页

不良信息举报

Test multipath feature by hand (by quqi99)

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭