com.xensource.xenapi
Class Host

java.lang.Object
  extended by com.xensource.xenapi.Host

public class Host
extends Object

A physical host


Nested Class Summary
static class Host.Record
          Represents all the fields in a Host
 
Field Summary
protected  String ref
          The XenAPI reference to this object.
 
Method Summary
 void addToLogging(String key, String value)
          Add the given key-value pair to the logging field of the given host.
 void addToOtherConfig(String key, String value)
          Add the given key-value pair to the other_config field of the given host.
 void disable()
          Puts the host into a state in which no new VMs can be started.
 String dmesg()
          Get the host xen dmesg.
 String dmesgClear()
          Get the host xen dmesg, and clear the buffer.
 void enable()
          Puts the host into a state in which new VMs can be started.
static Set<Host> getAll()
          Return a list of all the hosts known to the system.
static Map<Host,Host.Record> getAllRecords()
          Get all the Host Records at once, in a single XML RPC call
 Long getAPIVersionMajor()
          Get the API_version/major field of the given host.
 Long getAPIVersionMinor()
          Get the API_version/minor field of the given host.
 String getAPIVersionVendor()
          Get the API_version/vendor field of the given host.
 Map<String,String> getAPIVersionVendorImplementation()
          Get the API_version/vendor_implementation field of the given host.
static Set<Host> getByNameLabel(String label)
          Get all the host instances with the given label.
static Host getByUuid(String uuid)
          Get a reference to the host instance with the specified UUID.
 Set<String> getCapabilities()
          Get the capabilities field of the given host.
 Map<String,String> getCpuConfiguration()
          Get the cpu_configuration field of the given host.
 SR getCrashDumpSr()
          Get the crash_dump_sr field of the given host.
 Boolean getEnabled()
          Get the enabled field of the given host.
 Set<HostCpu> getHostCPUs()
          Get the host_CPUs field of the given host.
protected static Host getInstFromRef(String ref)
           
 String getLog()
          Get the host's log file
 Map<String,String> getLogging()
          Get the logging field of the given host.
 HostMetrics getMetrics()
          Get the metrics field of the given host.
 String getNameDescription()
          Get the name/description field of the given host.
 String getNameLabel()
          Get the name/label field of the given host.
 Map<String,String> getOtherConfig()
          Get the other_config field of the given host.
 Set<PBD> getPBDs()
          Get the PBDs field of the given host.
 Set<PIF> getPIFs()
          Get the PIFs field of the given host.
 Host.Record getRecord()
          Get a record containing the current state of the given host.
 Set<VM> getResidentVMs()
          Get the resident_VMs field of the given host.
 String getSchedPolicy()
          Get the sched_policy field of the given host.
 Map<String,String> getSoftwareVersion()
          Get the software_version field of the given host.
 Set<String> getSupportedBootloaders()
          Get the supported_bootloaders field of the given host.
 SR getSuspendImageSr()
          Get the suspend_image_sr field of the given host.
 String getUuid()
          Get the uuid field of the given host.
static Set<String> listMethods()
          List all supported methods
 void reboot()
          Reboot the host.
 void removeFromLogging(String key)
          Remove the given key and its corresponding value from the logging field of the given host.
 void removeFromOtherConfig(String key)
          Remove the given key and its corresponding value from the other_config field of the given host.
 void sendDebugKeys(String keys)
          Inject the given string as debugging keys into Xen
 void setCrashDumpSr(SR crashDumpSr)
          Set the crash_dump_sr field of the given host.
 void setLogging(Map<String,String> logging)
          Set the logging field of the given host.
 void setNameDescription(String description)
          Set the name/description field of the given host.
 void setNameLabel(String label)
          Set the name/label field of the given host.
 void setOtherConfig(Map<String,String> otherConfig)
          Set the other_config field of the given host.
 void setSuspendImageSr(SR suspendImageSr)
          Set the suspend_image_sr field of the given host.
 void shutdown()
          Shutdown the host.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ref

