It does work with --target, it seems there is a problem with cluster in 4.4, this worked fine with 4.3 without specifying the target.
Any solution to this problem?
In our setup I create my own images regularly and the entire code for it does not specify --target, but it seems if this is mandatory than need to change the code.
It sounds like LXD thinks the image got replicated to that node but it’s somehow missing from the filesystem.
lxd sql global "SELECT * FROM nodes;"
lxd sql global "SELECT * FROM images;"
lxd sql global "SELECT * FROM images_nodes;"
Should be useful to figure out whether LXD thinks that particular node has the image, then if it’s missing from /var/snap/lxd/images/ then that’s certainly a problem. You can fix it easily enough by dropping the incorrect DB row, though understanding the condition that causes the DB entry to show up without the matching image making it to disk would be useful.
Having the same issue as above after deleting the image ubuntu:20.04, so checked the sql entries. In spite of deleting the image it still exist in list probably some conflict between image in project vs image in default project.
After further investigation can replicate the error consistently:
# create a test container in test project from ubuntu:20.04 the image has not been downloaded yet in default or specific project.
$ lxc launch ubuntu:20.04 test1 --project testproject
# It launches correctly and shows ubuntu image in list.
$ lxc list --project testproject
+------------------+---------+--------------------+------+-----------+-----------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | LOCATION |
+------------------+---------+--------------------+------+-----------+-----------+-----------+
| test1 | STOPPED | | | CONTAINER | 0 |test-node-1|
+------------------+---------+--------------------+------+-----------+-----------+-----------+
$ lxc image list --project testproject
+--------------------------+--------------+--------+---------------------------------------------+--------------+-----------+-----------+-------------------------------+
| ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCHITECTURE | TYPE | SIZE | UPLOAD DATE |
+--------------------------+--------------+--------+---------------------------------------------+--------------+-----------+-----------+-------------------------------+
| | aedb5a84aaf2 | no | ubuntu 20.04 LTS amd64 (release) (20200907) | x86_64 | CONTAINER | 354.73MB | Sep 14, 2020 at 9:40am (UTC) |
+--------------------------+--------------+--------+---------------------------------------------+--------------+-----------+-----------+-------------------------------+
$ lxc image list
+-------------+--------------+--------+---------------------------------------------+--------------+-----------+----------+------------------------------+
| ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCHITECTURE | TYPE | SIZE | UPLOAD DATE |
+-------------+--------------+--------+---------------------------------------------+--------------+-----------+----------+------------------------------+
| | aedb5a84aaf2 | no | ubuntu 20.04 LTS amd64 (release) (20200907) | x86_64 | CONTAINER | 354.73MB | Sep 14, 2020 at 9:40am (UTC) |
+-------------+--------------+--------+---------------------------------------------+--------------+-----------+----------+------------------------------+
# now try to create container in default project
$ lxc launch ubuntu:20.04 test1
Creating test1
Error: Failed instance creation: Create instance from image: open /var/snap/lxd/common/lxd/images/aedb5a84aaf2e4e443e090511156366a2800c26cec1b6a46f44d153c4bf04205: no such file or directory
Please check the project settings in YAML file:
### Note that the name is shown but cannot be changed
description: ""
config:
features.images: "true"
features.profiles: "false"
features.storage.volumes: "false"
name: testproject
Based on this experiment it looks like when images are shared first it needs to be downloaded in default project and than only subsequent project can use it. If the image is downloaded directly in project it cannot be shared among projects even though features.images: "true" is set.
I’m not sure how many tests we have for image copies / caching between nodes and across projects. I also know we have startup logic to delete any image artifacts that are not present in the DB, so maybe that’s misfiring too?
It seems that the issue is that when the 2nd container is being created, it is placed on a different node than the first container, but thinks it is available locally due to lxc list showing it available.