Skip to content

Search vm snapshots using tags#4213

Merged
yadvr merged 2 commits intoapache:4.14from
shapeblue:vmsnap_search_by_tags
Aug 13, 2020
Merged

Search vm snapshots using tags#4213
yadvr merged 2 commits intoapache:4.14from
shapeblue:vmsnap_search_by_tags

Conversation

@Pearl1594
Copy link
Contributor

Description

Search VM snapshots using tags
Currently, search of VM snapshots doesn't comply with tags passed as input

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • 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)

How Has This Been Tested?

tested via CLI (cmk) and UI

@Pearl1594
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✔centos7 ✔debian. JID-1586

Copy link
Member

@GabrielBrascher GabrielBrascher left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @Pearl1594. I raised a few minor observations of what I think can be improved.

@yadvr yadvr added this to the 4.15.0.0 milestone Jul 27, 2020
@yadvr
Copy link
Member

yadvr commented Jul 27, 2020

@Pearl1594 can you address review comments and kick packaging/tests - assuming this is for primate, if so - can you pl change the base branch to 4.14?

@Pearl1594 Pearl1594 force-pushed the vmsnap_search_by_tags branch from 2a5b533 to f79dc4e Compare July 27, 2020 13:13
@Pearl1594 Pearl1594 changed the base branch from master to 4.14 July 27, 2020 13:14
@Pearl1594 Pearl1594 force-pushed the vmsnap_search_by_tags branch from f79dc4e to 2f01c8b Compare July 27, 2020 13:18
@Pearl1594
Copy link
Contributor Author

@GabrielBrascher Thanks for reviewing, I've addressed your comments.
@rhtyd I've rebased it to 4.14
@blueorangutan package

Copy link
Contributor

@davidjumani davidjumani left a comment

Choose a reason for hiding this comment

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

LGTM

@Pearl1594
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✔centos7 ✔debian. JID-1611

@Pearl1594
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Trillian test result (tid-2208)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 42325 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4213-t2208-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_internal_lb.py
Intermittent failure detected: /marvin/tests/smoke/test_kubernetes_clusters.py
Intermittent failure detected: /marvin/tests/smoke/test_vm_life_cycle.py
Smoke tests completed. 81 look OK, 2 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File
test_02_deploy_kubernetes_ha_cluster Error 3613.69 test_kubernetes_clusters.py
test_04_deploy_and_upgrade_kubernetes_cluster Error 0.04 test_kubernetes_clusters.py
test_05_deploy_and_upgrade_kubernetes_ha_cluster Error 0.03 test_kubernetes_clusters.py
test_06_deploy_and_invalid_upgrade_kubernetes_cluster Error 0.03 test_kubernetes_clusters.py
test_07_deploy_and_scale_kubernetes_cluster Error 0.03 test_kubernetes_clusters.py
ContextSuite context=TestKubernetesCluster>:teardown Error 36.45 test_kubernetes_clusters.py
ContextSuite context=Test01DeployVM>:setup Error 0.00 test_vm_life_cycle.py
ContextSuite context=Test02VMLifeCycle>:setup Error 0.00 test_vm_life_cycle.py
ContextSuite context=Test03SecuredVmMigration>:setup Error 0.00 test_vm_life_cycle.py

Copy link
Contributor

@RodrigoDLopez RodrigoDLopez left a comment

Choose a reason for hiding this comment

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

Hi @Pearl1594
Code looks good to me. I did not tested yet, I think you already did it.
I think if you could do those changes the code will be more readable, and add some unit tests

Comment on lines +243 to +251
SearchBuilder<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder();
for (int count = 0; count < tags.size(); count++) {
tagSearch.or().op(ApiConstants.KEY + String.valueOf(count), tagSearch.entity().getKey(), SearchCriteria.Op.EQ);
tagSearch.and(ApiConstants.VALUE + String.valueOf(count), tagSearch.entity().getValue(), SearchCriteria.Op.EQ);
tagSearch.cp();
}
tagSearch.and(ApiConstants.RESOURCE_TYPE, tagSearch.entity().getResourceType(), SearchCriteria.Op.EQ);
sb.groupBy(sb.entity().getId());
sb.join("tagSearch", tagSearch, sb.entity().getId(), tagSearch.entity().getResourceId(), JoinBuilder.JoinType.INNER);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please extract this to a method, add documentation to what this method do and why.
Also can you please create unit tests to cover those method

Comment on lines +258 to +264
int count = 0;
sc.setJoinParameters("tagSearch", ApiConstants.RESOURCE_TYPE, ResourceTag.ResourceObjectType.VMSnapshot.toString());
for (String key : tags.keySet()) {
sc.setJoinParameters("tagSearch", ApiConstants.KEY + String.valueOf(count), key);
sc.setJoinParameters("tagSearch", ApiConstants.VALUE + String.valueOf(count), tags.get(key));
count++;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

cloud you do the same here please,
extract to a new method, add documentation and unit tests.

@yadvr
Copy link
Member

yadvr commented Aug 5, 2020

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✖centos7 ✔debian. JID-1656

@Pearl1594
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✔centos7 ✔debian. JID-1662

@yadvr
Copy link
Member

yadvr commented Aug 10, 2020

@blueorangutan package

@blueorangutan
Copy link

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

@yadvr yadvr closed this Aug 10, 2020
@yadvr yadvr reopened this Aug 10, 2020
@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✔centos7 ✔debian. JID-1705

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Trillian test result (tid-2380)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 43584 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4213-t2380-kvm-centos7.zip
Smoke tests completed. 83 look OK, 0 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File

@yadvr
Copy link
Member

yadvr commented Aug 13, 2020

@Pearl1594 pl address code review comments, send another PR for refactoring as necessary

@yadvr yadvr merged commit b68be66 into apache:4.14 Aug 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants