xenserver 7.0 based on centos 7.2

https://docs.citrix.com/content/dam/docs/en-us/xenserver/xenserver-7-0/downloads/xenserver-7-0-installation-guide.pdf states:

 The Control Domain: Also known as 'Domain0', or 'dom0', the Control Domain is a secure, privileged Linux VM (based on a CentOS 7.2 distribution) that runs the XenServer management toolstack. Besides providing XenServer management functions, the Control Domain also runs the driver stack that provides user created Virtual Machines (VMs) access to physical devices. 

apply xen server patches in bulk

download a bunch of the buggers


for file in XS*.zip;do foo=`basename -s .zip $file`; unzip $file; bar=`xe patch-upload file-name=${foo}.xsupdate`;xe patch-apply uuid=$bar host-uuid=YOUR_HOST_UUID;done

you’ll probably want to add an rm of the zip file and an rm of the xsupdate file (exercise for the reader)

This won’t work for XS70E002 and XS70E003 until you apply XS70E004 (read the release notes).

add iso partition to xenserver

link: https://adamscheller.com/systems-administration/xenserver-local-iso-storage-new-partition/

for posterity…

figure out the name of the volume group (something like name-uuid)

pvscan

 

create the new volume

lvcreate -L 150G -n ISOs name-uuid

 

find the volume you just created

 
lvscan |grep ISO

 

create the filesystem

mkfs.ext2 /dev/other-name-uuid/ISOs

 

make the mount point

mkdir /mnt/isos

 

create the repository

xe sr-create name-label=ISOs type=iso device-config:legacy_mode=true device-config:location=/mnt/isos content-type=iso

 

mount the disk

mount -t ext2 /dev/name-uuid/ISOs /mnt/isos

			

para – virtualize to install from iso

http://www.xenlens.com/boot-a-guest-vm-from-cd-or-dvd-in-xenserver/ copied for posterity

In order to boot from cd or dvd you need to change the guest virtualization type from HVM (fully virtualized) to PV (paravirtualized).

xe vm-param-set HVM-boot-policy="BIOS order" uuid=[uuid of your vm]

After you have booted from dvd, change back to fully virtualized mode:

xe vm-param-set HVM-boot-policy="" uuid=[uuid of your vm]

xen xcp xapi change from eth0 to eth1 (after you delete eth0 eth1 becomes eth0 orn reboot)

#get the uuid of the box you want to add the eth1 to
xe vm-list

#list the interfaces that are associated with that box
xe vif-list | grep

#get list of network-uuids to pick from (in my case there are only 2)
xe vif-list |grep network-uuid| sort -u

# make the eth1 interface
vif-create device=1 vm-uuid= network-uuid=

# plug in the eth1 interface (uuid from prior step)
xe vif-plug uuid=

# unplug the eth0 interface (uuid from step 2)
xe vif-unplug uuid=

#delete the eth0 interface (after a reboot your new eth1 will be eth0)
xe vif-destroy uuid=

xcp add disk

xe sr-list #gives you a list of sr’s from which to pick a sr-uuid

xe vdi-create sr-uuid= name-label= type=user virtual-size=
#the above vdi-create outputs a vdi-uuid

xe vm-list # gives you a list of vm’s from which to pick a vm-uuid

xe vbd-create vm-uuid= vdi-uuid= bootable=false mode=RW type=Disk device= #pick an unused device name (my box had “disks” up to xvdc so I used xvdd)
# the above vbd-create outputs the vbd’s uuid

xe vbd-plug uuid=
#your new devices should now be visible from your domU

grub2 help for kernel upgrade on Ubuntu 12.04 domU on XCP

I wouldn’t be posting if this wasn’t yet another corner case, where things don’t work as they should… I likely built my xcp-xapi box at a bad time for xcp-xapi and grub2, hopefully this helps others…

Situation: installing new virtual kernel on Ubuntu 12.04 domU kernel upgrade crashes royally:

Error: Starting VM – Using to parse /boot/grub/grub.cfg – WARNING:root:Unknown directive load_video – WARNING:root:Unknown directive terminal_output – WARNING:root:Unknown directive else – WARNING:root:Unknown directive else – WARNING:root:Unknown directive else – WARNING:root:Unknown directive else – WARNING:root:Unknown directive else – WARNING:root:Unknown directive export – WARNING:root:Unknown image directive recordfail – WARNING:root:Unknown image directive gfxmode – WARNING:root:Unknown image directive recordfail – WARNING:root:Unknown directive submenu – WARNING:root:Unknown image directive recordfail – WARNING:root:Unknown image directive gfxmode – WARNING:root:Unknown image directive recordfail – Traceback (most recent call last): – File “/usr/lib/xcp/lib/pygrub.xcp”, line 853, in – raise RuntimeError, “Unable to find partition containing kernel” – RuntimeError: Unable to find partition containing kernel

Background: Ubuntu 12.04 dom0 running xcp

Work around (http://blog.403labs.com/post/1546501840/paravirtulization-with-citrix-xenserver-5-5-and-ubuntu):

 xe vm-param-set uuid=<VM-UUID> PV-bootloader-args="--kernel=/boot/vmlinuz-3.2.0-29-virtual --ramdisk=/boot/initrd.img-3.2.0-29-virtual"
xe vm-param-set uuid=<VM-UUID> PV-args="root=UUID=<disk-UUID> ro -- console=hvc0"

ubuntu 12.04 xcp bare metal recovery via rsnapshot

I’m verifying my backup process via a bare metal recovery to identical hardware so I thought I’d take some notes…

I got started on my ubuntu xen xcp/xapi setup with this excellent guide:
http://francispereira.com/blog/step-by-step-guide-to-setting-up-xen-and-xenapi-xcp-on-ubuntu-12-04-and-managing-it-with-xencenter/

Booted a usb based rescue disk to partition my disks the same as oringinal dom0, then rsync over the stuff from my dom0 rsnapshot, created /dev /proc and /sys directories, mounted them with –bind and then chrooted on to the actual partition to rebuild grub

sudo grub-install /dev/sdb
sudo grub-install --recheck /dev/sdb
sudo update-grub

Then umounted things and rebooted, and volia… but networking wasn’t happy… after some banging around I discovered my old nemesis the udev persistent crap, who ever thought of this has some explaining to do, how could this have ever been worth it? Maybe I’m just not in the use case where it’s good for my network adapter to seemingly randomly stop working. None the less, a quick

rm of /etc/udev/rules.d/70-persistent-net.rules

and a reboot and things were back to the way they should be. (also updated my rsnapshot exclude list so I can forget about udev for a while).

UPDATE(9/3/12): just booted the box and realized that it was unhappy about UUIDs of the new filesystems (/dev/sda1 (root) and /dev/sda2 (swap) in my case so some grub editing was needed to boot, and then also updating of /etc/fstab and running update-grub.

With xen xcp-xapi on ubuntu we’re pretty much off book so for this portion of the restore I’m planning to clean things out, create a new LVM, and then import from basic generic vxa images, and then restore domU data/settings from rsnapshot.

I cleaned out the xe setup with a number of commands including xe sr-forget, xe vm-destroy, xe pbd-unplug, xe pdb-destroy, xe vdi-destroy, and xe vbd-destroy, also the -list version of the above helps to identify what to destroy.

I recreated the LVM (synopsis of steps from above guide).

fdisk, n, p, 3, , t, 8e, W. #(use the rest of the disk)
pvcreate /dev/sda3
vgcreate VolumeGroup /dev/sda3
pvdisplay #(get size from here)
lvcreate --size G -n LocalStorage VolumeGroup
xe sr-create type=ext name-label=Local Storage device-config:device=/dev/mapper/VolumeGroup-LocalStorage

Next I set the recently created sr as the default SR and imported a vxa. then used nmap to find it, as that’s faster way to find it than logging in to my wrt.

xe sr-list
xe pool-list
xe pool-param-set uuid= default-SR=
xe vm-import filename=.vxa
xe vm-start vm=
nmap -PN -sS 10.0.0.0/24 192.168.1.0/24

I then rsync’ed the domU settings/data back and rebooted. I use the -anv in order to see what it’s going to do before it mucks things up…

rsync -anv --delete --exclude-from= . host:/|less
rsync -a -delete --exclude-from= . host:/

update(9/3/12): also snapshots weren’t working as I needed to specify the default SR

xe sr-list
xe pool-list
xe pool-param-set suspend-image-SR=  uuid=

Things I learned:

  • good to have the output of fdisk
  • I still really hate the udev permanent ethernet crap
  • bunch of xe commands