Skip to content

CLOUDSTACK-9691: Fixed unhandeled excetion in list snapshot command when a primary store is deleted related to it - #1847

Merged
asfgit merged 2 commits into
apache:4.9from
anshul1886:CLOUDSTACK-9691
Feb 20, 2017
Merged

CLOUDSTACK-9691: Fixed unhandeled excetion in list snapshot command when a primary store is deleted related to it#1847
asfgit merged 2 commits into
apache:4.9from
anshul1886:CLOUDSTACK-9691

Conversation

@anshul1886

@anshul1886anshul1886 commented Dec 21, 2016

Copy link
Copy Markdown

@mike-tutkowski After support for snapshots on solidifire there are many places which are prone to these NullPointer exceptions resulting in various issues. Root cause for these issues is that we get the primary storage associated with snapshot and then figure out how to handle but if that store is deleted then it results in NullPointer exceptions. Without solidfire we don't need to access primary storage.

Should we handle that as issues are found or could there be other way to fix all of these issues?

@mike-tutkowski

Copy link
Copy Markdown
Member

Can you tell me which line was throwing a NullPointerException in the code that you fixed? Thanks!

@anshul1886

Copy link
Copy Markdown
Author

@mike-tutkowski Its in bug description. Are you not seeing this issue on your end?

2016-08-26 14:34:36,709 DEBUG [c.c.a.ApiServlet] (catalina-exec-1:ctx-90c9ba3a) (logid:115e39ad) ===START=== 10.233.88.59 – GET command=listSnapshots&response=json&listAll=true&page=1&pagesize=20&_=1472202277072
2016-08-26 14:34:36,747 ERROR [c.c.a.ApiServer] (catalina-exec-1:ctx-90c9ba3a ctx-94284178) (logid:115e39ad) unhandled exception executing api command: [Ljava.lang.String;@77f27ce8
com.cloud.utils.exception.CloudRuntimeException: Unable to locate datastore with id 1
at org.apache.cloudstack.storage.datastore.manager.PrimaryDataStoreProviderManagerImpl.getPrimaryDataStore(PrimaryDataStoreProviderManagerImpl.java:61)
at org.apache.cloudstack.storage.datastore.DataStoreManagerImpl.getDataStore(DataStoreManagerImpl.java:48)
at com.cloud.api.ApiResponseHelper.getDataStoreRole(ApiResponseHelper.java:571)
at com.cloud.api.ApiResponseHelper.createSnapshotResponse(ApiResponseHelper.java:537)
at org.apache.cloudstack.api.command.user.snapshot.ListSnapshotsCmd.execute(ListSnapshotsCmd.java:117)
at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:132)
at com.cloud.api.ApiServer.queueCommand(ApiServer.java:707)
at com.cloud.api.ApiServer.handleRequest(ApiServer.java:538)
at com.cloud.api.ApiServlet.processRequestInContext(ApiServlet.java:297)
at com.cloud.api.ApiServlet$1.run(ApiServlet.java:129)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:56)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:103)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:53)
at com.cloud.api.ApiServlet.processRequest(ApiServlet.java:126)
at com.cloud.api.ApiServlet.doGet(ApiServlet.java:86)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

@serg38

Copy link
Copy Markdown

@mike-tutkowski@anshul-gangwar@nvazquez I believe the same issue is addressed in PR1735 but in a more consistent fashion

@anshul1886

Copy link
Copy Markdown
Author

@serg38 seems so both addressing same issue.

@nvazquez

Copy link
Copy Markdown
Contributor

Hi @anshul1886,
We addressed the same issue along with @serg38 in PR #1735. We proposed a way to fix the problem on it.

@mike-tutkowski

Copy link
Copy Markdown
Member

Let me provide a bit of background on this and then we can decide which way we want to correct this side effect.

Here is the PR that went in a while ago that enabled CloudStack to support volume snapshots that reside on primary storage:

#1403

The idea being these types of snapshots are faster than the back-up-to-secondary-storage approach CloudStack does by default and they can be a lot more space efficient, as well.

As part of this process, I went through and tried to identify all of the locations where we assumed a volume snapshot resided on secondary storage (and I put in code to see if it really resides there or, instead, if it's on primary storage).

As we have noted, a couple places were missed and this PR (as wells as #1735) were opened to address those issues.

The way this particular PR's code is written should work fine. In the case where the original primary storage has been removed, an exception will be thrown, caught, logged, and then we will default to returning secondary storage as the location (which it should be).

Instead of the try/catch approach, though, it might be better if we see if dataStore is null.

DataStore dataStore = dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary);

If that comes back null, then we apparently have removed primary storage, which can only be done if your snapshots don't reside on it. If dataStore == null, return DataStoreRole.IMAGE.

@anshul1886

Copy link
Copy Markdown
Author

@mike-tutkowski was in python mode so used try except mode instead of null check which is recommended in java. Pushed the changes for null check.

@mike-tutkowski

Copy link
Copy Markdown
Member

To clarify this line:

"If that comes back null, then we apparently have removed primary storage, which can only be done if your snapshots don't reside on it. If dataStore == null, return DataStoreRole.IMAGE."

I meant this for managed storage. For unmanaged storage, the original primary storage from which the snapshot came can be deleted and the snapshot can remain.

@mike-tutkowski

Copy link
Copy Markdown
Member

Code = LGTM

@sateesh-chodapuneedisateesh-chodapuneedi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for code changes.

@sateesh-chodapuneedi

Copy link
Copy Markdown
Member

@karuturi Seems this is ready for merge, with code LGTMs and based on test results published by @cloudmonger ?
The 4 test failures seems not relevant to this patch with code changes in API layer.

@karuturi

Copy link
Copy Markdown
Member

@sateesh-chodapuneedi@anshul1886@mike-tutkowski
whats the relation with #1735? Is one of them required or both?

@anshul1886

Copy link
Copy Markdown
Author

@karuturi, One will be enough to fix the issue. #1735 has added the test which can be used. Other then test that PR needs some fixing for actual fix.

@karuturi

Copy link
Copy Markdown
Member

@anshul1886 can you and @nvazquez work together and create a single PR?

@anshul1886

Copy link
Copy Markdown
Author

@nvazquez What would you like to do?

@nvazquez

Copy link
Copy Markdown
Contributor

Hi @anshul1886,
I've deployed and tested your PR by replicating issue we had in our environment with Vmware and passed successfully! I think your solution is much cleaner and simpler than mine. Do you agree if I close mine and we go ahead on your PR? Would you mind adding marvin test written in mine to your PR (under test_snapshots.py)?

@anshul1886

Copy link
Copy Markdown
Author

@nvazquez, Yeah I am fine with it. I will add the test from your PR to mine PR

@nvazquez

Copy link
Copy Markdown
Contributor

@anshul1886 great, thanks!

@anshul1886

Copy link
Copy Markdown
Author

@karuturi@nvazquez , Added the marvin test from #1735.

@sateesh-chodapuneedisateesh-chodapuneedi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for code.
Thanks @anshul1886 for fix, and @nvazquez for integration test.

@karuturi

Copy link
Copy Markdown
Member

merging

@karuturi

Copy link
Copy Markdown
Member

oops.. will wait for travis

@cloudmonger

Copy link
Copy Markdown

ACS CI BVT Run

Sumarry:
Build Number 352
Hypervisor xenserver
NetworkType Advanced
Passed=104
Failed=1
Skipped=7

Link to logs Folder (search by build_no):https://www.dropbox.com/sh/yj3wnzbceo9uef2/AAB6u-Iap-xztdm6jHX9SjPja?dl=0

Failed tests:

  • test_routers_network_ops.py

  • test_03_RVR_Network_check_router_state Failed

Skipped tests:
test_01_test_vm_volume_snapshot
test_vm_nic_adapter_vmxnet3
test_static_role_account_acls
test_11_ss_nfs_version_on_ssvm
test_nested_virtualization_vmware
test_3d_gpu_support
test_deploy_vgpu_enabled_vm

Passed test suits:
test_deploy_vm_with_userdata.py
test_affinity_groups_projects.py
test_portable_publicip.py
test_over_provisioning.py
test_global_settings.py
test_scale_vm.py
test_service_offerings.py
test_routers_iptables_default_policy.py
test_loadbalance.py
test_routers.py
test_reset_vm_on_reboot.py
test_deploy_vms_with_varied_deploymentplanners.py
test_network.py
test_router_dns.py
test_non_contigiousvlan.py
test_login.py
test_deploy_vm_iso.py
test_list_ids_parameter.py
test_public_ip_range.py
test_multipleips_per_nic.py
test_regions.py
test_affinity_groups.py
test_network_acl.py
test_pvlan.py
test_volumes.py
test_nic.py
test_deploy_vm_root_resize.py
test_resource_detail.py
test_secondary_storage.py
test_vm_life_cycle.py
test_disk_offerings.py

@anshul1886

Copy link
Copy Markdown
Author

@karuturi Test failing is unrelated to this PR.

=== TestName: test_add_user_to_project | Status : EXCEPTION ===
=== TestName: test_add_user_to_project | Status : EXCEPTION ===

Test failing in travis is | ContextSuite con | exceptions.Excep | 36.025 | test_project_lim |
| text=TestResourc | tion | | its |
| eLimitsProject>: | | | |
| teardown

@karuturi

Copy link
Copy Markdown
Member

Hi @anshul1886, I just observed that the related PR #1735 was for 4.9. Since this bug also exists in 4.9, can you change the base branch of this PR to 4.9 and rebase?

@anshul1886

Copy link
Copy Markdown
Author

Ok, Doing that.

@anshul1886
anshul1886 changed the base branch from master to 4.9February 20, 2017 05:54
@anshul1886

Copy link
Copy Markdown
Author

@karuturi, Done

@borisstoyanov

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-506

@borisstoyanov

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

asfgit pushed a commit that referenced this pull request Feb 20, 2017
CLOUDSTACK-9691: Fixed unhandeled excetion in list snapshot command when a primary store is deleted related to it@mike-tutkowski After support for snapshots on solidifire there are many places which are prone to these NullPointer exceptions resulting in various issues. Root cause for these issues is that we get the primary storage associated with snapshot and then figure out how to handle but if that store is deleted then it results in NullPointer exceptions. Without solidfire we don't need to access primary storage.
Should we handle that as issues are found or could there be other way to fix all of these issues?
* pr/1847:
CLOUDSTACK-9691: Added test list_snapshots_with_removed_data_store
CLOUDSTACK-9691: Fixed unhandeled excetion in list snapshot command when a primary store is deleted related to it
Signed-off-by: Rajani Karuturi <rajani.karuturi@accelerite.com>
@asfgit
asfgit merged commit 3caedb9 into apache:4.9Feb 20, 2017
@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-854)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 26568 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr1847-t854-kvm-centos7.zip
Intermitten failure detected: /marvin/tests/smoke/test_privategw_acl.py
Intermitten failure detected: /marvin/tests/smoke/test_snapshots.py
Test completed. 46 look ok, 2 have error(s)

