Skip to content

CLOUDSTACK-8687: Prepare template only on a given storage pool - #635

Closed
devdeep wants to merge 4 commits into
apache:masterfrom
devdeep:CLOUDSTACK-8687
Closed

devdeep wants to merge 4 commits into
apache:masterfrom
devdeep:CLOUDSTACK-8687

Conversation

@devdeep

@devdeep devdeep commented Jul 29, 2015

Copy link
Copy Markdown
Contributor

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.

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
@asfbot

asfbot commented Jul 29, 2015

Copy link
Copy Markdown

cloudstack-pull-rats #147 SUCCESS
This pull request looks good

@DaanHoogland

Copy link
Copy Markdown
Contributor

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.

@asfbot

asfbot commented Jul 29, 2015

Copy link
Copy Markdown

cloudstack-pull-requests #845 UNSTABLE
Looks like there's a problem with this pull request

@asfbot

asfbot commented Jul 29, 2015

Copy link
Copy Markdown

cloudstack-pull-analysis #80 SUCCESS
This pull request looks good

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

better to use poolId or storagePoolId instead of storageId to be consistent

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@devdeep LGTM if storageId is consistent across APIs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@kishankavala That's a conditional LGTM ;-) Please let me know if you LGTM as-is, or that you want something changed before LGTM. Thanks!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, thanks for clarifying!

@asfbot

asfbot commented Aug 4, 2015

Copy link
Copy Markdown

cloudstack-pull-rats #204 ABORTED

@asfbot

asfbot commented Aug 4, 2015

Copy link
Copy Markdown

cloudstack-pull-requests #901 ABORTED

@asfbot

asfbot commented Aug 4, 2015

Copy link
Copy Markdown

cloudstack-pull-analysis #137 FAILURE
Looks like there's a problem with this pull request

@devdeep

devdeep commented Aug 5, 2015

Copy link
Copy Markdown
Contributor Author

@DaanHoogland Added unit tests for prepare template functionality too. Can you take a look.

@DaanHoogland

Copy link
Copy Markdown
Contributor

will do but a bit busy today, hang on

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@DaanHoogland

Copy link
Copy Markdown
Contributor

@devdeep the test you added seems fine and passes (the assert messages look like they can be better formulated to describe what went wrong)
I do not understand the relevance to these test with respect to the changed code though.
Don't get me wrong, you wrote a fine set of additional tests and cloudstack is not an easy book to read so I might be misreading your test. I would like it to be clear and obvious that the added tests test what has been changed in this PR.

@devdeep

devdeep commented Aug 6, 2015

Copy link
Copy Markdown
Contributor Author

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

@DaanHoogland

Copy link
Copy Markdown
Contributor

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

@remibergsma

Copy link
Copy Markdown
Contributor

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

@DaanHoogland

Copy link
Copy Markdown
Contributor

@devdeep How about testing if the right (number of) threads are being started? Does my comment make any sense?

@devdeep

devdeep commented Aug 10, 2015

Copy link
Copy Markdown
Contributor Author

@DaanHoogland That is what I am looking into; how to get the number of threads that have been started by the executor service.

@DaanHoogland

Copy link
Copy Markdown
Contributor

You can mock the call and verify how often it has been called with mockito.

…late

functionality. This validated the prepareTemplate function itself.
@devdeep

devdeep commented Aug 14, 2015

Copy link
Copy Markdown
Contributor Author

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.

@asfbot

asfbot commented Aug 14, 2015

Copy link
Copy Markdown

cloudstack-pull-rats #296 SUCCESS
This pull request looks good

@asfbot

asfbot commented Aug 14, 2015

Copy link
Copy Markdown

cloudstack-pull-requests #993 UNSTABLE
Looks like there's a problem with this pull request

@asfbot

asfbot commented Aug 14, 2015

Copy link
Copy Markdown

cloudstack-pull-analysis #229 SUCCESS
This pull request looks good

@DaanHoogland

Copy link
Copy Markdown
Contributor

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

@devdeep

devdeep commented Aug 18, 2015

Copy link
Copy Markdown
Contributor Author

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

asfbot commented Aug 18, 2015

Copy link
Copy Markdown

cloudstack-pull-rats #338 ABORTED

@asfbot

asfbot commented Aug 18, 2015

Copy link
Copy Markdown

cloudstack-pull-requests #1033 ABORTED

@asfbot

asfbot commented Aug 18, 2015

Copy link
Copy Markdown

cloudstack-pull-analysis #270 SUCCESS
This pull request looks good

@DaanHoogland

Copy link
Copy Markdown
Contributor

@devdeep look great. one question but LGTM

@remibergsma

Copy link
Copy Markdown
Contributor

Travis error is due to timeout.

@remibergsma

Copy link
Copy Markdown
Contributor

@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!

@devdeep

devdeep commented Aug 19, 2015

Copy link
Copy Markdown
Contributor Author

@remibergsma I'll close this pull request and generate a new one where the unit tests are squashed in one commit.

@devdeep devdeep closed this Aug 19, 2015
@devdeep
devdeep deleted the CLOUDSTACK-8687 branch August 19, 2015 04:08
yadvr pushed a commit that referenced this pull request Jan 20, 2021
…636)

Fixes #635

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants