Mailing List Archive

How do I create a Snapshot using the XenAPI
Hello,

I am a student at FIU working on a school project - so I am a not very
experienced. Right now I am trying to use the Xen API code and the C#
SDK to Snapshot a VM. The project I have so far uses the XenAPI.VM
functions and I have been successful in starting and stopping a VM. As an
example I perform those actions like this:

XenRef<VM> vmRef = VM.get_by_uuid(_session, vmUUID);
VM.start(_session, vmRef.opaque_ref, false, true);

My mentors would like me to try and clone a VM. I have modeled my code
after the Run() function from
https://github.com/xenserver/xenadmin/tree/master/XenModel/Actions/VM/VMSnapshotCreateAction.cs
and I tried to make a snapshot with the following code:

public void snapshotTest(Session _session) {
XenRef<VM> vmRef = VM.get_by_uuid(_session, GetUUIDByName(vmName));
SnapshotType m_Type = SnapshotType.DISK; //hardcoded snapshot type
string snapshot_name = "Testing_Snapshot";

XenAPI.VM.async_snapshot(_session, vmRef.opaque_ref, snapshot_name);
}

I have two VM's. A Windows XP SP3 VM (No actual OS installed, just the base
VM) and an Ubuntu 14.04 Trusty Tahr VM (installed OS and running). The
Windows XP SP3 Snapshot gets created successfully but the Ubuntu snapshot
does not. I'm not sure what I'm doing wrong as this seems like it should be
pretty straight forward. I've also tried to snapshot with an without the VM
running and with and without quiesced disk.


Thanks,

D'Mita Levy
Cyber Fellow, Applied Research Center
Florida International University