From issues-return-88066-archive-asf-public=cust-asf.ponee.io@cloudstack.apache.org Thu Jan 4 12:24:05 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id ED64A180657 for ; Thu, 4 Jan 2018 12:24:05 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id DD36F160C3A; Thu, 4 Jan 2018 11:24: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 0833C160C2B for ; Thu, 4 Jan 2018 12:24:04 +0100 (CET) Received: (qmail 82031 invoked by uid 500); 4 Jan 2018 11:24:04 -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 82017 invoked by uid 500); 4 Jan 2018 11:24:04 -0000 Delivered-To: apmail-incubator-cloudstack-issues@incubator.apache.org Received: (qmail 82014 invoked by uid 99); 4 Jan 2018 11:24:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Jan 2018 11:24:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id A13DC1A020F for ; Thu, 4 Jan 2018 11:24:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.211 X-Spam-Level: X-Spam-Status: No, score=-99.211 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id L1s4paAslNqm for ; Thu, 4 Jan 2018 11:24:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id CE7DF5FB16 for ; Thu, 4 Jan 2018 11:24:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 47F00E0F13 for ; Thu, 4 Jan 2018 11:24:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id A40D1240F2 for ; Thu, 4 Jan 2018 11:24:00 +0000 (UTC) Date: Thu, 4 Jan 2018 11:24:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: cloudstack-issues@incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CLOUDSTACK-10146) Bypass Secondary Storage for KVM templates 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-10146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16311199#comment-16311199 ] ASF GitHub Bot commented on CLOUDSTACK-10146: --------------------------------------------- rafaelweingartner commented on a change in pull request #2379: CLOUDSTACK-10146: Bypass Secondary Storage for KVM templates URL: https://github.com/apache/cloudstack/pull/2379#discussion_r159627119 ########## File path: agent/src/com/cloud/agent/direct/download/DirectTemplateDownloaderImpl.java ########## @@ -0,0 +1,193 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +package com.cloud.agent.direct.download; + +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.script.Script; +import org.apache.cloudstack.utils.security.ChecksumValue; +import org.apache.commons.lang.StringUtils; + +import java.io.File; +import java.util.UUID; + +public abstract class DirectTemplateDownloaderImpl implements DirectTemplateDownloader { + + private String url; + private String destPoolPath; + private Long templateId; + private String downloadedFilePath; + private String installPath; + private String checksum; + + protected DirectTemplateDownloaderImpl(final String url, final String destPoolPath, final Long templateId, final String checksum) { + this.url = url; + this.destPoolPath = destPoolPath; + this.templateId = templateId; + this.checksum = checksum; + } + + private static String directDownloadDir = "template"; + + /** + * Return direct download temporary path to download template + * @param templateId + * @return + */ + protected static String getDirectDownloadTempPath(Long templateId) { + String templateIdAsString = String.valueOf(templateId); + return directDownloadDir + File.separator + templateIdAsString.substring(0,1) + + File.separator + templateIdAsString; + } + + /** + * Create folder on path if it does not exist + * @param path + */ + protected void createFolder(String path) { + File dir = new File(path); + if (!dir.exists()) { + dir.mkdirs(); + } + } + + public String getUrl() { + return url; + } + + public String getDestPoolPath() { + return destPoolPath; + } + + public Long getTemplateId() { + return templateId; + } + + public String getDownloadedFilePath() { + return downloadedFilePath; + } + + public void setDownloadedFilePath(String filePath) { + this.downloadedFilePath = filePath; + } + + /** + * Return filename from url + * @return Review comment: You can remove this empty "@return/@param" or others in the same style ---------------------------------------------------------------- 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 > Bypass Secondary Storage for KVM templates > ------------------------------------------ > > Key: CLOUDSTACK-10146 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10146 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the default.) > Affects Versions: 4.11.0.0 > Reporter: Nicolas Vazquez > Assignee: Nicolas Vazquez > -- This message was sent by Atlassian JIRA (v6.4.14#64029)