Skip to content

Conversation

@sureshanaparti
Copy link
Contributor

@sureshanaparti sureshanaparti commented Jan 19, 2026

Description

This PR returns the parent snapshot (along with the chain size) for incremental snapshots, and show it on the UI when the config 'snapshot.show.chain.size' is enabled (extends #11313)

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)
  • 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
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

  • Set the configuration 'kvm.incremental.snapshot' - true, 'snapshot.delta.max' - 3 and created volume snapshots. Verified the listCapabilities and listSnapshots response & UI with config 'snapshot.show.chain.size' true & false.
ShowParentSnapshotForIncrementalSnapshots

API:

(localcloud) 🐱 > list capabilities 
{
  "capability": {
    "additionalconfigenabled": false,
...
    "securitygroupsenabled": false,
    "sharedfsvmmincpucount": 2,
    "sharedfsvmminramsize": 1024,
    "snapshotshowchainsize": true,
...
  }
}

(localcloud) 🐱 > list snapshots volumeid=9b6b6754-5546-451e-95d5-d0bfd78e73f8 filter=id,name,virtualsize,physicalsize,chainsize,parent,parentname
{
  "count": 7,
  "snapshot": [
    {
      "id": "36e39187-3c68-4798-875b-718eb7a7d714",
      "name": "ROOT-6-Snap02-Incr",
      "physicalsize": 1892286464,
      "virtualsize": 8589934592
    },
    {
      "chainsize": 1893007360,
      "id": "bc06e2a3-5ac0-4ba5-9fe2-eedb2c2d67a3",
      "name": "ROOT-6-Snap03-Incr",
      "parent": "36e39187-3c68-4798-875b-718eb7a7d714",
      "parentname": "ROOT-6-Snap02-Incr",
      "physicalsize": 720896,
      "virtualsize": 8589934592
    },
    {
      "chainsize": 1893597184,
      "id": "f5361ece-f510-451c-b003-fce206e41400",
      "name": "ROOT-6-Snap04-Incr",
      "parent": "bc06e2a3-5ac0-4ba5-9fe2-eedb2c2d67a3",
      "parentname": "ROOT-6-Snap03-Incr",
      "physicalsize": 589824,
      "virtualsize": 8589934592
    },
    {
      "id": "9547bf0e-ee56-4fb0-99c5-99a13fc349b9",
      "name": "ROOT-6-Snap05-Incr",
      "physicalsize": 1892286464,
      "virtualsize": 8589934592
    },
    {
      "chainsize": 1892941824,
      "id": "4d7ffe9e-496f-4c7e-9514-2186b64e27ea",
      "name": "ROOT-6-Snap06-Incr",
      "parent": "9547bf0e-ee56-4fb0-99c5-99a13fc349b9",
      "parentname": "ROOT-6-Snap05-Incr",
      "physicalsize": 655360,
      "virtualsize": 8589934592
    },
    {
      "chainsize": 1893138560,
      "id": "5f2dd5a5-4be3-4ab4-bd0c-d7e2242eb2dd",
      "name": "ROOT-6-Snap07-Incr",
      "parent": "4d7ffe9e-496f-4c7e-9514-2186b64e27ea",
      "parentname": "ROOT-6-Snap06-Incr",
      "physicalsize": 196736,
      "virtualsize": 8589934592
    },
    {
      "id": "d854d36d-b591-4a99-9d47-e99d81860c71",
      "name": "ROOT-6-Snap01",
      "physicalsize": 1510342656,
      "virtualsize": 8589934592
    }
  ]
}

DB:

mysql> SELECT name, value FROM cloud.configuration WHERE name LIKE '%incremental%' OR name LIKE '%delta%' OR name LIKE '%chain%';
+--------------------------+-------+
| name                     | value |
+--------------------------+-------+
| kvm.incremental.snapshot | true  |
| snapshot.delta.max       | 3     |
| snapshot.show.chain.size | true  |
+--------------------------+-------+
3 rows in set (0.00 sec)

