Wednesday, October 02, 2013

Perl & Netapp Data Protection Manager Suspend & Resume Datasets

Suppose your using Netapp Data Protection Manager and you need to either suspend or resume many datasets all at once. Doing this through the UI can be cumbersome given you have to do each and everyone individually. However the little Perl scripts below I wrote allows you to suspend or resume all of them automatically. These two Perl scripts should be run on your DFPM host:

To suspend the datasets:


chomp(@list = `dfpm dataset list`);
foreach $list (@list) {
                $list =~ s/\s+//;
                ($id) = split(/\s+/,$list);
                print "$id\n";
                $cmd = `dfpm dataset suspend $id`;
                print "$cmd\n";
}

To resume the datasets:

chomp(@list = `dfpm dataset list`);
foreach $list (@list) {
                $list =~ s/\s+//;
                ($id) = split(/\s+/,$list);
                print "$id\n";
                $cmd = `dfpm dataset resume $id`;
                print "$cmd\n";
}
 
Now you could add an argument option and merge both scripts and depending on if your argument was suspend or resume execute the correct section of code.