Saturday, 20 December 2014

Simulating your Clustered ONTAP Environment: Part 2 - Volumes

Continuing from Part 1...

Firstly run ::>

rows 0
set -privilege admin # The formulas below work for output from admin level
set -confirmations off
set -showseparator "#"
set -units B

3) Volumes

For volumes, at the moment we’re only interested in the following output from the Clustershell ::>

vol show -vserver GBHDCNAS300V1 -volume !*rootvol* -fields vserver,volume,aggregate,size,type,security-style,comment,space-guarantee,percent-snapshot-space,snapshot-policy,language

Copy and paste this into Excel using the ‘Text Import Wizard’ and # as a delimiter. Excel will be used to construct the following command:

volume create -vserver {vserver} -volume {volume} -aggregate {aggregate} -size {size} -type {type} -security-style {style} -comment {comment} -space-guarantee {guarantee} -precent-snapshot-space {percent} -snapshot-policy {policy} -language {language}

And here is the Excel formula to generate our output:

=CONCATENATE("volume create -vserver ",A3," -volume ",B3," -aggregate ",C3," -size ",(INT(LEFT(D3,LEN(D3)-1)/(1024*10))),"B -type ",(IF(E3="RW","RW","DP"))," -security-style ",F3," -comment ","""",G3,""""," -space-guarantee ",H3," -percent-snapshot-space ",(I3*100)," -snapshot-policy ",J3," -language ",K3)

And copy and paste the commands in via PuTTY!

Note 1: The /(1024*10) is because the simulator has a lot less capacity than the real world systems (you may want to adjust this.)
Note 2: The - IF(E3="RW","RW","DP") - gets around TMP type volumes needing to be created as type DP.
Note 3: Some volumes may fail to create with “Error: command failed: Size ... is too small.  Minimum size is 20971520” - recreate the volumes with the minimum size, or - better (since it’s reusable in the spreadsheet) - edit the size in the spreadsheet to 20971520*1024*10 = 214748364800B.

4) TMP Type Volumes

Volumes which were originally TMP can be set to TMP using ::>

set -privilege diagnostic

And the following Clustershell command ::>

volume transition-protect -vserver {vserver} -volume {volume} -is-enabled on

We can get the complete script of commands from the output of the Excel spreadsheet and the formula:

=IF(E3="TMP",(CONCATENATE("volume transition-protect -vserver ",A3," -volume ",B3," -is-enabled on")),"")

5) Source Volumes for TMP Type Volumes or DP Type Volumes with a 7-Mode Source

To generate the source volumes on the source 7-Mode system for volumes that are TMP type, uses the command syntax >

vol create {vol-name} -l {language} -s {guarantee} {hosting-aggr} {size}

Generate the command script using the spreadsheet and the Excel formula:

=IF(E3="TMP",(CONCATENATE("vol create ",B3," -l ",K3," -s ",H3," aggr0 ",(INT(LEFT(D3,LEN(D3)-1)/(1024*10))))),"")

Note 1: This is also using /(1024*10) to make the SIM volumes smaller than the real ones.
Note 2: The 7-Mode SIM here has just one aggr called aggr0.

If volume transition-protect has already been removed, and there are DP type volumes with a 7-Mode Source, the slightly adjusted Excel formula will work (verify that the source is indeed 7-mode first!):

=IF(E3="DP",(CONCATENATE("vol create ",B3," -l ",K3," -s ",H3," aggr0 ",(INT(LEFT(D3,LEN(D3)-1)/(1024*10))))),"")

6) Destination DP type volumes (not Vault)

On the destination Vserver, create the DP type volumes from the output of the Excel formula, first replacing the contents of column A3 with the name of the destination SVM, and C3 with the name(s) of the destination aggregate(s):

=IF(E3="RW",(CONCATENATE("volume create -vserver ",A3," -volume ",B3," -aggregate ",C3," -size ",(INT(LEFT(D3,LEN(D3)-1)/(1024*10))),"B -type DP -security-style ",F3," -comment ","""",G3,""""," -space-guarantee ",H3," -percent-snapshot-space ",(I3*100)," -snapshot-policy none -language ",K3)),"")

Note 1: DP volumes must be created with a Snapshot Policy of “none”, otherwise you’ll get an error “Error: command failed: Snapshot policy must be "none" for DC, DP and LS volumes.”
Note 2: To collect the not-RW type volumes from the sheet, the modified Excel formula becomes (replacing the equals with a greater than and less than sign):

=IF(E3<>"RW",(CONCATENATE("volume create -vserver ",A3," -volume ",B3," -aggregate ",C3," -size ",(INT(LEFT(D3,LEN(D3)-1)/(1024*10))),"B -type DP -security-style ",F3," -comment ","""",G3,""""," -space-guarantee ",H3," -percent-snapshot-space ",(I3*100)," -snapshot-policy none -language ",K3)),"")

7) Destination DP type volumes (SnapVaults)

This is pretty much the same as 6, the only difference is that we make the volumes twice as big (only divide by (1024*5) and not (1024*10). The reason for doing this is that eventually the SnapVaults will have a much larger retention than the production and DR volumes. Again, replace the contents of column A3 with the name of the destination SnapVault SVM, and C3 with the name(s) of the destination SnapVault aggregate(s):

=IF(E3="RW",(CONCATENATE("volume create -vserver ",A3," -volume ",B3," -aggregate ",C3," -size ",(INT(LEFT(D3,LEN(D3)-1)/(1024*5))),"B -type DP -security-style ",F3," -comment ","""",G3,""""," -space-guarantee ",H3," -percent-snapshot-space ",(I3*100)," -snapshot-policy none -language ",K3)),"")

And after this part, we should have all our volumes in place!

TO BE CONTINUED...

No comments:

Post a Comment