Skip to content

Feat add snapshot description field#2924

Open
heldergomes wants to merge 15 commits intolxc:mainfrom
heldergomes:feat-add-snapshot-description-field
Open

Feat add snapshot description field#2924
heldergomes wants to merge 15 commits intolxc:mainfrom
heldergomes:feat-add-snapshot-description-field

Conversation

@heldergomes
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions github-actions bot added Documentation Documentation needs updating API Changes to the REST API labels Feb 11, 2026
@heldergomes
Copy link
Copy Markdown
Contributor Author

This PR implements #2254

@heldergomes
Copy link
Copy Markdown
Contributor Author

because this MR is quite long, I will try to explain a little bit about some change decisions and few concerns!

storage_volume_snapshot
Despite the requirement is quite simple, the change is painful because I had to change many piece of code, therefore I decided to change only instance snapshot on this PR, but I could open a new pull request changing volume snapshot afterward.

shared/api/instance_snapshot.go
I'd expected to refactor a little bit the InstanceSnapshot struct, snapshot data such as (expiry_at and description) should be on root struct and source instance data like (instance description) should be on nested object like InstanceProperties IMHO, this would design better the model to handle better with more instance properties in the future, however this change would break API, threfore I just add SnapshotDescription field on the model.

instance_args
Handle this struct was quite challenge mostly because incus handle snapshots and instance in the same way with instance_args, so although qemu/lxc driver and shared/api/instance_snapshot I ended up handle snapshot fields such as description and expiry on root struct, I took decision to create snapshot_args as nested object of instance_args, in order to make easier add new fields on this highly used struct.

I'd rather use snapshot as a nested struct of instance on every place like driver, api, db, etc, but this change is painful, so it's what it is!

instance_snapshot_property
I tried do use the term instance_snapshot_properties, however generate_database script only knew how to create mapper like list if tables name was singular, tables with suffix ies is considered plural on the script.

I think that's all, let me know if have any question or improvements.

@heldergomes
Copy link
Copy Markdown
Contributor Author

heldergomes commented Feb 11, 2026

Hi @stgraber, I think It's done this PR.
It was a bit challenge understand this whole change and I end up making a little mess with the past PR, so I closed the one that I had open and I made a clean branch with this one.

@stgraber
Copy link
Copy Markdown
Member

@heldergomes sorry for the delay, I've been dealing with quite a bit of backlog :)
I'm now finally at the stage where I'm reviewing this. I'll do a quick rebase and push to get it building again and then start the review and tweaks on my end.

@stgraber stgraber force-pushed the feat-add-snapshot-description-field branch from e8f30b4 to 40a1b63 Compare February 26, 2026 09:59
@heldergomes
Copy link
Copy Markdown
Contributor Author

No worries @stgraber
I will work on the same feature for volumes snapshots, sooner or later I will open the MR.
Only one thing that I probably need help is the migration part, I made few tests and I worry that once a out-of-date incus update to the incus version after this change, the snapshots are not migrate properly.
I'd like to ask to double check carefully the /db/update.go

@stgraber
Copy link
Copy Markdown
Member

Back to this one now that I've got the rest of the Incus 6.22 backlog taken care of ;)

@stgraber
Copy link
Copy Markdown
Member

I'll most likely get that one merged right after 6.22 so we have a whole month with the DB change and can deal with any unexpected consequences :)

@stgraber stgraber force-pushed the feat-add-snapshot-description-field branch from 40a1b63 to db6361c Compare March 4, 2026 15:55
@stgraber
Copy link
Copy Markdown
Member

stgraber commented Mar 4, 2026

I've pushed an initial edit. Basically drops the check in client/, re-orders and re-titles a bunch of commits. I'll look at the pointer in the Args struct next.

I also want to think a bit more about how we expose this stuff in the API as having ExpiresAt and SnapshotDescription feels pretty inconsistent. I need to go back to the issue and see if there's some alternative way to handle that which still doesn't break API ;)

@stgraber stgraber force-pushed the feat-add-snapshot-description-field branch 2 times, most recently from 5da2bbc to bcef8ef Compare March 6, 2026 21:54
heldergomes and others added 13 commits March 25, 2026 00:05
Signed-off-by: Helder Ardachnikoff Gomes <helder.versatti@gmail.com>
This change add snapshot_description as a new extension

Signed-off-by: Helder Ardachnikoff Gomes <helder.versatti@gmail.com>
The snapshot description field has added on snapshot creation and list
commands from incus cli in order to enable the management of this new
field

Signed-off-by: Helder Ardachnikoff Gomes <helder.versatti@gmail.com>
Previously, snapshot fields were mixed with instance fields within the
instanceArgs. With the introduction of the new snapshot API field, it
became necessary to introduce a nested SnapshotArgs within the
instanceArgs for better encapsulation. Furthermore, updates were made to
the instance driver interface to properly handle the retrieval and
updating of snapshot descriptions.

Signed-off-by: Helder Ardachnikoff Gomes <helder.versatti@gmail.com>
This change add snapshot_description on existing snapshots endpoint

Signed-off-by: Helder Ardachnikoff Gomes <helder.versatti@gmail.com>
It needs ensure that snapshot description is sent and received during
migration.

Signed-off-by: Helder Ardachnikoff Gomes <helder.versatti@gmail.com>
After create snapshot property table, it was necessary clean up few
fields in snapshot and instance table, and also few functions was made
to parse snapshot properties

Signed-off-by: Helder Ardachnikoff Gomes <helder.versatti@gmail.com>
After change instanceArgs object it was necessary change drivers to
manage properly the new instanceArgs model, futhermore mostly action
through instance snapshot is controlled by qemu/lxc driver so few
functions had to be changed

Signed-off-by: Helder Ardachnikoff Gomes <helder.versatti@gmail.com>
Signed-off-by: Helder Ardachnikoff Gomes <helder.versatti@gmail.com>
Signed-off-by: Helder Ardachnikoff Gomes <helder.versatti@gmail.com>
Signed-off-by: Helder Ardachnikoff Gomes <helder.versatti@gmail.com>
Signed-off-by: Helder Ardachnikoff Gomes <helder.versatti@gmail.com>
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
@stgraber stgraber force-pushed the feat-add-snapshot-description-field branch from bcef8ef to 09cd0f8 Compare March 25, 2026 04:23
@stgraber
Copy link
Copy Markdown
Member

@heldergomes sorry for all the delays...
I was looking into this one again today after a rebase and it's now failing to build because of the dependent volume logic we've since merged.

It's not obvious to me how to change that code path to work with your new logic.
If you have a bit of time, it'd be great if you could take a look!

I've pushed what I've got here into your branch.

@heldergomes
Copy link
Copy Markdown
Contributor Author

Hello @stgraber I will working on this fix!
I'm on this!

@stgraber
Copy link
Copy Markdown
Member

stgraber commented Apr 2, 2026

Thanks!

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

Labels

API Changes to the REST API Documentation Documentation needs updating

Development

Successfully merging this pull request may close these issues.

2 participants