Skip to content

Commit

Permalink
Merge pull request #727 from Pierre-PvF/pvf-dev
Browse files Browse the repository at this point in the history
Get-RubrikVolumeGroupMount fix - Added filter for MountPoints for New-RubrikVolumeGroupMount
  • Loading branch information
jaapbrasser authored Mar 8, 2021
2 parents e294309 + f9bc2b0 commit 41e2263
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Added

* Added 5.3 endpoint for `Get-RubrikVolumeGroupMount`, resolving issue [Issue 729](https://github.com/rubrikinc/rubrik-sdk-for-powershell/issues/729)
* Added support to `Get-RubrikUser` to work around all of the API endpoint changes in CDM 5.3 as per [Issue 723](https://github.com/rubrikinc/rubrik-sdk-for-powershell/issues/723)
* Added new parameter, `SLAPrimaryClusterId`, to `Protect-RubrikFileset` & `New-RubrikSnapshot`, fixing [Issue 720](https://github.com/rubrikinc/rubrik-sdk-for-powershell/issues/720)
* Added additional parameters: `-DoNotProtect` & `-Inherit` to `Set-RubrikSQLInstance` as requested in [Issue 717](https://github.com/rubrikinc/rubrik-sdk-for-powershell/issues/717)
Expand Down
15 changes: 15 additions & 0 deletions Rubrik/Private/Get-RubrikAPIData.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,21 @@ function Get-RubrikAPIData {
Filter = ''
Success = '200'
}
'5.3' = @{
Description = 'Retrieve information for all Volume mounts'
URI = '/api/v1/volume_group/snapshot/mount'
Method = 'Get'
Body = ''
Query = @{
id = 'source_volume_group_id'
source_host = 'source_host_name'
offset = 'offset'
limit = 'limit'
}
Result = 'data'
Filter = ''
Success = '200'
}
}
'Get-RubrikVMSnapshot' = @{
'1.0' = @{
Expand Down
14 changes: 11 additions & 3 deletions Rubrik/Public/New-RubrikVolumeGroupMount.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,16 @@ function New-RubrikVolumeGroupMount
.EXAMPLE
$snapshot = Get-RubrikVolumeGroup "MyVolumeGroup" | Get-RubrikSnapshot -Latest
New-RubrikVolumeGroupMount -TargetHost "MyTargetHostName" -VolumeGroupSnapshot $snapshot -ExcludeDrives @("D","E")
This will create a new VolumeGroup Mount on MyTargetHostName with the latest snapshot retrieved in the first line, while exlcluding drives D & E
New-RubrikVolumeGroupMount -TargetHost "MyTargetHostName" -VolumeGroupSnapshot $snapshot -ExcludeMountPoint @("C:\MFAPDB05Log\")
This will create a new VolumeGroup Mount on MyTargetHostName with the latest snapshot retrieved in the first line, while exlcluding the volume mounted on C:\MFAPDB05Log\
New-RubrikVolumeGroupMount -TargetHost "MyTargetHostName" -VolumeGroupSnapshot $snapshot -ExcludeMountPoint @("Log")
To exclude all MountPoints with a certain string
#>

[CmdletBinding(SupportsShouldProcess = $true,ConfirmImpact = 'High')]
Expand All @@ -39,6 +46,7 @@ function New-RubrikVolumeGroupMount
# Rubrik server IP or FQDN
[Parameter(ParameterSetName = 'Create')]
[Array]$ExcludeDrives,
[Array]$ExcludeMountPoints,
[String]$Server = $global:RubrikConnection.server,
# API version
[String]$api = $global:RubrikConnection.api
Expand Down Expand Up @@ -82,9 +90,9 @@ function New-RubrikVolumeGroupMount

foreach ($disk in $VolumeGroupSnapshot.includedVolumes)
{
if ($ExcludeDrives -contains $disk.mountPoints.Replace(":\",""))
if ($ExcludeDrives -contains $disk.mountPoints.Replace(":\","") -Or [bool]($disk.mountPoints -match $ExcludeMountPoints) )
{
Write-Verbose -Message "Skipping Disk $disk.mountPoints" -Verbose
Write-Verbose -Message "Disk/MountPoint $disk.mountPoints is excluded" -Verbose
}
else
{
Expand Down

0 comments on commit 41e2263

Please sign in to comment.