The nova.api.openstack.compute.hosts Module

The hosts admin extension.

class HostController

Bases: nova.api.openstack.wsgi.Controller

The Hosts API controller for the OpenStack API.

index(*args, **kwargs)

Returns a dict in the format

{‘hosts’: [{‘host_name’: ‘some.host.name’,
‘service’: ‘cells’,
‘zone’: ‘internal’},
{‘host_name’: ‘some.other.host.name’,
‘service’: ‘cells’,
‘zone’: ‘internal’},
{‘host_name’: ‘some.celly.host.name’,
‘service’: ‘cells’,
‘zone’: ‘internal’},
{‘host_name’: ‘console1.host.com’,
‘service’: ‘consoleauth’,
‘zone’: ‘internal’},
{‘host_name’: ‘network1.host.com’,
‘service’: ‘network’,
‘zone’: ‘internal’},
{‘host_name’: ‘netwwork2.host.com’,
‘service’: ‘network’,
‘zone’: ‘internal’},
{‘host_name’: ‘compute1.host.com’,
‘service’: ‘compute’,
‘zone’: ‘nova’},
{‘host_name’: ‘compute2.host.com’,
‘service’: ‘compute’,
‘zone’: ‘nova’},
{‘host_name’: ‘sched1.host.com’,
‘service’: ‘scheduler’,
‘zone’: ‘internal’},
{‘host_name’: ‘sched2.host.com’,
‘service’: ‘scheduler’,
‘zone’: ‘internal’},
{‘host_name’: ‘vol1.host.com’,
‘service’: ‘volume’,
‘zone’: ‘internal’}]}
reboot(*args, **kwargs)
show(*args, **kwargs)

Shows the physical/usage resource given by hosts.

Parameters:id – hostname
Returns:expected to use HostShowTemplate. ex.:
{'host': {'resource':D},..}
D: {'host': 'hostname','project': 'admin',
    'cpu': 1, 'memory_mb': 2048, 'disk_gb': 30}
shutdown(*args, **kwargs)
startup(*args, **kwargs)
update(*args, **kwargs)

Return booleanized version of body dict.

Parameters:
  • req (Request) – The request object (containing ‘nova-context’ env var).
  • id (str) – The host name.
  • body (dict) – example format {‘host’: {‘status’: ‘enable’, ‘maintenance_mode’: ‘enable’}}
Returns:

Same dict as body but ‘enable’ strings for ‘status’ and ‘maintenance_mode’ are converted into True, else False.

Return type:

dict

wsgi_actions = {}
wsgi_extensions = []
class Hosts(extension_info)

Bases: nova.api.openstack.extensions.V21APIExtensionBase

Admin-only host administration.

alias = 'os-hosts'
get_controller_extensions()
get_resources()
name = 'Hosts'
version = 1

Previous topic

The nova.api.openstack.compute.hide_server_addresses Module

Next topic

The nova.api.openstack.compute.hypervisors Module

Project Source

This Page