You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/02/22 13:09:16 UTC

[GitHub] [cloudstack] ustcweizhou opened a new pull request #4534: Migrate vm across clusters

ustcweizhou opened a new pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534


   ### Description
   
   This PR adds a global setting migrate.vm.across.clusters to indicate whether vm can be live migrated to other clusters (with same hypervisor type), if all volumes are in zone-wide storage pool.
   
   If vm is running on the last host in a cluster and vm cannot be migrated to other clusters, put host to maintenance will fail.
   
   This is based on pr #4378 
   
   This fixes #3707 #3720 
   
   <!--- Describe your changes in DETAIL - And how has behaviour functionally changed. -->
   
   <!-- For new features, provide link to FS, dev ML discussion etc. -->
   <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. -->
   
   <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged -->
   <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
   <!-- Fixes: # -->
   
   <!--- ********************************************************************************* -->
   <!--- NOTE: AUTOMATATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. -->
   <!--- PLEASE PUT AN 'X' in only **ONE** box -->
   <!--- ********************************************************************************* -->
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [X] Bug fix (non-breaking change which fixes an issue)
   - [X] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [X] Major
   - [ ] Minor
   
   
   ### Screenshots (if appropriate):
   
   
   ### How Has This Been Tested?
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to -->
   <!-- see how your change affects other areas of the code, etc. -->
   
   
   <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/master/CONTRIBUTING.md) document -->
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-781935126


   @rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-781989477


   @rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-912214579


   @nvazquez a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-913632538


   @shwstppr great, thanks for testing !


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] nvazquez merged pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
nvazquez merged pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] shwstppr edited a comment on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
shwstppr edited a comment on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-750226719


   @blueorangutan package
   
   @weizhouapache is this ready for review/test?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-912524808


   <b>Trillian test result (tid-1954)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 33873 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4534-t1954-kvm-centos7.zip
   Smoke tests completed. 88 look OK, 1 have errors
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_02_list_snapshots_with_removed_data_store | `Error` | 51.48 | test_snapshots.py
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-782082037


   Packaging result: ✖centos7 ✔centos8 ✔debian. JID-2764


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-824716775


   > Ping @weizhouapache is this valid for 4.15, in terms of severity should this be considered for 4.15.1?
   
   @rhtyd it is more like a new feature, so targeted to master/4.16, not 4.15


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-781934759


   Re-ping @shwstppr for review
   @blueorangutan package


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache closed pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache closed pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-824709930


   Ping @weizhouapache is this valid for 4.15, in terms of severity should this be considered for 4.15.1?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-914340989


   @nvazquez a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-901962193


   @weizhouapache a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] shwstppr commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
shwstppr commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-766696826


   Based on branch name marked for 4.15.1.0


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-783411158


   Packaging result: ✔centos7 ✖centos8 ✔debian. JID-2786


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-904275309


   Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 983


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] shwstppr commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
shwstppr commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-780342455


   @weizhouapache sorry but this needs fixing conflicts again.
   Also, is the use-case here is allow cross-cluster migration when putting the last host in maintenance. As we added some improvements for cross-cluster cross-pod VM migration with #4385 but they were largely for VMware.
   Since VMware would allow cross-cluster migration even with cluster scoped pools with vmotion do we need to mention the new global setting is not for VMware


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-766815988


   > @ustcweizhou I guess this will need changes in new UI now
   > I've not tested yet but cross-cluster migration could result in failure when there are only cluster-scoped primary stores so do we handle that? In case of VMware this could fail even with vMotion enabled with current master something that has been changed in #4385
   
   @shwstppr it is addressed in this pr.  if vm has volumes on cluster-wide storage, migrate will fail.
   migraiton is possible only if
   (1) all volumes are on zone-wide storage
   (2) source cluster and dest cluster have same hypervisor type.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-781989975


   @rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-901962971


   @weizhouapache a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-913420299


   @weizhouapache a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-913413931


   Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 1136


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-901867244


   Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 936


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] shwstppr commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
shwstppr commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-766694809


   @ustcweizhou I guess this will need changes in new UI now
   I've not tested yet but cross-cluster migration could result in failure when there are only cluster-scoped primary stores so do we handle that? In case of VMware this could fail even with vMotion enabled with current master something that has been changed in #4385 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] sureshanaparti commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
