Created
June 6, 2015 01:03
-
-
Save murarisumit/da7fd6f94644aaefceec to your computer and use it in GitHub Desktop.
Delete Orphan snapshots
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
snapshots = conn.get_all_snapshots(owner="self") #Fetch only my snapshot | |
volumes = conn.get_all_volumes() | |
for snapshot in snapshots: | |
volume_id = snapshot.volume_id | |
presence = False | |
temp = volumes | |
for volume in temp: | |
print ".", | |
if volume_id == volume.id: | |
presence = True | |
print " " | |
break | |
if presence == False: | |
count +=1 | |
print " " | |
snapshot.delete() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment