Include a -MaxSize option for New-SCStorageVolume that accounts for the S2D resiliency type
When you manage an S2D storage pool in VMM, the "Storage available" value that appears in the console (from the RemainingManagedSpace property of the SPACES_StoragePool object) does not account for resiliency. For example, if the storage pool is a two-way mirror with 400 GB physical storage, the VMM console shows 385 GB available. However, the largest volume you can create on the storage pool is really only 190 GB.
In this scenario, if you attempt to create an S2D volume using New-SCStorageVolume, and you specify a size (-SizeInBytes) that exceeds the actual storage pool capacity, you receive the following job error:
Creating volume new <volumename> on storage pool <poolname> failed with error code 1 [SMRCNOT_SUPPORTED]. The storage pool does not have sufficient eligible resources for the creation of the specified virtual disk."
The job error is valid. The problem is the VMM user has no way to know the actual storage pool capacity. It would be great if New-SCStorageVolume could replicate the -UseMaximumSize parameter that's available in the New-Volume cmdlet.
Otherwise, the user must remote or create the volume directly on the cluster and then rescan the storage in VMM. This defeats the purpose of using VMM to managed the storage.
Example PowerShell script to work around this limitation:
$poolName = "S2D on MyCluster"
$newVolumeName = $poolName + " - LUN 1"
$storageProvider = ((Get-SCStoragePool -Name $poolName).StorageArray).StorageProvider
$providerFQDN = $storageProvider.NetworkAddress
$providerName = $storageProvider.Name
$cimSession = New-CimSession -ComputerName $providerFQDN
New-Volume -CimSession $cimSession -StoragePoolFriendlyName $poolName -FriendlyName $newVolumeName -FileSystem "CSVFS_ReFS" -UseMaximumSize
Get-SCStorageProvider -Name $providerName | Read-SCStorageProvider -Force
The above works, but the user shouldn't have to create a separate CIM session and run a non-VMM cmdlet to create the volume.