XenServer how-to(s)

GUI Console
GUI Windows – Very stable and reliable: http://xenserver_ip
GUI UNIX – Very unstable, alpha: http://www.xensemaking.com/openxenmanager/
WEB UNIX – Also alpha: http://www.xensemaking.com/xenwebmanager/
Shell Console
xsconsole – Nice XenServer console
xentop – Just like xm top
xenmon.py – Useful for monitoring the performance Xen domains
Debian install (CLI)
—– Modify Debian template So we can use 10G disk by default
— List templates
xe template-list
— Set disk size
xe template-param-set uuid=<TEMPLATE-uuid> other-config:disks='<provision><disk device=”0″ size=”10769803776″ sr=”” bootable=”true” type=”system”/></provision>’
xe template-param-list uuid=<TEMPLATE-uuid>
— Set ram size
xe vm-memory-limits-set uuid=<TEMPLATE-uuid> static-min=1GiB static-max=5GiB dynamic-min=5GiB dynamic-max=5GiB
—- Create instance
— List templates and choose one
xe template-list
— Create VM from template
xe vm-install template=”Debian Lenny 5.0 (32-bit)” new-name-label=image-Debian5-Node01x sr-uuid=<sr-uuid>
— Disable VNC
xe vm-param-set uuid=<uuid-of-vm> other-config:disable_pv_vnc=1
— Setup Affinity
xe vm-param-set uuid=<vm-uuid> affinity=<xenserver-uuid>
— Change vm name lable
xe vm-param-set uuid=<vm-uuid> name-label=”New-name-label”
— List
xe vm-list
— Set repository for net-install
xe vm-param-set uuid=<uid> other-config:install-repository=ftp://ftp.ca.debian.org/debian
http://mirror.centos.org/centos/5.8/os/x86_64/
— Set parent bridge for new VM
xe network-list bridge=xenbr0 –minimal
— Create vif network interface for new VM
xe vif-create vm-uuid=<vm-uuid> network-uuid=<host-bridge-uuid> mac=random device=0
— Find “Guest installer interface”, this is temporary interface for net-install
xe network-list (find Guest installer network)

xe network-param-set uuid=<install-network-uuid> other-config:ip_begin=10.0.2.0 other-config:ip_end=10.0.2.255 other-config:netmask=255.255.255.0
— Make sure that your VM autostart on reboot
xe vm-param-set uuid=<vm-uuid> other-config:auto_poweron=true
— Finally start VM
xe vm-start uuid=<vm-uuid>
— How to attach TOOLS ISO
xe vdi-list params=all sm-config:xs-tools=true (Find ISO file with xentools)
xe vbd-list vm-uuid=<vm-uuid> params=vdi-uuid,vdi-name-label (See all disk images associated with this VM including labels)
xe cd-list
xe vm-cd-add vm=<vm-uuid> cd-name=”xs-tools.iso” device=3 (THIS IS ONLY FOR THE FIRST TIME)
xe vm-cd-eject vm=<vm-label>
xe vm-cd-insert cd-name=<name of ISO or CD> vm=<vm-label> (Every other time)
— How to create snapshot
xe vm-snapshot vm=<vm-uuid> new-name-label=”First-01″
xe snapshot-list
— How to uninstall VM
xe vm-uninstall uuid=<vm-uid>
lvremove <LV UUID>
VNC dom0 Ssh forwarding magic
ssh -L 5901:127.0.0.1:5901 -N -f -l root 10.0.2.45
vncviewer localhost:5901 (Install tightvnc from macports)
Console dom0 access
First disable VNC (For temp. solution just kill -9 pid)
xe vm-param-set uuid=<uuid-of-vm> other-config:disable_pv_vnc=1 (Reboot)
How to enable vnc?
xe vm-param-remove uuid=<vm-uuid> param-name=other-config param-key=disable_pv_vnc
– xe vm-list
– list_domains
or xe vm-list params=dom-id uuid=<uuid-of-vm> –minimal
/usr/lib/xen/bin/xenconsole 1

Usefull