sureshanaparti commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-867608796


   Hi @ustcweizhou can you please resolve the conflicts.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-825443913


   Thanks @weizhouapache - this was regards to https://github.com/apache/cloudstack/issues/3720 which is logged as a bug which this PR claims to fix.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache closed pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache closed pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] nvazquez commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
nvazquez commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-904264792


   @blueorangutan package


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-901962283


   @blueorangutan test


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-902340782


   <b>Trillian test result (tid-1726)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 33825 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4534-t1726-kvm-centos7.zip
   Smoke tests completed. 89 look OK, 0 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-914184392


   @weizhouapache a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-912543083


   <b>Trillian test result (tid-1956)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 35227 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4534-t1956-kvm-centos7.zip
   Smoke tests completed. 89 look OK, 0 have errors
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] nvazquez commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
nvazquez commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-903390126


   @weizhouapache can you please fix the conflicts? Is it ready for review?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] shwstppr commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
shwstppr commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-766694809






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-914183862


   @blueorangutan package


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] shwstppr commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
shwstppr commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-750226719


   @blueorangutan package
   
   @weizhouapache is this ready?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-783381700


   > sorry but this needs fixing conflicts again.
   > Also, is the use-case here is allow cross-cluster migration when putting the last host in maintenance. As we added some improvements for cross-cluster cross-pod VM migration with #4385 but they were largely for VMware.
   > Since VMware would allow cross-cluster migration even with cluster scoped pools with vmotion do we need to mention the new global setting is not for VMware
   
   @shwstppr 
   I had a quick view on #4385, it looks that it migrates vms with a storageid.
   this pr should not break the feature as this changes the behavior when hostid is passed or storageid is not passed.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-750228191


   @shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-901914891


   Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 937


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] soreana edited a comment on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
soreana edited a comment on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-888109850


   @ustcweizhou should we take care of changes for this pr?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-888123495


   > @ustcweizhou should we take care of changes for this pr?
   
   @soreana #4378 is not merged yet.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-904265167


   @nvazquez a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-868496023


   > Hi @ustcweizhou can you please resolve the conflicts.
   
   @sureshanaparti 
   This is based on pr #4378
   I will rebase when #4378 is merged.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache closed pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache closed pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] soreana commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
soreana commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-903541412


   @nvazquez I've fixed the conflict. It is ready for review.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-912196255


   Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 1118


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-750296313


   Packaging result: ✔centos7 ✔centos8 ✔debian. JID-2513


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-783371380


   @shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache edited a comment on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache edited a comment on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-783381700


   > sorry but this needs fixing conflicts again.
   > Also, is the use-case here is allow cross-cluster migration when putting the last host in maintenance. As we added some improvements for cross-cluster cross-pod VM migration with #4385 but they were largely for VMware.
   > Since VMware would allow cross-cluster migration even with cluster scoped pools with vmotion do we need to mention the new global setting is not for VMware
   
   @shwstppr 
   I had a quick view on #4385, it looks that it migrates vms with a storageid.
   this pr should not break the feature as this changes the behavior if storageid is not passed.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-914209182


   Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 1148


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-914717486


   <b>Trillian test result (tid-1981)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 33813 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4534-t1981-kvm-centos7.zip
   Smoke tests completed. 89 look OK, 0 have errors
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-901890319


   @blueorangutan package


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-912532071


   <b>Trillian test result (tid-1955)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 34220 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4534-t1955-kvm-centos7.zip
   Smoke tests completed. 89 look OK, 0 have errors
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] soreana commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
soreana commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-888127470


   @weizhouapache I see. Let me know if you need an extra hands :)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] soreana commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
soreana commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-888109850


   @ustcweizhou should we take care of this?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-902345878


   <b>Trillian test result (tid-1727)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 34481 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4534-t1727-kvm-centos7.zip
   Intermittent failure detected: /marvin/tests/smoke/test_snapshots.py
   Smoke tests completed. 88 look OK, 1 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_02_list_snapshots_with_removed_data_store | `Error` | 53.72 | test_snapshots.py
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-913454193


   <b>Trillian Build Failed (tid-1969)<b/>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] nvazquez commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
nvazquez commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-912177236


   @blueorangutan package


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache commented on a change in pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on a change in pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#discussion_r702888757



##########
File path: server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
##########
@@ -1345,6 +1353,37 @@ private boolean doMaintain(final long hostId) {
         return true;
     }
 
