Add description for vendor passthru methods

This adds descriptions to the vendor passthru methods. Previously the
descriptions were not present.

Change-Id: I1257b86a21987f44f36399b79eb22af0766db446
Closes-Bug: #1618179
This commit is contained in:
Annie Lezil 2016-09-14 22:37:20 +00:00
parent 5603a215b7
commit a04aeca944
6 changed files with 69 additions and 13 deletions

View File

@ -709,7 +709,11 @@ class BaseAgentVendor(AgentDeployMixin, base.VendorInterface):
% version) % version)
@METRICS.timer('BaseAgentVendor.heartbeat') @METRICS.timer('BaseAgentVendor.heartbeat')
@base.passthru(['POST']) @base.passthru(['POST'],
description=_("Used by ramdisk agent to check in with the "
"ironic-conductor service. Required argument:"
" 'agent_url' - the API URL of the agent, in "
"the form http://<agent_host>:<agent_port>."))
@task_manager.require_exclusive_lock @task_manager.require_exclusive_lock
def heartbeat(self, task, **kwargs): def heartbeat(self, task, **kwargs):
"""Method for agent to periodically check in. """Method for agent to periodically check in.
@ -733,7 +737,12 @@ class BaseAgentVendor(AgentDeployMixin, base.VendorInterface):
super(BaseAgentVendor, self).heartbeat(task, callback_url) super(BaseAgentVendor, self).heartbeat(task, callback_url)
@METRICS.timer('BaseAgentVendor.lookup') @METRICS.timer('BaseAgentVendor.lookup')
@base.driver_passthru(['POST'], async=False) @base.driver_passthru(['POST'], async=False,
description=_("This should only be called by a "
"ramdisk agent, the first time the "
"agent checks in. It finds the Node "
"associated with the ramdisk and "
"returns the Node object."))
def lookup(self, context, **kwargs): def lookup(self, context, **kwargs):
"""Find a matching node for the agent. """Find a matching node for the agent.

View File

@ -15,6 +15,7 @@
DRAC vendor-passthru interface DRAC vendor-passthru interface
""" """
from ironic.common.i18n import _
from ironic.conductor import task_manager from ironic.conductor import task_manager
from ironic.drivers import base from ironic.drivers import base
from ironic.drivers.modules.drac import bios as drac_bios from ironic.drivers.modules.drac import bios as drac_bios
@ -42,7 +43,9 @@ class DracVendorPassthru(base.VendorInterface):
""" """
return drac_common.parse_driver_info(task.node) return drac_common.parse_driver_info(task.node)
@base.passthru(['GET'], async=False) @base.passthru(['GET'], async=False,
description=_("Returns a dictionary containing the BIOS "
"settings from a node."))
def get_bios_config(self, task, **kwargs): def get_bios_config(self, task, **kwargs):
"""Get the BIOS configuration. """Get the BIOS configuration.
@ -61,7 +64,14 @@ class DracVendorPassthru(base.VendorInterface):
return bios_attrs return bios_attrs
@base.passthru(['POST'], async=False) @base.passthru(['POST'], async=False,
description=_("Change the BIOS configuration on a node. "
"Required argument : a dictionary of "
"{'AttributeName': 'NewValue'}. Returns "
"a dictionary containing the "
"'commit_required' key with a Boolean value "
"indicating whether commit_bios_config() "
"needs to be called to make the changes."))
@task_manager.require_exclusive_lock @task_manager.require_exclusive_lock
def set_bios_config(self, task, **kwargs): def set_bios_config(self, task, **kwargs):
"""Change BIOS settings. """Change BIOS settings.
@ -77,7 +87,17 @@ class DracVendorPassthru(base.VendorInterface):
""" """
return drac_bios.set_config(task, **kwargs) return drac_bios.set_config(task, **kwargs)
@base.passthru(['POST'], async=False) @base.passthru(['POST'], async=False,
description=_("Commit a BIOS configuration job submitted "
"through set_bios_config(). Required "
"argument: 'reboot' - indicates whether a "
"reboot job should be automatically created "
"with the config job. Returns a dictionary "
"containing the 'job_id' key with the ID of "
"the newly created config job, and the "
"'reboot_required' key indicating whether "
"the node needs to be rebooted to start the "
"config job."))
@task_manager.require_exclusive_lock @task_manager.require_exclusive_lock
def commit_bios_config(self, task, reboot=False, **kwargs): def commit_bios_config(self, task, reboot=False, **kwargs):
"""Commit a BIOS configuration job. """Commit a BIOS configuration job.
@ -98,7 +118,9 @@ class DracVendorPassthru(base.VendorInterface):
job_id = drac_bios.commit_config(task, reboot=reboot) job_id = drac_bios.commit_config(task, reboot=reboot)
return {'job_id': job_id, 'reboot_required': not reboot} return {'job_id': job_id, 'reboot_required': not reboot}
@base.passthru(['DELETE'], async=False) @base.passthru(['DELETE'], async=False,
description=_("Abandon a BIOS configuration job previously "
"submitted through set_bios_config()."))
@task_manager.require_exclusive_lock @task_manager.require_exclusive_lock
def abandon_bios_config(self, task, **kwargs): def abandon_bios_config(self, task, **kwargs):
"""Abandon a BIOS configuration job. """Abandon a BIOS configuration job.

View File

