Showing posts with label Virtualization. Show all posts
Showing posts with label Virtualization. Show all posts

Saturday, 16 November 2013

Running a PowerCLI Script

I'm a Linux User and fond some interesting scripts for VMWare on the Internet, the problem was I didn't knew how to run them.
Now I finally learned how to run a Power Shell script, so here's how I've done it:

Save the script to a file with a filetype of .ps1
Open the PowerCLI prompt on your PC
Connect to the vCenter with the Connect-VICenter cmdlet
dot-source the .ps1 file. That way the function is know in your PowerCLI session
. ./yourfile.ps1
Call the function implemented by the scipt.

Possibly Related Posts

Saturday, 26 January 2013

How to reset the root password of VMware ESXi 4.1 and 5.0

You can't recover your old password but by following this steps you can set it to blank and then set a new one.

First you'll need a Linux live CD, any one will do.

After booting to a live session of Linux you must look for a file named state.tgz on your vmware host's hard drive. To do so I used:
parted -l
To list all available partitions and mounted every VFAT partition to look inside, I found it was on /dev/sda5, in your case it might be on a different one, you can mount the partitions with:
mount /dev/sda1 /mnt
(replace sda with your device's name and 1 with your partition numver)
then check inside if the file state.tgz exists:
ls /mnt/
After finding the state.tzg file you must uncompress it using:
cd /tmp
tar xzf /mnt/Hypervisor3/state.tgz
this will get you a local.tgz file witch you have to extract using:
tar xzf local.tgz
now edit the file /tmp/etc/shadow
vi etc/shadow
Inside locate the root account and just remove it's hash (everything between the first and the second colon) and login to the service console as root with no password at all.

Finally re-pack the files and move the modified state.tgz back to the VFAT partition. Probably it is a good idea to make a backup copy of the original state.tgz in case something goes wrong:
mv /mnt/state.tgz /mnt/state.tgz.bak
rm local.tgz
tar czf local.tgz etc
tar czf state.tgz local.tgz
mv state.tgz /mnt/
Reboot back into ESXi and you're done.

Possibly Related Posts

Friday, 13 April 2012

Migrate/Convet VMs from Xen to VMWare

To migrate my Windows VMs I just uninstalled the Xen Tools from them and then used the VMWare Converter to migrate them as if they where physical machines.
However the VMWare Converter didn't worked so well with my Linux VMs and the converted VMs wouldn't even boot...

I've tried to export the VMs as OVF apliances from XenCenter but VSphere wasn't able to import them (although it works on the opposite direction)...

So in order to move my Ubuntu VMs from XenServer to VMWare, first I've installed an Ubuntu VM on VMWare with nothing but the base installation to be used as a template, then for each VM on XenSever I cloned this base VMWare VM and synced both using the following procedure:

Logged in as root on the source VM (on XenServer)

Uninstall Xen Tools
aptitude purge xe-guest-utilities
Generate a list of the installed packages
dpkg --get-selections > package_list
Copy the list to the destination VM (on VMWare)
scp package_list root@10.39.10.222:/root/
Install every package from that list on the destination VM
ssh root@10.39.10.222 "cat /root/package_list | sudo dpkg --set-selections && sudo apt-get dselect-upgrade"
Copy the users and groups files to the destination VM first to prevent errors during the sync
scp /etc/passwd* /etc/group* /etc/shadow* root@10.39.10.222:/etc/
Clear the network card name mapping by editing the file:
vi /etc/udev/rules.d/70-persistent-net.rules
and removing every network card entry (if any)

Copy everything from the source VM to the destination VM using rsync
rsync -avzlpEXogthe ssh --exclude 'fstab' /opt /var /etc /usr /root /home root@10.39.10.222:/
Reboot the destination VM:
ssh root@10.39.10.222 "reboot"
Stop the source VM:
halt
and thats what worked for me.

Note that this should work to migrate any Ubuntu server from any hypervisor or phisical server to another...

Possibly Related Posts

Wednesday, 11 April 2012

Citrix Xenserver Unable to export / import OVF

I was trying to expor a VM to an OVF package and before the process even started I was getting an error message saying that the export had failed, I've looked into the XenCenter's logs and found this:
citrix xenserver system.exception failed to export system.xml.xmlexception root element is missing
After banging my head for a while I found the cause of the problem. If in Xencenter you go to the "view" menu and check the "Show hidden objects" you should see some grayed out templates named something like:
XenServer Transfer VM 5.6.100-46655p (hidden)
Where 5.6.100 is the Xenserver version and 46655p is the build number. If this templates don't exist or don't match your Xenserver's version or build number you must create a new one.
You must delete all transfer VM templates that don't match your Xenserver's version or build, then go to your pool master's console and run this command:
/opt/xensource/packages/files/transfer-vm/install-transfer-vm.sh
Wait a few seconds for it to generate the template and after that you should be able to import and export OVF packages.

Possibly Related Posts

Monday, 12 March 2012

CloudStack reset password script

The process to install the password reset script described in the Cloudstack's admin guide was not working for me on an Ubuntu template so I tried to figure what was wrong with it.
In the admin guide they say that we should place the script in /etc/init.d/ and enable it using update-rc.d but that didn't work so I tried to place this in /etc/init/cloudstack.conf
##########################################################################
description "CloudStack password reset"
author "Luis Davim"
# Be sure to block the display managers until our job has completed. This
# is to make sure our kernel services are running before user
# may launch.
start on runlevel [235] or starting gdm or starting kdm or starting prefdm
stop on runlevel [06]
pre-start exec /etc/init.d/cloud-set-guest-password
post-stop exec /etc/init.d/cloud-set-guest-password
That didn't not work either, so I took a look at the script and figured it needed to have the network configured to run.
So I configured my network interface like this:
# The primary network interface
auto eth0
iface eth0 inet dhcp
post-up /etc/init.d/cloud-set-guest-password
pre-down /etc/init.d/cloud-set-guest-password
you can also link the script into the /etc/network/if-up(down) folders:
ln -s /etc/init.d/cloud-set-guest-password/etc/network/if-up/cloud-set-guest-password
ln -s /etc/init.d/cloud-set-guest-password/etc/network/if-down/cloud-set-guest-password
And that was it, now I have an Ubuntu template with a working password reset script.

Note: I've also modified the password script to use chpasswd insted of passwd --stdin since ubuntu does not have the --stdin option in passwd and both ubuntu and centos have chpasswd but that was/is not the problem because usermod with mkpasswd was working...

just replaced:
echo $password | passwd --stdin $user
with
echo "$user:$password" | chpasswd

Possibly Related Posts

Wednesday, 7 March 2012

CloudStack LDAP

References:

First you need to configure LDAP by making an API call with an URL like this:
http://127.0.0.1:8096/client/api?command=ldapConfig&hostname=127.0.0.1&searchbase=ou%3Dpeople%2Co%3DsevenSeas&queryfilter=%28%26%28uid%3D%25u%29%29&binddn=%20cn%3DJohn+Fryer%2Cou%3Dpeople%2Co%3DsevenSeas&bindpass=secret&port=10389&response=json
Or in a more readable format:
http://127.0.0.1:8096/client/api?command=ldapConfig
&hostname=127.0.0.1
&searchbase=ou%3Dpeople%2Co%3DsevenSeas
&queryfilter=%28%26%28uid%3D%25u%29%29
&binddn=%20cn%3DJohn+Fryer%2Cou%3Dpeople%2Co%3DsevenSeas
&bindpass=secret
&port=10389
&response=json
Note the URL encoded values, here you have the decoded version:
http://127.0.0.1:8096/client/api?command=ldapConfig
&hostname=127.0.0.1
&searchbase=ou=people,o=sevenSeas
&queryfilter=(&(uid=%u))
&binddn= cn=John Fryer,ou=people,o=sevenSeas
&bindpass=secret
&port=10389
&response=json
You can use this link to encode/decode your url -> http://meyerweb.com/eric/tools/dencoder/

After you've created your URL (with encoded values) open your browser, login into cloudstack and then fire up your ldap config URL.
Now if you go back to cloudstack and under "Global Settings" search for LDAP and you should see that LDAP is configured.

Now you have to manually create the user accounts with the same logins as in your LDAP server or you can use the CloudStack API to make a script and "sync" your LDAP users into CloudStack, I've written a PHP script that does this.
You'll have to modify it to match your LDAP schema and you can get it after the break.

Possibly Related Posts

Monday, 23 January 2012

Xenserver list snapshots

This command will list the snapshot tree, with it you'll get a view of where each VDI fits on your system:
for i in `vgs --noheadings -o vg_name`; do vhd-util scan -p -l $i -f 'VHD-*' ; done

Possibly Related Posts

Saturday, 8 October 2011

VDI is not Available - Xenserver error

In order to recover the VM you have to:

1. Run XE VDI-LIST and determine the UUID of the VM giving you the problem, like this:

xe vdi-list | grep -i <VM-NAME> -B2 -A2
2. Once you have the UUID run:

xe vdi-forget uuid=<VDI-UUID>
3. Rescan the SR with:
xe sr-scan uuid=<SR-UUID>
4. Now, in XenCenter, go to the VM and click on the Storage tab. You should see it empty. Then click on attach and first entry on the list should be NO NAME. Attach it to the VM, wait about 30 seconds, then power it up!

5. In most cases it should be up and running. If you are still getting errors then wait a minute and try it again. If still not working repeat the previous steps.

Possibly Related Posts

Friday, 7 October 2011

Some VM's are missing after Xenserver failure

Without enabled HA feature there is no mechanism enabled which checks if the host which went down had any VMs running at the time of the failure. There is no mechanism which updates the database with the informatio​n that the VMs which were running on the failing host should be marked as halted after the crash.

So, when you do not have the possibilit​y to enable HA you can do the following to make the VMs available in XenCenter again:

1. Locate the VMs which were running on the failed host with the following command:
xe vm-list resident-o​n=<UUID of the XenServer host> --multiple
You can determine the UUID of the host which failed by running the `xe host-list`​ command.

2. reset the power status of the VMs to halted using the following command:
xe vm-reset-p​owerstate vm=<Nam​e of VM received from the command in step 1> force=true​

(repeat this step for all VMs which were running on the failed host)

Once you reset the powerstate​ of the VM using the above command, the VM should appear in XenCenter again and can be started on another XenServer host.

NOTE: make sure that the VM you reset to halted using the vm-reset-p​owerstate command is actually powered off (e.g. because it was running on a XenServer which really failed) and not running on any other XenServer.​ Do NOT use this command while simulating​ the failure of a XenServer by stopping only the network of the host.

Possibly Related Posts

XenServer Pool, Master host failure

Every member of a resource pool contains all the information necessary to take over the role of master if required. When a master node fails, the following sequence of events occurs:

1. The members realize that communication has been lost and each tries to reconnect for sixty seconds.

2. Each member then puts itself into emergency mode, whereby the member XenServer hosts will only accept the pool-emergency commands:
xe pool-emergency-reset-master
and
xe pool-emergency-transition-to-master
If the master comes back up at this point, it re-establishes communication with its members, the members leave emergency mode, and operation returns to normal.
However if the master is really dead, choose one of the remaining members and run the command:
xe pool-emergency-transition-to-master
on it. Once it has become the master, issue the command:
xe pool-recover-slaves
and the members will now point to the new master.
If you repair or replace the server that was the original master, you can simply bring it up, install the XenServer host software, and add it to the pool.

Possibly Related Posts

Thursday, 15 September 2011

Remove a failed Xenserver from Pool

Run the following command to discover the UUID of the broken server:
xe host-list
Use the following command to remove the host:
xe host-forget uuid=<uuid_of_broken_server>
Note that a host should only be forgotten if it is physically unrecoverable, if possible, Hosts should be 'ejected' from the Pool instead.
Once a host has been forgotten it will have to be re-installed.

If the forget command fails with:
This host cannot be forgotten because there are some user VMs still running
Use this command to find witch VMs are listed as running on that server:
xe vm-list resident-on=<uuid_of_broken_server>
Then, for each VM returned by the previous command use the following command:
xe vm-reset-powerstate uuid=<VM_uuid>
Then try the forget command again.

Possibly Related Posts

Sunday, 10 July 2011

VM Stuck in "Pending" State on XenServer (orange/yellow icon)

This happens when some task is staled, in this case, from the XenServer console CLI:

1. Get the list of Pending tasks
xe task-list
2. Cancel the pending task
xe task-cancel force=true uuid=<the UUID from the above command>

Possibly Related Posts

Saturday, 9 July 2011

Xenserver - Edit grub.conf of halted VM

If a VM doesn’t boot due to an incorrect grub configuration, you can use the xe-edit-bootloader script in the XenServer control domain to edit the grub.conf until the config works, example:
xe-edit-bootloader -n "VM Name" -p 1
This will open the grub.conf file of the specified VM in nano editor.

Possibly Related Posts

Resizing LUNs for Xenserver SRs with Script

Here is another solution for re-sizing a LUN on a ISCSI Xenserver SR without rebooting.

First you need to resize the lun on the iscsi server, then use the following script:

SR_NAME=$1
#Get SR UUID
SR2GROW=$(xe sr-list params=uuid name-label=$SR_NAME | awk '{ print $NF }')
# find devices to resize
DEV2GROW=$(pvscan | grep $SR2GROW | awk '{ print $2 }')
# scan for resized devices
iscsiadm -m node -R
# do the resize
for dev in $DEV2GROW ; do
pvresize $dev
done
# tell xenapi to look for the new LVM size
xe sr-scan uuid=${SR2GROW}

Possibly Related Posts

Friday, 8 July 2011

Set Xenserver VMs Custom Fields with a script

On a previous post I've shown you a script that I use to backup my virtual machines on a XenServer Pool, but I have a lot of VMs so it's not easy to set the custom fields for every VM. So I've made another script that allows you set the custom fields on every VM or in a group of VMs using the tags from XenCenter.

you can use the script like this:

setCustomFields.sh [-t tag] [<template_frequency> <template_retention> <xva_frequency> <xva_retention>]

if you omit the -t flag it sets the custom fields for all VMs

And the script goes like this:


#!/bin/bash
#
# Variables
#

TAG="all"


LOCKFILE=/tmp/snapback.lock

if [ -f $LOCKFILE ]; then
echo "Lockfile $LOCKFILE exists, exiting!"
exit 1
fi

touch $LOCKFILE

#
# Don't modify below this line
#

# using getopts to parse arguments
while getopts 't:' OPTION
do
case $OPTION in
t) TAG="$OPTARG"
;;
?) printf "Usage: %s: [-t tag] [<template_frequency> <template_retention> <xva_frequency> <xva_retention>]\n" $(basename $0) >&2
exit 2
;;
esac
done
shift $(($OPTIND - 1))

