Hi,
i am unable to attach Storage volume to container.
commands
sudo lxc launch ubuntu:20.04 etcd-2
Creating etcd-2
Starting etcd-2
sudo lxc storage volume create local etcd-storage-1 size=200GB
Storage volume etcd-storage-1 created
sudo lxc storage volume attach local etcd-storage-1 etcd-2 etcd-1 /dev/etcd
ERROR:
Error: Failed to add device “etcd-1”: Failed loading custom volume: No such object
tomp
(Thomas Parrott)
March 24, 2021, 1:55pm
2
Please show output of lxc ls
and lxc storage volume ls local
.
sudo lxc storage volume ls local
+-----------+------------------------------------------------------------------+-------------+--------------+---------+----------+
| TYPE | NAME | DESCRIPTION | CONTENT-TYPE | USED BY | LOCATION |
+-----------+------------------------------------------------------------------+-------------+--------------+---------+----------+
| container | etcd-1 | | filesystem | 1 | ps001 |
+-----------+------------------------------------------------------------------+-------------+--------------+---------+----------+
| container | etcd-2 | | filesystem | 1 | ps002 |
+-----------+------------------------------------------------------------------+-------------+--------------+---------+----------+
| custom | etcd-storage | | filesystem | 0 | ps001 |
+-----------+------------------------------------------------------------------+-------------+--------------+---------+----------+
| custom | etcd-storage-1 | | filesystem | 0 | ps001 |
+-----------+------------------------------------------------------------------+-------------+--------------+---------+----------+
| image | 8053cb95e852440e8e9379614e4b0c5bd0164afe1314a852a9799cf9e6f43f59 | | filesystem | 1 | ps001 |
+-----------+------------------------------------------------------------------+-------------+--------------+---------+----------+
| image | 8053cb95e852440e8e9379614e4b0c5bd0164afe1314a852a9799cf9e6f43f59 | | filesystem | 1 | ps002 |
+-----------+------------------------------------------------------------------+-------------+--------------+---------+----------+
sudo lxc ls
+--------+---------+----------------------+------+-----------+-----------+----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | LOCATION |
+--------+---------+----------------------+------+-----------+-----------+----------+
| etcd-1 | RUNNING | 240.165.0.138 (eth0) | | CONTAINER | 0 | ps001 |
+--------+---------+----------------------+------+-----------+-----------+----------+
| etcd-2 | RUNNING | 240.169.0.80 (eth0) | | CONTAINER | 0 | ps002 |
+--------+---------+----------------------+------+-----------+-----------+----------+
tomp
(Thomas Parrott)
March 24, 2021, 1:58pm
4
Does just this below, work (i.e not specifying device name for the instance)?
lxc storage volume attach local etcd-storage-1 etcd-2 /dev/etcd
i tried both with device name and without device name,Both are giving error
with device_name
sudo lxc storage volume attach local etcd-storage-1 etcd-2 etcd-1 /dev/etcd
etcd-1 is device name
Error: Failed to add device “etcd-1”: Failed loading custom volume: No such object
with out device_name
sudo lxc storage volume attach local etcd-storage-1 etcd-2 /dev/etcd
Error: Failed to add device “etcd-storage-1”: Failed loading custom volume: No such object
tomp
(Thomas Parrott)
March 24, 2021, 2:34pm
6
Are you in a project? Show output of lxc project ls
please?
tomp:
lxc project ls
Yes,Using default project.
sudo lxc project ls
±------------------±-------±---------±----------------±---------±--------------------±--------+
| NAME | IMAGES | PROFILES | STORAGE VOLUMES | NETWORKS | DESCRIPTION | USED BY |
±------------------±-------±---------±----------------±---------±--------------------±--------+
| default (current) | YES | YES | YES | YES | Default LXD project | 7 |
±------------------±-------±---------±----------------±---------±--------------------±--------+
This is the expected behavior. Your etcd-2
container is running on ps002
while your storage volume etcd-storage-1
is running on ps001
. If you want to have shared storage volumes, you need to use Ceph, as all others storage backends (dir, btrfs, zfs, and lvm) are local to each node.
tomp
(Thomas Parrott)
March 25, 2021, 8:46am
9
Ah yes indeed, good spotting @monstermunchkin !
ok,Thank you
Can we assign which system it should create like container should create ps001 and storage also should create ps001,While creating can we give any addition command like target??
Yes, that’s possible with the --target=<location>
option. Here’s an example:
lxc launch ubuntu:20.04 etcd-2 --target=ps002
The same applies to storage volumes. Just use the --target
option.
I’ve also noticed that you run lxc
with sudo
. That’s not necessary if the user is in the lxd
group.