You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "winterhazel (via GitHub)" <gi...@apache.org> on 2025/02/11 02:42:28 UTC
[PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
winterhazel opened a new pull request, #10364:
URL: https://github.com/apache/cloudstack/pull/10364
### Description
Currently, data migration across secondary storages does not migrate public templates that have URLs (only private templates and public templates that do not have URLs are migrated) because, when this feature was implemented, it was assumed that these templates would automatically be downloaded when to newly added secondary storages. However, that's not always the case, as URLs can become inaccessible (unable to download the template), and their templates can be updated (unable to install due to checksum mismatch). This forces operators to manually move the templates inside the storage.
This PR solves this issue by allowing the migration of public templates that have URLs.
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] Enhancement (improves an existing feature and functionality)
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
### Feature/Enhancement Scale or Bug Severity
#### Feature/Enhancement Scale
- [ ] Major
- [X] Minor
### How Has This Been Tested?
In an environment with the following templates:
- Public with URL: `a`, `b`, `c`
- Public without URL: `t`
- Private with URL: `System VM Template (KVM)`, `z`
And two secondary storages:
- `nfs-1`: has all the templates
- `nfs-2`: has `b`, `c` (all public templates except `a`)
I did the following tests:
1. I restarted the SSVM. Then, I verified that it began to download templates `a` and `System VM Template (KVM)` to `nfs-2`
2. While the templates were downloading, I called `migrateSecondaryStorageData` to migrate the data from `nfs-1` to `nfs-2`
3. After the migration ended, I verified that all templates in `nfs-1` were moved to `nfs-2`. I also verified that there were no duplicate template entries, and that the `install_path` of the new entries matched the template's path in `nfs-2`
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2649695397
## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/10364?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 4.01%. Comparing base [(`2654890`)](https://app.codecov.io/gh/apache/cloudstack/commit/2654890e868a5a94412126be8aa920888e62cff4?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`0620b7f`)](https://app.codecov.io/gh/apache/cloudstack/commit/0620b7fa1e2bc9eb0e156d7472cd1e9ea5e9434e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 6 commits behind head on main.
> :exclamation: There is a different number of reports uploaded between BASE (2654890) and HEAD (0620b7f). Click for more details.
>
> <details><summary>HEAD has 1 upload less than BASE</summary>
>
>| Flag | BASE (2654890) | HEAD (0620b7f) |
>|------|------|------|
>|unittests|1|0|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #10364 +/- ##
=============================================
- Coverage 16.02% 4.01% -12.02%
=============================================
Files 5658 395 -5263
Lines 496312 32452 -463860
Branches 60109 5743 -54366
=============================================
- Hits 79536 1302 -78234
+ Misses 407927 31001 -376926
+ Partials 8849 149 -8700
```
| [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/10364/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/10364/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.01% <ø> (-0.01%)` | :arrow_down: |
| [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/10364/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/cloudstack/pull/10364?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2754066116
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 12893
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2760352078
<b>[SF] Trillian test result (tid-12834)</b>
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 53309 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr10364-t12834-kvm-ol8.zip
Smoke tests completed. 141 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:
Test | Result | Time (s) | Test File
--- | --- | --- | ---
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland merged PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "winterhazel (via GitHub)" <gi...@apache.org>.
winterhazel commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2685799964
@blueorangutan package
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "winterhazel (via GitHub)" <gi...@apache.org>.
winterhazel commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2649687387
@blueorangutan package
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2758365551
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2752030984
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 12885
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "winterhazel (via GitHub)" <gi...@apache.org>.
winterhazel commented on code in PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#discussion_r1951828167
##########
engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/SecondaryStorageServiceImpl.java:
##########
@@ -160,6 +157,69 @@ public AsyncCallFuture<DataObjectResult> migrateData(DataObject srcDataObject, D
return future;
}
+ /**
+ * Returns a boolean indicating whether a template is ready on the provided data store. If the template is being downloaded,
+ * waits until the download finishes.
+ * @param srcDataObject the template.
+ * @param destDatastore the data store.
+ */
+ protected boolean templateIsOnDestination(DataObject srcDataObject, DataStore destDatastore) {
+ if (!(srcDataObject instanceof TemplateInfo)) {
+ return false;
+ }
+
+ String templateAsString = srcDataObject.getTO().toString();
+ String destDatastoreAsString = destDatastore.getTO().toString();
+ TemplateDataStoreVO templateStoreVO;
+
+ long timer = getTemplateDownloadTimeoutInSeconds();
+ int secondsToSleep = 10;
+ int previousDownloadPercentage = -1;
+
+ while (true) {
+ templateStoreVO = templateStoreDao.findByStoreTemplate(destDatastore.getId(), srcDataObject.getId());
+ if (templateStoreVO == null) {
+ logger.debug("{} is not present at destination [{}].", templateAsString, destDatastoreAsString);
+ return false;
+ }
+ VMTemplateStorageResourceAssoc.Status downloadState = templateStoreVO.getDownloadState();
+ if (downloadState == null || !VMTemplateStorageResourceAssoc.PENDING_DOWNLOAD_STATES.contains(downloadState)) {
+ break;
+ }
+ if (previousDownloadPercentage == templateStoreVO.getDownloadPercent()) {
+ timer -= secondsToSleep;
+ } else {
+ timer = getTemplateDownloadTimeoutInSeconds();
+ }
+ if (timer <= 0) {
+ throw new CloudRuntimeException(String.format("Timeout while waiting for %s to be downloaded to image store [%s]. " +
+ "The download percentage has not changed for %d seconds.", templateAsString, destDatastoreAsString, getTemplateDownloadTimeoutInSeconds()));
+ }
+ waitForTemplateDownload(secondsToSleep, templateAsString, destDatastoreAsString);
+ }
+
+ if (templateStoreVO.getState() == ObjectInDataStoreStateMachine.State.Ready) {
+ logger.debug("{} already exists on destination [{}].", templateAsString, destDatastoreAsString);
+ return true;
+ }
+ return false;
+ }
+
+ protected long getTemplateDownloadTimeoutInSeconds() {
+ return 1800L;
+ }
Review Comment:
The actual template download timeout is also hard-coded in a method (`com.cloud.storage.download.DownloadActiveState#handleTimeout`). I'm planning on making this timeout configurable in a separate PR, so for this one I'll just adjust so that they match the same value.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2754122728
@winterhazel , it seems something in https://github.com/apache/cloudstack/pull/10364/files#diff-70d3c567cc7f97b4ac1a9e41f86723ba74291feacc95c0a2c0a6623458eaa92d causes timeouts .
```
17:59:14 [INFO] Running org.apache.cloudstack.storage.image.SecondaryStorageServiceImplTest
18:29:14 Build timed out (after 30 minutes). Marking the build as failed.
18:29:14 New run name is '#14896-10364'
18:29:14 Build was aborted
```
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2649760577
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12402
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2685993081
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 12587
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#discussion_r1950496622
##########
engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/SecondaryStorageServiceImpl.java:
##########
@@ -160,6 +157,69 @@ public AsyncCallFuture<DataObjectResult> migrateData(DataObject srcDataObject, D
return future;
}
+ /**
+ * Returns a boolean indicating whether a template is ready on the provided data store. If the template is being downloaded,
+ * waits until the download finishes.
+ * @param srcDataObject the template.
+ * @param destDatastore the data store.
+ */
+ protected boolean templateIsOnDestination(DataObject srcDataObject, DataStore destDatastore) {
+ if (!(srcDataObject instanceof TemplateInfo)) {
+ return false;
+ }
+
+ String templateAsString = srcDataObject.getTO().toString();
+ String destDatastoreAsString = destDatastore.getTO().toString();
+ TemplateDataStoreVO templateStoreVO;
+
+ long timer = getTemplateDownloadTimeoutInSeconds();
+ int secondsToSleep = 10;
+ int previousDownloadPercentage = -1;
+
+ while (true) {
+ templateStoreVO = templateStoreDao.findByStoreTemplate(destDatastore.getId(), srcDataObject.getId());
+ if (templateStoreVO == null) {
+ logger.debug("{} is not present at destination [{}].", templateAsString, destDatastoreAsString);
+ return false;
+ }
+ VMTemplateStorageResourceAssoc.Status downloadState = templateStoreVO.getDownloadState();
+ if (downloadState == null || !VMTemplateStorageResourceAssoc.PENDING_DOWNLOAD_STATES.contains(downloadState)) {
+ break;
+ }
+ if (previousDownloadPercentage == templateStoreVO.getDownloadPercent()) {
+ timer -= secondsToSleep;
+ } else {
+ timer = getTemplateDownloadTimeoutInSeconds();
+ }
+ if (timer <= 0) {
+ throw new CloudRuntimeException(String.format("Timeout while waiting for %s to be downloaded to image store [%s]. " +
+ "The download percentage has not changed for %d seconds.", templateAsString, destDatastoreAsString, getTemplateDownloadTimeoutInSeconds()));
+ }
+ waitForTemplateDownload(secondsToSleep, templateAsString, destDatastoreAsString);
+ }
+
+ if (templateStoreVO.getState() == ObjectInDataStoreStateMachine.State.Ready) {
+ logger.debug("{} already exists on destination [{}].", templateAsString, destDatastoreAsString);
+ return true;
+ }
+ return false;
+ }
+
+ protected long getTemplateDownloadTimeoutInSeconds() {
+ return 1800L;
+ }
Review Comment:
hard-coded in a method? better either a setting or a static final.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "winterhazel (via GitHub)" <gi...@apache.org>.
winterhazel commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2751890709
@blueorangutan package
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2758358643
@blueorangutan test
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2758348498
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12902
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "winterhazel (via GitHub)" <gi...@apache.org>.
winterhazel commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2754308255
> @winterhazel , it seems something in https://github.com/apache/cloudstack/pull/10364/files#diff-70d3c567cc7f97b4ac1a9e41f86723ba74291feacc95c0a2c0a6623458eaa92d causes timeouts .
>
> ```
> 17:59:14 [INFO] Running org.apache.cloudstack.storage.image.SecondaryStorageServiceImplTest
> 18:29:14 Build timed out (after 30 minutes). Marking the build as failed.
> 18:29:14 New run name is '#14896-10364'
> 18:29:14 Build was aborted
> ```
Will take a look.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2685804388
@winterhazel a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2649688614
@winterhazel a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2687445092
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 12597
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2751896712
@winterhazel a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "winterhazel (via GitHub)" <gi...@apache.org>.
winterhazel commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2758084319
> @winterhazel , it seems something in https://github.com/apache/cloudstack/pull/10364/files#diff-70d3c567cc7f97b4ac1a9e41f86723ba74291feacc95c0a2c0a6623458eaa92d causes timeouts .
>
> ```
> 17:59:14 [INFO] Running org.apache.cloudstack.storage.image.SecondaryStorageServiceImplTest
> 18:29:14 Build timed out (after 30 minutes). Marking the build as failed.
> 18:29:14 New run name is '#14896-10364'
> 18:29:14 Build was aborted
> ```
Should be fixed now :)
@blueorangutan package
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#issuecomment-2758091085
@winterhazel a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate public templates that have URLs on data migration across secondary storages [cloudstack]
Posted by "winterhazel (via GitHub)" <gi...@apache.org>.
winterhazel commented on code in PR #10364:
URL: https://github.com/apache/cloudstack/pull/10364#discussion_r1951828167
##########
engine/storage/image/src/main/java/org/apache/cloudstack/storage/image/SecondaryStorageServiceImpl.java:
##########
@@ -160,6 +157,69 @@ public AsyncCallFuture<DataObjectResult> migrateData(DataObject srcDataObject, D
return future;
}
+ /**
+ * Returns a boolean indicating whether a template is ready on the provided data store. If the template is being downloaded,
+ * waits until the download finishes.
+ * @param srcDataObject the template.
+ * @param destDatastore the data store.
+ */
+ protected boolean templateIsOnDestination(DataObject srcDataObject, DataStore destDatastore) {
+ if (!(srcDataObject instanceof TemplateInfo)) {
+ return false;
+ }
+
+ String templateAsString = srcDataObject.getTO().toString();
+ String destDatastoreAsString = destDatastore.getTO().toString();
+ TemplateDataStoreVO templateStoreVO;
+
+ long timer = getTemplateDownloadTimeoutInSeconds();
+ int secondsToSleep = 10;
+ int previousDownloadPercentage = -1;
+
+ while (true) {
+ templateStoreVO = templateStoreDao.findByStoreTemplate(destDatastore.getId(), srcDataObject.getId());
+ if (templateStoreVO == null) {
+ logger.debug("{} is not present at destination [{}].", templateAsString, destDatastoreAsString);
+ return false;
+ }
+ VMTemplateStorageResourceAssoc.Status downloadState = templateStoreVO.getDownloadState();
+ if (downloadState == null || !VMTemplateStorageResourceAssoc.PENDING_DOWNLOAD_STATES.contains(downloadState)) {
+ break;
+ }
+ if (previousDownloadPercentage == templateStoreVO.getDownloadPercent()) {
+ timer -= secondsToSleep;
+ } else {
+ timer = getTemplateDownloadTimeoutInSeconds();
+ }
+ if (timer <= 0) {
+ throw new CloudRuntimeException(String.format("Timeout while waiting for %s to be downloaded to image store [%s]. " +
+ "The download percentage has not changed for %d seconds.", templateAsString, destDatastoreAsString, getTemplateDownloadTimeoutInSeconds()));
+ }
+ waitForTemplateDownload(secondsToSleep, templateAsString, destDatastoreAsString);
+ }
+
+ if (templateStoreVO.getState() == ObjectInDataStoreStateMachine.State.Ready) {
+ logger.debug("{} already exists on destination [{}].", templateAsString, destDatastoreAsString);
+ return true;
+ }
+ return false;
+ }
+
+ protected long getTemplateDownloadTimeoutInSeconds() {
+ return 1800L;
+ }
Review Comment:
The actual template download timeout is also hard-coded in a method (`com.cloud.storage.download.DownloadActiveState#handleTimeout`). I'm planning on making this timeout configurable in a separate PR, so for this one I'll just adjust so that they match the same value by using the static value instead.
--
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: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org