Common Tasks :Powering Off or Suspending a Virtual Machine
来源:互联网 发布:手机淘宝取消退款流程 编辑:程序博客网 时间:2024/06/04 23:30
Powering Off or Suspending a Virtual Machine
This section discusses the operations used to power off or suspend a virtual machine.
Choosing Whether to Power Off or Suspend
You can stop virtual machine execution in two ways. Whether you choose to power off or to suspend a virtual machine depends on your purpose.
- VixVM_PowerOff() is equivalent to turning off the power switch of a physical machine. Some operations on a virtual machine, such as changing the virtual hardware configuration, require that the virtual machine be powered off.
- VixVM_Suspend() is similar to putting a laptop to sleep. The virtual machine stops running. When you resume operation, the virtual machine continues exactly from the point of suspension
The suspend operation also saves the virtual machine's state on disk, allowing you to reboot the host or move the virtual machine to a new location without shutting down the guest operating system in the virtual machine.
Both functions are asynchronous, so either function call must be completed with a callback function or a call to VixJob_Wait().
Powering Off a Virtual Machine
To power off a virtual machine
- Connect to the host on which the virtual machine is located. See Connecting to a Host.
- Get a handle to the virtual machine. See Getting a Handle to a Virtual Machine.
- Use the virtual machine handle in a call to VixVM_PowerOff().
Example 3-12.
C code below. Click here for Perl. Click here for COM.
VixError err = VIX_OK;VixHandle jobHandle = VIX_INVALID_HANDLE; // Power off the virtual machine.jobHandle = VixVM_PowerOff(vmHandle, VIX_VMPOWEROP_FROM_GUEST, // powerOffOptions NULL, // callbackProc NULL); // clientDataerr = VixJob_Wait(jobHandle, VIX_PROPERTY_NONE);if (VIX_OK != err) { // Handle the error... goto abort;}Vix_ReleaseHandle(jobHandle);jobHandle = VIX_INVALID_HANDLE;
Suspending a Virtual Machine
To suspend a virtual machine
- Connect to the host on which the virtual machine is located. See Connecting to a Host.
- Get a handle to the virtual machine. See Getting a Handle to a Virtual Machine.
- Use the virtual machine handle in a call to VixVM_Suspend().
Example 3-13.
C code below. Click here for Perl. Click here for COM.
VixError err = VIX_OK;VixHandle jobHandle = VIX_INVALID_HANDLE; // Suspend the virtual machine.jobHandle = VixVM_Suspend(vmHandle, 0, // powerOffOptions NULL, // callbackProc NULL); // clientDataerr = VixJob_Wait(jobHandle, VIX_PROPERTY_NONE);if (VIX_OK != err) { // Handle the error... goto abort;}Vix_ReleaseHandle(jobHandle);jobHandle = VIX_INVALID_HANDLE;
- Common Tasks :Powering Off or Suspending a Virtual Machine
- Common Tasks :Starting or Resuming a Virtual Machine
- Common Tasks :Importing a Legacy Virtual Machine
- Common Tasks :Getting a Handle to a Virtual Machine
- Common Tasks :Installing VMware Tools in a Virtual Machine
- Common Tasks :Virtual Machine Guest Operations
- Solution to : The cpu has been disabled by the guest operating system. You will need to power off or reset the virtual machine a
- Changing or keeping a UUID for a moved virtual machine
- Common Tasks :Registering and Unregistering Virtual Machines
- One of the disks in this virtual machine is already in use by a virtual machine or by a snapshot"
- the cpu has been disabled by the guest operating system. power off or reset the virtual machine
- Common Tasks :Connecting to a Host
- Common Tasks :Connecting to a Specified Host
- Powering a number
- Powering a number
- Renaming a virtual machine disk (VMDK) via the vSphere Management Assistant (vMA) or vSphere CLI (vC
- Suspending and Resuming a Thread
- Using USB Devices in a Virtual Machine
- Select模型学习
- Common Tasks :Virtual Machine Guest Operations
- php 对 mysql数据库的增,删,该,查
- C++的替代者
- 创建计算字段 汇总数据 分组数据
- Common Tasks :Powering Off or Suspending a Virtual Machine
- 第八周最后任务—我爱你!!!
- Common Tasks :Importing a Legacy Virtual Machine
- C++的营养——swap手法
- fusionchart的简单封装
- 一个程序员的悲剧 - 前言
- 任意值加密
- Google的编程样式
- Delphi 字符串加密算法 (基于DES)