UCSB has five physical servers hosting VMs named host-ucsb-1 to host-ucsb-5.
Host-ucsb-1 is a Dell server located at NCEAS, has about 2TB of local SAS storage.
Host-ucsb-2 to host-ucsb-5 are HP servers located on campus, the rest of this documentation is about them.
CentOS 6 is installed on the HP servers because of hardware driver issues with the Emulex NICs and the current Ubuntu 10.04 LTS release. Setup instructions are below.
Install CentOS using the CentOS x86-64 DVD (6.2 at the time of writing) with the default install settings, except:
hostname "host-ucsb-#"
"Use All Space" automatic partition layout
"Virtual Host" software selection
Add users:
useradd username
Enable sudo for users (uncomment wheel, add users to wheel group):
visudo
Setup networking (bond0, br0, eth0, eth4, eth5, eth6, eth7):
(network config to be linked from here, currently in /etc/sysconfig/network-scripts
Setup /etc/resolv.conf:
vim /etc/resolv.conf
Download and install epel repo:
wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
Install openssh-askpass, xorg-x11-xauth, device-mapper-multipath, etckeeper, fail2ban:
sudo yum update
sudo yum install xorg-x11-xauth device-mapper-multipath etckeeper fail2ban openssh-askpass
Init etckeeper, fail2ban:
sudo /etc/init.d/fail2ban start
sudo /sbin/chkconfig --level 2345 fail2ban on
sudo etckeeper init
sudo etckeeper commit "initial commit"
Create /etc/multipath.conf with the following contents:
defaults {
user_friendly_names no
}
Start multipathd, set multipathd to start on boot:
sudo /etc/init.d/multipathd start
sudo /sbin/chkconfig --level 2345 multipathd on
Map iscsi devices:
sudo iscsiadm -m discovery -t sendtargets -p 10.0.1.10
sudo iscsiadm -m discovery -t sendtargets -p 10.0.1.11
sudo iscsiadm -m discovery -t sendtargets -p 10.0.1.12
sudo iscsiadm -m discovery -t sendtargets -p 10.0.1.13
sudo iscsiadm -m discovery -t sendtargets -p 10.0.2.10
sudo iscsiadm -m discovery -t sendtargets -p 10.0.2.11
sudo iscsiadm -m discovery -t sendtargets -p 10.0.2.12
sudo iscsiadm -m discovery -t sendtargets -p 10.0.2.13
sudo iscsiadm --mode node --targetname iqn.1986-03.com.hp:storage.p2000g3.1126130966 --portal 10.0.1.10:3260 --login
sudo iscsiadm --mode node --targetname iqn.1986-03.com.hp:storage.p2000g3.1126130966 --portal 10.0.2.10:3260 --login
sudo iscsiadm --mode node --targetname iqn.1986-03.com.hp:storage.p2000g3.112512ed28 --portal 10.0.1.11:3260 --login
sudo iscsiadm --mode node --targetname iqn.1986-03.com.hp:storage.p2000g3.112512ed28 --portal 10.0.2.11:3260 --login
sudo iscsiadm --mode node --targetname iqn.1986-03.com.hp:storage.p2000g3.1126130985 --portal 10.0.1.12:3260 --login
sudo iscsiadm --mode node --targetname iqn.1986-03.com.hp:storage.p2000g3.1126130985 --portal 10.0.2.12:3260 --login
sudo iscsiadm --mode node --targetname iqn.1986-03.com.hp:storage.p2000g3.11261308c5 --portal 10.0.1.13:3260 --login
sudo iscsiadm --mode node --targetname iqn.1986-03.com.hp:storage.p2000g3.11261308c5 --portal 10.0.2.13:3260 --login
Open ports for live migration in iptables:
sudo iptables -I INPUT -p tcp --dport 49152:49261 -j ACCEPT
sudo /etc/init.d/iptables save
Add public IP to /etc/hosts:
128.111.36.72 host-ucsb-2 host-ucsb-2.dataone.org
Add the following line to ~/.bashrc to run virt-manager over X:
alias virt-manager="XAUTHORITY=~/.Xauthority sudo virt-manager"
Add user to kvm group:
sudo vigr
Create and copy root ssh keys to all shared servers:
(run on each server)
sudo ssh-keygen
sudo ssh-copy-id host-ucsb-* (do this for all three other servers)
virt-manager
File > Add Connection > Connect to Remote host (SSH, root, host-ucsb-3, autoconnect) (do this for all three other servers)
Adding an iSCSI device:
Port-forward array management interface to your localhost, through host-ucsb-{2..5}:
ssh -N -f -L 8080:10.0.0.10:80 host-ucsb-2.dataone.org
ssh -N -f -L 8081:10.0.0.12:80 host-ucsb-2.dataone.org
ssh -N -f -L 8082:10.0.0.14:80 host-ucsb-2.dataone.org
ssh -N -f -L 8083:10.0.0.16:80 host-ucsb-2.dataone.org
Load management interface in a browser:
http://localhost:8080
http://localhost:8081
http://localhost:8082
http://localhost:8083
Login, create a new Volume on an existing Vdisk (with a unique LUN!) Make sure the LUN does not overlap at http://mule1.dataone.org/OperationDocs/ucsb-storage-layout.html
Rescan iSCSI devices on all four hosts:
sudo iscsiadm --mode node --targetname iqn.1986-03.com.hp:storage.p2000g3.1126130966 --portal 10.0.1.10:3260 --rescan
sudo iscsiadm --mode node --targetname iqn.1986-03.com.hp:storage.p2000g3.1126130966 --portal 10.0.2.10:3260 --rescan
sudo iscsiadm --mode node --targetname iqn.1986-03.com.hp:storage.p2000g3.112512ed28 --portal 10.0.1.11:3260 --rescan
sudo iscsiadm --mode node --targetname iqn.1986-03.com.hp:storage.p2000g3.112512ed28 --portal 10.0.2.11:3260 --rescan
sudo iscsiadm --mode node --targetname iqn.1986-03.com.hp:storage.p2000g3.1126130985 --portal 10.0.1.12:3260 --rescan
sudo iscsiadm --mode node --targetname iqn.1986-03.com.hp:storage.p2000g3.1126130985 --portal 10.0.2.12:3260 --rescan
sudo iscsiadm --mode node --targetname iqn.1986-03.com.hp:storage.p2000g3.11261308c5 --portal 10.0.1.13:3260 --rescan
sudo iscsiadm --mode node --targetname iqn.1986-03.com.hp:storage.p2000g3.11261308c5 --portal 10.0.2.13:3260 --rescan
Note the new UUID by getting the sd* names from dmesg, then matching them to multipath:
dmesg
multipath -ll
Record the UUID at http://mule1.dataone.org/OperationDocs/ucsb-storage-layout.html
Open virt-manager (can be run from any server):
XAUTHORITY=~/.Xauthority sudo virt-manager
- Each iSCSI device will have one /dev/mapper/, and two /dev/sd devices because of multipathing
Example for removing one iSCSI device from one host:
$ sudo multipath -ll 3600c0ff0001287547fa77c4f01000000
3600c0ff0001287547fa77c4f01000000 dm-45 HP,P2000 G3 iSCSI
size=186G features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=0 status=active
| `- 9:0:0:24 sdxx 67:32 failed faulty running
`-+- policy='round-robin 0' prio=0 status=enabled
`- 8:0:0:24 sdxy 67:0 failed faulty running
$ sudo multipath -f /dev/mapper/3600c0ff0001287547fa77c4f01000000
$ sudo blockdev --flushbufs /dev/sdxx
$ sudo blockdev --flushbufs /dev/sdxy
root# echo 1 > /sys/block/sdxx/device/delete
root# echo 1 > /sys/block/sdxy/device/delete
Login to the web interface of the SAN and expand the disk image
Find the devices for the disk image (do this on every iscsi host):
sudo multipath -ll 3600c0ff0001287547fa77c4f01000000
Refresh the size for the block device (do this on every iscsi host, note: the block devices will use different names!):
$ echo 1 > /sys/block/sdaa/device/rescan $ echo 1 > /sys/block/sdab/device/rescan
Refresh the size for the multipath device (do this on every iscsi host):
$ sudo multipathd -k multipathd> resize map 3600c0ff0001287547fa77c4f01000000 ok multipathd> quit
Verify the size has changed.
Shut down (full off) and restart the virtual server to detect the changes
Resize the partitions in the virtual servers
- boot the virtual server from a GParted LiveCD ISO image
- resize the partition holding the LVM VG to the new disk image size with the graphical partitioner
- boot back into the virtual server
- reize the LVM LV with lvextend
- reize the file system with resize2fs
Live migration via virsh:
sudo virsh migrate --live --persistent --verbose cn-dev-ucsb-1 qemu+ssh://host-ucsb-4.dataone.org/system