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/05/18 09:01:26 UTC

[GitHub] [cloudstack] slavkap opened a new pull request #5029: Prevent NPE if hypervisor's capabilities are null

slavkap opened a new pull request #5029:
URL: https://github.com/apache/cloudstack/pull/5029


   ### Description
   
   If the hypervisor's capabilities are null, CloudRuntimeException will be thrown;
   Format the error message
   
   ### 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)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [X] Minor
   - [ ] Trivial
   
   ### How Has This Been Tested?
   tested on CS 4.15.1.0 with KVM hypervisors
   


-- 
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 #5029: Prevent NPE if hypervisor's capabilities are null

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


   <b>Trillian test result (tid-705)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 105468 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5029-t705-kvm-centos7.zip
   Intermittent failure detected: /marvin/tests/smoke/test_accounts.py
   Intermittent failure detected: /marvin/tests/smoke/test_affinity_groups_projects.py
   Intermittent failure detected: /marvin/tests/smoke/test_async_job.py
   Intermittent failure detected: /marvin/tests/smoke/test_deploy_virtio_scsi_vm.py
   Intermittent failure detected: /marvin/tests/smoke/test_deploy_vm_iso.py
   Intermittent failure detected: /marvin/tests/smoke/test_deploy_vms_with_varied_deploymentplanners.py
   Intermittent failure detected: /marvin/tests/smoke/test_deploy_vm_with_userdata.py
   Intermittent failure detected: /marvin/tests/smoke/test_diagnostics.py
   Intermittent failure detected: /marvin/tests/smoke/test_domain_service_offerings.py
   Intermittent failure detected: /marvin/tests/smoke/test_internal_lb.py
   Intermittent failure detected: /marvin/tests/smoke/test_iso.py
   Intermittent failure detected: /marvin/tests/smoke/test_kubernetes_clusters.py
   Intermittent failure detected: /marvin/tests/smoke/test_kubernetes_supported_versions.py
   Intermittent failure detected: /marvin/tests/smoke/test_list_ids_parameter.py
   Intermittent failure detected: /marvin/tests/smoke/test_loadbalance.py
   Intermittent failure detected: /marvin/tests/smoke/test_metrics_api.py
   Intermittent failure detected: /marvin/tests/smoke/test_multipleips_per_nic.py
   Intermittent failure detected: /marvin/tests/smoke/test_nested_virtualization.py
   Intermittent failure detected: /marvin/tests/smoke/test_network_acl.py
   Intermittent failure detected: /marvin/tests/smoke/test_network.py
   Intermittent failure detected: /marvin/tests/smoke/test_nic_adapter_type.py
   Intermittent failure detected: /marvin/tests/smoke/test_password_server.py
   Intermittent failure detected: /marvin/tests/smoke/test_portforwardingrules.py
   Intermittent failure detected: /marvin/tests/smoke/test_privategw_acl.py
   Intermittent failure detected: /marvin/tests/smoke/test_projects.py
   Intermittent failure detected: /marvin/tests/smoke/test_routers_network_ops.py
   Intermittent failure detected: /marvin/tests/smoke/test_ssvm.py
   Intermittent failure detected: /marvin/tests/smoke/test_vpc_redundant.py
   Smoke tests completed. 60 look OK, 27 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   ContextSuite context=TestAccounts>:setup | `Error` | 0.00 | test_accounts.py
   ContextSuite context=TestAddVmToSubDomain>:setup | `Error` | 0.00 | test_accounts.py
   test_DeleteDomain | `Error` | 0.74 | test_accounts.py
   test_forceDeleteDomain | `Failure` | 0.76 | test_accounts.py
   test_forceDeleteDomain | `Error` | 2.87 | test_accounts.py
   ContextSuite context=TestRemoveUserFromAccount>:setup | `Error` | 4.95 | test_accounts.py
   ContextSuite context=TestDomainsServiceOfferings>:setup | `Error` | 1529.35 | test_domain_service_offerings.py
   ContextSuite context=TestInternalLb>:setup | `Error` | 0.00 | test_internal_lb.py
   ContextSuite context=TestDeployVmWithAffinityGroup>:setup | `Error` | 0.00 | test_affinity_groups_projects.py
   test_01_create_iso_with_checksum_sha1 | `Error` | 65.31 | test_iso.py
   test_02_create_iso_with_checksum_sha256 | `Error` | 65.31 | test_iso.py
   test_03_create_iso_with_checksum_md5 | `Error` | 65.33 | test_iso.py
   test_04_create_iso_with_no_checksum | `Error` | 65.33 | test_iso.py
   test_01_create_iso | `Failure` | 1510.99 | test_iso.py
   ContextSuite context=TestISO>:setup | `Error` | 3023.09 | test_iso.py
   ContextSuite context=TestAsyncJob>:setup | `Error` | 0.00 | test_async_job.py
   ContextSuite context=TestLoadBalance>:setup | `Error` | 0.00 | test_loadbalance.py
   ContextSuite context=TestDeployVirtioSCSIVM>:setup | `Error` | 0.00 | test_deploy_virtio_scsi_vm.py
   test_list_clusters_metrics | `Error` | 1512.83 | test_metrics_api.py
   test_list_vms_metrics | `Error` | 0.11 | test_metrics_api.py
   ContextSuite context=TestDeployVMFromISO>:setup | `Error` | 0.00 | test_deploy_vm_iso.py
   ContextSuite context=TestDeployVmWithVariedPlanners>:setup | `Error` | 0.00 | test_deploy_vms_with_varied_deploymentplanners.py
   ContextSuite context=TestNetworkACL>:setup | `Error` | 0.00 | test_network_acl.py
   ContextSuite context=TestDeployVmWithUserData>:setup | `Error` | 0.00 | test_deploy_vm_with_userdata.py
   ContextSuite context=TestRemoteDiagnostics>:setup | `Error` | 0.00 | test_diagnostics.py
   test_delete_account | `Error` | 1512.56 | test_network.py
   test_delete_network_while_vm_on_it | `Error` | 0.05 | test_network.py
   test_deploy_vm_l2network | `Error` | 0.04 | test_network.py
   test_l2network_restart | `Error` | 1.11 | test_network.py
   ContextSuite context=TestPortForwarding>:setup | `Error` | 3.31 | test_network.py
   ContextSuite context=TestPublicIP>:setup | `Error` | 0.93 | test_network.py
   test_reboot_router | `Error` | 0.04 | test_network.py
   test_releaseIP | `Error` | 0.40 | test_network.py
   ContextSuite context=TestRouterRules>:setup | `Error` | 0.45 | test_network.py
   ContextSuite context=TestAdapterTypeForNic>:setup | `Error` | 0.00 | test_nic_adapter_type.py
   test_01_invalid_upgrade_kubernetes_cluster | `Failure` | 0.01 | test_kubernetes_clusters.py
   test_02_deploy_and_upgrade_kubernetes_cluster | `Failure` | 0.00 | test_kubernetes_clusters.py
   test_03_deploy_and_scale_kubernetes_cluster | `Failure` | 0.00 | test_kubernetes_clusters.py
   test_04_basic_lifecycle_kubernetes_cluster | `Failure` | 0.00 | test_kubernetes_clusters.py
   test_05_delete_kubernetes_cluster | `Failure` | 0.00 | test_kubernetes_clusters.py
   test_06_deploy_invalid_kubernetes_ha_cluster | `Failure` | 0.00 | test_kubernetes_clusters.py
   test_07_deploy_kubernetes_ha_cluster | `Failure` | 0.00 | test_kubernetes_clusters.py
   test_08_deploy_and_upgrade_kubernetes_ha_cluster | `Failure` | 0.00 | test_kubernetes_clusters.py
   test_09_delete_kubernetes_ha_cluster | `Failure` | 0.00 | test_kubernetes_clusters.py
   test_01_add_delete_kubernetes_supported_version | `Error` | 60.58 | test_kubernetes_supported_versions.py
   ContextSuite context=TestListIdsParams>:setup | `Error` | 0.00 | test_list_ids_parameter.py
   test_nic_secondaryip_add_remove | `Error` | 1511.70 | test_multipleips_per_nic.py
   ContextSuite context=TestNestedVirtualization>:setup | `Error` | 0.00 | test_nested_virtualization.py
   ContextSuite context=TestIsolatedNetworksPasswdServer>:setup | `Error` | 0.00 | test_password_server.py
   ContextSuite context=TestPortForwardingRules>:setup | `Error` | 0.00 | test_portforwardingrules.py
   ContextSuite context=TestPrivateGwACL>:setup | `Error` | 0.00 | test_privategw_acl.py
   ContextSuite context=TestProjectSuspendActivate>:setup | `Error` | 1520.34 | test_projects.py
   test_02_RVR_Network_FW_PF_SSH_default_routes_egress_false | `Failure` | 303.90 | test_routers_network_ops.py
   test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL | `Failure` | 490.63 | test_vpc_redundant.py
   test_03_create_redundant_VPC_1tier_2VMs_2IPs_2PF_ACL_reboot_routers | `Failure` | 420.21 | test_vpc_redundant.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.

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



