VMWare的VIX

VIX是什么东东?

摘自来自VMVare 官网

http://www.vmware.com/support/developer/vix-api/

 

The VIX API helps you write programs and scripts to automate virtual machine operations and run programs or manipulate files within guest operating systems. This API is high-level, easy to use, and practical for both script writers and application programmers. It runs on either Windows or Linux and supports management of VMware Server, Workstation, and ESX/ESXi, optionally through vCenter Server. Bindings are provided for C, Perl, and COM (Visual Basic, VBscript, C#).

 

安装之后位于:

C:/Program Files/VMware/VMware VIX

这个目录下有个vmrun.exe.

 

那么这个文件具体都有些什么内容?可以打开看一下。


C:/Program Files/VMware/VMware VIX>vmrun

vmrun version 2.0.2 build-203138

Usage: vmrun [AUTHENTICATION-FLAGS] COMMAND [PARAMETERS]



AUTHENTICATION-FLAGS
--------------------
These must appear before the command and any command parameters.

   -h <hostName>  (not needed for Workstation)
   -P <hostPort>  (not needed for Workstation)
   -T <hostType> (ws|server|server1)
     for example, use '-T server' for Server 2.0
                  use '-T server1' for Server 1.0
   -u <userName in host OS>  (not needed for Workstation)
   -p <password in host OS>  (not needed for Workstation)
   -gu <userName in guest OS>
   -gp <password in guest OS>



POWER COMMANDS            PARAMETERS           DESCRIPTION
--------------           ----------           -----------
start                    Path to vmx file     Start a VM
                         [gui|nogui]

stop                     Path to vmx file     Stop a VM
                         [hard|soft]

reset                    Path to vmx file     Reset a VM
                         [hard|soft]

suspend                  Path to vmx file     Suspend a VM
                         [hard|soft]

pause                    Path to vmx file     Pause a VM

unpause                  Path to vmx file     Unpause a VM



SNAPSHOT COMMANDS         PARAMETERS           DESCRIPTION
-----------------        ----------           -----------
snapshot                 Path to vmx file     Create a snapshot of a VM
                         Snapshot name

deleteSnapshot           Path to vmx file     Remove a snapshot from a VM
                         Snapshot name

revertToSnapshot         Path to vmx file     Set VM state to a snapshot
                         Snapshot name

注:Mware的虚拟机“快照”功能是对虚拟机磁盘文件VMDK的某个状态创建副本,当系统出现异常,可以通过恢复快照来保证系统的正常。

RECORD/REPLAY COMMANDS    PARAMETERS           DESCRIPTION
----------------------   ----------           -----------
beginRecording           Path to vmx file     Begin recording a VM
                         Snapshot name

endRecording             Path to vmx file     End recording a VM

beginReplay              Path to vmx file     Begin replaying a VM
                         Snapshot name

endReplay                Path to vmx file     End replaying a VM

注:
Record/Replay 则 是Workstation 6中新增加的一个测试中的功能。该功能有些类似Snapshot——它不仅能记录下过去的某一点,而且会记录那一点之后到现在为止的期间中的所有系统的动 作。这里的工作不仅包括鼠标键盘等输入动作,更包括内存、I/O等系统状态。该功能最大的用处就是,对于那些特别难以再现的系统现象(如BUG)一旦加以 录制,就可以反复回放,极大地方便了程序特别是系统应用程序的DEBUG。

 

GUEST OS COMMANDS         PARAMETERS           DESCRIPTION
-----------------        ----------           -----------
runProgramInGuest        Path to vmx file     Run a program in Guest OS
                         [-noWait]
                         [-activeWindow]
                         [-interactive]
                         Complete-Path-To-Program
                         [Program arguments]

fileExistsInGuest        Path to vmx file     Check if a file exists in Guest OS

                         Path to file in guest

setSharedFolderState     Path to vmx file     Modify a Host-Guest shared folder
                         Share name
                         Host path
                         writable | readonly

addSharedFolder          Path to vmx file     Add a Host-Guest shared folder
                         Share name
                         New host path

removeSharedFolder       Path to vmx file     Remove a Host-Guest shared folder
                         Share name

listProcessesInGuest     Path to vmx file     List running processes in Guest OS


killProcessInGuest       Path to vmx file     Kill a process in Guest OS
                         process id

runScriptInGuest         Path to vmx file     Run a script in Guest OS
                         Interpreter path
                         script_text

deleteFileInGuest        Path to vmx file     Delete a file in Guest OS
                         Path in guest

createDirectoryInGuest   Path to vmx file     Create a directory in Guest OS
                         Directory path in guest

deleteDirectoryInGuest   Path to vmx file     Delete a directory in Guest OS
                         Directory path in guest

listDirectoryInGuest     Path to vmx file     List a directory in Guest OS
                         Directory path in guest

copyFileFromHostToGuest  Path to vmx file     Copy a file from host OS to guest
OS
                         Path on host
                         Path in guest

copyFileFromGuestToHost  Path to vmx file     Copy a file from guest OS to host
OS
                         Path in guest
                         Path on host

renameFileInGuest        Path to vmx file     Rename a file in Guest OS
                         Original name
                         New name

captureScreen            Path to vmx file     Capture the screen of the VM to a
local file
                         Path on host

writeVariable            Path to vmx file     Write a variable in the VM state
                         [runtimeConfig|guestEnv]
                         variable name
                         variable value

readVariable             Path to vmx file     Read a variable in the VM state
                         [runtimeConfig|guestEnv]
                         variable name



VPROBE COMMANDS           PARAMETERS           DESCRIPTION
---------------          ----------           -----------
vprobeVersion            Path to vmx file     List VP version

vprobeLoad               Path to vmx file     Load VP script
                         'VP script text'

vprobeReset              Path to vmx file     Disable all vprobes

vprobeListProbes         Path to vmx file     List probes

vprobeListGlobals        Path to vmx file     List global variables



GENERAL COMMANDS          PARAMETERS           DESCRIPTION
----------------         ----------           -----------
list                                          List all running VMs

upgradevm                Path to vmx file     Upgrade VM file format, virtual hw


installtools             Path to vmx file     Install Tools in Guest

register                 Path to vmx file     Register a VM

unregister               Path to vmx file     Unregister a VM

listRegisteredVM                              List registered VMs

clone                    Path to vmx file     Create a copy of the VM
                         Path to destination vmx file
                         full|linked
                         [Snapshot name]




Examples:


Starting a virtual machine with Workstation on a Windows host
   vmrun -T ws start "c:/my VMs/myVM.vmx"


Stopping a virtual machine with Server on a linux host
   vmrun -T server -h https://myHost.com/sdk -u hostUser -p hostPassword stop "[
storage1] vm/myVM.vmx"


Running a program in a virtual machine with Workstation on a Windows host with W
indows guest
   vmrun -T ws -gu guestUser -gp guestPassword runProgramInGuest "c:/my VMs/myVM
.vmx" "c:/Program Files/myProgram.exe"


Running a program in a virtual machine with Server on a linux host with linux gu
est
   vmrun -T server -h https://myHost.com/sdk -u hostUser -p hostPassword -gu gue
stUser -gp guestPassword runProgramInGuest "[storage1] vm/myVM.vmx" /usr/bin/X11
/xclock -display :0


Creating a snapshot of a virtual machine with Workstation on a Windows host
   vmrun -T ws snapshot "c:/my VMs/myVM.vmx" mySnapshot


Reverting to a snapshot with Workstation on a Windows host
   vmrun -T ws revertToSnapshot "c:/my VMs/myVM.vmx" mySnapshot


Deleting a snapshot with Workstation on a Windows host
   vmrun -T ws deleteSnapshot "c:/my VMs/myVM.vmx" mySnapshot

C:/Program Files/VMware/VMware VIX>

 

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

惹不起的程咬金

来都来了,不赏点银子么

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值