Per unit configuration

help-needed

#1

Hi everyone,
This may be a juju anti-pattern but is there a way of customising application configuration on a per-unit basis?

To provide a concrete example of where this might be useful I have deployed charmed openstack which provides 1 or more units of the nova-compute application depending on the number of compute nodes. I have heterogeneous hardware and I’d like to be able to set different values for reserved-host-memory, for each compute node. This is supported by nova by modifying /etc/nova/nova.conf on the relevant host however juju config nova-compute reserved-host-memory=<new_number> will modify all instances of nova-compute, and there doesn’t appear to be a way to constrain this change to a particular unit/machine/other_relevant_entity.


#2

Unit-specific config is going against the grain… Juju prefers to think at the application level and treat units as ephemeral clones.

Depending on the level of heterogeneity, one option would be to create another instance of the nova-compute charm with different name. You could then manually add machines to that:

# if hardware already exists, ask juju to add it via SSH 
juju add-machine [ssh:<user>@<ip-address-0>] # creates <machine-id-0>

# if you want to recruit a machine from MAAS, use the --constraints option
juju add-machine [--constraints="mem=16G"]  # creates <machine-id-1>

juju deploy nova-compute nova-highmem  --to <machine-id-0>,<machine-id-1>
juju config nova-highmem reserved-host-memory=<new_number>

If you then wanted to add more units to the nova-highmem grouping, use the add-unit command:

juju add-machine ssh:<user>@<ip-address-n>
juju add-unit nova-highmem --to <ip-address-n>

If every machine is different, you could use juju scp on each machine to set /etc/nova/nova.conf values yourself… but that’s obviously very brittle.


#3

Ok cool, I was thinking perhaps this would be the case.

/etc/nova/nova.conf on the host says its managed by juju and shouldn’t be modified; are local modifications likely to be wiped out by some kind of periodical run (of the unit agent perhaps)?

Is there a method by which this could be supported by the charm itself?

Thanks for you help!


#4

I think the second command in your Tim should be

juju config nova-highmem reserved-host-memory=<new_number>


#5

As per @timClicks suggestion, you seggregate different hardware to different applications, thus each nova-compute application can have its own configuration. There is no need to “edit” nova.conf manually and worry about wiping out any modifications.


#6

You’re right. Thanks, will fix.


#7

@brettmilford Hi Brett, checking in. Did you manage to get things working as you wanted?