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
 

 .OUTPUTS 
 Outputs the response body containing the needed session ID. 
 .EXAMPLE 
 $authtoken = login-appliance $username $password $hostname 
 #> 
 # the particular URI on the Appliance to reqest an "auth token" 
 $loginURI = "/rest/login-sessions" 
 # append the URI to the end of the IP address to obtain a full URI 
 $fullLoginURI = $hostname + $loginURI 
 # create the request body as a hash table, then convert it to json format  
 $body = @{ userName = $username; password = $password } | convertTo-json 
 try 
 { 
 # create a new webrequest object and give it the header values that will be accepted by the 
Appliance, get response 
 $loginRequest = setup-request -Uri $fullLoginURI -method "POST" -accept "application/json" 
-contentType "application/json" -Body $body 
 if ($global:interactiveMode -eq 1) 
 { 
 Write-Host "Login completed successfully." 
 } 
 } 
 catch [System.Exception] 
 { 
 Write-Host $_.Exception.message 
 Write-Host $error[0].Exception 
 return 
 } 
 #the output for the function, a hash table which contains a single value, "sessionID" 
 $loginRequest | convertFrom-Json 
 return 
} 
##### Upload the backup file to the appliance ##### 
function uploadTo-appliance 
([string]$filepath,[string]$authinfo,[string]$hostname,[string]$backupFile) 
{ 
 <# 
 .DESCRIPTION 
 Attempts to upload a backup file to the appliance. Tries to use the curl command. 
 The curl command has significantly better performance especially for large backups. 
 If curl isn't installed, invokes uploadTo_appliance-without-curl to upload the 
file. 
 .PARAMETER filepath 
 The absolute filepath to the backup file. 
 .PARAMETER authinfo 
 The authorized session ID returned by the login request 
 .PARAMETER hostname 
 The appliance to connect to 
 .PARAMETER backupFile 
 The name of the file to upload. Only used to tell the server what file is contained 
in the post request. 
 .INPUTS 
 None, does not accept piping 
 .OUTPUTS 
 The response body to the upload post request. 
 .EXAMPLE 
 $uploadResponse = uploadTo-appliance $filePath $sessionID $hostname $fileName 
 #> 
 $uploadUri = "/rest/backups/archive" 
 $fullUploadUri = $hostname + $uploadUri 
 $curlUploadCommand = "curl -s -k -X POST " +  
 "-H 'content-type: multipart/form-data' " + 
 "-H 'accept: application/json' " + 
 "-H 'auth: " + $authinfo + "' " + 
 "-H 'X-API-Version: 1' " + 
 "-F file=@" + $filepath + " " + 
 $fullUploadUri 










