How to apply snapshots.expiry: 3d to all my container using profile?

Hi,
I was testing snapshot expiry and it work very well on a per container setting.

I try to modify the default profile to add in the config setting the snapshots.expiry without success.

Lxc info container would not give the expiration time !

Is this normal ?

The expiry only applies to new snapshots, not to the existing ones, could that be the problem?

Setting the key on the profile should show up in lxc config show --expanded NAME , if that’s the case, then I would expect new snapshots to have the proper expiry.

I confirm that the snapshot was new and taken after modification apply to the profile !

The first snap was done with the profile config
The second snap was done with the container config

I have recreate the container and tested it twice

Snapshots:
snap0 (taken at 2020/03/13 17:02 UTC) (stateless)
snap1 (taken at 2020/03/13 17:03 UTC) (expires at 2020/03/13 17:04 UTC) (stateless)

#lxc profile show default
config:
snapshots.expiry: 2M
description: Default LXD profile
devices:
eth0:
name: eth0
nictype: bridged
parent: br1
type: nic
root:
path: /
pool: local
type: disk
name: default
used_by:

  • /1.0/instances/first
  • /1.0/instances/lxdMosaic
  • /1.0/instances/Jellyfin
  • /1.0/instances/graylog3
  • /1.0/instances/ns1
  • /1.0/instances/bkp-aptcache
  • /1.0/instances/bkp-checkmk
  • /1.0/instances/bkp-graylog2
  • /1.0/instances/bkp-ns2
  • /1.0/instances/bkp-plex
  • /1.0/instances/bkp-unify
  • /1.0/instances/bkp-xwiki
  • /1.0/instances/bkp-gui1804
  • /1.0/instances/test

#lxc launch ubuntu: test
Creating test
Starting test

#lxc config show --expanded test
architecture: x86_64
config:
image.architecture: amd64
image.description: ubuntu 18.04 LTS amd64 (release) (20200218)
image.label: release
image.os: ubuntu
image.release: bionic
image.serial: “20200218”
image.type: squashfs
image.version: “18.04”
snapshots.expiry: 2M
volatile.base_image: 8c4e87e53c024e0449003350f0b0626b124b68060b73c0a7ad9547670e00d4b3
volatile.eth0.host_name: veth0d963311
volatile.eth0.hwaddr: 00:16:3e:db:d5:7e
volatile.idmap.base: “0”
volatile.idmap.current: ‘[{“Isuid”:true,“Isgid”:false,“Hostid”:1000000,“Nsid”:0,“Maprange”:1000000000},{“Isuid”:false,“Isgid”:true,“Hostid”:1000000,“Nsid”:0,“Maprange”:1000000000}]’
volatile.idmap.next: ‘[{“Isuid”:true,“Isgid”:false,“Hostid”:1000000,“Nsid”:0,“Maprange”:1000000000},{“Isuid”:false,“Isgid”:true,“Hostid”:1000000,“Nsid”:0,“Maprange”:1000000000}]’
volatile.last_state.idmap: ‘[{“Isuid”:true,“Isgid”:false,“Hostid”:1000000,“Nsid”:0,“Maprange”:1000000000},{“Isuid”:false,“Isgid”:true,“Hostid”:1000000,“Nsid”:0,“Maprange”:1000000000}]’
volatile.last_state.power: RUNNING
devices:
eth0:
name: eth0
nictype: bridged
parent: br1
type: nic
root:
path: /
pool: local
type: disk
ephemeral: false
profiles:

  • default
    stateful: false
    description: “”

# lxc snapshot test
# lxc info test
Name: test
Location: none
Remote: unix://
Architecture: x86_64
Created: 2020/03/13 17:07 UTC
Status: Running
Type: container
Profiles: default
Pid: 24243
Ips:
eth0: inet 192.168.1.187 veth0d963311
lo: inet 127.0.0.1
Resources:
Processes: 24
Disk usage:
root: 7.40MB
CPU usage:
CPU usage (in seconds): 12
Memory usage:
Memory (current): 130.11MB
Network usage:
eth0:
Bytes received: 225.31kB
Bytes sent: 4.32kB
Packets received: 1000
Packets sent: 36
lo:
Bytes received: 1.29kB
Bytes sent: 1.29kB
Packets received: 16
Packets sent: 16
Snapshots:

  • snap0 (taken at 2020/03/13 17:10 UTC) (stateless)*

I pushed https://github.com/lxc/lxd/pull/7022 which contains a fix for this issue.

1 Like

Tanks you ! have a great weekend !

It works ! tested it last night with installed: 3.22 (13814)

Merci :slight_smile: