rubrikinc / rubrik-sdk-for-powershell

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

cmdlet support to LiveMount Hyper-V #450

Closed aeva-assured closed 4 years ago

aeva-assured commented 5 years ago

Is your feature request related to a problem? Please describe.

When trying to use existing cmdlet "New-RubrikMount" to mount a HyperVVM I got the following response:

`PS C:\Users\user\Documents> New-RubrikMount -id bf6cd3a0-0b8b-445b-bb06-86b6c8df739a -Poweron:$false -HostID HypervServer:::efd5b192-534d-4709-a0ef-08d13e6681ca
WARNING: rubrik_error
WARNING: Invalid snappable type: HypervVirtualMachine for snappable: 431f2a92-270d-4d11-a521-6b6678ee4529-933AF92E-D50E-413E-A01A-5FFBE812C99D
The remote server returned an error: (422) Unprocessable Entity.
At C:\Program Files\WindowsPowerShell\Modules\Rubrik\4.0.0.490\Private\Submit-Request.ps1:77 char:21
+                     throw $_.Exception
+                     ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], WebException
    + FullyQualifiedErrorId : The remote server returned an error: (422) Unprocessable Entity.`

Describe the solution you'd like

cmdlet should detect snappable type or allow type flag to be set so that it will support livemounts of multiple types

Describe alternatives you've considered

I have a working work-around leveraging the "invoke-RubrikRESTCall" and building the POST body manually. This satisfies for most of my use-cases but would be fall closer in line with the existing cmdlets that have managed volume mounts, nasshare, vcenter vmdkmount, volumegroupmount, etc...

Additional context

Adding mount-types to the cmdlet will help for when AHV becomes available, additionally for streamlining EC2 mounts and Azure mounts

mwpreston commented 5 years ago

Thanks for creating the issue @aeva-assured ! I think this may best align with the rest of the module if we created a New-RubrikHyperVMount cmdlet or something along those lines...

Andrew - do you have examples of how you are using Invoke-RubrikRestCall now for Hyper-V Live Mounts? It'd be good to see what information you are passing that way we can be sure we capture everything you need...

Thx!

aeva-assured commented 5 years ago

I'm not doing anything different than we'd do with the vmware mounts. I definitely rename, enable/disable network, enable/disable power, options for specifying where I'm recovering to.

$body  = @{'vmName'=$($mountname);'disableNetwork'=$false;'powerOn'=$false;'hostId'='HypervServer:::efd5b192-534d-4709-a0ef-08d13e6681ca'}
    $job = Invoke-RubrikRESTCall -Endpoint hyperv/vm/snapshot/$($latestsnap.id)/mount -api internal -Method POST -Body $body
shamsway commented 4 years ago

Resolved by #565