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 BCB8F189C0 for ; Mon, 1 Feb 2016 01:22:40 +0000 (UTC) Received: (qmail 83075 invoked by uid 500); 1 Feb 2016 01:22:40 -0000 Delivered-To: apmail-cloudstack-issues-archive@cloudstack.apache.org Received: (qmail 83044 invoked by uid 500); 1 Feb 2016 01:22: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 83035 invoked by uid 500); 1 Feb 2016 01:22:40 -0000 Delivered-To: apmail-incubator-cloudstack-issues@incubator.apache.org Received: (qmail 83032 invoked by uid 99); 1 Feb 2016 01:22:40 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Feb 2016 01:22:40 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id C4A102C14F7 for ; Mon, 1 Feb 2016 01:22:39 +0000 (UTC) Date: Mon, 1 Feb 2016 01:22:39 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: cloudstack-issues@incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CLOUDSTACK-8609) [VMware] VM is not accessible after a migration across clusters. 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-8609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15125600#comment-15125600 ] ASF GitHub Bot commented on CLOUDSTACK-8609: -------------------------------------------- Github user pedro-martins commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/556#discussion_r51372149 --- Diff: plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java --- @@ -1765,7 +1767,18 @@ protected StartAnswer execute(StartCommand cmd) { // Since VM was successfully powered-on, if there was an existing VM in a different cluster that was unregistered, delete all the files associated with it. if (existingVmName != null && existingVmFileLayout != null) { - deleteUnregisteredVmFiles(existingVmFileLayout, dcMo, true); + List skipDatastores = new ArrayList(); + List vmDatastoreNames = new ArrayList(); + for (DatastoreMO vmDatastore : vmMo.getAllDatastores()) { + vmDatastoreNames.add(vmDatastore.getName()); + } + // Don't delete files that are in a datastore that is being used by the new VM as well (zone-wide datastore). + for (DatastoreMO existingDatastore : existingDatastores) { + if (vmDatastoreNames.contains(existingDatastore.getName())) { + skipDatastores.add(existingDatastore.getName()); + } + } + deleteUnregisteredVmFiles(existingVmFileLayout, dcMo, true, skipDatastores); } --- End diff -- Hi, likitha. Could you extract the code between lines 1770 - 1775 and 1776 - 1780 to methods with a little test case and Javadoc explaining what the methods do, the params that they use and what they return? Another thing, how about you replace the logic in 'if's at lines 2272, 2283 and 2291 for a method with a little test case and a Javadoc, that receives 2 params, (List skipDatastores, String name ) and returns skipDatastores == null || !skipDatastores.contains(name). Ty. > [VMware] VM is not accessible after a migration across clusters. > ---------------------------------------------------------------- > > Key: CLOUDSTACK-8609 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8609 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the default.) > Reporter: Likitha Shetty > Assignee: Likitha Shetty > Fix For: 4.6.1 > > > +Steps to reproduce+ > 1. Deploy a VMware zone with 2 clusters (a host each, H1 and H2) and one zone-wide primary storage spanning the two clusters. > 2. Deploy a VM (VM1) on one of the hosts (H1). > 3. Stop VM1. > 4. Make the host that contains the VM unsuitable for further VM deployments > - host runs out of capacity (cpu/memory) > - host has maximum VMs deployed on it > 5. Start VM1. > 6. VM will be powered on H2 but will not be accessible because the .vmx and other VM files associated with the VM have been deleted. -- This message was sent by Atlassian JIRA (v6.3.4#6332)