Skip to content

Commit

Permalink
[Storage] Support ClientName when listing file handles; Upgrade SDK t… (
Browse files Browse the repository at this point in the history
Azure#26819)

* [Storage] Support ClientName when listing file handles; Upgrade SDK to latest version (Azure#26789)

* Update SDK to latest version

* Update SDK to latest version

* add ClientName for listing file handles

---------

Co-authored-by: Yabo Hu <[email protected]>

* fix changelog

---------

Co-authored-by: yifanz7 <[email protected]>
  • Loading branch information
VeryEarly and yifanz7 authored Dec 4, 2024
1 parent 433046f commit 7768323
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.18.0" />
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.16.0" />
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.16.0" />
<PackageReference Include="Azure.Storage.Queues" Version="12.16.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.23.0" />
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.21.0" />
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.21.0" />
<PackageReference Include="Azure.Storage.Queues" Version="12.21.0" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions src/Storage/Storage.Management/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 18 additions & 18 deletions src/Storage/Storage.Management/help/Get-AzStorageFileHandle.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 .
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/Storage.common/Storage.common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.16.0" />
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.21.0" />
<PackageReference Include="Microsoft.Azure.Cosmos.Table" Version="1.0.8" />
<PackageReference Include="Microsoft.Azure.Storage.Blob" Version="11.2.3" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions src/Storage/Storage/Model/ResourceModel/PSFileHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,17 @@ 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))
{
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);
Expand Down
8 changes: 4 additions & 4 deletions src/Storage/Storage/Storage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

<ItemGroup>
<PackageReference Include="Azure.Data.Tables" Version="12.8.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.18.0" />
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.16.0" />
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.16.0" />
<PackageReference Include="Azure.Storage.Queues" Version="12.16.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.23.0" />
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.21.0" />
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.21.0" />
<PackageReference Include="Azure.Storage.Queues" Version="12.21.0" />
<PackageReference Include="Microsoft.Azure.Cosmos.Table" Version="1.0.8" />
<PackageReference Include="System.Security.Permissions" Version="4.7.0" />
<PackageReference Include="Microsoft.Azure.Storage.Blob" Version="11.2.3" />
Expand Down
7 changes: 7 additions & 0 deletions src/Storage/Storage/Storage.generated.format.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,10 @@
<Label>SessionId</Label>
<Alignment>Left</Alignment>
</TableColumnHeader>
<TableColumnHeader>
<Label>ClientName</Label>
<Alignment>Left</Alignment>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
Expand Down Expand Up @@ -588,6 +592,9 @@
<TableColumnItem>
<PropertyName>SessionId</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>ClientName</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
Expand Down

0 comments on commit 7768323

Please sign in to comment.