Freigeben über


How to Delete a Virtual Machine Checkpoint

 

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

  1. Connect to the Service Provider FoundationVMM service.

  2. Obtain reference to the specific SpfVMM.VMCheckPoint that you want to delete.

  3. Call the DeleteObject method on the VMM service object reference and pass in the checkpoint reference.

  4. Call the SaveChanges method on the VMM service object reference.

To delete a checkpoint by using HTTP

  1. Create a new HTTP DELETE operation.

  2. Set the URL to the VMCheckPoints collection 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').

  3. Add the HTTP headers.

    Specifically, add the x-ms-principal-id header, which can be set to any value.

  4. Submit the HTTP request.

Example

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();  
    }  
}  
  

Example

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  
  

Example

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  
  

See Also

Checkpoints
How to Create a Virtual Machine Checkpoint
How to Restore a VM From a Checkpoint