Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Microsoft.AVS.VMFS/Microsoft.AVS.VMFS.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"Set-VmfsStaticIscsi",
"New-VmfsDatastore",
"Dismount-VmfsDatastore",
"Resize-iSCSIDatastore",
"Resize-VmfsVolume",
"Restore-VmfsVolume",
"Sync-VMHostStorage",
Expand Down
62 changes: 62 additions & 0 deletions Microsoft.AVS.VMFS/Microsoft.AVS.VMFS.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,68 @@ function Resize-VmfsVolume {
$DatastoreSystem.ExpandVmfsDatastore($DatastoreToResize.ExtensionData.MoRef, $ExpandOptions[0].spec)
}

<#
.DESCRIPTION
Expand existing iSCSI Datastore to new size.

.PARAMETER ClusterName
Cluster name

.PARAMETER DatastoreName
Datastore name

.EXAMPLE
Resize-iSCSIDatastore -ClusterName "myCluster" -DatastoreName "myDatastore"

.INPUTS
vCenter cluster name and datastore name.

.OUTPUTS
None.
#>
function Resize-iSCSIDatastore {
[CmdletBinding()]
[AVSAttribute(10, UpdatesSDDC = $false)]
Param (
[Parameter(
Mandatory=$true,
HelpMessage = 'Cluster name in vCenter')]
[ValidateNotNull()]
[String]
$ClusterName,

[Parameter(
Mandatory=$true,
HelpMessage = 'Name of iSCSI datastore to be expanded in vCenter')]
[ValidateNotNull()]
[String]
$DatastoreName
)

$Cluster = Get-Cluster -Name $ClusterName -ErrorAction Ignore
if (-not $Cluster) {
throw "Cluster $ClusterName does not exist."
}

$Datastore = Get-Datastore -Name $DatastoreName -ErrorAction Ignore
if (-not $Datastore) {
throw "Datastore $DatastoreName does not exist."
}

if ($Datastore.Type -ne "VMFS") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the the test does not correspond to the conclusion - I don't see what's testing the VMFS provider specifically for Elastic.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pointless and redundant to resize-vmfsdatastore.

Copy link
Author

@Malika133 Malika133 Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @et1975 and @Zsoldier, thank you for taking out time to review the PR, I have renamed it to Resize-iSCSIDatastore, as we want it to available for both iSCSI-based storage solutions, ElasticSAN and Pure. It differs from Resize-VmfsDatastore in the way that
1.GA version of the package of Resize-VmfsDatastore is tied to Pure Storage GA. This GA version only allows customers to execute the cmdlets necessary for Pure Storage CBS appliance integration. Hence it can't be used for ElasticSAN use cases.
2. Customers might not have NAA ID readily available of the attached LUN, this will allow them to expand datastore using ClusterName and DatastoreName only,
adding same details in the PR description as well.
This check will ensure it is not implemented for other Datastore Types- vvol and NFS

throw "Datastore $DatastoreName is of type $($Datastore.Type). This cmdlet can only process iSCSI datastores."
}

$NaaID = [string]$Datastore.ExtensionData.Info.Vmfs.Extent.DiskName
if (-not $NaaID) {
throw "Failed to get NAA ID for datastore $DatastoreName."

}

Write-Host "Resizing iSCSI datastore $DatastoreName..."
Resize-VmfsVolume -ClusterName $ClusterName -DeviceNaaId $NaaID
}

<#
.DESCRIPTION
Re-signature existing VMFS volume to recover to previous version.
Expand Down