コード例 #1
0
def remove_snapshot_backup(snapshot):
    snapshots = snapshot.group.backups.all() if snapshot.group else [snapshot]
    for snapshot in snapshots:

        if snapshot.purge_at:
            continue

        LOG.info("Removing backup for {}".format(snapshot))

        provider = VolumeProviderBase(snapshot.instance)
        provider.delete_snapshot(snapshot)

        snapshot.purge_at = datetime.now()
        snapshot.save()

    return
コード例 #2
0
def remove_snapshot_backup(snapshot, provider=None, force=0, msgs=None):
    snapshots = snapshot.group.backups.all() if snapshot.group else [snapshot]
    for snapshot in snapshots:

        if snapshot.purge_at:
            continue

        LOG.info("Removing backup for {}".format(snapshot))

        if not provider:
            provider = VolumeProviderBase(snapshot.instance)
        removed = provider.delete_snapshot(snapshot, force=force)
        if removed:
            snapshot.purge_at = datetime.now()
            snapshot.save()
            msg = "Backup {} removed".format(snapshot)
            LOG.info(msg)
            if msgs is not None:
                msgs.append(msg)

    return
コード例 #3
0
def remove_snapshot_backup(snapshot, provider=None, force=0, msgs=None):
    snapshots = snapshot.group.backups.all() if snapshot.group else [snapshot]
    for snapshot in snapshots:

        if snapshot.purge_at:
            continue

        LOG.info("Removing backup for {}".format(snapshot))

        if not provider:
            provider = VolumeProviderBase(snapshot.instance)
        removed = provider.delete_snapshot(snapshot, force=force)
        if removed:
            snapshot.purge_at = datetime.now()
            snapshot.save()
            msg = "Backup {} removed".format(snapshot)
            LOG.info(msg)
            if msgs is not None:
                msgs.append(msg)

    return