Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3783A10431 for ; Tue, 11 Mar 2014 14:27:26 +0000 (UTC) Received: (qmail 64706 invoked by uid 500); 11 Mar 2014 14:26:47 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 64393 invoked by uid 500); 11 Mar 2014 14:26:39 -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 63602 invoked by uid 99); 11 Mar 2014 14:26:25 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Mar 2014 14:26:25 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C00DC93EDB1; Tue, 11 Mar 2014 14:26:24 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: muralireddy@apache.org To: commits@cloudstack.apache.org Date: Tue, 11 Mar 2014 14:26:39 -0000 Message-Id: <7dfb4885f0204bb8904f18f41170de71@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [17/50] [abbrv] git commit: updated refs/heads/regionvpc to edf12eb CLOUDSTACK-6170 Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cb26b4c3 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cb26b4c3 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cb26b4c3 Branch: refs/heads/regionvpc Commit: cb26b4c3375cdf4f8ecedf618f98e6b24a2cba6e Parents: ded7e68 Author: Mike Tutkowski Authored: Fri Mar 7 22:20:38 2014 -0700 Committer: Mike Tutkowski Committed: Fri Mar 7 23:52:01 2014 -0700 ---------------------------------------------------------------------- .../src/com/cloud/hypervisor/XenServerGuru.java | 33 ++++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb26b4c3/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java index 529e261..059e6e4 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java @@ -34,7 +34,6 @@ import com.cloud.host.HostVO; import com.cloud.host.dao.HostDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.storage.GuestOSVO; -import com.cloud.storage.Volume; import com.cloud.storage.VolumeVO; import com.cloud.storage.dao.GuestOSDao; import com.cloud.storage.dao.VolumeDao; @@ -103,30 +102,30 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru List volumes = _volumeDao.findByInstance(vm.getId()); + // it's OK in this case to send a detach command to the host for a root volume as this + // will simply lead to the SR that supports the root volume being removed if (volumes != null) { for (VolumeVO volume : volumes) { - if (volume.getVolumeType() == Volume.Type.DATADISK) { - StoragePoolVO storagePool = _storagePoolDao.findById(volume.getPoolId()); + StoragePoolVO storagePool = _storagePoolDao.findById(volume.getPoolId()); - // storagePool should be null if we are expunging a volume that was never - // attached to a VM that was started (the "trick" for storagePool to be null - // is that none of the VMs this volume may have been attached to were ever started, - // so the volume was never assigned to a storage pool) - if (storagePool != null && storagePool.isManaged()) { - DataTO volTO = _volFactory.getVolume(volume.getId()).getTO(); - DiskTO disk = new DiskTO(volTO, volume.getDeviceId(), volume.getPath(), volume.getVolumeType()); + // storagePool should be null if we are expunging a volume that was never + // attached to a VM that was started (the "trick" for storagePool to be null + // is that none of the VMs this volume may have been attached to were ever started, + // so the volume was never assigned to a storage pool) + if (storagePool != null && storagePool.isManaged()) { + DataTO volTO = _volFactory.getVolume(volume.getId()).getTO(); + DiskTO disk = new DiskTO(volTO, volume.getDeviceId(), volume.getPath(), volume.getVolumeType()); - DettachCommand cmd = new DettachCommand(disk, vm.getInstanceName()); + DettachCommand cmd = new DettachCommand(disk, vm.getInstanceName()); - cmd.setManaged(true); + cmd.setManaged(true); - cmd.setStorageHost(storagePool.getHostAddress()); - cmd.setStoragePort(storagePool.getPort()); + cmd.setStorageHost(storagePool.getHostAddress()); + cmd.setStoragePort(storagePool.getPort()); - cmd.set_iScsiName(volume.get_iScsiName()); + cmd.set_iScsiName(volume.get_iScsiName()); - commands.add(cmd); - } + commands.add(cmd); } } }