Skip to content

Commit 316f23e

Browse files
author
Alena Prokharchyk
committed
Return isolation methods as a part of listPhysicalNetworks call
1 parent e24bf73 commit 316f23e

4 files changed

Lines changed: 54 additions & 4 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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 com.cloud.network.dao;
14+
15+
import java.util.List;
16+
17+
import com.cloud.utils.db.GenericDao;
18+
19+
public interface PhysicalNetworkIsolationMethodDao extends GenericDao<PhysicalNetworkIsolationMethodVO, Long>{
20+
21+
/**
22+
* @param physicalNetworkId
23+
* @return
24+
*/
25+
List<String> getAllIsolationMethod(long physicalNetworkId);
26+
27+
/**
28+
* @param physicalNetworkId
29+
* @return
30+
*/
31+
String getIsolationMethod(long physicalNetworkId);
32+
33+
/**
34+
* @param physicalNetworkId
35+
* @return
36+
*/
37+
int clearIsolationMethods(long physicalNetworkId);
38+
39+
}

engine/schema/src/com/cloud/network/dao/PhysicalNetworkIsolationMethodDaoImpl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@
2020

2121
import org.springframework.stereotype.Component;
2222

23-
import com.cloud.utils.db.GenericDao;
2423
import com.cloud.utils.db.GenericDaoBase;
2524
import com.cloud.utils.db.GenericSearchBuilder;
2625
import com.cloud.utils.db.SearchBuilder;
2726
import com.cloud.utils.db.SearchCriteria;
2827
import com.cloud.utils.db.SearchCriteria.Op;
2928

3029
@Component
31-
public class PhysicalNetworkIsolationMethodDaoImpl extends GenericDaoBase<PhysicalNetworkIsolationMethodVO, Long> implements
32-
GenericDao<PhysicalNetworkIsolationMethodVO, Long> {
30+
public class PhysicalNetworkIsolationMethodDaoImpl extends GenericDaoBase<PhysicalNetworkIsolationMethodVO, Long> implements PhysicalNetworkIsolationMethodDao {
3331
private final GenericSearchBuilder<PhysicalNetworkIsolationMethodVO, String> IsolationMethodSearch;
3432
private final SearchBuilder<PhysicalNetworkIsolationMethodVO> AllFieldsSearch;
3533

@@ -47,20 +45,23 @@ protected PhysicalNetworkIsolationMethodDaoImpl() {
4745
AllFieldsSearch.done();
4846
}
4947

48+
@Override
5049
public List<String> getAllIsolationMethod(long physicalNetworkId) {
5150
SearchCriteria<String> sc = IsolationMethodSearch.create();
5251
sc.setParameters("physicalNetworkId", physicalNetworkId);
5352

5453
return customSearch(sc, null);
5554
}
5655

56+
@Override
5757
public String getIsolationMethod(long physicalNetworkId) {
5858
SearchCriteria<String> sc = IsolationMethodSearch.create();
5959
sc.setParameters("physicalNetworkId", physicalNetworkId);
6060

6161
return customSearch(sc, null).get(0);
6262
}
6363

64+
@Override
6465
public int clearIsolationMethods(long physicalNetworkId) {
6566
SearchCriteria<PhysicalNetworkIsolationMethodVO> sc = AllFieldsSearch.create();
6667
sc.setParameters("physicalNetworkId", physicalNetworkId);

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@
181181
import com.cloud.network.dao.NetworkRuleConfigVO;
182182
import com.cloud.network.dao.NetworkVO;
183183
import com.cloud.network.dao.PhysicalNetworkDao;
184+
import com.cloud.network.dao.PhysicalNetworkIsolationMethodDao;
184185
import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
185186
import com.cloud.network.dao.PhysicalNetworkServiceProviderVO;
186187
import com.cloud.network.dao.PhysicalNetworkTrafficTypeDao;
@@ -409,6 +410,7 @@ public class ApiDBUtils {
409410
static ResourceMetaDataService s_resourceDetailsService;
410411
static HostGpuGroupsDao s_hostGpuGroupsDao;
411412
static VGPUTypesDao s_vgpuTypesDao;
413+
static PhysicalNetworkIsolationMethodDao s_pNtwkIsolatinoMethodsDao;
412414

413415
@Inject
414416
private ManagementServer ms;
@@ -631,6 +633,8 @@ public class ApiDBUtils {
631633
private HostGpuGroupsDao hostGpuGroupsDao;
632634
@Inject
633635
private VGPUTypesDao vgpuTypesDao;
636+
@Inject
637+
private PhysicalNetworkIsolationMethodDao pNtwkIsolatinoMethodsDao;
634638

635639
@PostConstruct
636640
void init() {
@@ -745,6 +749,7 @@ void init() {
745749
s_resourceDetailsService = resourceDetailsService;
746750
s_hostGpuGroupsDao = hostGpuGroupsDao;
747751
s_vgpuTypesDao = vgpuTypesDao;
752+
s_pNtwkIsolatinoMethodsDao = pNtwkIsolatinoMethodsDao;
748753
}
749754

750755
// ///////////////////////////////////////////////////////////
@@ -1835,4 +1840,9 @@ public static boolean isAdmin(Account account) {
18351840
public static List<ResourceTagJoinVO> listResourceTagViewByResourceUUID(String resourceUUID, ResourceObjectType resourceType) {
18361841
return s_tagJoinDao.listBy(resourceUUID, resourceType);
18371842
}
1843+
1844+
public static List<String> getIsolationMethodsForPhysicalNtwk(long pNtwkId) {
1845+
return s_pNtwkIsolatinoMethodsDao.getAllIsolationMethod(pNtwkId);
1846+
}
1847+
18381848
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2197,7 +2197,7 @@ public PhysicalNetworkResponse createPhysicalNetworkResponse(PhysicalNetwork res
21972197
if (result.getBroadcastDomainRange() != null) {
21982198
response.setBroadcastDomainRange(result.getBroadcastDomainRange().toString());
21992199
}
2200-
response.setIsolationMethods(result.getIsolationMethods());
2200+
response.setIsolationMethods(ApiDBUtils.getIsolationMethodsForPhysicalNtwk(result.getId()));
22012201
response.setTags(result.getTags());
22022202
if (result.getState() != null) {
22032203
response.setState(result.getState().toString());

0 commit comments

Comments
 (0)