Asked by:
OpenVirtualDisk fails to Open VHDSET files.

Question
-
Hi,
I am trying to open VHDSET file using Virtual Disk management API OpenVirtualDisk API call. But it fails without any proper error. OpenVirtualDisk API returns 3227320074
Below is my code,
virtStorageType.DeviceId = VIRTUAL_STORAGE_TYPE_DEVICE_VHDSET; virtStorageType.VendorId = VIRTUAL_STORAGE_TYPE_VENDOR_UNKNOWN; memset(&openParameters, 0, sizeof(openParameters)); openParameters.Version = OPEN_VIRTUAL_DISK_VERSION_2; openParameters.Version2.GetInfoOnly = bForInfo; openParameters.Version2.ReadOnly = pbIsReadOnly; dwOpenStatus = OpenVirtualDisk( &virtStorageType, pwstrHDPath.c_str(), VIRTUAL_DISK_ACCESS_NONE, OPEN_VIRTUAL_DISK_FLAG_NONE, &openParameters, &m_VDiskHandle);
Thanks
All replies
-
Hi,
Thank you for posting here.
>>OpenVirtualDisk fails to Open VHDSET files. OpenVirtualDisk API returns 3227320074
OpenVirtualDisk function to open a virtual hard disk (VHD) or CD or DVD image file (ISO) for use. VHD Set files are a new shared Virtual Disk model.
OpenVirtualDisk API returns 3227320074-ERROR_VHD_SHARED. Just as what the error code suggests the requested operation cannot be performed on the virtual disk as it is currently used in shared mode.
As far as I'm concerned you couldn't try to use OpenVirtualDisk to open VHD SET files.
Best Regards,
Jeanine Zhang
-
-
Hi,
>>If not OpenVirtualDisk what API can be used to open VHDSET file ? Please Help.
VHD Set files are a new shared Virtual Disk model for guest clusters in Windows Server 2016. For more details you could refer to the link: https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/manage/create-vhdset-file
Refer to your description, your issue is more related to the Windows PowerShell . Since our forum is to discuss the C++ development, I would suggest posting your issue in the Windows PowerShell located here: https://social.technet.microsoft.com/Forums/windowsserver/en-US/home?forum=winserverpowershell
Thank you for your understanding and cooperation.
Best Regards,
Jeanine Zhang