Error in Powershell script for creating HA device 2 nodes

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

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

Post Reply
Alpanet
Posts: 4
Joined: Fri Apr 07, 2017 5:02 pm

Fri Apr 07, 2017 5:12 pm

Hi to everybody,
when I tried to use the sample script to create a 2 nodes HaDevice I recieved this error:

"Plugin does not support."

Anybody can help me please?


Thaks a lot

Andrea


Import-Module StarWindX

try
{
$server = New-SWServer -host 192.168.1.10 -port 3261 -user root -password starwind

$server.Connect()

$firstNode = new-Object Node

$firstNode.ImagePath = "Host1\C\StarWindHA"
$firstNode.ImageName = "Csv1"
$firstNode.Size = 100000
$firstNode.CreateImage = $true
$firstNode.TargetAlias = "targetha1"
$firstNode.AutoSynch = $true
$firstNode.SyncInterface = "#p2=172.16.20.10:3260"
$firstNode.HBInterface = "#p2=172.16.10.10:32600"
$firstNode.CacheSize = 640
$firstNode.CacheMode = "wb"
$firstNode.PoolName = "pool1"
$firstNode.SyncSessionCount = 1
$firstNode.ALUAOptimized = $true

#
# device sector size. Possible values: 512 or 4096(May be incompatible with some clients!) bytes.
#
$firstNode.SectorSize = 512

#
# 'SerialID' should be between 16 and 31 symbols. If it not specified StarWind Service will generate it.
# Note: Second node always has the same serial ID. You do not need to specify it for second node
#
$firstNode.SerialID = "050176c0b535403ba3ce02102e33eab"

$secondNode = new-Object Node

$secondNode.HostName = "192.168.1.12"
$secondNode.HostPort = "3261"
$secondNode.Login = "root"
$secondNode.Password = "starwind"
$secondNode.ImagePath = "Host2\C\StarWindHA"
$secondNode.ImageName = "partnercsv1"
$secondNode.Size = 100000
$secondNode.CreateImage = $true
$secondNode.TargetAlias = "targetha2"
$secondNode.AutoSynch = $true
$secondNode.SyncInterface = "172.16.20.11:3260"
$secondNode.HBInterface = "#p2=172.16.10.11:32600"
$secondNode.ALUAOptimized = $true

$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod "Clear"

$syncState = $device.GetPropertyValue("ha_synch_status")

while ($syncState -ne "1")
{
#
# Refresh device info
#
$device.Refresh()

$syncState = $device.GetPropertyValue("ha_synch_status")
$syncPercent = $device.GetPropertyValue("ha_synch_percent")

Start-Sleep -m 2000

Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow
}
}
catch
{
Write-Host "Exception $($_.Exception.Message)" -foreground red
}

$server.Disconnect()
Ivan (staff)
Staff
Posts: 172
Joined: Thu Mar 09, 2017 6:30 pm

Tue Apr 11, 2017 2:18 pm

Hello Alpanet,
Thanks for interesting in StarWind solution.
As far as I can see in your script you typed the wrong Image path:

Code: Select all

$firstNode.ImagePath = "Host1\C\StarWindHA"
Should be:

Code: Select all

$firstNode.ImagePath = "My Computer\C\StarWindHA"
Or:

Code: Select all

$firstNode.ImagePath = "C:\StarWindHA"
Please, make this changes in example script and try one more time.
Keep us updated about it.
Alpanet
Posts: 4
Joined: Fri Apr 07, 2017 5:02 pm

Mon Apr 24, 2017 9:55 am

Hi Ivan,
sorry for the late answer but I just tried your advice but the result seems the same:

PS C:\Users\adm> C:\Users\adm\Documents\CreateHA2nodes.ps1
Exception Plugin does not support.

Can you help me?

Thank a lot

Andrea


Powershell script is below:

Import-Module StarWindX