TEMPLATE_BACKUP=${1:-weekly}
TEMPLATE_KEEP=${2:-1}

XVA_BACKUP=${3:-weekly}
XVA_KEEP=${4:-1}

# Quick hack to grab the required paramater from the output of the xe command
function xe_param()
{
PARAM=$1
while read DATA; do
LINE=$(echo $DATA | egrep "$PARAM")
if [ $? -eq 0 ]; then
echo "$LINE" | awk 'BEGIN{FS=": "}{print $2}'
fi
done
}

# Get all running VMs
RUNNING_VMS=$(xe vm-list power-state=running is-control-domain=false | xe_param uuid)

for VM in $RUNNING_VMS; do
VM_NAME="$(xe vm-list uuid=$VM | xe_param name-label)"

echo " "
echo "= Retrieving backup paramaters for $VM_NAME - $(date) ="
#echo "= $VM_NAME uuid is $VM ="
#Template backups
SCHEDULE=$(xe vm-param-get uuid=$VM param-name=other-config param-key=XenCenter.CustomFields.backup)
RETAIN=$(xe vm-param-get uuid=$VM param-name=other-config param-key=XenCenter.CustomFields.retain)
#XVA Backups
XVA_SCHEDULE=$(xe vm-param-get uuid=$VM param-name=other-config param-key=XenCenter.CustomFields.xva_backup)
XVA_RETAIN=$(xe vm-param-get uuid=$VM param-name=other-config param-key=XenCenter.CustomFields.xva_retain)

