From commits-return-77106-archive-asf-public=cust-asf.ponee.io@cloudstack.apache.org Tue May 22 11:36:56 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id E81E0180638 for ; Tue, 22 May 2018 11:36:55 +0200 (CEST) Received: (qmail 59643 invoked by uid 500); 22 May 2018 09:36:55 -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 59632 invoked by uid 99); 22 May 2018 09:36:55 -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; Tue, 22 May 2018 09:36:55 +0000 From: GitBox To: commits@cloudstack.apache.org Subject: [GitHub] rafaelweingartner commented on a change in pull request #2653: Generate MAC address if the MAC in command addNicToVirtualMachine is invalid Message-ID: <152698181435.26671.15090323882612592463.gitbox@gitbox.apache.org> Date: Tue, 22 May 2018 09:36:54 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit rafaelweingartner commented on a change in pull request #2653: Generate MAC address if the MAC in command addNicToVirtualMachine is invalid URL: https://github.com/apache/cloudstack/pull/2653#discussion_r189836738 ########## File path: server/src/com/cloud/vm/UserVmManagerImpl.java ########## @@ -1228,6 +1230,19 @@ public UserVm addNicToVirtualMachine(AddNicToVMCmd cmd) throws InvalidParameterV return _vmDao.findById(vmInstance.getId()); } + /** + * If the given MAC address is invalid it replaces the given MAC with the next available MAC address + */ + protected String validateOrReplaceMacAddress(String macAddress, long networkId) { + if (!NetUtils.isValidMac(macAddress)) { Review comment: I think we should only generate a MAC address if the value entered by the user is null. All other combinations (invalid, empty, blank and so on) should return an invalid parameter value exception. ---------------------------------------------------------------- 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