The transition to NetApp MS Azure AD B2C is complete. If you missed the pre-registration, you will be invited to reigister at next log in.
Please note that access to your NetApp data may take up to 1 hour.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Active IQ Unified Manager Discussions

Error running the command "Add Volume to Dataset"

Aravind

I am trying to the use the command "Add Volume to Dataset" in my workflow,when i test the command i am getting the below mentioned error

"No connection could be made because the target machine actively refused it"

is there anything which needs to be configured on the dfm server before running this command.As this command tries to establish a SSH session with the dfm server.

the powershel cmdlet used in this command is Invoke-NaSSH,

Any guidance on this would help.

 

wfa_err.png

1 ACCEPTED SOLUTION

mbeattie

Hi,

 

It's possible to use the DFM API rather than rely on the WFA certified command which uses the "Invoke-NaSsh" CmdLet.

If you use the DFM API method below you don't need to install SSH on your DFM server.

Here is the PowerShell Code. Hope this helps?

 

Cheers

 

/matt

 

param(
   [Parameter(Mandatory=$true, HelpMessage="The name of the storage controller or vfiler hosting the volume")]
   [String]$Array,
   [Parameter(Mandatory=$true, HelpMessage="Name or IP address of the DataFabric Manager Server")]
   [String]$DFMServerName,
   [Parameter(Mandatory=$true, HelpMessage="DFM Dataset name")]
   [String]$DatasetName,
   [parameter(Mandatory=$true, HelpMessage="The Volume name to add to the DFM Dataset")]
   [String]$VolumeName
)
#'------------------------------------------------------------------------------
#'Enumerate the DFM Server Credentials.
#'------------------------------------------------------------------------------
$credentials = Get-WfaCredentials -Host $DFMServerName
If(!$credentials){
   Throw "Failed to connect to DFM: " + $DFMServerName + ".`nNo credentials were found.";
}
#'------------------------------------------------------------------------------
#'Create a ZAPI connection to the DFM server.
#'------------------------------------------------------------------------------
[NetApp.Manage.NaServer]$naServer = New-WfaZapiServer -Host $DFMServerName -Type DFM -Credentials $credentials
Get-WfaLogger -Info -Message $("Connected to DFM Server " + $DFMServerName)
#'------------------------------------------------------------------------------
#'Invoke the API to edit the DFM Dataset
#'------------------------------------------------------------------------------
$naElement = New-Object NetApp.Manage.naElement("dataset-edit-begin")
$naElement.AddNewChild("dataset-name-or-id", $DatasetName)
$results = $naServer.InvokeElem($naElement)
#'------------------------------------------------------------------------------
#'Check the API Status and enumerate the Dataset lock ID
#'------------------------------------------------------------------------------
If($results.GetAttr("status") -eq "passed"){
   $lockID = $results.GetChildContent("edit-lock-id")
   Get-WFALogger -Info -Message $("Editing DFM Dataset ""$DatasetName"" Lock ID ""$lockID""")
}Else{
   Throw ("Failed to execute ZAPI call ""dataset-edit-begin"". Error: " + $results.GetAttr("status"))
}
#'------------------------------------------------------------------------------
#'Set the volume name to the required format to add it to the dataset.
#'------------------------------------------------------------------------------
If($VolumeName.Contains("/vol/")){
   $VolumeName = $VolumeName -Replace("/vol/", "")
}
[String]$volumeFullName = "$Array`:/$volumeName"
#'------------------------------------------------------------------------------
#'Invoke the API to add the volume to the DFM dataset.
#'------------------------------------------------------------------------------
$naElement = New-Object NetApp.Manage.naElement("dataset-add-member")
$naElement.AddNewChild("edit-lock-id", $lockID)
$naElement1 = New-Object NetApp.Manage.naElement("dataset-member-parameters")
$naElement2 = New-Object NetApp.Manage.naElement("dataset-member-parameter")
$naElement2.AddNewChild("object-name-or-id", $volumeFullName)
$naElement1.AddChildElement($naElement2)
$naElement.AddChildElement($naElement1)
$results = $naServer.InvokeElem($naElement)
#'------------------------------------------------------------------------------
#'Invoke the API to rollback if the API failed to add the volume to the DFM dataset.
#'------------------------------------------------------------------------------
If($results.GetAttr("status") -eq "failed"){
   $naElement = New-Object NetApp.Manage.naElement("dataset-edit-rollback")
   $naElement.AddNewChild("edit-lock-id", $lockID)
   $results = $naServer.InvokeElem($naElement)
   If($results.GetAttr("status") -eq "failed"){
      Throw ("Failed to execute ZAPI call ""dataset-edit-rollback"". Error: " + $results.GetAttr("status"))
   }Else{
      Get-WFALogger -Info -Message $("Invoked Rollback for Lock ID ""$LockID"" on Dataset ""$DatasetName""")
   }
}
#'------------------------------------------------------------------------------
#'Invoke the API to Commit the changes if the API to add the volume to the DFM dataset passed.
#'------------------------------------------------------------------------------
If($results.GetAttr("status") -eq "passed"){
   $naElement = New-Object NetApp.Manage.naElement("dataset-edit-commit")
   $naElement.AddNewChild("edit-lock-id", $lockID)
   $results = $naServer.InvokeElem($naElement)
   If($results.GetAttr("status") -eq "failed"){
      Throw ("Failed to execute ZAPI call ""dataset-edit-commit"". Error: " + $results.GetAttr("status"))
   }
}
#'------------------------------------------------------------------------------
#'Log the results if the API successfully committed the changes
#'------------------------------------------------------------------------------
If($results.GetAttr("status") -eq "passed"){
   Get-WFALogger -Info -Message $("Added Volume ""$volumeFullName"" to DFM Dataset ""$DatasetName""")
}
#'------------------------------------------------------------------------------
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

