HP Matrix 7.2 KVM Private Cloud Backup and Restore
Table Of Contents
- Abstract
 - Matrix Operating Environment with Matrix KVM Private Cloud Overview
 - Backup and restore strategy for Matrix OE with Matrix KVM Private Cloud
 - Matrix KVM Private Cloud backup and restore
 - Matrix KVM Private Cloud Images repository backup and restore
 - Matrix KVM Private Cloud High Availability (HA) cluster configuration backup and restore
 - Appendix A: KVM Private Cloud restore resynchronization actions
 - Appendix B: Images repository restore resynchronization actions
 - Appendix C: Alerts and Audit messages
 - Appendix D: HA Cluster details
 - Appendix E: Backup and Restore REST API
 - Appendix F: Sample Backup Script
 - Appendix G: Sample Restore Script
 - References
 - For more information
 

 $downloadUri = $hostname + $backupResource.downloadUri 
 $fileDir = [environment]::GetFolderPath("Personal") 
 $filePath = $fileDir + "\" + $backupResource.id + ".bkp" 
 $curlDownloadCommand = "curl -o " + $filePath + " -s -f -L -k -X GET " +  
 "-H 'accept: application/octet-stream' " + 
 "-H 'auth: " + $authValue + "' " + 
 "-H 'X-API-Version: 1' " + 
 $downloadUri  
 $curlGetDownloadErrorCommand = "curl -s -k -X GET " +  
 "-H 'accept: application/json' " + 
 "-H 'auth: " + $authValue + "' " + 
 "-H 'X-API-Version: 1' " + 
 $downloadUri  
 try 
 { 
 invoke-expression $curlDownloadCommand 
 if ($LASTEXITCODE -ne 0)  
 { 
 $errorResponse = invoke-expression $curlGetDownloadErrorCommand 
 if ($global:interactiveMode -eq 1) 
 { 
 Write-Host "Download error: $errorResponse" 
 } 
 else 
 { 
 Write-EventLog -EventId 100 -LogName Application -Source backup.ps1 -Message 
"Download error: $errorResponse" 
 } 
 if (Test-Path $filePath) 
 { 
 Remove-Item $filePath 
 } 
 return 
 } 
 if ($global:interactiveMode -eq 1) 
 { 
 Write-Host "Backup download complete!" 
 } 
 } 
 catch [System.Management.Automation.CommandNotFoundException] 
 { 
 return download-Backup-without-curl $backupResource $authValue $hostname 
 } 
 catch [System.Exception] 
 { 
 Write-Host "Not able to download backup" 
 Write-Host $error[0].Exception 
  return 
 } 
 return $filePath 
} 
##### Function to download the Backup file without using the curl command ##### 
function download-Backup-without-curl 
([PSCustomObject]$backupResource,[string]$authValue,[string]$hostname) 
{ 
 <# 
 .DESCRIPTION 
 Downloads the backup file from the appliance to the local system (without using 
curl) 
 .PARAMETER backupResource 
 Backup resource containing URI for downloading 
 .PARAMETER authValue 
 The authorized sessionID 
 .PARAMETER hostname 
 The IP address of the appliance 
 .INPUTS 
 None, does not accept piping 
44 










