|
29 | 29 | import javax.annotation.PostConstruct; |
30 | 30 | import javax.inject.Inject; |
31 | 31 |
|
| 32 | +import com.cloud.offerings.dao.NetworkOfferingServiceMapDao; |
| 33 | +import org.apache.commons.collections.CollectionUtils; |
32 | 34 | import org.apache.log4j.Logger; |
33 | 35 |
|
34 | 36 | import com.cloud.network.Network; |
@@ -82,6 +84,8 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use |
82 | 84 | ResourceTagDao _tagsDao; |
83 | 85 | @Inject |
84 | 86 | NetworkDao networkDao; |
| 87 | + @Inject |
| 88 | + NetworkOfferingServiceMapDao networkOfferingServiceMapDao; |
85 | 89 |
|
86 | 90 | private static final String LIST_PODS_HAVING_VMS_FOR_ACCOUNT = |
87 | 91 | "SELECT pod_id FROM cloud.vm_instance WHERE data_center_id = ? AND account_id = ? AND pod_id IS NOT NULL AND (state = 'Running' OR state = 'Stopped') " |
@@ -313,7 +317,10 @@ private void recreateUserVmSeach(NetworkVO network) { |
313 | 317 | SearchBuilder<NicVO> nicSearch = _nicDao.createSearchBuilder(); |
314 | 318 | nicSearch.and("networkId", nicSearch.entity().getNetworkId(), SearchCriteria.Op.EQ); |
315 | 319 | nicSearch.and("removed", nicSearch.entity().getRemoved(), SearchCriteria.Op.NULL); |
316 | | - if (!Network.GuestType.L2.equals(network.getGuestType())) { |
| 320 | + |
| 321 | + List<String> networkServices = networkOfferingServiceMapDao.listServicesForNetworkOffering(network.getNetworkOfferingId()); |
| 322 | + |
| 323 | + if (!Network.GuestType.L2.equals(network.getGuestType()) && CollectionUtils.isNotEmpty(networkServices)) { |
317 | 324 | nicSearch.and().op("ip4Address", nicSearch.entity().getIPv4Address(), SearchCriteria.Op.NNULL); |
318 | 325 | nicSearch.or("ip6Address", nicSearch.entity().getIPv6Address(), SearchCriteria.Op.NNULL); |
319 | 326 | nicSearch.cp(); |
|
0 commit comments