error creating image device for vsan

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

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

Post Reply
stevej
Posts: 2
Joined: Tue Apr 19, 2022 3:36 pm

Tue Apr 19, 2022 3:49 pm

when i try to create my first device, after created the image
I got this error:
Error HRESULT E_FAIL has been returned from a call to a COM component.

I can see many devices been created in the console. In the event log, i can see the device been created too, I can create target based on the device name. However, when I run enumDevice scripts from powershell sample, only target showed up.
It appears to me that powershell library is broken for device related functions. I cant enum/remove device from powershell. Any idea how to fix?

My code for creating image/device/target( I ran them one by one to debug):

Code: Select all

param($addr="192.168.10.101", $port=3261, $user="root", $password="starwind",
	$fileName="img1",
	$filePath="My Computer\F\vsan",
	$size=4096,
	$targetAlias="targetimg1",
	$devName="imagefile1",
	$sectorSize=4096,
	$numaNode=0,
	$cacheMode="wt",
	$cacheSize=128)

Import-Module StarWindX

try
{
	Enable-SWXLog

	if($sectorSize -eq 4096 -and $size -lt 2)
	{
		throw "Minimal device size 2MB"
	}

	$server = New-SWServer -host $addr -port $port -user $user -password $password

	$server.Connect()
	Write-Host 'create image file'
	#create image file
	#New-ImageFile -server $server -path $filePath -fileName $fileName -size $size
    Write-Host 'create device'
	#create device
	#$device = Add-ImageDevice -server $server -path $filePath -fileName $fileName -sectorSize $sectorSize -NumaNode $numaNode -CacheMode $cacheMode -CacheSize $cacheSize

	#$device
    Write-Host 'target'
	#create target
	#$target = New-Target -server $server -alias $targetAlias -devices $device.Name
	#$target = New-Target -server $server -alias $targetAlias -devices $devName

	$target
}
catch
{
	Write-Host 'AError!'
	Write-Host $_ -foreground red
}
finally
{
	$server.Disconnect()
}

Another side issue is when i try to uninstall everything, I found a pagefile created still remains on my disk, and I can't remove it... any idea how to remove that?


Much appreciated for your help!

My system:
new hyper v server 2019 host
NTFS volume on disk( windows storage space ) on a ssd
Attachments
errorcap2.png
errorcap2.png (35.48 KiB) Viewed 1595 times
errorcap.png
errorcap.png (17.61 KiB) Viewed 1595 times
Last edited by stevej on Wed Apr 20, 2022 2:33 am, edited 1 time in total.
yaroslav (staff)
Staff
Posts: 2361
Joined: Mon Nov 18, 2019 11:11 am

Tue Apr 19, 2022 7:00 pm

Hi,

Welcome to StarWind Forum. What you are doing is creating an image file that is not associated with any target.
Can I see your script, please?
stevej
Posts: 2
Joined: Tue Apr 19, 2022 3:36 pm

Wed Apr 20, 2022 2:36 am

Thanks, I was using the sample PS scripts ( just added in my post). I ran the code for create image/create device/associate target by commenting out the rest.
There was no error for create image and associate target, the error appears for create device, but it seems the device was created anyway.

And enumDevice doesnt work (using the sample scripts)
yaroslav (staff) wrote:Hi,

Welcome to StarWind Forum. What you are doing is creating an image file that is not associated with any target.
Can I see your script, please?
yaroslav (staff)
Staff
Posts: 2361
Joined: Mon Nov 18, 2019 11:11 am

Thu Apr 21, 2022 7:45 am

Could you please, reproduce the error, and collect the logs with StarWind log collector https://knowledgebase.starwindsoftware. ... collector/? Share them here with Google Disk or any other convenient service. Thank you!
Post Reply