Skip to content

Instantly share code, notes, and snippets.

@murarisumit
Created June 6, 2015 01:03
Show Gist options
  • Save murarisumit/da7fd6f94644aaefceec to your computer and use it in GitHub Desktop.
Save murarisumit/da7fd6f94644aaefceec to your computer and use it in GitHub Desktop.
Delete Orphan snapshots
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