Github user borisroman commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1209#discussion_r47435854
  
    --- Diff: engine/schema/src/com/cloud/vm/dao/NicDaoImpl.java ---
    @@ -222,11 +222,20 @@ public String getIpAddress(long networkId, long 
instanceId) {
         }
     
         @Override
    -    public int countNics(long instanceId) {
    -        SearchCriteria<Integer> sc = CountBy.create();
    -        sc.setParameters("vmId", instanceId);
    -        List<Integer> results = customSearch(sc, null);
    -        return results.get(0);
    +    public int getFreeDeviceId(long instanceId) {
    +        Filter searchFilter = new Filter(NicVO.class, "deviceId", true, 
null, null);
    +        SearchCriteria<Integer> sc = deviceIdSearch.create();
    +        sc.setParameters("instance", instanceId);
    +        List<Integer> deviceIds = customSearch(sc, searchFilter);
    +
    +        int freeDeviceId = 0;
    +        for (int deviceId : deviceIds) {
    --- End diff --
    
    @ustcweizhou Could you elaborate on what the logic does?



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to