A SERVICE OF

logo

CHAPTER 4 Operations on Virtual Machines
67
RC1
jobHandle = VixHost_Connect(VIX_API_VERSION,
VIX_SERVICEPROVIDER_VMWARE_SERVER,
NULL, // hostName
0, // hostPort
NULL, // userName
NULL, // password,
0, // options
VIX_INVALID_HANDLE, // propertyListHandle
NULL, // callbackProc
NULL); // clientData
err = VixJob_Wait(jobHandle,
VIX_PROPERTY_JOB_RESULT_HANDLE,
&hostHandle,
VIX_PROPERTY_NONE);
if (VIX_OK != err) {
// Handle the error...
goto abort;
}
Vix_ReleaseHandle(jobHandle);
jobHandle = VixVM_Open(hostHandle,
"c:\\Virtual Machines\\vm1\\win2000.vmx",
NULL, // callbackProc
NULL); // clientData
err = VixJob_Wait(jobHandle,
VIX_PROPERTY_JOB_RESULT_HANDLE,
&vmHandle,
VIX_PROPERTY_NONE);
if (VIX_OK != err) {
// Handle the error...
goto abort;
}
Vix_ReleaseHandle(jobHandle);
// Revert to snapshot #0.
snapshotIndex = 0;
err = VixVM_GetRootSnapshot(vmHandle,
snapshotIndex,
&snapshotHandle);
if (VIX_OK != err) {
// Handle the error...
goto abort;
}
jobHandle = VixVM_RevertToSnapshot(vmHandle,
snapshotHandle,
0, // options
VIX_INVALID_HANDLE, // propertyListHandle