Showing posts with label citrix. Show all posts
Showing posts with label citrix. Show all 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

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

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

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

Convert VMware to Xen

http://support.citrix.com/article/CTX116603
  • Uninstall vmtools
    • on linux - vmware-uninstall-tools.pl
    • on windows uninstall from control panel
  • Power off
  • From VSphere export as OVF
  • From XenCenter import OVF

Possibly Related Posts