/// <summary> /// Get the name of FSRVP server which the client MUST connect to create shadow copies of the specified shareName. /// </summary> /// <param name="shareName">The full path of the share in UNC format.</param> /// <returns>The name of FSRVP server.</returns> private string GetFsrvpServerName(string shareName) { int ret; string FsrvpServerName = ""; string serverName; FsrvpClient fsrvpClientForQuery = new FsrvpClient(); serverName = GetHostname(shareName); BaseTestSite.Assume.IsFalse(string.IsNullOrEmpty(serverName), "serverName is valid. The actual value is {0}.", serverName); try { DoUntilSucceed(() => ConnectServer(ref fsrvpClientForQuery, serverName), TestConfig.LongerTimeout, "Retry ConnectServer until succeed within timeout span"); BaseTestSite.Log.Add(LogEntryKind.Debug, "Start to call IsPathSupported({0}, out SupportedByThisProvider, out OwnerMachineName)", shareName); bool SupportedByThisProvider; ret = fsrvpClientForQuery.IsPathSupported(shareName, out SupportedByThisProvider, out FsrvpServerName); BaseTestSite.Assert.AreEqual <FsrvpErrorCode>(FsrvpErrorCode.FSRVP_SUCCESS, (FsrvpErrorCode)ret, "The server is expected to return 0x00000000. The server actually returns 0x{0:x8}.", ret); BaseTestSite.Assert.IsTrue(SupportedByThisProvider, "Expect that shadow copies of this share are supported by the server."); BaseTestSite.Assert.IsFalse(string.IsNullOrEmpty(FsrvpServerName), "Expect that OwnerMachineName is not null or empty. The server actually returns {0}.", FsrvpServerName); } finally { DisconnectServer(ref fsrvpClientForQuery); } return(FsrvpServerName); }