You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by maneesha-p <gi...@git.apache.org> on 2015/09/10 11:38:05 UTC

[GitHub] cloudstack pull request: CLOUDSTACK-8829 : Consecutive cold migrat...

GitHub user maneesha-p opened a pull request:

    https://github.com/apache/cloudstack/pull/797

    CLOUDSTACK-8829 : Consecutive cold migration fails

    Issue - Consecutive VM cold migration fails.
    Root Cause Analysis - In case of VMware, if VM is being cold migrated between clusters belonging to two different VMware DCs, CCP unregisters the VM from the source host and cleans up the associated VM files. The check if a VM is being cold migrated across DCs is made using the source host id. In case of consecutive cold migrations since the source host id of a VM is NULL and no VM exists, CCP should skip the check
    Proposed Solution - Attempt to unregister a VM in another DC, only if there is a host associated with a VM.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/maneesha-p/cloudstack pull-21

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cloudstack/pull/797.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #797
    
----
commit 8890fc638ee3ffedac873b1c6af762af3d35f273
Author: Likitha Shetty <li...@citrix.com>
Date:   2015-09-10T09:28:04Z

    CLOUDSTACK-8829 : Consecutive cold migration fails

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8829 : Consecutive cold migrat...

Posted by rhtyd <gi...@git.apache.org>.
Github user rhtyd commented on the pull request:

    https://github.com/apache/cloudstack/pull/797#issuecomment-216188749
  
    @maneesha-p please rebase against latest master and push -f, update on status of your PR



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8829 : Consecutive cold migrat...

