making a vm
Submitted by thomas on Fri, 09/18/2009 - 14:22
The first step is to create a new lun in the vm can live. After creating the new lun, tell the kernel to rescan the scsi bus for any new drives.
[root@hypervisor ~]# echo "- - -" > /sys/class/scsi_host/host3/scan [root@hypervisor ~]# dmesg |grep sd SCSI device sdag: drive cache: write back sdag: unknown partition table sd 3:0:1:14: Attached scsi disk sdag sd 3:0:1:14: Attached scsi generic sg35 type 0Using dmesg we can see the device name assigned by the kernel to the new partition. We can then run scsi_id on the device to determine the scsi_id of that device.
[root@hypervisor ~]# /sbin/scsi_id -g -u -s /block/sdag Vendor_AA01000D33100100We can then add the id to /etc/multipath.conf to create a device in /dev/mapper. So in our multipath.conf we put
multipaths {
multipath {
wwid Vendor_AA01000D33100100
alias vm_test
}
}
This will create a block file /dev/mapper/vm_test, this is what we will tell the vm to use as it's hard drive. Now, if we use some version control (subversion), or configuration control (puppet), we can push this config file to all our hypervisors. This means that /dev/mapper/vm_test will exist on each of the hypervisors, moreover, it will be the correct block file for our system.
<devices>
<emulator>/usr/bin/qemu-kvm
<disk type='block' device='disk'>
<source dev='/dev/mapper/ldap'/>
<target dev='hda' bus='ide'/>
</disk>
