def snapshot(env): """Create a snapshot of an existing vlmc Image.""" name = env.get("name") snapshot_name = env.get("snapshot_name") sys.stderr.write("Creating snapshot '%s' from '%s'\n" % (snapshot_name, name)) vlmc.snapshot(name=name, snap_name=snapshot_name) return 0
def snapshot(volume): vlmc.snapshot(name=volume)
RANDOMSIZE = 20 * 1024 * 1024 test_create(tmpvolume, volumesize=10240) try: write(tmpvolume, 10240) mkfs_and_mount(tmpvolume, mntdir) rf = [getrandomfile(RANDOMSIZE)] write_data(tmpvolume, mntdir, rf) archipelago.restart(user=True) read_data(tmpvolume, mntdir, rf) #snapshot snapname = gettempname(prefix="snapshot") print "Snapshot ", tmpvolume, "to", snapname snap = vlmc.snapshot(name=tmpvolume, snap_name=snapname) clonedvolume = gettempname() print "Cloning ", snapname, "to", clonedvolume test_create(clonedvolume, snap=snapname) except Exception as e: print e vlmc.remove(name=tmpvolume) raise e #create clone volume from snapshot try: rf1 = [getrandomfile(RANDOMSIZE)] #write new data to old volume write_data(tmpvolume, mntdir, rf1) #read new data from old volume read_data(tmpvolume, mntdir, rf1)
RANDOMSIZE=20*1024*1024 test_create(tmpvolume, volumesize=10240) try: write(tmpvolume, 10240) mkfs_and_mount(tmpvolume, mntdir) rf = [getrandomfile(RANDOMSIZE)] write_data(tmpvolume, mntdir, rf) archipelago.restart(user=True) read_data(tmpvolume, mntdir, rf) #snapshot snapname=gettempname(prefix="snapshot") print "Snapshot ", tmpvolume, "to", snapname snap = vlmc.snapshot(name=tmpvolume, snap_name=snapname) clonedvolume=gettempname() print "Cloning ", snapname, "to", clonedvolume test_create(clonedvolume, snap=snapname) except Exception as e: print e vlmc.remove(name=tmpvolume) raise e #create clone volume from snapshot try: rf1 = [getrandomfile(RANDOMSIZE)] #write new data to old volume write_data(tmpvolume, mntdir, rf1) #read new data from old volume read_data(tmpvolume, mntdir, rf1)