A very small script to check the masking information for each of the cloned devices.

A very small script to check the masking information for each of the cloned devices.

Please note that this is the first and very basic version and I will post an updated version as soon as possible. 

The Symmetrix Storage Arrays have a concept of "clones" where in the storage devices are paired for data transfer. During certain activities, it is important for a storage administrator to ensure that the correct device is made visible to the correct server. During this checking process, the command to check masking records (masking refers to the act of making the SAN Storage Devices visible to hosts) of each of the hexadecimal devices shown below has to be run individually. The command to check that is -

symmask -sid 000190101234 list assign -devs BB01
, where sid is the symmetrix array ID and the BB01 part is the device ID. The script automates the process.

Here's the output of the clone device command - :
 symclone -sid 1234 list
Symmetrix ID: 000190101234

      Source Device           Target Device         Status
------------------------- ---------------------- -------------
                Protected
Sym             Tracks    Sym               CGDP SRC <=> TGT
------------------------- ---------------------- -------------
BB01                    0 01AF              X.X. Copied
CB01                    0 01B3              X.X. Copied
D301                    0 01C7              X.X. Copied
D701                    0 01CF              X.X. Copied
E301                    0 01E7              X.X. Copied
EF01                    0 01EB              X.X. Copied
F701                    0 01F3              X.X. Copied
F306                    0 0723              X.X. Copied
2B07                    0 0747              X.X. Copied
2F07                    0 074B              X.X. Copied
3307                    0 074F              X.X. Copied
3707                    0 0753              X.X. Copied
3B07                    0 0757              X.X. Copied
3F07                    0 075B              X.X. Copied
4307                    0 075F              X.X. Copied
BB06                    0 078F              X.X. Copied
AF06                    0 0793              X.X. Copied
B306                    0 0797              X.X. Copied
A306                    0 079B              X.X. Copied
A706                    0 079F              X.X. Copied
9F06                    0 07A3              X.X. Copied
1307                    0 07A7              X.X. Copied
AB06                    0 07AB              X.X. Copied
0B07                    0 07AF              X.X. Copied
1B07                    0 07B3              X.X. Copied
0F07                    0 07B7              X.X. Copied
0307                    0 07BB              X.X. Copied
0707                    0 07BF              X.X. Copied
FF06                    0 07C3              X.X. Copied
FB06                    0 07C7              X.X. Copied
F706                    0 07CB              X.X. Copied
E706                    0 07CF              X.X. Copied
EB06                    0 07D3              X.X. Copied
E306                    0 07D7              X.X. Copied
EF06                    0 07DB              X.X. Copied
1707                    0 07DF              X.X. Copied
9B06                    0 07E3              X.X. Copied
D306                    0 07E7              X.X. Copied
D706                    0 07EB              X.X. Copied
DF06                    0 07EF              X.X. Copied
DB06                    0 07F3              X.X. Copied
BE24                    0 24C6              X.X. Copied
C224                    0 24CA              X.X. Copied
A62A                    0 2C6A              X.X. Copied
AA2A                    0 2C6E              X.X. Copied
AE2A                    0 2C72              X.X. Copied
662C                    0 2C76              X.X. Copied

Total            --------
  Tracks                0
  MB(s)               0.0


Legend:

(C): X = The background copy setting is active for this pair.
     . = The background copy setting is not active for this pair.
(G): X = The Target device is associated with a group.
     . = The Target device is not associated with a group.
(D): X = The Clone session is a differential copy session.
     . = The Clone session is not a differential copy session.
(P): X = The pre-copy operation has completed one cycle
     . = The pre-copy operation has not completed one cycle

Redirect this command output to a text file - e.g. 1234_clones.txt and pass the file to the script as shown below. Note - the script automatically greps the symmetrix ID from the clones.txt file.

C:\Users\perl\work>perl clone.pl 1234_clones.txt
symmask -sid 000190101234 list assign -devs BB01
symmask -sid 000190101234 list assign -devs 01AF
symmask -sid 000190101234 list assign -devs CB01
symmask -sid 000190101234 list assign -devs 01B3
symmask -sid 000190101234 list assign -devs D301
symmask -sid 000190101234 list assign -devs 01C7
symmask -sid 000190101234 list assign -devs D701
symmask -sid 000190101234 list assign -devs 01CF
symmask -sid 000190101234 list assign -devs E301
symmask -sid 000190101234 list assign -devs 01E7
symmask -sid 000190101234 list assign -devs EF01
symmask -sid 000190101234 list assign -devs 01EB
symmask -sid 000190101234 list assign -devs F701
symmask -sid 000190101234 list assign -devs 01F3
symmask -sid 000190101234 list assign -devs F306

All that is needed now, is to copy paste these commands in a bat file, and we get the output. This is just the first version of the script and I will be automating it further to reflect the server names.

And here is the script:
#!/usr/bin/perl
use warnings;
use strict;

my $symmid;

while (<>)
{	 if ($_=~/^symmetrix id:.*?(?\b\p{Digit}{12}\b)/gi)
	{
	    $symmid = $+{symmid};
	}
	
    next if ($_ !~ /^\p{Hex}{4}?/);
	   
	 if ($_ =~ /(?\b\p{Hex}{4}\b).*?(?\b\p{Hex}{4}\b)/)
	 {
	    
	    print "symmask -sid $symmid list assign -devs $+{source}\n";
	    print "symmask -sid $symmid list assign -devs $+{target}\n";
	    
	 }
}

4 Comments

On this blog platform you can get syntax coloring for your Perl code by wrapping it with <pre><code>...</code></pre>

Instead of copying the commands into batch file, why don't you just execute them?

(using one of the following)

system "symmask -sid $symmid list assign -devs $+{source}";
`symmask -sid $symmid list assign -devs $+{source}`;
system 'symmask', '-sid', $symmid, qw'list assign -devs', $+{source};

Leave a comment

About perl514

user-pic Perlpetually Indebted To PerlMonks.