Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lxd recover loses the expiration dates of snapshots. #13464

Open
simondeziel opened this issue May 9, 2024 · 1 comment
Open

lxd recover loses the expiration dates of snapshots. #13464

simondeziel opened this issue May 9, 2024 · 1 comment
Labels
Bug Confirmed to be a bug
Milestone

Comments

@simondeziel
Copy link
Member

I just went through a successful lxd recover which reimport my container and its snapshots from the intact zpool. Snapshots are taken on a schedule:

# lxc config show -e ganymede | grep snapshot
  snapshots.expiry: 3d
  snapshots.schedule: '@daily, @startup'

However, after lxd recover brought those snapshots back, they lost their expires at field:

# lxc info ganymede | sed -n '/^Snapshots:$/,$ p'
Snapshots:
+---------+----------------------+----------------------+----------+
|  NAME   |       TAKEN AT       |      EXPIRES AT      | STATEFUL |
+---------+----------------------+----------------------+----------+
| snap222 | 2024/05/07 05:28 UTC |                      | NO       |
+---------+----------------------+----------------------+----------+
| snap223 | 2024/05/08 05:28 UTC |                      | NO       |
+---------+----------------------+----------------------+----------+
| snap224 | 2024/05/09 05:28 UTC |                      | NO       |
+---------+----------------------+----------------------+----------+
| snap225 | 2024/05/09 22:21 UTC | 2024/05/12 22:21 UTC | NO       |
+---------+----------------------+----------------------+----------+

In the above, snap225 was taken after the lxd recover.

However, the instance's backup.yaml should have had this information which is where it learned about the taken at field. That said, it seems the recovery have overwritten the backup.yaml with the bogus values now:

# LD_LIBRARY_PATH=/snap/lxd/current/lib/:/snap/lxd/current/lib/x86_64-linux-gnu/ nsenter --mount=/run/snapd/ns/lxd.mnt sed -n '/^volume_snapshots:$/,$ p' /var/snap/lxd/common/lxd/storage-pools/default/containers/ganymede/backup.yaml
volume_snapshots:
- name: snap222
  description: ""
  content_type: filesystem
  created_at: 0001-01-01T00:00:00Z
  expires_at: 0001-01-01T00:00:00Z
  config:
    volatile.uuid: a951c197-c11f-4fcc-a76e-ec575b99e305
- name: snap223
  description: ""
  content_type: filesystem
  created_at: 0001-01-01T00:00:00Z
  expires_at: 0001-01-01T00:00:00Z
  config:
    volatile.uuid: 2b8f7c0c-92da-4170-af35-c5033ec6b89c
- name: snap224
  description: ""
  content_type: filesystem
  created_at: 0001-01-01T00:00:00Z
  expires_at: 0001-01-01T00:00:00Z
  config:
    volatile.uuid: dba273a7-2980-46e4-afc3-ddb7ec617171
- name: snap225
  description: ""
  content_type: filesystem
  created_at: 2024-05-09T22:21:56.762923236Z
  expires_at: 0001-01-01T00:00:00Z
  config:
    volatile.uuid: 93c48d05-4de3-492b-8e6c-f3ce2e3e9c63

Additional information:

# snap list lxd
Name  Version         Rev    Tracking     Publisher   Notes
lxd   5.21.1-d46c406  28460  5.21/stable  canonical✓  -
@simondeziel
Copy link
Member Author

In fact, looking at the snap225 section of the backup.yaml (added post-recovery), it seems that during normal operations LXD doesn't save the right expires_at field in the backup.yaml file.

@tomponline tomponline added the Bug Confirmed to be a bug label May 10, 2024
@tomponline tomponline modified the milestones: lxd-6.1, lxd-6.2 May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed to be a bug
Projects
None yet
Development

No branches or pull requests

2 participants