Page 1 of 1
How to start a sync from "Waiting for automatic syncronization" state via powershell?
Posted: Thu Sep 20, 2018 5:17 pm
by serhiogo
Hello collegues!
I'm trying to start a full device sync via powershell after a successful storage power crash-test

.
The current state is on screen below (using Starwind Virtual SAN Free v8.0.0 (Build 12166)):
HAImage1 was started to sync automatically.
HAImage2 was started to sync manually via GUI.
And now - how to start a sync at HAImage3 manually via PS?
I've tried to use
$device.Synchronize([SwHaSyncType]::SW_HA_SYNC_FULL) from the embedded SyncHaDevice.ps1 script, but it was unsuccessful. I've got a message about a sync proccess start, and subsequent attempts are ended with...
Code: Select all
Synchronize device HAImage3
Error:
200 Failed: error occurred while initial synchronization process was running..
At C:\Temp\SyncHaDevice.ps1:19 char:3
+ $device.Synchronize([SwHaSyncType]::SW_HA_SYNC_FULL)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
... but nothing happens with sync status, it's still "Not Synchronized"
and "Waiting for autosyncronization".
It could be fixed easilly via GUI but I have to be able to make it via PS after a trial period will gone.
And another one question.
Why the HAImage1 was started to sync automatically while others wasn't? It's settings looks the same except paths and sizes. Or maybe autosync processes a devices one by one, not at the same time?
WBR, SerhioGo.
Re: How to start a sync from "Waiting for automatic syncronization" state via powershell?
Posted: Thu Sep 20, 2018 7:47 pm
by Boris (staff)
Have a look at GetHASyncState.ps1 - I believe what you need is the following fragment:
Code: Select all
if ( $syncState -eq "3" )
{
#
# Device not synchronized. Synchronize current node from partner
#
Write-Host "Device not synchronized. Synchronize current node from partner '$($partnerTargetName)'" -foreground yellow
$params = new-object -ComObject StarWindX.Parameters
$params.AppendParam("deviceID",$device.DeviceId)
$params.AppendParam("partnetTargetName",$partnerTargetName)
$server.ExecuteCommand( 0, "restoreHAPartnerNode", $params)
#
# If you want to synchronize partners from current node you can comment out code above and uncomment section below
#
#
# Device not synchronized. Mark current node as 'Synchronized'.
# WARNING, Command changes Device Status to "Synchronized" without Data Synchronization with HA (High Availability) Partner,
# Device will start processing Client Requests immediately and will be used as Data Synchronization Source for Partner Device.
#
#Write-Host "Device not synchronized. Mark current node as 'Synchronized'. " -foreground yellow
#$params = new-object -ComObject StarWindX.Parameters
#$params.AppendParam("deviceID",$device.DeviceId)
#$server.ExecuteCommand( 0, "restoreCurrentHANode", $params)
Start-Sleep -m 5000
}
Re: How to start a sync from "Waiting for automatic syncronization" state via powershell?
Posted: Thu Sep 20, 2018 10:48 pm
by serhiogo
Hello Boris!
Boris (staff) wrote:Have a look at GetHASyncState.ps1 - I believe what you need is the following fragment:
Code: Select all
if ( $syncState -eq "3" )
{
#
# Device not synchronized. Synchronize current node from partner
#
Write-Host "Device not synchronized. Synchronize current node from partner '$($partnerTargetName)'" -foreground yellow
$params = new-object -ComObject StarWindX.Parameters
$params.AppendParam("deviceID",$device.DeviceId)
$params.AppendParam("partnetTargetName",$partnerTargetName)
$server.ExecuteCommand( 0, "restoreHAPartnerNode", $params)
#
# If you want to synchronize partners from current node you can comment out code above and uncomment section below
#
#
# Device not synchronized. Mark current node as 'Synchronized'.
# WARNING, Command changes Device Status to "Synchronized" without Data Synchronization with HA (High Availability) Partner,
# Device will start processing Client Requests immediately and will be used as Data Synchronization Source for Partner Device.
#
#Write-Host "Device not synchronized. Mark current node as 'Synchronized'. " -foreground yellow
#$params = new-object -ComObject StarWindX.Parameters
#$params.AppendParam("deviceID",$device.DeviceId)
#$server.ExecuteCommand( 0, "restoreCurrentHANode", $params)
Start-Sleep -m 5000
}
I've tried. It was unsuccessfully.
I ran...
Code: Select all
...
$params = new-object -ComObject StarWindX.Parameters
$params.AppendParam("deviceID",$device.DeviceId)
$params.AppendParam("partnetTargetName",$partnerTargetName)
$server.ExecuteCommand( 0, "restoreHAPartnerNode", $params)
...
...code fragment on the slave side. I've got...
Code: Select all
powershell -file GetHASyncState.ps1 127.0.0.1 HAImage3 iqn.2008-08.com.starwindsoftware:vsan-1-mmt-lite-210
HAImage3
Device not synchronized. Synchronize current node from partner 'iqn.2008-08.com.starwindsoftware:vsan-1-mmt-lite-210'
Device not synchronized. Synchronize current node from partner 'iqn.2008-08.com.starwindsoftware:vsan-1-mmt-lite-210'
Device not synchronized. Synchronize current node from partner 'iqn.2008-08.com.starwindsoftware:vsan-1-mmt-lite-210'
...
Then I ran...
Code: Select all
...
$params = new-object -ComObject StarWindX.Parameters
$params.AppendParam("deviceID",$device.DeviceId)
$server.ExecuteCommand( 0, "restoreCurrentHANode", $params)
...
...uncommented code fragment on the "master" side.
The state of the HAImage3 device was not changed as a result:

It's from the PHP output of my simple status page, the GUI console views are...

... for "master" device and...

for "slave" one.
Maybe I've done something wrong of course.
Re: How to start a sync from "Waiting for automatic syncronization" state via powershell?
Posted: Fri Sep 21, 2018 8:03 am
by serhiogo
Maybe the manual sync wasn't started because of autosync flag?
Re: How to start a sync from "Waiting for automatic syncronization" state via powershell?
Posted: Tue Sep 25, 2018 11:23 am
by Oleg(staff)
No, that should not be the reason.
Is it possible to collect logs from nodes and send them to us?
You can use
this tool.
Re: How to start a sync from "Waiting for automatic syncronization" state via powershell?
Posted: Wed Sep 26, 2018 12:12 pm
by serhiogo
Oleg(staff) wrote:No, that should not be the reason.
Is it possible to collect logs from nodes and send them to us?
You can use
this tool.
Thank you, I collected the logs and noticed my sale manager, waiting for RnD recommendations. I'll drop the line with results here.
WBR, Serhio Go.
Re: How to start a sync from "Waiting for automatic syncronization" state via powershell?
Posted: Thu Sep 27, 2018 4:04 pm
by Boris (staff)
Thanks for the logs. As far as I know, the R&D guys have received them and will look into that issue. I believe your account manager will inform you of the investigation results, and we will post some info here, too.
Re: How to start a sync from "Waiting for automatic syncronization" state via powershell?
Posted: Wed Oct 10, 2018 7:11 pm
by serhiogo
It's finally working thanks to patch for
$device.Synchronize([SwHaSyncType]::SW_HA_SYNC_FULL, "") method from Starwind.
This mehod from the embedded SyncHaDevice.ps1 sample script didn't worked for me before.
Good job from RnD and pre-sale, thanks =]
P.S.
And another one question.
Why the HAImage1 was started to sync automatically while others wasn't? It's settings looks the same except paths and sizes. Or maybe autosync processes a devices one by one, not at the same time?
The answer is - YES, "one-by-one" is a default processing algoritm.
--------------------
WBR, Serhio Go.
Re: How to start a sync from "Waiting for automatic syncronization" state via powershell?
Posted: Thu Oct 11, 2018 5:04 am
by Oleg(staff)
You are welcome!
Re: How to start a sync from "Waiting for automatic syncronization" state via powershell?
Posted: Thu Oct 11, 2018 8:41 am
by serhiogo
And P.P.S. finally, just for the information.
This is the answer from our pre-sale engineer.
$server.ExecuteCommand( 0, "restoreHAPartnerNode", $params) – unsupported anymore and will be deleted from the StarwindX module soon. This was the reason why your first script wasn't working.
You may use the method below instead:
$device.Synchronize([SwHaSyncType]::SW_HA_SYNC_FULL, "") ,
where the second parameter is the sync source target name. If it's omitted (like above), the target will be choosen automatically.
The patch from Starwind just fixed a reaction of service to this method.
The topic can be considered as closed, thanx.
---------------------
WBR, Serhio Go.
Re: How to start a sync from "Waiting for automatic syncronization" state via powershell?
Posted: Fri Oct 12, 2018 11:40 am
by Oleg(staff)
Hi Serhio,
Thank you for confirmation!