Skip to content

include all VMs when projects selected not just for admins - #7667

Merged
DaanHoogland merged 2 commits into
apache:4.18from
shapeblue:projectAndNormalVMs
Aug 3, 2023
Merged

DaanHoogland merged 2 commits into
apache:4.18from
shapeblue:projectAndNormalVMs

Conversation

@DaanHoogland

Copy link
Copy Markdown
Contributor

Description

This PR makes so that when project=-1 and listall=true, listVMsMetricsCmd returns all VMs for the user, the same as for admin.

Fixes: #7642

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)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

@DaanHoogland DaanHoogland added this to the 4.18.1.0 milestone Jun 21, 2023
@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SF] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@codecov

codecov Bot commented Jun 21, 2023 •

Copy link
Copy Markdown

Codecov Report

Merging #7667 (9a804ee) into 4.18 (a2eb103) will increase coverage by 0.00%.
The diff coverage is 0.00%.

@@            Coverage Diff            @@
##               4.18    #7667   +/-   ##
=========================================
  Coverage     13.02%   13.02%           
- Complexity     9030     9031    +1     
=========================================
  Files          2720     2720           
  Lines        257001   257001           
  Branches      40083    40083           
=========================================
+ Hits          33463    33465    +2     
+ Misses       219337   219334    -3     
- Partials       4201     4202    +1     
Files Changed Coverage Δ
...ain/java/com/cloud/api/query/QueryManagerImpl.java 2.99% <0.00%> (ø)
...c/main/java/com/cloud/user/AccountManagerImpl.java 20.40% <0.00%> (ø)

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 6293

@DaanHoogland DaanHoogland changed the title include all files when project selected not just for admins include all VMs when projects selected not just for admins Jun 21, 2023
@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@blueorangutan test keepEnv

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-6798)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 47781 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7667-t6798-kvm-centos7.zip
Smoke tests completed. 107 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_migrate_VM_and_root_volume Error 79.89 test_vm_life_cycle.py
test_02_migrate_VM_with_two_data_disks Error 60.55 test_vm_life_cycle.py

}
}
if (listAll) {
domainIdRecursiveListProject.third(ListProjectResourcesCriteria.ListAllIncludingProjectResources);

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, should we worry if there could be negative consequences? (I'm asking to understand why this case was previously suported for admin only).

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

Code LGTM, the listAll check should certainly work for all users but I'm not sure about any side-effects. Any manual QA/review would be great (as different user types/roles - both account and project roles).

@DaanHoogland
DaanHoogland marked this pull request as ready for review July 3, 2023 09:16
@kiranchavala

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@kiranchavala a [SF] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 6515

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

@DaanHoogland

During Manual testing, I was unable to view the VMs and from my project's vm

Steps followed

1. Create a normal user role account under root domain
2. Login with the normal user account
3. Create a project
4. Change the view to project
5. Deploy a vm

6. Change the view back to normal
7. Deploy a vm 

unable to view the 2 vm in normal view

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@DaanHoogland

During Manual testing, I was unable to view the VMs and from my project's vm

Steps followed

1. Create a normal user role account under root domain
2. Login with the normal user account
3. Create a project
4. Change the view to project
5. Deploy a vm

6. Change the view back to normal
7. Deploy a vm 

unable to view the 2 vm in normal view

I see what you mean @kiranchavala . this fix is API only (so far) I will look ate the UI as well.

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

code lgtm

@DaanHoogland
DaanHoogland marked this pull request as draft July 27, 2023 09:05
@DaanHoogland
DaanHoogland force-pushed the projectAndNormalVMs branch from 8841145 to c8e2f3d Compare July 27, 2023 09:11
@DaanHoogland
DaanHoogland force-pushed the projectAndNormalVMs branch from 2becf79 to 9a804ee Compare July 31, 2023 06:49
@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SF] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@DaanHoogland
DaanHoogland marked this pull request as ready for review July 31, 2023 06:50
@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@kiranchavala , I tested this with the API. It should work as expected now. Sorry for the extra work.
ua : user/account
up : user/project
dp : domain/project
da : not visible ;)

(luser) 🐱 > list virtualmachines listall=true projectid=-1 filter=name
{
  "count": 3,
  "virtualmachine": [
    {
      "name": "up"
    },
    {
      "name": "ua"
    },
    {
      "name": "dp"
    }
  ]
}

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 6607

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@kiranchavala

Copy link
Copy Markdown
Member

@kiranchavala , I tested this with the API. It should work as expected now. Sorry for the extra work. ua : user/account up : user/project dp : domain/project da : not visible ;)

(luser) 🐱 > list virtualmachines listall=true projectid=-1 filter=name
{
  "count": 3,
  "virtualmachine": [
    {
      "name": "up"
    },
    {
      "name": "ua"
    },
    {
      "name": "dp"
    }
  ]
}

@DaanHoogland is the fix only for API or is UI also included ?

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@DaanHoogland is the fix only for API or is UI also included ?

The issue is API only, I checked the UI and it works without changes

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

@DaanHoogland

The api calls are working fine but the in the UI (default view) , I am not able to view the vm's which belonging to a project view

list virtualmachines listall=true projectid=-1 filter=name
list virtualmachinesmetrics listall=true projectid=-1 filter=name

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

The api calls are working fine but the in the UI (default view) , I am not able to view the vm's which belonging to a project view

I just tested again and it works. Can you expand on your test procedure?

@kiranchavala

Copy link
Copy Markdown
Member

@DaanHoogland

Please find the steps that i followed

  1. Create a normal user-role account

  2. Login as the user account

  3. Create a project

  4. Change the view to project

  5. Launch a vm

userview

  1. Change the view back to the default view

  2. I am not able to view the vm which was launched from the project in the default view

defaultview

@kiranchavala kiranchavala 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, Tested manually

Able to view the project view instances instances in the default view

image

@kiranchavala

Copy link
Copy Markdown
Member

@DaanHoogland

Please find the steps that i followed

1. Create a normal user-role account

2. Login as the user account

3. Create a project

4. Change the view to project

5. Launch a vm

userview

6. Change the view back to the default view

7. I am not able to view the vm which was launched from the project in the default view

defaultview

Its working fine forgot to toggle the projects

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.

UI/API: Not showing all my VMs as normal users when projects is selected

7 participants