Open Sven-Niehus opened 4 months ago
Using Get-BcContainerTenants
used to work without throwing any error and I found a work around with waiting anywhere between 30s and 2 minutes using a do/while loop. It would still be great if the commandlet wouldn't throw the Cannot refresh the tenant state because the tenant is being mounted.
error as using it is the only way to get the tenants state. It should fail soft instead with giving back $null
for example.
Did you test whether this is related to 6.0.17 or BC 24.0 ? I would assume the problem is in 24 - and 6.0.17 would still work with 23.5?
You could try to use Wait-BcContainerReady, which also waits for tenants to be mounted instead of your loop.
As far as I'm aware it only happens with the latest version of the BCContainerHelper and the latest version of BC yes.
If I understood Wait-BcContainerReady
right it waits for the first occurence of Ready for connections!
, but does that even get logged again if the database is restored via Restore-DatabasesInBcContainer
? In my tests the log didn't show Ready for connections!
again after the initial creation of the container.
Wait-BcContainerReady might actually have a bug as it doesn't wait for a new occurance of Ready for conenctions - but accepts an earlier one - will test restart-bccontainer.
But anyway, you can run this:
Invoke-ScriptInBcContainer -containerName $containerName -scriptblock {
$boo = $true
while (Get-NAVServerInstance | Get-NavTenant | Where-Object { $_.State -eq "Mounting" }) {
if ($boo) { Write-Host "Waiting for tenants to be mounted"; $boo = $false }
Start-Sleep -Seconds 1
}
}
To wait for all tenants are mounted.
That is being run in the end of Wait-BcContainerReady as well.
Restart seems to work
will check why...:-)
Ahh - I added a parameter called startLog - which is the part of the log to be ignored. So, indeed you can just call Wait-BcContainerReady - it will wait for container and tenants ready.
Describe the issue The commandlet Get-BcContainerTenants fails if called immediately after Restore-DatabasesInBcContainer with the following error message:
Scripts used to create container and cause the issue Script used to create the container and to backup the database:
Script used to restore the database:
Full output of scripts Output for container creation:
Output for restoring the database
Additional context It was working until the 29th and thus was likely broken with the 6.0.17 update of the BcContainerHelper on the 30th.