[
https://issues.apache.org/jira/browse/CLOUDSTACK-10102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16296647#comment-16296647
]
ASF GitHub Bot commented on CLOUDSTACK-10102:
---------------------------------------------
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:
[email protected]
> New Network Type (L2)
> ---------------------
>
> Key: CLOUDSTACK-10102
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10102
> Project: CloudStack
> Issue Type: Improvement
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Reporter: Nicolas Vazquez
> Assignee: Nicolas Vazquez
>
> Feature Specification:
> https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=74680920
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)