Software Development Kit (SDK) and API Discussions

In powershell what is a good way to test to see if a clone split is complete?

aleeyee
1,338 Views

Hello,   I have been trying to find a way to test if a clone split is complete.  I know Get-NcCloneSplitStatus gives me information but throws an error after the clone is complete.   I looked at the volume fields on the cli and there is field called clone-volume, but could not find the corresponding PS attribute.   I ended up doing something like below but wanted to know if there is a better way code wise to test to see if the clone split was done.

 

$snap_busy = (Get-NcVol -Vserver $svm -name $org_vol | Get-NcSnapshot -SnapName $org_snap).Dependency
while($snap_busy)
{
Write-Host "Wakeup in 30 seconds...."
Start-Sleep 30
$snap_busy = (Get-NcVol -Vserver $svm -name $org_vol | Get-NcSnapshot -SnapName $org_snap).Dependency
}

1 ACCEPTED SOLUTION

donny_lang
1,294 Views

Same logic as your code, but once the split operation has been completed, the volume will no longer show up in the output of the "Get-NcVolClone" command (since it is no longer a clone). In your code, you could test for its absence from the output of that command and then branch from there based on that data.

 

$SplitStatus = Get-NcVolClone -Volume volume01
while ($SplitStatus){
Write-Host "Split in progress..."
Start-Sleep 30
$SplitStatus = Get-NcVolClone -Volume volume01
}

 

View solution in original post

2 REPLIES 2

donny_lang
1,295 Views

Same logic as your code, but once the split operation has been completed, the volume will no longer show up in the output of the "Get-NcVolClone" command (since it is no longer a clone). In your code, you could test for its absence from the output of that command and then branch from there based on that data.

 

$SplitStatus = Get-NcVolClone -Volume volume01
while ($SplitStatus){
Write-Host "Split in progress..."
Start-Sleep 30
$SplitStatus = Get-NcVolClone -Volume volume01
}

 

aleeyee
1,221 Views

Excellent I ran the code with this and it worked great and cleaner option.  Thanks for the solution.

Public