try
{
$server = New-SWServer -host 192.168.1.10 -port 3261 -user root -password starwind

$server.Connect()

$firstNode = new-Object Node

$firstNode.ImagePath = "C:\StarWindHA"
$firstNode.ImageName = "Csv1"
$firstNode.Size = 100000
$firstNode.CreateImage = $true
$firstNode.TargetAlias = "targetha1"
$firstNode.AutoSynch = $true
$firstNode.SyncInterface = "#p2=172.16.20.10:3260"
$firstNode.HBInterface = "#p2=172.16.10.10:32600"
$firstNode.CacheSize = 640
$firstNode.CacheMode = "wb"
$firstNode.PoolName = "pool1"
$firstNode.SyncSessionCount = 1
$firstNode.ALUAOptimized = $true

#
# device sector size. Possible values: 512 or 4096(May be incompatible with some clients!) bytes.
#
$firstNode.SectorSize = 512

#
# 'SerialID' should be between 16 and 31 symbols. If it not specified StarWind Service will generate it.
# Note: Second node always has the same serial ID. You do not need to specify it for second node
#
$firstNode.SerialID = "050176c0b535403ba3ce02102e33eab"

$secondNode = new-Object Node

$secondNode.HostName = "192.168.1.11"
$secondNode.HostPort = "3261"
$secondNode.Login = "root"
$secondNode.Password = "starwind"
$secondNode.ImagePath = "C:\StarWindHA"
$secondNode.ImageName = "partnercsv1"
$secondNode.Size = 100000
$secondNode.CreateImage = $true
$secondNode.TargetAlias = "targetha2"
$secondNode.AutoSynch = $true
$secondNode.SyncInterface = "172.16.20.11:3260"
$secondNode.HBInterface = "#p2=172.16.10.11:32600"
$secondNode.ALUAOptimized = $true

$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod "Clear"

$syncState = $device.GetPropertyValue("ha_synch_status")

while ($syncState -ne "1")
{
#
# Refresh device info
#
$device.Refresh()

$syncState = $device.GetPropertyValue("ha_synch_status")
$syncPercent = $device.GetPropertyValue("ha_synch_percent")

Start-Sleep -m 2000

Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow
}
}
catch
{
Write-Host "Exception $($_.Exception.Message)" -foreground red
}

$server.Disconnect()
Ivan (staff)
Staff
Posts: 172
Joined: Thu Mar 09, 2017 6:30 pm

Tue Apr 25, 2017 6:27 pm

Hello Alpanet,
Try this one:
create the folder on C: drive. Without ##IP FROM SECOND NODE and ##IP FROM FIRST NODE
Also, make sure you have enough space for this device

Code: Select all

Powershell script is below:

Import-Module StarWindX

try
{
$server = New-SWServer -host 192.168.1.10 -port 3261 -user root -password starwind

$server.Connect()

$firstNode = new-Object Node

$firstNode.ImagePath = "My computer\C\StarWindHA"
$firstNode.ImageName = "Csv1"
$firstNode.Size = 100000
$firstNode.CreateImage = $true
$firstNode.TargetAlias = "targetha1"
$firstNode.AutoSynch = $true
$firstNode.SyncInterface = "#p2=172.16.20.10:3260" ##IP FROM SECOND NODE
$firstNode.HBInterface = "#p2=172.16.10.10:32600"  ##IP FROM SECOND NODE
$firstNode.CacheSize = 640
$firstNode.CacheMode = "wb"
$firstNode.PoolName = "pool1"
$firstNode.SyncSessionCount = 1
$firstNode.ALUAOptimized = $true

#
# device sector size. Possible values: 512 or 4096(May be incompatible with some clients!) bytes. 
#
$firstNode.SectorSize = 512

#
# 'SerialID' should be between 16 and 31 symbols. If it not specified StarWind Service will generate it. 
# Note: Second node always has the same serial ID. You do not need to specify it for second node
#
$firstNode.SerialID = "050176c0b535403ba3ce02102e33eab" 

$secondNode = new-Object Node

$secondNode.HostName = "192.168.1.11"
$secondNode.HostPort = "3261"
$secondNode.Login = "root"
$secondNode.Password = "starwind"
$secondNode.ImagePath = "My computer\C\StarWindHA"
$secondNode.ImageName = "partnercsv1"
$secondNode.Size = 100000
$secondNode.CreateImage = $true
$secondNode.TargetAlias = "targetha2"
$secondNode.AutoSynch = $true
$secondNode.SyncInterface = "p1=172.16.20.11:3260" ##IP FROM FIRST NODE
$secondNode.HBInterface = "#p1=172.16.10.11:32600" ##IP FROM FIRST NODE
$secondNode.ALUAOptimized = $true

$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod "Clear"

$syncState = $device.GetPropertyValue("ha_synch_status")

while ($syncState -ne "1")
{
#
# Refresh device info
#
$device.Refresh()

$syncState = $device.GetPropertyValue("ha_synch_status")
$syncPercent = $device.GetPropertyValue("ha_synch_percent")

Start-Sleep -m 2000

Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow
}
}
catch
{
Write-Host "Exception $($_.Exception.Message)" -foreground red 
}