TestResultTime (s)Test File
test_04_rvpc_privategw_static_routesFailure315.29test_privategw_acl.py
test_02_list_snapshots_with_removed_data_storeError0.04test_snapshots.py
test_01_vpc_site2site_vpnSuccess140.99test_vpc_vpn.py
test_01_vpc_remote_access_vpnSuccess66.12test_vpc_vpn.py
test_01_redundant_vpc_site2site_vpnSuccess220.68test_vpc_vpn.py
test_02_VPC_default_routesSuccess284.23test_vpc_router_nics.py
test_01_VPC_nics_after_destroySuccess513.11test_vpc_router_nics.py
test_05_rvpc_multi_tiersSuccess503.72test_vpc_redundant.py
test_04_rvpc_network_garbage_collector_nicsSuccess1404.04test_vpc_redundant.py
test_03_create_redundant_VPC_1tier_2VMs_2IPs_2PF_ACL_reboot_routersSuccess538.71test_vpc_redundant.py
test_02_redundant_VPC_default_routesSuccess741.04test_vpc_redundant.py
test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACLSuccess1286.74test_vpc_redundant.py
test_09_delete_detached_volumeSuccess151.44test_volumes.py
test_08_resize_volumeSuccess156.61test_volumes.py
test_07_resize_failSuccess156.51test_volumes.py
test_06_download_detached_volumeSuccess157.60test_volumes.py
test_05_detach_volumeSuccess151.18test_volumes.py
test_04_delete_attached_volumeSuccess151.37test_volumes.py
test_03_download_attached_volumeSuccess156.77test_volumes.py
test_02_attach_volumeSuccess94.64test_volumes.py
test_01_create_volumeSuccess621.09test_volumes.py
test_deploy_vm_multipleSuccess252.67test_vm_life_cycle.py
test_deploy_vmSuccess0.03test_vm_life_cycle.py
test_advZoneVirtualRouterSuccess0.03test_vm_life_cycle.py
test_10_attachAndDetach_isoSuccess26.80test_vm_life_cycle.py
test_09_expunge_vmSuccess125.25test_vm_life_cycle.py
test_08_migrate_vmSuccess40.93test_vm_life_cycle.py
test_07_restore_vmSuccess0.13test_vm_life_cycle.py
test_06_destroy_vmSuccess130.86test_vm_life_cycle.py
test_03_reboot_vmSuccess126.01test_vm_life_cycle.py
test_02_start_vmSuccess10.18test_vm_life_cycle.py
test_01_stop_vmSuccess35.33test_vm_life_cycle.py
test_CreateTemplateWithDuplicateNameSuccess75.64test_templates.py
test_08_list_system_templatesSuccess0.03test_templates.py
test_07_list_public_templatesSuccess0.04test_templates.py
test_05_template_permissionsSuccess0.06test_templates.py
test_04_extract_templateSuccess5.16test_templates.py
test_03_delete_templateSuccess5.13test_templates.py
test_02_edit_templateSuccess90.18test_templates.py
test_01_create_templateSuccess25.33test_templates.py
test_10_destroy_cpvmSuccess161.44test_ssvm.py
test_09_destroy_ssvmSuccess163.81test_ssvm.py
test_08_reboot_cpvmSuccess101.37test_ssvm.py
test_07_reboot_ssvmSuccess133.56test_ssvm.py
test_06_stop_cpvmSuccess131.60test_ssvm.py
test_05_stop_ssvmSuccess133.67test_ssvm.py
test_04_cpvm_internalsSuccess1.02test_ssvm.py
test_03_ssvm_internalsSuccess3.29test_ssvm.py
test_02_list_cpvm_vmSuccess0.15test_ssvm.py
test_01_list_sec_storage_vmSuccess0.13test_ssvm.py
test_01_snapshot_root_diskSuccess11.10test_snapshots.py
test_04_change_offering_smallSuccess210.81test_service_offerings.py
test_03_delete_service_offeringSuccess0.04test_service_offerings.py
test_02_edit_service_offeringSuccess0.05test_service_offerings.py
test_01_create_service_offeringSuccess0.11test_service_offerings.py
test_02_sys_template_readySuccess0.13test_secondary_storage.py
test_01_sys_vm_startSuccess0.18test_secondary_storage.py
test_09_reboot_routerSuccess40.33test_routers.py
test_08_start_routerSuccess30.28test_routers.py
test_07_stop_routerSuccess10.16test_routers.py
test_06_router_advancedSuccess0.06test_routers.py
test_05_router_basicSuccess0.04test_routers.py
test_04_restart_network_wo_cleanupSuccess5.68test_routers.py
test_03_restart_network_cleanupSuccess55.49test_routers.py
test_02_router_internal_advSuccess0.85test_routers.py
test_01_router_internal_basicSuccess0.46test_routers.py
test_router_dns_guestipquerySuccess76.73test_router_dns.py
test_router_dns_externalipquerySuccess0.08test_router_dns.py
test_router_dhcphostsSuccess288.86test_router_dhcphosts.py
test_router_dhcp_optsSuccess21.62test_router_dhcphosts.py
test_01_updatevolumedetailSuccess0.08test_resource_detail.py
test_01_reset_vm_on_rebootSuccess130.88test_reset_vm_on_reboot.py
test_createRegionSuccess0.04test_regions.py
test_create_pvlan_networkSuccess5.21test_pvlan.py
test_dedicatePublicIpRangeSuccess0.44test_public_ip_range.py
test_03_vpc_privategw_restart_vpc_cleanupSuccess439.45test_privategw_acl.py
test_02_vpc_privategw_static_routesSuccess349.86test_privategw_acl.py
test_01_vpc_privategw_aclSuccess92.19test_privategw_acl.py
test_01_primary_storage_nfsSuccess35.80test_primary_storage.py
test_createPortablePublicIPRangeSuccess15.19test_portable_publicip.py
test_createPortablePublicIPAcquireSuccess15.48test_portable_publicip.py
test_isolate_network_password_serverSuccess89.22test_password_server.py
test_UpdateStorageOverProvisioningFactorSuccess0.14test_over_provisioning.py
test_oobm_zchange_passwordSuccess30.70test_outofbandmanagement.py
test_oobm_multiple_mgmt_server_ownershipSuccess16.33test_outofbandmanagement.py
test_oobm_issue_power_statusSuccess5.22test_outofbandmanagement.py
test_oobm_issue_power_softSuccess15.31test_outofbandmanagement.py
test_oobm_issue_power_resetSuccess15.47test_outofbandmanagement.py
test_oobm_issue_power_onSuccess15.32test_outofbandmanagement.py
test_oobm_issue_power_offSuccess15.33test_outofbandmanagement.py
test_oobm_issue_power_cycleSuccess15.34test_outofbandmanagement.py
test_oobm_enabledisable_across_clusterzonesSuccess92.56test_outofbandmanagement.py
test_oobm_enable_feature_validSuccess5.15test_outofbandmanagement.py
test_oobm_enable_feature_invalidSuccess0.09test_outofbandmanagement.py
test_oobm_disable_feature_validSuccess5.36test_outofbandmanagement.py
test_oobm_disable_feature_invalidSuccess0.10test_outofbandmanagement.py
test_oobm_configure_invalid_driverSuccess0.07test_outofbandmanagement.py
test_oobm_configure_default_driverSuccess0.07test_outofbandmanagement.py
test_oobm_background_powerstate_syncSuccess23.43test_outofbandmanagement.py
test_extendPhysicalNetworkVlanSuccess15.36test_non_contigiousvlan.py
test_01_nicSuccess419.17test_nic.py
test_releaseIPSuccess157.40test_network.py
test_reboot_routerSuccess383.34test_network.py
test_public_ip_user_accountSuccess10.25test_network.py
test_public_ip_admin_accountSuccess40.30test_network.py
test_network_rules_acquired_public_ip_3_Load_Balancer_RuleSuccess67.10test_network.py
test_network_rules_acquired_public_ip_2_nat_ruleSuccess61.71test_network.py
test_network_rules_acquired_public_ip_1_static_nat_ruleSuccess121.06test_network.py
test_delete_accountSuccess288.17test_network.py
test_02_port_fwd_on_non_src_natSuccess55.65test_network.py
test_01_port_fwd_on_src_natSuccess109.71test_network.py
test_nic_secondaryip_add_removeSuccess202.70test_multipleips_per_nic.py
login_test_saml_userSuccess19.32test_login.py
test_assign_and_removal_lbSuccess133.09test_loadbalance.py
test_02_create_lb_rule_non_natSuccess187.10test_loadbalance.py
test_01_create_lb_rule_src_natSuccess207.50test_loadbalance.py
test_03_list_snapshotsSuccess0.05test_list_ids_parameter.py
test_02_list_templatesSuccess0.04test_list_ids_parameter.py
test_01_list_volumesSuccess0.03test_list_ids_parameter.py
test_07_list_default_isoSuccess0.06test_iso.py
test_05_iso_permissionsSuccess0.06test_iso.py
test_04_extract_IsoSuccess5.16test_iso.py
test_03_delete_isoSuccess95.21test_iso.py
test_02_edit_isoSuccess0.06test_iso.py
test_01_create_isoSuccess21.03test_iso.py
test_04_rvpc_internallb_haproxy_stats_on_all_interfacesSuccess193.60test_internal_lb.py
test_03_vpc_internallb_haproxy_stats_on_all_interfacesSuccess127.59test_internal_lb.py
test_02_internallb_roundrobin_1RVPC_3VM_HTTP_port80Success515.71test_internal_lb.py
test_01_internallb_roundrobin_1VPC_3VM_HTTP_port80Success426.01test_internal_lb.py
test_dedicateGuestVlanRangeSuccess10.26test_guest_vlan_range.py
test_UpdateConfigParamWithScopeSuccess0.14test_global_settings.py
test_rolepermission_lifecycle_updateSuccess6.17test_dynamicroles.py
test_rolepermission_lifecycle_listSuccess5.99test_dynamicroles.py
test_rolepermission_lifecycle_deleteSuccess5.89test_dynamicroles.py
test_rolepermission_lifecycle_createSuccess5.94test_dynamicroles.py
test_rolepermission_lifecycle_concurrent_updatesSuccess6.01test_dynamicroles.py
test_role_lifecycle_update_role_inuseSuccess5.93test_dynamicroles.py
test_role_lifecycle_updateSuccess10.99test_dynamicroles.py
test_role_lifecycle_listSuccess5.91test_dynamicroles.py
test_role_lifecycle_deleteSuccess10.95test_dynamicroles.py
test_role_lifecycle_createSuccess5.97test_dynamicroles.py
test_role_inuse_deletionSuccess5.92test_dynamicroles.py
test_role_account_acls_multiple_mgmt_serversSuccess8.06test_dynamicroles.py
test_role_account_aclsSuccess8.31test_dynamicroles.py
test_default_role_deletionSuccess5.99test_dynamicroles.py
test_04_create_fat_type_disk_offeringSuccess0.07test_disk_offerings.py
test_03_delete_disk_offeringSuccess0.04test_disk_offerings.py
test_02_edit_disk_offeringSuccess0.05test_disk_offerings.py
test_02_create_sparse_type_disk_offeringSuccess0.07test_disk_offerings.py
test_01_create_disk_offeringSuccess0.11test_disk_offerings.py
test_deployvm_userdispersingSuccess20.59test_deploy_vms_with_varied_deploymentplanners.py
test_deployvm_userconcentratedSuccess20.61test_deploy_vms_with_varied_deploymentplanners.py
test_deployvm_firstfitSuccess60.77test_deploy_vms_with_varied_deploymentplanners.py
test_deployvm_userdata_postSuccess10.37test_deploy_vm_with_userdata.py
test_deployvm_userdataSuccess45.63test_deploy_vm_with_userdata.py
test_02_deploy_vm_root_resizeSuccess5.99test_deploy_vm_root_resize.py
test_01_deploy_vm_root_resizeSuccess6.01test_deploy_vm_root_resize.py
test_00_deploy_vm_root_resizeSuccess212.48test_deploy_vm_root_resize.py
test_deploy_vm_from_isoSuccess202.41test_deploy_vm_iso.py
test_DeployVmAntiAffinityGroupSuccess65.97test_affinity_groups.py
test_03_delete_vm_snapshotsSkipped0.00test_vm_snapshots.py
test_02_revert_vm_snapshotsSkipped0.00test_vm_snapshots.py
test_01_test_vm_volume_snapshotSkipped0.00test_vm_snapshots.py
test_01_create_vm_snapshotsSkipped0.00test_vm_snapshots.py
test_06_copy_templateSkipped0.00test_templates.py
test_static_role_account_aclsSkipped0.02test_staticroles.py
test_01_scale_vmSkipped0.00test_scale_vm.py
test_01_primary_storage_iscsiSkipped0.04test_primary_storage.py
test_06_copy_isoSkipped0.00test_iso.py
test_deploy_vgpu_enabled_vmSkipped0.01test_deploy_vgpu_enabled_vm.py

