Showing posts with label xe. Show all posts
Showing posts with label xe. Show all posts

25 July, 2010

Delete all snapshots by name (XenServer)

I posted a blog a while back on how to delete all snapshots from SR.
I found it not working 100%, so I wrote a new script that deletes all Snapshots by name.
So if you use the backup script I wrote you can use this as a pre-step to delete old snapshots.

Here it is:
====================================================

echo === deleting old snapshot ===
set user=[user]
set password=[password]
set server=[IP]
echo Start at:
echo %date% - %time%
:start
C:\Progra~1\Citrix\XenCenter\xe.exe -s %server% -u %user% -pw %Password% template-list name-label=4Backup --minimal > Old_tempates.txt
for /f "tokens=1 delims=," %%G in (Old_tempates.txt) do (
if [%%G] EQU [] (goto end) else (
C:\Progra~1\Citrix\XenCenter\xe.exe -s %server% -u %user% -pw %Password% template-param-set is-a-template=false uuid=%%G
C:\Progra~1\Citrix\XenCenter\xe.exe -s %server% -u %user% -pw %Password% vm-uninstall uuid=%%G force=true
goto start
)
)

:end
=================================================

enjoy...

14 September, 2009

Automatic backup of XenServer vm with vm-export

Hi,

I needed to schedule a weekly backup of my VM's in my XenServer.
When I googled it I found a script written by Jeff Riechers, this script was good but did not help me because I did not have enough storage to take a snapshot to each VM.
I had to tweak it and I improved the method of retrieving the uuid (no more temp files...).

The final script reads from a file (named serverlist.txt) the vm name and the host on it resides. This is because I noticed that when I shut down the VM it gets a deferent home server, so I forced it to start on a specific host.

Just schedule it with cscript and your good to go.

Link to the script