关闭

Test multipath feature by hand (by quqi99)

标签: multipathiscsi
267人阅读 评论(0) 收藏 举报
分类:

**作者:张华 发表于: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
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 tgt-admin --dump > /etc/tgt/conf.d/my-targets.conf
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 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 mkfs.ext4 /dev/mapper/360000000000000000e00000000010001
sudo mkdir /test
sudo mount -o _netdev /dev/mapper/360000000000000000e00000000010001 /test
0
0

猜你在找
深度学习基础与TensorFlow实践
【在线峰会】前端开发重点难点技术剖析与创新实践
【在线峰会】一天掌握物联网全栈开发之道
【在线峰会】如何高质高效的进行Android技术开发
机器学习40天精英计划
Python数据挖掘与分析速成班
微信小程序开发实战
JFinal极速开发企业实战
备战2017软考 系统集成项目管理工程师 学习套餐
Python大型网络爬虫项目开发实战(全套)
查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1352806次
    • 积分:15415
    • 等级:
    • 排名:第661名
    • 原创:290篇
    • 转载:10篇
    • 译文:0篇
    • 评论:298条