In Juju, a storage constraint is a collection of storage specifications that can be passed as a positional argument to some commands (add-storage) or as the argument to the --storage option of other commands (deploy, refresh) to dictate how storage is allocated.
A storage constraint is slightly different from a constraint – while the general meaning is similar, the syntax is quite different. For this reason, a storage constraint is sometimes also called a storage directive.
To put together a storage constraint, you need information from both the charm and the storage provider / storage pool.
This constraint has the form <label>=<pool>,<count>,<size>.
The order of the arguments does not actually matter – they are identified based on a regex (pool names must start with a letter and sizes must end with a unit suffix).
<label> is a string taken from the charmed operator itself. It encapsulates a specific storage option/feature. Sometimes it is also called a store.
I have a question regardning using the lxd storage provider, I have juju client installed in a container with manually added lxd cloud as described in this thread:
Right now I would like to deploy openstack from the zed charm, everything seems to work fine except for ceph-osd, I know that I have to use vm instead of container but I have problems adding more block devices:
root@juju-client:~/opens# juju list-storage --volume
No storage to display.
root@juju-client:~/opens# juju model-config | grep storage
storage-default-block-source model remote
storage-default-filesystem-source model lxd
root@juju-client:~/opens# j model-config storage-default-block-source=lxd
root@juju-client:~/opens# juju add-storage ceph-osd/1 osd-devices=64G,1
added storage osd-devices/2 to ceph-osd/1
root@juju-client:~/opens# juju list-storage --volume
Machine Unit Storage ID Volume ID Provider ID Device Size State Message
3 ceph-osd/1 osd-devices/2 3/2 pending creating volume: could not create block file: allocating loop backing file "/var/lib/juju/storage/loop/volume-3-2": fallocate: fallocate failed: No space left on device: exit status 1
root@juju-client:~/opens# juju detach-storage osd-devices/2
detaching osd-devices/2
root@juju-client:~/opens# juju remove-storage osd-devices/2
removing osd-devices/2
root@juju-client:~/opens# juju add-storage ceph-osd/1 osd-devices=remote,64G,1
failed to add storage "osd-devices" to ceph-osd/1: adding "osd-devices" storage to ceph-osd/1: pool "remote" not found
root@juju-client:~/opens# juju add-storage ceph-osd/1 osd-devices=lxd,64G,1
failed to add storage "osd-devices" to ceph-osd/1: adding "osd-devices" storage to ceph-osd/1: "lxd" provider does not support "block" storage
Is there any way I can use a particular pool from my lxd cloud?
lxc storage ls
+--------+--------+-------------+---------+---------+
| NAME | DRIVER | DESCRIPTION | USED BY | STATE |
+--------+--------+-------------+---------+---------+
| local | zfs | | 18 | CREATED |
+--------+--------+-------------+---------+---------+
| remote | ceph | | 48 | CREATED |
+--------+--------+-------------+---------+---------+
In particular I would like to use the latter pool - remote which has 90% of my free space.
Could you add some hints to the documentation?
Thank you for any help
P.S - I am tagging @tlm in regard to the thread mentioned at the beginning, maybe you figured it out, how to interact with the cloud in case of juju-client being run from container
Thanks for bringing this up! All the examples I can see seem to assume the order mentioned in this doc: <label>=<pool>,<size>,<count>. However, I can see how that contradicts what’s in the other doc. I’ll check to see which one is correct and then update the docs accordingly.