How to manage storage¶
See first:
Manage storage for a machine charm¶
Define the storage¶
Each storage can be defined as supporting a single or multiple storage instances. If you define a storage as supporting multiple instances, your charm’s users can use juju add-storage to increase the number of instances attached to the current unit. (Note that this command doesn’t ‘grow’ existing instances).
Let’s define a storage called cache that supports multiple instances. In charmcraft.yaml:
storage:
cache:
description: Somewhere to cache files locally.
type: filesystem
properties:
- transient
minimum-size: 1G
multiple:
range: 1-10
When your charm is deployed, by default Juju attaches one storage instance to each unit - the minimum of the range 1-10. The instance is at least 1GB in size. Each additional instance that’s attached will also be at least 1GB in size.
Juju mounts each storage instance in the unit’s filesystem. Your charm should configure the workload with the path of each mounted instance.
You can specify where to