Common Tasks :Virtual Machine Guest Operations
2012-10-19 11:24
232 查看
Virtual Machine Guest Operations
This section discusses several operations that provide access to the guest operating system.
VMware Tools
All functions that execute in a guest operating system require VMware Tools to be installed and running. See InstallingVMware Tools in a Virtual Machine for information on installing VMware Tools.
Authentication
All functions that modify a file system in the guest operating system or that execute code in a guest operating system require the client to authenticate as a user accountknown to the guest. The following list shows the functions that require client authentication.
VixVM_CopyFileFromHostToGuest()
VixVM_CopyFileFromGuestToHost()
VixVM_CreateDirectoryInGuest()
VixVM_CreateTempFileInGuest()
VixVM_DeleteDirectoryInGuest()
VixVM_DeleteFileInGuest()
VixVM_DirectoryExistsInGuest()
VixVM_FileExistsInGuest()
VixVM_KillProcessInGuest()
VixVM_ListDirectoryInGuest()
VixVM_ListProcessesInGuest()
VixVM_OpenUrlInGuest()
VixVM_RenameFileInGuest()
VixVM_RunProgramInGuest()
VixVM_RunScriptInGuest()
A client uses VixVM_LoginInGuest() to authenticate with the guest operating system. Once authenticated, the client
may continue to perform guest operations until one of the following takes place:
The client calls VixVM_LogoutFromGuest().
The client terminates, which ends the session.
The client attempts to authenticate a second time, and the second attempt fails.
The virtual machine shuts down.
If a virtual machine is suspended while a client is authenticated with the guest operating system, the client may resume guest operations after resuming virtual machine execution.
However, this is true only as long as the client continues running while the virtual machine is suspended.
To authenticate with the guest operating system:
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.
Power on the virtual machine and wait for VMware Tools to become active. See Starting
or Resuming a Virtual Machine.
Use the virtual machine handle, the user name, and the user password, to call VixVM_LoginInGuest().
Example 3-10.
C code below. Click here for Perl. Click
here for COM.
VixError err = VIX_OK; VixHandle jobHandle = VIX_INVALID_HANDLE; // Authenticate with guest operating system. jobHandle = VixVM_LoginInGuest(vmHandle, "Administrator", // userName "secret", // password 0, // options NULL, // callbackProc NULL); // clientData err = VixJob_Wait(jobHandle, VIX_PROPERTY_NONE); if (VIX_OK != err) { // Handle the error... goto abort; } Vix_ReleaseHandle(jobHandle); jobHandle = VIX_INVALID_HANDLE;
The Console User
You may sometimes choose to provide a predefined string in place of an actual user name when callingVixVM_LoginInGuest().The Vix header file provides the define VIX_CONSOLE_USER_NAME as a substitute for an actual user name. You need to use this substitute for authentication with a Windows guest operating system if you
plan to launch a graphical user interface in the guest.
Before calling VixVM_LoginInGuest() with VIX_CONSOLE_USER_NAME,
you need to be sure that a user is currently logged in to the guest operating system. The user must log in through a graphical console connection to the virtual machine.
VixVM_LoginInGuest() establishes credentials for API operations but does not do an actual login to the guest.
Using VIX_CONSOLE_USER_NAME is similar to making a second console connection to a virtual machine. When a user has
logged in through one console connection, a second connection to the same virtual machine shares the display with the first connection and takes advantage of the first user's login account.
VIX_CONSOLE_USER_NAME is needed prior to calling these functions:
VixVM_OpenUrlInGuest()
VixVM_RunProgramInGuest()
The password for VIX_CONSOLE_USER_NAME is always NULL.
Example 3-11.
C code below. Click here for Perl. Click
here for COM.
VixError err = VIX_OK; VixHandle jobHandle = VIX_INVALID_HANDLE; // Authenticate with guest operating system. jobHandle = VixVM_LoginInGuest(vmHandle, CONSOLE_USER_NAME, // Use console ID NULL, // no password needed 0, // options NULL, // callbackProc NULL); // clientData err = 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
- create a new virtual machine & install a guest OS(ESX)
- the virtual machine is configured for 64-bit guest operating systems
- the cpu has been disabled by the guest operating system. power off or reset the virtual machine
- This virtual machine is configured for 64-bit guest operating systems. However, 64-bit operation is
- Configuring and Installing a Xen Hardware Virtual Machine (HVM) domainU Guest
- This virtual machine is configured for 64-bit guest operating systems.……
- You have configured this virtual machine to use a 64-bit guest operating system. However, 64-bit op
- Extended paging tables to map guest physical memory addresses from virtual memory page tables to host physical memory addresses in a virtual machine system
- This Virtual Machine Is Configured For 64-bit Guest Operating Systems
- Common Tasks :Getting a Handle to a Virtual Machine
- eclipse启动时 failed to create the java virtual machine 解决办法 .
- 如何解决Fail to create the java Virtual Machine
- start up virtual machine with ivshmem device
- CentOS 6.0 fix for VBoxGuestAdditions installation for VirtualBox
- JVM - Concept and Lifetime (From book "Inside the Java Virtual Machine")
- 打开Eclipse时出现"Failed to create the Java Virtual Machine"
- 关于VMware出现 Not enough physical memory is available to power on this virtual machine
- An unexpected error has been detected by HotSpot Virtual Machine的解决过程
- The virtual machine could not be added. The virtual machine configuration could not be added. A configuration with this name already exists.