@serg38

Copy link
Copy Markdown

@nvazquez @rhtyd @anshul1886 We might need to tweak the test_data.py to add additional nfs mount e.g. nfs1 and use it in this test. E.g adding
"nfs1": {
"url": "nfs://nfs/export/automation/1/testprimary1",
"name": "Primary XEN1"
},
Blueorangutain environment will need to be adjusted as well. Otherwise the test fails with
CloudstackAPIException: Execute cmd: createstoragepool failed, due to: errorCode: 530, errorText:Failed to add data store: Storage pool NFS://10.2.0.16/acs/primary/pr1847-t854-kvm-centos7/marvin_pri1 already in use by another pod (id=1)\n']

@yadvr

Copy link
Copy Markdown
Member

@borisstoyanov can you have a look at ^^, thanks.

@serg38

Copy link
Copy Markdown

@karuturi@anshul1886 Can we tweak line 278 of test_snaphsot.py from
self.services["nfs"],
to self.services["nfs2"],

and re-merge this PR so it doesn't conflict with other tests using "nfs" test data.

@nvazquez

Copy link
Copy Markdown
Contributor

@borisstoyanov @rhtyd I was checking BlueOrangutan logs:

In test_primary_storage_8NPG5G\runinfo.txt lines 27-30, there's PS creation:

