Github user cmars commented on a diff in the pull request:

    https://github.com/apache/bigtop/pull/400#discussion_r222424656
  
    --- Diff: bigtop-packages/src/charm/kafka/layer-kafka/reactive/kafka.py ---
    @@ -90,3 +98,39 @@ def serve_client(client, zookeeper):
         client.send_port(kafka_port)
         client.send_zookeepers(zookeeper.zookeepers())
         hookenv.log('Sent Kafka configuration to client')
    +
    +
    +@hook('logs-storage-attached')
    +def storage_attach():
    +    storageids = hookenv.storage_list('logs')
    +    if not storageids:
    +        hookenv.status_set('blocked', 'cannot locate attached storage')
    +        return
    +    storageid = storageids[0]
    --- End diff --
    
    It's explained near the bottom of [this 
section](https://docs.jujucharms.com/2.4/en/developer-storage#adding-storage) 
in the juju docs. Basically, we allow 0 or 1 stores to be attached. 0 allows us 
to deploy with no storage attached; /tmp would be used in that case.
    
    The check above (`if not storageids`) ensures that if we've attached 
storage, we have at least one store, or the list would be empty and we'd be 
blocked. Not sure if that can actually happen (can you attach 0 stores?) but 
this case is covered in any case.
    
    I borrowed this logic & metadata config from the postgresql charm, which 
has a similar storage usage pattern (single mounted volume for data).


---

Reply via email to