Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 87DEA200D34 for ; Fri, 3 Nov 2017 16:13:05 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 86986160C01; Fri, 3 Nov 2017 15:13:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 04657160BFD for ; Fri, 3 Nov 2017 16:13:04 +0100 (CET) Received: (qmail 32979 invoked by uid 500); 3 Nov 2017 15:13:03 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 32894 invoked by uid 99); 3 Nov 2017 15:13:03 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Nov 2017 15:13:03 +0000 From: GitBox To: commits@cloudstack.apache.org Subject: [GitHub] rhtyd commented on a change in pull request #2048: CLOUDSTACK-9880: Expansion of Management IP Range. Message-ID: <150972198318.25614.3188635150533719060.gitbox@gitbox.apache.org> archived-at: Fri, 03 Nov 2017 15:13:05 -0000 rhtyd commented on a change in pull request #2048: CLOUDSTACK-9880: Expansion of Management IP Range. URL: https://github.com/apache/cloudstack/pull/2048#discussion_r148809330 ########## File path: server/src/com/cloud/configuration/ConfigurationManagerImpl.java ########## @@ -1097,8 +1095,243 @@ public void doInTransactionWithoutResult(final TransactionStatus status) { } @Override + @DB + public Pod createPodIpRange(final CreateManagementNetworkIpRangeCmd cmd) { + + //Check if calling account is root admin. + final Account account = CallContext.current().getCallingAccount(); + + if(!_accountMgr.isRootAdmin(account.getId())) { + throw new PermissionDeniedException("Cannot perform this operation, Calling account is not root admin: " + account.getId()); + } + + final long podId = cmd.getPodId(); + final String gateway = cmd.getGateWay(); + final String netmask = cmd.getNetmask(); + final String startIp = cmd.getStartIp(); + String endIp = cmd.getEndIp(); + + final HostPodVO pod = _podDao.findById(podId); + + if(pod == null) { + throw new InvalidParameterValueException("Unable to find pod by ID: " + podId); + } + + final long zoneId = pod.getDataCenterId(); + + //Check if gateway is a valid IP address. + if(!NetUtils.isValidIp(gateway)) { + throw new InvalidParameterValueException("The gateway IP address is invalid."); + } + + //Check if netmask is valid. Review comment: Remove comments, they tell what the code is trying to do (redundancy) ---------------------------------------------------------------- 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