Software Development Kit (SDK) and API Discussions

cDOT Perl API: storage-disk-get-iter call with query option enabled

vladimirzhigulin
4,032 Views

Hi All,

I have SDK 5.2.2 and cDOT 8.2P3 cluster, I'm trying to fetch all disks in status 'broken'.

 

According to documentation 'query' option of 'storage-disk-get-iter' API call should work for cDOT OnTAP (not 7Mode), but I'm failing to get it working.

I wonder if someone has got a working piece of perl code to achieve it?

Cheers,
Vladimir

1 ACCEPTED SOLUTION

richard_payne
4,014 Views

Yes, I have manged to get the queries working. For failed drives it would be something like:

 

my $in = NaElement->new('storage-disk-get-iter');

my $query = NaElement->new('query');

my $ownerInfo = NaElement->new('disk-ownership-info');

$ownerInfo->child_add_string('is-failed','true');

my $diskInfo = NaElement->new('storage-disk-info');

$diskInfo->child_add($ownerInfo);

$query->child_add($diskInfo);

$in->child_add($query);

my $failedDiskData = $s->invoke_elem($in);

 

$s is of course your NaServer

 

I don't have any failed drives in my cmode clusters right now so I'm getting nothing back (num-records is zero).

 

In theory I guess you should run the 'invoke_elem' in a loop looking for 'next-tag' in case you have a lot of failures....

 

Let me know if that works (or doesn't!).

 

--rdp

 

 

View solution in original post

2 REPLIES 2

richard_payne
4,015 Views

Yes, I have manged to get the queries working. For failed drives it would be something like:

 

my $in = NaElement->new('storage-disk-get-iter');

my $query = NaElement->new('query');

my $ownerInfo = NaElement->new('disk-ownership-info');

$ownerInfo->child_add_string('is-failed','true');

my $diskInfo = NaElement->new('storage-disk-info');

$diskInfo->child_add($ownerInfo);

$query->child_add($diskInfo);

$in->child_add($query);

my $failedDiskData = $s->invoke_elem($in);

 

$s is of course your NaServer

 

I don't have any failed drives in my cmode clusters right now so I'm getting nothing back (num-records is zero).

 

In theory I guess you should run the 'invoke_elem' in a loop looking for 'next-tag' in case you have a lot of failures....

 

Let me know if that works (or doesn't!).

 

--rdp

 

 

vladimirzhigulin
3,972 Views

Thanks mate! It works as expected, ie it picks up a single broken disk in my cDOT cluster, but it is now also clear to me how to modify the script to pick muliple broken disks.

 

Cheers,

Vladimir

Public