Friday, January 23, 2015

Solaris 11: adding additional Disk/LUN to a zone ONLINE


Documentation by: mgerdts

Solaris 11.2 allows you to modify your zone configuration and apply those changes without a reboot.  Check this out:
First, I want to show that there are no disk devices present in the zone.
root@vzl-212:~# zlogin z1 'find /dev/*dsk'
/dev/dsk
/dev/rdsk
Next, I modify the static zone configuration to add a access to all partitions of a particular disk.  This has no effect on the running zone.
root@vzl-212:~# zonecfg -z z1
zonecfg:z1> add device
zonecfg:z1:device> set match=/dev/*dsk/c0t600144F0DBF8AF19000052EC175B0004d0*
zonecfg:z1:device> end
zonecfg:z1> exit
I then use zoneadm to apply the changes in the zone configuration to the running zone.
root@vzl-212:~# zoneadm -z z1 apply
zone 'z1': Checking: Adding device match=/dev/*dsk/c0t600144F0DBF8AF19000052EC175B0004d0*
zone 'z1': Applying the changes
And now, the zone can see the devices.
root@vzl-212:~# zlogin z1 'find /dev/*dsk'
/dev/dsk
/dev/dsk/c0t600144F0DBF8AF19000052EC175B0004d0
/dev/dsk/c0t600144F0DBF8AF19000052EC175B0004d0s0
/dev/dsk/c0t600144F0DBF8AF19000052EC175B0004d0s1
/dev/dsk/c0t600144F0DBF8AF19000052EC175B0004d0s2
/dev/dsk/c0t600144F0DBF8AF19000052EC175B0004d0s3
/dev/dsk/c0t600144F0DBF8AF19000052EC175B0004d0s4
/dev/dsk/c0t600144F0DBF8AF19000052EC175B0004d0s5
/dev/dsk/c0t600144F0DBF8AF19000052EC175B0004d0s6
/dev/rdsk
/dev/rdsk/c0t600144F0DBF8AF19000052EC175B0004d0
/dev/rdsk/c0t600144F0DBF8AF19000052EC175B0004d0s0
/dev/rdsk/c0t600144F0DBF8AF19000052EC175B0004d0s1
/dev/rdsk/c0t600144F0DBF8AF19000052EC175B0004d0s2
/dev/rdsk/c0t600144F0DBF8AF19000052EC175B0004d0s3
/dev/rdsk/c0t600144F0DBF8AF19000052EC175B0004d0s4
/dev/rdsk/c0t600144F0DBF8AF19000052EC175B0004d0s5
/dev/rdsk/c0t600144F0DBF8AF19000052EC175B0004d0s6
If I wanted to just temporarily modify the configuration, there's an option to just modify the running configuration. For example, if I plan on doing some maintenance on my ZFS Storage Appliance that hosts the LUN I allocated above, I may want to be sure that the zone can't see it for a bit.  That's easy enough.
Here I use zonecfg's -r option to modify the running configuration.
root@vzl-212:~# zonecfg -z z1 -r
zonecfg:z1> info device
device:
    match: /dev/*dsk/c0t600144F0DBF8AF19000052EC175B0004d0*
    storage not specified
    allow-partition not specified
    allow-raw-io not specified
zonecfg:z1> remove device
zonecfg:z1> info device
zonecfg:z1> commit
zone 'z1': Checking: Removing device match=/dev/*dsk/c0t600144F0DBF8AF19000052EC175B0004d0*
zone 'z1': Applying the changes
zonecfg:z1> exit
Without the -r option, zonecfg displays the on-disk configuration.
root@vzl-212:~# zonecfg -z z1 info device
device:
    match: /dev/*dsk/c0t600144F0DBF8AF19000052EC175B0004d0*
    storage not specified
    allow-partition not specified
    allow-raw-io not specified

 
root@vzl-212:~# zonecfg -z z1 -r info device
root@vzl-212:~#
The running configuration reflects the contents of /dev/dsk and /dev/rdsk inside the zone.
root@vzl-212:~# zlogin z1 'find /dev/*dsk'
/dev/dsk
/dev/rdsk
When it is time to revert back to the on-disk configuration, simply apply the on-disk configuration and the device tree inside the zone reverts to the on-disk configuration.
root@vzl-212:~# zoneadm -z z1 apply
zone 'z1': Checking: Adding device match=/dev/*dsk/c0t600144F0DBF8AF19000052EC175B0004d0*
zone 'z1': Applying the changes

 
root@vzl-212:~# zlogin z1 'find /dev/*dsk'
/dev/dsk
/dev/dsk/c0t600144F0DBF8AF19000052EC175B0004d0
/dev/dsk/c0t600144F0DBF8AF19000052EC175B0004d0s0
/dev/dsk/c0t600144F0DBF8AF19000052EC175B0004d0s1
/dev/dsk/c0t600144F0DBF8AF19000052EC175B0004d0s2
/dev/dsk/c0t600144F0DBF8AF19000052EC175B0004d0s3
/dev/dsk/c0t600144F0DBF8AF19000052EC175B0004d0s4
/dev/dsk/c0t600144F0DBF8AF19000052EC175B0004d0s5
/dev/dsk/c0t600144F0DBF8AF19000052EC175B0004d0s6
/dev/rdsk
/dev/rdsk/c0t600144F0DBF8AF19000052EC175B0004d0
/dev/rdsk/c0t600144F0DBF8AF19000052EC175B0004d0s0
/dev/rdsk/c0t600144F0DBF8AF19000052EC175B0004d0s1
/dev/rdsk/c0t600144F0DBF8AF19000052EC175B0004d0s2
/dev/rdsk/c0t600144F0DBF8AF19000052EC175B0004d0s3
/dev/rdsk/c0t600144F0DBF8AF19000052EC175B0004d0s4
/dev/rdsk/c0t600144F0DBF8AF19000052EC175B0004d0s5
/dev/rdsk/c0t600144F0DBF8AF19000052EC175B0004d0s6
Live Zone Reconfiguration is not limited to just device resources, it works with most other resources as well.  See the Live Zones Reconfiguration section in zones(5).

No comments:

Post a Comment