Return-Path: X-Original-To: apmail-cloudstack-issues-archive@www.apache.org Delivered-To: apmail-cloudstack-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7D65C189B3 for ; Thu, 14 Jan 2016 05:16:42 +0000 (UTC) Received: (qmail 22431 invoked by uid 500); 14 Jan 2016 05:16:40 -0000 Delivered-To: apmail-cloudstack-issues-archive@cloudstack.apache.org Received: (qmail 22265 invoked by uid 500); 14 Jan 2016 05:16:40 -0000 Mailing-List: contact issues-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 issues@cloudstack.apache.org Received: (qmail 22128 invoked by uid 500); 14 Jan 2016 05:16:40 -0000 Delivered-To: apmail-incubator-cloudstack-issues@incubator.apache.org Received: (qmail 22070 invoked by uid 99); 14 Jan 2016 05:16:40 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jan 2016 05:16:40 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 174E32C1F72 for ; Thu, 14 Jan 2016 05:16:40 +0000 (UTC) Date: Thu, 14 Jan 2016 05:16:40 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: cloudstack-issues@incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CLOUDSTACK-8950) Hypervisor Parameter check is not performed for registerTemplate and getUploadParamsForTemplate API's. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CLOUDSTACK-8950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15097615#comment-15097615 ] ASF GitHub Bot commented on CLOUDSTACK-8950: -------------------------------------------- Github user GabrielBrascher commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/928#discussion_r49688571 --- Diff: server/src/com/cloud/template/TemplateAdapterBase.java --- @@ -293,9 +298,15 @@ public TemplateProfile prepare(GetUploadParamsForTemplateCmd cmd) throws Resourc zoneId = -1L; } + HypervisorType hypervisorType = HypervisorType.getType(cmd.getHypervisor()); + if(hypervisorType == HypervisorType.None) { + throw new InvalidParameterValueException("Hypervisor Type: " + cmd.getHypervisor() + " is invalid. Supported Hypervisor types are " + + EnumUtils.listValues(HypervisorType.values()).replace("None, ", "")); + } --- End diff -- @karuturi Can you create a method for those duplicated blocks (lines 302-305 and 274-277) and document it? Example: checkForNoneHypervisorType(HypervisorType hypervisorType) {..} > Hypervisor Parameter check is not performed for registerTemplate and getUploadParamsForTemplate API's. > ------------------------------------------------------------------------------------------------------- > > Key: CLOUDSTACK-8950 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8950 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the default.) > Reporter: Rajani Karuturi > Assignee: Rajani Karuturi > Fix For: 4.7.0 > > > Register Template : > http://10.220.135.31:8096/client/api?command=registerTemplate&displaytext=urlapi&format=VHD&hypervisor=ABC&name=urlapi1&ostypeid=6c590b5c-fde9-11e4-b65a-a20b7b72c771&url=http://10.147.28.7/templates/rajani-thin-volume.vhd&zoneid=1e7bbab9-02cd-4067-99f9-3f8b115304df > getUploadParamsForTemplate : > http://10.81.29.49:8096/client/api?command=getUploadParamsForTemplate&type=template&response=json&name=nossvm&displayText=nossvmnossvm&zoneid=ca8adf51-539d-45eb-b205-792a58503d14&format=VHD&isextractable=false&passwordEnabled=false&isdynamicallyscalable=false&osTypeId=ce099056-ee53-11e4-a8ad-d242118f6f9b&hypervisor=XEN&requireshvm=false&apiKey=_cMgYFGzeE0QEMmqN5OWC5QpOm33UqGpVbAXUntbR_ESNoKX-N9TMNhCcl-lUbyYhT90k53gCkvSP0ZO3CWtxg&account=admin&domainid=cddff412-ee53-11e4-a8ad-d242118f6f9b > In the above API calls have given the hypervisor types as ABC and XEN respectively. No error is thrown and templates are sucessfully registerd and Uploaded . But they do not list in the Templates section as DB entry for the above shows HYpervisor as NONE . > Expected Result : > Hypervisor parameter should only accept values which the cloudstack currently supports and API should fail if we give any other values . Templates should not be uploaded for NONE type . -- This message was sent by Atlassian JIRA (v6.3.4#6332)