VNX5400 create raid disks for ceph.

A script that creates RaidGroups with single disks for use in a ceph installation.

uses the naviseccli command line interface. Make sure that the naviseccli works before running the script. it also changes the hotspare policy to not use any hotspares.

#!/usr/bin/perl
# create single disks for exporting to ceph osd server.

$user = "******";
$password = "*******";

my $address1 = $ARGV[0];
my $address2 = $ARGV[1];


# remove hotspare policy
$cmd = "/opt/Navisphere/bin/naviseccli -user $user -password $password -scope 0 -Address $address1";
print "$cmd hotsparepolicy -set 1 -keep1unusedper 0 -o\n";
print `$cmd hotsparepolicy -set 1 -keep1unusedper 0 -o\n`;

#
# create storagegroup
$cmd = "/opt/Navisphere/bin/naviseccli -user $user -password $password -scope 0 -Address $address1";
print "$cmd storagegroup -create -gname Ceph\n";
print `$cmd storagegroup -create -gname Ceph\n`;


$disks = 25;
$startdisk = 4;
for ($i = $startdisk; $i < $disks; ++$i) {
        if (0 == $i % 2) {
                $cmd = "/opt/Navisphere/bin/naviseccli -user $user -password $password -scope 0 -Address $address1";
} else {
                $cmd = "/opt/Navisphere/bin/naviseccli -user $user -password $password -scope 0 -Address $address2";
}

        # create raidgroup disk
        print "$cmd createrg $i 0_0_$i -raidtype disk\n";
        print `$cmd createrg $i 0_0_$i -raidtype disk\n`;

        # bind lun to raidgroup
        print "$cmd bind id $i -rg $i\n";
        print `$cmd bind id $i -rg $i\n`;

        # bind lun to raidgroup
        print "$cmd storagegroup -addhlu -gname Ceph -hlu $i -alu $i";
        print `$cmd storagegroup -addhlu -gname Ceph -hlu $i -alu $i`;
}

Leave a comment

Your email address will not be published. Required fields are marked *