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!
Categories
- /etc (15)
- Apache (3)
- DNS (2)
- Hardware (7)
- Information Technology (8)
- Linux (14)
- MySQL (2)
- Networking (7)
- Programming (20)
- Rants (9)
- Windows (5)
- Xen (6)
Archives
- December 2009 (1)
- November 2009 (1)
- October 2009 (2)
- September 2009 (6)
- August 2009 (2)
- July 2009 (3)
- June 2009 (3)
- May 2009 (5)
- April 2009 (1)
- March 2009 (1)
- February 2009 (2)
- January 2009 (2)
- December 2008 (4)
- November 2008 (3)
- October 2008 (3)
- September 2008 (1)
- August 2008 (1)
- July 2008 (2)
- June 2008 (2)
- April 2008 (1)
- March 2008 (6)
- February 2008 (3)
- November 2007 (3)
- October 2007 (1)
- September 2007 (1)
- October 2006 (2)
- September 2006 (6)
- August 2006 (2)
- July 2006 (2)
- May 2006 (1)
- April 2006 (3)
- March 2006 (4)
I replied to your thread on the citrix forums and I decided to post here as well to get some advice. How do I run this script? I tried to run it and got “: No such file or directory”. Any ideas?
you should try running the script with –log-level=10 to see what it was doing before it error’d out. also check the –help option to see all the available options. if you still aren’t getting anywhere, feel free to post the output when you run the script with –log-level=10.
Hello Mike,
Did you check on the Netapp WebGUI that the snapshots are deleted?
As far as I know, when you create a snapshot of a VM in a Netapp SR environment, and then create another one. The first can’t be deleted. It is deleted from XenServer but is not deleted from the Netapp volume.
Did you check this? Does this happen to you?
Thanks,
hello nadav, this is a very interesting problem (and one which i had never noticed before).
the vm/vdi snapshots are deleted from the xenserver (as well as from the netapp gui), but the *volume* snapshots seem to remain forever until you delete every vm/vdi snapshot that was created in that volume. it’s almost as if subsequent snapshots are reliant upon the previous ones somehow. do you happen to know why this happens? i never saw anything about this in the xenserver api docs. in any case, it looks like i have some investigating to do…
hey nadav, i just found a thread about this on the xenserver forums. so i guess the answer is that we need to wait for citrix to fix their api?
I’m getting…
File “./xen-vm-autosnapshot.py”, line 305
finally:
^
SyntaxError: invalid syntax
…which apparently is a problem with pre py2.5 versions? I haven’t been able to install the latest xenserver updates so I suspect python 2.5 is in one of those.
hey kit,
the syntax error you’re getting is because of a change that was made to the “try” statement in python 2.5.
you don’t need to install the script on the xenserver itself though. if you’re just testing, you can even run it from your desktop if you want.
any news on the post about volume snapshots not deleting?
Quick suggestion: Add the URL to this page to the comments in that file. It’s a small detail, but it means anybody who gets a copy of this script knows where to come for updates.
thanks ross, i thought i did that, but i guess not! in the latest version, the website shows up when you use the –version option.
Is there a good way, Mike, that you know of to make this script work for only the windows based VMs?
unfortunately, i dont think the xen api provides a way to see what operating system is running on a particular vm. at the moment, the only way to select vms is by name (using the –vms option), so if you know which machines are running windows, you could always use a regular expression like –vms=”(vm1|vm2|vm3)”.
how does one load the xenapi on a server so that this script can use it. I have py2.5 on this other machine but it’s now throwing errors wanting xenapi… :\
XenAPI.py should be placed either in the same directory as xen-vm-autosnapshot.py, or in the python site-packages directory (usually /usr/lib/python2.5/site-packages on linux or c:\Python25\Lib\site-packages on windows). See PYTHONPATH.
Hey guys,
One of my VMs has started giving this error when attempting to perform a snapshot. I have Xenserver 5.0 with a netapp backend over nfs.
['SR_BACKEND_FAILURE_109', '', 'The snapshot chain is too long', '']
Any ideas?
if im not mistaken, it looks like you hit netapp’s 255-snapshot-per-volume limit. this is exactly why we need citrix to fix their api. xen snapshots are basically useless at this point. =/
Where would I go to view these snapshots? Can I remove them?
I updated my xenservers to 5.5 and snapshots seem to work in the console…is this script set up to work with 5.5?
kit, you should read the other comments in this thread, as they will answer your questions about the snapshot problem.
as far as i know, the script will work with 5.5.
Sorry… :\