2017-02-20 11:03:59,678 - DEBUG - Payload: {'apiKey': u'LIN6rqXuaJwMPfGYFh13qDwYz5VNNz1J2J6qIOWcd3oLQOq0WtD4CwRundBL6rzXToa3lQOC_vKjI3nkHtiD8Q', 'name': 'Marvin Primary Pool', 'url': 'NFS://10.2.0.16/acs/primary/pr1847-t854-kvm-centos7/marvin_pri1', 'podid': u'1c6f35e3-a31e-49cc-b0b0-801848dbb9bc', 'clusterid': u'8ac40777-344d-4f36-93a3-7b685361a523', 'zoneid': u'9c474c4e-0742-4fbb-b0ae-cb3d1e63cb70', 'command': 'createStoragePool', 'signature': 'zq6ff7P2n9iLmw3Cw9nDgMM1v90=', 'response': 'json'}
2017-02-20 11:03:59,678 - DEBUG - ========Sending GET Cmd : createStoragePool=======
2017-02-20 11:04:00,038 - DEBUG - Response : {podname : u'Pod1', name : u'Marvin Primary Pool', disksizeallocated : 0, created : u'2017-02-20T11:04:00+0000', clustername : u'p1-c1', ipaddress : u'10.2.0.16', podid : u'1c6f35e3-a31e-49cc-b0b0-801848dbb9bc', clusterid : u'8ac40777-344d-4f36-93a3-7b685361a523', zoneid : u'9c474c4e-0742-4fbb-b0ae-cb3d1e63cb70', state : u'Up', scope : u'CLUSTER', overprovisionfactor : u'2.0', path : u'/acs/primary/pr1847-t854-kvm-centos7/marvin_pri1', zonename : u'pr1847-t854-kvm-centos7', type : u'NetworkFilesystem', id : u'fa44baa2-267d-3f36-88c9-c5c545e0204b', disksizetotal : 7514055770112}
2017-02-20 11:04:00,038 - DEBUG - Created storage pool in cluster: 8ac40777-344d-4f36-93a3-7b685361a523