+    private boolean isClusterWideMigrationPossible(Host host, List<VMInstanceVO> vms, List<HostVO> hosts) {
+        if (MIGRATE_VM_ACROSS_CLUSTERS.valueIn(host.getDataCenterId())) {
+            s_logger.info("Looking for hosts across different clusters in zone: " + host.getDataCenterId());
+            Long podId = null;
+            for (final VMInstanceVO vm : vms) {
+                if (VirtualMachine.systemVMs.contains(vm.getType())) {
+                    // SystemVMs can only be migrated to same pod
+                    podId = host.getPodId();
+                    break;
+                }
+            }
+            hosts.addAll(listAllUpAndEnabledHosts(Host.Type.Routing, null, podId, host.getDataCenterId()));
+            if (CollectionUtils.isEmpty(hosts)) {
+                s_logger.warn("Unable to find a host for vm migration in zone: " + host.getDataCenterId());
+                return false;
+            }
+            s_logger.info("Found hosts in the zone for vm migration: " + hosts);
+            // Don't migrate vm if it has volumes on cluster-wide pool
+            for (final VMInstanceVO vm : vms) {
+                if (! HypervisorType.VMware.equals(host.getHypervisorType()) && _vmMgr.checkIfVmHasClusterWideVolumes(vm.getId())) {
+                    s_logger.warn(String.format("VM %s cannot be migrated across cluster as it has volumes on cluster-wide pool", vm));
+                    return false;
+                }
+            }

Review comment:
       @shwstppr 
   moved the hypervisor type check.
   
   I have considered the order of checks. in my opinion, the checks of vm volumes have more db queries than listAllUpAndEnabledHosts so I put the check prior to volume pool check.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] shwstppr commented on a change in pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
shwstppr commented on a change in pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#discussion_r701628352



##########
File path: server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
##########
@@ -1336,6 +1344,28 @@ private boolean doMaintain(final long hostId) {
         return true;
     }
 
+    private boolean isClusterWideMigrationSupported(Host host, List<VMInstanceVO> vms, List<HostVO> hosts) {

Review comment:
       Are you deliberately trying to change `hosts` arg here to have the new list available to the caller?

##########
File path: server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
##########
@@ -1306,7 +1307,14 @@ private boolean doMaintain(final long hostId) {
                 return true;
             }
 
-            final List<HostVO> hosts = listAllUpAndEnabledHosts(Host.Type.Routing, host.getClusterId(), host.getPodId(), host.getDataCenterId());
+            List<HostVO> hosts = listAllUpAndEnabledHosts(Host.Type.Routing, host.getClusterId(), host.getPodId(), host.getDataCenterId());
+            if (hosts == null || hosts.isEmpty()) {
+                s_logger.warn("Unable to find a host for vm migration in cluster: " + host.getClusterId());
+                if (! isClusterWideMigrationSupported(host, vms, hosts)) {
+                    return false;
+                }
+            }
+
             for (final VMInstanceVO vm : vms) {
                 if (hosts == null || hosts.isEmpty() || !answer.getMigrate()

Review comment:
       @weizhouapache do we need to re-list `hosts` here for getting hosts from other clusters else VM will be stopped instead of migration.
   
   I've tested on KVM with one host each in two different clusters and the VM just stops and doesn't migrate. Global setting was set to true.
   
   I was able to get it working with some changes though
   ```
   diff --git a/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java b/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
   index 6a4509cefb..ef3585650a 100755
   --- a/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
   +++ b/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
   @@ -33,18 +33,6 @@ import java.util.Random;
    import javax.inject.Inject;
    import javax.naming.ConfigurationException;
    
   -import com.cloud.deploy.DataCenterDeployment;
   -import com.cloud.deploy.DeployDestination;
   -import com.cloud.deploy.DeploymentPlanner;
   -import com.cloud.deploy.DeploymentPlanningManager;
   -import com.cloud.exception.InsufficientServerCapacityException;
   -import com.cloud.exception.ResourceUnavailableException;
   -import com.cloud.service.ServiceOfferingVO;
   -import com.cloud.service.dao.ServiceOfferingDao;
   -import com.cloud.storage.dao.DiskOfferingDao;
   -import com.cloud.vm.UserVmManager;
   -import com.cloud.vm.VirtualMachineProfile;
   -import com.cloud.vm.VirtualMachineProfileImpl;
    import org.apache.cloudstack.api.ApiConstants;
    import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
    import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
   @@ -53,12 +41,11 @@ import org.apache.cloudstack.api.command.admin.host.AddHostCmd;
    import org.apache.cloudstack.api.command.admin.host.AddSecondaryStorageCmd;
    import org.apache.cloudstack.api.command.admin.host.CancelHostAsDegradedCmd;
    import org.apache.cloudstack.api.command.admin.host.CancelMaintenanceCmd;
   -import org.apache.cloudstack.api.command.admin.host.PrepareForMaintenanceCmd;
    import org.apache.cloudstack.api.command.admin.host.DeclareHostAsDegradedCmd;
   +import org.apache.cloudstack.api.command.admin.host.PrepareForMaintenanceCmd;
    import org.apache.cloudstack.api.command.admin.host.ReconnectHostCmd;
    import org.apache.cloudstack.api.command.admin.host.UpdateHostCmd;
    import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
   -
    import org.apache.cloudstack.context.CallContext;
    import org.apache.cloudstack.framework.config.ConfigKey;
    import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
   @@ -113,6 +100,10 @@ import com.cloud.dc.dao.DataCenterDao;
    import com.cloud.dc.dao.DataCenterIpAddressDao;
    import com.cloud.dc.dao.DedicatedResourceDao;
    import com.cloud.dc.dao.HostPodDao;
   +import com.cloud.deploy.DataCenterDeployment;
   +import com.cloud.deploy.DeployDestination;
   +import com.cloud.deploy.DeploymentPlanner;
   +import com.cloud.deploy.DeploymentPlanningManager;
    import com.cloud.deploy.PlannerHostReservationVO;
    import com.cloud.deploy.dao.PlannerHostReservationDao;
    import com.cloud.event.ActionEvent;
   @@ -121,9 +112,11 @@ import com.cloud.event.EventTypes;
    import com.cloud.event.EventVO;
    import com.cloud.exception.AgentUnavailableException;
    import com.cloud.exception.DiscoveryException;
   +import com.cloud.exception.InsufficientServerCapacityException;
    import com.cloud.exception.InvalidParameterValueException;
    import com.cloud.exception.PermissionDeniedException;
    import com.cloud.exception.ResourceInUseException;
   +import com.cloud.exception.ResourceUnavailableException;
    import com.cloud.gpu.GPU;
    import com.cloud.gpu.HostGpuGroupsVO;
    import com.cloud.gpu.VGPUTypesVO;
   @@ -150,6 +143,8 @@ import com.cloud.org.Cluster;
    import com.cloud.org.Grouping;
    import com.cloud.org.Managed;
    import com.cloud.serializer.GsonHelper;
   +import com.cloud.service.ServiceOfferingVO;
   +import com.cloud.service.dao.ServiceOfferingDao;
    import com.cloud.service.dao.ServiceOfferingDetailsDao;
    import com.cloud.storage.GuestOSCategoryVO;
    import com.cloud.storage.StorageManager;
   @@ -158,6 +153,7 @@ import com.cloud.storage.StoragePoolHostVO;
    import com.cloud.storage.StoragePoolStatus;
    import com.cloud.storage.StorageService;
    import com.cloud.storage.VMTemplateVO;
   +import com.cloud.storage.dao.DiskOfferingDao;
    import com.cloud.storage.dao.GuestOSCategoryDao;
    import com.cloud.storage.dao.StoragePoolHostDao;
    import com.cloud.storage.dao.VMTemplateDao;
   @@ -189,10 +185,13 @@ import com.cloud.utils.net.Ip;
    import com.cloud.utils.net.NetUtils;
    import com.cloud.utils.ssh.SSHCmdHelper;
    import com.cloud.utils.ssh.SshException;
   +import com.cloud.vm.UserVmManager;
    import com.cloud.vm.VMInstanceVO;
    import com.cloud.vm.VirtualMachine;
    import com.cloud.vm.VirtualMachine.State;
    import com.cloud.vm.VirtualMachineManager;
   +import com.cloud.vm.VirtualMachineProfile;
   +import com.cloud.vm.VirtualMachineProfileImpl;
    import com.cloud.vm.VmDetailConstants;
    import com.cloud.vm.dao.UserVmDetailsDao;
    import com.cloud.vm.dao.VMInstanceDao;
   @@ -1307,12 +1306,18 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
                    return true;
                }
    
   -            List<HostVO> hosts = listAllUpAndEnabledHosts(Host.Type.Routing, host.getClusterId(), host.getPodId(), host.getDataCenterId());
   -            if (hosts == null || hosts.isEmpty()) {
   -                s_logger.warn("Unable to find a host for vm migration in cluster: " + host.getClusterId());
   -                if (! isClusterWideMigrationSupported(host, vms, hosts)) {
   -                    return false;
   -                }
   +
   +            List<HostVO> hosts;
   +            Long clusterId = null;
   +            if (isClusterWideMigrationPossible(host.getDataCenterId(), vms)) {
   +                s_logger.info(String.format("Looking for hosts for VM migration across different clusters in pod ID: %d", host.getPodId()));
   +            } else {
   +                clusterId = host.getClusterId();
   +                s_logger.info(String.format("Looking for hosts for VM migration in cluster ID: %d", clusterId));
   +            }
   +            hosts = listAllUpAndEnabledHosts(Host.Type.Routing, clusterId, host.getPodId(), host.getDataCenterId());
   +            if (CollectionUtils.isEmpty(hosts)) {
   +                s_logger.warn(String.format("Unable to find a host for VM migration away from host: %s", host));
                }
    
                for (final VMInstanceVO vm : vms) {
   @@ -1344,23 +1349,17 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
            return true;
        }
    
   -    private boolean isClusterWideMigrationSupported(Host host, List<VMInstanceVO> vms, List<HostVO> hosts) {
   -        if (MIGRATE_VM_ACROSS_CLUSTERS.valueIn(host.getDataCenterId())) {
   -            s_logger.info("Looking for hosts across different clusters in zone: " + host.getDataCenterId());
   -            hosts = listAllUpAndEnabledHosts(Host.Type.Routing, null, null, host.getDataCenterId());
   -            if (hosts == null || hosts.isEmpty()) {
   -                s_logger.warn("Unable to find a host for vm migration in zone: " + host.getDataCenterId());
   -                return false;
   -            }
   -            // Dont migrate vm if it has volumes on cluster-wide pool
   +    private boolean isClusterWideMigrationPossible(long zoneId, List<VMInstanceVO> vms) {
   +        if (MIGRATE_VM_ACROSS_CLUSTERS.valueIn(zoneId)) {
   +            // Don't migrate vm if it has volumes on cluster-wide pool
                for (final VMInstanceVO vm : vms) {
                    if (_vmMgr.checkIfVmHasClusterWideVolumes(vm.getId())) {
   -                    s_logger.warn("Unable to migrate vm " + vm.getInstanceName() + " as it has volumes on cluster-wide pool");
   +                    s_logger.warn(String.format("VM %s cannot be migrated across cluster as it has volumes on cluster-wide pool", vm));
                        return false;
                    }
                }
            } else {
   -            s_logger.warn("Not migrating VM across cluster since " + MIGRATE_VM_ACROSS_CLUSTERS.key() + " is false");
   +            s_logger.warn(String.format("VMs cannot be migrated across cluster since %s is false for zone ID: %d", MIGRATE_VM_ACROSS_CLUSTERS.key(), zoneId));
                return false;
            }
            return true;
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] DaanHoogland commented on a change in pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on a change in pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#discussion_r541026313



##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -5812,7 +5814,7 @@ public VirtualMachine migrateVirtualMachine(Long vmId, Host destinationHost) thr
 
         // If no suitable destination found then throw exception
         if (dest == null) {
-            throw new RuntimeException("Unable to find suitable destination to migrate VM " + vm.getInstanceName());
+            throw new CloudRuntimeException("Unable to find suitable destination to migrate VM " + vm.getInstanceName());

Review comment:
       👍 

##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -5787,6 +5789,50 @@ public VirtualMachine migrateVirtualMachine(Long vmId, Host destinationHost) thr
 
         // check if migrating to same host
         long srcHostId = vm.getHostId();
+
+        DeployDestination dest = null;
+        if (destinationHost == null) {
+            vm.setLastHostId(null); // Do not check last host
+            final VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
+            final Host host = _hostDao.findById(srcHostId);
+            final DataCenterDeployment plan = new DataCenterDeployment(host.getDataCenterId(), null, null, null, null, null);
+            ExcludeList excludes = new ExcludeList();
+            excludes.addHost(srcHostId);
+            try {
+                dest = _planningMgr.planDeployment(profile, plan, excludes, null);
+            } catch (final AffinityConflictException e2) {
+                s_logger.warn("Unable to create deployment, affinity rules associted to the VM conflict", e2);
+                throw new CloudRuntimeException("Unable to create deployment, affinity rules associted to the VM conflict");
+            } catch (final InsufficientServerCapacityException e3) {
+                throw new CloudRuntimeException("Unable to find a server to migrate the vm to");
+            }
+        } else {
+            dest = checkVmMigrationDestination(vm, srcHostId, destinationHost);
+        }
+
+        // If no suitable destination found then throw exception
+        if (dest == null) {
+            throw new RuntimeException("Unable to find suitable destination to migrate VM " + vm.getInstanceName());
+        }
+
+        UserVmVO uservm = _vmDao.findById(vmId);
+        if (uservm != null) {
+            collectVmDiskStatistics(uservm);
+            collectVmNetworkStatistics(uservm);
+        }
+        _itMgr.migrate(vm.getUuid(), srcHostId, dest);
+        VMInstanceVO vmInstance = _vmInstanceDao.findById(vmId);
+        if (vmInstance.getType().equals(VirtualMachine.Type.User)) {
+            return _vmDao.findById(vmId);
+        } else {
+            return vmInstance;
+        }

Review comment:
       I know i sound like a broken record , but I see four methods here. Can you extract these pieces of code please?

##########
File path: server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
##########
@@ -1262,7 +1263,29 @@ private boolean doMaintain(final long hostId) {
                 return true;
             }
 
-            final List<HostVO> hosts = listAllUpAndEnabledHosts(Host.Type.Routing, host.getClusterId(), host.getPodId(), host.getDataCenterId());
+            List<HostVO> hosts = listAllUpAndEnabledHosts(Host.Type.Routing, host.getClusterId(), host.getPodId(), host.getDataCenterId());
+            if (hosts == null || hosts.isEmpty()) {
+                s_logger.warn("Unable to find a host for vm migration in cluster: " + host.getClusterId());
+                if (MIGRATE_VM_ACROSS_CLUSTERS.value()) {
+                    s_logger.info("Looking for hosts across different clusters in zone: " + host.getDataCenterId());
+                    hosts = listAllUpAndEnabledHosts(Host.Type.Routing, null, null, host.getDataCenterId());
+                    if (hosts == null || hosts.isEmpty()) {
+                        s_logger.warn("Unable to find a host for vm migration in zone: " + host.getDataCenterId());
+                        return false;
+                    }
+                    // Dont migrate vm if it has volumes on cluster-wide pool
+                    for (final VMInstanceVO vm : vms) {
+                        if (_vmMgr.checkIfVmHasClusterWideVolumes(vm.getId())) {
+                            s_logger.warn("Unable to migrate vm " + vm.getInstanceName() + " as it has volumes on cluster-wide pool");
+                            return false;
+                        }
+                    }
+                } else {
+                    s_logger.warn("Not migrating VM across cluster since " + MIGRATE_VM_ACROSS_CLUSTERS.key() + " is false");
+                    return false;
+                }
+            }

Review comment:
       sugestion:
   `if (! clusterWideMigrationSupported(...)) return false;`
   and extract this code to
   `boolean clusterWideMigrationSupported(...)`

##########
File path: engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
##########
@@ -3268,6 +3226,22 @@ public boolean checkIfVmHasClusterWideVolumes(Long vmId) {
 
     }
 
+    private DataCenterDeployment getMigrationDeployment(final Long vmId, final Host host, final Long poolId, final ExcludeList excludes) {
+        if (MIGRATE_VM_ACROSS_CLUSTERS.value() && !checkIfVmHasClusterWideVolumes(vmId)) {
+            s_logger.info("Searching for hosts in the zone for vm migration");
+            List<Long> clustersToExcluded = _clusterDao.listAllClusters(host.getDataCenterId());

Review comment:
       sugest you name this `clustersToExclude` without the d on the end




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-912177544


   @nvazquez a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-767578602


   @DaanHoogland 
   this is an improvement so I changed the destination to master.
   
   made some changes as your comments.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-913387479






-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache closed pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache closed pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] nvazquez commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
nvazquez commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-914340308


   @blueorangutan test


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache closed pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache closed pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-781988245


   @blueorangutan package


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-766815988


   > @ustcweizhou I guess this will need changes in new UI now
   > I've not tested yet but cross-cluster migration could result in failure when there are only cluster-scoped primary stores so do we handle that? In case of VMware this could fail even with vMotion enabled with current master something that has been changed in #4385
   
   @shwstppr it is addressed in this pr.  if vm has volumes on cluster-wide storage, migrate will fail.
   migraiton is possible only if
   (1) all volumes are on zone-wide storage
   (2) source cluster and dest cluster have same hypervisor type.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-913419970


   @blueorangutan test


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-901843600


   @weizhouapache a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-901843232


   @blueorangutan package


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-901961952


   @blueorangutan test


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-913388109


   @weizhouapache a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] shwstppr commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
shwstppr commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-783370910


   @blueorangutan package


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-781984629


   Packaging result: ✖centos7 ✔centos8 ✖debian. JID-2749


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] shwstppr commented on a change in pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
shwstppr commented on a change in pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#discussion_r701565289



##########
File path: server/src/main/java/com/cloud/deploy/FirstFitPlanner.java
##########
@@ -441,7 +441,22 @@ protected void removeClustersCrossingThreshold(List<Long> clusterListForVmAlloca
         return podIdsByCapacity;
     }
 
-    protected Pair<List<Long>, Map<Long, Double>> listClustersByCapacity(long id, int requiredCpu, long requiredRam, ExcludeList avoid, boolean isZone) {
+    private List<Long> listDisabledClusters(long zoneId, Long podId) {
+        List<Long> disabledClusters = clusterDao.listDisabledClusters(zoneId, podId);
+        if (podId == null) {
+            //list all disabled clusters under this zone + clusters under any disabled pod of this zone
+            List<Long> clustersWithDisabledPods = clusterDao.listClustersWithDisabledPods(zoneId);
+            disabledClusters.addAll(clustersWithDisabledPods);
+        }
+        return disabledClusters;
+    }
+
+    private List<Long> listDisabledPods(long zoneId) {
+        List<Long> disabledPods = podDao.listDisabledPods(zoneId);
+        return disabledPods;
+    }

Review comment:
       @weizhouapache these methods are not used?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] weizhouapache commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-913508858


   @blueorangutan test
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] nvazquez commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
nvazquez commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-912213452


   @blueorangutan test


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-901890961


   @weizhouapache a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#issuecomment-912562211


   <b>Trillian test result (tid-1957)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 36874 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4534-t1957-kvm-centos7.zip
   Smoke tests completed. 88 look OK, 1 have errors
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_disable_oobm_ha_state_ineligible | `Error` | 1511.66 | test_hostha_kvm.py
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] shwstppr commented on a change in pull request #4534: Migrate vm across clusters

Posted by GitBox <gi...@apache.org>.
shwstppr commented on a change in pull request #4534:
URL: https://github.com/apache/cloudstack/pull/4534#discussion_r702809034



##########
File path: server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
##########
@@ -1345,6 +1353,37 @@ private boolean doMaintain(final long hostId) {
         return true;
     }
 
+    private boolean isClusterWideMigrationPossible(Host host, List<VMInstanceVO> vms, List<HostVO> hosts) {
+        if (MIGRATE_VM_ACROSS_CLUSTERS.valueIn(host.getDataCenterId())) {
+            s_logger.info("Looking for hosts across different clusters in zone: " + host.getDataCenterId());
+            Long podId = null;
+            for (final VMInstanceVO vm : vms) {
+                if (VirtualMachine.systemVMs.contains(vm.getType())) {
+                    // SystemVMs can only be migrated to same pod
+                    podId = host.getPodId();
+                    break;
+                }
+            }
+            hosts.addAll(listAllUpAndEnabledHosts(Host.Type.Routing, null, podId, host.getDataCenterId()));
+            if (CollectionUtils.isEmpty(hosts)) {
+                s_logger.warn("Unable to find a host for vm migration in zone: " + host.getDataCenterId());
+                return false;
+            }
+            s_logger.info("Found hosts in the zone for vm migration: " + hosts);
+            // Don't migrate vm if it has volumes on cluster-wide pool
+            for (final VMInstanceVO vm : vms) {
+                if (! HypervisorType.VMware.equals(host.getHypervisorType()) && _vmMgr.checkIfVmHasClusterWideVolumes(vm.getId())) {
+                    s_logger.warn(String.format("VM %s cannot be migrated across cluster as it has volumes on cluster-wide pool", vm));
+                    return false;
+                }
+            }

Review comment:
       Minor nit: this block can be moved to start of `if` to fail early




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org