Skip to content

Instantly share code, notes, and snippets.

@archerslaw
Created April 29, 2014 05:13
Show Gist options
  • Save archerslaw/11391127 to your computer and use it in GitHub Desktop.
Save archerslaw/11391127 to your computer and use it in GitHub Desktop.
virtio-scsi multipath testing.
NOTE: only for raw image and pass-through SCSI disk support it, scsi_id command was provided by Udev is now part of systemd and is installed by default.(e.g.: /usr/lib/udev/scsi_id ...).
# yum install device-mapper.x86_64 device-mapper-multipath.x86_64
# modprobe dm-multipath dm-round-robin
# service multipathd start
Starting multipathd daemon: [ OK ]
# chkconfig multipathd on //ensure sure that the multipath daemon starts on bootup
# /sbin/mpathconf --enable
# ls -l /etc/multipath.conf
-rw-------. 1 root root 2754 Jan 9 18:55 /etc/multipath.conf
# multipath -v2 //prints multipathed paths and show multipathed devices.
# multipath -ll
1.boot a guest with one local raw image attached twice,like:
e.g:...-drive file=/home/datadisk.raw,if=none,format=raw,id=datadisk1 -device virtio-scsi-pci,id=scsipci1 -device scsi-hd,drive=datadisk1,id=datadisk1,serial=test -drive file=/home/datadisk.raw,if=none,format=raw,id=datadisk2 -device virtio-scsi-pci,id=scsipci2 -device scsi-hd,drive=datadisk2,id=datadisk2,serial=test
2.in guest check wwid
# scsi_id --whitelisted --replace-whitespace --device=/dev/sdb
# scsi_id --whitelisted --replace-whitespace --device=/dev/sdc
3. in guest configure multipath
# vi /etc/multipath.conf
blacklist {
wwid XXXXXXXXXXXXXXXXXX //system disk wwid
}
defaults {
user_friendly_names no
path_grouping_policy multibus
getuid_callout "/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/%n"
}
multipaths {
multipath {
wwid YYYYYYYYYYYYYYYYYYYYY //wwid of /dev/sdb
alias sluo-sdb
path_grouping_policy multibus
path_selector "round-robin 0"
}
multipath {
wwid YYYYYYYYYYYYYYYYYYYYY //wwid of /dev/sdc
alias sluo-sdc
path_grouping_policy multibus
path_selector "round-robin 0"
}
}
4. restart multipathd
# /bin/systemctl restart multipathd.service
# systemctl enable multipathd.service
# fdisk -l
5. check multipath works.
5.1 # ls /dev/mapper/
# multipath -ll
5.2 run dd test on this datadisk.
# dd if=/dev/zero of=/dev/sdX bs=1M count=2000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment