lxd icon indicating copy to clipboard operation
lxd copied to clipboard

Error in lxc image copy after upgrade to 4.19

Open vikrantrathore opened this issue 3 years ago • 2 comments

After the cluster upgrade to version 4.19 find an issue in lxc image copy with projects. Steps to replicate error:

# Create a test container
$ lxc launch ubuntu:20.04 test1 --project test1
$ lxc stop test1 --project test1
$ lxc publish test1 --alias test-image-1 --project test1
$ lxc image copy test-image-1 local: --auto-update --project test1
Error: Not Found
$ lxc image info test-image-1 --project test1

Fingerprint: xxxxxxxxxxxxxx (removed for clarity)
Size: 1449.47MB
Architecture: x86_64
Type: container
Public: no
Timestamps:
    Created: 2021/10/28 03:10 UTC
    Uploaded: 2021/10/28 03:10 UTC
    Expires: never
    Last used: never
Properties:
    description: Ubuntu 20.04 LTS server (20210825)
    os: ubuntu
    release: focal
    architecture: x86_64
Aliases:
    - test-image-1
Cached: no
Auto update: disabled
Profiles:
    - default

$ lxc project show test1
config:
  features.images: "true"
  features.profiles: "false"
  features.storage.volumes: "false"
description: ""
name: test1
used_by:
- /1.0/images/194281a78761e6c322b3d1a8bbeb418b6f43d1e0a2c19d807192b467d32f4739?project=test1
- /1.0/images/5fc94479f588171282beb094da96bb83eb51420d6cf13b223c737d1fda9169cd?project=test1
- /1.0/instances/test1?project=test1

This used to work until version 4.18 and stopped working as soon as LXD upgrade to 4.19.

Probably some changes done in the new updates for image handling.

$ lxc project ls
+-------------------+--------+----------+-----------------+----------+---------------------+---------+
|       NAME        | IMAGES | PROFILES | STORAGE VOLUMES | NETWORKS |     DESCRIPTION     | USED BY |
+-------------------+--------+----------+-----------------+----------+---------------------+---------+
| default (current) | YES    | YES      | YES             | YES      | Default LXD project | 4       |
+-------------------+--------+----------+-----------------+----------+---------------------+---------+
| test              | YES    | NO       | NO              | NO       |                     | 3       |
+-------------------+--------+----------+-----------------+----------+---------------------+---------+

$ lxc image ls
+-------+--------------+--------+-------------------------------------+--------------+-----------------+----------+-------------------------------+
| ALIAS | FINGERPRINT  | PUBLIC |             DESCRIPTION             | ARCHITECTURE |      TYPE       |   SIZE   |          UPLOAD DATE          |
+-------+--------------+--------+-------------------------------------+--------------+-----------------+----------+-------------------------------+
|       | a33719937baa | no     | Ubuntu focal amd64 (20211018_07:42) | x86_64       | CONTAINER       | 103.43MB | Oct 26, 2021 at 12:53pm (UTC) |
+-------+--------------+--------+-------------------------------------+--------------+-----------------+----------+-------------------------------+
|       | d91bf665b110 | no     | Ubuntu focal amd64 (20211018_07:42) | x86_64       | VIRTUAL-MACHINE | 241.38MB | Oct 26, 2021 at 12:53pm (UTC) |
+-------+--------------+--------+-------------------------------------+--------------+-----------------+----------+-------------------------------+

$ lxc image copy a33719937baa local:  --project test
Error: The source server isn't listening on the network

Maybe need an lxc image set command

Reference discussion at https://discuss.linuxcontainers.org/t/error-in-lxc-image-copy-after-upgrade-to-4-19/12485

vikrantrathore avatar Nov 12 '21 06:11 vikrantrathore

To clarify the environment, can you show:

  • lxc remote list
  • lxc project list local:

stgraber avatar Nov 13 '21 03:11 stgraber

Result for lxc remote list:

+-----------------+------------------------------------------+---------------+-------------+--------+--------+--------+
|      NAME       |                   URL                    |   PROTOCOL    |  AUTH TYPE  | PUBLIC | STATIC | GLOBAL |
+-----------------+------------------------------------------+---------------+-------------+--------+--------+--------+
| images          | https://images.linuxcontainers.org       | simplestreams | none        | YES    | NO     | NO     |
+-----------------+------------------------------------------+---------------+-------------+--------+--------+--------+
| local (current) | unix://                                  | lxd           | file access | NO     | YES    | NO     |
+-----------------+------------------------------------------+---------------+-------------+--------+--------+--------+
| ubuntu          | https://cloud-images.ubuntu.com/releases | simplestreams | none        | YES    | YES    | NO     |
+-----------------+------------------------------------------+---------------+-------------+--------+--------+--------+
| ubuntu-daily    | https://cloud-images.ubuntu.com/daily    | simplestreams | none        | YES    | YES    | NO     |
+-----------------+------------------------------------------+---------------+-------------+--------+--------+--------+

Result of lxc project list local: :

+-------------------+--------+----------+-----------------+----------+---------------------+---------+
|       NAME        | IMAGES | PROFILES | STORAGE VOLUMES | NETWORKS |     DESCRIPTION     | USED BY |
+-------------------+--------+----------+-----------------+----------+---------------------+---------+
| default (current) | YES    | YES      | YES             | YES      | Default LXD project | 4       |
+-------------------+--------+----------+-----------------+----------+---------------------+---------+
| test              | YES    | NO       | NO              | NO       |                     | 3       |
+-------------------+--------+----------+-----------------+----------+---------------------+---------+

vikrantrathore avatar Nov 18 '21 03:11 vikrantrathore

I've confirmed the steps above do create the error reported.

Reverting this change (which doesn't make sense to me because it ignores the --project flag):

https://github.com/lxc/lxd/blob/master/lxc/image.go#L189-L197

Avoids the not found error, but instead we get:

lxc image copy test-image-1 local: --auto-update --project test1
Error: The source and target servers must be different

That check has been there for 6 years, so not clear how this ever worked. https://github.com/lxc/lxd/blob/master/client/lxd_images.go#L671

But I agree really we need a lxc image set --attribute command similar to described here https://github.com/lxc/lxd/issues/10960#issuecomment-1264140543 as ultimately having to do a copy action to modify attributes isn't the correct behavior.

tomponline avatar Dec 05 '22 11:12 tomponline

Hello, I am representing a group of undergraduate UT Austin students aiming to contribute to open-source virtualization projects on behalf of a virtualization course. Could we have this issue assigned to us?

kiranchandrasekhar avatar Mar 26 '23 23:03 kiranchandrasekhar

Thanks @Kingran15 assigned to you. I just want to check @stgraber is happy with the proposal first before you start.

tomponline avatar Mar 27 '23 08:03 tomponline

So shouldn't we just do #10960 and close this one instead?

stgraber avatar Mar 27 '23 12:03 stgraber

Ah yes thanks @stgraber that is indeed the more general form of this issue.

tomponline avatar Mar 27 '23 13:03 tomponline

@Kingran15 if @gabrielmougard has not started working on #10960 yet then we could assign it to you if he doesn't mind.

tomponline avatar Mar 27 '23 13:03 tomponline