Active IQ Unified Manager Discussions

Error running the command "Add Volume to Dataset"

Aravind
4,608 Views

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
4,481 Views

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
4,596 Views

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
4,582 Views

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.

sinhaa
4,563 Views

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.

mbeattie
4,482 Views

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.

Aravind
4,458 Views

Thanks a lot matt, that worked for me.

Public