if [[ $TAG == "all" ]]
then
VM_TAGS=$TAG
else
VM_TAGS=$(xe vm-param-get uuid=$VM param-name=tags)
fi

if [[ $VM_TAGS == *$TAG* ]]
then

if [ "$SCHEDULE" != "$TEMPLATE_BACKUP" ]; then
echo "Updating template backup schedule..."
xe vm-param-set uuid=$VM other-config:XenCenter.CustomFields.backup="$TEMPLATE_BACKUP"
fi

if [ "$RETAIN" != "$TEMPLATE_KEEP" ]; then
echo "Updating template backup retention..."
xe vm-param-set uuid=$VM other-config:XenCenter.CustomFields.retain="$TEMPLATE_KEEP"
fi

if [ "$XVA_SCHEDULE" != "$XVA_BACKUP" ]; then
echo "Updating XVA backup schedule..."
xe vm-param-set uuid=$VM other-config:XenCenter.CustomFields.xva_backup="$XVA_BACKUP"
fi

if [ "$XVA_RETAIN" != "$XVA_KEEP" ]; then
echo "Updating template XVA retention..."
xe vm-param-set uuid=$VM other-config:XenCenter.CustomFields.xva_retain="$XVA_KEEP"
fi

fi

done

rm $LOCKFILE

Possibly Related Posts

Resizing LUNs for Xenserver SRs

Perform steps 2-7 on the Pool Master:

1. Extend the volume/LUN from the SAN management console

2.Execute the following command and note the uuid of the SR.
xe sr-list name-label=<your SR name you want to resize>
3.To get the device name (eg: PV /dev/sdj ) use:
pvscan | grep <the uuid you noted in the previous step>
4.Tell the serve to refresh the iscsi connection:
echo 1 > /sys/block/device/device/rescan (e.g. echo 1 > /sys/block/sdj/device/rescan)
5.Resize the volume
pvresize <device name> (eg: pvresize /dev/sdj )
6. Rescan the SR:
xe sr-scan <the uuid you noted in the previous step>
7. Verify that the XE host sees the larger physical disk:
pvscan | grep <the uuid you noted in step 2>

References: http://blogs.citrix.com/2011/03/07/live-lun-resize-on-xenserver/

Possibly Related Posts

Tuesday, 5 July 2011

Reclaim Disk Space from Deleted XenServer Snapshots and Clones

Running this script will incur some downtime for the VM, due the suspend/resume operations performed.

This instructions are for XenServer 5.6 and later

Citrix recommends that you back up the VM on which you will run the space reclamation tool. You can use the XenCenter export option for this purpose.

