question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

obtain storage path in charm container by storage name

See original GitHub issue

I would like to be able to obtain the mounted storage location in a charm container, by storage name.

For example:

storage:
  logs:
    type: filesystem
    # specifying location on the charm container is optional
    # when unspecified, defaults to /var/lib/juju/storage/<name>/<num>

From charm code, I would like to be able to do something like “get_storage_path(“logs”)”.

One option is to increase the scope of self.meta from metadata.yaml to a broader definition. (self.meta.storages["logs"].location in this case would be None.)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:18 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
pengalecommented, Jun 16, 2022

The storage paths for some clouds are deterministic, but I don’t believe that they are guaranteed to be so in the future. AFAIK, the path being deterministic for sidecar charms is a consequence of the current implementation, and not necessarily an intentionally supported feature.

It’s safest to get the path to the storage at runtime, as close to the code that needs it as possible. The lookup is cheap, in terms of CPU resources, and the call is a one liner, so it should do no harm to require charms to do so.

If there’s a circumstance where a charm absolutely cannot get the storage path at the time that it needs it with things as they are currently written, we can re-open and investigate this issue. I believe that it should remain closed for now, however.

1reaction
pengalecommented, Feb 8, 2022

Just wanted to drop a quick note here: I think this is a good idea, and I’ve proposed fixing up location as part of the general update we’re doing to support metadata v2. Will update when/if plans get more concrete.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Storage - Juju
If left unset, the charm container will have the storage volume mounted at a predictable path at /var/lib/juju/storage/<name>/<num> , where <num> is the ......
Read more >
Storage provider - doc - Charmhub - Juju Discourse
The 'cinder' storage provider has a 'volume-type' configuration option whose value is the name of any volume type registered with Cinder.
Read more >
Azure Media Services (v3) - specific output asset container ...
When using the REST API for Create Asset you are able to set the container name: ... You are right, working like a...
Read more >
Blob Containers - Get - REST API (Azure Storage Resource ...
The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length...
Read more >
ConfigMaps | Developer Guide - OpenShift Documentation
The ConfigMap object provides mechanisms to inject containers with configuration data while keeping containers agnostic of OpenShift Container Platform.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found