mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-9907 Physical size of snapshot is considered for usage
This commit is contained in:
parent
38701073a6
commit
721f4475f4
@ -42,7 +42,8 @@ public interface SnapshotManager {
|
||||
"Maximum recurring weekly snapshots to be retained for a volume. If the limit is reached, snapshots from the beginning of the week are deleted so that newer ones can be saved. This limit does not apply to manual snapshots. If set to 0, recurring weekly snapshots can not be scheduled.", false, ConfigKey.Scope.Global, null);
|
||||
static final ConfigKey<Integer> SnapshotMonthlyMax = new ConfigKey<Integer>(Integer.class, "snapshot.max.monthly", "Snapshots", "8",
|
||||
"Maximum recurring monthly snapshots to be retained for a volume. If the limit is reached, snapshots from the beginning of the month are deleted so that newer ones can be saved. This limit does not apply to manual snapshots. If set to 0, recurring monthly snapshots can not be scheduled.", false, ConfigKey.Scope.Global, null);
|
||||
|
||||
static final ConfigKey<Boolean> usageSnapshotSelection = new ConfigKey<Boolean>("Usage", Boolean.class, "usage.snapshot.virtualsize.select", "false",
|
||||
"Set the value to true if snapshot usage need to consider virtual size, else physical size is considered ", false);
|
||||
void deletePoliciesForVolume(Long volumeId);
|
||||
|
||||
/**
|
||||
|
||||
@ -1328,5 +1328,5 @@ public class SnapshotManagerImpl extends MutualExclusiveIdsManagerBase implement
|
||||
|
||||
@Override
|
||||
public ConfigKey<?>[] getConfigKeys() {
|
||||
return new ConfigKey<?>[] { SnapshotHourlyMax, SnapshotDailyMax, SnapshotMonthlyMax, SnapshotWeeklyMax}; }
|
||||
return new ConfigKey<?>[] { SnapshotHourlyMax, SnapshotDailyMax, SnapshotMonthlyMax, SnapshotWeeklyMax, usageSnapshotSelection}; }
|
||||
}
|
||||
|
||||
@ -169,6 +169,7 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager, Runna
|
||||
private Future _scheduledFuture = null;
|
||||
private Future _heartbeat = null;
|
||||
private Future _sanity = null;
|
||||
private boolean usageSnapshotSelection = false;
|
||||
|
||||
public UsageManagerImpl() {
|
||||
}
|
||||
@ -208,6 +209,7 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager, Runna
|
||||
String sanityCheckInterval = configs.get("usage.sanity.check.interval");
|
||||
String quotaEnable = configs.get("quota.enable.service");
|
||||
_runQuota = Boolean.valueOf(quotaEnable == null ? "false" : quotaEnable );
|
||||
usageSnapshotSelection = Boolean.valueOf(configs.get("usage.snapshot.virtualsize.select"));
|
||||
if (sanityCheckInterval != null) {
|
||||
_sanityCheckInterval = Integer.parseInt(sanityCheckInterval);
|
||||
}
|
||||
@ -1535,7 +1537,11 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager, Runna
|
||||
|
||||
long snapId = event.getResourceId();
|
||||
if (EventTypes.EVENT_SNAPSHOT_CREATE.equals(event.getType())) {
|
||||
snapSize = event.getSize();
|
||||
if (usageSnapshotSelection){
|
||||
snapSize = event.getVirtualSize();
|
||||
}else {
|
||||
snapSize = event.getSize();
|
||||
}
|
||||
zoneId = event.getZoneId();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user