Reply to Message

View discussion in a popup

Replying to:
unixman
Contributor
Contributor

Hi,

well thank you for taking the time to look into all this. Great work indeed and we all miss things one time or another.

I have 1 more questions(there is always 1 more, right?) would I be able to take multiple snapshots with the vix api against a vmware server product giving the snapshots different names or would it always take 1 snapshot overwriting the existing snapshots

below is the full listing of the code which causes the segfault, it pretty much came out of the docs. I haven't started doing anything complex yet.

#include "stdio.h"

#include "string.h"

#include "vix.h"

static VixHandle hostHandle = VIX_INVALID_HANDLE;

static VixHandle jobHandle = VIX_INVALID_HANDLE;

void VixDiscoveryProc(VixHandle jobHandle,

VixEventType eventType,

VixHandle moreEventInfo,

void *clientData)

{

VixError err = VIX_OK;

VixHandle vmHandle = VIX_INVALID_HANDLE;

char *url = NULL;

// Check callback event; ignore progress reports.

if (VIX_EVENTTYPE_FIND_ITEM != eventType) {

return;

}

// Found a virtual machine.

err = Vix_GetProperties(moreEventInfo,

VIX_PROPERTY_FOUND_ITEM_LOCATION,

&url,

VIX_PROPERTY_NONE);

if (VIX_OK != err) {

// Handle the error...

goto abort;

}

printf("\nFound virtual machine: %s\n", url);

abort:

Vix_ReleaseHandle(jobHandle);

Vix_FreeBuffer(url);

}

int main()

{

VixError err;

// Connect to specified host.

jobHandle = VixHost_Connect(VIX_API_VERSION,

VIX_SERVICEPROVIDER_VMWARE_SERVER,

"vmserver1", // hostName

902, // hostPort

"root", // userName

"password", // 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);

printf("\nLooking for running virtual machines");

jobHandle = VixHost_FindItems(hostHandle,

VIX_FIND_RUNNING_VMS,

VIX_INVALID_HANDLE, // searchCriteria

-1, // timeout

VixDiscoveryProc,

NULL);

VixJob_Wait(jobHandle, VIX_PROPERTY_NONE);

Vix_ReleaseHandle(jobHandle);

VixHost_Disconnect(hostHandle);

abort:

printf("Aborting\n");

Vix_ReleaseHandle(jobHandle);

VixHost_Disconnect(hostHandle);

}

Reply
0 Kudos