-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disk: Cannot convert System.UInt64 #210
Comments
Hi @AussieDavo - I'm trying to track down where this error is occurring and my best guess is it is hitting this line: And possibly has returned more than one partition (not sure how though). What is returned if you execute: Get-Partition -DriveLetter 'Q' And: Get-Partition -DriveLetter 'Q' | Get-PartitionSupportedSize | Format-List * On the node? |
Hi @PlagueHO - I have attempted executing the above and seem to get multiple partition results for Q however there is definitely only one partition on that disk: PS C:\Users\user1> Get-Partition -DriveLetter 'Q'
DiskPath: \\?\Disk{6be45e1f-c754-1348-8c6d-25a145b5e31f}
PartitionNumber DriveLetter Offset Size Type
--------------- ----------- ------ ---- ----
1 Q 1048576 25 GB IFS
DiskPath: \\?\Disk{b7043479-9007-9c04-f7f0-36e11f645cbc}
PartitionNumber DriveLetter Offset Size Type
--------------- ----------- ------ ---- ----
1 Q 1048576 25 GB IFS
PS C:\Users\user1> Get-Partition -DriveLetter 'Q' | Get-PartitionSupportedSize | Format-List *
SizeMin : 3273654272
SizeMax : 26841448448
SizeMin : 3273654272
SizeMax : 26841448448
PS C:\Users\user1> It is the same for every other disk with the issue. This seems to be leading more to being a VMware related issue and the way the disk is being presented to the Virtual machine. I also did a bit more testing between "LSI Logic SAS" and "VMware Paravirtual" VMware SCSI controllers and came up with something interesting. PowerShell results on a disk connected to a "LSI Logic SAS" SCSI controller: PS C:\Users\user1> $disks = get-disk
PS C:\Users\user1> $supportedsize = $disks[0] | Get-Partition | Get-PartitionSupportedSize
PS C:\Users\user1> [System.UInt64]$Size = $supportedSize.SizeMax
Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.UInt64".
At line:1 char:1
+ [System.UInt64]$Size = $supportedSize.SizeMax
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : MetadataError: (:) [], ArgumentTransformationMetadataException
+ FullyQualifiedErrorId : RuntimeException
PS C:\Users\user1> PowerShell results on a disk connected to a "VMware Paravirtual" SCSI controller: PS C:\Users\user1> $disks = get-disk
PS C:\Users\user1> $supportedsize = $disks[1] | Get-Partition | Get-PartitionSupportedSize
PS C:\Users\user1> [System.UInt64]$Size = $supportedSize.SizeMax
PS C:\Users\user1> $size
107372085248
PS C:\Users\user1> |
Thanks for that detailed info @AussieDavo . It is strange that the partition shows up twice, but on two different disks (I'm assuming there is just one disk that appears twice in the disk subsystem). I'm thinking that we could detect and handle this situation by always selecting the first disk that matches. We would definitely need to make sure that this was deterministic and always selected the same disk. Anyone else have any other info or ideas around why this is occurring? |
@PlagueHO and @AussieDavo making the following change to the Test-TargetResource of MSFTDSC_Disk corrects the issue: |
Thanks @aultt - That does sound like a possibility. The assumption we made was that it shouldn't have been possible to have two partitions with the same drive letter assigned, but this might not be correct. I'll add this and release a preview version and see if it resolves the issue. |
@PlagueHO sounds good I have tested it on my side with Windows2019 and it resolved the issue. |
@aultt - thank you for checking that and submitting the solution. I've updated the resource and it has no problems and all tests pass. I just need to add some unit tests to cover this and then I'll submit the PR. |
Hi @aultt, @AussieDavo - this has been deployed to the PSGallery as a preview version: https://www.powershellgallery.com/packages/StorageDsc/5.0.1-preview0003 I'll aim to release the full version in a week. |
I know this is a closed issue, but wanted to call out 1 more error case that causes this error even in 5.0.1. Doing a '"rescan" | diskpart' THEN running the DSC works |
None of the "rescan" or "select-object -first 1" tricks worked for me (Win 2016 & 2019 under VmWare and Paravirtual scsi driver). I had to modify my code as : $Part | Resize-Partition -Size $sizemax[0] -ErrorAction SilentlyContinue -Verbose |
Details of the scenario you tried and the problem that is occurring
Error when running Test-TargetResource:
Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.UInt64".
I have attempted deleting the partition and letting DSC recreate, which it does successfully but then fails again on the next Test-TargetResource.
I had some success after changing the VMware SCSI controller from "LSI Logic SAS" to "VMware Paravirtual" but after the next DSC run the error returned.
Verbose logs showing the problem
Suggested solution to the issue
I have a feeling it has something to do with the disk "size" value not being able to convert to UInt64 however I have no idea how to fix it.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
OsName : Microsoft Windows Server 2016 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsBuildLabEx : 14393.3085.amd64fre.rs1_release.190703-1816
OsLanguage : en-US
OsMuiLanguages : {en-US}
Version and build of PowerShell the target node is running
PSVersion 5.1.14393.3053
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.3053
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Version of the DSC module that was used
Master 4.7.0.0
The text was updated successfully, but these errors were encountered: