DedicatedHostManager

class SoftLayer.managers.DedicatedHostManager(client, ordering_manager=None)[source]

Manages SoftLayer Dedicated Hosts.

See product information here https://www.ibm.com/cloud/dedicated

Parameters:
__init__(client, ordering_manager=None)[source]

Methods

__init__(client[, ordering_manager])

cancel_guests(host_id)

Cancel all guests into the dedicated host immediately.

cancel_host(host_id)

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

get_create_options()

Returns valid options for ordering a dedicated host.

get_host(host_id, **kwargs)

Get details about a dedicated host.

get_router_options([datacenter, flavor])

Returns available backend routers for the dedicated host.

list_guests(host_id[, tags, cpus, memory, ...])

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

list_instances([tags, hostname, datacenter, ...])

Retrieve a list of all dedicated hosts on the account

place_order(hostname, domain, location, ...)

Places an order for a dedicated host.

resolve_ids(identifier)

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

verify_order(hostname, domain, location, ...)

Verifies an order for a dedicated host.

Attributes

resolvers

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, hostname=None, datacenter=None, order=None, owner=None)[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.