ravening opened a new issue #4195:
URL: https://github.com/apache/cloudstack/issues/4195
<!--
Verify first that your issue/request is not already reported on GitHub.
Also test if the latest release and master branch are affected too.
Always add information AFTER of these HTML comments, but no need to delete
the comments.
-->
##### ISSUE TYPE
<!-- Pick one below and delete the rest -->
* Bug Report
##### COMPONENT NAME
<!--
Categorize the issue, e.g. API, VR, VPN, UI, etc.
-->
~~~
API, Server
~~~
##### CLOUDSTACK VERSION
<!--
New line separated list of affected versions, commit ID for issues on master
branch.
-->
~~~
4.14.0.0
~~~
##### OS / ENVIRONMENT
<!--
Information about the environment if relevant, N/A otherwise
-->
Ubuntu16
##### SUMMARY
<!-- Explain the problem/feature briefly -->
The count value returned by listDiskofferings api is different from total
number of actual returned elements.
##### STEPS TO REPRODUCE
<!--
For bugs, show exactly how to reproduce the problem, using a minimal
test-case. Use Screenshots if accurate.
For new features, show how the feature would be used.
-->
<!-- Paste example playbooks or commands between quotes below -->
~~~
1. Create a domain under ROOT called "test1"
2. Create a child domain for "test1" called "test1-child"
3. Create disk offerings ONLY for the domain "test1-child"
4. Login as "test1" domain in cloudmonkey using cloudmonkey -p test1
5. Run the list diskofferings command with and without isrecursive flag
~~~
<!-- You can also paste gist.github.com links for larger files -->
##### EXPECTED RESULTS
<!-- What did you expect to happen when running the steps above? -->
~~~
Without isrecursive flag I should see a total of 9 items returned as the
count says 9
With isrecursive flag set to true, I should see a total of 9 elements
returned as the count says 9
~~~
##### ACTUAL RESULTS
<!-- What actually happened? -->
<!-- Paste verbatim command output between quotes below -->
~~~
Without isrecursive flag I see only 6 elements returned
(test1) 🐵 > list diskofferings filter=name
{
"count": 9, <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
"diskoffering": [
{
"name": "Small"
},
{
"name": "Medium"
},
{
"name": "Large"
},
{
"name": "Custom"
},
{
"name": "root-offering"
},
{
"name": "test1"
}
]
}
With isrecursive=true, I see 8 items returned
(test1) 🐵 > list diskofferings filter=name isrecursive=true
{
"count": 9, <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
"diskoffering": [
{
"name": "Small"
},
{
"name": "Medium"
},
{
"name": "Large"
},
{
"name": "Custom"
},
{
"name": "test-11"
},
{
"name": "test1"
},
{
"name": "test-11-only"
},
{
"name": "child-domain-test-11"
}
]
}
~~~
@rhtyd @shwstppr
what should the `count` variable contain here?
In the code `server/src/main/java/com/cloud/api/query/QueryManagerImpl.java`
function `searchForDiskOfferingsInternal`, I see that if `isrecursive=true` is
passed, it is doing some filtering on the list but it does not return the final
size of the list instead it returns the initial size of the list
```
return new Pair<>(result.first(), result.second());
```
Instead, it should return
```
return new Pair<>(result.first(), result.first().size());
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]