You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2017/12/19 11:30:56 UTC
[GitHub] rafaelweingartner commented on a change in pull request #2281: CLOUDSTACK-10102: New network type (L2)
rafaelweingartner commented on a change in pull request #2281: CLOUDSTACK-10102: New network type (L2)
URL: https://github.com/apache/cloudstack/pull/2281#discussion_r157727843
##########
File path: engine/schema/src/com/cloud/vm/dao/UserVmDaoImpl.java
##########
@@ -299,21 +304,32 @@ public void updateVM(long id, String displayName, boolean enable, Long osTypeId,
return listBy(sc);
}
- @Override
- public List<UserVmVO> listByNetworkIdAndStates(long networkId, State... states) {
- if (UserVmSearch == null) {
+ /**
+ * Recreates UserVmSearch depending on network type, as nics on L2 networks have no ip addresses
+ * @param network network
+ */
+ private void recreateUserVmSeach(NetworkVO network) {
+ if (network != null) {
SearchBuilder<NicVO> nicSearch = _nicDao.createSearchBuilder();
nicSearch.and("networkId", nicSearch.entity().getNetworkId(), SearchCriteria.Op.EQ);
nicSearch.and("removed", nicSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
- nicSearch.and().op("ip4Address", nicSearch.entity().getIPv4Address(), SearchCriteria.Op.NNULL);
- nicSearch.or("ip6Address", nicSearch.entity().getIPv6Address(), SearchCriteria.Op.NNULL);
- nicSearch.cp();
+ if (!network.getGuestType().equals(Network.GuestType.L2)) {
Review comment:
Can the method `getGuestType` return `Null`?
If not, the code is ok. Otherwise, it might be more interesting to do `Network.GuestType.L2.equals(network.getGuestType())`
Or even using `==`, if it is an enum type, it is ok to use `==`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services