Common Tasks :Getting a Handle to a Virtual Machine
2012-10-19 11:21
288 查看
Getting a Handle to a Virtual Machine
Most virtual machine operations require a handle to identify the virtual machine. The VixVM_Open() function convertsa path name to a handle, which you can use in subsequent function calls. VixVM_Open() is an asynchronous function, so the function call must be completed with a callback function or a call to VixJob_Wait().
To get a handle to a virtual machine
Supply a handle to the host on which the virtual machine is located. See Connecting
to a Host.
On VMware Server only, ensure that the virtual machine is registered on the host. See Registering
and Unregistering Virtual Machines.
Use the host handle and the virtual machine's path name in the host's file system to open the virtual machine withVixVM_Open().
Retrieve the virtual machine handle from the job object.
Example 3-6.
C code below. Click here for Perl. Click
here for COM.
VixHandle jobHandle = VIX_INVALID_HANDLE; VixHandle vmHandle = VIX_INVALID_HANDLE; char vmxFilePath[] = "c:\\Virtual Machines\\vm1\\win2000.vmx"; VixError err; // Open virtual machine and get a handle. jobHandle = VixVM_Open(hostHandle, vmxFilePath, 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); jobHandle = VIX_INVALID_HANDLE; // ...Use vmHandle in subsequent code...
相关文章推荐
- PatentTips - Use of multiple virtual machine monitors to handle privileged events
- eclipse failed to create the java virtual machine 问题图文解析
- SQL Developer 4.0 启动报错“unable to create an instance of the java virtual machine located at path”
- 关于VMware出现 Not enough physical memory is available to power on this virtual machine
- 【 Failed to create the Java Virtual Machine】的2种解决方式
- Failed to create the Java Virtual Machine
- 运行Virtualbox去安装系统时出错:Failed to open a session for the virtual machine,Unable to load R3 module xxxx/VBoxDD.DLL(VBoxDD)
- Oops: Unable to handle kernel NULL pointer dereference at virtual address 00000004
- Failed to create the Java Virtual Machine
- diskpart to deal with driver letter changed after reboot in Virtual Machine
- eclipse failed to create the java virtual machine
- 使用Oracle SQL Developer报错:Unable to find a Java Virtual Machine
- 解决Eclipse启动报错【Failed to create the Java Virtual Machine】
- ERROR: "This virtual machine appears to be in use"
- this virtual machine appears to be in use
- eclipse打开出错failed to create the java virtual machine解决方案
- Eclipse启动时fail to create Java Virtual Machine问题的解决
- 简单解决Eclipse"Failed to create the Java Virtual Machine"
- 打开sqldeveloper报错:Unable to launch the Java Virtual Machine Located at path
- 错误:Failed to create the Java Virtual Machine