Skip to content

Commit 748afb5

Browse files
dvdliaojacksegal
authored andcommitted
Delete before creating new snaps (#84)
according to the docs https://cloud.google.com/compute/docs/disks/restore-and-delete-snapshots#deleting_snapshot this would be slightly more correct since instead of gcp handling the magic of references, we can allow the newly created snapshot to reference the right parent
1 parent 4ef1300 commit 748afb5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gcloud-snapshot.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,12 +376,12 @@ main()
376376

377377
# build snapshot name
378378
local snapshot_name=$(createSnapshotName ${PREFIX} ${device_name} ${DATE_TIME})
379+
380+
# delete snapshots for this disk that were created older than DELETION_DATE
381+
deleteSnapshots "$PREFIX-.*" "$DELETION_DATE" "${device_id}"
379382

380383
# create the snapshot
381384
createSnapshot ${device_name} ${snapshot_name} ${device_zone}
382-
383-
# delete snapshots for this disk that were created older than DELETION_DATE
384-
deleteSnapshots "$PREFIX-.*" "$DELETION_DATE" "${device_id}"
385385
done
386386

387387
logTime "End of google-compute-snapshot"

0 commit comments

Comments
 (0)