Class VirtualServer
- java.lang.Object
-
- com.aoindustries.aoserv.client.AOServObject<K,T>
-
- com.aoindustries.aoserv.client.CachedObject<Integer,V>
-
- com.aoindustries.aoserv.client.CachedObjectIntegerKey<VirtualServer>
-
- com.aoindustries.aoserv.client.infrastructure.VirtualServer
-
- All Implemented Interfaces:
Streamable,StreamReadable,StreamWritable,Row,AOServReadable,AOServStreamable,AOServWritable,SingleTableObject<Integer,VirtualServer>
public final class VirtualServer extends CachedObjectIntegerKey<VirtualServer>
AVirtualServerconsumes physical resources within the virtualization layer.- Author:
- AO Industries, Inc.
-
-
Field Summary
Fields Modifier and Type Field Description static intBLOCKEDThe possible state flags for the virtual server.static intCRASHEDThe possible state flags for the virtual server.static intDESTROYEDThe possible state flags for the virtual server.static intDYINGThe possible state flags for the virtual server.static intPAUSEDThe possible state flags for the virtual server.static intRUNNINGThe possible state flags for the virtual server.static intSHUTDOWNThe possible state flags for the virtual server.-
Fields inherited from class com.aoindustries.aoserv.client.CachedObjectIntegerKey
pkey
-
Fields inherited from class com.aoindustries.aoserv.client.CachedObject
table
-
Fields inherited from class com.aoindustries.aoserv.client.AOServObject
USE_ARRAY_OF_DOMAIN, USE_SQL_DATA, USE_SQL_DATA_WRITE
-
-
Constructor Summary
Constructors Constructor Description VirtualServer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringcreate()Calls "xm create" on the current primary physical server.Stringdestroy()Calls "xm destroy" on the current primary physical server.protected ObjectgetColumnImpl(int i)HostgetHost()ArchitecturegetMinimumProcessorArchitecture()Gets the minimum processor architecture.intgetMinimumProcessorSpeed()Gets the minimum processor speed or-1for none.intgetMinimumProcessorSpeedTarget()Gets the minimum processor speed target or-1for none.ProcessorTypegetMinimumProcessorType()Gets the minimum processor type ornullif none.PhysicalServergetPrimaryPhysicalServer()Gets the physical server that is currently the primary node for this virtual server.intgetPrimaryRam()intgetPrimaryRamTarget()shortgetProcessorCores()Gets the processor cores.shortgetProcessorCoresTarget()shortgetProcessorWeight()Gets the processor weight.shortgetProcessorWeightTarget()booleangetRequiresHvm()Gets if this virtual requires full hardware virtualization support.PhysicalServergetSecondaryPhysicalServer()Gets the physical server that is currently the secondary node for this virtual server.intgetSecondaryRam()Gets the secondary RAM allocation or-1if no secondary required.intgetSecondaryRamTarget()intgetStatus()Calls "xm list" to get the current state on the current primary physical server.static StringgetStatusList(int status)Gets a human readable, but constant and not translated, comma-separated list of current status flags.Table.TableIDgetTableID()VirtualDiskgetVirtualDisk(String device)Gets the virtual disk for this virtual server and the provided device name.List<VirtualDisk>getVirtualDisks()StringgetVncPassword()Gets the VNC password for this virtual server ornullif VNC is disabled.voidinit(ResultSet result)Initializes this object from the raw database contents.booleanisPrimaryPhysicalServerLocked()Gets if the primary server is locked (manually set).booleanisSecondaryPhysicalServerLocked()Gets if the secondary server is locked (manually set).Stringpause()Calls "xm pause" on the current primary physical server.voidread(StreamableInput in, AoservProtocol.Version protocolVersion)Stringreboot()Calls "xm reboot" on the current primary physical server.Server.DaemonAccessrequestVncConsoleAccess()Stringshutdown()Calls "xm shutdown" on the current primary physical server.StringtoStringImpl()AOServObject.toString()implementation that is allowed to throw exceptions.Stringunpause()Calls "xm unpause" on the current primary physical server.voidwrite(StreamableOutput out, AoservProtocol.Version protocolVersion)-
Methods inherited from class com.aoindustries.aoserv.client.CachedObjectIntegerKey
equals, getKey, getPkey, hashCode
-
Methods inherited from class com.aoindustries.aoserv.client.CachedObject
getTable, setTable
-
Methods inherited from class com.aoindustries.aoserv.client.AOServObject
compare, compare, compare, compare, compareIgnoreCaseConsistentWithEquals, compareTo, compareTo, compareTo, getAccountingCode, getColumn, getColumns, getColumns, getDomainLabel, getDomainLabels, getDomainName, getDto, getEmail, getGecos, getGroupId, getHashedKey, getHashedPassword, getHostname, getInetAddress, getLinuxID, getLinuxUserName, getMacAddress, getMySQLDatabaseName, getMySQLServerName, getMysqlUserName, getPort, getPostgresDatabaseName, getPostgresServerName, getPostgresUserId, getTableSchema, getTimeMillis, getTimeMillis, getUnixPath, getUserId, read, toString, write
-
-
-
-
Field Detail
-
RUNNING
public static final int RUNNING
The possible state flags for the virtual server. At least one of these flags will be enable in the result. Any number of them may be present concurrently, as returned by "xm list".- See Also:
- Constant Field Values
-
BLOCKED
public static final int BLOCKED
The possible state flags for the virtual server. At least one of these flags will be enable in the result. Any number of them may be present concurrently, as returned by "xm list".- See Also:
- Constant Field Values
-
PAUSED
public static final int PAUSED
The possible state flags for the virtual server. At least one of these flags will be enable in the result. Any number of them may be present concurrently, as returned by "xm list".- See Also:
- Constant Field Values
-
SHUTDOWN
public static final int SHUTDOWN
The possible state flags for the virtual server. At least one of these flags will be enable in the result. Any number of them may be present concurrently, as returned by "xm list".- See Also:
- Constant Field Values
-
CRASHED
public static final int CRASHED
The possible state flags for the virtual server. At least one of these flags will be enable in the result. Any number of them may be present concurrently, as returned by "xm list".- See Also:
- Constant Field Values
-
DYING
public static final int DYING
The possible state flags for the virtual server. At least one of these flags will be enable in the result. Any number of them may be present concurrently, as returned by "xm list".- See Also:
- Constant Field Values
-
DESTROYED
public static final int DESTROYED
The possible state flags for the virtual server. At least one of these flags will be enable in the result. Any number of them may be present concurrently, as returned by "xm list".- See Also:
- Constant Field Values
-
-
Method Detail
-
getColumnImpl
protected Object getColumnImpl(int i)
- Specified by:
getColumnImplin classAOServObject<Integer,VirtualServer>
-
getHost
public Host getHost() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getPrimaryRam
public int getPrimaryRam()
-
getPrimaryRamTarget
public int getPrimaryRamTarget()
-
getSecondaryRam
public int getSecondaryRam()
Gets the secondary RAM allocation or-1if no secondary required. When RAM allocation is-1, the VM will not be able to run on the secondary server - it only provides block device replication. Therefore, other things like processor type, speed, architecture, processor cores and processor weights will also not be allocated.
-
getSecondaryRamTarget
public int getSecondaryRamTarget()
-
getMinimumProcessorType
public ProcessorType getMinimumProcessorType() throws IOException, SQLException
Gets the minimum processor type ornullif none.- Throws:
IOExceptionSQLException
-
getMinimumProcessorArchitecture
public Architecture getMinimumProcessorArchitecture() throws IOException, SQLException
Gets the minimum processor architecture.- Throws:
IOExceptionSQLException
-
getMinimumProcessorSpeed
public int getMinimumProcessorSpeed()
Gets the minimum processor speed or-1for none.
-
getMinimumProcessorSpeedTarget
public int getMinimumProcessorSpeedTarget()
Gets the minimum processor speed target or-1for none.
-
getProcessorCores
public short getProcessorCores()
Gets the processor cores.
-
getProcessorCoresTarget
public short getProcessorCoresTarget()
-
getProcessorWeight
public short getProcessorWeight()
Gets the processor weight.
-
getProcessorWeightTarget
public short getProcessorWeightTarget()
-
isPrimaryPhysicalServerLocked
public boolean isPrimaryPhysicalServerLocked()
Gets if the primary server is locked (manually set).
-
isSecondaryPhysicalServerLocked
public boolean isSecondaryPhysicalServerLocked()
Gets if the secondary server is locked (manually set).
-
getRequiresHvm
public boolean getRequiresHvm()
Gets if this virtual requires full hardware virtualization support.
-
getVncPassword
public String getVncPassword()
Gets the VNC password for this virtual server ornullif VNC is disabled. The password must be unique between virtual servers because the password is used behind the scenes to resolve the actual IP and port for VNC proxying.
-
getTableID
public Table.TableID getTableID()
- Specified by:
getTableIDin classAOServObject<Integer,VirtualServer>
-
init
public void init(ResultSet result) throws SQLException
Description copied from class:AOServObjectInitializes this object from the raw database contents.- Specified by:
initin classAOServObject<Integer,VirtualServer>- Parameters:
result- theResultSetcontaining the row to copy into this object- Throws:
SQLException
-
read
public void read(StreamableInput in, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
readin interfaceAOServReadable- Specified by:
readin interfaceAOServStreamable- Specified by:
readin classAOServObject<Integer,VirtualServer>- Throws:
IOException
-
toStringImpl
public String toStringImpl() throws SQLException, IOException
Description copied from class:AOServObjectAOServObject.toString()implementation that is allowed to throw exceptions.Implementation Note:
This default implementation callsAOServObject.toString()on the key (fromAOServObject.getKey()). When the key isnull, uses the default implementation fromObject.toString().- Overrides:
toStringImplin classCachedObjectIntegerKey<VirtualServer>- Throws:
SQLExceptionIOException
-
write
public void write(StreamableOutput out, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
writein interfaceAOServStreamable- Specified by:
writein interfaceAOServWritable- Specified by:
writein classAOServObject<Integer,VirtualServer>- Throws:
IOException
-
getVirtualDisks
public List<VirtualDisk> getVirtualDisks() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getVirtualDisk
public VirtualDisk getVirtualDisk(String device) throws IOException, SQLException
Gets the virtual disk for this virtual server and the provided device name.- Parameters:
device- should bexvd[a-z]- Returns:
- the disk or
nullif not found - Throws:
IOExceptionSQLException
-
requestVncConsoleAccess
public Server.DaemonAccess requestVncConsoleAccess() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
create
public String create() throws IOException, SQLException
Calls "xm create" on the current primary physical server.- Returns:
- the output of the command.
- Throws:
IOException- any non-zero exit code will result in an exception with the standard error in the exception message.SQLException
-
reboot
public String reboot() throws IOException, SQLException
Calls "xm reboot" on the current primary physical server.- Returns:
- the output of the command.
- Throws:
IOException- any non-zero exit code will result in an exception with the standard error in the exception message.SQLException
-
shutdown
public String shutdown() throws IOException, SQLException
Calls "xm shutdown" on the current primary physical server.- Returns:
- the output of the command.
- Throws:
IOException- any non-zero exit code will result in an exception with the standard error in the exception message.SQLException
-
destroy
public String destroy() throws IOException, SQLException
Calls "xm destroy" on the current primary physical server.- Returns:
- the output of the command.
- Throws:
IOException- any non-zero exit code will result in an exception with the standard error in the exception message.SQLException
-
pause
public String pause() throws IOException, SQLException
Calls "xm pause" on the current primary physical server.- Returns:
- the output of the command.
- Throws:
IOException- any non-zero exit code will result in an exception with the standard error in the exception message.SQLException
-
unpause
public String unpause() throws IOException, SQLException
Calls "xm unpause" on the current primary physical server.- Returns:
- the output of the command.
- Throws:
IOException- any non-zero exit code will result in an exception with the standard error in the exception message.SQLException
-
getStatusList
public static String getStatusList(int status)
Gets a human readable, but constant and not translated, comma-separated list of current status flags.
-
getStatus
public int getStatus() throws IOException, SQLExceptionCalls "xm list" to get the current state on the current primary physical server.- Returns:
- the OR of all state bits.
- Throws:
IOException- any non-zero exit code will result in an exception with the standard error in the exception message.SQLException
-
getPrimaryPhysicalServer
public PhysicalServer getPrimaryPhysicalServer() throws IOException, SQLException
Gets the physical server that is currently the primary node for this virtual server.- Throws:
IOExceptionSQLException
-
getSecondaryPhysicalServer
public PhysicalServer getSecondaryPhysicalServer() throws IOException, SQLException
Gets the physical server that is currently the secondary node for this virtual server.- Throws:
IOExceptionSQLException
-
-