protected final String ref
The XenAPI reference to this object.

Method Detail

getInstFromRef

protected static Host getInstFromRef(String ref)

getRecord

public Host.Record getRecord()
                      throws Types.BadServerResponse,
                             ConnectionHelper.NoConnectionOnThisThreadException,
                             XmlRpcException
Get a record containing the current state of the given host.

Returns:
all fields from the object
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getByUuid

public static Host getByUuid(String uuid)
                      throws Types.BadServerResponse,
                             ConnectionHelper.NoConnectionOnThisThreadException,
                             XmlRpcException
Get a reference to the host instance with the specified UUID.

Parameters:
uuid - UUID of object to return
Returns:
reference to the object
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getByNameLabel

public static Set<Host> getByNameLabel(String label)
                                throws Types.BadServerResponse,
                                       ConnectionHelper.NoConnectionOnThisThreadException,
                                       XmlRpcException
Get all the host instances with the given label.

Parameters:
label - label of object to return
Returns:
references to objects with matching names
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getUuid

public String getUuid()
               throws Types.BadServerResponse,
                      ConnectionHelper.NoConnectionOnThisThreadException,
                      XmlRpcException
Get the uuid field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getNameLabel

public String getNameLabel()
                    throws Types.BadServerResponse,
                           ConnectionHelper.NoConnectionOnThisThreadException,
                           XmlRpcException
Get the name/label field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getNameDescription

public String getNameDescription()
                          throws Types.BadServerResponse,
                                 ConnectionHelper.NoConnectionOnThisThreadException,
                                 XmlRpcException
Get the name/description field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getAPIVersionMajor

public Long getAPIVersionMajor()
                        throws Types.BadServerResponse,
                               ConnectionHelper.NoConnectionOnThisThreadException,
                               XmlRpcException
Get the API_version/major field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getAPIVersionMinor

public Long getAPIVersionMinor()
                        throws Types.BadServerResponse,
                               ConnectionHelper.NoConnectionOnThisThreadException,
                               XmlRpcException
Get the API_version/minor field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getAPIVersionVendor

public String getAPIVersionVendor()
                           throws Types.BadServerResponse,
                                  ConnectionHelper.NoConnectionOnThisThreadException,
                                  XmlRpcException
Get the API_version/vendor field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getAPIVersionVendorImplementation

public Map<String,String> getAPIVersionVendorImplementation()
                                                     throws Types.BadServerResponse,
                                                            ConnectionHelper.NoConnectionOnThisThreadException,
                                                            XmlRpcException
Get the API_version/vendor_implementation field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getEnabled

public Boolean getEnabled()
                   throws Types.BadServerResponse,
                          ConnectionHelper.NoConnectionOnThisThreadException,
                          XmlRpcException
Get the enabled field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getSoftwareVersion

public Map<String,String> getSoftwareVersion()
                                      throws Types.BadServerResponse,
                                             ConnectionHelper.NoConnectionOnThisThreadException,
                                             XmlRpcException
Get the software_version field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getOtherConfig

public Map<String,String> getOtherConfig()
                                  throws Types.BadServerResponse,
                                         ConnectionHelper.NoConnectionOnThisThreadException,
                                         XmlRpcException
Get the other_config field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getCapabilities

public Set<String> getCapabilities()
                            throws Types.BadServerResponse,
                                   ConnectionHelper.NoConnectionOnThisThreadException,
                                   XmlRpcException
Get the capabilities field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getCpuConfiguration

public Map<String,String> getCpuConfiguration()
                                       throws Types.BadServerResponse,
                                              ConnectionHelper.NoConnectionOnThisThreadException,
                                              XmlRpcException
Get the cpu_configuration field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getSchedPolicy

public String getSchedPolicy()
                      throws Types.BadServerResponse,
                             ConnectionHelper.NoConnectionOnThisThreadException,
                             XmlRpcException
