|
Agaetis VMWare API 1.0.0.8 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.agaetis.vmware.VixVM
public class VixVM
VixVM is instantiated when a VMHost runs an "open" method. VixVM is the wrapper for a Virtual Machine that includes every methods to power it on, off, suspend it or revert it to the last snapshot.
| Field Summary | |
|---|---|
private int |
handle
|
(package private) boolean |
loggedIn
|
(package private) VixLibrary.VixLibraryInterface |
vLibraryInterfaceInstance
|
private String |
vmxFilePathName
|
| Constructor Summary | |
|---|---|
VixVM()
|
|
| Method Summary | |
|---|---|
void |
copyFileFromGuestToHost(String guestPathName,
String hostPathName)
copy a file from guest to host file system OS |
void |
copyFileFromHostToGuest(String hostPathName,
String guestPathName)
copy a file from host to the virtual machine guest OS |
void |
createSnapshot(String name,
String description)
create a snapshot on the server with the current running machine. |
void |
deleteDirectoryInGuest(String guestPathName)
This function deletes a directory in the guest operating system. |
void |
deleteFileInGuest(String guestPathName)
This function deletes a file in the guest operating system. |
boolean |
directoryExistsInGuest(String guestPathName)
This function tests the existence of a directory in the guest operating system. |
boolean |
fileExistsInGuest(String guestPathName)
This function tests the existence of a file in the guest operating system. |
int |
getHandle()
|
int |
getPowerState()
It allows to know the state of the current vm. |
private int |
getRootSnapshot(int index)
|
String |
getVmxFilePathName()
|
boolean |
isOff()
To know if the vm is off. |
boolean |
isOn()
To know if the vm is running with a power state matching with Vix.PowerState.POWERED_ON |
boolean |
isSuspended()
To know if the vm is in a suspended mode. |
void |
loginInGuest(String username,
String password)
Allows to login on the guest system. |
void |
loginInGuest(String username,
String password,
boolean interactive)
Allows to login on the guest system. |
void |
logoutFromGuest()
Logout from the previous login for this VM. |
private void |
power(boolean p)
Private method for power actions. |
void |
powerOff()
Power off the VM. |
void |
powerOn()
Power on the VM. |
void |
revertToSnapshot(int index)
Revert the vm to the snapshot specified with index. |
ExitProperties |
runProgramInGuest(String program,
String args,
int flag)
Run a command in the virtual machine. |
ExitProperties |
runScriptInGuest(String interpreter,
String scriptText,
int flag)
Allow to run a script in an interpreter installed on the guest machine. |
void |
setHandle(int handle)
|
void |
setVmxFilePathName(String vmxFilePathName)
|
void |
shutdownUnixSystem(String login,
String password,
String shutdownOptions)
If the guest system is a linux, it shutdowns the machine. |
void |
suspend()
Put the virtual machine in a suspended mode. |
void |
unpause()
Unpause the machine whe it was in a paused state. |
void |
waitForToolsInGuest(int timeoutInSeconds)
waitForToolsInGuest wait for VMWare tools to be launched. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private String vmxFilePathName
private int handle
boolean loggedIn
VixLibrary.VixLibraryInterface vLibraryInterfaceInstance
| Constructor Detail |
|---|
public VixVM()
| Method Detail |
|---|
public void copyFileFromGuestToHost(String guestPathName,
String hostPathName)
guestPathName - The path name of a file on the guest file systemhostPathName - The path name of a file on the host file system
public void copyFileFromHostToGuest(String hostPathName,
String guestPathName)
hostPathName - The path name of a file on the host file systemguestPathName - The path name of a file on the guest file system
public void createSnapshot(String name,
String description)
name - unique name for the snapshotdescription - description of the snapshotpublic void deleteDirectoryInGuest(String guestPathName)
guestPathName - the path name of the directory to delete in the guest
operating system.public void deleteFileInGuest(String guestPathName)
guestPathName - the path name of the file to delete in the guest operating
system.public boolean directoryExistsInGuest(String guestPathName)
guestPathName - The path to the directory to be tested.
public boolean fileExistsInGuest(String guestPathName)
guestPathName - The path to the file to be tested.
public int getHandle()
public int getPowerState()
throws VMWareRuntimeException
com.agaetis.exceptions.VMWareRuntimeException
VMWareRuntimeExceptionVix.PowerStateprivate int getRootSnapshot(int index)
public String getVmxFilePathName()
public boolean isOff()
public boolean isOn()
public boolean isSuspended()
public void loginInGuest(String username,
String password)
throws VMWareRuntimeException
loginInGuest(String, String, boolean)
username - the username login in the guest system.password - the password used for this login
com.agaetis.exceptions.VMWareRuntimeException
VMWareRuntimeException
public void loginInGuest(String username,
String password,
boolean interactive)
throws VMWareRuntimeException
username - the username login in the guest system.password - the password used for this logininteractive - define if the option for the LoginInGuest should be 0 (false)
or VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT (true).
com.agaetis.exceptions.VMWareRuntimeException
VMWareRuntimeException
public void logoutFromGuest()
throws VMWareRuntimeException
com.agaetis.exceptions.VMWareRuntimeException
VMWareRuntimeException
private void power(boolean p)
throws VMWareRuntimeException
p - a boolean that indicated if it should power on or power off.
com.agaetis.exceptions.VMWareRuntimeException
VMWareRuntimeException
public void powerOff()
throws VMWareRuntimeException
com.agaetis.exceptions.VMWareRuntimeException
VMWareRuntimeExceptionshutdownUnixSystem(java.lang.String, java.lang.String, java.lang.String)
public void powerOn()
throws VMWareRuntimeException
com.agaetis.exceptions.VMWareRuntimeException
VMWareRuntimeException
public void revertToSnapshot(int index)
throws VMWareRuntimeException
index - index of the snapshot used to switched to
VMWareRuntimeException
public ExitProperties runProgramInGuest(String program,
String args,
int flag)
throws VMWareRuntimeException
loginInGuest(String username, String password)
program - program path to run. e.g : "/sbin/shutdown"args - arguments for the program to launch. e.g : "-h now"flag - for some guest it's possible to tell with this flag to open
the program in a window. The guest need to be in a gui
environment. usually Vix.RunProgram.RETURN_IMMEDIATELY is
used.
ExitProperties#
com.agaetis.exceptions.VMWareRuntimeException
VMWareRuntimeExceptionVix.RunProgram
public ExitProperties runScriptInGuest(String interpreter,
String scriptText,
int flag)
throws VMWareRuntimeException
loginInGuest(String, String)
interpreter - interpreter path to run the script with. If it is cmd.exe then
put null instead. Otherwise it would launch cmd.exe and not
the script itself.scriptText - script contentflag - for some guest it's possible to tell with this flag to open
the program in a window. The guest need to be in a gui
environment. usually Vix.RunProgram.RETURN_IMMEDIATELY is
used.
ExitProperties
VMWareRuntimeExceptionpublic void setHandle(int handle)
public void setVmxFilePathName(String vmxFilePathName)
public void shutdownUnixSystem(String login,
String password,
String shutdownOptions)
throws VMWareRuntimeException
loginInGuest(java.lang.String, java.lang.String) and runProgramInGuest(java.lang.String, java.lang.String, int) combined. You just
have to provide login and password used by the loginInGuest method, and
shutdownOptions string. It uses the shutdown command of unix system with
the -h options which says to halt the machine. Usually you use 'now'
after the options of the shutdown command as shutdownOptions. but +1
(wait 1 minute before to proceed with the shutting down).
myVM.shutdownUnixSystem("stiger", "1234", "+1");
This example will shutdown the vm through the unix command. It will wait
1 minute before stopping every process and before halting the machine.
login - the username login in the guest system.password - the password used for this login.shutdownOptions - options like 'now' or '+1' to pass to the unix command
shutdown.
com.agaetis.exceptions.VMWareRuntimeException
VMWareRuntimeException
public void suspend()
throws VMWareRuntimeException
powerOn() method on the suspended vm.
com.agaetis.exceptions.VMWareRuntimeException
VMWareRuntimeException
public void unpause()
throws VMWareRuntimeException
com.agaetis.exceptions.VMWareRuntimeException
VMWareRuntimeException
public void waitForToolsInGuest(int timeoutInSeconds)
throws VMWareRuntimeException
timeoutInSeconds - Timeout in second.
com.agaetis.exceptions.VMWareRuntimeException
VMWareRuntimeException
|
Agaetis VMWare API 1.0.0.8 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||