Then, it gets removed, lines 46-48:

2017-02-20 11:04:35,193 - DEBUG - Payload: {'apiKey': u'LIN6rqXuaJwMPfGYFh13qDwYz5VNNz1J2J6qIOWcd3oLQOq0WtD4CwRundBL6rzXToa3lQOC_vKjI3nkHtiD8Q', 'response': 'json', 'command': 'deleteStoragePool', 'signature': '73NDgRVRZDU4uHR/Vc8pRbVg2p4=', 'id': u'fa44baa2-267d-3f36-88c9-c5c545e0204b'}
2017-02-20 11:04:35,193 - DEBUG - ========Sending GET Cmd : deleteStoragePool=======
2017-02-20 11:04:35,396 - DEBUG - Response : {success : u'true'}

Then, on test_volumes_950C4W\runinfo.txt lines 474-476 listStoragePools command is sent and lists previously deleted PS:

2017-02-20 13:54:49,407 - DEBUG - Payload: {'apiKey': u'LIN6rqXuaJwMPfGYFh13qDwYz5VNNz1J2J6qIOWcd3oLQOq0WtD4CwRundBL6rzXToa3lQOC_vKjI3nkHtiD8Q', 'command': 'listStoragePools', 'signature': 'l3xL+RNaPCVAYEpCovbu1snTIRI=', 'response': 'json'}
2017-02-20 13:54:49,407 - DEBUG - ========Sending GET Cmd : listStoragePools=======
2017-02-20 13:54:49,432 - DEBUG - Response : [{podname : u'Pod1', storagecapabilities : {VOLUME_SNAPSHOT_QUIESCEVM : u'false'}, name : u'Marvin Primary Pool', disksizeallocated : 8590328832, podid : u'1c6f35e3-a31e-49cc-b0b0-801848dbb9bc', clustername : u'p1-c1', ipaddress : u'10.2.0.16', created : u'2017-02-20T12:51:45+0000', clusterid : u'8ac40777-344d-4f36-93a3-7b685361a523', zoneid : u'9c474c4e-0742-4fbb-b0ae-cb3d1e63cb70', state : u'Up', disksizeused : 174845853696, id : u'fa44baa2-267d-3f36-88c9-c5c545e0204b', overprovisionfactor : u'2.0', path : u'/acs/primary/pr1847-t854-kvm-centos7/marvin_pri1', zonename : u'pr1847-t854-kvm-centos7', type : u'NetworkFilesystem', scope : u'CLUSTER', disksizetotal : 7514055770112}, {podname : u'Pod1', storagecapabilities : {VOLUME_SNAPSHOT_QUIESCEVM : u'false'}, name : u'pr1847-t854-kvm-centos7-kvm-pri2', disksizeallocated : 977060864, podid : u'1c6f35e3-a31e-49cc-b0b0-801848dbb9bc', clustername : u'p1-c1', ipaddress : u'10.2.0.16', created : u'2017-02-20T08:52:51+0000', clusterid : u'8ac40777-344d-4f36-93a3-7b685361a523', zoneid : u'9c474c4e-0742-4fbb-b0ae-cb3d1e63cb70', state : u'Up', disksizeused : 174845853696, id : u'7a360219-f4a9-3edb-a1e3-241cbc2dee7f', overprovisionfactor : u'2.0', path : u'/acs/primary/pr1847-t854-kvm-centos7/pr1847-t854-kvm-centos7-kvm-pri2', zonename : u'pr1847-t854-kvm-centos7', type : u'NetworkFilesystem', scope : u'CLUSTER', disksizetotal : 7514055770112}, {podname : u'Pod1', storagecapabilities : {VOLUME_SNAPSHOT_QUIESCEVM : u'false'}, name : u'pr1847-t854-kvm-centos7-kvm-pri1', disksizeallocated : 3221422592, podid : u'1c6f35e3-a31e-49cc-b0b0-801848dbb9bc', clustername : u'p1-c1', ipaddress : u'10.2.0.16', created : u'2017-02-20T08:52:50+0000', clusterid : u'8ac40777-344d-4f36-93a3-7b685361a523', zoneid : u'9c474c4e-0742-4fbb-b0ae-cb3d1e63cb70', state : u'Up', disksizeused : 174845853696, id : u'4435931f-bb5a-3ce6-a2f5-6f7345d5eb0a', overprovisionfactor : u'2.0', path : u'/acs/primary/pr1847-t854-kvm-centos7/pr1847-t854-kvm-centos7-kvm-pri1', zonename : u'pr1847-t854-kvm-centos7', type : u'NetworkFilesystem', scope : u'CLUSTER', disksizetotal : 7514055770112}]

