@Override public List<? extends Nic> listNics(ListNicsCmd cmd) { Account caller = CallContext.current().getCallingAccount(); Long nicId = cmd.getNicId(); long vmId = cmd.getVmId(); String keyword = cmd.getKeyword(); Long networkId = cmd.getNetworkId(); UserVmVO userVm = _userVmDao.findById(vmId); if (userVm == null || (!userVm.isDisplayVm() && caller.getType() == Account.ACCOUNT_TYPE_NORMAL)) { throwInvalidIdException("Virtual machine id does not exist", Long.valueOf(vmId).toString(), "vmId"); } _accountMgr.checkAccess(caller, null, true, userVm); return _networkMgr.listVmNics(vmId, nicId, networkId, keyword); }
@Override public List<? extends NicSecondaryIp> listVmNicSecondaryIps(ListNicsCmd cmd) { Account caller = CallContext.current().getCallingAccount(); Long nicId = cmd.getNicId(); long vmId = cmd.getVmId(); String keyword = cmd.getKeyword(); UserVmVO userVm = _userVmDao.findById(vmId); if (userVm == null || (!userVm.isDisplayVm() && caller.getType() == Account.ACCOUNT_TYPE_NORMAL)) { throwInvalidIdException("Virtual machine id does not exist", Long.valueOf(vmId).toString(), "vmId"); } _accountMgr.checkAccess(caller, null, true, userVm); return _nicSecondaryIpDao.listSecondaryIpUsingKeyword(nicId, keyword); }
if (this.getKeyword() != null && !this.getKeyword().isEmpty() && this.getNicId() != null) { List<? extends NicSecondaryIp> results = _networkService.listVmNicSecondaryIps(this); ListResponse<NicSecondaryIpResponse> response = new ListResponse<NicSecondaryIpResponse>(); response.setResponseName(getCommandName()); this.setResponseObject(response); response.setResponseName(getCommandName()); this.setResponseObject(response);