/// <summary> /// Delete the existing snapshots for the VHD set file /// </summary> /// <param name="requestId">Tunnel operation request id</param> /// <param name="snapshotId">The snapshot id to be deleted</param> /// <param name="rsvdClient">The instance of rsvd client. NULL stands for the default client</param> public void DeleteSnapshot(ref ulong requestId, Guid snapshotId, RsvdClient rsvdClient = null) { if (rsvdClient == null) { rsvdClient = this.client; } SVHDX_TUNNEL_OPERATION_HEADER? header; SVHDX_TUNNEL_DELETE_SNAPSHOT_REQUEST deleteRequest = new SVHDX_TUNNEL_DELETE_SNAPSHOT_REQUEST(); deleteRequest.SnapshotId = snapshotId; deleteRequest.PersistReference = PersistReference_Flags.PersistReferenceFalse; deleteRequest.SnapshotType = Snapshot_Type.SvhdxSnapshotTypeVM; byte[] payload = rsvdClient.CreateTunnelMetaOperationDeleteSnapshotRequest(deleteRequest); SVHDX_TUNNEL_OPERATION_HEADER?deleteResponse; uint status = rsvdClient.TunnelOperation <SVHDX_TUNNEL_OPERATION_HEADER>( false, RSVD_TUNNEL_OPERATION_CODE.RSVD_TUNNEL_DELETE_SNAPSHOT, requestId, payload, out header, out deleteResponse); 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_DELETE_SNAPSHOT, (uint)RsvdStatus.STATUS_SVHDX_SUCCESS, requestId++); }
protected void DeleteSnapshot(Guid snapshotId) { SVHDX_TUNNEL_DELETE_SNAPSHOT_REQUEST deleteRequest = new SVHDX_TUNNEL_DELETE_SNAPSHOT_REQUEST(); deleteRequest.SnapshotId = snapshotId; deleteRequest.PersistReference = PersistReference_Flags.PersistReferenceFalse; deleteRequest.SnapshotType = Snapshot_Type.SvhdxSnapshotTypeVM; byte[] payload = client.CreateTunnelMetaOperationDeleteSnapshotRequest( deleteRequest); SVHDX_TUNNEL_OPERATION_HEADER?deleteResponse; SVHDX_TUNNEL_OPERATION_HEADER?header; uint status = client.TunnelOperation <SVHDX_TUNNEL_OPERATION_HEADER>( false,//true for Async operation, false for non-async operation RSVD_TUNNEL_OPERATION_CODE.RSVD_TUNNEL_DELETE_SNAPSHOT, ++RequestIdentifier, payload, out header, out deleteResponse); 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_DELETE_SNAPSHOT, (uint)RsvdStatus.STATUS_SVHDX_SUCCESS, RequestIdentifier); }