Updated Branches: refs/heads/master cb073e063 -> 02bdb28d7
Resource metadata support for autoscale vm group object Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/02bdb28d Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/02bdb28d Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/02bdb28d Branch: refs/heads/master Commit: 02bdb28d767931c7dd1115902a9a83d2f015085d Parents: cb073e0 Author: Alena Prokharchyk <alena.prokharc...@citrix.com> Authored: Thu Jan 30 13:00:00 2014 -0800 Committer: Alena Prokharchyk <alena.prokharc...@citrix.com> Committed: Thu Jan 30 13:04:56 2014 -0800 ---------------------------------------------------------------------- api/src/com/cloud/server/ResourceTag.java | 3 +- .../spring-engine-schema-core-daos-context.xml | 1 + .../AutoScaleVmGroupDetailVO.java | 81 ++++++++++++++++++++ .../dao/AutoScaleVmGroupDetailsDao.java | 26 +++++++ .../dao/AutoScaleVmGroupDetailsDaoImpl.java | 33 ++++++++ .../metadata/ResourceMetaDataManagerImpl.java | 4 + .../cloud/network/as/AutoScaleManagerImpl.java | 2 +- .../cloud/tags/TaggedResourceManagerImpl.java | 2 + setup/db/db/schema-430to440.sql | 10 +++ 9 files changed, 160 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/02bdb28d/api/src/com/cloud/server/ResourceTag.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/server/ResourceTag.java b/api/src/com/cloud/server/ResourceTag.java index a08c3e4..275510e 100644 --- a/api/src/com/cloud/server/ResourceTag.java +++ b/api/src/com/cloud/server/ResourceTag.java @@ -52,7 +52,8 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit VpnConnection(false, true), User(true, true), DiskOffering(false, true), - AutoScaleVmProfile(false, true); + AutoScaleVmProfile(false, true), + AutoScaleVmGroup(false, true); ResourceObjectType(boolean resourceTagsSupport, boolean resourceMetadataSupport) { this.resourceTagsSupport = resourceTagsSupport; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/02bdb28d/engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml ---------------------------------------------------------------------- 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 d1a68ed..08efb83 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 @@ -332,6 +332,7 @@ <bean id="DiskOfferingDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.DiskOfferingDetailsDaoImpl" /> <bean id="UserDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.UserDetailsDaoImpl" /> <bean id="AutoScaleVmProfileDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.AutoScaleVmProfileDetailsDaoImpl" /> + <bean id="AutoScaleVmGroupDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.AutoScaleVmGroupDetailsDaoImpl" /> <bean id="databaseIntegrityChecker" class="com.cloud.upgrade.DatabaseIntegrityChecker" /> </beans> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/02bdb28d/engine/schema/src/org/apache/cloudstack/resourcedetail/AutoScaleVmGroupDetailVO.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/AutoScaleVmGroupDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/AutoScaleVmGroupDetailVO.java new file mode 100644 index 0000000..a657caa --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/AutoScaleVmGroupDetailVO.java @@ -0,0 +1,81 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.resourcedetail; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.apache.cloudstack.api.ResourceDetail; + +@Entity +@Table(name = "autoscale_vmgroup_details") +public class AutoScaleVmGroupDetailVO implements ResourceDetail { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "autoscale_vmgroup_id") + private long resourceId; + + @Column(name = "name") + private String name; + + @Column(name = "value", length = 1024) + private String value; + + @Column(name = "display") + private boolean display; + + public AutoScaleVmGroupDetailVO() { + } + + public AutoScaleVmGroupDetailVO(long id, String name, String value) { + this.resourceId = id; + this.name = name; + this.value = value; + } + + @Override + public long getId() { + return id; + } + + @Override + public String getName() { + return name; + } + + @Override + public String getValue() { + return value; + } + + @Override + public long getResourceId() { + return resourceId; + } + + @Override + public boolean isDisplay() { + return display; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/02bdb28d/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/AutoScaleVmGroupDetailsDao.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/AutoScaleVmGroupDetailsDao.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/AutoScaleVmGroupDetailsDao.java new file mode 100644 index 0000000..6e20e5a --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/AutoScaleVmGroupDetailsDao.java @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.resourcedetail.dao; + +import org.apache.cloudstack.resourcedetail.AutoScaleVmGroupDetailVO; +import org.apache.cloudstack.resourcedetail.ResourceDetailsDao; + +import com.cloud.utils.db.GenericDao; + +public interface AutoScaleVmGroupDetailsDao extends GenericDao<AutoScaleVmGroupDetailVO, Long>, ResourceDetailsDao<AutoScaleVmGroupDetailVO> { + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/02bdb28d/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/AutoScaleVmGroupDetailsDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/AutoScaleVmGroupDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/AutoScaleVmGroupDetailsDaoImpl.java new file mode 100644 index 0000000..b4c82bc --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/AutoScaleVmGroupDetailsDaoImpl.java @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.resourcedetail.dao; + +import javax.ejb.Local; + +import org.apache.cloudstack.resourcedetail.AutoScaleVmGroupDetailVO; +import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase; +import org.springframework.stereotype.Component; + +@Component +@Local(value = {AutoScaleVmGroupDetailsDao.class}) +public class AutoScaleVmGroupDetailsDaoImpl extends ResourceDetailsDaoBase<AutoScaleVmGroupDetailVO> implements AutoScaleVmGroupDetailsDao { + + @Override + public void addDetail(long resourceId, String key, String value) { + super.addDetail(new AutoScaleVmGroupDetailVO(resourceId, key, value)); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/02bdb28d/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java index 5393a6a..17b4895 100644 --- a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java +++ b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java @@ -26,6 +26,7 @@ import javax.naming.ConfigurationException; import org.apache.cloudstack.api.ResourceDetail; import org.apache.cloudstack.resourcedetail.ResourceDetailsDao; +import org.apache.cloudstack.resourcedetail.dao.AutoScaleVmGroupDetailsDao; import org.apache.cloudstack.resourcedetail.dao.AutoScaleVmProfileDetailsDao; import org.apache.cloudstack.resourcedetail.dao.DiskOfferingDetailsDao; import org.apache.cloudstack.resourcedetail.dao.FirewallRuleDetailsDao; @@ -110,6 +111,8 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource UserDetailsDao _userDetailsDao; @Inject AutoScaleVmProfileDetailsDao _autoScaleVmProfileDetailsDao; + @Inject + AutoScaleVmGroupDetailsDao _autoScaleVmGroupDetailsDao; private static Map<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>> s_daoMap = new HashMap<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>>(); @@ -138,6 +141,7 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource s_daoMap.put(ResourceObjectType.DiskOffering, _diskOfferingDetailsDao); s_daoMap.put(ResourceObjectType.User, _userDetailsDao); s_daoMap.put(ResourceObjectType.AutoScaleVmProfile, _autoScaleVmProfileDetailsDao); + s_daoMap.put(ResourceObjectType.AutoScaleVmGroup, _autoScaleVmGroupDetailsDao); return true; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/02bdb28d/server/src/com/cloud/network/as/AutoScaleManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/AutoScaleManagerImpl.java b/server/src/com/cloud/network/as/AutoScaleManagerImpl.java index 7eeec9c..a2cc32e 100644 --- a/server/src/com/cloud/network/as/AutoScaleManagerImpl.java +++ b/server/src/com/cloud/network/as/AutoScaleManagerImpl.java @@ -447,7 +447,7 @@ public class AutoScaleManagerImpl<Type> extends ManagerBase implements AutoScale sb.and("templateId", sb.entity().getTemplateId(), SearchCriteria.Op.EQ); sb.and("serviceOfferingId", sb.entity().getServiceOfferingId(), SearchCriteria.Op.EQ); sb.and("otherDeployParams", sb.entity().getOtherDeployParams(), SearchCriteria.Op.LIKE); - sb.and("zoneId", sb.entity().getZoneId(), SearchCriteria.Op.LIKE); + sb.and("zoneId", sb.entity().getZoneId(), SearchCriteria.Op.EQ); SearchCriteria<AutoScaleVmProfileVO> sc = searchWrapper.buildSearchCriteria(); if (id != null) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/02bdb28d/server/src/com/cloud/tags/TaggedResourceManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java index 555a845..0674683 100644 --- a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java +++ b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java @@ -39,6 +39,7 @@ import com.cloud.event.ActionEvent; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.PermissionDeniedException; +import com.cloud.network.as.AutoScaleVmGroupVO; import com.cloud.network.as.AutoScaleVmProfileVO; import com.cloud.network.dao.IPAddressVO; import com.cloud.network.dao.LoadBalancerVO; @@ -117,6 +118,7 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso s_typeMap.put(ResourceObjectType.User, UserVO.class); s_typeMap.put(ResourceObjectType.DiskOffering, DiskOfferingVO.class); s_typeMap.put(ResourceObjectType.AutoScaleVmProfile, AutoScaleVmProfileVO.class); + s_typeMap.put(ResourceObjectType.AutoScaleVmGroup, AutoScaleVmGroupVO.class); } @Inject http://git-wip-us.apache.org/repos/asf/cloudstack/blob/02bdb28d/setup/db/db/schema-430to440.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-430to440.sql b/setup/db/db/schema-430to440.sql index 8c45295..70f7352 100644 --- a/setup/db/db/schema-430to440.sql +++ b/setup/db/db/schema-430to440.sql @@ -457,3 +457,13 @@ CREATE TABLE `cloud`.`autoscale_vmprofile_details` ( PRIMARY KEY (`id`), CONSTRAINT `fk_autoscale_vmprofile_details__autoscale_vmprofile_id` FOREIGN KEY `fk_autoscale_vmprofile_details__autoscale_vmprofile_id`(`autoscale_vmprofile_id`) REFERENCES `autoscale_vmprofiles`(`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`autoscale_vmgroup_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `autoscale_vmgroup_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id', + `name` varchar(255) NOT NULL, + `value` varchar(1024) NOT NULL, + `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end autoscale_vmgroup', + PRIMARY KEY (`id`), + CONSTRAINT `fk_autoscale_vmgroup_details__autoscale_vmgroup_id` FOREIGN KEY `fk_autoscale_vmgroup_details__autoscale_vmgroup_id`(`autoscale_vmgroup_id`) REFERENCES `autoscale_vmgroups`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8;