update hook for cinder-backend

Hi,

I have deployed my custom cinder backend using the cookie cutter template. Everything is working perfectly fine (this is the link btw) except when the charm tries to do an status update. After the charm has been deployed and several minutes have passed by, if I do a juju status this is what I see.


cinder                            20.3.1   active       3  cinder                  yoga/stable    664  no       Unit is ready
cinder-e590                                waiting      3  cinder-e590                              0  no       Charm configuration in progress
cinder-hacluster                  2.1.2    active       3  hacluster               2.4/stable     131  no       Unit is ready and clustered
cinder-mysql-router               8.0.35   active       3  mysql-router            8.0/stable     111  no       Unit is ready
cinder/0                               active    idle   0         172.16.14.64    8776/tcp        Unit is ready
  cinder-e590/2                        waiting   idle             172.16.14.64                    Charm configuration in progress
  cinder-hacluster/2                   active    idle             172.16.14.64                    Unit is ready and clustered
  cinder-mysql-router/2                active    idle             172.16.14.64                    Unit is ready
cinder/1*                              active    idle   1         172.16.14.65    8776/tcp        Unit is ready
  cinder-e590/0*                       waiting   idle             172.16.14.65                    Charm configuration in progress
  cinder-hacluster/0*                  active    idle             172.16.14.65                    Unit is ready and clustered
  cinder-mysql-router/0*               active    idle             172.16.14.65                    Unit is ready
cinder/2                               active    idle   2         172.16.14.68    8776/tcp        Unit is ready
  cinder-e590/1                        waiting   idle             172.16.14.68                    Charm configuration in progress
  cinder-hacluster/1                   active    idle             172.16.14.68                    Unit is ready and clustered
  cinder-mysql-router/1                active    idle             172.16.14.68                    Unit is ready

As you can see, the charm status changes to configuration in progress (I guess because there is no update hook. I went to check the logs from the cinder-e590 unit (my charm) and I can see this. This makes me think that it did update successfully so I don’t know how to continue now, because the actual storage backend configuration got written to the /etc/cinder/cinder.conf file. I’m not sure what the update should do and why it would be writing down the configuration again.

> 2024-01-03 18:58:47 INFO juju.worker.uniter.operation runhook.go:186 ran "update-status" hook (via hook dispatching script: dispatch)
> 2024-01-03 19:03:37 INFO unit.cinder-e590/2.juju-log server.go:325 Updating status
> 2024-01-03 19:03:37 INFO unit.cinder-e590/2.juju-log server.go:325 Status updated

Thank you in advance.

Hi Carlos,

  cinder-e590/1                        waiting   idle             172.16.14.68                    Charm configuration in progress

the unit is setting its state to waiting, this is being done by one of the handlers. What handlers are you connecting?, is your charm’s source code publicly available?

Best,

Hi,

sure. I just uploaded the charm to github.

bravocarlos/e590charm (github.com)

I’m connecting only my backend charm to cinder.

The base class OSBaseCharm will check self._stored.is_started to determine if the configuration was done or not (see https://opendev.org/openstack/charm-ops-openstack/src/branch/master/ops_openstack/core.py#L187 ), so you should set self._stored.is_started = True when you are done with the configuration, that will prevent from subsequent runs to the update-status hook to set your units back to waiting state.

thank you so much. With that change it worked as expected.