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 »

Apr 282013
 

Objective: Move the Windows virtual machine, you can change when you transfer the resources allocated system
Problems: Converting using XenConvert whole system in OVF format can be imported only through the XenCenter and does not always work
Warning: this work only on EXT storage (not LVM)

  1. Install XenConvert on Windows
  2. Export appropriate volumes using XenConvert in the format VHD (it is recommended to export only drive C, just copy the other disks)
  3. Copy the VHD file to a location accessible from the XenServer
  4. Download and install the vhd2xen.i686 utility on XenServer
  5. Import VHD disk in XenServer:
    /usr/lib/Acronis/VHD2XEN/vhd2xen.sh [VHD file]
  6. Create a virtual machine In XenCenter from a template corresponding to the exported system
  7. Remove all the created discs In the newly created virtual machine and attach imported disk
  8. Start the virtual machine and fix the settings in Windows, if necessary
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 »

Jan 032012
 

осле обновления до XenServer 6.0 обнаружилось, что в настройках виртуальных машин отсутствует возможность задать способ запуска – автоматически или вручную. Для решения этой проблемы необходимо:

1. Включить возможность автостарта для пула:

xe pool-param-set uuid=... other-config:auto_poweron=true

2. Для каждой виртуальной машины, для которой нужен автозапуск:

xe vm-param-set uuid=... other-config:auto_poweron=true

Второй пункт естественно нужно выполнять для каждой новой виртуальной машины

PS: копия на http://wwalery.blogspot.com/