Repository: cloudstack Updated Branches: refs/heads/4.4-forward be2b5918e -> 8ffb2c114
CLOUDSTACK-6585: added missing metadata support for LBStickiness/LBHealthcheck policies Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8ffb2c11 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8ffb2c11 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8ffb2c11 Branch: refs/heads/4.4-forward Commit: 8ffb2c11485c178a97dd30f620458684c79d186a Parents: be2b591 Author: Alena Prokharchyk <[email protected]> Authored: Tue May 6 17:03:20 2014 -0700 Committer: Alena Prokharchyk <[email protected]> Committed: Tue May 6 17:04:03 2014 -0700 ---------------------------------------------------------------------- api/src/com/cloud/server/ResourceTag.java | 5 +- .../spring-engine-schema-core-daos-context.xml | 3 + .../LBHealthCheckPolicyDetailVO.java | 78 +++++++++++++++++++ .../LBStickinessPolicyDetailVO.java | 82 ++++++++++++++++++++ .../dao/LBHealthCheckPolicyDetailsDao.java | 22 ++++++ .../dao/LBHealthCheckPolicyDetailsDaoImpl.java | 29 +++++++ .../dao/LBStickinessPolicyDetailsDao.java | 22 ++++++ .../dao/LBStickinessPolicyDetailsDaoImpl.java | 29 +++++++ .../metadata/ResourceMetaDataManagerImpl.java | 9 +++ .../cloud/tags/TaggedResourceManagerImpl.java | 8 +- 10 files changed, 284 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ffb2c11/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 275510e..d91bb7d 100644 --- a/api/src/com/cloud/server/ResourceTag.java +++ b/api/src/com/cloud/server/ResourceTag.java @@ -53,7 +53,10 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit User(true, true), DiskOffering(false, true), AutoScaleVmProfile(false, true), - AutoScaleVmGroup(false, true); + AutoScaleVmGroup(false, true), + LBStickinessPolicy(false, true), + LBHealthCheckPolicy(false, true); + ResourceObjectType(boolean resourceTagsSupport, boolean resourceMetadataSupport) { this.resourceTagsSupport = resourceTagsSupport; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ffb2c11/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 f5050e2..2ef0d20 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 @@ -338,5 +338,8 @@ <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" /> + <bean id="LBStickinessPolicyDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.LBStickinessPolicyDetailsDaoImpl" /> + <bean id="LBHealthCheckPolicyDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.LBHealthCheckPolicyDetailsDaoImpl" /> + </beans> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ffb2c11/engine/schema/src/org/apache/cloudstack/resourcedetail/LBHealthCheckPolicyDetailVO.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/LBHealthCheckPolicyDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/LBHealthCheckPolicyDetailVO.java new file mode 100644 index 0000000..52b30ff --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/LBHealthCheckPolicyDetailVO.java @@ -0,0 +1,78 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by 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. +// +// Automatically generated by addcopyright.py at 04/03/2012 +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 = "load_balancer_healthcheck_policy_details") +public class LBHealthCheckPolicyDetailVO implements ResourceDetail{ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "lb_policy_id") + private long resourceId; + + @Column(name = "name") + private String name; + + @Column(name = "value", length = 1024) + private String value; + + @Column(name = "display") + private boolean display = true; + + public LBHealthCheckPolicyDetailVO() { + } + + public LBHealthCheckPolicyDetailVO(long id, String name, String value, boolean display) { + this.resourceId = id; + this.name = name; + this.value = value; + this.display = display; + } + + @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; + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ffb2c11/engine/schema/src/org/apache/cloudstack/resourcedetail/LBStickinessPolicyDetailVO.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/LBStickinessPolicyDetailVO.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/LBStickinessPolicyDetailVO.java new file mode 100644 index 0000000..caa2d90 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/LBStickinessPolicyDetailVO.java @@ -0,0 +1,82 @@ +// 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 = "load_balancer_stickiness_policy_details") +public class LBStickinessPolicyDetailVO implements ResourceDetail { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "lb_policy_id") + private long resourceId; + + @Column(name = "name") + private String name; + + @Column(name = "value", length = 1024) + private String value; + + @Column(name = "display") + private boolean display = true; + + public LBStickinessPolicyDetailVO() { + } + + public LBStickinessPolicyDetailVO(long id, String name, String value, boolean display) { + this.resourceId = id; + this.name = name; + this.value = value; + this.display = display; + } + + @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; + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ffb2c11/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBHealthCheckPolicyDetailsDao.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBHealthCheckPolicyDetailsDao.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBHealthCheckPolicyDetailsDao.java new file mode 100644 index 0000000..9f8fcdd --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBHealthCheckPolicyDetailsDao.java @@ -0,0 +1,22 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by 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. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.resourcedetail.dao; + +import org.apache.cloudstack.resourcedetail.LBHealthCheckPolicyDetailVO; +import org.apache.cloudstack.resourcedetail.ResourceDetailsDao; + +import com.cloud.utils.db.GenericDao; + +public interface LBHealthCheckPolicyDetailsDao extends GenericDao<LBHealthCheckPolicyDetailVO, Long>, ResourceDetailsDao<LBHealthCheckPolicyDetailVO>{ + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ffb2c11/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBHealthCheckPolicyDetailsDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBHealthCheckPolicyDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBHealthCheckPolicyDetailsDaoImpl.java new file mode 100644 index 0000000..ab2e07f --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBHealthCheckPolicyDetailsDaoImpl.java @@ -0,0 +1,29 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by 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. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.resourcedetail.dao; + +import javax.ejb.Local; + +import org.apache.cloudstack.resourcedetail.LBHealthCheckPolicyDetailVO; +import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase; +import org.springframework.stereotype.Component; + +@Component +@Local(value = {LBHealthCheckPolicyDetailsDao.class}) +public class LBHealthCheckPolicyDetailsDaoImpl extends ResourceDetailsDaoBase<LBHealthCheckPolicyDetailVO> implements LBHealthCheckPolicyDetailsDao { + + @Override + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new LBHealthCheckPolicyDetailVO(resourceId, key, value, display)); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ffb2c11/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBStickinessPolicyDetailsDao.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBStickinessPolicyDetailsDao.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBStickinessPolicyDetailsDao.java new file mode 100644 index 0000000..512debc --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBStickinessPolicyDetailsDao.java @@ -0,0 +1,22 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by 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. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.resourcedetail.dao; + +import org.apache.cloudstack.resourcedetail.LBStickinessPolicyDetailVO; +import org.apache.cloudstack.resourcedetail.ResourceDetailsDao; + +import com.cloud.utils.db.GenericDao; + +public interface LBStickinessPolicyDetailsDao extends GenericDao<LBStickinessPolicyDetailVO, Long>, ResourceDetailsDao<LBStickinessPolicyDetailVO>{ + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ffb2c11/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBStickinessPolicyDetailsDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBStickinessPolicyDetailsDaoImpl.java b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBStickinessPolicyDetailsDaoImpl.java new file mode 100644 index 0000000..a9afa22 --- /dev/null +++ b/engine/schema/src/org/apache/cloudstack/resourcedetail/dao/LBStickinessPolicyDetailsDaoImpl.java @@ -0,0 +1,29 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by 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. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.resourcedetail.dao; + +import javax.ejb.Local; + +import org.apache.cloudstack.resourcedetail.LBStickinessPolicyDetailVO; +import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase; +import org.springframework.stereotype.Component; + +@Component +@Local(value = {LBStickinessPolicyDetailsDao.class}) +public class LBStickinessPolicyDetailsDaoImpl extends ResourceDetailsDaoBase<LBStickinessPolicyDetailVO> implements LBStickinessPolicyDetailsDao { + + @Override + public void addDetail(long resourceId, String key, String value, boolean display) { + super.addDetail(new LBStickinessPolicyDetailVO(resourceId, key, value, display)); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ffb2c11/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 d91da92..f7b092c 100644 --- a/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java +++ b/server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java @@ -40,7 +40,10 @@ import org.apache.cloudstack.resourcedetail.dao.UserDetailsDao; import org.apache.cloudstack.resourcedetail.dao.UserIpAddressDetailsDao; import org.apache.cloudstack.resourcedetail.dao.VpcDetailsDao; import org.apache.cloudstack.resourcedetail.dao.VpcGatewayDetailsDao; +import org.apache.cloudstack.resourcedetail.dao.LBStickinessPolicyDetailsDao; +import org.apache.cloudstack.resourcedetail.dao.LBHealthCheckPolicyDetailsDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao; + import org.apache.log4j.Logger; import org.springframework.stereotype.Component; @@ -113,6 +116,10 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource AutoScaleVmProfileDetailsDao _autoScaleVmProfileDetailsDao; @Inject AutoScaleVmGroupDetailsDao _autoScaleVmGroupDetailsDao; + @Inject + LBStickinessPolicyDetailsDao _stickinessPolicyDao; + @Inject + LBHealthCheckPolicyDetailsDao _healthcheckPolicyDao; private static Map<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>> s_daoMap = new HashMap<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>>(); @@ -142,6 +149,8 @@ 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); return true; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ffb2c11/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 71722a9..cac12c6 100644 --- a/server/src/com/cloud/tags/TaggedResourceManagerImpl.java +++ b/server/src/com/cloud/tags/TaggedResourceManagerImpl.java @@ -25,12 +25,11 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; +import org.apache.log4j.Logger; import com.cloud.api.query.dao.ResourceTagJoinDao; import com.cloud.dc.DataCenterVO; @@ -40,9 +39,11 @@ import com.cloud.event.ActionEvent; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.PermissionDeniedException; +import com.cloud.network.LBHealthCheckPolicyVO; import com.cloud.network.as.AutoScaleVmGroupVO; import com.cloud.network.as.AutoScaleVmProfileVO; import com.cloud.network.dao.IPAddressVO; +import com.cloud.network.dao.LBStickinessPolicyVO; import com.cloud.network.dao.LoadBalancerVO; import com.cloud.network.dao.NetworkVO; import com.cloud.network.dao.RemoteAccessVpnVO; @@ -120,6 +121,9 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso s_typeMap.put(ResourceObjectType.DiskOffering, DiskOfferingVO.class); s_typeMap.put(ResourceObjectType.AutoScaleVmProfile, AutoScaleVmProfileVO.class); s_typeMap.put(ResourceObjectType.AutoScaleVmGroup, AutoScaleVmGroupVO.class); + s_typeMap.put(ResourceObjectType.LBStickinessPolicy, LBStickinessPolicyVO.class); + s_typeMap.put(ResourceObjectType.LBHealthCheckPolicy, LBHealthCheckPolicyVO.class); + } @Inject
