Software-based VM-centric and flash-friendly VM storage + free version
Moderators: anton (staff), art (staff), Anatoly (staff), Max (staff)
-
mpastore
- Posts: 4
- Joined: Thu Jun 29, 2017 3:33 pm
Thu Jun 29, 2017 3:38 pm
Hello,
I'm new to use the Starwind application and I'm trying to create an HA setup using the sample powershell script called "CreateHA(two nodes).ps1". After editing the proper values, I'm getting the error "Exception No coercion operator is defined between types 'System.String' and 'System.Int32'". I've tried many different things, but can't get past this error. Here is the copy of the script. Any idea what might be causing this?
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\Starwind"
$firstNode.ImageName = "imagefile1"
$firstNode.Size = 1024
$firstNode.CreateImage = $true
$firstNode.TargetAlias = "targetha1"
$firstNode.AutoSynch = $true
$firstNode.SyncInterface = "#p2=10.120.120.69:3260"
$firstNode.HBInterface = "#p2=10.120.120.69:3260"
$firstNode.CacheSize = 64
$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 = "10.120.120.69"
$secondNode.HostPort = "3261"
$secondNode.Login = "root"
$secondNode.Password = "starwind"
$secondNode.ImagePath = "My computer\C\Starwind"
$secondNode.ImageName = "partnerImg1"
$secondNode.Size = 256
$secondNode.CreateImage = $true
$secondNode.TargetAlias = "partnerha1"
$secondNode.AutoSynch = $true
$secondNode.SyncInterface = "#p1=10.120.120.224:3260"
$secondNode.HBInterface = "#p1=10.120.120.224: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()
-
tig_jeff
- Posts: 36
- Joined: Fri Apr 07, 2017 6:18 pm
Fri Jun 30, 2017 8:40 pm
Are you trying to run this on one of the two system that will be in the HA volume?
I've run into an error similar to this.
The fix was to install this onto a 3rd system for initial configuration.
Hope this helps.
- Jeff Morlen
Follow me on Twitter (@tig_jeff)
-
mpastore
- Posts: 4
- Joined: Thu Jun 29, 2017 3:33 pm
Mon Jul 03, 2017 2:14 pm
Thanks, just spun up a new VM, installed the software and kept the same settings, and reran the script which produced the same error. When you ran into this same error and introduced a 3rd node, did you run the 3 node script or ran the same 2 node one?
-
mpastore
- Posts: 4
- Joined: Thu Jun 29, 2017 3:33 pm
Mon Jul 03, 2017 2:46 pm
Looks like I found some more info. I hope I'm not going down the rabbit hole, but when I enter the code line by line into powershell and execute, I get a little better error message. Looks like it's having issues with this line in the HA PS module: $firstImage.AppendParam("Type", $firstNode.StorageType). If I look at the value of $firstNode.StorageType, it's '0'. Maybe I need to add a value for this variable?
No coercion operator is defined between types 'System.String' and 'System.Int32'.
At C:\windows\system32\windowspowershell\v1.0\Modules\StarWindX\HA.ps1:73 char:4
+ $firstImage.AppendParam("Type", $firstNode.StorageType)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], InvalidOperationException
+ FullyQualifiedErrorId : System.InvalidOperationException
No coercion operator is defined between types 'System.String' and 'System.Int32'.
At C:\windows\system32\windowspowershell\v1.0\Modules\StarWindX\HA.ps1:141 char:4
+ $secondImage.AppendParam("Type", $secondNode.StorageType)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], InvalidOperationException
+ FullyQualifiedErrorId : System.InvalidOperationException
Error:
200 Synchronization cannot be started because the nodes are not ready! Try to synchronize the nodes manually.
Pending.
At C:\windows\system32\windowspowershell\v1.0\Modules\StarWindX\HA.ps1:236 char:9
+ $server.CreateDevice($firstNode.ImagePath, $firstNode.ImageNa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
-
Ivan (staff)
- Staff
- Posts: 172
- Joined: Thu Mar 09, 2017 6:30 pm
Mon Jul 03, 2017 7:05 pm
Hello mpastore,
Thanks for your interest in StarWind solution.
Could you try to create simple ImageFile via powershell and share with us the results?
Also, try to change size of partner from 256 to 1024.
-
mpastore
- Posts: 4
- Joined: Thu Jun 29, 2017 3:33 pm
Wed Jul 05, 2017 12:36 pm
Thanks for the reply. I was able to create an image fine and without issue with PS, but unfortunately changing the partner size to 1024 didn't make a difference in the "CreateHA" script. Do you happen to have the steps to create a HA setup manually through the GUI? If not, I'm not sure what else I should be checking for the PS error?
-
Ivan (staff)
- Staff
- Posts: 172
- Joined: Thu Mar 09, 2017 6:30 pm
Wed Jul 05, 2017 4:34 pm
Hello mpastore,
Could you please check the IPs on your script?
$firstNode.SyncInterface = "#p2=10.120.120.69:3260"
$firstNode.HBInterface = "#p2=10.120.120.69:3260"
#p2 - should be IP from
SECOND node
$secondNode.SyncInterface = "#p1=10.120.120.224:3260"
$secondNode.HBInterface = "#p1=10.120.120.224:3260"
#p1 - should be IP from
FIRST node
Also, make sure you have "StarWind" folder in your path: "My computer\C\Starwind"
If your GUI still available, you can create an HA storage via StarWind Management console. You can read about it in your guide by following next link:
https://www.starwindsoftware.com/starwi ... -v-cluster