Network/Procedures/Create a Makers Local VM host

From Makers Local 256
Jump to: navigation, search
  • Create this disk layout.

Number  Start   End     Size    Type     File system     Flags
1      1049kB  48.0GB  48.0GB  primary  ext4            boot
2      48.0GB  50.0GB  2000MB  primary  linux-swap(v1)
3      50.0GB  (rest of disk)  primary                  lvm

  • Make a new volume group called vm4_storage and include partition 3 as the first PV.
  • Run this on an existing VM host to get a list of packages to copy to the new host.

dpkg --get-selections > vmhost.dpkg-selections

  • After copying that file to the new host, do this on the new host to install those packages.

sudo apt-get install dselect
sudo dselect update
grep -v deinstall vmhost.dpkg-selections | sudo dpkg --set-selections
sudo apt-get -y update
sudo apt-get dselect-upgrade

  • Make xen boot instead of linux.

dpkg-divert --divert /etc/grub.d/08_linux_xen --rename /etc/grub.d/20_linux_xen

  • Create /etc/network/interfaces like this. Be sure to change the vlan 200 IP to a unique one. I'm using for vm4 for example. Usually it's host number times 10.

auto lo
iface lo inet loopback
auto eth0.100 eth0.200 eth0.300 eth0.400
auto br.100 br.200 br.300 br.400
iface eth0.100 inet manual
       vlan_raw_device eth0
iface eth0.200 inet manual
       vlan_raw_device eth0
iface eth0.300 inet manual
       vlan_raw_device eth0
iface eth0.400 inet manual
       vlan_raw_device eth0
iface br.100 inet manual
       bridge_ports eth0.100
       bridge_maxwait 0
iface br.200 inet static
       bridge_ports eth0.200
       bridge_maxwait 0
iface br.300 inet manual
       bridge_ports eth0.300
       bridge_maxwait 0
iface br.400 inet manual
       bridge_ports eth0.400
       bridge_maxwait 0

  • While running "service networking restart", configure the host's switch port like this.

interface FastEthernet0/12
 description vm4
 switchport access vlan 200
 switchport mode trunk
 spanning-tree portfast

  • Set up your drbd volumes in /etc/drbd.d to mirror to whatever other VM host. Then reload drbd and kick off your syncs. First you will want to copy root's .ssh directory from the first box so that you can use ssh keys to log in between root users on different boxes. Then you can use scp as root:

scp vm2:/etc/drbd.d/* /etc/drbd.d/
#modify the files here if changing to different host...
# for each VM you want to be able to run on this machine,
# go create the appropriate LVM volume
lvcreate whatever_storage --name whatever_disk --size some_amountGiB
service drbd restart
# initialize each LVM volume in drbd
drbdadm create-md whatever_disk

  • While that's moving, copy your Xen configs from another VM host.

scp vm2:/etc/xen/*.cfg /etc/xen/

  • Edit /etc/default/xendomains and set XENDOMAINS_RESTORE=false and XENDOMAINS_SAVE= (empty string).

That's probably not exactly right but it's something like that. Good luck.