How to start a sync from "Waiting for automatic syncronization" state via powershell?

Software-based VM-centric and flash-friendly VM storage + free version

Moderators: anton (staff), art (staff), Max (staff), Anatoly (staff)

Post Reply
serhiogo
Posts: 30
Joined: Thu Aug 16, 2018 12:49 pm

Thu Sep 20, 2018 5:17 pm

Hello collegues!

I'm trying to start a full device sync via powershell after a successful storage power crash-test :D .

The current state is on screen below (using Starwind Virtual SAN Free v8.0.0 (Build 12166)):

Image

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.
Boris (staff)
Staff
Posts: 805
Joined: Fri Jul 28, 2017 8:18 am

Thu Sep 20, 2018 7:47 pm

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
                    }
serhiogo
Posts: 30
Joined: Thu Aug 16, 2018 12:49 pm

Thu Sep 20, 2018 10:48 pm

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:

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

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

Image
for "slave" one.

Maybe I've done something wrong of course.
serhiogo
Posts: 30
Joined: Thu Aug 16, 2018 12:49 pm

Fri Sep 21, 2018 8:03 am

Maybe the manual sync wasn't started because of autosync flag?
Oleg(staff)
Staff
Posts: 568
Joined: Fri Nov 24, 2017 7:52 am

Tue Sep 25, 2018 11:23 am

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.
serhiogo
Posts: 30
Joined: Thu Aug 16, 2018 12:49 pm

Wed Sep 26, 2018 12:12 pm

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.
Boris (staff)
Staff
Posts: 805
Joined: Fri Jul 28, 2017 8:18 am

Thu Sep 27, 2018 4:04 pm

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.
serhiogo
Posts: 30
Joined: Thu Aug 16, 2018 12:49 pm

Wed Oct 10, 2018 7:11 pm

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.
Oleg(staff)
Staff
Posts: 568
Joined: Fri Nov 24, 2017 7:52 am

Thu Oct 11, 2018 5:04 am

You are welcome!
serhiogo
Posts: 30
Joined: Thu Aug 16, 2018 12:49 pm

Thu Oct 11, 2018 8:41 am

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.
Oleg(staff)
Staff
Posts: 568
Joined: Fri Nov 24, 2017 7:52 am

Fri Oct 12, 2018 11:40 am

Hi Serhio,
Thank you for confirmation!
Post Reply