From a04aeca9448c461c60a0bfe6bc4571167e1681ef Mon Sep 17 00:00:00 2001 From: Annie Lezil Date: Wed, 14 Sep 2016 22:37:20 +0000 Subject: [PATCH] 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 --- ironic/drivers/modules/agent_base_vendor.py | 13 ++++++-- .../drivers/modules/drac/vendor_passthru.py | 30 ++++++++++++++++--- ironic/drivers/modules/ilo/vendor.py | 6 +++- ironic/drivers/modules/ipminative.py | 10 +++++-- ironic/drivers/modules/ipmitool.py | 10 +++++-- ironic/drivers/modules/seamicro.py | 13 ++++++-- 6 files changed, 69 insertions(+), 13 deletions(-) diff --git a/ironic/drivers/modules/agent_base_vendor.py b/ironic/drivers/modules/agent_base_vendor.py index f2d7156825..41d6f6d769 100644 --- a/ironic/drivers/modules/agent_base_vendor.py +++ b/ironic/drivers/modules/agent_base_vendor.py @@ -709,7 +709,11 @@ class BaseAgentVendor(AgentDeployMixin, base.VendorInterface): % version) @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://:.")) @task_manager.require_exclusive_lock def heartbeat(self, task, **kwargs): """Method for agent to periodically check in. @@ -733,7 +737,12 @@ class BaseAgentVendor(AgentDeployMixin, base.VendorInterface): super(BaseAgentVendor, self).heartbeat(task, callback_url) @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): """Find a matching node for the agent. diff --git a/ironic/drivers/modules/drac/vendor_passthru.py b/ironic/drivers/modules/drac/vendor_passthru.py index 3fd8cbe683..a0d31cbf5a 100644 --- a/ironic/drivers/modules/drac/vendor_passthru.py +++ b/ironic/drivers/modules/drac/vendor_passthru.py @@ -15,6 +15,7 @@ DRAC vendor-passthru interface """ +from ironic.common.i18n import _ from ironic.conductor import task_manager from ironic.drivers import base 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) - @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): """Get the BIOS configuration. @@ -61,7 +64,14 @@ class DracVendorPassthru(base.VendorInterface): 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 def set_bios_config(self, task, **kwargs): """Change BIOS settings. @@ -77,7 +87,17 @@ class DracVendorPassthru(base.VendorInterface): """ 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 def commit_bios_config(self, task, reboot=False, **kwargs): """Commit a BIOS configuration job. @@ -98,7 +118,9 @@ class DracVendorPassthru(base.VendorInterface): job_id = drac_bios.commit_config(task, reboot=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 def abandon_bios_config(self, task, **kwargs): """Abandon a BIOS configuration job. diff --git a/ironic/drivers/modules/ilo/vendor.py b/ironic/drivers/modules/ilo/vendor.py index 341866947d..f5aac370bb 100644 --- a/ironic/drivers/modules/ilo/vendor.py +++ b/ironic/drivers/modules/ilo/vendor.py @@ -110,7 +110,11 @@ class VendorPassthru(iscsi_deploy.VendorPassthru): task.context, {'image_source': kwargs.get('boot_iso_href')}, []) @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 def boot_into_iso(self, task, **kwargs): """Attaches an ISO image in glance and reboots bare metal. diff --git a/ironic/drivers/modules/ipminative.py b/ironic/drivers/modules/ipminative.py index 0baaa5a777..add11e1226 100644 --- a/ironic/drivers/modules/ipminative.py +++ b/ironic/drivers/modules/ipminative.py @@ -658,7 +658,10 @@ class VendorPassthru(base.VendorInterface): _parse_driver_info(task.node) @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 def send_raw(self, task, http_method, raw_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) @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 def bmc_reset(self, task, http_method, warm=True): """Reset BMC via IPMI command. diff --git a/ironic/drivers/modules/ipmitool.py b/ironic/drivers/modules/ipmitool.py index 5ab0d7cff6..b1c3d5c905 100644 --- a/ironic/drivers/modules/ipmitool.py +++ b/ironic/drivers/modules/ipmitool.py @@ -1051,7 +1051,10 @@ class VendorPassthru(base.VendorInterface): _check_temp_dir() @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 def send_raw(self, task, http_method, raw_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) @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 def bmc_reset(self, task, http_method, warm=True): """Reset BMC with IPMI command 'bmc reset (warm|cold)'. diff --git a/ironic/drivers/modules/seamicro.py b/ironic/drivers/modules/seamicro.py index 818248bee6..cf45bb6d05 100644 --- a/ironic/drivers/modules/seamicro.py +++ b/ironic/drivers/modules/seamicro.py @@ -434,7 +434,10 @@ class VendorPassthru(base.VendorInterface): def validate(self, task, method, **kwargs): _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): """Sets an untagged vlan id for NIC 0 of node. @@ -463,7 +466,13 @@ class VendorPassthru(base.VendorInterface): node.properties = properties 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): """Attach a volume to a node.