Get the sched_policy field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getSupportedBootloaders

public Set<String> getSupportedBootloaders()
                                    throws Types.BadServerResponse,
                                           ConnectionHelper.NoConnectionOnThisThreadException,
                                           XmlRpcException
Get the supported_bootloaders field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getResidentVMs

public Set<VM> getResidentVMs()
                       throws Types.BadServerResponse,
                              ConnectionHelper.NoConnectionOnThisThreadException,
                              XmlRpcException
Get the resident_VMs field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getLogging

public Map<String,String> getLogging()
                              throws Types.BadServerResponse,
                                     ConnectionHelper.NoConnectionOnThisThreadException,
                                     XmlRpcException
Get the logging field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getPIFs

public Set<PIF> getPIFs()
                 throws Types.BadServerResponse,
                        ConnectionHelper.NoConnectionOnThisThreadException,
                        XmlRpcException
Get the PIFs field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getSuspendImageSr

public SR getSuspendImageSr()
                     throws Types.BadServerResponse,
                            ConnectionHelper.NoConnectionOnThisThreadException,
                            XmlRpcException
Get the suspend_image_sr field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getCrashDumpSr

public SR getCrashDumpSr()
                  throws Types.BadServerResponse,
                         ConnectionHelper.NoConnectionOnThisThreadException,
                         XmlRpcException
Get the crash_dump_sr field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getPBDs

public Set<PBD> getPBDs()
                 throws Types.BadServerResponse,
                        ConnectionHelper.NoConnectionOnThisThreadException,
                        XmlRpcException
Get the PBDs field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getHostCPUs

public Set<HostCpu> getHostCPUs()
                         throws Types.BadServerResponse,
                                ConnectionHelper.NoConnectionOnThisThreadException,
                                XmlRpcException
Get the host_CPUs field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getMetrics

public HostMetrics getMetrics()
                       throws Types.BadServerResponse,
                              ConnectionHelper.NoConnectionOnThisThreadException,
                              XmlRpcException
Get the metrics field of the given host.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

setNameLabel

public void setNameLabel(String label)
                  throws Types.BadServerResponse,
                         ConnectionHelper.NoConnectionOnThisThreadException,
                         XmlRpcException
Set the name/label field of the given host.

Parameters:
label - New value to set
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

setNameDescription

public void setNameDescription(String description)
                        throws Types.BadServerResponse,
                               ConnectionHelper.NoConnectionOnThisThreadException,
                               XmlRpcException
Set the name/description field of the given host.

Parameters:
description - New value to set
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

setOtherConfig

public void setOtherConfig(Map<String,String> otherConfig)
                    throws Types.BadServerResponse,
                           ConnectionHelper.NoConnectionOnThisThreadException,
                           XmlRpcException
Set the other_config field of the given host.

Parameters:
otherConfig - New value to set
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

addToOtherConfig

public void addToOtherConfig(String key,
                             String value)
                      throws Types.BadServerResponse,
                             ConnectionHelper.NoConnectionOnThisThreadException,
                             XmlRpcException
Add the given key-value pair to the other_config field of the given host.

Parameters:
key - Key to add
value - Value to add
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

removeFromOtherConfig

public void removeFromOtherConfig(String key)
                           throws Types.BadServerResponse,
                                  ConnectionHelper.NoConnectionOnThisThreadException,
                                  XmlRpcException
Remove the given key and its corresponding value from the other_config field of the given host. If the key is not in that Map, then do nothing.

Parameters:
key - Key to remove
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

setLogging

public void setLogging(Map<String,String> logging)
                throws Types.BadServerResponse,
                       ConnectionHelper.NoConnectionOnThisThreadException,
                       XmlRpcException
Set the logging field of the given host.

Parameters:
logging - New value to set
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

addToLogging

public void addToLogging(String key,
                         String value)
                  throws Types.BadServerResponse,
                         ConnectionHelper.NoConnectionOnThisThreadException,
                         XmlRpcException
