diff --git a/api/src/com/cloud/server/ResourceTag.java b/api/src/com/cloud/server/ResourceTag.java index d91bb7d519a..bf18d65e8c9 100644 --- a/api/src/com/cloud/server/ResourceTag.java +++ b/api/src/com/cloud/server/ResourceTag.java @@ -55,7 +55,8 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit AutoScaleVmProfile(false, true), AutoScaleVmGroup(false, true), LBStickinessPolicy(false, true), - LBHealthCheckPolicy(false, true); + LBHealthCheckPolicy(false, true), + SnapshotPolicy(false, true); ResourceObjectType(boolean resourceTagsSupport, boolean resourceMetadataSupport) { diff --git a/api/src/com/cloud/storage/snapshot/SnapshotPolicy.java b/api/src/com/cloud/storage/snapshot/SnapshotPolicy.java index 37ce6fd1536..22d5dfb9c1b 100644 --- a/api/src/com/cloud/storage/snapshot/SnapshotPolicy.java +++ b/api/src/com/cloud/storage/snapshot/SnapshotPolicy.java @@ -16,10 +16,11 @@ // under the License. package com.cloud.storage.snapshot; +import org.apache.cloudstack.api.Displayable; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; -public interface SnapshotPolicy extends Identity, InternalIdentity { +public interface SnapshotPolicy extends Identity, InternalIdentity, Displayable { long getVolumeId(); diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java index c1381c8d7cc..4e2e6bd3bbd 100644 --- a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java @@ -16,6 +16,7 @@ // under the License. package org.apache.cloudstack.api.command.user.snapshot; +import org.apache.cloudstack.acl.RoleType; import org.apache.log4j.Logger; import org.apache.cloudstack.api.APICommand; @@ -64,6 +65,9 @@ public class CreateSnapshotPolicyCmd extends BaseCmd { @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "the ID of the disk volume") private Long volumeId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the policy to the end user or not", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -88,6 +92,14 @@ public class CreateSnapshotPolicyCmd extends BaseCmd { return volumeId; } + @Override + public boolean isDisplay() { + if(display == null) + return true; + else + return display; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java index ffafe2df7b7..749711f4150 100644 --- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.snapshot; import java.util.ArrayList; import java.util.List; +import org.apache.cloudstack.acl.RoleType; import org.apache.log4j.Logger; import org.apache.cloudstack.api.APICommand; @@ -46,6 +47,9 @@ public class ListSnapshotPoliciesCmd extends BaseListCmd { @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.UUID, entityType = VolumeResponse.class, required = true, description = "the ID of the disk volume") private Long volumeId; + @Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "list resources by display flag; only ROOT admin is eligible to pass this parameter", since = "4.4", authorized = {RoleType.Admin}) + private Boolean display; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -54,6 +58,14 @@ public class ListSnapshotPoliciesCmd extends BaseListCmd { return volumeId; } + @Override + public boolean isDisplay() { + if (display != null) { + return display; + } + return true; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/response/SnapshotPolicyResponse.java b/api/src/org/apache/cloudstack/api/response/SnapshotPolicyResponse.java index 913d2349d0e..39178a3afd6 100644 --- a/api/src/org/apache/cloudstack/api/response/SnapshotPolicyResponse.java +++ b/api/src/org/apache/cloudstack/api/response/SnapshotPolicyResponse.java @@ -18,6 +18,8 @@ package org.apache.cloudstack.api.response; import com.google.gson.annotations.SerializedName; +import org.apache.cloudstack.acl.RoleType; +import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; @@ -50,6 +52,10 @@ public class SnapshotPolicyResponse extends BaseResponse { @Param(description = "the time zone of the snapshot policy") private String timezone; + @SerializedName(ApiConstants.FOR_DISPLAY) + @Param(description = "is this policy for display to the regular user", since = "4.4", authorized = {RoleType.Admin}) + private Boolean forDisplay; + public String getId() { return id; } @@ -97,4 +103,12 @@ public class SnapshotPolicyResponse extends BaseResponse { public void setTimezone(String timezone) { this.timezone = timezone; } + + public Boolean getForDisplay() { + return forDisplay; + } + + public void setForDisplay(Boolean forDisplay) { + this.forDisplay = forDisplay; + } } diff --git a/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml b/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml index 2ef0d206a63..c73d3d9952b 100644 --- a/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml +++ b/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml @@ -254,6 +254,7 @@ + diff --git a/engine/schema/src/com/cloud/storage/SnapshotPolicyVO.java b/engine/schema/src/com/cloud/storage/SnapshotPolicyVO.java index 2f8638e5d1c..c7848586826 100644 --- a/engine/schema/src/com/cloud/storage/SnapshotPolicyVO.java +++ b/engine/schema/src/com/cloud/storage/SnapshotPolicyVO.java @@ -58,17 +58,21 @@ public class SnapshotPolicyVO implements SnapshotPolicy { @Column(name = "uuid") String uuid; + @Column(name = "display", updatable = true, nullable = false) + protected boolean display = true; + public SnapshotPolicyVO() { this.uuid = UUID.randomUUID().toString(); } - public SnapshotPolicyVO(long volumeId, String schedule, String timezone, IntervalType intvType, int maxSnaps) { + public SnapshotPolicyVO(long volumeId, String schedule, String timezone, IntervalType intvType, int maxSnaps, boolean display) { this.volumeId = volumeId; this.schedule = schedule; this.timezone = timezone; this.interval = (short)intvType.ordinal(); this.maxSnaps = maxSnaps; this.active = true; + this.display = display; this.uuid = UUID.randomUUID().toString(); } @@ -140,4 +144,12 @@ public class SnapshotPolicyVO implements SnapshotPolicy { public void setUuid(String uuid) { this.uuid = uuid; } + + public boolean isDisplay() { + return display; + } + + public void setDisplay(boolean display) { + this.display = display; + } } diff --git a/engine/schema/src/com/cloud/storage/dao/SnapshotPolicyDao.java b/engine/schema/src/com/cloud/storage/dao/SnapshotPolicyDao.java index f65b5839f75..0e55c2a6a31 100644 --- a/engine/schema/src/com/cloud/storage/dao/SnapshotPolicyDao.java +++ b/engine/schema/src/com/cloud/storage/dao/SnapshotPolicyDao.java @@ -32,9 +32,9 @@ public interface SnapshotPolicyDao extends GenericDao { List listByVolumeId(long volumeId, Filter filter); - Pair, Integer> listAndCountByVolumeId(long volumeId); + Pair, Integer> listAndCountByVolumeId(long volumeId, boolean display); - Pair, Integer> listAndCountByVolumeId(long volumeId, Filter filter); + Pair, Integer> listAndCountByVolumeId(long volumeId, boolean display, Filter filter); SnapshotPolicyVO findOneByVolumeInterval(long volumeId, IntervalType intvType); diff --git a/engine/schema/src/com/cloud/storage/dao/SnapshotPolicyDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/SnapshotPolicyDaoImpl.java index b0ea9176f31..34478b4d873 100644 --- a/engine/schema/src/com/cloud/storage/dao/SnapshotPolicyDaoImpl.java +++ b/engine/schema/src/com/cloud/storage/dao/SnapshotPolicyDaoImpl.java @@ -66,14 +66,15 @@ public class SnapshotPolicyDaoImpl extends GenericDaoBase, Integer> listAndCountByVolumeId(long volumeId) { - return listAndCountByVolumeId(volumeId, null); + public Pair, Integer> listAndCountByVolumeId(long volumeId, boolean display) { + return listAndCountByVolumeId(volumeId, display, null); } @Override - public Pair, Integer> listAndCountByVolumeId(long volumeId, Filter filter) { + public Pair, Integer> listAndCountByVolumeId(long volumeId, boolean display, Filter filter) { SearchCriteria sc = VolumeIdSearch.create(); sc.setParameters("volumeId", volumeId); + sc.setParameters("display", display); sc.setParameters("active", true); return searchAndCount(sc, filter); } @@ -82,6 +83,7 @@ public class SnapshotPolicyDaoImpl extends GenericDaoBase, ResourceDetailsDao { +} diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/SnapshotPolicyDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/SnapshotPolicyDetailsDaoImpl.java new file mode 100644 index 00000000000..ead76809ea2 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/SnapshotPolicyDetailsDaoImpl.java @@ -0,0 +1,17 @@ +package org.apache.cloudstack.resourcedetail.dao; + +import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase; +import org.apache.cloudstack.resourcedetail.SnapshotPolicyDetailVO; +import org.springframework.stereotype.Component; + +import javax.ejb.Local; + + @Component + @Local(value = {SnapshotPolicyDetailsDao.class}) + public class SnapshotPolicyDetailsDaoImpl extends ResourceDetailsDaoBase implements SnapshotPolicyDetailsDao { + + @Override + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new SnapshotPolicyDetailVO(resourceId, key, value)); + } +} \ No newline at end of file diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index f1f0d2cfd5a..9cf0a2f9fb7 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -519,6 +519,7 @@ public class ApiResponseHelper implements ResponseGenerator { policyResponse.setIntervalType(policy.getInterval()); policyResponse.setMaxSnaps(policy.getMaxSnaps()); policyResponse.setTimezone(policy.getTimezone()); + policyResponse.setForDisplay(policy.isDisplay()); policyResponse.setObjectName("snapshotpolicy"); return policyResponse; diff --git a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java index 6f1f40d6480..812630ab8b0 100644 --- a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java +++ b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java @@ -36,6 +36,7 @@ import org.apache.cloudstack.resourcedetail.dao.RemoteAccessVpnDetailsDao; import org.apache.cloudstack.resourcedetail.dao.Site2SiteCustomerGatewayDetailsDao; import org.apache.cloudstack.resourcedetail.dao.Site2SiteVpnConnectionDetailsDao; import org.apache.cloudstack.resourcedetail.dao.Site2SiteVpnGatewayDetailsDao; +import org.apache.cloudstack.resourcedetail.dao.SnapshotPolicyDetailsDao; import org.apache.cloudstack.resourcedetail.dao.UserDetailsDao; import org.apache.cloudstack.resourcedetail.dao.UserIpAddressDetailsDao; import org.apache.cloudstack.resourcedetail.dao.VpcDetailsDao; @@ -117,9 +118,11 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource @Inject AutoScaleVmGroupDetailsDao _autoScaleVmGroupDetailsDao; @Inject - LBStickinessPolicyDetailsDao _stickinessPolicyDao; + LBStickinessPolicyDetailsDao _stickinessPolicyDetailsDao; @Inject - LBHealthCheckPolicyDetailsDao _healthcheckPolicyDao; + LBHealthCheckPolicyDetailsDao _healthcheckPolicyDetailsDao; + @Inject + SnapshotPolicyDetailsDao _snapshotPolicyDetailsDao; private static Map> s_daoMap = new HashMap>(); @@ -149,8 +152,9 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource s_daoMap.put(ResourceObjectType.User, _userDetailsDao); s_daoMap.put(ResourceObjectType.AutoScaleVmProfile, _autoScaleVmProfileDetailsDao); s_daoMap.put(ResourceObjectType.AutoScaleVmGroup, _autoScaleVmGroupDetailsDao); - s_daoMap.put(ResourceObjectType.LBStickinessPolicy, _stickinessPolicyDao); - s_daoMap.put(ResourceObjectType.LBHealthCheckPolicy, _healthcheckPolicyDao); + s_daoMap.put(ResourceObjectType.LBStickinessPolicy, _stickinessPolicyDetailsDao); + s_daoMap.put(ResourceObjectType.LBHealthCheckPolicy, _healthcheckPolicyDetailsDao); + s_daoMap.put(ResourceObjectType.SnapshotPolicy, _snapshotPolicyDetailsDao); return true; } diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java index 44bce1a738e..21887a01ce8 100755 --- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java @@ -616,6 +616,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, @DB public SnapshotPolicyVO createPolicy(CreateSnapshotPolicyCmd cmd, Account policyOwner) { Long volumeId = cmd.getVolumeId(); + boolean display = cmd.isDisplay(); VolumeVO volume = _volsDao.findById(cmd.getVolumeId()); if (volume == null) { throw new InvalidParameterValueException("Failed to create snapshot policy, unable to find a volume with id " + volumeId); @@ -623,7 +624,8 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, _accountMgr.checkAccess(CallContext.current().getCallingAccount(), null, true, volume); - if (volume.getState() != Volume.State.Ready) { + // If display is false we don't actually schedule snapshots. + if (volume.getState() != Volume.State.Ready && display) { throw new InvalidParameterValueException("VolumeId: " + volumeId + " is not in " + Volume.State.Ready + " state but " + volume.getState() + ". Cannot take snapshot."); } @@ -670,33 +672,37 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, throw new InvalidParameterValueException("maxSnaps exceeds limit: " + intervalMaxSnaps + " for interval type: " + cmd.getIntervalType()); } - // Verify that max doesn't exceed domain and account snapshot limits - long accountLimit = _resourceLimitMgr.findCorrectResourceLimitForAccount(owner, ResourceType.snapshot); - long domainLimit = _resourceLimitMgr.findCorrectResourceLimitForDomain(_domainMgr.getDomain(owner.getDomainId()), ResourceType.snapshot); - int max = cmd.getMaxSnaps().intValue(); - if (!_accountMgr.isRootAdmin(owner.getId())&& ((accountLimit != -1 && max > accountLimit) || (domainLimit != -1 && max > domainLimit))) { - String message = "domain/account"; - if (owner.getType() == Account.ACCOUNT_TYPE_PROJECT) { - message = "domain/project"; + // Verify that max doesn't exceed domain and account snapshot limits in case display is on + if(display){ + long accountLimit = _resourceLimitMgr.findCorrectResourceLimitForAccount(owner, ResourceType.snapshot); + long domainLimit = _resourceLimitMgr.findCorrectResourceLimitForDomain(_domainMgr.getDomain(owner.getDomainId()), ResourceType.snapshot); + int max = cmd.getMaxSnaps().intValue(); + if (!_accountMgr.isRootAdmin(owner.getId())&& ((accountLimit != -1 && max > accountLimit) || (domainLimit != -1 && max > domainLimit))) { + String message = "domain/account"; + if (owner.getType() == Account.ACCOUNT_TYPE_PROJECT) { + message = "domain/project"; + } + + throw new InvalidParameterValueException("Max number of snapshots shouldn't exceed the " + message + " level snapshot limit"); } - - throw new InvalidParameterValueException("Max number of snapshots shouldn't exceed the " + message + " level snapshot limit"); } - SnapshotPolicyVO policy = _snapshotPolicyDao.findOneByVolumeInterval(volumeId, intvType); if (policy == null) { - policy = new SnapshotPolicyVO(volumeId, cmd.getSchedule(), timezoneId, intvType, cmd.getMaxSnaps()); + policy = new SnapshotPolicyVO(volumeId, cmd.getSchedule(), timezoneId, intvType, cmd.getMaxSnaps(), display); policy = _snapshotPolicyDao.persist(policy); _snapSchedMgr.scheduleNextSnapshotJob(policy); } else { try { + boolean previousDisplay = policy.isDisplay(); policy = _snapshotPolicyDao.acquireInLockTable(policy.getId()); policy.setSchedule(cmd.getSchedule()); policy.setTimezone(timezoneId); policy.setInterval((short)intvType.ordinal()); policy.setMaxSnaps(cmd.getMaxSnaps()); policy.setActive(true); + policy.setDisplay(display); _snapshotPolicyDao.update(policy.getId(), policy); + _snapSchedMgr.scheduleOrCancelNextSnapshotJobOnDisplayChange(policy, previousDisplay); } finally { if (policy != null) { _snapshotPolicyDao.releaseFromLockTable(policy.getId()); @@ -716,12 +722,13 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, @Override public Pair, Integer> listPoliciesforVolume(ListSnapshotPoliciesCmd cmd) { Long volumeId = cmd.getVolumeId(); + boolean display = cmd.isDisplay(); VolumeVO volume = _volsDao.findById(volumeId); if (volume == null) { throw new InvalidParameterValueException("Unable to find a volume with id " + volumeId); } _accountMgr.checkAccess(CallContext.current().getCallingAccount(), null, true, volume); - Pair, Integer> result = _snapshotPolicyDao.listAndCountByVolumeId(volumeId); + Pair, Integer> result = _snapshotPolicyDao.listAndCountByVolumeId(volumeId, display); return new Pair, Integer>(result.first(), result.second()); } diff --git a/server/src/com/cloud/storage/snapshot/SnapshotScheduler.java b/server/src/com/cloud/storage/snapshot/SnapshotScheduler.java index c744f69b4d2..ae4f7ce9af8 100644 --- a/server/src/com/cloud/storage/snapshot/SnapshotScheduler.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotScheduler.java @@ -40,4 +40,6 @@ public interface SnapshotScheduler extends Manager, Scheduler { * @return */ boolean removeSchedule(Long volumeId, Long policyId); + + void scheduleOrCancelNextSnapshotJobOnDisplayChange(SnapshotPolicyVO policy, boolean previousDisplay); } diff --git a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java index 3de1ed007b8..b11d27b1bbd 100644 --- a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java @@ -304,6 +304,12 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu if (policy == null) { return null; } + + // If display attribute is false then remove schedules if any. + if(!policy.isDisplay()){ + removeSchedule(policy.getVolumeId(), policy.getId()); + } + final long policyId = policy.getId(); if (policyId == Snapshot.MANUAL_POLICY_ID) { return null; @@ -330,6 +336,20 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu return nextSnapshotTimestamp; } + @Override + public void scheduleOrCancelNextSnapshotJobOnDisplayChange(final SnapshotPolicyVO policy, boolean previousDisplay) { + + // Take action only if display changed + if(policy.isDisplay() != previousDisplay ){ + if(policy.isDisplay()){ + scheduleNextSnapshotJob(policy); + }else{ + removeSchedule(policy.getVolumeId(), policy.getId()); + } + } + } + + @Override @DB public boolean removeSchedule(final Long volumeId, final Long policyId) { diff --git a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java index e6f317cd02f..b77c55e090c 100644 --- a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java +++ b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java @@ -25,6 +25,7 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; +import com.cloud.storage.SnapshotPolicyVO; import com.cloud.user.dao.AccountDao; import com.cloud.utils.exception.CloudRuntimeException; import org.apache.cloudstack.api.Identity; @@ -124,6 +125,7 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso s_typeMap.put(ResourceObjectType.AutoScaleVmGroup, AutoScaleVmGroupVO.class); s_typeMap.put(ResourceObjectType.LBStickinessPolicy, LBStickinessPolicyVO.class); s_typeMap.put(ResourceObjectType.LBHealthCheckPolicy, LBHealthCheckPolicyVO.class); + s_typeMap.put(ResourceObjectType.SnapshotPolicy, SnapshotPolicyVO.class); } @@ -166,9 +168,9 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso entity = _entityMgr.findById(clazz, resourceId); if (entity != null) { return ((InternalIdentity)entity).getId(); - } - throw new InvalidParameterValueException("Unable to find resource by id " + resourceId + " and type " + resourceType); } + throw new InvalidParameterValueException("Unable to find resource by id " + resourceId + " and type " + resourceType); + } private Pair getAccountDomain(long resourceId, ResourceObjectType resourceType) { Class clazz = s_typeMap.get(resourceType); diff --git a/setup/db/db/schema-430to440.sql b/setup/db/db/schema-430to440.sql index 8f127781e91..9043fb2158f 100644 --- a/setup/db/db/schema-430to440.sql +++ b/setup/db/db/schema-430to440.sql @@ -1712,3 +1712,16 @@ CREATE TABLE `cloud`.`load_balancer_healthcheck_policy_details` ( PRIMARY KEY (`id`), CONSTRAINT `fk_lb_healthcheck_policy_details__lb_healthcheck_policy_id` FOREIGN KEY `fk_lb_healthcheck_policy_details__lb_healthcheck_policy_id`(`lb_policy_id`) REFERENCES `load_balancer_healthcheck_policies`(`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +ALTER TABLE `cloud`.`snapshot_policy` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the policy can be displayed to the end user'; + +CREATE TABLE `cloud`.`snapshot_policy_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `policy_id` bigint unsigned NOT NULL COMMENT 'snapshot policy id', + `name` varchar(255) NOT NULL, + `value` varchar(1024) NOT NULL, + `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user', + PRIMARY KEY (`id`), + CONSTRAINT `fk_snapshot_policy_details__snapshot_policy_id` FOREIGN KEY `fk_snapshot_policy_details__snapshot_policy_id`(`policy_id`) REFERENCES `snapshot_policy`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +