cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Tutkowski <mike.tutkow...@solidfire.com>
Subject Creating a backup of a hypervisor snapshot
Date Tue, 04 Nov 2014 17:27:46 GMT
Hi,

The standard behavior when we take a snapshot of a volume on XenServer is
to take a hypervisor snapshot of the volume and then copy this snapshot to
secondary storage.

We then try to delete all other hypervisor snapshots for this volume.

I notice the process of deleting all other hypervisor snapshots for this
volume never finds any snapshots to delete and our list of hypervisor
snapshots continues to grow over time for the volume in question.

(Below) Set<VDI> snapshots = volume.getSnapshots(conn); returns the empty
set, so there's nothing to delete.

However, if I look in XenCenter, I can see hypervisor snapshots for the
volume in question.

It appears we are passing in the correct info to this method, too.

When I use xe, it confirms that the VDI that represents our volume does not
have any snapshots, which seems odds.

    protected boolean destroySnapshotOnPrimaryStorageExceptThis(Connection
conn, String volumeUuid, String avoidSnapshotUuid) {

        try {

            VDI volume = getVDIbyUuid(conn, volumeUuid);

            if (volume == null) {

                throw new InternalErrorException("Could not destroy
snapshot on volume " + volumeUuid + " due to can not find it");

            }

            Set<VDI> snapshots = volume.getSnapshots(conn);

            for (VDI snapshot : snapshots) {

                try {

                    if (!snapshot.getUuid(conn).equals(avoidSnapshotUuid)) {

                        snapshot.destroy(conn);

                    }

                } catch (Exception e) {

                    String msg = "Destroying snapshot: " + snapshot + " on
primary storage failed due to " + e.toString();

                    s_logger.warn(msg, e);

                }

            }

            s_logger.debug("Successfully destroyed snapshot on volume: " +
volumeUuid + " execept this current snapshot " + avoidSnapshotUuid);

            return true;

        } catch (XenAPIException e) {

            String msg = "Destroying snapshot on volume: " + volumeUuid + "
execept this current snapshot " + avoidSnapshotUuid + " failed due to " +
e.toString();

            s_logger.error(msg, e);

        } catch (Exception e) {

            String msg = "Destroying snapshot on volume: " + volumeUuid + "
execept this current snapshot " + avoidSnapshotUuid + " failed due to " +
e.toString();

            s_logger.warn(msg, e);

        }


        return false;

    }

-- 
*Mike Tutkowski*
*Senior CloudStack Developer, SolidFire Inc.*
e: mike.tutkowski@solidfire.com
o: 303.746.7302
Advancing the way the world uses the cloud
<http://solidfire.com/solution/overview/?video=play>*™*

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message