xe sr-list
(all about vm)
xe template-param-list uuid=<TEMPLATE-uuid>
xe host-list params=memory-free (All hypervisor RAM)
xe vm-list uuid=<vm-uuid> params=all
xe network-list – List of all interfaces
xe network-param-list uuid=<uid> – Detail info
HOW to install XEN-TOOLS from CLI
From XenServer shell
(This is just for a first time, for inserting CDROM second time use example from XenServer HowTo, This example will create cd-device and insert disk)
xe vm-cd-add vm=<vm-uuid> cd-name=”xs-tools.iso” device=3
Login to VM
mkdir /mnt/cdrom
dmesg |grep xvd (It is the last one in this case xvdd)
mount /dev/xvdd /mnt/cdrom/
cd Linux
./install.sh
reboot
How to eject
After reboot go to XenServer and eject CD
xe vm-cd-eject vm=image-Debian5-Node01
You can check status from
1. xsconsole
2. Virtual Machines
3. VMs running on the host
If you see Memory Usage and Network IP you are good to go 🙂
Snapshots
xe vm-snapshot vm=<vm-label> new-name-label=<snapshot-label>
xe snapshot-list
xe snapshot-list snapshot-of=<vm uuid>
xe snapshot-export-to-template snapshot-uuid=<snapshot-uuid> filename=/mnt/nfs/export-example-1
xe snapshot-uninstall snapshot-uuid=<snapshot-uuid>
Reclaim unused Snapshot VDI space (After snapshot removal XenServer will keep snapshot LVM space since server thinks you will use “snapshots space” again in the future, this is default “feature” behaviour)
xe snapshot-list
xe snapshot-uninstall snapshot-uuid=<snapshot-uuid>
xe host-call-plugin host-uuid=<XENSERVER-UUID> plugin=coalesce-leaf fn=leaf-coalesce args:vm_uuid=<VM_UUID>

How to add GPG key do Debian 5 Machine
wget -q http://updates.vmd.citrix.com/XenServer/5.5.0/GPG-KEY -O- | apt-key add –

Convert template to VM permanently
xe template-param-set uuid=e23a7faa-f364-7533-4f69-cac5746fe3e3 is-a-template=false
How-to SHUTDOWN forcefuly VM
xe task-list
xe task-cancel force=true uuid=986397fb-4c92-b414-0850-b0316157f12a
xe vm-shutdown force=true uuid=66c369f3-dd8c-5575-e193-3410f1015e73
Real VM-snapshot!!
xe vm-snapshot vm=Debian-5 new-name-label=Debian-5-snapshot
xe template-param-set is-a-template=false uuid=3309ad2e-6af8-6d14-7d42-5ab2e33d98ab
vi /etc/iscsi/iscsid.conf
node.session.auth.authmethod = CHAP
node.session.auth.username = someuser
node.session.auth.password = 12301980912838WEQWE23
xe host-param-set uuid=9c4e38b1-f7dc-4ea0-95cb-18e0c50bdf87 other-config:iscsi_iqn=iqn.image.com.xen-sun1
xe host-param-set uuid=d0e128a2-54e0-4071-a322-54bdf516edd9 other-config:iscsi_iqn=iqn.image.com.xen-sun2
nano /etc/iscsi/iscsid.conf
/etc/init.d/iscsid restart
Autostart on new XenServer using POOL
xe pool-param-set uuid=25d39c25-65ba-6b52-2af4-ea4e97ba41f0 other-config:auto_poweron=true
xe vm-param-set uuid=bcd99d7f-610d-cb65-9776-8fec3ee8355d other-config:auto_poweron=true
—-Delete all snapshots
#!/bin/bash
for i in `xe snapshot-list –minimal | sed -e ‘s/,/\ /g’` ; do xe snapshot-uninstall force=true uuid=$i ; done
VM Auto boot in the pool
xe pool-param-set uuid=UUID other-config:auto_poweron=true
xe vm-param-set uuid=UUID other-config:auto_poweron=true
Add your comment

Your email address will not be published. Required fields are marked *