SoftLayer.dedicatedhost

DH Manager/helpers

license:MIT, see License for more details.
class SoftLayer.managers.dedicated_host.DedicatedHostManager(client, ordering_manager=None)[source]

Manages SoftLayer Dedicated Hosts.

See product information here https://www.ibm.com/cloud/dedicated
Parameters:
  • client (SoftLayer.API.BaseClient) – the client instance
  • ordering_manager (SoftLayer.managers.OrderingManager) – an optional manager to handle ordering. If none is provided, one will be auto initialized.
cancel_guests(host_id)[source]

Cancel all guests into the dedicated host immediately.

To cancel an specified guest use the method VSManager.cancel_instance()

Parameters:host_id – The ID of the dedicated host.
Returns:The id, fqdn and status of all guests into a dictionary. The status could be ‘Cancelled’ or an exception message, The dictionary is empty if there isn’t any guest in the dedicated host.
Example::
# Cancel guests of dedicated host id 12345 result = mgr.cancel_guests(12345)
cancel_host(host_id)[source]

Cancel a dedicated host immediately, it fails if there are still guests in the host.

Parameters:host_id – The ID of the dedicated host to be cancelled.
Returns:True on success or an exception
Example::
# Cancels dedicated host id 12345 result = mgr.cancel_host(12345)
get_create_options()[source]

Returns valid options for ordering a dedicated host.

get_host(host_id, **kwargs)[source]

Get details about a dedicated host.

:param integer : the host ID :returns: A dictionary containing host information.

Example:

# Print out host ID 12345.
dh = mgr.get_host(12345)
print dh

# Print out only name and backendRouter for instance 12345
object_mask = "mask[name,backendRouter[id]]"
dh = mgr.get_host(12345, mask=mask)
print dh
get_router_options(datacenter=None, flavor=None)[source]

Returns available backend routers for the dedicated host.

list_guests(host_id, tags=None, cpus=None, memory=None, hostname=None, domain=None, local_disk=None, nic_speed=None, public_ip=None, private_ip=None, **kwargs)[source]

Retrieve a list of all virtual servers on the dedicated host.

Example:

# Print out a list of instances with 4 cpu cores in the host id 12345.

for vsi in mgr.list_guests(host_id=12345, cpus=4):
   print vsi['fullyQualifiedDomainName'], vsi['primaryIpAddress']

# Using a custom object-mask. Will get ONLY what is specified
object_mask = "mask[hostname,monitoringRobot[robotStatus]]"
for vsi in mgr.list_guests(mask=object_mask,cpus=4):
    print vsi
Parameters:
  • host_id (integer) – the identifier of dedicated host
  • tags (list) – filter based on list of tags
  • cpus (integer) – filter based on number of CPUS
  • memory (integer) – filter based on amount of memory
  • hostname (string) – filter based on hostname
  • domain (string) – filter based on domain
  • local_disk (string) – filter based on local_disk
  • nic_speed (integer) – filter based on network speed (in MBPS)
  • public_ip (string) – filter based on public ip address
  • private_ip (string) – filter based on private ip address
  • **kwargs (dict) – response-level options (mask, limit, etc.)
Returns:

Returns a list of dictionaries representing the matching virtual servers

list_instances(tags=None, cpus=None, memory=None, hostname=None, disk=None, datacenter=None, **kwargs)[source]

Retrieve a list of all dedicated hosts on the account

Parameters:
  • tags (list) – filter based on list of tags
  • cpus (integer) – filter based on number of CPUS
  • memory (integer) – filter based on amount of memory
  • hostname (string) – filter based on hostname
  • disk (string) – filter based on disk
  • datacenter (string) – filter based on datacenter
  • **kwargs (dict) – response-level options (mask, limit, etc.)
Returns:

Returns a list of dictionaries representing the matching dedicated host.

place_order(hostname, domain, location, flavor, hourly, router=None)[source]

Places an order for a dedicated host.

See get_create_options() for valid arguments.

Parameters:
  • hostname (string) – server hostname
  • domain (string) – server domain name
  • location (string) – location (datacenter) name
  • hourly (boolean) – True if using hourly pricing (default). False for monthly.
  • router (int) – an optional value for selecting a backend router
resolve_ids(identifier)

Takes a string and tries to resolve to a list of matching ids.

What exactly ‘identifier’ can be depends on the resolvers

Parameters:identifier (string) – identifying string
Returns list:
verify_order(hostname, domain, location, hourly, flavor, router=None)[source]

Verifies an order for a dedicated host.

See place_order() for a list of available options.