Skip to content

Commit d44b4e1

Browse files
committed
comment linking both instances of nic resturning
1 parent 42a3e37 commit d44b4e1

2 files changed

Lines changed: 38 additions & 23 deletions

File tree

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

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@
1616
// under the License.
1717
package com.cloud.api;
1818

19+
import java.text.DecimalFormat;
20+
import java.util.ArrayList;
21+
import java.util.Calendar;
22+
import java.util.Date;
23+
import java.util.EnumSet;
24+
import java.util.HashMap;
25+
import java.util.HashSet;
26+
import java.util.List;
27+
import java.util.Map;
28+
import java.util.Set;
29+
import java.util.TimeZone;
30+
31+
import javax.inject.Inject;
32+
1933
import com.cloud.agent.api.VgpuTypesInfo;
2034
import com.cloud.api.query.ViewResponseHelper;
2135
import com.cloud.api.query.vo.AccountJoinVO;
@@ -304,19 +318,6 @@
304318
import org.apache.commons.collections.CollectionUtils;
305319
import org.apache.log4j.Logger;
306320

307-
import javax.inject.Inject;
308-
import java.text.DecimalFormat;
309-
import java.util.ArrayList;
310-
import java.util.Calendar;
311-
import java.util.Date;
312-
import java.util.EnumSet;
313-
import java.util.HashMap;
314-
import java.util.HashSet;
315-
import java.util.List;
316-
import java.util.Map;
317-
import java.util.Set;
318-
import java.util.TimeZone;
319-
320321
public class ApiResponseHelper implements ResponseGenerator {
321322

322323
private static final Logger s_logger = Logger.getLogger(ApiResponseHelper.class);
@@ -3522,13 +3523,19 @@ public NicSecondaryIpResponse createSecondaryIPToNicResponse(NicSecondaryIp resu
35223523
return response;
35233524
}
35243525

3526+
/**
3527+
* The resulting Response attempts to be in line with what is returned from
3528+
* @see com.cloud.api.query.dao.UserVmJoinDaoImpl#setUserVmResponse(ResponseView, UserVmResponse, UserVmJoinVO)
3529+
*/
35253530
@Override
35263531
public NicResponse createNicResponse(Nic result) {
35273532
NicResponse response = new NicResponse();
35283533
NetworkVO network = _entityMgr.findById(NetworkVO.class, result.getNetworkId());
35293534
VMInstanceVO vm = _entityMgr.findById(VMInstanceVO.class, result.getInstanceId());
35303535
UserVmJoinVO userVm = _entityMgr.findById(UserVmJoinVO.class, result.getInstanceId());
35313536

3537+
// The numbered comments are to keep track of the data returned from here and UserVmJoinDaoImpl.setUserVmResponse()
3538+
// the data can't be identical but some tidying up/unifying might be possible
35323539
/*1: nicUuid*/
35333540
response.setId(result.getUuid());
35343541
/*2: networkUuid*/

server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@
1616
// under the License.
1717
package com.cloud.api.query.dao;
1818

19+
import java.text.DecimalFormat;
20+
import java.util.ArrayList;
21+
import java.util.EnumSet;
22+
import java.util.HashMap;
23+
import java.util.Hashtable;
24+
import java.util.List;
25+
import java.util.Map;
26+
import java.util.Set;
27+
28+
import javax.inject.Inject;
29+
1930
import com.cloud.api.ApiDBUtils;
2031
import com.cloud.api.query.vo.UserVmJoinVO;
2132
import com.cloud.gpu.GPU;
@@ -27,6 +38,7 @@
2738
import com.cloud.uservm.UserVm;
2839
import com.cloud.utils.db.SearchBuilder;
2940
import com.cloud.utils.db.SearchCriteria;
41+
import com.cloud.vm.Nic;
3042
import com.cloud.vm.UserVmDetailVO;
3143
import com.cloud.vm.VirtualMachine.State;
3244
import com.cloud.vm.VmStats;
@@ -43,16 +55,6 @@
4355
import org.apache.log4j.Logger;
4456
import org.springframework.stereotype.Component;
4557

46-
import javax.inject.Inject;
47-
import java.text.DecimalFormat;
48-
import java.util.ArrayList;
49-
import java.util.EnumSet;
50-
import java.util.HashMap;
51-
import java.util.Hashtable;
52-
import java.util.List;
53-
import java.util.Map;
54-
import java.util.Set;
55-
5658
@Component
5759
public class UserVmJoinDaoImpl extends GenericDaoBaseWithTagInformation<UserVmJoinVO, UserVmResponse> implements UserVmJoinDao {
5860
public static final Logger s_logger = Logger.getLogger(UserVmJoinDaoImpl.class);
@@ -309,6 +311,10 @@ public UserVmResponse newUserVmResponse(ResponseView view, String objectName, Us
309311
return userVmResponse;
310312
}
311313

314+
/**
315+
* The resulting Response attempts to be in line with what is returned from
316+
* @see com.cloud.api.ApiResponseHelper#createNicResponse(Nic)
317+
*/
312318
@Override
313319
public UserVmResponse setUserVmResponse(ResponseView view, UserVmResponse userVmData, UserVmJoinVO uvo) {
314320
Long securityGroupId = uvo.getSecurityGroupId();
@@ -330,6 +336,8 @@ public UserVmResponse setUserVmResponse(ResponseView view, UserVmResponse userVm
330336
long nic_id = uvo.getNicId();
331337
if (nic_id > 0) {
332338
NicResponse nicResponse = new NicResponse();
339+
// The numbered comments are to keep track of the data returned from here and ApiResponseHelper.createNicResponse()
340+
// the data can't be identical but some tidying up/unifying might be possible
333341
/*1: nicUuid*/
334342
nicResponse.setId(uvo.getNicUuid());
335343
/*2: networkUuid*/

0 commit comments

Comments
 (0)