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

Enable download of the zip file from a restore -> download workflow #624

Closed
dewbrik opened this issue May 8, 2020 · 1 comment · Fixed by #631
Closed

Enable download of the zip file from a restore -> download workflow #624

dewbrik opened this issue May 8, 2020 · 1 comment · Fixed by #631

Comments

@dewbrik
Copy link

dewbrik commented May 8, 2020

Is your feature request related to a problem? Please describe.
When recovering data from a fileset backup, there's the option to "Download" the recovered data, which in turn is made available as a zip file to be downloaded from the Rubrik cluster and it looks like this in the /event_series output:

id : 1588866508924-89a16ef3-b15c-41dd-866f-dd97631df567
status : Success
time : Thu May 07 15:48:28 UTC 2020
eventInfo : {"message":"Download link for 1 path(s) from snapshot of 'Linux NFS All' taken at 'Tue May 05 10:06:43 UTC 2020' is ready","id":"Snapshot.DownloadFileSuccess","params":{"${numOfPath}":"1","${snappableName}":"All Files","${snapshotdate}":"Tue May 05 10:06:43 UTC
2020"},"downloadInfo":{"name":"VMware-vCenter-support-2019-01-01@10-00-36.zip","path":"download_dir/X5iNw3b1TMzzYB0qkK7d","timeToLiveInSecondsOpt":86400}}
objectId : 64654b05-75c5-4cfe-ab04-f7fc4bc1783d
objectType : ShareFileset
objectName : All Files

I initially tried to download it like this:
(Invoke-WebRequest -Uri "https://RUBRIK_IP_HERE/download_dir/X5iNw3b1TMzzYB0qkK7d" -SkipCertificateCheck).content | Set-Content restored.file -AsByteStream

I initially tried this in PowerShell 7.0 as I'm on a Mac. This works fine for a small file(say < 1mb), but if the zip file is much larger than that, say 300 MB, this can take over an hour. I stopped it because pwsh process was starting to consume a lot of memory. I looked around a bit but I couldn't come up with a faster way and I eventually ended up trying this in Windows PowerShell 5.1 instead:

add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Ssl3, [Net.SecurityProtocolType]::Tls, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls12

$wc = new-object System.Net.WebClient
$url = "https://RUBRIK_IP_HERE/download_dir/X5iNw3b1TMzzYB0qkK7d"
$output = "test.zip"
$wc.DownloadFile($url,$output)

Describe the solution you'd like
I would like a cmdlet to download the zip file generated from a recovery workflow of "Recover Files" -> "Download Option"

A clear and concise description of what you want to happen.
Ideally, I would feed the file(s)/dir(s) I want to recover from a cmdlet and pipe the output from the cmdlet to another cmdlet that does the downloading. I think I might be asking for two new cmdlets(first recover, then download), but we have a use case for this.

Ideally the download cmdlet would also accept the event_series ID that would contain the above info.

Describe alternatives you've considered

This workflow is being carried out without Rubrik cmdlets now so it's not that it can't be done, but it'd be nice to have.

Additional context

@dewbrik
Copy link
Author

dewbrik commented May 8, 2020

I see that I forgot to mention what happened when I ran the last snippet in Windows PowerShell 5.1. That worked pretty well compared to the Set-Content approach I took with PowerShell 7.0. For comparison, pwsh memory consumption exceeded 20 GB and rendered my mac really sluggish, while trying the .Net approach on a Windows VM finished in less than a minute with no noticeable effect to the VM and both attempts used the same zip file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants