Warning Livedoc is no longer being updated and will be deprecated shortly. Please refer to https://documentation.tjhsst.edu.

VM Creation

From Livedoc - The Documentation Repository
Revision as of 11:53, 7 June 2013 by 2016fwilson (talk | contribs) (create the page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Storage Setup

ssh to bottom/snares (wherever apocalypse zpool is imported) and gain root zfs create apocalypse/vms/<hostname> zfs create -V 10G apocalypse/vms/<hostname>/root zfs create -V 1G apocalypse/vms/<hostname>/swap

targetcli targetcli> cd backstores/block targetcli> create apocalypse-<hostname>-root /dev/zvol/apocalypse/vms/<hostname>/root targetcli> create apocalypse-<hostname>-swap /dev/zvol/apocalypse/vms/<hostname>/swap targetcli> cd /iscsi/iqn.1992-03.edu.tjhsst:storage:apocalypse.0/tpg1/luns

    • record the lun numbers. You will need them later.**

targetcli> create /backstores/block/apocalypse-<hostname>-root targetcli> create /backstores/block/apocalypse-<hostname>-swap targetcli> exit echo yes | tcm_dump --o

ssh to the VM server you plan to use for the new VM (waitaha/littleblue) and gain root iscsiadm -m session --rescan generate the wwid by running: /lib/udev/scsi_id -g /dev/disk/by-path/ip-*-lun-<lunnum> if you forgot the lun numbers run targetcli targetcli> cd /iscsi/iqn.1992-03.edu.tjhsst:storage:apocalypse.0/tpg1/luns targetcli> ls

Edit /etc/multipath.conf and create two entries for root and swap following the existing examples The WWID is the wwn from the previous command for each volume after editing, copy /etc/multipath.conf to the other VM servers

multipath multipath -ll

You should now have device nodes in /dev/mapper for each new volume

mkfs.ext4 /dev/mapper/apocalypse-<hostname>-root mkswap /dev/mapper/apocalypse-<hostname>-swap

mkdir /mnt/<hostname> mount /dev/mapper/apocalypse-<hostname>-root /mnt/<hostname> Check if the device is writable. touch /mnt/<hostname>/t rm /mnt/<hostname>/t If this dosen't work you may need to recreate the device nodes multipath -f apocalypse-<hostname>-root multipath -f apocalypse-<hostname>-swap iscsiadm -m session --rescan multipath Actually copy the files. scp stage64:newvm-excludes ~ rsync -avSz --numeric-ids --exclude-from=newvm-excludes stage64:/ /mnt/<hostname> If you need the kernel sources (only if you need to compile 3rd party modules) cd /mnt/<hostname>/usr/src/ git clone stage64:/usr/src/linux.git linux.git

Change root to your new vm

chroot /mnt/<hostname> /bin/bash env-update source /etc/profile export PS1="{<hostname>}$PS1"

passwd Add any additional partitions to /etc/fstab vim /etc/conf.d/hostname vim /etc/conf.d/net

rm /etc/ssh/ssh_host_* #These should already be gone rm /etc/krb5.keytab

ktutil -k /etc/krb5.keytab get -p ahamilto/admin host/<FQDN> vim /etc/issue #Remove the warning and change the hostname vim /etc/nagios/nrpe.cfg #Edit the bind IP and update check values if appropriate vim /etc/security/access.groups #remove stage64 and add in appropriate hostname group

crontab -l #Configure appropriate backup time


umount /mnt/<hostname>

cd /etc/libvirt/qemu cp stage64.xml <hostname>.xml

vim <hostname>.xml Set name, partitions, kernel, memory, and networking as appropriate Mac address is derrived from the IPv4 Address of the system virsh define /etc/libvirt/qemu/<hostname>.xml