XenServer

May 192018
 

For connect to virtual machine screen via VNC you need:

  1. Retrieve VM domain number (execute in XenServer console):
    xe vm-list params=dom-id name-label=[vm name] | grep dom-id
  2. Retrieve VNC port for this domain (execute in XenServer console):
    xenstore-read /local/domain/[domain]/console/vnc-port
  3. Make remote connection ([port] – last two digits from previous output), execute in remote console:
    vncviewer -via root@[xenserver] localhost:[port]

All together from remote console xen_vm_screen.sh:

#!/bin/bash
XEN_HOST=$1
VM=$2
XEN_USER=root
DOMAIN=`ssh $XEN_USER@$XEN_HOST "xe vm-list params=dom-id name-label=$VM | awk -F ':' '{gsub(/[ \t]+/, \"\", \\\$2); print \\\$2}'"`
VM_PORT=`ssh $XEN_USER@$XEN_HOST "xenstore-read /local/domain/$DOMAIN/console/vnc-port"`
vncviewer -via $XEN_USER@$XEN_HOST localhost:${VM_PORT:2:2}

Execute it as:

bash ./xen_vm_screen.sh vm_host_name vm_name
Aug 072013
 
  1. In file /etc/yum.repos.d/CentOS-Base.repo in section [base] set enabled=1
  2. sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/CentOS-Base.repo
  3. For XenServer 6.2, 6.5 in file /etc/yum.repos.d/Citrix.repo in section [citrix] set enabled=0
  4. sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/Citrix.repo
  5.  rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/$(uname -i)/epel-release-5-4.noarch.rpm
     cd /tmp
     wget https://yum.puppetlabs.com/el/5/products/$(uname -i)/puppetlabs-release-5-10.noarch.rpm
     rpm -Uvh puppetlabs-release-5-10.noarch.rpm
     yum install puppet
    

    set up /etc/puppet/puppet.conf, after that:

     chkconfig puppet on
     /etc/init.d/puppet start
    

I Also recommend using a xs_patcher to make XenServer up to date.

Aug 072013
 

Warning: all operations are carried out only with the first two RAID partitions, the third partition is not changed

Due to the fact that the standard update is a XenServer installation of the new XenServer with virtual machines preservation, with the loss of all the changes that were made manually on the server (installed software, changing / adding settings through the console, etc.), the update is the new XenServer installation and connection of the old virtual machines.

Based on: http://support.citrix.com/article/CTX120962

  1. Backup all VM, manually:
    xe vm-export vm=vm_name filename=backup_fiule_name compress=true
    ...
    xe pool-dump-database file-name=dump_name.dump
    

    or with XENBack

  2. VM metadata export
    xe vm-export metadata=true --multiple filename=VMEXPORT

    Warning: store all files VMEXPORT… to another computer/data store/etc

  3. Continue reading »

Dec 292012
 

Compiled from: CodeAddict’s Blog and http://pastebin.com/buBHcfxU

First: Install XenServer on first disk (/dev/sda) and NOT configure any local storage.
/dev/sda should contain three partitions, verify this with:

sgdisk -p /dev/sda

In some cases XenServer doesn’t create third partition, i.e. result of this command has only two partitions and looks like:

Number Start (sector) End (sector) Size Code Name
1 2048 8388641 4.0 GiB 0700
2 8390656 16777249 4.0 GiB 0700

In this case you need to create third partition manually:

sgdisk --new=3:16779264:DISK_SIZE-34 /dev/sda
sgdisk --typecode=3:fd00

The second partition is used for backups during a XenServer upgrade. This partition won’t used in my XenServer upgrade method.
Now we are going to use /dev/sdb as the mirror disk. First clear the partition table.

sgdisk --zap-all /dev/sdb

and install a GPT table on it

sgdisk --mbrtogpt --clear /dev/sdb

Continue reading »

Sep 232012
 

I need to create virtual machine on XenServer (6.2.0) but I have access to console/SSH only

Solution:

  1. Virtual machine based on template. For select template execute:
    xe template-list
  2. After selecting template, create VM:
    xe vm-install template="Debian Wheezy 7.0 (32-bit)" new-name-label="newVM"

    so VM based on Debian Wheezy 7.0 (32-bit) template, VM name is newVM
    Last command execution produced UUID for created VM

  3. Continue reading »

Aug 242012
 

В XenServer (5.0, 5.5, 6.0) при постоянном изготовлении снепшотов системы (обычно используется для бекапов) через определенное время эти снепшоты делатся отказывались, возвращая ошибку:

Error code: SR_BACKEND_FAILURE_109
Error parameters: , The snapshot chain is too long

Continue reading »