Difference between revisions of "Xen"

From Earlham CS Department
Jump to navigation Jump to search
(Created page with "= All about Xen on the CS network = = Setting up a new Xen guest = = Misc notes from Eamon = Regarding Virtual machines at the moment (June 2017): eccs-tools and eccs-home...")
 
(Blanked the page)
Line 1: Line 1:
= All about Xen on the CS network =
 
  
= Setting up a new Xen guest =
 
 
= Misc notes from Eamon =
 
Regarding Virtual machines at the moment (June 2017):
 
 
eccs-tools and eccs-home are still running on the old hardware as before. Nothing's changed there. I believe there is documentation on the wiki for control's setup.
 
 
eccs-net and eccs-web are running on the newly-set-up VM host- "smiley" (smiley.cs.earlham.edu, 159.28.22.31). It's running pretty much the same software stack as control, but on a newer os and with a simpler partition layout. The old vm's still exist and can be spun up again if they're needed later. smiley is not hooked up to ldap; login using the sysadmin credentials that should be on most (if not all) machines.
 
 
Along with their normal cs connections, control and smiley are linked together with a long ethernet patch cable with an mtu of 9000 to expedite NFS transfers. control has address 192.168.0.1 and smiley has 0.2. This connection can be removed once the migration is done.
 
 
LVM logical volumes for Xen are stored in the vmdata volume group on smiley. There are swap and root lvm logical volumes for each host (eccs-net-disk and eccs-web-disk). The process for migrating goes a bit like this (note that the file names i've used are different, but the process is still the same):
 
 
On Smiley (using eccs-net as an example):
 
 
#Create a new lvm logical volume using for the new virtual machine on smiley
 
#and create an ext4 partition on it. Sizes of partitions should more or less
 
#match the size of the partitions on control. Run lvs as root to check.
 
 
smiley~# lvcreate -L 50G -n eccs-net-disk vmdata
 
smiley~# mkfs.ext4 /dev/vmdata/eccs-net-disk
 
 
#Create a new mount point for the empty partition to copy to over nfs
 
#and mount the new, empty partition.
 
 
smiley~# mkdir -p /mnt/migrate-smiley
 
smiley~# mount /dev/vmdata/eccs-net-disk /mnt/migrate-smiley
 
 
#Add /mnt/migrate-smiley to /etc/exports and allow access from the 192.168.0.0/24 subnet.
 
#Also make sure no_root_squash is set. This nfs mount can be reused for multiple hosts.
 
 
On control:
 
 
#Shutdown the virtual machine by running shutdown -h now on eccs-net
 
#On control, mount the nfs share we just created on smiley. You must use this ip for it to perform
 
#reasonably (thanks to jumbo frames). Also mount the root partition for the VM we just shut down.
 
#You need to use vers=3 for NFS; otherwise it will complain about UID's and GID's not existing on the new
 
#host server (since it doesn't use LDAP).
 
 
control~# mkdir -p /mnt/to-smiley
 
control~# mount -t nfs -o vers=3 192.168.0.2 :/ mnt/migrate-smiley /mnt/to-smiley
 
control~# mkdir -p /mnt/from-control
 
control~# mount /dev/vmdata-shared/net.cs.earlham.edu-disk /mnt/from-control
 
 
#Use rsync to copy /mnt/from-control/* to /mnt/to-smiley
 
#Make sure that rsync preserves file permissions and metadata
 
 
control~# rsync --progress --numeric-ids -avWHAX /mnt/from-control/* /mnt/to-smiley/
 
 
#Go make some coffee. rsync is gonna be a while, especially on eccs-home (about 400GB of data to copy)
 
#Also take some time to copy the xen configuration for the machine from ~sysadmin/xen-configs on control to somewhere on smiley.
 
#Like on control, ~sysadmin/xen-configs is a good spot.
 
 
#You will need to modify the configuration to match the new path to the swap and root partitions (e.g. /dev/vmdata/eccs-net-disk),
 
#as well as set the path to the kernel and initrd file to use for the guest. You can just use smiley's kernel
 
#image in /boot. That's what net and web are using at the moment.
 
 
#Once rsync finishes, unmount /mnt/migrate-smiley on smiley (make it contains root files for the vm you're copying
 
#(etc, bin, usr, etc) first) and start the new virtual machine like so: (note that xen is managed using the xl
 
#command now, not xm
 
 
smiley~# xl create -c <path to copied config file>
 
 
#Once that's started up and things are working properly, you can hit ^] (Ctrl + ]) to go back to smiley's shell.
 
#Once all VM's are migrated, you can remove the entries added to /etc/exports and remove any mountpoints you've created.
 
#Control should be shut down at this point. I believe smiley is stealing one of the Lovelace lab IP's at the moment, so
 
#the ip address should be updated in /etc/network/interfaces as well as DNS to match control's old IP. You might want to do
 
#this from the console down in dennis in case the network goes down in the process.
 
 
 
Hello again,
 
 
I've finished restoring all the VM's. eccs-tools and home are running on control; web and net are on smiley. I've tried to leave smiley in a state that should be as easy as possible to finish the migration if you guys choose to.
 
 
Here's where it's at
 
 
- All the partitioning and work with LVM is done.
 
 
The four vm's have root disks at
 
 
/dev/vmdata/eccs-home-disk
 
* This disk has the partial copy I started, so you may want to clean it out first before using it.
 
/dev/vmdata/eccs-tools-disk
 
/dev/vmdata/eccs-net-disk
 
/dev/vmdata/eccs-web-disk
 
 
They all have ext4 filesystems.
 
 
- Networking is set up. There is a bridge-utils bridge at xenbr0. It's the interface that the xen dom0 uses; the physical interface runs at the ethernet layer and does't have an IP address.
 
- I've put the appropriate xen configuraition files in ~sysadmin/xen-configs. They're modified for smiley's different partition layout.
 
 
Once the files for each VM are copied to the appropriate partitions (via rsyinc, dd, cp, scp, whatever) you should be good to start up the last two vm's using the email I sent out earlier. I don't think it should need anything else.
 
 
Eamon
 

Revision as of 15:06, 14 September 2017