You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "sureshanaparti (via GitHub)" <gi...@apache.org> on 2026/01/21 07:16:06 UTC
[PR] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
sureshanaparti opened a new pull request, #12481:
URL: https://github.com/apache/cloudstack/pull/12481
### Description
This PR updates the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation.
The snapshot size incremented for the primary storage resource in the resource count while allocating snapshot (here: https://github.com/apache/cloudstack/pull/11558), is reverted during resource count recalculation for primary storage resource. Also, post snapshot creation, the decrement resource count not performed for primary storage resource when snapshot created on primary.
Fixes #11441
<!--- Describe your changes in DETAIL - And how has behaviour functionally changed. -->
<!-- For new features, provide link to FS, dev ML discussion etc. -->
<!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. -->
<!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged -->
<!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
<!-- Fixes: # -->
<!--- ******************************************************************************* -->
<!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. -->
<!--- PLEASE PUT AN 'X' in only **ONE** box -->
<!--- ******************************************************************************* -->
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] Enhancement (improves an existing feature and functionality)
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
- [ ] Build/CI
- [ ] Test (unit or integration test code)
### Feature/Enhancement Scale or Bug Severity
#### Feature/Enhancement Scale
- [ ] Major
- [ ] Minor
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [x] Major
- [ ] Minor
- [ ] Trivial
### Screenshots (if appropriate):
### How Has This Been Tested?
Created snapshots with user, admin accounts for some volumes and checked the resource count of 'primary_storage' resource.
<!-- Please describe in detail how you tested your changes. -->
<!-- Include details of your testing environment, and the tests you ran to -->
#### How did you try to break this feature and the system with this change?
<!-- see how your change affects other areas of the code, etc. -->
<!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document -->
--
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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#issuecomment-3776557449
## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/12481?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 4.03%. Comparing base ([`42f1e19`](https://app.codecov.io/gh/apache/cloudstack/commit/42f1e19362ab9030117dc3808dbf3854b6a9f92d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`0659e8d`](https://app.codecov.io/gh/apache/cloudstack/commit/0659e8d9736ddb77ea3eae7e3e04da5ec9710111?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 6 commits behind head on 4.20.
> :exclamation: There is a different number of reports uploaded between BASE (42f1e19) and HEAD (0659e8d). Click for more details.
>
> <details><summary>HEAD has 1 upload less than BASE</summary>
>
>| Flag | BASE (42f1e19) | HEAD (0659e8d) |
>|------|------|------|
>|unittests|1|0|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## 4.20 #12481 +/- ##
=============================================
- Coverage 16.23% 4.03% -12.21%
=============================================
Files 5657 402 -5255
Lines 499039 32712 -466327
Branches 60567 5831 -54736
=============================================
- Hits 81024 1319 -79705
+ Misses 408978 31238 -377740
+ Partials 9037 155 -8882
```
| [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/12481/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/12481/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.03% <ø> (ø)` | |
| [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/12481/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/12481?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).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#issuecomment-3776694159
@sureshanaparti 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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "borisstoyanov (via GitHub)" <gi...@apache.org>.
borisstoyanov commented on PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#issuecomment-3799603705
@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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#issuecomment-3801083138
@borisstoyanov 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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#issuecomment-3804159030
<b>[SF] Trillian test result (tid-15282)</b>
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 52112 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr12481-t15282-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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#issuecomment-3776686139
@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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#discussion_r2711683277
##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java:
##########
@@ -578,4 +586,35 @@ public int expungeBySnapshotList(final List<Long> snapshotIds, final Long batchS
sc.setParameters("snapshotIds", snapshotIds.toArray());
return batchExpunge(sc, batchSize);
}
+
+ /**
+ * Returns the total physical size, in bytes, of all snapshots stored on primary
+ * storage for the specified account that have not yet been backed up to
+ * secondary storage.
+ *
+ * <p>If no such snapshots are found, this method returns {@code 0}.</p>
+ *
+ * @param accountId the ID of the account whose snapshots on primary storage
+ * should be considered
+ * @return the total physical size in bytes of matching snapshots on primary
+ * storage, or {@code 0} if none are found
+ */
Review Comment:
will update
--
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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#issuecomment-3777451267
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16466
--
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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#discussion_r2712002670
##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java:
##########
@@ -78,6 +78,15 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase<SnapshotDataStoreVO
" order by created %s " +
" limit 1";
+ private static final String GET_PHYSICAL_SIZE_OF_SNAPSHOTS_ON_PRIMARY_BY_ACCOUNT = "SELECT SUM(s.physical_size) " +
+ "FROM cloud.snapshot_store_ref s " +
+ "LEFT JOIN cloud.snapshots ON s.snapshot_id = snapshots.id " +
+ "WHERE snapshots.account_id = ? " +
+ "AND snapshots.removed IS NULL " +
+ "AND s.state = 'Ready' " +
+ "AND s.store_role = 'Primary' " +
+ "AND NOT EXISTS (SELECT 1 FROM cloud.snapshot_store_ref i WHERE i.snapshot_id = s.snapshot_id AND i.store_role = 'Image')";
Review Comment:
> Shouldn't we include the size of the snapshot in primary which is present on secondary as well?
@abh1sar no, the snapshots in primary are deleted when they are backed up on secondary, but the store_ref record still exists (with 'Ready' state as I noticed - this record needs to removed or state should be updated to 'Destroyed'. Also, _location_type_ column in snapshots table is not populated, which should indicate location of the snapshot. - these need more testing and can break any existing func, so I'll raise separate PR with these fixes/improvements).
--
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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "borisstoyanov (via GitHub)" <gi...@apache.org>.
borisstoyanov commented on PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#issuecomment-3801079219
@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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#discussion_r2711569316
##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java:
##########
@@ -578,4 +586,35 @@ public int expungeBySnapshotList(final List<Long> snapshotIds, final Long batchS
sc.setParameters("snapshotIds", snapshotIds.toArray());
return batchExpunge(sc, batchSize);
}
+
+ /**
+ * Returns the total physical size, in bytes, of all snapshots stored on primary
+ * storage for the specified account that have not yet been backed up to
+ * secondary storage.
+ *
+ * <p>If no such snapshots are found, this method returns {@code 0}.</p>
+ *
+ * @param accountId the ID of the account whose snapshots on primary storage
+ * should be considered
+ * @return the total physical size in bytes of matching snapshots on primary
+ * storage, or {@code 0} if none are found
+ */
Review Comment:
Why in the implementation @sureshanaparti ? as it is an interface method the javadoc could go in the `Interface` , right?
--
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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#discussion_r2711379933
##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java:
##########
@@ -78,6 +78,15 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase<SnapshotDataStoreVO
" order by created %s " +
" limit 1";
+ private static final String GET_PHYSICAL_SIZE_OF_SNAPSHOTS_ON_PRIMARY_BY_ACCOUNT = "SELECT SUM(s.physical_size) " +
+ "FROM cloud.snapshot_store_ref s " +
+ "INNER JOIN cloud.snapshots ON s.snapshot_id = snapshots.id " +
+ "WHERE snapshots.account_id = ? " +
+ "AND snapshots.removed IS NULL " +
+ "AND s.state = 'Ready' " +
+ "AND s.store_role = 'Primary' " +
+ "AND NOT EXISTS (SELECT 1 FROM cloud.snapshot_store_ref i WHERE i.snapshot_id = s.snapshot_id AND i.store_role = 'Image')";
Review Comment:
done
--
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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "abh1sar (via GitHub)" <gi...@apache.org>.
abh1sar commented on code in PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#discussion_r2735539942
##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java:
##########
@@ -78,6 +78,15 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase<SnapshotDataStoreVO
" order by created %s " +
" limit 1";
+ private static final String GET_PHYSICAL_SIZE_OF_SNAPSHOTS_ON_PRIMARY_BY_ACCOUNT = "SELECT SUM(s.physical_size) " +
+ "FROM cloud.snapshot_store_ref s " +
+ "LEFT JOIN cloud.snapshots ON s.snapshot_id = snapshots.id " +
+ "WHERE snapshots.account_id = ? " +
+ "AND snapshots.removed IS NULL " +
+ "AND s.state = 'Ready' " +
+ "AND s.store_role = 'Primary' " +
+ "AND NOT EXISTS (SELECT 1 FROM cloud.snapshot_store_ref i WHERE i.snapshot_id = s.snapshot_id AND i.store_role = 'Image')";
Review Comment:
ok @sureshanaparti
I guess this can be improved once the issue you described is fixed?
--
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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#issuecomment-3776972155
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16457
--
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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#issuecomment-3777136980
@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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "abh1sar (via GitHub)" <gi...@apache.org>.
abh1sar commented on code in PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#discussion_r2711917090
##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java:
##########
@@ -78,6 +78,15 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase<SnapshotDataStoreVO
" order by created %s " +
" limit 1";
+ private static final String GET_PHYSICAL_SIZE_OF_SNAPSHOTS_ON_PRIMARY_BY_ACCOUNT = "SELECT SUM(s.physical_size) " +
+ "FROM cloud.snapshot_store_ref s " +
+ "LEFT JOIN cloud.snapshots ON s.snapshot_id = snapshots.id " +
+ "WHERE snapshots.account_id = ? " +
+ "AND snapshots.removed IS NULL " +
+ "AND s.state = 'Ready' " +
+ "AND s.store_role = 'Primary' " +
+ "AND NOT EXISTS (SELECT 1 FROM cloud.snapshot_store_ref i WHERE i.snapshot_id = s.snapshot_id AND i.store_role = 'Image')";
Review Comment:
Shouldn't we include the size of the snapshot in primary which is present on secondary as well?
```suggestion
private static final String GET_PHYSICAL_SIZE_OF_SNAPSHOTS_ON_PRIMARY_BY_ACCOUNT = "SELECT SUM(s.physical_size) " +
"FROM cloud.snapshot_store_ref s " +
"LEFT JOIN cloud.snapshots ON s.snapshot_id = snapshots.id " +
"WHERE snapshots.account_id = ? " +
"AND snapshots.removed IS NULL " +
"AND s.state = 'Ready' " +
"AND s.store_role = 'Primary' ";
```
##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java:
##########
@@ -78,6 +78,15 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase<SnapshotDataStoreVO
" order by created %s " +
" limit 1";
+ private static final String GET_PHYSICAL_SIZE_OF_SNAPSHOTS_ON_PRIMARY_BY_ACCOUNT = "SELECT SUM(s.physical_size) " +
+ "FROM cloud.snapshot_store_ref s " +
+ "LEFT JOIN cloud.snapshots ON s.snapshot_id = snapshots.id " +
+ "WHERE snapshots.account_id = ? " +
+ "AND snapshots.removed IS NULL " +
+ "AND s.state = 'Ready' " +
+ "AND s.store_role = 'Primary' " +
+ "AND NOT EXISTS (SELECT 1 FROM cloud.snapshot_store_ref i WHERE i.snapshot_id = s.snapshot_id AND i.store_role = 'Image')";
Review Comment:
Actually, if we are going this way we can just use `snapshotSizeSearch` in `ResourceLimitManagerImpl` directly similar to calculateSecondaryStorageForAccount()
```
SearchCriteria<SumCount> sc2 = snapshotSizeSearch.create();
sc2.setParameters("state", ObjectInDataStoreStateMachine.State.Ready);
sc2.setParameters("storeRole", DataStoreRole.Primary);
sc2.setJoinParameters("snapshots", "accountId", accountId);
List<SumCount> snapshots = _snapshotDataStoreDao.customSearch(sc2, null);
```
--
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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#discussion_r2711381691
##########
api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java:
##########
@@ -244,8 +244,7 @@ public void execute() {
}
private Snapshot.LocationType getLocationType() {
-
- if (Snapshot.LocationType.values() == null || Snapshot.LocationType.values().length == 0 || locationType == null) {
+ if (Snapshot.LocationType.values().length == 0 || locationType == null) {
Review Comment:
done
--
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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#discussion_r2712002670
##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java:
##########
@@ -78,6 +78,15 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase<SnapshotDataStoreVO
" order by created %s " +
" limit 1";
+ private static final String GET_PHYSICAL_SIZE_OF_SNAPSHOTS_ON_PRIMARY_BY_ACCOUNT = "SELECT SUM(s.physical_size) " +
+ "FROM cloud.snapshot_store_ref s " +
+ "LEFT JOIN cloud.snapshots ON s.snapshot_id = snapshots.id " +
+ "WHERE snapshots.account_id = ? " +
+ "AND snapshots.removed IS NULL " +
+ "AND s.state = 'Ready' " +
+ "AND s.store_role = 'Primary' " +
+ "AND NOT EXISTS (SELECT 1 FROM cloud.snapshot_store_ref i WHERE i.snapshot_id = s.snapshot_id AND i.store_role = 'Image')";
Review Comment:
> Shouldn't we include the size of the snapshot in primary which is present on secondary as well?
@abh1sar no, the snapshots in primary are deleted when they are backed up on secondary, but the store_ref record still exists (with 'Ready' state as I noticed - this record needs to removed or state should be updated to 'Destroyed'. Also, _location_type_ column in snapshots table is not populated, which should indicate location of the snapshot - 'Primary' or 'Image'. - these need more testing and can break any existing func, so I'll raise separate PR with these fixes/improvements).
--
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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#discussion_r2711769183
##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java:
##########
@@ -578,4 +586,35 @@ public int expungeBySnapshotList(final List<Long> snapshotIds, final Long batchS
sc.setParameters("snapshotIds", snapshotIds.toArray());
return batchExpunge(sc, batchSize);
}
+
+ /**
+ * Returns the total physical size, in bytes, of all snapshots stored on primary
+ * storage for the specified account that have not yet been backed up to
+ * secondary storage.
+ *
+ * <p>If no such snapshots are found, this method returns {@code 0}.</p>
+ *
+ * @param accountId the ID of the account whose snapshots on primary storage
+ * should be considered
+ * @return the total physical size in bytes of matching snapshots on primary
+ * storage, or {@code 0} if none are found
+ */
Review Comment:
done
--
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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#issuecomment-3799607848
@borisstoyanov 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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#discussion_r2711385847
##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDao.java:
##########
@@ -110,4 +110,6 @@ public interface SnapshotDataStoreDao extends GenericDao<SnapshotDataStoreVO, Lo
void updateDisplayForSnapshotStoreRole(long snapshotId, long storeId, DataStoreRole role, boolean display);
int expungeBySnapshotList(List<Long> snapshotIds, Long batchSize);
+
Review Comment:
done
--
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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#issuecomment-3777144894
@sureshanaparti 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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#discussion_r2712009101
##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java:
##########
@@ -78,6 +78,15 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase<SnapshotDataStoreVO
" order by created %s " +
" limit 1";
+ private static final String GET_PHYSICAL_SIZE_OF_SNAPSHOTS_ON_PRIMARY_BY_ACCOUNT = "SELECT SUM(s.physical_size) " +
+ "FROM cloud.snapshot_store_ref s " +
+ "LEFT JOIN cloud.snapshots ON s.snapshot_id = snapshots.id " +
+ "WHERE snapshots.account_id = ? " +
+ "AND snapshots.removed IS NULL " +
+ "AND s.state = 'Ready' " +
+ "AND s.store_role = 'Primary' " +
+ "AND NOT EXISTS (SELECT 1 FROM cloud.snapshot_store_ref i WHERE i.snapshot_id = s.snapshot_id AND i.store_role = 'Image')";
Review Comment:
> > Shouldn't we include the size of the snapshot in primary which is present on secondary as well?
>
> @abh1sar no, the snapshots in primary are deleted when they are backed up on secondary, but the store_ref record still exists (with 'Ready' state as I noticed - this record needs to removed or state should be updated to 'Destroyed'. Also, _location_type_ column in snapshots table is not populated, which should indicate location of the snapshot - 'Primary' or 'Image'. - these need more testing and can break any existing func, so I'll raise separate PR with these fixes/improvements).
the sql would consider the snapshots in primary and not exists in secondary storage.
--
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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#discussion_r2711297816
##########
api/src/main/java/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java:
##########
@@ -244,8 +244,7 @@ public void execute() {
}
private Snapshot.LocationType getLocationType() {
-
- if (Snapshot.LocationType.values() == null || Snapshot.LocationType.values().length == 0 || locationType == null) {
+ if (Snapshot.LocationType.values().length == 0 || locationType == null) {
Review Comment:
The check for Snapshot.LocationType.values().length == 0 is redundant since the LocationType enum has two defined values (PRIMARY and SECONDARY) and will never have a length of 0. Consider removing this check as well to simplify the condition to just checking if locationType is null.
```suggestion
if (locationType == null) {
```
##########
server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java:
##########
@@ -1485,15 +1493,17 @@ public SnapshotInfo takeSnapshot(VolumeInfo volume) throws ResourceAllocationExc
if (logger.isDebugEnabled()) {
logger.debug("Failed to create snapshot" + cre.getLocalizedMessage());
}
+ ResourceType storeResourceType = getStoreResourceType(volume.getDataCenterId(), payload.getLocationType());
_resourceLimitMgr.decrementResourceCount(snapshotOwner.getId(), ResourceType.snapshot);
- _resourceLimitMgr.decrementResourceCount(snapshotOwner.getId(), ResourceType.secondary_storage, new Long(volume.getSize()));
+ _resourceLimitMgr.decrementResourceCount(snapshotOwner.getId(), storeResourceType, new Long(volume.getSize()));
throw cre;
} catch (Exception e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to create snapshot", e);
}
+ ResourceType storeResourceType = getStoreResourceType(volume.getDataCenterId(), payload.getLocationType());
_resourceLimitMgr.decrementResourceCount(snapshotOwner.getId(), ResourceType.snapshot);
- _resourceLimitMgr.decrementResourceCount(snapshotOwner.getId(), ResourceType.secondary_storage, new Long(volume.getSize()));
+ _resourceLimitMgr.decrementResourceCount(snapshotOwner.getId(), storeResourceType, new Long(volume.getSize()));
Review Comment:
Inefficient constructor for long value, use Long.valueOf(...) instead.
##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java:
##########
@@ -78,6 +78,15 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase<SnapshotDataStoreVO
" order by created %s " +
" limit 1";
+ private static final String GET_PHYSICAL_SIZE_OF_SNAPSHOTS_ON_PRIMARY_BY_ACCOUNT = "SELECT SUM(s.physical_size) " +
+ "FROM cloud.snapshot_store_ref s " +
+ "INNER JOIN cloud.snapshots ON s.snapshot_id = snapshots.id " +
+ "WHERE snapshots.account_id = ? " +
+ "AND snapshots.removed IS NULL " +
+ "AND s.state = 'Ready' " +
+ "AND s.store_role = 'Primary' " +
+ "AND NOT EXISTS (SELECT 1 FROM cloud.snapshot_store_ref i WHERE i.snapshot_id = s.snapshot_id AND i.store_role = 'Image')";
Review Comment:
The SQL query uses a NOT EXISTS subquery which could be inefficient on large datasets. Consider adding appropriate indexes on snapshot_store_ref.snapshot_id and snapshot_store_ref.store_role, or restructuring the query to use a LEFT JOIN with IS NULL check for better performance. Additionally, ensure that indexes exist on snapshots.account_id and snapshots.removed for optimal query performance.
```suggestion
"LEFT JOIN cloud.snapshot_store_ref i ON i.snapshot_id = s.snapshot_id AND i.store_role = 'Image' " +
"WHERE snapshots.account_id = ? " +
"AND snapshots.removed IS NULL " +
"AND s.state = 'Ready' " +
"AND s.store_role = 'Primary' " +
"AND i.snapshot_id IS NULL";
```
##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java:
##########
@@ -578,4 +586,23 @@ public int expungeBySnapshotList(final List<Long> snapshotIds, final Long batchS
sc.setParameters("snapshotIds", snapshotIds.toArray());
return batchExpunge(sc, batchSize);
}
+
+ @Override
+ public long getSnapshotsPhysicalSizeOnPrimaryStorageByAccountId(long accountId) {
+ long snapshotsPhysicalSize = 0;
+ try (TransactionLegacy transactionLegacy = TransactionLegacy.currentTxn()) {
+ try (PreparedStatement preparedStatement = transactionLegacy.prepareStatement(GET_PHYSICAL_SIZE_OF_SNAPSHOTS_ON_PRIMARY_BY_ACCOUNT)) {
+ preparedStatement.setLong(1, accountId);
+
+ try (ResultSet resultSet = preparedStatement.executeQuery()) {
+ if (resultSet.next()) {
+ snapshotsPhysicalSize = resultSet.getLong(1);
+ }
+ }
+ }
+ } catch (SQLException e) {
+ logger.warn("Failed to get the snapshots physical size for the account [{}] due to [{}].", accountId, e.getMessage(), e);
+ }
+ return snapshotsPhysicalSize;
+ }
Review Comment:
The new method getSnapshotsPhysicalSizeOnPrimaryStorageByAccountId lacks direct unit or integration tests. While it is tested through mocking in ResourceLimitManagerImplTest, consider adding a test case in SnapshotDataStoreDaoImplTest or creating an integration test that validates the SQL query behavior with actual database data, especially for edge cases like accounts with no snapshots, null physical sizes, or the NOT EXISTS clause conditions.
##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java:
##########
@@ -578,4 +586,23 @@ public int expungeBySnapshotList(final List<Long> snapshotIds, final Long batchS
sc.setParameters("snapshotIds", snapshotIds.toArray());
return batchExpunge(sc, batchSize);
}
+
+ @Override
+ public long getSnapshotsPhysicalSizeOnPrimaryStorageByAccountId(long accountId) {
+ long snapshotsPhysicalSize = 0;
+ try (TransactionLegacy transactionLegacy = TransactionLegacy.currentTxn()) {
+ try (PreparedStatement preparedStatement = transactionLegacy.prepareStatement(GET_PHYSICAL_SIZE_OF_SNAPSHOTS_ON_PRIMARY_BY_ACCOUNT)) {
+ preparedStatement.setLong(1, accountId);
+
+ try (ResultSet resultSet = preparedStatement.executeQuery()) {
+ if (resultSet.next()) {
+ snapshotsPhysicalSize = resultSet.getLong(1);
+ }
+ }
+ }
+ } catch (SQLException e) {
+ logger.warn("Failed to get the snapshots physical size for the account [{}] due to [{}].", accountId, e.getMessage(), e);
+ }
+ return snapshotsPhysicalSize;
+ }
Review Comment:
The method getSnapshotsPhysicalSizeOnPrimaryStorageByAccountId could benefit from handling the null case explicitly for clarity. When SUM() returns NULL (no matching rows), resultSet.getLong(1) will return 0 by default, but this behavior is implicit. Consider using resultSet.wasNull() to check if the SUM returned NULL and explicitly return 0, or add a COALESCE in the SQL query to make the intent clearer.
##########
server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java:
##########
@@ -1472,8 +1479,9 @@ public SnapshotInfo takeSnapshot(VolumeInfo volume) throws ResourceAllocationExc
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_SNAPSHOT_CREATE, snapshot.getAccountId(), snapshot.getDataCenterId(), snapshotId, snapshot.getName(), null, null,
snapshotStoreRef.getPhysicalSize(), volume.getSize(), snapshot.getClass().getName(), snapshot.getUuid());
+ ResourceType storeResourceType = dataStoreRole == DataStoreRole.Image ? ResourceType.secondary_storage : ResourceType.primary_storage;
// Correct the resource count of snapshot in case of delta snapshots.
- _resourceLimitMgr.decrementResourceCount(snapshotOwner.getId(), ResourceType.secondary_storage, new Long(volume.getSize() - snapshotStoreRef.getPhysicalSize()));
+ _resourceLimitMgr.decrementResourceCount(snapshotOwner.getId(), storeResourceType, new Long(volume.getSize() - snapshotStoreRef.getPhysicalSize()));
Review Comment:
Inefficient constructor for long value, use Long.valueOf(...) instead.
##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDao.java:
##########
@@ -110,4 +110,6 @@ public interface SnapshotDataStoreDao extends GenericDao<SnapshotDataStoreVO, Lo
void updateDisplayForSnapshotStoreRole(long snapshotId, long storeId, DataStoreRole role, boolean display);
int expungeBySnapshotList(List<Long> snapshotIds, Long batchSize);
+
Review Comment:
The new method getSnapshotsPhysicalSizeOnPrimaryStorageByAccountId lacks documentation. Consider adding a JavaDoc comment that describes what the method does, its parameters, return value, and any important behavior (e.g., that it only returns snapshots on primary storage that haven't been backed up to secondary storage, and returns 0 if no snapshots are found).
```suggestion
/**
* Returns the total physical size, in bytes, of all snapshots stored on primary
* storage for the specified account that have not yet been backed up to
* secondary storage.
*
* <p>If no such snapshots are found, this method returns {@code 0}.</p>
*
* @param accountId the ID of the account whose snapshots on primary storage
* should be considered
* @return the total physical size in bytes of matching snapshots on primary
* storage, or {@code 0} if none are found
*/
```
##########
server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java:
##########
@@ -1485,15 +1493,17 @@ public SnapshotInfo takeSnapshot(VolumeInfo volume) throws ResourceAllocationExc
if (logger.isDebugEnabled()) {
logger.debug("Failed to create snapshot" + cre.getLocalizedMessage());
}
+ ResourceType storeResourceType = getStoreResourceType(volume.getDataCenterId(), payload.getLocationType());
_resourceLimitMgr.decrementResourceCount(snapshotOwner.getId(), ResourceType.snapshot);
- _resourceLimitMgr.decrementResourceCount(snapshotOwner.getId(), ResourceType.secondary_storage, new Long(volume.getSize()));
+ _resourceLimitMgr.decrementResourceCount(snapshotOwner.getId(), storeResourceType, new Long(volume.getSize()));
Review Comment:
Inefficient constructor for long value, use Long.valueOf(...) 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
Re: [PR] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#discussion_r2712009101
##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java:
##########
@@ -78,6 +78,15 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase<SnapshotDataStoreVO
" order by created %s " +
" limit 1";
+ private static final String GET_PHYSICAL_SIZE_OF_SNAPSHOTS_ON_PRIMARY_BY_ACCOUNT = "SELECT SUM(s.physical_size) " +
+ "FROM cloud.snapshot_store_ref s " +
+ "LEFT JOIN cloud.snapshots ON s.snapshot_id = snapshots.id " +
+ "WHERE snapshots.account_id = ? " +
+ "AND snapshots.removed IS NULL " +
+ "AND s.state = 'Ready' " +
+ "AND s.store_role = 'Primary' " +
+ "AND NOT EXISTS (SELECT 1 FROM cloud.snapshot_store_ref i WHERE i.snapshot_id = s.snapshot_id AND i.store_role = 'Image')";
Review Comment:
> > Shouldn't we include the size of the snapshot in primary which is present on secondary as well?
>
> @abh1sar no, the snapshots in primary are deleted when they are backed up on secondary, but the store_ref record still exists (with 'Ready' state as I noticed - this record needs to removed or state should be updated to 'Destroyed'. Also, _location_type_ column in snapshots table is not populated, which should indicate location of the snapshot - 'Primary' or 'Image'. - these need more testing and can break any existing func, so I'll raise separate PR with these fixes/improvements).
the sql would consider the snapshots in primary and not exists in secondary storage.
##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java:
##########
@@ -78,6 +78,15 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase<SnapshotDataStoreVO
" order by created %s " +
" limit 1";
+ private static final String GET_PHYSICAL_SIZE_OF_SNAPSHOTS_ON_PRIMARY_BY_ACCOUNT = "SELECT SUM(s.physical_size) " +
+ "FROM cloud.snapshot_store_ref s " +
+ "LEFT JOIN cloud.snapshots ON s.snapshot_id = snapshots.id " +
+ "WHERE snapshots.account_id = ? " +
+ "AND snapshots.removed IS NULL " +
+ "AND s.state = 'Ready' " +
+ "AND s.store_role = 'Primary' " +
+ "AND NOT EXISTS (SELECT 1 FROM cloud.snapshot_store_ref i WHERE i.snapshot_id = s.snapshot_id AND i.store_role = 'Image')";
Review Comment:
> Shouldn't we include the size of the snapshot in primary which is present on secondary as well?
@abh1sar no, the snapshots in primary are deleted when they are backed up on secondary, but the store_ref record still exists (with 'Ready' state as I noticed - this record needs to removed or state should be updated to 'Destroyed'. Also, _location_type_ column in snapshots table is not populated, which should indicate location of the snapshot - 'Primary' or 'Image'. - these need more testing and can break any existing func, so I'll raise separate PR with these fixes/improvements).
the sql would consider the snapshots in primary and not exists in secondary storage.
--
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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481#issuecomment-3799920533
<b>[SF] Trillian Build Failed (tid-15276)<b/>
--
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] Update the snapshot physical size for the primary storage resource after snapshot creation and during resource count recalculation [cloudstack]
Posted by "borisstoyanov (via GitHub)" <gi...@apache.org>.
borisstoyanov merged PR #12481:
URL: https://github.com/apache/cloudstack/pull/12481
--
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