Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 02-15-2011, 02:30 PM   #1
Mustafa Ismail Mustafa
Registered: Nov 2009
Location: Amman, Jordan
Distribution: Ubuntu 10.04, CentOS 5.5, FreeBSD 7.2, Debian Squeeze, PC-BSD 8
Posts: 44

Rep: Reputation: 0
Backup XenServer VMs

OK, so I've been using Andy Burton's fantastic XenServer VM backup script (Clickety) and the only fault I can find is not script based but XenServer. If you try and overwrite an already existing backed up VM, XenServer seems to ignore that.

So, I decided to tackle the situation by doing the following:

Grab a list of the files that already exist and serializing that list
Perform the actual VM backups
Delete the original files that are in the serialized file
Delete the serialized file itself
And I'm trying to improve my python-fu so I decided to do this (1,3 and 4) with python scripts and still do the backup with Andy's, possibly moving to my own python script in the future.

Now I have a pair of scripts, and as follows:


import os
import glob

path = "/home/mim/scripts/python/junk/"
ext = "del"
tmpList = "tmpList"

#create a file with the list of files to remove
#fileList = [file for file in os.listdir(path) if file.endswith(ext)]
fileList = glob.glob(path+"*."+ext)

tmpfile = open(path+tmpList,"w")
for i in fileList:



import os
import glob

path = "/home/mim/scripts/python/junk/"
ext = "del"
tmpList = "tmpList"

#read from the tmpList and delete each file then the tmplist itself
tmpfile = open(path+tmpList,"r")
fileList = tmpfile.readlines()
print fileList
for i in fileList:
#    print(i)
#delete the tmpList

#remove the tmplist file
(please note that there has been some experimentation with the code and the values in there are dummy values for testing before moving to production)

My two questions:

How can I serialize and deserialize the values I retrieve from glob in list format?
Is there a better way of doing this?
This is being run on Python 2.4.3 (the version I found on XenServer 5.x)



Oh yeah, I also thought of doing some smart redirections along the lines of:

ls /path/to/files/*.extension > /path/to/tmpfolder/list.lst
then later

redirect the contents of the files to a "xargs rm" but I wasn't too sure how to do that.

Last edited by Mustafa Ismail Mustafa; 02-15-2011 at 03:02 PM.


python, scripting, xenserver

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is anyone able to install Xenserver by PXE? jerrybuilt Linux - Newbie 1 09-27-2010 06:41 PM
[Tcptraceroute/Traceroute/Ping] Windows VMs & Linux VMs BiFo Linux - Networking 0 08-24-2010 03:07 PM
xenserver compiling issue strubbldesign Linux - Server 6 09-10-2009 03:18 PM
LXer: XenServer 5: First Impressions LXer Syndicated Linux News 0 03-04-2009 01:31 AM
LXer: Using Xen With LVM-Based VMs Instead Of Image-Based VMs (Debian Etch) LXer Syndicated Linux News 0 01-14-2009 09:20 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:52 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration