Commit 6bf955b2 authored by Kristian Feldsam's avatar Kristian Feldsam

3PAR - delete snapshot

Signed-off-by: Kristian Feldsam's avatarKristián Feldsam <feldsam@gmail.com>
parent 45083330
......@@ -76,7 +76,7 @@ def backup_live(one, image, data_store, vm, vm_disk_id, verbose):
snap_id = one.vm.disksnapshotcreate(vm.ID, vm_disk_id, 'Automatic Backup')
if snap_id is False:
raise Exception('Error creating snapshot!')
raise Exception('Error creating snapshot! Check VM logs.')
# get source name and create snap name
name = vv_name(image.SOURCE)
......@@ -95,7 +95,7 @@ def backup_live(one, image, data_store, vm, vm_disk_id, verbose):
except exceptions.HTTPNotFound:
# failed after 60s
if i > 11:
raise Exception('Looks like snapshot is not created. Investigate VM logs')
raise Exception('Looks like snapshot is not created. Check VM logs.')
i += 1
time.sleep(5)
......@@ -133,4 +133,10 @@ def backup_live(one, image, data_store, vm, vm_disk_id, verbose):
print 'Unexporting snapshot from backup server...'
unexport_vv(snap_name, config.EXPORT_HOST)
# delete snapshot
if verbose:
print 'Deleting snapshot...'
if not one.vm.disksnapshotdelete(vm.ID, vm_disk_id, snap_id):
raise Exception('Can not delete snapshot! Check VM logs.')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment