Microsoft Virtualization Discussions

FlexGroup Volumes using New-NcVol vs. Invoke-NcSSh


I have come across something interesting when creating FlexGroup volumes. When I create the FlexGroup volume using the New-NcVol command, I get errors when trying to set particulars on the volume. I error I get is "Modification not permitted. Volime is mixed.



However, when I use Invoke-NcSsh to create the FlexGroup volume I can set particulars on the volume without any errors. Examples of the code are below:


If I execute the code below I get the following erros when using the "Set" commandlets.

Set-NcVolOption : Modification not permitted. Volume is mixed.

Set-NcSnapshotReserve : Modification not permitted. Volume is mixed

Write-Host (Get-Date).ToLongTimeString() "...Attempting to create " -NoNewline; Write-Host $x.dataSet1 -ForegroundColor 'Yellow' -NoNewline; Write-Host " Volume: " -NoNewline; Write-Host $newVol -ForegroundColor Green

#Invoke-NcSsh "volume create -vserver $nfsvserver -volume $newvol -aggr-list $aggr1name,$aggr2name -aggr-list-multiplier 2 -size "$x.volumesize" -junction-path $jpath" -ErrorVariable volError New-NcVol -Name $newvol -FlexGroupVolume -AggregateList $aggr1name,$aggr2name -VserverContext $nfsVserver -AggregateMultiplier 2 -JunctionPath $jpath -Size $x.volumeSize -ErrorVariable volError -ErrorAction stop Invoke-NcSsh volume modify -vserver $nfsVserver -volume $newvol -snapshot-policy none Invoke-NcSsh snapshot delete -vserver $nfsVserver -volume $newvol -snapshot * Invoke-NcSSH volume efficiency on -vserver $nfsVserver -volume $newvol Set-NcVolOption $newVol -VserverContext $nfsVserver fractional_reserve 0 -ErrorVariable +nDeployError #sets volume fractional reserve Set-NcSnapshotReserve $newvol -VserverContext $nfsvserver 0 Set-NcVolOption $newvol guarantee none -VserverContext $nfsvserver -ErrorVariable +nDeployError

If I comment out the "New-NcVol" line and execute the script with the "Invoke-NcSsh" line above, there are no issues. 


I found this behavior odd, and perhaps I missed something in the commandlet's abilities. 



I used the below code and didn't have any issues setting the same values you did.



# create the FlexGroup
New-NcVol -VserverContext $svm -Name $volName -FlexGroupVolume -AggregateList $aggrList -AggregateMultiplier 2 -Size $volSize

# disable snapshots
Update-NcVol -Query @{ vserver = $svm; name = $volName } -Attributes @{ VolumeSnapshotAttributes = @{ SnapshotPolicy = "none" } }

$vol = Get-NcVol -Vserver $svm -Name $volName
# remove any snaps which have been created $vol | Get-NcSnapshot | Remove-NcSnapshot -Confirm:$false # turn on dedupe $vol | Enable-NcSis | Start-NcSis # disable fractional reserve $vol | Set-NcVolOption -Key fractional_reserve -Value 0 # disable snap reserve $vol | Set-NcSnapshotReserve -Percentage 0 # thin provision the volume $vol | Set-NcVolOption -Key guarantee -Value none


I uesd the examples from here and here for setting volume options.  


The FlexGroup is created asynchronously, I wonder if perhaps the options are attempting to be set via PowerShell before the constituent volumes have been created, whereas with SSH the session doesn't terminate until the volumes have been created.


Perhaps set a delay or loop with a test condition for the FlexGroup being successfully completed?  It took about 15 seconds on my system to create the FlexGroup...the output of "New-NcVol" with the FlexGroupVolume option is a job.  You should be able to use that job ID to query the controller and check for completion using the Get-NcJob and Get-NcJobHistory cmdlets.


Hope that helps.



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


Thanks for the information. I did seem to notice running the command seperatley after the fact the error was not present. You could be correct about the delay. I just would  have thought if that was the case it would say the volume does not exsist, but I guess it could still be in the process of creating. I will probably stick with the Invoke only because I need to encrypt the FlexGroups. 


Do you know what the error means though? "Not allowed the volume is mixed?"


Thanks again for the information. 


No idea what it actually means, but I'd wager it's a generic one when the volumes are in an inconsistent state, e.g. some have been created, some have not.  Do you have the "errno" associated with the failure?  

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