@ -110,7 +110,11 @@ class VendorPassthru(iscsi_deploy.VendorPassthru):
task.context, {'image_source': kwargs.get('boot_iso_href')}, []) task.context, {'image_source': kwargs.get('boot_iso_href')}, [])
@METRICS.timer('IloVendorPassthru.boot_into_iso') @METRICS.timer('IloVendorPassthru.boot_into_iso')
@base.passthru(['POST']) @base.passthru(['POST'],
description=_("Attaches an ISO image and reboots the node. "
"Required argument: 'boot_iso_href' - href "
"of the image to be booted. This can be a "
"Glance UUID or an HTTP(S) URL."))
@task_manager.require_exclusive_lock @task_manager.require_exclusive_lock
def boot_into_iso(self, task, **kwargs): def boot_into_iso(self, task, **kwargs):
"""Attaches an ISO image in glance and reboots bare metal. """Attaches an ISO image in glance and reboots bare metal.

View File

@ -658,7 +658,10 @@ class VendorPassthru(base.VendorInterface):
_parse_driver_info(task.node) _parse_driver_info(task.node)
@METRICS.timer('VendorPassthru.send_raw') @METRICS.timer('VendorPassthru.send_raw')
@base.passthru(['POST']) @base.passthru(['POST'],
description=_("Send raw bytes to the BMC. Required "
"argument: 'raw_bytes' - a string of raw "
"bytes (e.g. '0x00 0x01')."))
@task_manager.require_exclusive_lock @task_manager.require_exclusive_lock
def send_raw(self, task, http_method, raw_bytes): def send_raw(self, task, http_method, raw_bytes):
"""Send raw bytes to the BMC. Bytes should be a string of bytes. """Send raw bytes to the BMC. Bytes should be a string of bytes.
@ -675,7 +678,10 @@ class VendorPassthru(base.VendorInterface):
_send_raw(driver_info, raw_bytes) _send_raw(driver_info, raw_bytes)
@METRICS.timer('VendorPassthru.bmc_reset') @METRICS.timer('VendorPassthru.bmc_reset')
@base.passthru(['POST']) @base.passthru(['POST'],
description=_("Reset the BMC. Required argument: 'warm' "
"(Boolean) - for warm (True) or cold (False) "
"reset."))
@task_manager.require_exclusive_lock @task_manager.require_exclusive_lock
def bmc_reset(self, task, http_method, warm=True): def bmc_reset(self, task, http_method, warm=True):
"""Reset BMC via IPMI command. """Reset BMC via IPMI command.

View File

@ -1051,7 +1051,10 @@ class VendorPassthru(base.VendorInterface):
_check_temp_dir() _check_temp_dir()
@METRICS.timer('VendorPassthru.send_raw') @METRICS.timer('VendorPassthru.send_raw')
@base.passthru(['POST']) @base.passthru(['POST'],
description=_("Send raw bytes to the BMC. Required "
"argument: 'raw_bytes' - a string of raw "
"bytes (e.g. '0x00 0x01')."))
@task_manager.require_exclusive_lock @task_manager.require_exclusive_lock
def send_raw(self, task, http_method, raw_bytes): def send_raw(self, task, http_method, raw_bytes):
"""Send raw bytes to the BMC. Bytes should be a string of bytes. """Send raw bytes to the BMC. Bytes should be a string of bytes.
@ -1067,7 +1070,10 @@ class VendorPassthru(base.VendorInterface):
send_raw(task, raw_bytes) send_raw(task, raw_bytes)
@METRICS.timer('VendorPassthru.bmc_reset') @METRICS.timer('VendorPassthru.bmc_reset')
@base.passthru(['POST']) @base.passthru(['POST'],
description=_("Reset the BMC. Required argument: 'warm' "
"(Boolean) - for warm (True) or cold (False) "
"reset."))
@task_manager.require_exclusive_lock @task_manager.require_exclusive_lock
def bmc_reset(self, task, http_method, warm=True): def bmc_reset(self, task, http_method, warm=True):
"""Reset BMC with IPMI command 'bmc reset (warm|cold)'. """Reset BMC with IPMI command 'bmc reset (warm|cold)'.

View File

@ -434,7 +434,10 @@ class VendorPassthru(base.VendorInterface):
def validate(self, task, method, **kwargs): def validate(self, task, method, **kwargs):
_parse_driver_info(task.node) _parse_driver_info(task.node)
@base.passthru(['POST']) @base.passthru(['POST'],
description=_("Set an untagged VLAN ID for NIC 0 of node. "
"Required argument: 'vlan_id' - ID of "
"untagged VLAN."))
def set_node_vlan_id(self, task, **kwargs): def set_node_vlan_id(self, task, **kwargs):
"""Sets an untagged vlan id for NIC 0 of node. """Sets an untagged vlan id for NIC 0 of node.
@ -463,7 +466,13 @@ class VendorPassthru(base.VendorInterface):
node.properties = properties node.properties = properties
node.save() node.save()
@base.passthru(['POST']) @base.passthru(['POST'],
description=_("Attach volume to node. Arguments: "
"1. 'volume_id' - ID of pre-provisioned "
"volume. This is optional. If not specified, "
"a volume is created in SeaMicro storage "
"pool. 2. 'volume_size' - size of new volume "
"(if volume_id is not specified)."))
def attach_volume(self, task, **kwargs): def attach_volume(self, task, **kwargs):
"""Attach a volume to a node. """Attach a volume to a node.