From 7768323e4ba9c29466a9cc24740e1cb463f17eb7 Mon Sep 17 00:00:00 2001 From: Yabo Hu Date: Wed, 4 Dec 2024 14:43:54 +0800 Subject: [PATCH] =?UTF-8?q?[Storage]=20Support=20ClientName=20when=20listi?= =?UTF-8?q?ng=20file=20handles;=20Upgrade=20SDK=20t=E2=80=A6=20(#26819)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Storage] Support ClientName when listing file handles; Upgrade SDK to latest version (#26789) * Update SDK to latest version * Update SDK to latest version * add ClientName for listing file handles --------- Co-authored-by: Yabo Hu * fix changelog --------- Co-authored-by: yifanz7 <131133995+yifanz7@users.noreply.github.com> --- .../Storage.Management.Test.csproj | 8 ++--- src/Storage/Storage.Management/ChangeLog.md | 6 ++++ .../help/Get-AzStorageFileHandle.md | 36 +++++++++---------- .../Storage.common/Storage.common.csproj | 2 +- .../File/Cmdlet/SetAzureStorageFileContent.cs | 7 +++- .../Model/ResourceModel/PSFileHandle.cs | 4 +++ src/Storage/Storage/Storage.csproj | 8 ++--- .../Storage/Storage.generated.format.ps1xml | 7 ++++ 8 files changed, 50 insertions(+), 28 deletions(-) diff --git a/src/Storage/Storage.Management.Test/Storage.Management.Test.csproj b/src/Storage/Storage.Management.Test/Storage.Management.Test.csproj index 88e3effe66af..d14a1c43fa36 100644 --- a/src/Storage/Storage.Management.Test/Storage.Management.Test.csproj +++ b/src/Storage/Storage.Management.Test/Storage.Management.Test.csproj @@ -11,10 +11,10 @@ - - - - + + + + diff --git a/src/Storage/Storage.Management/ChangeLog.md b/src/Storage/Storage.Management/ChangeLog.md index be44cd301115..af87be7f80d3 100644 --- a/src/Storage/Storage.Management/ChangeLog.md +++ b/src/Storage/Storage.Management/ChangeLog.md @@ -18,6 +18,12 @@ - Additional information about change #1 --> ## Upcoming Release +* Upgraded Azure.Storage.Blobs to 12.23.0 +* Upgraded Azure.Storage.Files.Shares to 12.21.0 +* Upgraded Azure.Storage.Files.DataLake to 12.21.0 +* Upgraded Azure.Storage.Queues to 12.21.0 +* Supported ClientName property when listing file handles + - `Get-AzStorageFileHandle` * Upgraded Azure.Core to 1.44.1. ## Version 8.0.0 diff --git a/src/Storage/Storage.Management/help/Get-AzStorageFileHandle.md b/src/Storage/Storage.Management/help/Get-AzStorageFileHandle.md index f46d0ebe639d..8a91668e5580 100644 --- a/src/Storage/Storage.Management/help/Get-AzStorageFileHandle.md +++ b/src/Storage/Storage.Management/help/Get-AzStorageFileHandle.md @@ -55,14 +55,14 @@ Get-AzStorageFileHandle -ShareName "mysharename" -Recursive | Sort-Object Client ``` ```output -HandleId Path ClientIp ClientPort OpenTime LastReconnectTime FileId ParentId SessionId --------- ---- -------- ---------- -------- ----------------- ------ -------- --------- -28506980357 104.46.105.229 49805 2019-07-29 08:37:36Z 0 0 9297571480349046273 -28506980537 dir1 104.46.105.229 49805 2019-07-30 09:28:48Z 10376363910205800448 0 9297571480349046273 -28506980538 dir1 104.46.105.229 49805 2019-07-30 09:28:48Z 10376363910205800448 0 9297571480349046273 -28582543365 104.46.119.170 51675 2019-07-30 09:29:32Z 0 0 9477733061320772929 -28582543375 dir1 104.46.119.170 51675 2019-07-30 09:29:38Z 10376363910205800448 0 9477733061320772929 -28582543376 dir1 104.46.119.170 51675 2019-07-30 09:29:38Z 10376363910205800448 0 9477733061320772929 +HandleId Path ClientIp ClientPort OpenTime LastReconnectTime FileId ParentId SessionId ClientName +-------- ---- -------- ---------- -------- ----------------- ------ -------- --------- ---------- +28506980357 104.46.105.229 49805 2019-07-29 08:37:36Z 0 0 9297571480349046273 myclientvm +28506980537 dir1 104.46.105.229 49805 2019-07-30 09:28:48Z 10376363910205800448 0 9297571480349046273 myclientvm +28506980538 dir1 104.46.105.229 49805 2019-07-30 09:28:48Z 10376363910205800448 0 9297571480349046273 myclientvm +28582543365 104.46.119.170 51675 2019-07-30 09:29:32Z 0 0 9477733061320772929 myclientvm +28582543375 dir1 104.46.119.170 51675 2019-07-30 09:29:38Z 10376363910205800448 0 9477733061320772929 myclientvm +28582543376 dir1 104.46.119.170 51675 2019-07-30 09:29:38Z 10376363910205800448 0 9477733061320772929 myclientvm ``` This command lists file handles on a file share, and sort the output by ClientIp, then by OpenTime. @@ -73,10 +73,10 @@ Get-AzStorageFileHandle -ShareName "mysharename" -Path 'dir1/dir2' -Recursive - ``` ```output -HandleId Path ClientIp ClientPort OpenTime LastReconnectTime FileId ParentId SessionId --------- ---- -------- ---------- -------- ----------------- ------ -------- --------- -24057151779 dir1/dir2 104.46.105.229 50861 2019-06-18 07:39:23Z 16140971433240035328 11529285414812647424 9549812641162070049 -24057151780 dir1/dir2 104.46.105.229 50861 2019-06-18 07:39:23Z 16140971433240035328 11529285414812647424 9549812641162070049 +HandleId Path ClientIp ClientPort OpenTime LastReconnectTime FileId ParentId SessionId ClientName +-------- ---- -------- ---------- -------- ----------------- ------ -------- --------- ---------- +24057151779 dir1/dir2 104.46.105.229 50861 2019-06-18 07:39:23Z 16140971433240035328 11529285414812647424 9549812641162070049 myclientvm +24057151780 dir1/dir2 104.46.105.229 50861 2019-06-18 07:39:23Z 16140971433240035328 11529285414812647424 9549812641162070049 myclientvm ``` This command lists first 2 file handles on a file directory recursively . @@ -87,12 +87,12 @@ Get-AzStorageFileHandle -ShareName "mysharename" -Path 'dir1/dir2/test.txt' -ski ``` ```output -HandleId Path ClientIp ClientPort OpenTime LastReconnectTime FileId ParentId SessionId --------- ---- -------- ---------- -------- ----------------- ------ -------- --------- -24055513248 dir1/dir2/test.txt 104.46.105.229 49817 2019-06-18 08:21:59Z 9223407221226864640 16140971433240035328 9338416139169958321 -24055513249 dir1/dir2/test.txt 104.46.105.229 49817 2019-06-18 08:21:59Z 9223407221226864640 16140971433240035328 9338416139169958321 -24055513252 dir1/dir2/test.txt 104.46.105.229 49964 2019-06-18 08:22:54Z 9223407221226864640 16140971433240035328 9338416138431762125 -24055513253 dir1/dir2/test.txt 104.46.105.229 49964 2019-06-18 08:22:54Z 9223407221226864640 16140971433240035328 9338416138431762125 +HandleId Path ClientIp ClientPort OpenTime LastReconnectTime FileId ParentId SessionId ClientName +-------- ---- -------- ---------- -------- ----------------- ------ -------- --------- ---------- +24055513248 dir1/dir2/test.txt 104.46.105.229 49817 2019-06-18 08:21:59Z 9223407221226864640 16140971433240035328 9338416139169958321 myclientvm +24055513249 dir1/dir2/test.txt 104.46.105.229 49817 2019-06-18 08:21:59Z 9223407221226864640 16140971433240035328 9338416139169958321 myclientvm +24055513252 dir1/dir2/test.txt 104.46.105.229 49964 2019-06-18 08:22:54Z 9223407221226864640 16140971433240035328 9338416138431762125 myclientvm +24055513253 dir1/dir2/test.txt 104.46.105.229 49964 2019-06-18 08:22:54Z 9223407221226864640 16140971433240035328 9338416138431762125 myclientvm ``` This command lists the 3rd to the 6th file handles on a file. diff --git a/src/Storage/Storage.common/Storage.common.csproj b/src/Storage/Storage.common/Storage.common.csproj index d03de780375b..a396c7865d19 100644 --- a/src/Storage/Storage.common/Storage.common.csproj +++ b/src/Storage/Storage.common/Storage.common.csproj @@ -17,7 +17,7 @@ - + diff --git a/src/Storage/Storage/File/Cmdlet/SetAzureStorageFileContent.cs b/src/Storage/Storage/File/Cmdlet/SetAzureStorageFileContent.cs index 8d05515a8df3..115391a9325d 100644 --- a/src/Storage/Storage/File/Cmdlet/SetAzureStorageFileContent.cs +++ b/src/Storage/Storage/File/Cmdlet/SetAzureStorageFileContent.cs @@ -284,7 +284,12 @@ await DataMovementTransferHelper.DoTransfer(() => } // set file header and attributes to the file - fileClient.SetHttpHeaders(httpHeaders: header, smbProperties: smbProperties); + ShareFileSetHttpHeadersOptions httpHeadersOptions = new ShareFileSetHttpHeadersOptions + { + HttpHeaders = header, + SmbProperties = smbProperties + }; + fileClient.SetHttpHeaders(httpHeadersOptions); } if (this.PassThru) diff --git a/src/Storage/Storage/Model/ResourceModel/PSFileHandle.cs b/src/Storage/Storage/Model/ResourceModel/PSFileHandle.cs index e86825162fe1..14c1bf045d5e 100644 --- a/src/Storage/Storage/Model/ResourceModel/PSFileHandle.cs +++ b/src/Storage/Storage/Model/ResourceModel/PSFileHandle.cs @@ -48,6 +48,9 @@ public class PSFileHandle [Ps1Xml(Label = "SessionId", Target = ViewControl.Table, Position = 8)] public ulong SessionId { get; set; } + [Ps1Xml(Label = "ClientName", Target = ViewControl.Table, Position = 9)] + public string ClientName { get; set; } + public PSFileHandle(ShareFileHandle handle) { if (!String.IsNullOrEmpty(handle.HandleId)) @@ -55,6 +58,7 @@ public PSFileHandle(ShareFileHandle handle) this.HandleId = Convert.ToUInt64(handle.HandleId); } this.Path = handle.Path; + this.ClientName = handle.ClientName; if (!String.IsNullOrEmpty(handle.ClientIp)) { string[] clientIPs = handle.ClientIp.Split(new char[] { ':'}, StringSplitOptions.RemoveEmptyEntries); diff --git a/src/Storage/Storage/Storage.csproj b/src/Storage/Storage/Storage.csproj index 232484edbae5..c4a03a81f008 100644 --- a/src/Storage/Storage/Storage.csproj +++ b/src/Storage/Storage/Storage.csproj @@ -13,10 +13,10 @@ - - - - + + + + diff --git a/src/Storage/Storage/Storage.generated.format.ps1xml b/src/Storage/Storage/Storage.generated.format.ps1xml index 63138da30aa5..0f80427d585e 100644 --- a/src/Storage/Storage/Storage.generated.format.ps1xml +++ b/src/Storage/Storage/Storage.generated.format.ps1xml @@ -557,6 +557,10 @@ Left + + + Left + @@ -588,6 +592,9 @@ SessionId + + ClientName +