Run the following command from the XenServer CLI:
xe host-call-plugin host-uuid=<host-UUID> plugin=coalesce-leaf fn=leaf-coalesce args:vm_uuid=<VM-UUID>
The amount of time required varies based on the amount of data written to the disk since the last snapshot. Smaller VMs (that is, 10 GB or less) take less than a minute.

If the Virtual Disk Images (VDIs) to be coalesced are on shared storage, you must execute the off-line coalesce tool on the pool master.

To get Pool Master UUID you can use this command:
xe pool-list params=master | egrep -o "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"
To get uuids of all running VMs
xe vm-list is-control-domain=false power-state=running params=uuid | egrep -o "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"
so you can create a script to execute the off-line coalescing tool on every VM like this:
#!/bin/bash

MASTER=$(xe pool-list params=master | egrep -o "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}")
#All VMs
RUNNING_VMS=$(xe vm-list is-control-domain=false params=uuid | egrep -o "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}")
#All running VMs
#RUNNING_VMS=$(xe vm-list is-control-domain=false power-state=running params=uuid | egrep -o "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}")
#All halted VMs
#RUNNING_VMS=$(xe vm-list is-control-domain=false power-state=halted  params=uuid | egrep -o "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}")

for VM in $RUNNING_VMS; do
    echo " "
    echo "=== Starting coalesce leaf process for $VM at $(date) ==="
    echo " "

    xe host-call-plugin host-uuid=$MASTER plugin=coalesce-leaf fn=leaf-coalesce args:vm_uuid=$VM

    echo " "
    echo "=== Coalesce leaf process for $VM ended at $(date) ==="
    echo " "
done
references: http://support.citrix.com/article/CTX123400

Possibly Related Posts

Friday, 3 June 2011

Xenserver Backup solution

After reviewing some of the available backup solutions (see my previous post) I've opted to use the script provided by Mark Round but I've modified it a bit to allow backing up the VMs to .xva files with an independent schedule from the template backups, I use this to store xva files of my VMs in tapes monthly.

To use it you just have to place the script in /usr/local/bin/snapback.sh in your pool master host and add a line to /etc/crontab:
2 1 * * * root /usr/local/bin/snapback.sh > /var/log/snapback.log 2>&1
Then you can configure the scheduling and retention for each VM, from the XenCenter, by adding the following costume fields:
  • backup - to set the schedule for the template backups (daily, monthly or weekly)
  • retain - to set the number of backup templates to keep
  • xva_backup - to set the schedule for the xva backups (daily, monthly or weekly)
  • xva_retain - to set the number of xva files to keep
Click in the "read more" link to see the script.

Possibly Related Posts

Saturday, 28 May 2011

Xenserver Backup solutions

There are a lot of different backup solutions available to backup your VMs. So I've compiled a comparative list of some of the available solutions, and in my next post I will tell you about the one I chose for my backups.

Generic Backup Solutions:
Backuppc:http://backuppc.sourceforge.net/
  • No agent needed, it uses rsync, rsyncd or smb
  • File level deduplication across all backups
  • Incremental and full backup scheduling
  • Easy to setup
  • Web interface
  • Command Line Interface
  • No support for tape drives
  • disk-based data backup and recovery
  • Free and Open Source
  • No downtime
Bacula:http://www.bacula.org/
  • Free and Open Source
  • No downtime
  • Support for tape drives and tape libraries
  • Uses agents
  • Web interface
  • wxWidgets interface
  • Command Line Interface
  • can encrypt data in transit
  • supports snapshots via Windows VSS
  • Data backed up by Bacula must be recovered by Bacula
  • user postings online indicate that it can be quite complex to set up
