Resource fetching missing projectid: "-1" parameter

Open Beginner friendly
#14,070 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript
Domain
frontend

Research direction

Start in ui/src/components/view/VolumesTab.vue, at the getVolumes method and its listVolumes API call. Verify the request includes projectid: "-1", then reproduce the listed project-scope scenario and confirm the instance's Volumes tab displays its volumes in the default view.

Written by the indexing model from the issue text.

Description

bug component:projects component:UI
problem

When viewing a resource, for example an instance, that is currently in a project that differs from the currently selected or global project scope, it will attempt to fetch volumes yet none will return as it is only filtering on the ones that are owned by this user (not the project user).

Image
versions

The only relevant version is the UI and management server; replicated on 4.23.0.0. Also replicated this issue to the current HEAD of main.

The steps to reproduce the bug
  1. Create a project "test".
  2. Create (for example) and instance under that project "instance-01".
  3. (Optionally) add another volume to this instance.
  4. Make sure you have no project enabled at the top of the page ("Default view").
  5. Go to instances, turn on the project slider and select "instance-01" in the list.
  6. Browse to the Volumes tab and notice that this list is empty.
What to do about it?

Add the {projectid: "-1"} parameter to this API call. Unsure whether this happens to other resources (like NICs), I have not tested this.

diff --git a/ui/src/components/view/VolumesTab.vue b/ui/src/components/view/VolumesTab.vue
index b65933a643..e4679c02dc 100644
--- a/ui/src/components/view/VolumesTab.vue
+++ b/ui/src/components/view/VolumesTab.vue
@@ -141,7 +141,7 @@ export default {
       }
     },
     getVolumes () {
-      getAPI('listVolumes', { listall: true, listsystemvms: true, virtualmachineid: this.vm.id }).then(json => {
+      getAPI('listVolumes', { listall: true, listsystemvms: true, projectid: "-1", virtualmachineid: this.vm.id }).then(json => {
         this.volumes = json.listvolumesresponse.volume
         if (this.volumes) {
           this.volumes.sort((a, b) => { return a.deviceid - b.deviceid })
Dominant language
Java
Stars
3.1k
Forks
1.4k
Avg merge
7d 5h
Merged PRs (30d)
28

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/cloudstack

All issues in apache/cloudstack

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.