How to Delete a Virtual Machine Checkpoint
Updated: June 27, 2017
Applies To: System Center 2016 - Service Provider Foundation, System Center Technical Preview
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.
Sometimes though, a checkpoint might no longer be needed, and you might want to delete it. You use the standard OData method to delete a resource. A checkpoint is deleted by calling the DELETE HTTP operation on the checkpoint that is identified by the URL.
To delete a checkpoint by using the .NET Framework
Connect to the Service Provider Foundation
VMMservice.Obtain reference to the specific
SpfVMM.VMCheckPointthat you want to delete.Call the
DeleteObjectmethod on theVMMservice object reference and pass in the checkpoint reference.Call the
SaveChangesmethod on theVMMservice object reference.
To delete a checkpoint by using HTTP
Create a new
HTTPDELETE operation.Set the URL to the
VMCheckPointscollection to identify the checkpoint to delete. For example: https://server:30006/subscription-id/services/systemcenter/vmm/VMCheckPoints(ID=guid'a11cc636-5521-4f88-92b2-cad392911fe0',StampId=guid'ba4146fa-fb41-4f59-a193-ad00c52a138c').Add the HTTP headers.
Specifically, add the
x-ms-principal-idheader, which can be set to any value.Submit the HTTP request.
The following code example shows how to delete a virtual machine checkpoint. For more information, seeProgramming in Visual Studio with Service Provider Foundation Services.
public static void DeleteCheckpoint() { SpfVMM.VMM vmmService = new SpfVMM.VMM(new Uri("https://wapserver:30006/97FD50F3-1DC0-41B6-A7C0-2B4FF4C3F7E3/services/systemcenter/vmm/")); vmmService.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; var checkpoint = vmmService.VMCheckPoints.Where(cp => cp.ID == new Guid("3499b02c-8dc9-4c0d-aa83-097a1340cbda")).FirstOrDefault(); if (checkpoint != null) { vmmService.DeleteObject(checkpoint); vmmService.SaveChanges(); } }
The following code example is an HTTP request that is sent to the server.
DELETE https://wapserver:30006/97FD50F3-1DC0-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:30006 Content-Length: 0
The following code example shows the HTTP response from the server.
HTTP/1.1 204 No Content Cache-Control: no-cache Server: Microsoft-IIS/8.5 x-ms-request-id: 7ce34b7f-81a1-40e6-a3bf-12b84995cf74 X-Content-Type-Options: nosniff request-id: eda9bde6-834a-0001-9808-abed4a83ce01 DataServiceVersion: 1.0; X-AspNet-Version: 4.0.30319 Persistent-Auth: true X-Powered-By: ASP.NET Date: Mon, 19 Aug 2013 22:17:52 GMT
Checkpoints
How to Create a Virtual Machine Checkpoint
How to Restore a VM From a Checkpoint