Amanda:http://www.amanda.org/
  • Free and Open Source
  • No downtime
  • Free and Open Source
  • can back up Linux, Unix, Mac and Windows clients to tape, disk and storage grids, such as Amazon Simple Storage Service (S3)
  • Write to Multiple Volumes in Parallel
  • Support for tape drives and tape libraries
  • Virtual tapes
  • use of native tools, such as ufsdump, dump and/or GNU tar
  • Ability to read the backup tapes without Amanda
  • Uses agents
  • Commercial version named Zamanda with added features such as:
    • web-based GUI
    • management console
    • one-click restore and reporting application agents (priced additionally) for Microsoft Exchange, SQL Server and SharePoint, and Oracle
    • 24/7 customer support
    • orderly new feature release schedule
  • Commercial Version Pricing (http://network.zmanda.com/shop/home.php?cat=1,3):
    • Basic:
      • Server $400
      • Linux, Solaris and Windows Cients $150
      • Windows Clients for desktops and laptops $200
      • Backup to S3 option $250
    • Standard:
      • Server $500
      • Linux, Solaris and Windows Cients $300
      • Windows Clients for desktops and laptops $300
      • Backup to S3 option $500
      • Oracle agent $300
      • Postgres agent $300
      • VMWare vSphere and ESXi client $300
    • Premium:
      • Server $750
      • Linux, Solaris and Windows Cients $450
      • Windows Clients for desktops and laptops $450
      • Backup to S3 option $750
      • Oracle agent $300
      • Postgres agent $450
      • VMWare vSphere and ESXi client $450
Acronis Backup:http://www.acronis.eu/
  • Uses agents
  • Server runs on Windows
  • Supports Tape drives and tape autoloaders
  • Compress backups to optimize your storage space.
  • Save storage space and time by excluding non-essential files and folders from backups.
  • Store backups into two different locations — backup to a local disk and a copy to a network share.
  • Automatic or manual splitting of backups
  • Bare-metal restore
  • Perform remote restores of your networked machines
  • Restore to dissimilar hardware-optional
  • Convert backup images to virtual machine formats compatible with VMware, Microsoft Hyper-V, Citrix XenServer and Parallels environments.
  • install Agent on unlimited number of virtual machines
  • Automated deletion of outdated backups
  • Backup validation and consolidation by Acronis Storage Node
  • Consolidate incremental and differential backups to save space (Deduplication).
  • Templates for backup rotation schemes
  • Centralized management
  • Reporting and monitoring
  • Command line with scripting support
  • Encrypted network communications
  • Costs 1784€ per license
Xen specific Backup Solutions:
Manual Snapshots:
XenServer supports three types of VM snapshots: regular, quiesced and snapshot with memory. Regular snapshots are crash consistent and can be performed on all VM types. The VM snapshot contains all the storage information and VM configuration, including attached VIFs, allowing them to be exported and restored for backup purposes.

Quiesced snapshots take advantage of the Windows Volume Shadow Copy Service (VSS) to generate application consistent point-in-time snapshots. The VSS framework helps VSS-aware applications like Microsoft Exchange or Microsoft SQL Server to flush data to disk and prepare for the snapshot before it is taken. XenServer supports quiesced snapshots on Windows Server 2003 and Windows Server 2008 for both 32-bit and 64-bit variants. Windows 2000, Windows XP and Windows Vista are not supported.

Snapshot with memory save the VMs state (RAM).This can be useful if you are upgrading or patching software, or want to test a new application, but also want the option to be able to get back to the current, pre-change state (RAM) of the VM. Reverting back to a snapshot with memory, does not require a reboot of the VM.

Backup across multiple external disks:http://couleetechlink.com/xenbackup.php
  • back up to muliple esata hard drive's so if you have a 1.5 tb image and only 2 1tb esata hard drives you can span it between both.
  • This will work with any number of drive’s as long as the total combined disk space is larger then the vm’s you are trying to back up.
  • This also works if you only have one drive
  • The backup will be just a little larger then the used space on the drive, so even if you have a 2tb virtual drive but it is only using 500gb it should fit on a drive with 600gb or more freespace.
  • need to manualy create a list of VMs to backup
Zero-Downtime Limited-Space Backup Script:
http://community.citrix.com/display/xs/Zero-Downtime+Limited-Space+Backup
http://community.citrix.com/display/xs/Zero-Downtime+Limited-Space+Backup+and+Restore
  • Currently, Windows servers are not supported, only Linux VMs and the XenServer instance, itself.
  • based on using the python API and command-line LVM snapshots
  • No downtime
  • Free and Open Source
  • Limited space - "Doing built-in snapshots of VM's was not feasible for us. Currently, there is no way to exclude disks in a snapshot (that we have found). A snapshot will take about double the currently used space for a disk on an SR, and this space cannot be reclaimed until the snapshot is deleted and the machine is shutdown to be coalesced. In one of our VMs we have about 8 TB of user drive space, with no extra space on the SRs where the disks are allocated. We don't have enough room, nor do we care about creating a snapshot with the user data since it is already backed up with netbackup. The script allows us to get no-downtime snapshots of the system disks with only requiring a small and temporary amount of extra space on the SRs".
  • The python API is used to gather metadata about the VM, its disks, and its network interfaces. The metadata is written to plain text files. The data from the disks is imaged by doing a dd on the lvm volumes that correspond to the VDIs for the disks.
  • To restore, a new VM is created and given the memory and CPUs settings stored in the metadata. Then the VIF and disks are restored with the stored images being written to the new lvm volumes.
  • The script is still a work in progress
  • Support for Windows will be added
TINABS (This Is Not Another Backup Script):
http://code.google.com/p/xenserver-vms-live-backup/
  • It is based on using the python API and tested under XenServer 5.6 FP1
  • This library allows you to create simple scripts to backup the skeleton of one or more virtual machines.
  • Data disks are not included and they are recreated empty
  • The core of the library is the backup() function which iterates through a list of user supplied virtual machine and:
    • gets a snapshot of the system disk, attach it to a brand new virtual machine created based on the parameters of the current one in the list,
    • recreates any data disks on a shared SR (I preferly use an NFS SR as destination due to the fact thatt “For file-based VHDs, all nodes consume only as much data as has been written, and the leaf node files grow to accommodate data as it is actively written. If a 100GB VDI is allocated for a new VM and an OS is installed, the VDI file will physically be only the size of the OS data that has been written to the disk, plus some minor metadata overhead” as stated in XenServer Administrator's Guide) and attaches them to the backup one,
    • recreates any VIFs of the original virtual machine and attaches them to the backup one,
    • exports the backup virtual machine in .xva format on a local directory,
    • completely deletes the backup virtual machine.
  • The restoring process simply consists in importing the .xva previously created and restoring any data from a backup!
  • Live backup and export of virtual machines.
  • I don't care about creating a snapshot of the entire virtual machine including even any data disks since their data are already backed up with a backup tool.
  • Run from a remote host (even a Windows machine)
  • Provide a simple GUI (WxPython + XRC)
  • By default (if running through the GUI) all pool's virtual machines tagged with the current day of the week (in the format: Mon, Tue, Wed, Thu, Fri, Sat, Sun) are selected for backup.
  • A single virtual machine can be selected as well
NOTE: In some cases useing the following scritps the disk space won't be freed after deleting the snapshots, if that happens follow this instructions:
http://support.citrix.com/article/CTX123400 but according to http://support.citrix.com/article/CTX127362 this problem is solved in XenServer 5.6 FP1

XenServer Live Backup Script:
http://community.spiceworks.com/scripts/show/161-xenserver-live-backup?page=2

  • runs on windows
  • written in VBScript
  • Requires that XenCenter be installed on Windows machine you run the script from.
  • Beta Stage
Filippo Zanardo's Xenbackup Script:http://pipposan.wordpress.com/2010/06/16/xenserver-final-backup-script-with-or-without-snapshot/http://code.google.com/p/xenbackup/
  • written in Perl
  • skip VMs by adding them to a list
  • Optional use of snapshot: if set to true backup script try to make a snapshot of the vm, else he shutdown the machine, export and power on the machine
  • Mail Notification
  • Optionaly create a subfolder in the store for each backup based on vm name
  • versioning: Set to true to let the script manage to delete the backup older than a certain day or number or hours specified in the $delnumber variable
  • automount: if set to true script try to mount the backupdir specified in mountcommand at start and umount at end, else no action taken and u have to mount dir manually
  • checkspace: if set to true the script check the avaiable space on the backup dir and if less than $spacerequired quit with a message, size is in MB
  • Free and Open Source
  • the author is also working on a web based Xen backup solution (http://pipposan.wordpress.com/2010/12/28/web-xen-server-backup/)
Andy Burton's VM export script:
http://www.andy-burton.co.uk/blog/index.php/2009-08/citrix-xenserver-automated-live-vm-backup-to-windows-cifs-share/
or
http://www.andy-burton.co.uk/blog/index.php/2009-11/updated-citrix-xenserver-5-5-automatic-vm-backup-scripts/
  • Backup of the entire machine
  • Fast recovery in case of disaster
  • Free and Open Source
  • No downtime
  • VDI removal – Run in addition to the standard vm-uninstall command to stop snapshotted VMs allocating all your disk space
  • Backup VM selection – Select between all, running, none and specifically set (by VM uuid) virtual machines.
  • Quiesce snapshots – To take advantage of the quiesce snapshot functionality if the VM supports it.
  • There is an improved version on http://www.8layer8.com/xen/ (posted in: http://www.8layer8.com/?p=260) this version adds:
    • some cleanup scripts to handle disk remounts, removal of older backup images, and some logic to not back up if the backup drive is not present and mounted
    • A plaintext dump of all the info needed to figure out what used to be connected to what and where it used to live, all the SR, VM, VIF, UUID's etc. are here in a reasonably readable format if needed.
    • A sctipt that unmounts and remounts the backup disk, and then cleans it up so that we only have the last two backups on it. Needs some logic to abort if the drive isn't, or can't be, mounted.
    • A script to back up the metadata of the Xen Pool in a restorable format. Backs up the host machines over to the backup drive as well.
  • Back up all the VM's, Xen hosts, and metadata from a single Xen host, so you only need to set this up on one machine
  • Backup destination can be an NFS share, SMB share, USB disk, flash drive, or anything else you can get mounted up.
Markround Script:
http://www.markround.com/archives/61-Xenserver-snapshot-and-template-based-backup-script.html
  • Similar to the previous but more complete
  • Backup and retention policy can be configured from XenCenter
  • Ability to use a different SR for the backups
Alike:http://quorumsoft.com/learnmore.php
  • Agentless backup for XenServer
  • Comes in 3 versions, free, Standard ($899/XenServer Host) and DR ($1189/XenServer Host)
  • Volume licensing
  • Block-level data deduplication across all VMs backed up
  • Friendly UI
  • Versions each snapshot that is backed up
  • Alike is able to backup any or all of the drives in any VM
  • Jobs can be scheduled daily, weekly, or monthly; may be configured for multiple runs per day
  • Alike can run on 64-bit Windows, can back up any guest OS
  • Backup to Any Common Storage Type
  • Alike can fully automate and schedule Citrix's Coalesce tool, dramatically simplifying the reclaim process.
  • Alike can schedule the export, migration or replication of your VMs, providing simple offsite support.
  • Alike installs nothing on the XenServer host operating system (Dom0), and does not require disk from XenServer Storage Repository (SR).
PHD backup:
http://www.phdvirtual.com/server_virtualization_citrix_xenserver
  • Block level deduplication
  • No downtime
  • Backups saved as VHD
  • File level recovery Any OS, Any File System
  • Removes the need to deploy and manage a separate physical server, additional software, scripts or agents for backup and recovery of the virtual environment
  • Simple to Deploy & Easy to Use
  • Integrate management for backup and recovery into XenCenter
  • Data is checked both during the backup and restore processes ensuring data integrity. Self-healing is provided by automatically detecting and repairing corrupt data blocks.
  • Multiple Data Streams for Fast Backup and Restore
  • Job Scheduling
  • Supports Tape Backup Solutions
  • Application Consistent Backup using VSS
  • E-mail notification
  • Support for Thin Provisioned Disks
  • Backup Storage Warnings
  • Distributed Virtual Switch Support
  • Supports all Operating Systems supported by XenServer
  • Licence per host
  • we own the licences with an optional annual subscription.
  • 1395$ until the end of the month, regualrly 2000$ per server. with one year suppor included (email and phone suppot, updates and patches)
  • 280$ per host for the annual subscription 11/5 EST working hours
  • Resellers in Portugal
  • 15 day trial

Possibly Related Posts

Thursday, 26 May 2011

xe command list

Here is a list of the most common commands, for more information visit:
http://wiki.xensource.com/xenwiki/Command_Line_Interface

Virtual Machines
List of available virtual machines
xe vm-list
Get uuids of all running VMs
xe vm-list is-control-domain=false power-state=running params=uuid | egrep -o "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"
Force shutdown a virtual machine
xe vm-reset-powerstate uuid=uuid-of-the-VM force=true
Shutdown VM
xe vm-shutdown vm=<uuid>
Suspend VM
xe vm-suspend vm=<uuid>
List all the parameters available on the selected host
xe vm-param-list uuid=1b334f12-66cf-73cc-b0f9-3059519ace27

CPUs
Set the number of cores with:
xe vm-param-s<wbr/>et platform:c<wbr/>ores-per-soc<wbr/>ket=4 uuid=xxxxx<wbr/>x
Set the number of CPUS at startup:
xe vm-param-s<wbr/>et VCPUs-at-s<wbr/>tartup=8 uuid=xxxxx<wbr/>x
Set the max number of CPUS:
xe vm-param-s<wbr/>et VCPUs-max=<wbr/>8 uuid=xxxxx<wbr/>xx
Hosts
List hosts
xe host-list
Shutdown host
xe host-shutdown host=<uuid>
Remove Host from Pool
xe host-forget uuid=<toasted_host_uuid>
Get Pool Master UUID
xe pool-list params=master | egrep -o "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"
Eject host from pool
xe pool-eject host-uuid=9712025f-9b98-4c25-81ef-9222993b71f9
Get VMs running on specified host
xe vm-list resident-on=<host uuid=""> is-control-domain=false
Pending tasks:
xe task-list #to view the Pending tasks
xe task-cancel force=true uuid=<UUID> #to cancel a specific task
Last resort:
xe-toolstack-restart
Networking
Lists networks
xe network-list
Lists Physical Network Cards with specified MAC Address
xe pif-list MAC=1c:c1:de:6b:9f:22
Create a new Network
xe network-create name-label=VLAN_DMZ
Assign a network to a Physical Network Card with a VLAN
xe vlan-create network-uuid=329b55d1-0f77-512a-63ed-8b6bcf429e99 pif-uuid=80c1ea1a-4beb-c1ee-f69d-14e3a699587e vlan=205
Backups
Export VM or snapshot to XVA
xe vm-export vm=<uuid_or_name> filename=/backup/Ubuntu_backup.xva
Import XVA file
xe vm-import vm=<name> filename=/backup/Ubuntu_backup.xva
Create a snapshot
xe vm-snapshot vm="<vm_name>" new-name-label="snapshot_name"
Convert snapshot to template
xe snapshot-copy uuid=<snapshot_uuid> sr-uuid=<sr_uuid> new-name-description="Description" new-name-label="Template Name"

Possibly Related Posts