Skip to content

Commit ee5f559

Browse files
author
Alena Prokharchyk
committed
CLOUDSTACK-6585: added missing metadata support for LBStickiness/LBHealthcheck policies
1 parent 521ac79 commit ee5f559

10 files changed

Lines changed: 284 additions & 3 deletions

File tree

api/src/com/cloud/server/ResourceTag.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ public enum ResourceObjectType {
5353
User(true, true),
5454
DiskOffering(false, true),
5555
AutoScaleVmProfile(false, true),
56-
AutoScaleVmGroup(false, true);
56+
AutoScaleVmGroup(false, true),
57+
LBStickinessPolicy(false, true),
58+
LBHealthCheckPolicy(false, true);
59+
5760

5861
ResourceObjectType(boolean resourceTagsSupport, boolean resourceMetadataSupport) {
5962
this.resourceTagsSupport = resourceTagsSupport;

engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,5 +338,8 @@
338338
<bean id="AutoScaleVmProfileDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.AutoScaleVmProfileDetailsDaoImpl" />
339339
<bean id="AutoScaleVmGroupDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.AutoScaleVmGroupDetailsDaoImpl" />
340340
<bean id="databaseIntegrityChecker" class="com.cloud.upgrade.DatabaseIntegrityChecker" />
341+
<bean id="LBStickinessPolicyDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.LBStickinessPolicyDetailsDaoImpl" />
342+
<bean id="LBHealthCheckPolicyDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.LBHealthCheckPolicyDetailsDaoImpl" />
343+
341344

342345
</beans>
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// Copyright 2012 Citrix Systems, Inc. Licensed under the
2+
// Apache License, Version 2.0 (the "License"); you may not use this
3+
// file except in compliance with the License. Citrix Systems, Inc.
4+
// reserves all rights not expressly granted by the License.
5+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
// Unless required by applicable law or agreed to in writing, software
7+
// distributed under the License is distributed on an "AS IS" BASIS,
8+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
// See the License for the specific language governing permissions and
10+
// limitations under the License.
11+
//
12+
// Automatically generated by addcopyright.py at 04/03/2012
13+
package org.apache.cloudstack.resourcedetail;
14+
15+
import javax.persistence.Column;
16+
import javax.persistence.Entity;
17+
import javax.persistence.GeneratedValue;
18+
import javax.persistence.GenerationType;
19+
import javax.persistence.Id;
20+
import javax.persistence.Table;
21+
22+
import org.apache.cloudstack.api.ResourceDetail;
23+
24+
@Entity
25+
@Table(name = "load_balancer_healthcheck_policy_details")
26+
public class LBHealthCheckPolicyDetailVO implements ResourceDetail{
27+
@Id
28+
@GeneratedValue(strategy = GenerationType.IDENTITY)
29+
@Column(name = "id")
30+
private long id;
31+
32+
@Column(name = "lb_policy_id")
33+
private long resourceId;
34+
35+
@Column(name = "name")
36+
private String name;
37+
38+
@Column(name = "value", length = 1024)
39+
private String value;
40+
41+
@Column(name = "display")
42+
private boolean display = true;
43+
44+
public LBHealthCheckPolicyDetailVO() {
45+
}
46+
47+
public LBHealthCheckPolicyDetailVO(long id, String name, String value, boolean display) {
48+
this.resourceId = id;
49+
this.name = name;
50+
this.value = value;
51+
this.display = display;
52+
}
53+
54+
@Override
55+
public long getId() {
56+
return id;
57+
}
58+
59+
@Override
60+
public String getName() {
61+
return name;
62+
}
63+
64+
@Override
65+
public String getValue() {
66+
return value;
67+
}
68+
69+
@Override
70+
public long getResourceId() {
71+
return resourceId;
72+
}
73+
74+
@Override
75+
public boolean isDisplay() {
76+
return display;
77+
}
78+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.resourcedetail;
18+
19+
import javax.persistence.Column;
20+
import javax.persistence.Entity;
21+
import javax.persistence.GeneratedValue;
22+
import javax.persistence.GenerationType;
23+
import javax.persistence.Id;
24+
import javax.persistence.Table;
25+
26+
import org.apache.cloudstack.api.ResourceDetail;
27+
28+
@Entity
29+
@Table(name = "load_balancer_stickiness_policy_details")
30+
public class LBStickinessPolicyDetailVO implements ResourceDetail {
31+
@Id
32+
@GeneratedValue(strategy = GenerationType.IDENTITY)
33+
@Column(name = "id")
34+
private long id;
35+
36+
@Column(name = "lb_policy_id")
37+
private long resourceId;
38+
39+
@Column(name = "name")
40+
private String name;
41+
42+
@Column(name = "value", length = 1024)
43+
private String value;
44+
45+
@Column(name = "display")
46+
private boolean display = true;
47+
48+
public LBStickinessPolicyDetailVO() {
49+
}
50+
51+
public LBStickinessPolicyDetailVO(long id, String name, String value, boolean display) {
52+
this.resourceId = id;
53+
this.name = name;
54+
this.value = value;
55+
this.display = display;
56+
}
57+
58+
@Override
59+
public long getId() {
60+
return id;
61+
}
62+
63+
@Override
64+
public String getName() {
65+
return name;
66+
}
67+
68+
@Override
69+
public String getValue() {
70+
return value;
71+
}
72+
73+
@Override
74+
public long getResourceId() {
75+
return resourceId;
76+
}
77+
78+
@Override
79+
public boolean isDisplay() {
80+
return display;
81+
}
82+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2012 Citrix Systems, Inc. Licensed under the
2+
// Apache License, Version 2.0 (the "License"); you may not use this
3+
// file except in compliance with the License. Citrix Systems, Inc.
4+
// reserves all rights not expressly granted by the License.
5+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
// Unless required by applicable law or agreed to in writing, software
7+
// distributed under the License is distributed on an "AS IS" BASIS,
8+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
// See the License for the specific language governing permissions and
10+
// limitations under the License.
11+
//
12+
// Automatically generated by addcopyright.py at 04/03/2012
13+
package org.apache.cloudstack.resourcedetail.dao;
14+
15+
import org.apache.cloudstack.resourcedetail.LBHealthCheckPolicyDetailVO;
16+
import org.apache.cloudstack.resourcedetail.ResourceDetailsDao;
17+
18+
import com.cloud.utils.db.GenericDao;
19+
20+
public interface LBHealthCheckPolicyDetailsDao extends GenericDao<LBHealthCheckPolicyDetailVO, Long>, ResourceDetailsDao<LBHealthCheckPolicyDetailVO>{
21+
22+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2012 Citrix Systems, Inc. Licensed under the
2+
// Apache License, Version 2.0 (the "License"); you may not use this
3+
// file except in compliance with the License. Citrix Systems, Inc.
4+
// reserves all rights not expressly granted by the License.
5+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
// Unless required by applicable law or agreed to in writing, software
7+
// distributed under the License is distributed on an "AS IS" BASIS,
8+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
// See the License for the specific language governing permissions and
10+
// limitations under the License.
11+
//
12+
// Automatically generated by addcopyright.py at 04/03/2012
13+
package org.apache.cloudstack.resourcedetail.dao;
14+
15+
import javax.ejb.Local;
16+
17+
import org.apache.cloudstack.resourcedetail.LBHealthCheckPolicyDetailVO;
18+
import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
19+
import org.springframework.stereotype.Component;
20+
21+
@Component
22+
@Local(value = {LBHealthCheckPolicyDetailsDao.class})
23+
public class LBHealthCheckPolicyDetailsDaoImpl extends ResourceDetailsDaoBase<LBHealthCheckPolicyDetailVO> implements LBHealthCheckPolicyDetailsDao {
24+
25+
@Override
26+
public void addDetail(long resourceId, String key, String value, boolean display) {
27+
super.addDetail(new LBHealthCheckPolicyDetailVO(resourceId, key, value, display));
28+
}
29+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2012 Citrix Systems, Inc. Licensed under the
2+
// Apache License, Version 2.0 (the "License"); you may not use this
3+
// file except in compliance with the License. Citrix Systems, Inc.
4+
// reserves all rights not expressly granted by the License.
5+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
// Unless required by applicable law or agreed to in writing, software
7+
// distributed under the License is distributed on an "AS IS" BASIS,
8+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
// See the License for the specific language governing permissions and
10+
// limitations under the License.
11+
//
12+
// Automatically generated by addcopyright.py at 04/03/2012
13+
package org.apache.cloudstack.resourcedetail.dao;
14+
15+
import org.apache.cloudstack.resourcedetail.LBStickinessPolicyDetailVO;
16+
import org.apache.cloudstack.resourcedetail.ResourceDetailsDao;
17+
18+
import com.cloud.utils.db.GenericDao;
19+
20+
public interface LBStickinessPolicyDetailsDao extends GenericDao<LBStickinessPolicyDetailVO, Long>, ResourceDetailsDao<LBStickinessPolicyDetailVO>{
21+
22+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2012 Citrix Systems, Inc. Licensed under the
2+
// Apache License, Version 2.0 (the "License"); you may not use this
3+
// file except in compliance with the License. Citrix Systems, Inc.
4+
// reserves all rights not expressly granted by the License.
5+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
// Unless required by applicable law or agreed to in writing, software
7+
// distributed under the License is distributed on an "AS IS" BASIS,
8+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
// See the License for the specific language governing permissions and
10+
// limitations under the License.
11+
//
12+
// Automatically generated by addcopyright.py at 04/03/2012
13+
package org.apache.cloudstack.resourcedetail.dao;
14+
15+
import javax.ejb.Local;
16+
17+
import org.apache.cloudstack.resourcedetail.LBStickinessPolicyDetailVO;
18+
import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
19+
import org.springframework.stereotype.Component;
20+
21+
@Component
22+
@Local(value = {LBStickinessPolicyDetailsDao.class})
23+
public class LBStickinessPolicyDetailsDaoImpl extends ResourceDetailsDaoBase<LBStickinessPolicyDetailVO> implements LBStickinessPolicyDetailsDao {
24+
25+
@Override
26+
public void addDetail(long resourceId, String key, String value, boolean display) {
27+
super.addDetail(new LBStickinessPolicyDetailVO(resourceId, key, value, display));
28+
}
29+
}

server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@
4040
import org.apache.cloudstack.resourcedetail.dao.UserIpAddressDetailsDao;
4141
import org.apache.cloudstack.resourcedetail.dao.VpcDetailsDao;
4242
import org.apache.cloudstack.resourcedetail.dao.VpcGatewayDetailsDao;
43+
import org.apache.cloudstack.resourcedetail.dao.LBStickinessPolicyDetailsDao;
44+
import org.apache.cloudstack.resourcedetail.dao.LBHealthCheckPolicyDetailsDao;
4345
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
46+
4447
import org.apache.log4j.Logger;
4548
import org.springframework.stereotype.Component;
4649

@@ -113,6 +116,10 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
113116
AutoScaleVmProfileDetailsDao _autoScaleVmProfileDetailsDao;
114117
@Inject
115118
AutoScaleVmGroupDetailsDao _autoScaleVmGroupDetailsDao;
119+
@Inject
120+
LBStickinessPolicyDetailsDao _stickinessPolicyDao;
121+
@Inject
122+
LBHealthCheckPolicyDetailsDao _healthcheckPolicyDao;
116123

117124
private static Map<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>> s_daoMap = new HashMap<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>>();
118125

@@ -142,6 +149,8 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
142149
s_daoMap.put(ResourceObjectType.User, _userDetailsDao);
143150
s_daoMap.put(ResourceObjectType.AutoScaleVmProfile, _autoScaleVmProfileDetailsDao);
144151
s_daoMap.put(ResourceObjectType.AutoScaleVmGroup, _autoScaleVmGroupDetailsDao);
152+
s_daoMap.put(ResourceObjectType.LBStickinessPolicy, _stickinessPolicyDao);
153+
s_daoMap.put(ResourceObjectType.LBHealthCheckPolicy, _healthcheckPolicyDao);
145154

146155
return true;
147156
}

server/src/com/cloud/tags/TaggedResourceManagerImpl.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,11 @@
2525
import javax.inject.Inject;
2626
import javax.naming.ConfigurationException;
2727

28-
import org.apache.log4j.Logger;
29-
3028
import org.apache.cloudstack.api.Identity;
3129
import org.apache.cloudstack.api.InternalIdentity;
3230
import org.apache.cloudstack.context.CallContext;
3331
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
32+
import org.apache.log4j.Logger;
3433

3534
import com.cloud.api.query.dao.ResourceTagJoinDao;
3635
import com.cloud.dc.DataCenterVO;
@@ -40,9 +39,11 @@
4039
import com.cloud.event.EventTypes;
4140
import com.cloud.exception.InvalidParameterValueException;
4241
import com.cloud.exception.PermissionDeniedException;
42+
import com.cloud.network.LBHealthCheckPolicyVO;
4343
import com.cloud.network.as.AutoScaleVmGroupVO;
4444
import com.cloud.network.as.AutoScaleVmProfileVO;
4545
import com.cloud.network.dao.IPAddressVO;
46+
import com.cloud.network.dao.LBStickinessPolicyVO;
4647
import com.cloud.network.dao.LoadBalancerVO;
4748
import com.cloud.network.dao.NetworkVO;
4849
import com.cloud.network.dao.RemoteAccessVpnVO;
@@ -120,6 +121,9 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso
120121
s_typeMap.put(ResourceObjectType.DiskOffering, DiskOfferingVO.class);
121122
s_typeMap.put(ResourceObjectType.AutoScaleVmProfile, AutoScaleVmProfileVO.class);
122123
s_typeMap.put(ResourceObjectType.AutoScaleVmGroup, AutoScaleVmGroupVO.class);
124+
s_typeMap.put(ResourceObjectType.LBStickinessPolicy, LBStickinessPolicyVO.class);
125+
s_typeMap.put(ResourceObjectType.LBHealthCheckPolicy, LBHealthCheckPolicyVO.class);
126+
123127
}
124128

125129
@Inject

0 commit comments

Comments
 (0)