$server.Disconnect()
Alpanet
Posts: 4
Joined: Fri Apr 07, 2017 5:02 pm

Tue May 16, 2017 10:57 am

Hi Ivan,
sorry but I had an accident and I returned in office only yesterday... :|
Thanks for your reply but i don't understand what you mean when you said:
"create the folder on C: drive." : the folder is already created on both hosts
and when you said:
"Without ##IP FROM SECOND NODE and ##IP FROM FIRST NODE" I dont understand which part of code I have to remove...

Sorry but I am new with this technologies... :-)

Thanks a lot for your support

Andrea
Ivan (staff)
Staff
Posts: 172
Joined: Thu Mar 09, 2017 6:30 pm

Tue May 16, 2017 2:50 pm

Hello Alpanet,
I mean delete ##IP FROM FIRST NODE from my example.
Try to run this one:

Code: Select all

#Import-Module StarWindX

try
{
    $server = New-SWServer -host 127.0.0.1 -port 3261 -user root -password starwind

    $server.Connect()

    $firstNode = new-Object Node

    $firstNode.ImagePath = "My computer\C\StarWindHA"
    $firstNode.ImageName = "masterImg1"
    $firstNode.Size = 100000
    $firstNode.CreateImage = $true
    $firstNode.TargetAlias = "csv1"
    $firstNode.AutoSynch = $true
    $firstNode.SyncInterface = "#p2=172.16.20.11:3260"
    $firstNode.HBInterface = "#p2=172.16.10.11:3260"
    $firstNode.CacheSize = 640
    $firstNode.CacheMode = "wb"
    $firstNode.PoolName = "pool1"
    $firstNode.SyncSessionCount = 1
    $firstNode.ALUAOptimized = $true
    
    #
    # device sector size. Possible values: 512 or 4096(May be incompatible with some clients!) bytes. 
    #
    $firstNode.SectorSize = 512
	
	#
	# 'SerialID' should be between 16 and 31 symbols. If it not specified StarWind Service will generate it. 
	# Note: Second node always has the same serial ID. You do not need to specify it for second node
	#
	$firstNode.SerialID = "050176c0b535403ba3ce02102e33eab" 
    
    $secondNode = new-Object Node

    $secondNode.HostName = "192.168.1.12"
    $secondNode.HostPort = "3261"
    $secondNode.Login = "root"
    $secondNode.Password = "starwind"
    $secondNode.ImagePath = "My computer\C\StarWindHA"
    $secondNode.ImageName = "partnerImg1"
    $secondNode.Size = 100000
    $secondNode.CreateImage = $true
    $secondNode.TargetAlias = "csv1"
    $secondNode.AutoSynch = $true
    $secondNode.SyncInterface = "#p1=172.16.20.10:3260"
    $secondNode.HBInterface = "#p1=172.16.10.10:3260"
    $secondNode.ALUAOptimized = $true
        
    $device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod "Clear"
    
    $syncState = $device.GetPropertyValue("ha_synch_status")

    while ($syncState -ne "1")
    {
        #
        # Refresh device info
        #
        $device.Refresh()

        $syncState = $device.GetPropertyValue("ha_synch_status")
        $syncPercent = $device.GetPropertyValue("ha_synch_percent")

        Start-Sleep -m 2000

        Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow
    }
}
catch
{
    Write-Host "Exception $($_.Exception.Message)" -foreground red 
}

