Data Infrastructure Management Software Discussions

Highlighted

Unable to get volumes using vol-get-iter API

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

11 REPLIES 11
Highlighted

Re: Unable to get volumes using vol-get-iter API

Make sure you use compatible version of NMSDK bindings with that particular version of ONTAP.

The typedef error normally comes because of that if the version of ONTAP to which you are trying

to connect is of a higher version than the NMSDK version which you are using.

 

Regards

Abhi

Highlighted

Re: Unable to get volumes using vol-get-iter API

Please Import WFA C-Dot Pack. To resolve this issue.

 

 

Regards,

Sundar

Highlighted

Re: Unable to get volumes using vol-get-iter API

Can you elaborate on this ? Can you tell me what should I download exactly WFA Software or is there any dar file ? Can you point out the link here?

Highlighted

Re: Unable to get volumes using vol-get-iter API

Hi Abhi,

 

I am running WFA 3.1 version. So it has default nmsdk version. How to change this particular nmsdk in WFA installation files.

 

 

Highlighted

Re: Unable to get volumes using vol-get-iter API

Highlighted

Re: Unable to get volumes using vol-get-iter API

Actually the thing is customer is having 3.1 version in their environment. And they want to delete multiple volumes  based on vserver name. Suppose if there is a vserver vs1 and it contains 6 volumes . While deleting vserver, volumes also should get deleted. So to get volumes , I am using vol-get-iter api. If I upgrade my version to 4.0 .. Then that workflow will not work in customers 3.1 WFA version.

Is there any alternative ?

Highlighted

Re: Unable to get volumes using vol-get-iter API

Instead of writing a new command block, why don't you use row repetition to call the certified "Remove volume" command block multiple times?

Highlighted

Re: Unable to get volumes using vol-get-iter API

Yes I am aware of it. But here user is not going to enter the volumenames in inputs. User will write vserver name and whatever the volumes of vserver should be deleted before deleting vserver. So to catch the volumes owning by the vserver I found vol-get-iter api. 

Highlighted

Re: Unable to get volumes using vol-get-iter API

But here one thing I can do is to run the sql query in the code itself and collect all volume names owning by vserver and it should delete all those volumes. I think we have a function in wfa to execute sql query if I am not wrong.

Highlighted

Re: Unable to get volumes using vol-get-iter API

@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

Highlighted

Re: Unable to get volumes using vol-get-iter API

Ok I got your point. Instead of using vol-get-iter api, I can create the filter and then use it in the command mappings in which list of volumes can be found based on vserver name. I can repeat that command for the list of volumes. I thought this other alternative to do this. Anyway thanks for the respons. I will check into the attached workflow.

Try the NEW Knowledgebase!
NetApp KB Site
Forums