|
34 | 34 |
|
35 | 35 | import javax.inject.Inject; |
36 | 36 |
|
| 37 | +import com.cloud.network.dao.IPAddressDao; |
| 38 | +import com.cloud.network.dao.IPAddressVO; |
37 | 39 | import com.cloud.storage.StoragePool; |
38 | 40 | import com.cloud.storage.StoragePoolHostVO; |
39 | 41 | import com.cloud.event.EventVO; |
@@ -549,6 +551,9 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q |
549 | 551 | @Inject |
550 | 552 | private NetworkDao networkDao; |
551 | 553 |
|
| 554 | + @Inject |
| 555 | + private IPAddressDao ipAddressDao; |
| 556 | + |
552 | 557 | @Inject |
553 | 558 | private NicDao nicDao; |
554 | 559 |
|
@@ -1453,6 +1458,22 @@ private Pair<List<Long>, Integer> searchForUserVMIdsAndCount(ListVMsCmd cmd) { |
1453 | 1458 | if (isRootAdmin) { |
1454 | 1459 | userVmSearchBuilder.or("keywordInstanceName", userVmSearchBuilder.entity().getInstanceName(), Op.LIKE ); |
1455 | 1460 | } |
| 1461 | + |
| 1462 | + SearchBuilder<IPAddressVO> ipAddressSearch = ipAddressDao.createSearchBuilder(); |
| 1463 | + userVmSearchBuilder.join("ipAddressSearch", ipAddressSearch, |
| 1464 | + ipAddressSearch.entity().getAssociatedWithVmId(), userVmSearchBuilder.entity().getId(), JoinBuilder.JoinType.LEFT); |
| 1465 | + |
| 1466 | + SearchBuilder<NicVO> nicSearch = nicDao.createSearchBuilder(); |
| 1467 | + userVmSearchBuilder.join("nicSearch", nicSearch, JoinBuilder.JoinType.LEFT, |
| 1468 | + JoinBuilder.JoinCondition.AND, |
| 1469 | + nicSearch.entity().getInstanceId(), userVmSearchBuilder.entity().getId(), |
| 1470 | + nicSearch.entity().getRemoved(), userVmSearchBuilder.entity().setLong(null)); |
| 1471 | + |
| 1472 | + userVmSearchBuilder.or("ipAddressSearch", "keywordPublicIpAddress", ipAddressSearch.entity().getAddress(), Op.LIKE); |
| 1473 | + |
| 1474 | + userVmSearchBuilder.or("nicSearch", "keywordIpAddress", nicSearch.entity().getIPv4Address(), Op.LIKE); |
| 1475 | + userVmSearchBuilder.or("nicSearch", "keywordIp6Address", nicSearch.entity().getIPv6Address(), Op.LIKE); |
| 1476 | + |
1456 | 1477 | userVmSearchBuilder.cp(); |
1457 | 1478 | } |
1458 | 1479 |
|
@@ -1546,6 +1567,9 @@ private Pair<List<Long>, Integer> searchForUserVMIdsAndCount(ListVMsCmd cmd) { |
1546 | 1567 | userVmSearchCriteria.setParameters("keywordDisplayName", keywordMatch); |
1547 | 1568 | userVmSearchCriteria.setParameters("keywordName", keywordMatch); |
1548 | 1569 | userVmSearchCriteria.setParameters("keywordState", keyword); |
| 1570 | + userVmSearchCriteria.setParameters("keywordIpAddress", keywordMatch); |
| 1571 | + userVmSearchCriteria.setParameters("keywordPublicIpAddress", keywordMatch); |
| 1572 | + userVmSearchCriteria.setParameters("keywordIp6Address", keywordMatch); |
1549 | 1573 | if (isRootAdmin) { |
1550 | 1574 | userVmSearchCriteria.setParameters("keywordInstanceName", keywordMatch); |
1551 | 1575 | } |
|
0 commit comments