Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/src/com/cloud/event/EventTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ public class EventTypes {

// Snapshots
public static final String EVENT_SNAPSHOT_CREATE = "SNAPSHOT.CREATE";
public static final String EVENT_SNAPSHOT_OFF_PRIMARY = "SNAPSHOT.OFF_PRIMARY";
public static final String EVENT_SNAPSHOT_DELETE = "SNAPSHOT.DELETE";
public static final String EVENT_SNAPSHOT_REVERT = "SNAPSHOT.REVERT";
public static final String EVENT_SNAPSHOT_POLICY_CREATE = "SNAPSHOTPOLICY.CREATE";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import com.cloud.agent.AgentManager;
import com.cloud.agent.api.to.DiskTO;
import com.cloud.dc.dao.ClusterDao;
import com.cloud.event.ActionEvent;
import com.cloud.event.EventTypes;
import com.cloud.event.UsageEventUtils;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.host.HostVO;
import com.cloud.host.dao.HostDao;
Expand Down Expand Up @@ -147,7 +150,9 @@ public boolean deleteSnapshot(Long snapshotId) {
* @return true if snapshot is removed, false otherwise
*/

@ActionEvent(eventType = EventTypes.EVENT_SNAPSHOT_DELETE, eventDescription = "deleting snapshot", async = true)
private boolean cleanupSnapshotOnPrimaryStore(long snapshotId) {
s_logger.info("IR24 cleanupSnapshotOnPrimaryStore snapshotId " + snapshotId);

SnapshotObject snapshotObj = (SnapshotObject)snapshotDataFactory.getSnapshot(snapshotId, DataStoreRole.Primary);

Expand Down Expand Up @@ -176,6 +181,8 @@ private boolean cleanupSnapshotOnPrimaryStore(long snapshotId) {
snapshotSvr.deleteSnapshot(snapshotObj);

snapshotObj.processEvent(Snapshot.Event.OperationSucceeded);
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_SNAPSHOT_DELETE, snapshotObj.getAccountId(), snapshotObj.getDataCenterId(), snapshotId,
snapshotObj.getName(), null, null, 0L, snapshotObj.getClass().getName(), snapshotObj.getUuid());
}
catch (Exception e) {
s_logger.debug("Failed to delete snapshot: ", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public Snapshot createSnapshot(Long volumeId, Long policyId, Long snapshotId, Ac
}

@Override
public Snapshot backupSnapshot(Long snapshotId) {
public Snapshot backupSnapshot(Long snapshotId) { // IR24
SnapshotInfo snapshot = snapshotFactory.getSnapshot(snapshotId, DataStoreRole.Image);
if (snapshot != null) {
throw new CloudRuntimeException("Already in the backup snapshot:" + snapshotId);
Expand Down