Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-RubrikVolumeGroupMount fix - Added filter for MountPoints for New-RubrikVolumeGroupMount #727

Merged
merged 8 commits into from
Mar 8, 2021
Merged
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 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