Scripting changes to multiple zone configurations in the same Global Zone

So this is Solaris 11.1. I have a Global zone that has several non-global zones running in it. I want to change the capped-memory.physical resources setting in ALL the zone configs of the running zones.

if I were to do this manually here's what I would do:

zonecfg -z zone1
select capped-memory 
set physical=16G
end 
verify
commit
exit

Here's the question,

How do I script that? :slight_smile:

If it was a regular setting say:

autoboot=false

then I would do something like:

for i in `zoneadm list -c|grep -v global`;
        do
            zonecfg $i autoboot=true;
        done;

but the part I don't understand is how to do that to a subsection like

capped-memory

example zoneconfig:

zonename: zone1
zonepath: /zones/zone1
brand: solaris
autoboot: false
bootargs:
file-mac-profile:
pool:
limitpriv:
scheduling-class:
ip-type: exclusive
hostid:
fs-allowed:
net:
        address not specified
        allowed-address not specified
        configure-allowed-address: true
        physical: netx
        defrouter not specified
net:
        address not specified
        allowed-address: x.x.x.x/24
        configure-allowed-address: true
        physical: nety
        defrouter not specified
capped-cpu:
        [ncpus: 3.00]
capped-memory:
        physical: 10G
        [swap: 16G]
rctl:
        name: zone.max-swap
        value: (priv=privileged,limit=17179869184,action=deny)
rctl:
        name: zone.cpu-cap
        value: (priv=privileged,limit=300,action=deny)


You can try (didn't test it):

zonecfg -z zone1 "select capped-memory; set physical=16G; end"
1 Like

surprisingly it was that easy. sometimes you can't see the trees for the forest.

I was overthinking it.