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

lxc image copy doesnt set Cached: false for pre-existing cached image #13271

Closed
tomponline opened this issue Apr 8, 2024 · 0 comments · Fixed by #13296
Closed

lxc image copy doesnt set Cached: false for pre-existing cached image #13271

tomponline opened this issue Apr 8, 2024 · 0 comments · Fixed by #13296
Assignees
Labels
Bug Confirmed to be a bug
Milestone

Comments

@tomponline
Copy link
Member

If you copy a remote image to a local LXD server and a cached image already exists for that fingerprint, its Auto update property is correctly set to disabled, but its Cached property isn't set to false.

Download fresh image to local server as alias foo:

lxc image copy images:alpine/3.19 local: --alias foo
lxc image info foo
Fingerprint: e0a6de8ce6a290330969969c77c75f5f78fad63c9eb56cc281f76dddea2b866e
Size: 2.93MiB
Architecture: x86_64
Type: container
Public: no
Timestamps:
    Created: 2024/04/08 00:00 UTC
    Uploaded: 2024/04/08 07:20 UTC
    Expires: never
    Last used: never
Properties:
    release: 3.19
    requirements.secure_boot: false
    serial: 20240408_0017
    type: squashfs
    variant: default
    architecture: amd64
    description: alpine  amd64 (20240408_0017)
    os: alpine
Aliases:
    - foo
Cached: no
Auto update: disabled
Source:
    Server: https://images.lxd.canonical.com
    Protocol: simplestreams
    Alias: alpine/3.19
Profiles:
    - default

Note:

Aliases:
    - foo
Cached: no
Auto update: disabled

Now lets delete the image and see what happens when its downloaded implicitly as part of an instance create:

lxc image delete e0a6de8ce6a290330969969c77c75f5f78fad63c9eb56cc281f76dddea2b866e
lxc init images:alpine/3.19 c1
lxc image info e0a6de8ce6a290330969969c77c75f5f78fad63c9eb56cc281f76dddea2b866e
Fingerprint: e0a6de8ce6a290330969969c77c75f5f78fad63c9eb56cc281f76dddea2b866e
Size: 2.93MiB
Architecture: x86_64
Type: container
Public: no
Timestamps:
    Created: 2024/04/08 00:00 UTC
    Uploaded: 2024/04/08 07:22 UTC
    Expires: never
    Last used: 2024/04/08 07:22 UTC
Properties:
    os: alpine
    release: 3.19
    requirements.secure_boot: false
    serial: 20240408_0017
    type: squashfs
    variant: default
    architecture: amd64
    description: alpine  amd64 (20240408_0017)
Aliases:
Cached: yes
Auto update: enabled
Source:
    Server: https://images.lxd.canonical.com
    Protocol: simplestreams
    Alias: alpine/3.19
Profiles:
    - default

Note:

Aliases:
Cached: yes
Auto update: enabled

Now lets copy the remote image explicitly to the local server with an alias like we did before (without deleting the cached image first):

lxc image copy images:alpine/3.19 local: --alias foo
lxc image info e0a6de8ce6a290330969969c77c75f5f78fad63c9eb56cc281f76dddea2b866e
Fingerprint: e0a6de8ce6a290330969969c77c75f5f78fad63c9eb56cc281f76dddea2b866e
Size: 2.93MiB
Architecture: x86_64
Type: container
Public: no
Timestamps:
    Created: 2024/04/08 00:00 UTC
    Uploaded: 2024/04/08 07:22 UTC
    Expires: never
    Last used: 2024/04/08 07:22 UTC
Properties:
    type: squashfs
    variant: default
    architecture: amd64
    description: alpine  amd64 (20240408_0017)
    os: alpine
    release: 3.19
    requirements.secure_boot: false
    serial: 20240408_0017
Aliases:
    - foo
Cached: yes
Auto update: disabled
Source:
    Server: https://images.lxd.canonical.com
    Protocol: simplestreams
    Alias: alpine/3.19
Profiles:
    - default

Note:

Aliases:
    - foo
Cached: yes
Auto update: disabled

So the Aliases and Auto updated properties have been set to the same values as when we copied the image explicitly the first time, but the Cached property is still set to yes which means it will be a candidate for auto removal.

We should ensure that if an image is explicitly copied to a local alias and that the fingerprint already exists as a cached image that it has Cached set to No so that it mirrors the behaviour that occurs when no pre-existing cached image exists.

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

Successfully merging a pull request may close this issue.

2 participants