/// <summary> /// Create an SVHDX_META_OPERATION_START_CONVERT_TO_VHDSET_REQUEST structure and marshal it to a byte array /// </summary> /// <param name="startRequest">Struct SVHDX_META_OPERATION_START_REQUEST includes TransactionId and OperationType</param> /// <param name="convert">Struct SVHDX_META_OPERATION_CONVERT_TO_VHDSET</param> /// <returns>The marshalled byte array</returns> public byte[] CreateTunnelMetaOperationStartConvertToVHDSetRequest( SVHDX_META_OPERATION_START_REQUEST startRequest, SVHDX_META_OPERATION_CONVERT_TO_VHDSET convert) { SVHDX_META_OPERATION_START_CONVERT_TO_VHDSET_REQUEST convertRequest = new SVHDX_META_OPERATION_START_CONVERT_TO_VHDSET_REQUEST(); convertRequest.startRequest = startRequest; convertRequest.convert = convert; return(TypeMarshal.ToBytes(convertRequest)); }
public void BVT_Convert_VHDFile_to_VHDSetFile() { BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Client opens a shared virtual disk file and expects success."); OpenSharedVHD(TestConfig.NameOfSharedVHDX, RSVD_PROTOCOL_VERSION.RSVD_PROTOCOL_VERSION_2); BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. Client sends the tunnel operation SVHDX_META_OPERATION_START_REQUEST to convert a VHD file into a VHDSet file and expects success."); SVHDX_META_OPERATION_START_REQUEST startRequest = new SVHDX_META_OPERATION_START_REQUEST(); startRequest.TransactionId = System.Guid.NewGuid(); startRequest.OperationType = Operation_Type.SvhdxMetaOperationTypeConvertToVHDSet; SVHDX_META_OPERATION_CONVERT_TO_VHDSET convert = new SVHDX_META_OPERATION_CONVERT_TO_VHDSET(); convert.DestinationVhdSetName = TestConfig.NameOfConvertedSharedVHDS; convert.DestinationVhdSetNameLength = (uint)(convert.DestinationVhdSetName.Length + 1) * 2; byte[] payload = client.CreateTunnelMetaOperationStartConvertToVHDSetRequest( startRequest, convert); SVHDX_TUNNEL_OPERATION_HEADER?header; SVHDX_TUNNEL_OPERATION_HEADER?response; //For RSVD_TUNNEL_META_OPERATION_START operation code, the IOCTL code should be FSCTL_SVHDX_ASYNC_TUNNEL_REQUEST uint status = client.TunnelOperation <SVHDX_TUNNEL_OPERATION_HEADER>( true,//true for Async operation, false for non-async operation RSVD_TUNNEL_OPERATION_CODE.RSVD_TUNNEL_META_OPERATION_START, ++RequestIdentifier, payload, out header, out response); BaseTestSite.Assert.AreEqual( (uint)Smb2Status.STATUS_SUCCESS, status, "Ioctl should succeed, actual status: {0}", GetStatus(status)); VerifyTunnelOperationHeader(header.Value, RSVD_TUNNEL_OPERATION_CODE.RSVD_TUNNEL_META_OPERATION_START, (uint)RsvdStatus.STATUS_SVHDX_SUCCESS, RequestIdentifier); BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Client closes the file."); client.CloseSharedVirtualDisk(); BaseTestSite.Log.Add(LogEntryKind.TestStep, "4. Client queris the converted disk info and expects the format is changed successfully."); CheckDiskFormat(); }