OpenNebula
Cloud API

org.opennebula.client.host
Class Host

java.lang.Object
  extended by org.opennebula.client.PoolElement
      extended by org.opennebula.client.host.Host

public class Host
extends PoolElement

This class represents an OpenNebula host. It also offers static XML-RPC call wrappers.


Field Summary
 
Fields inherited from class org.opennebula.client.PoolElement
client, id, xml, xpath
 
Constructor Summary
  Host(int id, Client client)
          Creates a new Host representation.
protected Host(org.w3c.dom.Node xmlElement, Client client)
           
 
Method Summary
static OneResponse allocate(Client client, java.lang.String hostname, java.lang.String im, java.lang.String vmm, java.lang.String tm)
          Allocates a new host in OpenNebula
 OneResponse delete()
          Deletes the host from OpenNebula.
static OneResponse delete(Client client, int id)
          Deletes a host from OpenNebula.
 OneResponse enable(boolean enable)
          Enables or disables the host.
static OneResponse enable(Client client, int id, boolean enable)
          Enables or disables a given host.
 OneResponse info()
          Loads the xml representation of the host.
static OneResponse info(Client client, int id)
          Retrieves the information of the given host.
 java.lang.String shortStateStr()
          Returns the short length string state of the Host.
 java.lang.String stateStr()
          Returns the state of the Host.
 
Methods inherited from class org.opennebula.client.PoolElement
getId, getName, processInfo, state, xpath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Host

public Host(int id,
            Client client)
Creates a new Host representation.

Parameters:
id - The host id (hid) of the machine.
client - XML-RPC Client.

Host

protected Host(org.w3c.dom.Node xmlElement,
               Client client)
See Also:
PoolElement
Method Detail

allocate

public static OneResponse allocate(Client client,
                                   java.lang.String hostname,
                                   java.lang.String im,
                                   java.lang.String vmm,
                                   java.lang.String tm)
Allocates a new host in OpenNebula

Parameters:
client - XML-RPC Client.
hostname - Hostname of the machine we want to add
im - The name of the information manager (im_mad_name), this values are taken from the oned.conf with the tag name IM_MAD (name)
vmm - The name of the virtual machine manager mad name (vmm_mad_name), this values are taken from the oned.conf with the tag name VM_MAD (name)
tm - The transfer manager mad name to be used with this host
Returns:
If successful the message contains the associated id generated for this host

info

public static OneResponse info(Client client,
                               int id)
Retrieves the information of the given host.

Parameters:
client - XML-RPC Client.
id - The host id (hid) of the target machine.
Returns:
If successful the message contains the string with the information returned by OpenNebula.

delete

public static OneResponse delete(Client client,
                                 int id)
Deletes a host from OpenNebula.

Parameters:
client - XML-RPC Client.
id - The host id (hid) of the target machine.
Returns:
A encapsulated response.

enable

public static OneResponse enable(Client client,
                                 int id,
                                 boolean enable)
Enables or disables a given host.

Parameters:
client - XML-RPC Client.
id - The host id (hid) of the target machine.
enable - If set true OpenNebula will enable the target host, if set false it will disable it.
Returns:
A encapsulated response.

info

public OneResponse info()
Loads the xml representation of the host. The info is also stored internally.

See Also:
info(Client, int)

delete

public OneResponse delete()
Deletes the host from OpenNebula.

See Also:
delete(Client, int)

enable

public OneResponse enable(boolean enable)
Enables or disables the host.

See Also:
enable(Client, int, boolean)

stateStr

public java.lang.String stateStr()
Returns the state of the Host.
The method info() must be called before.

Returns:
The state of the Host.

shortStateStr

public java.lang.String shortStateStr()
Returns the short length string state of the Host.
The method info() must be called before.

Returns:
The short length string state of the Host.

OpenNebula
Cloud API

Visit OpenNebula.org
Copyright 2002-2010 © OpenNebula Project Leads (OpenNebula.org).