Create New Device Powershell
Posted: Thu Nov 30, 2017 4:08 pm
Hi I am trying to create new devices with the script below but I get getting the errors:
Exception Exception calling "CreateDevice" with "4" argument(s): "Error:
200 Failed: operation cannot be completed.. "
Exception Exception calling "CreateDevice" with "4" argument(s): "Error:
200 Failed: There is not enough space on the disk.. "
Exception Exception calling "CreateDevice" with "4" argument(s): "Error:
200 Failed: operation cannot be completed.. "
Can you please offer some advice?
Exception Exception calling "CreateDevice" with "4" argument(s): "Error:
200 Failed: operation cannot be completed.. "
Exception Exception calling "CreateDevice" with "4" argument(s): "Error:
200 Failed: There is not enough space on the disk.. "
Exception Exception calling "CreateDevice" with "4" argument(s): "Error:
200 Failed: operation cannot be completed.. "
Code: Select all
Import-Module StarWindX
$storage = 'FS1'
$storage2 = 'FS2'
try
{
$server = New-SWServer -host $storage -port 3261 -user root -password starwind
$server.Connect()
$firstNode = new-Object Node
$firstNode.ImagePath = "My computer\E"
$firstNode.ImageName = "CSV1"
$firstNode.Size = 20000
$firstNode.CreateImage = $true
$firstNode.TargetAlias = "csv1"
$firstNode.AutoSynch = $true
$firstNode.SyncInterface = "#p2=10.32.10.10:3260"
$firstNode.HBInterface = "#p2=10.32.35.80:3260"
$firstNode.CacheSize = 128
$firstNode.CacheMode = "wb"
$firstNode.PoolName = "SW"
$firstNode.SyncSessionCount = 1
$firstNode.ALUAOptimized = $true
$secondNode = new-Object Node
$secondNode.HostName = $storage2
$secondNode.HostPort = "3261"
$secondNode.Login = "root"
$secondNode.Password = "starwind"
$secondNode.ImagePath = "My computer\E"
$secondNode.ImageName = "CSV1"
$secondNode.Size = 20000
$secondNode.CreateImage = $true
$secondNode.TargetAlias = "csv1"
$secondNode.AutoSynch = $true
$secondNode.SyncInterface = "#p1=10.32.10.20:3260"
$secondNode.HBInterface = "#p1=10.32.35.81:3260"
$secondNode.ALUAOptimized = $true
$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod "Clear"
Start-Sleep -m 1000
$syncState = $device.GetPropertyValue("ha_synch_status")
while ($syncState -ne "1")
{
$device.Refresh()
$syncState = $device.GetPropertyValue("ha_synch_status")
$syncPercent = $device.GetPropertyValue("ha_synch_percent")
Start-Sleep -m 500
Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow
}
}
catch
{
Write-Host "Exception $($_.Exception.Message)" -foreground red
}
try
{
$server = New-SWServer -host $storage -port 3261 -user root -password starwind
$server.Connect()
$firstNode = new-Object Node
$firstNode.ImagePath = "My computer\E"
$firstNode.ImageName = "CSV2"
$firstNode.Size = 20000
$firstNode.CreateImage = $true
$firstNode.TargetAlias = "csv2"
$firstNode.AutoSynch = $true
$firstNode.SyncInterface = "#p2=10.32.10.10:3260"
$firstNode.HBInterface = "#p2=10.32.35.80:3260"
$firstNode.CacheSize = 128
$firstNode.CacheMode = "wb"
$firstNode.PoolName = "SW"
$firstNode.SyncSessionCount = 1
$firstNode.ALUAOptimized = $true
$secondNode = new-Object Node
$secondNode.HostName = $storage2
$secondNode.HostPort = "3261"
$secondNode.Login = "root"
$secondNode.Password = "starwind"
$secondNode.ImagePath = "My computer\E"
$secondNode.ImageName = "CSV2"
$secondNode.Size = 20000
$secondNode.CreateImage = $true
$secondNode.TargetAlias = "csv2"
$secondNode.AutoSynch = $true
$secondNode.SyncInterface = "#p1=10.32.10.20:3260"
$secondNode.HBInterface = "#p1=10.32.35.81:3260"
$secondNode.ALUAOptimized = $true
$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod "Clear"
Start-Sleep -m 1000
$syncState = $device.GetPropertyValue("ha_synch_status")
while ($syncState -ne "1")
{
$device.Refresh()
$syncState = $device.GetPropertyValue("ha_synch_status")
$syncPercent = $device.GetPropertyValue("ha_synch_percent")
Start-Sleep -m 500
Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow
}
}
catch
{
Write-Host "Exception $($_.Exception.Message)" -foreground red
}
try
{
$server = New-SWServer -host $storage -port 3261 -user root -password starwind
$server.Connect()
$firstNode = new-Object Node
$firstNode.ImagePath = "My computer\E"
$firstNode.ImageName = "witness"
$firstNode.Size = 10000
$firstNode.CreateImage = $true
$firstNode.TargetAlias = "witness"
$firstNode.AutoSynch = $true
$firstNode.SyncInterface = "#p2=10.32.10.10:3260"
$firstNode.HBInterface = "#p2=10.32.35.80:3260"
$firstNode.CacheSize = 128
$firstNode.CacheMode = "wb"
$firstNode.PoolName = "SW"
$firstNode.SyncSessionCount = 1
$firstNode.ALUAOptimized = $true
$firstNode.SectorSize = 512
$firstNode.SerialID = ""
$secondNode = new-Object Node
$secondNode.HostName = $storage2
$secondNode.HostPort = "3261"
$secondNode.Login = "root"
$secondNode.Password = "starwind"
$secondNode.ImagePath = "My computer\E"
$secondNode.ImageName = "witness"
$secondNode.Size = 10000
$secondNode.CreateImage = $true
$secondNode.TargetAlias = "witness"
$secondNode.AutoSynch = $true
$secondNode.SyncInterface = "#p1=10.32.10.10:3260"
$secondNode.HBInterface = "#p1=10.32.35.81:3260"
$secondNode.ALUAOptimized = $true
$device = Add-HADevice -server $server -firstNode $firstNode -secondNode $secondNode -initMethod "Clear"
Start-Sleep -m 1000
$syncState = $device.GetPropertyValue("ha_synch_status")
while ($syncState -ne "1")
{
$device.Refresh()
$syncState = $device.GetPropertyValue("ha_synch_status")
$syncPercent = $device.GetPropertyValue("ha_synch_percent")
Start-Sleep -m 500
Write-Host "Synchronizing: $($syncPercent)%" -foreground yellow
}
}
catch
{
Write-Host "Exception $($_.Exception.Message)" -foreground red
}
$server.Disconnect()