rubrikinc / rubrik-sdk-for-powershell

Rubrik Module for PowerShell
https://build.rubrik.com/sdks/powershell/
MIT License
102 stars 87 forks source link

Livemount from Rubrik replica fails with At C:\Program Files\WindowsPowerShell\Modules\Rubrik\6.0.0\Private\Invoke-RubrikWebRequest.ps1:36 char:23 #818

Open StefanBPS opened 1 year ago

StefanBPS commented 1 year ago

This script (with the variables set to the primary Rubrik edge system);

$latestrubriksnapshot=(Get-RubrikVM $line | Where-Object { $_.effectiveSlaDomainName -ne 'Unprotected' } | Get-RubrikSnapshot -Latest)

write-host $latestrubriksnapshot

Get-RubrikVM $line | Get-RubrikSnapshot -Latest  |Where-Object { $_.effectiveSlaDomainName -ne 'Unprotected' } | New-RubrikMount -MountName $bartrestoredname -Confirm:$false -PowerOn:$false| Get-RubrikRequest -WaitForCompletion 

Livemounts the VM in $line.

The very same script with a connection to the Rubrik replica system does not livemount the replicated snapshot but displays the following output:

@{isOnDemandSnapshot=False; date=2022-11-03T11:01:36.086Z; vmName=Linux 4; vNicsInfo=; snapshotRetentionInfo=; indexState=1; slaId=b617f5ef-6350-44cc-83e2-e2915f200039; cloudState=0; isPlacedOnLegalHold=False; cloudStorageTiers=; consistencyLevel=FILE_SYSTEM_CONSISTENT; isRetainedByRetentionLockSla=False; id=d93d2f8e-92ee-4a18-bafc-de03353c0015; archivalLocationIds=; slaName=demo_vm; isCustomRetentionApplied=False; replicationLocationIds=}

Invoke-WebRequest : Internal server error At C:\Program Files\WindowsPowerShell\Modules\Rubrik\6.0.0\Private\Invoke-RubrikWebRequest.ps1:36 char:23

You can see that the snapshot is found, it is a single snapshot (as it should be piping multiple results in errors or multiple mounts) but while I can restore this snapshot from the replica and restore or livemount it on the primary I cannot do a livemount from the Rubrik replica. This is not VM specific, it does not work with any VM. I have this issue with the Rubrik module 6.0.0 and CDM 7.something but also CDM 8.

CDM connection information:

Name Value


authType Token api 1 id server 172.17.200.151 version 8.0.1-p1-22135 header {User-Agent, Authorization} time 11/3/2022 2:57:43 PM userId cbdd4fda-9be8-4c9a-9fa2-45c31880b495

successfully connected to Rubrik server 172.17.200.151

using API token : eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJjYmRkNGZkYS05YmU4LTRjOWEtOWZhMi00NWMzMTg4MGI0OTUiLCJpc01mYVJlbWVtY

StefanBPS commented 1 year ago

I created a ticket for this at Rubrik support and after some investigation this is the response I got:

The Function to mount the snapshot from the replication site is defined by the API v2, however, the PowerShell module is always connecting to v1 and hence it is failing,

As of now, "Invoke-RubrikRESTCall" seems to be the only solution.

The current PowerShell module does not support mounting replicated snapshots.

I have noticed that other features related to what happens to NIC's during a restore are also not implemented in the Powershell module because it connects to API v1, this will impact more and more new Rubrik features, are there plans to support API V2 with the Rubrik powershell module?