Active IQ Unified Manager Discussions

Unable to get volumes using vol-get-iter API

Rutul
7,363 Views

use strict;
use WFAUtil;
use Getopt::Long;

my $Cluster;
my $VserverName;


GetOptions('Cluster=s' => \$Cluster,
'VserverName=s' => \$VserverName,
);


my $wfautil = WFAUtil->new();
my $server=$wfautil->connect($Cluster,$VserverName);

my %inputhash = ('owning-vserver-name' => $VserverName);
my %volidattribhash=('volume-id-attributes' => \%inputhash);
my %volattrib=('volume-attributes' => \%volidattribhash);
my %query =('query' => \%volattrib);

 

my $result=$server->volume_get_iter(%query);


$wfautil->sendLog("INFO",$result->{'attributes-list'});

 

Is the code fine or there is anything i need to change ?

 

Also I am gettting error as : 18:00:21.894 ERROR  [Delete Volumes based on Vserver name] Failed executing command. Exception: No definition for typedef is-cft-precommit found at C:\Program Files\NetApp\WFA\perl\nmsdk/OntapClusterAPI.pm line 78812, <STDIN> line 1.

 

Any inputs on this would be appreciable

1 ACCEPTED SOLUTION

sinhaa
5,620 Views

@Rutul 

 

Rutul,

    @cbauernf is right in his response. 

 

The choice of solution for your requirement is not the best one. Its not using the full advantages that WFA brings to you. WFA is not a mere script executor that your script needs to loop.

 

You are trying to loop on every volume in the command code, but you need not do this. With this approach you can't preview things and know details like the order of volume removal, or know how many volumes will get deleted etc. before hand. The preview allows you to confirm what is going to happen in execution.

 

See the attached workflow example. It can be imported on WFA 3.0 and above.

 

The logic is very simple.

 

1. Have a filter to get all volumes for a given Vserver on a cluster. Crete a finder if required.

2. Now have a workflow with the command "Remove volume" and do Repeat Row for " member in a group.

3. If you are using WFA3.1, the finderless loops are available. Just select your filter. Else use the finder created in step(1)

4. The workflow will loop through every row returned by the filter. So that every volume in the given vserver is passed  to  command for execution on by one.

 

 

Let me know how this worked for you.

 

 

sinhaa

 

 

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

View solution in original post

11 REPLIES 11
Public