$server.Disconnect()
Alpanet
Posts: 4
Joined: Fri Apr 07, 2017 5:02 pm

Wed May 17, 2017 5:58 pm

Hi Ivan,
I tried this but the result is the same:
"Exception Plugin does not support."

I launched this script from a Win10 pc Powershell ISE in the same subnet 192.168.1.0
What I got wrong?

Thanks a lot for your patience

Andrea



#Import-Module StarWindX

try
{
$server = New-SWServer -host 192.168.1.10 -port 3261 -user root -password starwind

$server.Connect()

$firstNode = new-Object Node

$firstNode.ImagePath = "My computer\C\StarWindHA"
$firstNode.ImageName = "masterImg1"
$firstNode.Size = 100000
$firstNode.CreateImage = $true
$firstNode.TargetAlias = "csv1"
$firstNode.AutoSynch = $true
$firstNode.SyncInterface = "#p2=172.16.20.10:3260"
$firstNode.HBInterface = "#p2=172.16.10.10:3260"
$firstNode.CacheSize = 640
$firstNode.CacheMode = "wb"
$firstNode.PoolName = "pool1"
$firstNode.SyncSessionCount = 1
$firstNode.ALUAOptimized = $true

#
# device sector size. Possible values: 512 or 4096(May be incompatible with some clients!) bytes.
#
$firstNode.SectorSize = 512

#
# 'SerialID' should be between 16 and 31 symbols. If it not specified StarWind Service will generate it.
# Note: Second node always has the same serial ID. You do not need to specify it for second node
#
$firstNode.SerialID = "050176c0b535403ba3ce02102e33eab"

$secondNode = new-Object Node

$secondNode.HostName = "192.168.1.11"
$secondNode.HostPort = "3261"
$secondNode.Login = "root"
$secondNode.Password = "starwind"
$secondNode.ImagePath = "My computer\C\StarWindHA"
$secondNode.ImageName = "partnerImg1"
$secondNode.Size = 100000
$secondNode.CreateImage = $true
$secondNode.TargetAlias = "csv1"
$secondNode.AutoSynch = $true
$secondNode.SyncInterface = "#p1=172.16.20.11:3260"
$secondNode.HBInterface = "#p1=172.16.10.11:3260"
$secondNode.ALUAOptimized = $true

$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod "Clear"

$syncState = $device.GetPropertyValue("ha_synch_status")

while ($syncState -ne "1")
{
#
# Refresh device info
#
$device.Refresh()

$syncState = $device.GetPropertyValue("ha_synch_status")
$syncPercent = $device.GetPropertyValue("ha_synch_percent")

Start-Sleep -m 2000

Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow
}
}
catch
{
Write-Host "Exception $($_.Exception.Message)" -foreground red
}

$server.Disconnect()
Ivan (staff)
Staff
Posts: 172
Joined: Thu Mar 09, 2017 6:30 pm

Wed May 17, 2017 10:47 pm

Hello Alpanet,
To do it properly you need to install StarWind vSAN on your desktop PC (I suppose) and change 127.0.0.1 to the management IP from first host (which will be primary).
Try to run this script directly on Host which will be used to vSAN.
Also, I would recommend to update StarWind vSAN to the latest build, which you can find by following next link:
https://www.starwindsoftware.com/regist ... irtual-san
Post Reply