Please note that although there's almost 3-hour difference between logs, there exists a PS with the same id ("fa44baa2-267d-3f36-88c9-c5c545e0204b"), but creation times are different:
created: u'2017-02-20T11:04:00+0000' vs created : u'2017-02-20T12:51:45+0000'

So, when test_snapshots.py gets executed, it tries creating PS and fails due to there is already a PS with the same url. I agree with @serg38 on adding a new entry on test_data.py which would solve the problem, but I think it would require modifying test_data.py each time we want to create a PS using nfs. What do you guys think, that you know how BlueOrangutan works, that would be the best approach?

@borisstoyanov

Copy link
Copy Markdown
Contributor

Hi @nvazquez, let me simplify what B.O. is doing, when it read 'test' it kicks a jenkins job that deploys the pr, deploys a zone and executes all tests in the smoketests directory.
Personally I don't see anything wrong with appending an item in the test_data.py and using it, as long as we make sure to do self.cleanup.append(new_object). In particular, this object can be reused by any test as long as it's not already added.

asfgit pushed a commit that referenced this pull request Mar 28, 2017
Fix for test_snapshots.py using nfs2 instead of nfs templateFix for marvin test failure introduced in #1847
Cc: @borisstoyanov @rhtyd @karuturi
* pr/1961:
Fix for test failure
Fix for test_snapshots.py using nfs2 instead of nfs template
Signed-off-by: Rajani Karuturi <rajani.karuturi@accelerite.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

12 participants

@anshul1886@mike-tutkowski@serg38@nvazquez@sateesh-chodapuneedi@karuturi@cloudmonger@borisstoyanov@blueorangutan@yadvr@asfgit@anshul-gangwar