mysql> SELECT id, uuid, name, pool_id, instance_id, size, state, created FROM cloud.volumes WHERE name = 'ROOT-6';
+----+--------------------------------------+--------+---------+-------------+------------+-------+---------------------+
| id | uuid                                 | name   | pool_id | instance_id | size       | state | created             |
+----+--------------------------------------+--------+---------+-------------+------------+-------+---------------------+
|  8 | 9b6b6754-5546-451e-95d5-d0bfd78e73f8 | ROOT-6 |       2 |           6 | 8589934592 | Ready | 2025-10-29 08:05:54 |
+----+--------------------------------------+--------+---------+-------------+------------+-------+---------------------+
1 row in set (0.00 sec)

mysql> SELECT id, uuid, name, volume_id, size, status, created FROM cloud.snapshots WHERE volume_id = 8;
+------+--------------------------------------+--------------------+-----------+------------+----------+---------------------+
| id   | uuid                                 | name               | volume_id | size       | status   | created             |
+------+--------------------------------------+--------------------+-----------+------------+----------+---------------------+
|    9 | d854d36d-b591-4a99-9d47-e99d81860c71 | ROOT-6-Snap01      |         8 | 8589934592 | BackedUp | 2025-10-29 08:06:22 |
| 1989 | 36e39187-3c68-4798-875b-718eb7a7d714 | ROOT-6-Snap02-Incr |         8 | 8589934592 | BackedUp | 2026-01-19 15:41:49 |
| 1990 | bc06e2a3-5ac0-4ba5-9fe2-eedb2c2d67a3 | ROOT-6-Snap03-Incr |         8 | 8589934592 | BackedUp | 2026-01-19 15:42:54 |
| 1991 | f5361ece-f510-451c-b003-fce206e41400 | ROOT-6-Snap04-Incr |         8 | 8589934592 | BackedUp | 2026-01-19 15:43:04 |
| 1992 | 9547bf0e-ee56-4fb0-99c5-99a13fc349b9 | ROOT-6-Snap05-Incr |         8 | 8589934592 | BackedUp | 2026-01-19 15:43:24 |
| 1993 | 4d7ffe9e-496f-4c7e-9514-2186b64e27ea | ROOT-6-Snap06-Incr |         8 | 8589934592 | BackedUp | 2026-01-19 15:44:14 |
| 1994 | 5f2dd5a5-4be3-4ab4-bd0c-d7e2242eb2dd | ROOT-6-Snap07-Incr |         8 | 8589934592 | BackedUp | 2026-01-19 15:44:31 |
+------+--------------------------------------+--------------------+-----------+------------+----------+---------------------+
7 rows in set (0.00 sec)

mysql> SELECT volume_id, snapshot_id, parent_snapshot_id, store_id, store_role, size, physical_size, install_path, kvm_checkpoint_path, end_of_chain, state, created FROM cloud.snapshot_store_ref WHERE volume_id = 8;
+-----------+-------------+--------------------+----------+------------+------------+---------------+----------------------------------------------------+------------------------------------------------------------------------------------------------+--------------+-------+---------------------+
| volume_id | snapshot_id | parent_snapshot_id | store_id | store_role | size       | physical_size | install_path                                       | kvm_checkpoint_path                                                                            | end_of_chain | state | created             |
+-----------+-------------+--------------------+----------+------------+------------+---------------+----------------------------------------------------+------------------------------------------------------------------------------------------------+--------------+-------+---------------------+
|         8 |           9 |                  0 |        1 | Image      | 8589934592 |    1510342656 | snapshots/2/8/3981d657-408c-466f-83eb-abad06a23d66 | NULL                                                                                           |         NULL | Ready | 2025-10-29 08:07:02 |
|         8 |        1989 |                  0 |        1 | Image      | 8589934592 |    1892286464 | snapshots/2/8/03e6839f-aee0-4623-aa30-d08245c8ebf9 | /mnt/ddabb61d-f9b0-3814-8912-34881c0dc717/checkpoints/2/8/03e6839f-aee0-4623-aa30-d08245c8ebf9 |         NULL | Ready | 2026-01-19 15:42:12 |
|         8 |        1990 |               1989 |        1 | Image      | 8589934592 |        720896 | snapshots/2/8/b90ac84d-6639-4043-8039-c5dc166293d6 | /mnt/ddabb61d-f9b0-3814-8912-34881c0dc717/checkpoints/2/8/b90ac84d-6639-4043-8039-c5dc166293d6 |         NULL | Ready | 2026-01-19 15:42:55 |
|         8 |        1991 |               1990 |        1 | Image      | 8589934592 |        589824 | snapshots/2/8/a1f1db80-d8bd-405e-aa57-eca7a78fe6ce | /mnt/ddabb61d-f9b0-3814-8912-34881c0dc717/checkpoints/2/8/a1f1db80-d8bd-405e-aa57-eca7a78fe6ce |            1 | Ready | 2026-01-19 15:43:17 |
|         8 |        1992 |                  0 |        1 | Image      | 8589934592 |    1892286464 | snapshots/2/8/4038aa08-4be6-42ae-934f-f11a1a7cf9d3 | /mnt/ddabb61d-f9b0-3814-8912-34881c0dc717/checkpoints/2/8/4038aa08-4be6-42ae-934f-f11a1a7cf9d3 |         NULL | Ready | 2026-01-19 15:43:45 |
|         8 |        1993 |               1992 |        1 | Image      | 8589934592 |        655360 | snapshots/2/8/f574208f-8f18-47e8-9baa-461facc01637 | /mnt/ddabb61d-f9b0-3814-8912-34881c0dc717/checkpoints/2/8/f574208f-8f18-47e8-9baa-461facc01637 |         NULL | Ready | 2026-01-19 15:44:15 |
|         8 |        1994 |               1993 |        1 | Image      | 8589934592 |        196736 | snapshots/2/8/1bb690d4-e3d6-4060-bbf6-1a59f33f6077 | /mnt/ddabb61d-f9b0-3814-8912-34881c0dc717/checkpoints/2/8/1bb690d4-e3d6-4060-bbf6-1a59f33f6077 |            1 | Ready | 2026-01-19 15:44:34 |
+-----------+-------------+--------------------+----------+------------+------------+---------------+----------------------------------------------------+------------------------------------------------------------------------------------------------+--------------+-------+---------------------+
7 rows in set (0.00 sec)