Posted by pedro-martins <gi...@git.apache.org>.
Github user pedro-martins commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/797#discussion_r53579417
  
    --- Diff: engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java ---
    @@ -1776,19 +1773,26 @@ private void orchestrateStorageMigration(final String vmUuid, final StoragePool
                     // If VM was cold migrated between clusters belonging to two different VMware DCs,
                     // unregister the VM from the source host and cleanup the associated VM files.
                     if (vm.getHypervisorType().equals(HypervisorType.VMware)) {
    +                    Long srcClusterId = null;
    +                    Long srcHostId = vm.getHostId() != null ? vm.getHostId() : vm.getLastHostId();
    +                    if (srcHostId != null) {
    +                        HostVO srcHost = _hostDao.findById(srcHostId);
    +                        srcClusterId = srcHost.getClusterId();
    +                    }
    +
                         final Long destClusterId = destPool.getClusterId();
                         if (srcClusterId != null && destClusterId != null && ! srcClusterId.equals(destClusterId)) {
                             final String srcDcName = _clusterDetailsDao.getVmwareDcName(srcClusterId);
                             final String destDcName = _clusterDetailsDao.getVmwareDcName(destClusterId);
                             if (srcDcName != null && destDcName != null && !srcDcName.equals(destDcName)) {
                                 s_logger.debug("Since VM's storage was successfully migrated across VMware Datacenters, unregistering VM: " + vm.getInstanceName() +
    -                                    " from source host: " + srcHost.getId());
    +                                    " from source host: " + srcHostId);
                                 final UnregisterVMCommand uvc = new UnregisterVMCommand(vm.getInstanceName());
                                 uvc.setCleanupVmFiles(true);
                                 try {
    -                                _agentMgr.send(srcHost.getId(), uvc);
    +                                _agentMgr.send(srcHostId, uvc);
                                 } catch (final Exception e) {
    -                                throw new CloudRuntimeException("Failed to unregister VM: " + vm.getInstanceName() + " from source host: " + srcHost.getId() +
    +                                throw new CloudRuntimeException("Failed to unregister VM: " + vm.getInstanceName() + " from source host: " + srcHostId +
    --- End diff --
    
    hi @maneesha-p 
    
    How about you replace the catch Exception at line 1794 to ( AgentUnavailableException | OperationTimedoutException )? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8829 : Consecutive cold migrat...

Posted by maneesha-p <gi...@git.apache.org>.
Github user maneesha-p commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/797#discussion_r53916405
  
    --- Diff: engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java ---
    @@ -1776,19 +1773,26 @@ private void orchestrateStorageMigration(final String vmUuid, final StoragePool
                     // If VM was cold migrated between clusters belonging to two different VMware DCs,
                     // unregister the VM from the source host and cleanup the associated VM files.
                     if (vm.getHypervisorType().equals(HypervisorType.VMware)) {
    +                    Long srcClusterId = null;
    +                    Long srcHostId = vm.getHostId() != null ? vm.getHostId() : vm.getLastHostId();
    +                    if (srcHostId != null) {
    +                        HostVO srcHost = _hostDao.findById(srcHostId);
    --- End diff --
    
    @alexandrelimassantana 'srcHost' variable is local to the if-block but 'srcClusterId' variable that is populated inside the if-block is outside the scope of it and as @GabrielBrascher mentioned its being used in line 1784.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack issue #797: CLOUDSTACK-8829 : Consecutive cold migration fails

Posted by maneesha-p <gi...@git.apache.org>.
Github user maneesha-p commented on the issue:

    https://github.com/apache/cloudstack/pull/797
  
    ### ACS CI BVT Run
     **Sumarry:**
     Build Number 128
     Hypervisor xenserver
     NetworkType Advanced
     Passed=73
     Failed=0
     Skipped=3
    
    _Link to logs Folder (search by build_no):_ https://www.dropbox.com/sh/yj3wnzbceo9uef2/AAB6u-Iap-xztdm6jHX9SjPja?dl=0
    
    
    **Failed tests:**
    
    **Skipped tests:**
    test_vm_nic_adapter_vmxnet3
    test_static_role_account_acls
    test_deploy_vgpu_enabled_vm
    
    **Passed test suits:**
    test_deploy_vm_with_userdata.py
    test_affinity_groups_projects.py
    test_portable_publicip.py
    test_vpc_vpn.py
    test_over_provisioning.py
    test_global_settings.py
    test_scale_vm.py
    test_service_offerings.py
    test_routers_iptables_default_policy.py
    test_routers.py
    test_reset_vm_on_reboot.py
    test_snapshots.py
    test_deploy_vms_with_varied_deploymentplanners.py
    test_login.py
    test_list_ids_parameter.py
    test_public_ip_range.py
    test_multipleips_per_nic.py
    test_regions.py
    test_affinity_groups.py
    test_network_acl.py
    test_pvlan.py
    test_volumes.py
    test_nic.py
    test_deploy_vm_root_resize.py
    test_resource_detail.py
    test_secondary_storage.py
    test_vm_life_cycle.py
    test_disk_offerings.py


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8829 : Consecutive cold migrat...

Posted by alexandrelimassantana <gi...@git.apache.org>.
Github user alexandrelimassantana commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/797#discussion_r52846855
  
    --- Diff: engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java ---
    @@ -1776,19 +1773,26 @@ private void orchestrateStorageMigration(final String vmUuid, final StoragePool
                     // If VM was cold migrated between clusters belonging to two different VMware DCs,
                     // unregister the VM from the source host and cleanup the associated VM files.
                     if (vm.getHypervisorType().equals(HypervisorType.VMware)) {
    +                    Long srcClusterId = null;
    +                    Long srcHostId = vm.getHostId() != null ? vm.getHostId() : vm.getLastHostId();
    +                    if (srcHostId != null) {
    +                        HostVO srcHost = _hostDao.findById(srcHostId);
    --- End diff --
    
    Hello @maneesha-p
    I got a little confused by this if statement. Are you actually doing anything inside it? If Im not mistaken both variables are local inside this if-block and won't do anything outside it's scope, is this intended?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8829 : Consecutive cold migrat...

Posted by maneesha-p <gi...@git.apache.org>.
Github user maneesha-p commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/797#discussion_r56786342
  
    --- Diff: engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java ---
    @@ -1776,19 +1773,26 @@ private void orchestrateStorageMigration(final String vmUuid, final StoragePool
                     // If VM was cold migrated between clusters belonging to two different VMware DCs,
                     // unregister the VM from the source host and cleanup the associated VM files.
                     if (vm.getHypervisorType().equals(HypervisorType.VMware)) {
    +                    Long srcClusterId = null;
    +                    Long srcHostId = vm.getHostId() != null ? vm.getHostId() : vm.getLastHostId();
    +                    if (srcHostId != null) {
    +                        HostVO srcHost = _hostDao.findById(srcHostId);
    +                        srcClusterId = srcHost.getClusterId();
    +                    }
    +
                         final Long destClusterId = destPool.getClusterId();
                         if (srcClusterId != null && destClusterId != null && ! srcClusterId.equals(destClusterId)) {
                             final String srcDcName = _clusterDetailsDao.getVmwareDcName(srcClusterId);
                             final String destDcName = _clusterDetailsDao.getVmwareDcName(destClusterId);
                             if (srcDcName != null && destDcName != null && !srcDcName.equals(destDcName)) {
                                 s_logger.debug("Since VM's storage was successfully migrated across VMware Datacenters, unregistering VM: " + vm.getInstanceName() +
    -                                    " from source host: " + srcHost.getId());
    +                                    " from source host: " + srcHostId);
                                 final UnregisterVMCommand uvc = new UnregisterVMCommand(vm.getInstanceName());
                                 uvc.setCleanupVmFiles(true);
                                 try {
    -                                _agentMgr.send(srcHost.getId(), uvc);
    +                                _agentMgr.send(srcHostId, uvc);
                                 } catch (final Exception e) {
    -                                throw new CloudRuntimeException("Failed to unregister VM: " + vm.getInstanceName() + " from source host: " + srcHost.getId() +
    +                                throw new CloudRuntimeException("Failed to unregister VM: " + vm.getInstanceName() + " from source host: " + srcHostId +
    --- End diff --
    
    Thanks for pointing out.Updated.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-8829 : Consecutive cold migrat...

Posted by GabrielBrascher <gi...@git.apache.org>.
Github user GabrielBrascher commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/797#discussion_r53559299
  
    --- Diff: engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java ---
    @@ -1776,19 +1773,26 @@ private void orchestrateStorageMigration(final String vmUuid, final StoragePool
                     // If VM was cold migrated between clusters belonging to two different VMware DCs,
                     // unregister the VM from the source host and cleanup the associated VM files.
                     if (vm.getHypervisorType().equals(HypervisorType.VMware)) {
    +                    Long srcClusterId = null;
    +                    Long srcHostId = vm.getHostId() != null ? vm.getHostId() : vm.getLastHostId();
    +                    if (srcHostId != null) {
    +                        HostVO srcHost = _hostDao.findById(srcHostId);
    --- End diff --
    
    @alexandrelimassantana I don't see any problem with that **if** (line 1778). Both variables (**srcHostId** and **srcClusterId**) are used.
    
    The conditional at the line 1784 uses **srcClusterId**.
    
    The method at line 1793 sends the **UnregisterVMCommand** to a given host with the **srcHostId**.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---