Repository navigation
Conversation
only on a given primary storage. Currently, the prepare template api will seed/prepare a given template on all the primary storage pools in a zone. If however, a user wishes to prepare a template only a particular storage pool, it isn't possible. Updated the api to take storage pool id as an optional parameter. If the pool id is provided then the template is prepared only on the given primary storage pool
|
cloudstack-pull-rats #147 SUCCESS |
|
please add unit- or integration tests. for instance for prepareTemplate, prepareTemplateInOneStoragePool and prepareTemplateInAllStoragePools to show that expected behavior stays the same and new behavior is proven. |
|
cloudstack-pull-requests #845 UNSTABLE |
|
cloudstack-pull-analysis #80 SUCCESS |
There was a problem hiding this comment.
better to use poolId or storagePoolId instead of storageId to be consistent
There was a problem hiding this comment.
@kishankavala There isn't a poolid or storagePoolid constant available in apiconstants. I had looked for it and couldn't find it. Moreover, storageId is the parameter name used through the apis whenever a primary storage pool is referred, for example in list/update/migrate volumes, volume response etc. So I decided to use storageId here too for consistency, instead of defining a new one.
There was a problem hiding this comment.
@devdeep LGTM if storageId is consistent across APIs
There was a problem hiding this comment.
@kishankavala That's a conditional LGTM ;-) Please let me know if you LGTM as-is, or that you want something changed before LGTM. Thanks!
There was a problem hiding this comment.
@remibergsma, @kishankavala is concurring with the observation by @devdeep that his call was good in the name of consistency. I think he was being unconditional about his LGTM.
There was a problem hiding this comment.
Ok, thanks for clarifying!
|
cloudstack-pull-rats #204 ABORTED |
|
cloudstack-pull-requests #901 ABORTED |
|
cloudstack-pull-analysis #137 FAILURE |
|
@DaanHoogland Added unit tests for prepare template functionality too. Can you take a look. |
|
will do but a bit busy today, hang on |
There was a problem hiding this comment.
You are testing another method then the ones you changed. Why?
The test seems to make sense and please keep it but it doesn't test
prepareTemplate(long templateId, long zoneId, Long storageId)
or
prepareTemplateInOneStoragePool(final VMTemplateVO template, final StoragePoolVO pool)
which are the one you changed and the one you added.
|
@devdeep the test you added seems fine and passes (the assert messages look like they can be better formulated to describe what went wrong) |
|
@DaanHoogland When prepareTemplate is called, it either falls into prepareTemplateInOneStoragePool if one primary has to be seeded with the template; or into prepareTemplateInAllStoragePool for seeding template in all primary pools available. prepareTemplateInAllStoragePool too calls into prepareTemplateInOneStoragePool for seeding the template. prepareTemplateInOneStoragePool schedules a thread to seeded the template on a given primary storage. The actual work of seeding the template is done by prepareTemplateForCreate. Their were no unit tests for this routine. I have written unit tests for the same. It was more meaningful to write tests for this routine, as it is here, where the actual work happens. prepareTemplate and prepareTemplateInOneStoragePool just schedule a thread/executor to seed the primary pools. |
|
@devdeep You have written a very fine test and as it passes and tests what its target should do you would get a definate lgtm on tat one from me. However it does not test the code that was changed in this PR so it should be submitted separately and the code here should be tested in this PR. let's ask the RMs, @remibergsma and @karuturi. If they think it is fine to add it like this I will let them. The code looks ok but the PR doesn't to me. |
|
@DaanHoogland So, you suggest putting the new tests in a separate PR and add relevant unit tests that test the change in this PR? That sounds good to me. Let's change one thing per PR. @devdeep can you align with @DaanHoogland on this please? Once that is done I'll merge it. |
|
@devdeep How about testing if the right (number of) threads are being started? Does my comment make any sense? |
|
@DaanHoogland That is what I am looking into; how to get the number of threads that have been started by the executor service. |
|
You can mock the call and verify how often it has been called with mockito. |
…late functionality. This validated the prepareTemplate function itself.
|
Added another test to validate the prepareTemplate function. Looked into if it was possible to mock the threadpool executor service in templatemanagerimpl. However, it is currently a private member and I couldn't find a way to mock it. |
|
cloudstack-pull-rats #296 SUCCESS |
|
cloudstack-pull-requests #993 UNSTABLE |
|
cloudstack-pull-analysis #229 SUCCESS |
|
@devdeep do you have plans to add further verification to this test or further testing? I think for the sake of testing you can change the encapsulation level. |
|
@DaanHoogland added some additional tests to validate the templates get scheduled for seeding. |
…d for seeding. If a pool is disabled or the pool is in another zone, make sure the template isn't scheduled for seeding on the storage pool.
|
cloudstack-pull-rats #338 ABORTED |
|
cloudstack-pull-requests #1033 ABORTED |
|
cloudstack-pull-analysis #270 SUCCESS |
|
@devdeep look great. one question but LGTM |
|
Travis error is due to timeout. |
|
@devdeep Could you please make your commit message (first line) more descriptive? Right now I cannot tell the difference between them, unless I click on them and read it all. Thanks! |
|
@remibergsma I'll close this pull request and generate a new one where the unit tests are squashed in one commit. |
Update prepare template api to seed/prepare a template only on a given primary storage. Currently, the prepare template api will seed/prepare a given template on all the primary storage pools in a zone. If however, a user wishes to prepare a template only a particular storage pool, it isn't possible. Updated the api to take storage pool id as an optional parameter. If the pool id is provided then the template is prepared only on the given primary storage pool.
Following scenarios were tested. 1) Prepared a template with out the storage pool id. The template was seeded on all the available pools in the given zone. 2) Prepared a template with storage pool id as a parameter in the api. The template was seeded only on the given primary storage pool.