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 D7271200CE4 for ; Sun, 20 Aug 2017 14:47:37 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D58BF1645DF; Sun, 20 Aug 2017 12:47:37 +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 272E51645DE for ; Sun, 20 Aug 2017 14:47:37 +0200 (CEST) Received: (qmail 78816 invoked by uid 500); 20 Aug 2017 12:47:35 -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 78807 invoked by uid 99); 20 Aug 2017 12:47:35 -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; Sun, 20 Aug 2017 12:47:35 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id BBFD28117C; Sun, 20 Aug 2017 12:47:32 +0000 (UTC) Date: Sun, 20 Aug 2017 12:47:32 +0000 To: "commits@cloudstack.apache.org" Subject: [cloudstack] branch master updated: CLOUDSTACK-9734: Destroy VM Fails sometimes (#2013) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <150323325268.6383.3674188084460763026@gitbox.apache.org> From: bhaisaab@apache.org Reply-To: "commits@cloudstack.apache.org" X-Git-Host: gitbox.apache.org X-Git-Repo: cloudstack X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 250c47eb62f51357a68394bc2f73e5d66af49f77 X-Git-Newrev: b947eca9586d62146288e67e7fb39858d6c3328c X-Git-Rev: b947eca9586d62146288e67e7fb39858d6c3328c X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated archived-at: Sun, 20 Aug 2017 12:47:38 -0000 This is an automated email from the ASF dual-hosted git repository. bhaisaab pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cloudstack.git The following commit(s) were added to refs/heads/master by this push: new b947eca CLOUDSTACK-9734: Destroy VM Fails sometimes (#2013) b947eca is described below commit b947eca9586d62146288e67e7fb39858d6c3328c Author: SudharmaJain AuthorDate: Sun Aug 20 18:17:28 2017 +0530 CLOUDSTACK-9734: Destroy VM Fails sometimes (#2013) --- .../com/cloud/vm/VirtualMachineManagerImpl.java | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index 5127cf3..babfbdb 100755 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -1710,17 +1710,20 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac deleteVMSnapshots(vm, expunge); - // reload the vm object from db - vm = _vmDao.findByUuid(vmUuid); - try { - if (!stateTransitTo(vm, VirtualMachine.Event.DestroyRequested, vm.getHostId())) { - s_logger.debug("Unable to destroy the vm because it is not in the correct state: " + vm); - throw new CloudRuntimeException("Unable to destroy " + vm); + Transaction.execute(new TransactionCallbackWithExceptionNoReturn() { + public void doInTransactionWithoutResult(final TransactionStatus status) throws CloudRuntimeException { + VMInstanceVO vm = _vmDao.findByUuid(vmUuid); + try { + if (!stateTransitTo(vm, VirtualMachine.Event.DestroyRequested, vm.getHostId())) { + s_logger.debug("Unable to destroy the vm because it is not in the correct state: " + vm); + throw new CloudRuntimeException("Unable to destroy " + vm); + } + } catch (final NoTransitionException e) { + s_logger.debug(e.getMessage()); + throw new CloudRuntimeException("Unable to destroy " + vm, e); + } } - } catch (final NoTransitionException e) { - s_logger.debug(e.getMessage()); - throw new CloudRuntimeException("Unable to destroy " + vm, e); - } + }); } /** -- To stop receiving notification emails like this one, please contact ['"commits@cloudstack.apache.org" '].