How did you try to break this feature and the system with this change?

@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.59%. Comparing base (3828a3b) to head (bd98e92).

Files with missing lines Patch % Lines
...ache/cloudstack/api/response/SnapshotResponse.java 0.00% 6 Missing ⚠️
.../cloudstack/api/response/CapabilitiesResponse.java 0.00% 3 Missing ⚠️
...a/com/cloud/api/query/dao/SnapshotJoinDaoImpl.java 0.00% 2 Missing ⚠️
...in/java/com/cloud/server/ManagementServerImpl.java 0.00% 2 Missing ⚠️
...k/api/command/user/config/ListCapabilitiesCmd.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #12468      +/-   ##
============================================
- Coverage     17.59%   17.59%   -0.01%     
  Complexity    15601    15601              
============================================
  Files          5910     5910              
  Lines        529819   529839      +20     
  Branches      64730    64730              
============================================
- Hits          93225    93224       -1     
- Misses       426099   426120      +21     
  Partials      10495    10495              
Flag Coverage Δ
uitests 3.60% <ø> (-0.01%) ⬇️
unittests 18.66% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the snapshot feature by exposing parent snapshot information and chain size for incremental snapshots. The feature is controlled by the configuration setting 'snapshot.show.chain.size' and affects both API responses and UI display.

Changes:

  • Added parent and parentName fields to the snapshot API response
  • Added snapshotShowChainSize capability to the listCapabilities API
  • Updated UI to conditionally display chain size and parent name in snapshot listings when the feature is enabled

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
api/src/main/java/org/apache/cloudstack/api/response/SnapshotResponse.java Added parent and parentName fields with setters to expose parent snapshot information
api/src/main/java/org/apache/cloudstack/api/response/CapabilitiesResponse.java Added snapshotShowChainSize field and setter to expose the feature flag
api/src/main/java/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java Populated the SnapshotShowChainSize capability in the response
server/src/main/java/com/cloud/server/ManagementServerImpl.java Retrieved and added SnapshotShowChainSize configuration value to capabilities map
server/src/main/java/com/cloud/api/query/dao/SnapshotJoinDaoImpl.java Set parent UUID and name in snapshot response when showChainSize is enabled and parent exists
ui/src/config/section/storage.js Conditionally added chainsize and parentname columns, and added parentname to details array

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sureshanaparti
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

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

Copy link
Contributor

@nvazquez nvazquez left a comment

Choose a reason for hiding this comment

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

Code LGTM - thanks @sureshanaparti

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16433

@nvazquez
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@nvazquez a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

4 participants