This article is part of the Service Provider Foundation Programmers Guide (SPF).
Virtual Machine Checkpoints provide a way to capture the state of a Virtual Machine. The Checkpoint can then be used to restore the Virtual Machine back to the way it was when the Checkpoint was created.
To restore a checkpoint state to a Virtual Machine, you update an existing Checkpoint object. Set the VMCheckPointAction property to Restore and submit the changed entity back to the server. This is done with a MERGE or PUT HTTP operation.
Connect to the Service Provider Foundation VMM service.
Obtain reference to the specific SpfVMM.VMCheckPoint you want to restore an associated virtual machine to.
Set the VMCheckPointAction property to Restore.
Call the UpdateObject method on the VMM service object reference and pass in the checkpoint reference.
Call the SaveChanges method on the VMM service object reference.
Create a new HTTP PUT or MERGE operation.
Set the URL to the URI of a specific checkpoint: https://server:30005/subscription-id/services/systemcenter/vmm/VMCheckPoints(ID=guid'checkpoint-id',StampId=guid'stamp-id')
Add the HTTP headers.
Specifically, add the x-ms-principal-id header, which can be set to any value.
Create the HTTP payload containing the checkpoint entity with the VMCheckPointAction property set to Restore.
Submit the HTTP request.
The following example shows how to get a specific checkpoint and restore it using .NET. For more information, see Programming in Visual Studio with Service Provider Foundation Services.
var checkpoint = vmmService.VMCheckPoints.Where(cp => cp.ID ==
new
Guid(
"a11cc636-5521-4f88-92b2-cad392911fe0"
)).FirstOrDefault();
if
(checkpoint !=
null
)
{
checkpoint.VMCheckPointAction =
"Restore"
;
vmmService.UpdateObject(checkpoint);
vmmService.SaveChanges();
}
The following is an example HTTP request sent to the server:
MERGE https://wapserver:30005/BA4146FA-FB41-41B6-A7C0-2B4FF4C3F7E3/services/systemcenter/vmm/VMCheckPoints(ID=guid'a11cc636-5521-4f88-92b2-cad392911fe0',StampId=guid'ba4146fa-fb41-4f59-a193-ad00c52a138c') HTTP/1.1 DataServiceVersion: 3.0;NetFx MaxDataServiceVersion: 3.0;NetFx Accept: application/json;odata=minimalmetadata Accept-Charset: UTF-8 DataServiceUrlConventions: KeyAsSegment User-Agent: Microsoft ADO.NET Data Services x-ms-principal-id: user@contoso.com Content-Type: application/json;odata=minimalmetadata Host: wapserver:30005 Content-Length: 80 Expect: 100-continue { "VMCheckPointAction": "Restore", "odata.type": "VMM.VMCheckPoint" }
The following is an example HTTP response from the server:
HTTP/1.1 204 No Content Cache-Control: no-cache Server: Microsoft-IIS/8.5 x-ms-request-id: 6e0d9045-9d24-4ac1-93fc-a172e09af870 X-Content-Type-Options: nosniff request-id: eda9bde6-834a-0000-2eda-aced4a83ce01 DataServiceVersion: 1.0; X-AspNet-Version: 4.0.30319 Persistent-Auth: true X-Powered-By: ASP.NET Date: Mon, 19 Aug 2013 22:13:09 GMT