Return-Path: X-Original-To: apmail-cloudstack-dev-archive@www.apache.org Delivered-To: apmail-cloudstack-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CCE9718877 for ; Wed, 18 Nov 2015 09:20:09 +0000 (UTC) Received: (qmail 58381 invoked by uid 500); 18 Nov 2015 09:20:09 -0000 Delivered-To: apmail-cloudstack-dev-archive@cloudstack.apache.org Received: (qmail 58325 invoked by uid 500); 18 Nov 2015 09:20:09 -0000 Mailing-List: contact dev-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 dev@cloudstack.apache.org Received: (qmail 58313 invoked by uid 99); 18 Nov 2015 09:20:09 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Nov 2015 09:20:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id B665EC7011 for ; Wed, 18 Nov 2015 09:20:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.9 X-Spam-Level: ** X-Spam-Status: No, score=2.9 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id vFxUhqNLYTjq for ; Wed, 18 Nov 2015 09:19:59 +0000 (UTC) Received: from mail-qg0-f44.google.com (mail-qg0-f44.google.com [209.85.192.44]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 9DF3721195 for ; Wed, 18 Nov 2015 09:19:58 +0000 (UTC) Received: by qgec40 with SMTP id c40so23561559qge.2 for ; Wed, 18 Nov 2015 01:19:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=YHj4FoegxQ5S9XSBToEdoPquNqlpK+DjhHIJjJtLRFU=; b=BnfTofTWOiUZ6q5darSNItObdHNTwuJH8gmf/7DnJtsUpTuw/+LQ48SrkY+oaxmZQe bN/BvusUsOUImOnzV0Ox0Hky/8kN0kCwnV1fJIY389vajFMsnUGk+edPB8ygJ1dfM8Za 2rgANM/SU/euxgY0aqGzzkIOI1E3tlFj1h1O72vqO4cI+fOYGCmUxz/pKrpcW8QZssut ed27TUzEsJVH76hEuLkQChWnjJjwRNMbQS0zqW5gKYLBYWVYkGgtMnB/o1gucxu22tv3 xoziPl+T6/SH1KEsjwstMCkNqEfWrxMewVzUjg1XmBEt2QEGPf88i2GIr1eY9BRQFpp9 8W6Q== MIME-Version: 1.0 X-Received: by 10.140.131.74 with SMTP id 71mr383600qhd.51.1447838397682; Wed, 18 Nov 2015 01:19:57 -0800 (PST) Received: by 10.140.39.240 with HTTP; Wed, 18 Nov 2015 01:19:57 -0800 (PST) In-Reply-To: <001901d121d1$f602dfc0$e2089f40$@cn> References: <001901d121d1$f602dfc0$e2089f40$@cn> Date: Wed, 18 Nov 2015 10:19:57 +0100 Message-ID: Subject: Re: [KVM] NPE when createVolume by a snapshot whose source volume is deleted From: Wei ZHOU To: "dev@cloudstack.apache.org" Content-Type: multipart/alternative; boundary=001a11350c7062d8f30524cd2579 --001a11350c7062d8f30524cd2579 Content-Type: text/plain; charset=UTF-8 Qian, This is fixed in 4.6/master by commit bef92052ee9a7303b427782838a8a97623de231c diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeDataFactoryImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeDataFactoryImp~ index bc51f5f..3e4cdff 100644 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeDataFactoryImpl.java +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeDataFactoryImpl.java @@ -77,7 +77,7 @@ public class VolumeDataFactoryImpl implements VolumeDataFactory { @Override public VolumeInfo getVolume(long volumeId) { - VolumeVO volumeVO = volumeDao.findById(volumeId); + VolumeVO volumeVO = volumeDao.findByIdIncludingRemoved(volumeId); if (volumeVO == null) { return null; } Kind regards, Wei 2015-11-18 8:23 GMT+01:00 Qian Shaohua : > Hi all, > > > > CS 4.5.2 KVM > > KVMStorageProcessor checks source volume of a snapshot for the ImageFormat > in createVolumeFromSnapshot(CopyCommand cmd). > > If the source volume is deleted, we get NPE. > > > > 2015-11-18 14:02:57,259 DEBUG [o.a.c.e.o.VolumeOrchestrator] > (API-Job-Executor-35:ctx-0c1e2671 job-2795 ctx-5108a77c) Failed to create > volume from snapshot:java.lang.NullPointerException > > at > > com.cloud.hypervisor.kvm.storage.KVMStorageProcessor.createVolumeFromSnapsho > t(KVMStorageProcessor.java:1237) > > at > > com.cloud.storage.resource.StorageSubsystemCommandHandlerBase.execute(Storag > eSubsystemCommandHandlerBase.java:97) > > at > > com.cloud.storage.resource.StorageSubsystemCommandHandlerBase.handleStorageC > ommands(StorageSubsystemCommandHandlerBase.java:53) > > at > > com.cloud.hypervisor.kvm.resource.LibvirtComputingResource.executeRequest(Li > bvirtComputingResource.java:1406) > > at com.cloud.agent.Agent.processRequest(Agent.java:503) > > at com.cloud.agent.Agent$AgentRequestHandler.doTask(Agent.java:808) > > at com.cloud.utils.nio.Task.run(Task.java:84) > > at > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:11 > 45) > > at > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:6 > 15) > > at java.lang.Thread.run(Thread.java:744) > > > > It isn't fix in master as we know. > > Shall we save format info in snapshots table and get rid of the dependency? > > Or give the volume info in CopyCommand even if the volume is deleted? > > > > -- > > Qian > > --001a11350c7062d8f30524cd2579--