287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
|
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
|
-
+
-
+
|
print >>sys.stderr,"Cannot make snapshot of running VW"
sys.exit(1)
drives=get_drives(options.dir)
os.chdir(options.dir)
newnames={}
for i in drives:
name,ext=os.path.splitext(i)
newnames[i]=name+"."+options.snapname+"."+ext
newnames[i]=name+"."+options.snapname+ext
if os.path.exists(newnames[i]):
print >>sys.stderr,"Snapshot %s already exists",options.snapname
return 1
for i in drives:
os.rename(i,newnames[i])
os.system("qemu-img create -f qcow2 -b \"%s\" \"%s\"" %(i,newnames[i]))
os.system("qemu-img create -f qcow2 -b \"%s\" \"%s\"" %(newnames[i],i))
return 0
def cmd_snapshots(options):
os.chdir(options.dir)
drives = get_drives(options.dir)
lst=[]
info={}
|