You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by devdeep <gi...@git.apache.org> on 2015/07/29 12:06:06 UTC
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
GitHub user devdeep opened a pull request:
https://github.com/apache/cloudstack/pull/635
CLOUDSTACK-8687: Prepare template only on a given storage pool
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.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/devdeep/cloudstack-1 CLOUDSTACK-8687
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cloudstack/pull/635.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #635
----
commit 746dddd6054a3a1453c8347ce0640e8941b8a6a7
Author: Devdeep Singh <de...@gmail.com>
Date: 2015-07-28T06:35:35Z
CLOUDSTACK-8687: 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
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by remibergsma <gi...@git.apache.org>.
Github user remibergsma commented on the pull request:
https://github.com/apache/cloudstack/pull/635#issuecomment-129228698
@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.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by remibergsma <gi...@git.apache.org>.
Github user remibergsma commented on the pull request:
https://github.com/apache/cloudstack/pull/635#issuecomment-132237794
@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!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by kishankavala <gi...@git.apache.org>.
Github user kishankavala commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/635#discussion_r35849002
--- Diff: api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java ---
@@ -60,6 +61,15 @@
description = "template ID of the template to be prepared in primary storage(s).")
private Long templateId;
+ @ACL(accessType = AccessType.OperateEntry)
+ @Parameter(name = ApiConstants.STORAGE_ID,
+ type = CommandType.UUID,
+ entityType = StoragePoolResponse.class,
+ required = false,
+ description = "storage pool ID of the primary storage pool to which the template should be prepared. If it is not provided the template" +
+ " is prepared on all the available primary storage pools.")
+ private Long storageId;
--- End diff --
better to use poolId ou storagePoolId instead of storageId to be consistent
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by DaanHoogland <gi...@git.apache.org>.
Github user DaanHoogland commented on the pull request:
https://github.com/apache/cloudstack/pull/635#issuecomment-125917105
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.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by DaanHoogland <gi...@git.apache.org>.
Github user DaanHoogland commented on the pull request:
https://github.com/apache/cloudstack/pull/635#issuecomment-128843113
@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.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by devdeep <gi...@git.apache.org>.
Github user devdeep commented on the pull request:
https://github.com/apache/cloudstack/pull/635#issuecomment-129411154
@DaanHoogland That is what I am looking into; how to get the number of threads that have been started by the executor service.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by DaanHoogland <gi...@git.apache.org>.
Github user DaanHoogland commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/635#discussion_r36286725
--- Diff: server/test/com/cloud/template/TemplateManagerImplTest.java ---
@@ -18,20 +18,369 @@
package com.cloud.template;
-import org.junit.Test;
+import com.cloud.agent.AgentManager;
+import com.cloud.api.query.dao.UserVmJoinDao;
+import com.cloud.dc.dao.DataCenterDao;
+import com.cloud.domain.dao.DomainDao;
+import com.cloud.event.dao.UsageEventDao;
import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.host.Status;
+import com.cloud.host.dao.HostDao;
+import com.cloud.projects.ProjectManager;
+import com.cloud.storage.StorageManager;
+import com.cloud.storage.StoragePool;
+import com.cloud.storage.VMTemplateStoragePoolVO;
+import com.cloud.storage.VMTemplateStorageResourceAssoc;
+import com.cloud.storage.VMTemplateVO;
+import com.cloud.storage.dao.GuestOSDao;
+import com.cloud.storage.dao.LaunchPermissionDao;
+import com.cloud.storage.dao.SnapshotDao;
+import com.cloud.storage.dao.StoragePoolHostDao;
+import com.cloud.storage.dao.VMTemplateDao;
+import com.cloud.storage.dao.VMTemplatePoolDao;
+import com.cloud.storage.dao.VMTemplateZoneDao;
+import com.cloud.storage.dao.VolumeDao;
+import com.cloud.user.AccountManager;
+import com.cloud.user.ResourceLimitService;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.utils.component.ComponentContext;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.vm.dao.UserVmDao;
+import com.cloud.vm.dao.VMInstanceDao;
+import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
+import org.apache.cloudstack.engine.subsystem.api.storage.StorageCacheManager;
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory;
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateService;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.framework.messagebus.MessageBus;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
+import org.apache.cloudstack.test.utils.SpringUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.core.type.classreading.MetadataReader;
+import org.springframework.core.type.classreading.MetadataReaderFactory;
+import org.springframework.core.type.filter.TypeFilter;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.support.AnnotationConfigContextLoader;
+
+import javax.inject.Inject;
+import java.io.IOException;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.anyBoolean;
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(loader = AnnotationConfigContextLoader.class)
public class TemplateManagerImplTest {
- TemplateManagerImpl tmgr = new TemplateManagerImpl();
+ @Inject
+ TemplateManagerImpl templateManager = new TemplateManagerImpl();
+
+ @Inject
+ DataStoreManager dataStoreManager;
+
+ @Inject
+ VMTemplateDao vmTemplateDao;
+
+ @Inject
+ VMTemplatePoolDao vmTemplatePoolDao;
+
+ @Inject
+ TemplateDataStoreDao templateDataStoreDao;
+
+ @Inject
+ StoragePoolHostDao storagePoolHostDao;
+
+ @Before
+ public void setUp() {
+ ComponentContext.initComponentsLifeCycle();
+ }
@Test(expected = InvalidParameterValueException.class)
public void testVerifyTemplateIdOfSystemTemplate() {
- tmgr.verifyTemplateId(1L);
+ templateManager.verifyTemplateId(1L);
}
public void testVerifyTemplateIdOfNonSystemTemplate() {
- tmgr.verifyTemplateId(1L);
+ templateManager.verifyTemplateId(1L);
+ }
+
+ @Test
+ public void testPrepareTemplateIsSeeded() {
+ VMTemplateVO mockTemplate = mock(VMTemplateVO.class);
+ when(mockTemplate.getId()).thenReturn(202l);
+
+ StoragePoolVO mockPool = mock(StoragePoolVO.class);
+ when(mockPool.getId()).thenReturn(2l);
+
+ PrimaryDataStore mockPrimaryDataStore = mock(PrimaryDataStore.class);
+ when(mockPrimaryDataStore.getId()).thenReturn(2l);
+
+ VMTemplateStoragePoolVO mockTemplateStore = mock(VMTemplateStoragePoolVO.class);
+ when(mockTemplateStore.getDownloadState()).thenReturn(VMTemplateStorageResourceAssoc.Status.DOWNLOADED);
+
+ when(dataStoreManager.getPrimaryDataStore(anyLong())).thenReturn(mockPrimaryDataStore);
+ when(vmTemplateDao.findById(anyLong(), anyBoolean())).thenReturn(mockTemplate);
+ when(vmTemplatePoolDao.findByPoolTemplate(anyLong(), anyLong())).thenReturn(mockTemplateStore);
+
+ doNothing().when(mockTemplateStore).setMarkedForGC(anyBoolean());
+
+ VMTemplateStoragePoolVO returnObject = templateManager.prepareTemplateForCreate(mockTemplate, (StoragePool) mockPrimaryDataStore);
--- End diff --
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.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by DaanHoogland <gi...@git.apache.org>.
Github user DaanHoogland commented on the pull request:
https://github.com/apache/cloudstack/pull/635#issuecomment-129408998
@devdeep How about testing if the right (number of) threads are being started? Does my comment make any sense?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by DaanHoogland <gi...@git.apache.org>.
Github user DaanHoogland commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/635#discussion_r36613344
--- Diff: api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java ---
@@ -60,6 +61,15 @@
description = "template ID of the template to be prepared in primary storage(s).")
private Long templateId;
+ @ACL(accessType = AccessType.OperateEntry)
+ @Parameter(name = ApiConstants.STORAGE_ID,
+ type = CommandType.UUID,
+ entityType = StoragePoolResponse.class,
+ required = false,
+ description = "storage pool ID of the primary storage pool to which the template should be prepared. If it is not provided the template" +
+ " is prepared on all the available primary storage pools.")
+ private Long storageId;
--- End diff --
@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.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by devdeep <gi...@git.apache.org>.
Github user devdeep closed the pull request at:
https://github.com/apache/cloudstack/pull/635
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by devdeep <gi...@git.apache.org>.
Github user devdeep commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/635#discussion_r35849928
--- Diff: api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java ---
@@ -60,6 +61,15 @@
description = "template ID of the template to be prepared in primary storage(s).")
private Long templateId;
+ @ACL(accessType = AccessType.OperateEntry)
+ @Parameter(name = ApiConstants.STORAGE_ID,
+ type = CommandType.UUID,
+ entityType = StoragePoolResponse.class,
+ required = false,
+ description = "storage pool ID of the primary storage pool to which the template should be prepared. If it is not provided the template" +
+ " is prepared on all the available primary storage pools.")
+ private Long storageId;
--- End diff --
@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.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by kishankavala <gi...@git.apache.org>.
Github user kishankavala commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/635#discussion_r35862098
--- Diff: api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java ---
@@ -60,6 +61,15 @@
description = "template ID of the template to be prepared in primary storage(s).")
private Long templateId;
+ @ACL(accessType = AccessType.OperateEntry)
+ @Parameter(name = ApiConstants.STORAGE_ID,
+ type = CommandType.UUID,
+ entityType = StoragePoolResponse.class,
+ required = false,
+ description = "storage pool ID of the primary storage pool to which the template should be prepared. If it is not provided the template" +
+ " is prepared on all the available primary storage pools.")
+ private Long storageId;
--- End diff --
@devdeep LGTM if storageId is consistent across APIs
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by remibergsma <gi...@git.apache.org>.
Github user remibergsma commented on the pull request:
https://github.com/apache/cloudstack/pull/635#issuecomment-132237051
Travis error is due to timeout.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by remibergsma <gi...@git.apache.org>.
Github user remibergsma commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/635#discussion_r36592822
--- Diff: api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java ---
@@ -60,6 +61,15 @@
description = "template ID of the template to be prepared in primary storage(s).")
private Long templateId;
+ @ACL(accessType = AccessType.OperateEntry)
+ @Parameter(name = ApiConstants.STORAGE_ID,
+ type = CommandType.UUID,
+ entityType = StoragePoolResponse.class,
+ required = false,
+ description = "storage pool ID of the primary storage pool to which the template should be prepared. If it is not provided the template" +
+ " is prepared on all the available primary storage pools.")
+ private Long storageId;
--- End diff --
@kishankavala That's a conditional LGTM ;-) Please let me know if you LGTM as-is, or that you want something changed before LGTM. Thanks!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by remibergsma <gi...@git.apache.org>.
Github user remibergsma commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/635#discussion_r36620562
--- Diff: api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java ---
@@ -60,6 +61,15 @@
description = "template ID of the template to be prepared in primary storage(s).")
private Long templateId;
+ @ACL(accessType = AccessType.OperateEntry)
+ @Parameter(name = ApiConstants.STORAGE_ID,
+ type = CommandType.UUID,
+ entityType = StoragePoolResponse.class,
+ required = false,
+ description = "storage pool ID of the primary storage pool to which the template should be prepared. If it is not provided the template" +
+ " is prepared on all the available primary storage pools.")
+ private Long storageId;
--- End diff --
Ok, thanks for clarifying!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by devdeep <gi...@git.apache.org>.
Github user devdeep commented on the pull request:
https://github.com/apache/cloudstack/pull/635#issuecomment-132439804
@remibergsma I'll close this pull request and generate a new one where the unit tests are squashed in one commit.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by devdeep <gi...@git.apache.org>.
Github user devdeep commented on the pull request:
https://github.com/apache/cloudstack/pull/635#issuecomment-132072881
@DaanHoogland added some additional tests to validate the templates get scheduled for seeding.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by DaanHoogland <gi...@git.apache.org>.
Github user DaanHoogland commented on the pull request:
https://github.com/apache/cloudstack/pull/635#issuecomment-127946635
@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.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by devdeep <gi...@git.apache.org>.
Github user devdeep commented on the pull request:
https://github.com/apache/cloudstack/pull/635#issuecomment-127850003
@DaanHoogland Added unit tests for prepare template functionality too. Can you take a look.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by DaanHoogland <gi...@git.apache.org>.
Github user DaanHoogland commented on the pull request:
https://github.com/apache/cloudstack/pull/635#issuecomment-131242854
@devdeep do you have plans to add further testing? I think for the sake of testing you can change the encapsulation level.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by DaanHoogland <gi...@git.apache.org>.
Github user DaanHoogland commented on the pull request:
https://github.com/apache/cloudstack/pull/635#issuecomment-127918187
will do but a bit busy today, hang on
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by DaanHoogland <gi...@git.apache.org>.
Github user DaanHoogland commented on the pull request:
https://github.com/apache/cloudstack/pull/635#issuecomment-132174594
@devdeep look great. one question but LGTM
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by devdeep <gi...@git.apache.org>.
Github user devdeep commented on the pull request:
https://github.com/apache/cloudstack/pull/635#issuecomment-128292255
@DaanHoogland When prepareTemplate is called, it either falls into prepareTemplateInOneStoragePool if one primary has to be seeded with the template; or prepareTemplateInAllAllStoragePool for seeding templates in all primary pools available. prepareTemplateInAllStoragePool also calls prepareTemplateInOneStoragePool for seeding the template. prepareTemplateInOneStoragePool schedules the template to seeded 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
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by devdeep <gi...@git.apache.org>.
Github user devdeep commented on the pull request:
https://github.com/apache/cloudstack/pull/635#issuecomment-131020409
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.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request: CLOUDSTACK-8687: Prepare template only on...
Posted by DaanHoogland <gi...@git.apache.org>.
Github user DaanHoogland commented on the pull request:
https://github.com/apache/cloudstack/pull/635#issuecomment-129412845
You can mock the call and verify how often it has been called with mockito.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---