Archive for the 'Xen' Category

Managing Additional NICs after XenServer Installation

After Installing XenServer, any new NICs you add will not appear automatically. You need to run the following command from the XenServer console:

xe pif-scan host-uuid=<UUID of XenServer host>

If this command results in interfaces with funny names, such as NIC__tmp1234567890, there’s a way to fix that too. First get the UUID of the interface in question:

xe pif-list device=__tmp<numbers>

Get the host UUID of the interface:

xe pif-param-get param-name=host-uuid uuid=<UUID of interface>

Get the MAC address of the interface:

xe pif-param-get param-name=MAC uuid=<UUID of interface>

Remove the interface:

xe pif-forget uuid=<UUID of interface>

Reintroduce the interface with a more appropriate name:

xe pif-introduce device=eth<n> host-uuid=<UUID of XenServer host>  mac=<MAC address of interface>

And that’s it! Note that this process may cause the vendor name, device name, and PCI Bus Path to disappear in the host’s NICs tab in XenCenter. I’m not sure why this happens, but it seems to fix itself eventually. Also note that this process will leave behind “orphan” networks with names like “Pool-wide network associated with __tmp1234567890.” These networks can be safely and easily deleted via XenCenter.

xen-vm-autosnapshot.py 1.2

The xen-vm-autosnapshot.py script has been updated with an important new option: –snapshot-tag. I still can’t believe I made such a silly oversight, but previous versions of this script had no way of differentiating between snapshots created automatically and those that were created manually. So if you happened to have some old manual snapshots lying around, the snapshot-rotate routine would have rotated them along with all the rest.

The –snapshot-tag option fixes this by allowing you to “tag” each snapshot as it’s created. Then the snapshot-rotate routine will only consider snapshots with the correct “tag.” This also allows for more advanced snapshot/rotation schedules.

Thanks to Adam Adamou at NJEDge.Net for his input.

xen-vm-autosnapshot.py 1.1

The xen-vm-autosnapshot.py script has been updated. It can now accept strings for –log-level (e.g. –log-level=debug), and the –test option has been renamed to –dry-run (since that’s the convention everyone else in the world seems to be used to).

Some of you have been asking about the problem where snapshots get locked and can’t be deleted from NetApp volumes. Unfortunately, this appears to be related to the way the XenServer API interacts with NetApp’s DATA OnTap API. Unless someone out there can enlighten me, I don’t think there’s much we can do, other than wait for Citrix to fix their API. =(

Automatic, Rotating VM Snapshots on Xen with xen-vm-autosnapshot.py

My new Xen Tools project page is up, and my first tool is ready for wide-spread use.  xen-vm-autosnapshot.py is a command line program (written in Python, of course) that will take automatic, rotating snapshots of virtual machines running on a Xen host. Enjoy!

When in Doubt, Restart the Xen Toolstack

I’ve had a few really strange Xen problems that I was only able to resolve by doing a rolling-reboot of the individual Xen hosts. This was a real pain in the ass, but now I’ve discovered a way to restart the Xen toolstack without affecting the running VMs:

xe-toolstack-restart

Note that you sometimes need to run this command on the master in your pool rather than the actual XenServer(s) having problems.