[GitHub] [cloudstack] rhtyd commented on pull request #5029: Prevent NPE if hypervisor's capabilities are null

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


   @blueorangutan test centos7 vmware-67u3


-- 
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 #5029: Prevent NPE if hypervisor's capabilities are null

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


   Packaging result: :heavy_check_mark: centos7 :heavy_check_mark: centos8 :heavy_check_mark: debian. SL-JID 51


-- 
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] slavkap commented on a change in pull request #5029: Prevent NPE if hypervisor's capabilities are null

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



##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -6194,22 +6194,16 @@ public VirtualMachine migrateVirtualMachineWithVolume(Long vmId, Host destinatio
 
         HypervisorCapabilitiesVO capabilities = _hypervisorCapabilitiesDao.findByHypervisorTypeAndVersion(srcHost.getHypervisorType(), srcHost.getHypervisorVersion());
 
-        if (capabilities == null && HypervisorType.KVM.equals(srcHost.getHypervisorType())) {
-            List<HypervisorCapabilitiesVO> lstHypervisorCapabilities = _hypervisorCapabilitiesDao.listAllByHypervisorType(HypervisorType.KVM);
-
-            if (lstHypervisorCapabilities != null) {
-                for (HypervisorCapabilitiesVO hypervisorCapabilities : lstHypervisorCapabilities) {
-                    if (hypervisorCapabilities.isStorageMotionSupported()) {
-                        capabilities = hypervisorCapabilities;
-
-                        break;
-                    }
-                }
+        if (capabilities == null) {
+            if (!HypervisorType.KVM.equals(srcHost.getHypervisorType())) {
+                throw new CloudRuntimeException(String.format("Cannot migrate VM with storage, as the capabilities are not found for the hypervisor %s with version %s", srcHost.getHypervisorType(), srcHost.getHypervisorVersion()));
             }
-        }
+            List<HypervisorCapabilitiesVO> lstHypervisorCapabilities = _hypervisorCapabilitiesDao.listAllByHypervisorType(HypervisorType.KVM);
 
-        if (!capabilities.isStorageMotionSupported()) {
-            throw new CloudRuntimeException("Migration with storage isn't supported on hypervisor " + srcHost.getHypervisorType() + " of version " + srcHost.getHypervisorVersion());
+            capabilities = lstHypervisorCapabilities.stream().filter(hvCapabilities -> hvCapabilities.isStorageMotionSupported()).findAny()
+            .orElseThrow(() -> new CloudRuntimeException(String.format("Migration with storage isn't supported on hypervisor %s of version %s", srcHost.getHypervisorType(), srcHost.getHypervisorVersion())));

Review comment:
       @sureshanaparti, actually here  we have  2 cases in which exception could be thrown
   1 - if the `lstHypervisorCapabilities` is empty, then I could use your suggestion
   2 - if `!isStorageMotionSupported`, then the message should be left "Migration with storage isn't supported on hypervisor..."
   Should I think for a common message for both cases?




-- 
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 #5029: Prevent NPE if hypervisor's capabilities are null

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


   @rhtyd 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.

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



[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #5029: Prevent NPE if hypervisor's capabilities are null

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



##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -6194,22 +6194,16 @@ public VirtualMachine migrateVirtualMachineWithVolume(Long vmId, Host destinatio
 
         HypervisorCapabilitiesVO capabilities = _hypervisorCapabilitiesDao.findByHypervisorTypeAndVersion(srcHost.getHypervisorType(), srcHost.getHypervisorVersion());
 
-        if (capabilities == null && HypervisorType.KVM.equals(srcHost.getHypervisorType())) {
-            List<HypervisorCapabilitiesVO> lstHypervisorCapabilities = _hypervisorCapabilitiesDao.listAllByHypervisorType(HypervisorType.KVM);
-
-            if (lstHypervisorCapabilities != null) {
-                for (HypervisorCapabilitiesVO hypervisorCapabilities : lstHypervisorCapabilities) {
-                    if (hypervisorCapabilities.isStorageMotionSupported()) {
-                        capabilities = hypervisorCapabilities;
-
-                        break;
-                    }
-                }
+        if (capabilities == null) {
+            if (!HypervisorType.KVM.equals(srcHost.getHypervisorType())) {
+                throw new CloudRuntimeException(String.format("Cannot migrate VM with storage, as the capabilities are not found for the hypervisor %s with version %s", srcHost.getHypervisorType(), srcHost.getHypervisorVersion()));
             }
-        }
+            List<HypervisorCapabilitiesVO> lstHypervisorCapabilities = _hypervisorCapabilitiesDao.listAllByHypervisorType(HypervisorType.KVM);
 
-        if (!capabilities.isStorageMotionSupported()) {
-            throw new CloudRuntimeException("Migration with storage isn't supported on hypervisor " + srcHost.getHypervisorType() + " of version " + srcHost.getHypervisorVersion());
+            capabilities = lstHypervisorCapabilities.stream().filter(hvCapabilities -> hvCapabilities.isStorageMotionSupported()).findAny()
+            .orElseThrow(() -> new CloudRuntimeException(String.format("Migration with storage isn't supported on hypervisor %s of version %s", srcHost.getHypervisorType(), srcHost.getHypervisorVersion())));

Review comment:
       > @sureshanaparti, actually here we have 2 cases in which exception could be thrown
   > 1 - if the `lstHypervisorCapabilities` is empty, then I could use your suggestion
   > 2 - if `!isStorageMotionSupported`, then the message should be left "Migration with storage isn't supported on hypervisor..."
   > Should I think for a common message for both cases?
   
   @slavkap when `lstHypervisorCapabilities` (for KVM) is not empty, and any of the capabilities for KVM (other than that hypervisor version) are checked for storage motion support. If no such capabilities exists, then i think, still it means there are no capabilities for that hypervisor and version (and you can use the same message as the first one).




-- 
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] slavkap commented on pull request #5029: Prevent NPE if hypervisor's capabilities are null

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


   Hi @shwstppr, I saw the code in the master branch, and I don't think this change is needed because it won't fail. But if you want, I could refactor it.


-- 
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 pull request #5029: Prevent NPE if hypervisor's capabilities are null

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


   @slavkap Do you plan to add the fix/refactor this in master as well? Code there has been moved to `HypervisorCapabilitiesDaoImpl`


-- 
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 #5029: Prevent NPE if hypervisor's capabilities are null

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


   @rhtyd 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.

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



[GitHub] [cloudstack] slavkap commented on pull request #5029: Prevent NPE if hypervisor's capabilities are null

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


   > @slavkap Do you plan to add the fix/refactor this in master as well? Code there has been moved to HypervisorCapabilitiesDaoImpl
   
   @shwstppr, sorry I didn't check what happens in the master branch. I will check the changes there and will add a fix, but at the moment, I've got an issue with my master environment. I hope to fix it up to 1-2 days
   
   


-- 
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 a change in pull request #5029: Prevent NPE if hypervisor's capabilities are null

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



##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -6208,8 +6208,8 @@ public VirtualMachine migrateVirtualMachineWithVolume(Long vmId, Host destinatio
             }
         }
 
-        if (!capabilities.isStorageMotionSupported()) {
-            throw new CloudRuntimeException("Migration with storage isn't supported on hypervisor " + srcHost.getHypervisorType() + " of version " + srcHost.getHypervisorVersion());
+        if (capabilities == null || !capabilities.isStorageMotionSupported()) {

Review comment:
       @slavkap when capabilities == null, it might be better to throw relevant message, something like "Cannot migrate VM with storage, as the capabilities are not found for the hypervisor X with version 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] rhtyd commented on pull request #5029: Prevent NPE if hypervisor's capabilities are null

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


   @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] rhtyd commented on pull request #5029: Prevent NPE if hypervisor's capabilities are null

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


   @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.

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



[GitHub] [cloudstack] rhtyd commented on pull request #5029: Prevent NPE if hypervisor's capabilities are null

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


   @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.

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



[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #5029: Prevent NPE if hypervisor's capabilities are null

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



##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -6194,22 +6194,16 @@ public VirtualMachine migrateVirtualMachineWithVolume(Long vmId, Host destinatio
 
         HypervisorCapabilitiesVO capabilities = _hypervisorCapabilitiesDao.findByHypervisorTypeAndVersion(srcHost.getHypervisorType(), srcHost.getHypervisorVersion());
 
-        if (capabilities == null && HypervisorType.KVM.equals(srcHost.getHypervisorType())) {
-            List<HypervisorCapabilitiesVO> lstHypervisorCapabilities = _hypervisorCapabilitiesDao.listAllByHypervisorType(HypervisorType.KVM);
-
-            if (lstHypervisorCapabilities != null) {
-                for (HypervisorCapabilitiesVO hypervisorCapabilities : lstHypervisorCapabilities) {
-                    if (hypervisorCapabilities.isStorageMotionSupported()) {
-                        capabilities = hypervisorCapabilities;
-
-                        break;
-                    }
-                }
+        if (capabilities == null) {
+            if (!HypervisorType.KVM.equals(srcHost.getHypervisorType())) {
+                throw new CloudRuntimeException(String.format("Cannot migrate VM with storage, as the capabilities are not found for the hypervisor %s with version %s", srcHost.getHypervisorType(), srcHost.getHypervisorVersion()));
             }
-        }
+            List<HypervisorCapabilitiesVO> lstHypervisorCapabilities = _hypervisorCapabilitiesDao.listAllByHypervisorType(HypervisorType.KVM);
 
-        if (!capabilities.isStorageMotionSupported()) {
-            throw new CloudRuntimeException("Migration with storage isn't supported on hypervisor " + srcHost.getHypervisorType() + " of version " + srcHost.getHypervisorVersion());
+            capabilities = lstHypervisorCapabilities.stream().filter(hvCapabilities -> hvCapabilities.isStorageMotionSupported()).findAny()
+            .orElseThrow(() -> new CloudRuntimeException(String.format("Migration with storage isn't supported on hypervisor %s of version %s", srcHost.getHypervisorType(), srcHost.getHypervisorVersion())));

Review comment:
       @slavkap if no capabilities found here, throw the same exception as above.
   
   ```suggestion
               .orElseThrow(() -> new CloudRuntimeException(String.format("Cannot migrate VM with storage, as the capabilities are not found for the hypervisor %s with version %s", srcHost.getHypervisorType(), srcHost.getHypervisorVersion())));
   ```




-- 
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] slavkap commented on a change in pull request #5029: Prevent NPE if hypervisor's capabilities are null

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



##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -6208,8 +6208,8 @@ public VirtualMachine migrateVirtualMachineWithVolume(Long vmId, Host destinatio
             }
         }
 
-        if (!capabilities.isStorageMotionSupported()) {
-            throw new CloudRuntimeException("Migration with storage isn't supported on hypervisor " + srcHost.getHypervisorType() + " of version " + srcHost.getHypervisorVersion());
+        if (capabilities == null || !capabilities.isStorageMotionSupported()) {

Review comment:
       Thanks, @sureshanaparti, for the review! I tried to kill 2 birds with one stone :)
   I hope the new changes are better than this one




-- 
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 removed a comment on pull request #5029: Prevent NPE if hypervisor's capabilities are null

Posted by GitBox <gi...@apache.org>.
blueorangutan removed a comment on pull request #5029:
URL: https://github.com/apache/cloudstack/pull/5029#issuecomment-844560658


   <b>Trillian test result (tid-705)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 105468 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5029-t705-kvm-centos7.zip
   Intermittent failure detected: /marvin/tests/smoke/test_accounts.py
   Intermittent failure detected: /marvin/tests/smoke/test_affinity_groups_projects.py
   Intermittent failure detected: /marvin/tests/smoke/test_async_job.py
   Intermittent failure detected: /marvin/tests/smoke/test_deploy_virtio_scsi_vm.py
   Intermittent failure detected: /marvin/tests/smoke/test_deploy_vm_iso.py
   Intermittent failure detected: /marvin/tests/smoke/test_deploy_vms_with_varied_deploymentplanners.py
   Intermittent failure detected: /marvin/tests/smoke/test_deploy_vm_with_userdata.py
   Intermittent failure detected: /marvin/tests/smoke/test_diagnostics.py
   Intermittent failure detected: /marvin/tests/smoke/test_domain_service_offerings.py
   Intermittent failure detected: /marvin/tests/smoke/test_internal_lb.py
   Intermittent failure detected: /marvin/tests/smoke/test_iso.py
   Intermittent failure detected: /marvin/tests/smoke/test_kubernetes_clusters.py
   Intermittent failure detected: /marvin/tests/smoke/test_kubernetes_supported_versions.py
   Intermittent failure detected: /marvin/tests/smoke/test_list_ids_parameter.py
   Intermittent failure detected: /marvin/tests/smoke/test_loadbalance.py
   Intermittent failure detected: /marvin/tests/smoke/test_metrics_api.py
   Intermittent failure detected: /marvin/tests/smoke/test_multipleips_per_nic.py
   Intermittent failure detected: /marvin/tests/smoke/test_nested_virtualization.py
   Intermittent failure detected: /marvin/tests/smoke/test_network_acl.py
   Intermittent failure detected: /marvin/tests/smoke/test_network.py
   Intermittent failure detected: /marvin/tests/smoke/test_nic_adapter_type.py
   Intermittent failure detected: /marvin/tests/smoke/test_password_server.py
   Intermittent failure detected: /marvin/tests/smoke/test_portforwardingrules.py
   Intermittent failure detected: /marvin/tests/smoke/test_privategw_acl.py
   Intermittent failure detected: /marvin/tests/smoke/test_projects.py
   Intermittent failure detected: /marvin/tests/smoke/test_routers_network_ops.py
   Intermittent failure detected: /marvin/tests/smoke/test_ssvm.py
   Intermittent failure detected: /marvin/tests/smoke/test_vpc_redundant.py
   Smoke tests completed. 60 look OK, 27 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   ContextSuite context=TestAccounts>:setup | `Error` | 0.00 | test_accounts.py
   ContextSuite context=TestAddVmToSubDomain>:setup | `Error` | 0.00 | test_accounts.py
   test_DeleteDomain | `Error` | 0.74 | test_accounts.py
   test_forceDeleteDomain | `Failure` | 0.76 | test_accounts.py
   test_forceDeleteDomain | `Error` | 2.87 | test_accounts.py
   ContextSuite context=TestRemoveUserFromAccount>:setup | `Error` | 4.95 | test_accounts.py
   ContextSuite context=TestDomainsServiceOfferings>:setup | `Error` | 1529.35 | test_domain_service_offerings.py
   ContextSuite context=TestInternalLb>:setup | `Error` | 0.00 | test_internal_lb.py
   ContextSuite context=TestDeployVmWithAffinityGroup>:setup | `Error` | 0.00 | test_affinity_groups_projects.py
   test_01_create_iso_with_checksum_sha1 | `Error` | 65.31 | test_iso.py
   test_02_create_iso_with_checksum_sha256 | `Error` | 65.31 | test_iso.py
   test_03_create_iso_with_checksum_md5 | `Error` | 65.33 | test_iso.py
   test_04_create_iso_with_no_checksum | `Error` | 65.33 | test_iso.py
   test_01_create_iso | `Failure` | 1510.99 | test_iso.py
   ContextSuite context=TestISO>:setup | `Error` | 3023.09 | test_iso.py
   ContextSuite context=TestAsyncJob>:setup | `Error` | 0.00 | test_async_job.py
   ContextSuite context=TestLoadBalance>:setup | `Error` | 0.00 | test_loadbalance.py
   ContextSuite context=TestDeployVirtioSCSIVM>:setup | `Error` | 0.00 | test_deploy_virtio_scsi_vm.py
   test_list_clusters_metrics | `Error` | 1512.83 | test_metrics_api.py
   test_list_vms_metrics | `Error` | 0.11 | test_metrics_api.py
   ContextSuite context=TestDeployVMFromISO>:setup | `Error` | 0.00 | test_deploy_vm_iso.py
   ContextSuite context=TestDeployVmWithVariedPlanners>:setup | `Error` | 0.00 | test_deploy_vms_with_varied_deploymentplanners.py
   ContextSuite context=TestNetworkACL>:setup | `Error` | 0.00 | test_network_acl.py
   ContextSuite context=TestDeployVmWithUserData>:setup | `Error` | 0.00 | test_deploy_vm_with_userdata.py
   ContextSuite context=TestRemoteDiagnostics>:setup | `Error` | 0.00 | test_diagnostics.py
   test_delete_account | `Error` | 1512.56 | test_network.py
   test_delete_network_while_vm_on_it | `Error` | 0.05 | test_network.py
   test_deploy_vm_l2network | `Error` | 0.04 | test_network.py
   test_l2network_restart | `Error` | 1.11 | test_network.py
   ContextSuite context=TestPortForwarding>:setup | `Error` | 3.31 | test_network.py
   ContextSuite context=TestPublicIP>:setup | `Error` | 0.93 | test_network.py
   test_reboot_router | `Error` | 0.04 | test_network.py
   test_releaseIP | `Error` | 0.40 | test_network.py
   ContextSuite context=TestRouterRules>:setup | `Error` | 0.45 | test_network.py
   ContextSuite context=TestAdapterTypeForNic>:setup | `Error` | 0.00 | test_nic_adapter_type.py
   test_01_invalid_upgrade_kubernetes_cluster | `Failure` | 0.01 | test_kubernetes_clusters.py
   test_02_deploy_and_upgrade_kubernetes_cluster | `Failure` | 0.00 | test_kubernetes_clusters.py
   test_03_deploy_and_scale_kubernetes_cluster | `Failure` | 0.00 | test_kubernetes_clusters.py
   test_04_basic_lifecycle_kubernetes_cluster | `Failure` | 0.00 | test_kubernetes_clusters.py
   test_05_delete_kubernetes_cluster | `Failure` | 0.00 | test_kubernetes_clusters.py
   test_06_deploy_invalid_kubernetes_ha_cluster | `Failure` | 0.00 | test_kubernetes_clusters.py
   test_07_deploy_kubernetes_ha_cluster | `Failure` | 0.00 | test_kubernetes_clusters.py
   test_08_deploy_and_upgrade_kubernetes_ha_cluster | `Failure` | 0.00 | test_kubernetes_clusters.py
   test_09_delete_kubernetes_ha_cluster | `Failure` | 0.00 | test_kubernetes_clusters.py
   test_01_add_delete_kubernetes_supported_version | `Error` | 60.58 | test_kubernetes_supported_versions.py
   ContextSuite context=TestListIdsParams>:setup | `Error` | 0.00 | test_list_ids_parameter.py
   test_nic_secondaryip_add_remove | `Error` | 1511.70 | test_multipleips_per_nic.py
   ContextSuite context=TestNestedVirtualization>:setup | `Error` | 0.00 | test_nested_virtualization.py
   ContextSuite context=TestIsolatedNetworksPasswdServer>:setup | `Error` | 0.00 | test_password_server.py
   ContextSuite context=TestPortForwardingRules>:setup | `Error` | 0.00 | test_portforwardingrules.py
   ContextSuite context=TestPrivateGwACL>:setup | `Error` | 0.00 | test_privategw_acl.py
   ContextSuite context=TestProjectSuspendActivate>:setup | `Error` | 1520.34 | test_projects.py
   test_02_RVR_Network_FW_PF_SSH_default_routes_egress_false | `Failure` | 303.90 | test_routers_network_ops.py
   test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL | `Failure` | 490.63 | test_vpc_redundant.py
   test_03_create_redundant_VPC_1tier_2VMs_2IPs_2PF_ACL_reboot_routers | `Failure` | 420.21 | test_vpc_redundant.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.

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



[GitHub] [cloudstack] blueorangutan commented on pull request #5029: Prevent NPE if hypervisor's capabilities are null

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


   Packaging result: :heavy_check_mark: centos7 :heavy_check_mark: centos8 :heavy_check_mark: debian. SL-JID 53


-- 
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 pull request #5029: Prevent NPE if hypervisor's capabilities are null

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


   @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 #5029: Prevent NPE if hypervisor's capabilities are null

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


   <b>Trillian test result (tid-706)</b>
   Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 34649 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5029-t706-vmware-67u3.zip
   Smoke tests completed. 87 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.

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



[GitHub] [cloudstack] rhtyd merged pull request #5029: Prevent NPE if hypervisor's capabilities are null

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


   


-- 
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 #5029: Prevent NPE if hypervisor's capabilities are null

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


   @rhtyd a Trillian-Jenkins test job (centos7 mgmt + vmware-67u3) 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.

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



[GitHub] [cloudstack] blueorangutan commented on pull request #5029: Prevent NPE if hypervisor's capabilities are null

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


   @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 #5029: Prevent NPE if hypervisor's capabilities are null

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


   <b>Trillian test result (tid-708)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 32135 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5029-t708-kvm-centos7.zip
   Smoke tests completed. 87 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.

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



[GitHub] [cloudstack] blueorangutan commented on pull request #5029: Prevent NPE if hypervisor's capabilities are null

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


   @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