View solution in original post

5 REPLIES 5

sinhaa

Do you have any SSH server running on your DFM?

 

Using Putty or any other SSH client, try to connect via SSH using the credentials you providing in WFA.

 

sinhaa

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

Aravind

As of now there is no SSH server configured on the dfm server. Is SSH Server instaltion required to run this particular command.Or is there any other alternative way.

mbeattie

Hi,

 

It's possible to use the DFM API rather than rely on the WFA certified command which uses the "Invoke-NaSsh" CmdLet.

If you use the DFM API method below you don't need to install SSH on your DFM server.

Here is the PowerShell Code. Hope this helps?

 

Cheers

 

/matt

 

param(
   [Parameter(Mandatory=$true, HelpMessage="The name of the storage controller or vfiler hosting the volume")]
   [String]$Array,
   [Parameter(Mandatory=$true, HelpMessage="Name or IP address of the DataFabric Manager Server")]
   [String]$DFMServerName,
   [Parameter(Mandatory=$true, HelpMessage="DFM Dataset name")]
   [String]$DatasetName,
   [parameter(Mandatory=$true, HelpMessage="The Volume name to add to the DFM Dataset")]
   [String]$VolumeName
)
#'------------------------------------------------------------------------------
#'Enumerate the DFM Server Credentials.
#'------------------------------------------------------------------------------
$credentials = Get-WfaCredentials -Host $DFMServerName
If(!$credentials){
   Throw "Failed to connect to DFM: " + $DFMServerName + ".`nNo credentials were found.";
}
#'------------------------------------------------------------------------------
#'Create a ZAPI connection to the DFM server.
#'------------------------------------------------------------------------------
[NetApp.Manage.NaServer]$naServer = New-WfaZapiServer -Host $DFMServerName -Type DFM -Credentials $credentials
Get-WfaLogger -Info -Message $("Connected to DFM Server " + $DFMServerName)
#'------------------------------------------------------------------------------
#'Invoke the API to edit the DFM Dataset
#'------------------------------------------------------------------------------
$naElement = New-Object NetApp.Manage.naElement("dataset-edit-begin")
$naElement.AddNewChild("dataset-name-or-id", $DatasetName)
$results = $naServer.InvokeElem($naElement)
#'------------------------------------------------------------------------------
#'Check the API Status and enumerate the Dataset lock ID
#'------------------------------------------------------------------------------
If($results.GetAttr("status") -eq "passed"){
   $lockID = $results.GetChildContent("edit-lock-id")
   Get-WFALogger -Info -Message $("Editing DFM Dataset ""$DatasetName"" Lock ID ""$lockID""")
}Else{
   Throw ("Failed to execute ZAPI call ""dataset-edit-begin"". Error: " + $results.GetAttr("status"))
}
#'------------------------------------------------------------------------------
#'Set the volume name to the required format to add it to the dataset.
#'------------------------------------------------------------------------------
If($VolumeName.Contains("/vol/")){
   $VolumeName = $VolumeName -Replace("/vol/", "")
}
[String]$volumeFullName = "$Array`:/$volumeName"
#'------------------------------------------------------------------------------
#'Invoke the API to add the volume to the DFM dataset.
#'------------------------------------------------------------------------------
$naElement = New-Object NetApp.Manage.naElement("dataset-add-member")
$naElement.AddNewChild("edit-lock-id", $lockID)
$naElement1 = New-Object NetApp.Manage.naElement("dataset-member-parameters")
$naElement2 = New-Object NetApp.Manage.naElement("dataset-member-parameter")
$naElement2.AddNewChild("object-name-or-id", $volumeFullName)
$naElement1.AddChildElement($naElement2)
$naElement.AddChildElement($naElement1)
$results = $naServer.InvokeElem($naElement)
#'------------------------------------------------------------------------------
#'Invoke the API to rollback if the API failed to add the volume to the DFM dataset.
#'------------------------------------------------------------------------------
If($results.GetAttr("status") -eq "failed"){
   $naElement = New-Object NetApp.Manage.naElement("dataset-edit-rollback")
   $naElement.AddNewChild("edit-lock-id", $lockID)
   $results = $naServer.InvokeElem($naElement)
   If($results.GetAttr("status") -eq "failed"){
      Throw ("Failed to execute ZAPI call ""dataset-edit-rollback"". Error: " + $results.GetAttr("status"))
   }Else{
      Get-WFALogger -Info -Message $("Invoked Rollback for Lock ID ""$LockID"" on Dataset ""$DatasetName""")
   }
}
#'------------------------------------------------------------------------------
#'Invoke the API to Commit the changes if the API to add the volume to the DFM dataset passed.
#'------------------------------------------------------------------------------
If($results.GetAttr("status") -eq "passed"){
   $naElement = New-Object NetApp.Manage.naElement("dataset-edit-commit")
   $naElement.AddNewChild("edit-lock-id", $lockID)
   $results = $naServer.InvokeElem($naElement)
   If($results.GetAttr("status") -eq "failed"){
      Throw ("Failed to execute ZAPI call ""dataset-edit-commit"". Error: " + $results.GetAttr("status"))
   }
}
#'------------------------------------------------------------------------------
#'Log the results if the API successfully committed the changes
#'------------------------------------------------------------------------------
If($results.GetAttr("status") -eq "passed"){
   Get-WFALogger -Info -Message $("Added Volume ""$volumeFullName"" to DFM Dataset ""$DatasetName""")
}
#'------------------------------------------------------------------------------
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

View solution in original post

Aravind

Thanks a lot matt, that worked for me.

sinhaa

If you have no money in your bank account, can you find an alternative way to draw some money using your ATM card?

 

Think again..

 

 

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public