Active IQ Unified Manager Discussions

Delete volume if it contains only one qtree

rogerhinson
3,709 Views

Hey all,

 

I'm working on a workflow that deletes a qtree if it has no exports, and then deleting the volume if there are no other qtrees in it.

 

I created a command to view the number of qtrees which works when I test it.  I added a Return Parameter to the code for the command that shows the number of qtrees (although it also includes the root volume).  When I try to use that Return Parameter in the Delete Volume command, I get an error that it's an invalid expression.  It doesn't look like the numQtree parameter is being passed back to the workflow.

 

This is WFA 2.2 and I'm creating this for 7-Mode. 

 

I can't figure out how to attach the exported workflow.  It gives me an error that the contents of the attachment doesn't match its file type.

 

Thanks for any help.  I can direct mail to anyone who can look.

 

This is the command that is set to have a Return Parameter.

 

param (
  [parameter(Mandatory=$true, HelpMessage="Volume name")]
  [string]$VolumeName,

  [parameter(Mandatory=$true, HelpMessage="Array IP or name")]
  [string]$Array,

  [parameter(Mandatory=$true, HelpMessage="vFiler name")]
  [string]$VFilerName,

  [parameter(Mandatory=$false, HelpMessage="Qtree name")]
  [string]$QtreeName

#  [parameter(Mandatory=$false, HelpMessage="Qouta Size")]
#  [Long]$QuotaSize

)

# connect to controller
Connect-WfaController -Array $Array -VFiler $VFilerName

#$policy = Get-NcExportPolicy -VserverContext $VserverName -Name $PolicyName 
  
$qtreeQuery =  Get-NaQtree -VolumeName $volumeName -QtreeName *
#$qtreeQuery.vfiler = $VFilerName
#$qtreeQuery.Volume = $volumeName


  if($qtreeQuery)
   {
       Get-WFALogger -Info -message $("Check existing qtrees for: " +  $volumeName)
      $qtreeStatus =   Get-NaQtree -VolumeName $volumeName -QtreeName *
    }

Get-WFALogger -Info -message $("qtrees exist for volume... : " +  $volumeName)

Get-WFALogger -Info -message $("qtreeStatus shows..." + $qtreeStatus)

Get-WFALogger -Info -message $("qtreeStatus shows there are qtrees..." + $qtreeStatus.Count)

Add-WfaWorkflowParameter -Name numQtree -Value $qtreeStatus.Count -AddAsReturnParameter $true

 

 

Roger

 

 

1 ACCEPTED SOLUTION

paragp
3,684 Views

Can you share the code from the delete volume command where you are trying to read the parameter numQtree.

 

We have had a bug where the files used for these parameters get deleted by our tmp folder cleanup mechanism. This was fixed in 3.0. Can you please check your <WFA Install dir>\jboss\standalone\tmp\wfa\workflow_data directory, It should have a file named <job id>.xml . You can get the job id for your workflow execution from the execution status page in WFA. The parameter "numQtree" and its value should be present in this file. If the file is not present you might be seeing this issue

View solution in original post

2 REPLIES 2

paragp
3,685 Views

Can you share the code from the delete volume command where you are trying to read the parameter numQtree.

 

We have had a bug where the files used for these parameters get deleted by our tmp folder cleanup mechanism. This was fixed in 3.0. Can you please check your <WFA Install dir>\jboss\standalone\tmp\wfa\workflow_data directory, It should have a file named <job id>.xml . You can get the job id for your workflow execution from the execution status page in WFA. The parameter "numQtree" and its value should be present in this file. If the file is not present you might be seeing this issue

rogerhinson
3,669 Views

I realized my mistake.  I thought the return parameter went into the main list of parameters.  I was using the default "Delete Volume" command.  I created a copy and used the Get return parameter to accomplish my goal.

 

Thanks,

Roger

 

Public