Add the given key-value pair to the logging field of the given host.

Parameters:
key - Key to add
value - Value to add
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

removeFromLogging

public void removeFromLogging(String key)
                       throws Types.BadServerResponse,
                              ConnectionHelper.NoConnectionOnThisThreadException,
                              XmlRpcException
Remove the given key and its corresponding value from the logging field of the given host. If the key is not in that Map, then do nothing.

Parameters:
key - Key to remove
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

setSuspendImageSr

public void setSuspendImageSr(SR suspendImageSr)
                       throws Types.BadServerResponse,
                              ConnectionHelper.NoConnectionOnThisThreadException,
                              XmlRpcException
Set the suspend_image_sr field of the given host.

Parameters:
suspendImageSr - New value to set
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

setCrashDumpSr

public void setCrashDumpSr(SR crashDumpSr)
                    throws Types.BadServerResponse,
                           ConnectionHelper.NoConnectionOnThisThreadException,
                           XmlRpcException
Set the crash_dump_sr field of the given host.

Parameters:
crashDumpSr - New value to set
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

disable

public void disable()
             throws Types.BadServerResponse,
                    ConnectionHelper.NoConnectionOnThisThreadException,
                    XmlRpcException
Puts the host into a state in which no new VMs can be started. Currently active VMs on the host continue to execute.

Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

enable

public void enable()
            throws Types.BadServerResponse,
                   ConnectionHelper.NoConnectionOnThisThreadException,
                   XmlRpcException
Puts the host into a state in which new VMs can be started.

Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

shutdown

public void shutdown()
              throws Types.BadServerResponse,
                     ConnectionHelper.NoConnectionOnThisThreadException,
                     XmlRpcException
Shutdown the host. (This function can only be called if there are no currently running VMs on the host and it is disabled.)

Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

reboot

public void reboot()
            throws Types.BadServerResponse,
                   ConnectionHelper.NoConnectionOnThisThreadException,
                   XmlRpcException
Reboot the host. (This function can only be called if there are no currently running VMs on the host and it is disabled.)

Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

dmesg

public String dmesg()
             throws Types.BadServerResponse,
                    ConnectionHelper.NoConnectionOnThisThreadException,
                    XmlRpcException
Get the host xen dmesg.

Returns:
dmesg string
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

dmesgClear

public String dmesgClear()
                  throws Types.BadServerResponse,
                         ConnectionHelper.NoConnectionOnThisThreadException,
                         XmlRpcException
Get the host xen dmesg, and clear the buffer.

Returns:
dmesg string
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getLog

public String getLog()
              throws Types.BadServerResponse,
                     ConnectionHelper.NoConnectionOnThisThreadException,
                     XmlRpcException
Get the host's log file

Returns:
The contents of the host's primary log file
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

sendDebugKeys

public void sendDebugKeys(String keys)
                   throws Types.BadServerResponse,
                          ConnectionHelper.NoConnectionOnThisThreadException,
                          XmlRpcException
Inject the given string as debugging keys into Xen

Parameters:
keys - The keys to send
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

listMethods

public static Set<String> listMethods()
                               throws Types.BadServerResponse,
                                      ConnectionHelper.NoConnectionOnThisThreadException,
                                      XmlRpcException
List all supported methods

Returns:
The name of every supported method.
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getAll

public static Set<Host> getAll()
                        throws Types.BadServerResponse,
                               ConnectionHelper.NoConnectionOnThisThreadException,
                               XmlRpcException
Return a list of all the hosts known to the system.

Returns:
references to all objects
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getAllRecords

public static Map<Host,Host.Record> getAllRecords()
                                           throws Types.BadServerResponse,
                                                  ConnectionHelper.NoConnectionOnThisThreadException,
                                                  XmlRpcException
Get all the Host Records at once, in a single XML RPC call

Returns:
A map from Host to Host.Record
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException