PowerShell script exchange
Post Reply
SvenP
Influencer
Posts: 13
Liked: never
Joined: Mar 31, 2016 12:53 pm
Full Name: Sven Putze
Contact:

9.5 Update 4a - Powershell - Possible race condition?

Post by SvenP »

Before upgrading to version 9.5 update 4a, something like

Code: Select all

$NewJob = Add-VBRViBackupJob -Name "$JobName" -Description "$Description" -Entity $Entity -BackupRepository $Repository
Set-VBRJobAdvancedViOptions -Job $NewJob -VMToolsQuiesce $True
worked without any problems in a Cmdlet (the variables are set, of course).

After the upgrade the VMToolsQuiesce option is not set. If I enter the second code line manually some time (here is the possible race condition) afterwards the option will be set.
Same goes for

Code: Select all

Set-VBRJobAdvancedViOptions -Job $NewJob -SetResultsToVmAttribute $True -VmAttributeName "veeam"| Out-Null
Also in the variations

Code: Select all

# first query the new created job
Get-VBRJob -Name "$JOBName"|Set-VBRJobAdvancedViOptions -SetResultsToVmAttribute $True -VmAttributeName "veeam" | Out-Null
#or
Get-VBRJob -Name "$JOBName"|Set-VBRJobAdvancedViOptions -SetResultsToVmAttribute $True -VmAttributeName "veeam"
No errors are printed nor exceptions thrown. Inserting "sleep" didn't help either. Has anyone else experienced the same problem? Any ideas for a remedy?
HannesK
Product Manager
Posts: 14287
Liked: 2877 times
Joined: Sep 01, 2014 11:46 am
Full Name: Hannes Kasparick
Location: Austria
Contact:

Re: 9.5 Update 4a - Powershell - Possible race condition?

Post by HannesK »

Hello,
I tested your code and it works for me. The quiesce option was set correctly.

Code: Select all

Add-PSSnapin VeeamPSSnapin
$Entity = Find-VBRViEntity -Name HK-Nano
$NewJob = Add-VBRViBackupJob -Name "BJ-Quiesce" -Description "Description" -Entity $Entity  -BackupRepository VBR-01-ReFS64k-Repo1
Set-VBRJobAdvancedViOptions -Job $NewJob -VMToolsQuiesce $true
As it seems to be a specific case, I suggest opening a support case. Please post the case number for reference.

Thanks,
Hannes
SvenP
Influencer
Posts: 13
Liked: never
Joined: Mar 31, 2016 12:53 pm
Full Name: Sven Putze
Contact:

Re: 9.5 Update 4a - Powershell - Possible race condition?

Post by SvenP »

Thank you! I will do so after the holidays when the office is manned again.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: 9.5 Update 4a - Powershell - Possible race condition?

Post by veremin »

I've also confirmed your script that sets attributes, so, it indeed seems to be environment specific problem. Thanks!
SvenP
Influencer
Posts: 13
Liked: never
Joined: Mar 31, 2016 12:53 pm
Full Name: Sven Putze
Contact:

Re: 9.5 Update 4a - Powershell - Possible race condition?

Post by SvenP »

So, finally opened Case # 03582291 a few minutes ago, let's wait and see.
SvenP
Influencer
Posts: 13
Liked: never
Joined: Mar 31, 2016 12:53 pm
Full Name: Sven Putze
Contact:

Re: 9.5 Update 4a - Powershell - Possible race condition?

Post by SvenP »

Hi there, it was a race condition in my own script. Short version:

Code: Select all

$NewJob = Add-VBRViBackupJob -Name "$JobName" -Description "$Description" -Entity $Entity -BackupRepository $Repository
$JobOptions = Get-VBRJobOptions -Job $NewJob
Set-VBRJobAdvancedViOptions -Job $NewJob -VmAttributeName "veeam" -SetResultsToVmAttribute $True
Set-VBRJobAdvancedViOptions -Job $NewJob -VMToolsQuiesce $True
Set-VBRJobOptions -Job $NewJob -Options $JobOptions
$JobOptions contains the state before setting VMToolsQuiesce for example. When writing with Set-VBRJobOptions the old state overwrites the option. It was hard to track down because those things did not happen in 4 lines of code; they were some screens apart. Plus: it worked with older versions of Veeam (I've checked the Git history of the script)
Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests