diff --git a/ironic/drivers/modules/ilo/boot.py b/ironic/drivers/modules/ilo/boot.py index 7df57cd4a7..745b2d4fe0 100644 --- a/ironic/drivers/modules/ilo/boot.py +++ b/ironic/drivers/modules/ilo/boot.py @@ -18,6 +18,7 @@ Boot Interface for iLO drivers and its supporting methods. import os import tempfile +from ironic_lib import metrics_utils from ironic_lib import utils as ironic_utils from oslo_config import cfg from oslo_log import log as logging @@ -39,6 +40,8 @@ from ironic.drivers.modules.ilo import common as ilo_common LOG = logging.getLogger(__name__) +METRICS = metrics_utils.get_metrics_logger(__name__) + CONF = cfg.CONF REQUIRED_PROPERTIES = { @@ -250,6 +253,7 @@ class IloVirtualMediaBoot(base.BootInterface): def get_properties(self): return COMMON_PROPERTIES + @METRICS.timer('IloVirtualMediaBoot.validate') def validate(self, task): """Validate the deployment information for the task's node. @@ -272,6 +276,7 @@ class IloVirtualMediaBoot(base.BootInterface): props = ['kernel', 'ramdisk'] deploy_utils.validate_image_properties(task.context, d_info, props) + @METRICS.timer('IloVirtualMediaBoot.prepare_ramdisk') def prepare_ramdisk(self, task, ramdisk_params): """Prepares the boot of deploy ramdisk using virtual media. @@ -320,6 +325,7 @@ class IloVirtualMediaBoot(base.BootInterface): ilo_common.setup_vmedia(task, deploy_iso, ramdisk_params) + @METRICS.timer('IloVirtualMediaBoot.prepare_instance') def prepare_instance(self, task): """Prepares the boot of instance. @@ -356,6 +362,7 @@ class IloVirtualMediaBoot(base.BootInterface): LOG.warning(_LW("The UUID for the root partition could not " "be found for node %s"), node.uuid) + @METRICS.timer('IloVirtualMediaBoot.clean_up_instance') def clean_up_instance(self, task): """Cleans up the boot of instance. @@ -377,6 +384,7 @@ class IloVirtualMediaBoot(base.BootInterface): ilo_common.cleanup_vmedia_boot(task) + @METRICS.timer('IloVirtualMediaBoot.clean_up_ramdisk') def clean_up_ramdisk(self, task): """Cleans up the boot of ironic ramdisk. diff --git a/ironic/drivers/modules/ilo/console.py b/ironic/drivers/modules/ilo/console.py index c8b4f0c4e0..e65e21cfbf 100644 --- a/ironic/drivers/modules/ilo/console.py +++ b/ironic/drivers/modules/ilo/console.py @@ -15,11 +15,15 @@ iLO Deploy Driver(s) and supporting methods. """ +from ironic_lib import metrics_utils + from ironic.common import exception from ironic.common.i18n import _ from ironic.drivers.modules.ilo import common as ilo_common from ironic.drivers.modules import ipmitool +METRICS = metrics_utils.get_metrics_logger(__name__) + class IloConsoleInterface(ipmitool.IPMIShellinaboxConsole): """A ConsoleInterface that uses ipmitool and shellinabox.""" @@ -29,6 +33,7 @@ class IloConsoleInterface(ipmitool.IPMIShellinaboxConsole): props.update(ilo_common.CONSOLE_PROPERTIES) return props + @METRICS.timer('IloConsoleInterface.validate') def validate(self, task): """Validate the Node console info. diff --git a/ironic/drivers/modules/ilo/deploy.py b/ironic/drivers/modules/ilo/deploy.py index 7e564bff8f..b716e2df4d 100644 --- a/ironic/drivers/modules/ilo/deploy.py +++ b/ironic/drivers/modules/ilo/deploy.py @@ -15,6 +15,7 @@ iLO Deploy Driver(s) and supporting methods. """ +from ironic_lib import metrics_utils from oslo_log import log as logging from ironic.common import boot_devices @@ -35,6 +36,8 @@ from ironic.drivers.modules import pxe LOG = logging.getLogger(__name__) +METRICS = metrics_utils.get_metrics_logger(__name__) + def _prepare_agent_vmedia_boot(task): """Ejects virtual media devices and prepares for vmedia boot.""" @@ -162,6 +165,7 @@ class IloVirtualMediaIscsiDeploy(iscsi_deploy.ISCSIDeploy): def get_properties(self): return {} + @METRICS.timer('IloVirtualMediaIscsiDeploy.validate') def validate(self, task): """Validate the prerequisites for virtual media based deploy. @@ -176,6 +180,7 @@ class IloVirtualMediaIscsiDeploy(iscsi_deploy.ISCSIDeploy): _validate(task) super(IloVirtualMediaIscsiDeploy, self).validate(task) + @METRICS.timer('IloVirtualMediaIscsiDeploy.tear_down') @task_manager.require_exclusive_lock def tear_down(self, task): """Tear down a previous deployment on the task's node. @@ -192,6 +197,7 @@ class IloVirtualMediaIscsiDeploy(iscsi_deploy.ISCSIDeploy): _disable_secure_boot_if_supported(task) return super(IloVirtualMediaIscsiDeploy, self).tear_down(task) + @METRICS.timer('IloVirtualMediaIscsiDeploy.prepare') def prepare(self, task): """Prepare the deployment environment for this task's node. @@ -203,6 +209,7 @@ class IloVirtualMediaIscsiDeploy(iscsi_deploy.ISCSIDeploy): super(IloVirtualMediaIscsiDeploy, self).prepare(task) + @METRICS.timer('IloVirtualMediaIscsiDeploy.prepare_cleaning') def prepare_cleaning(self, task): """Boot into the agent to prepare for cleaning. @@ -228,6 +235,7 @@ class IloVirtualMediaAgentDeploy(agent.AgentDeploy): """ return ilo_boot.COMMON_PROPERTIES + @METRICS.timer('IloVirtualMediaAgentDeploy.validate') def validate(self, task): """Validate the prerequisites for virtual media based deploy. @@ -242,6 +250,7 @@ class IloVirtualMediaAgentDeploy(agent.AgentDeploy): _validate(task) super(IloVirtualMediaAgentDeploy, self).validate(task) + @METRICS.timer('IloVirtualMediaAgentDeploy.tear_down') @task_manager.require_exclusive_lock def tear_down(self, task): """Tear down a previous deployment on the task's node. @@ -254,6 +263,7 @@ class IloVirtualMediaAgentDeploy(agent.AgentDeploy): _disable_secure_boot_if_supported(task) return super(IloVirtualMediaAgentDeploy, self).tear_down(task) + @METRICS.timer('IloVirtualMediaAgentDeploy.prepare') def prepare(self, task): """Prepare the deployment environment for this node. @@ -265,6 +275,7 @@ class IloVirtualMediaAgentDeploy(agent.AgentDeploy): super(IloVirtualMediaAgentDeploy, self).prepare(task) + @METRICS.timer('IloVirtualMediaAgentDeploy.prepare_cleaning') def prepare_cleaning(self, task): """Boot into the agent to prepare for cleaning. @@ -279,6 +290,7 @@ class IloVirtualMediaAgentDeploy(agent.AgentDeploy): manager_utils.node_power_action(task, states.POWER_OFF) return super(IloVirtualMediaAgentDeploy, self).prepare_cleaning(task) + @METRICS.timer('IloVirtualMediaAgentDeploy.get_clean_steps') def get_clean_steps(self, task): """Get the list of clean steps from the agent. @@ -305,6 +317,7 @@ class IloVirtualMediaAgentDeploy(agent.AgentDeploy): class IloPXEDeploy(iscsi_deploy.ISCSIDeploy): + @METRICS.timer('IloPXEDeploy.prepare') def prepare(self, task): """Prepare the deployment environment for this task's node. @@ -334,6 +347,7 @@ class IloPXEDeploy(iscsi_deploy.ISCSIDeploy): super(IloPXEDeploy, self).prepare(task) + @METRICS.timer('IloPXEDeploy.deploy') def deploy(self, task): """Start deployment of the task's node. @@ -346,6 +360,7 @@ class IloPXEDeploy(iscsi_deploy.ISCSIDeploy): manager_utils.node_set_boot_device(task, boot_devices.PXE) return super(IloPXEDeploy, self).deploy(task) + @METRICS.timer('IloPXEDeploy.tear_down') @task_manager.require_exclusive_lock def tear_down(self, task): """Tear down a previous deployment on the task's node. @@ -359,6 +374,7 @@ class IloPXEDeploy(iscsi_deploy.ISCSIDeploy): _disable_secure_boot_if_supported(task) return super(IloPXEDeploy, self).tear_down(task) + @METRICS.timer('IloPXEDeploy.prepare_cleaning') def prepare_cleaning(self, task): """Boot into the agent to prepare for cleaning. diff --git a/ironic/drivers/modules/ilo/inspect.py b/ironic/drivers/modules/ilo/inspect.py index e7571816ee..9f37816efb 100644 --- a/ironic/drivers/modules/ilo/inspect.py +++ b/ironic/drivers/modules/ilo/inspect.py @@ -12,6 +12,7 @@ """ iLO Inspect Interface """ +from ironic_lib import metrics_utils from oslo_log import log as logging from oslo_utils import importutils @@ -28,6 +29,8 @@ ilo_error = importutils.try_import('proliantutils.exception') LOG = logging.getLogger(__name__) +METRICS = metrics_utils.get_metrics_logger(__name__) + CAPABILITIES_KEYS = {'BootMode', 'secure_boot', 'rom_firmware_version', 'ilo_firmware_version', 'server_model', 'max_raid_level', 'pci_gpu_devices', 'sr_iov_devices', 'nic_capacity'} @@ -162,6 +165,7 @@ class IloInspect(base.InspectInterface): def get_properties(self): return ilo_common.REQUIRED_PROPERTIES + @METRICS.timer('IloInspect.validate') def validate(self, task): """Check that 'driver_info' contains required ILO credentials. @@ -176,6 +180,7 @@ class IloInspect(base.InspectInterface): node = task.node ilo_common.parse_driver_info(node) + @METRICS.timer('IloInspect.inspect_hardware') def inspect_hardware(self, task): """Inspect hardware to get the hardware properties. diff --git a/ironic/drivers/modules/ilo/management.py b/ironic/drivers/modules/ilo/management.py index cf5362df7a..83d0a98b71 100644 --- a/ironic/drivers/modules/ilo/management.py +++ b/ironic/drivers/modules/ilo/management.py @@ -15,6 +15,7 @@ iLO Management Interface """ +from ironic_lib import metrics_utils from oslo_log import log as logging from oslo_utils import excutils from oslo_utils import importutils @@ -32,6 +33,8 @@ from ironic.drivers.modules import ipmitool LOG = logging.getLogger(__name__) +METRICS = metrics_utils.get_metrics_logger(__name__) + ilo_error = importutils.try_import('proliantutils.exception') BOOT_DEVICE_MAPPING_TO_ILO = { @@ -86,6 +89,7 @@ class IloManagement(base.ManagementInterface): def get_properties(self): return MANAGEMENT_PROPERTIES + @METRICS.timer('IloManagement.validate') def validate(self, task): """Check that 'driver_info' contains required ILO credentials. @@ -100,6 +104,7 @@ class IloManagement(base.ManagementInterface): """ ilo_common.parse_driver_info(task.node) + @METRICS.timer('IloManagement.get_supported_boot_devices') def get_supported_boot_devices(self, task): """Get a list of the supported boot devices. @@ -110,6 +115,7 @@ class IloManagement(base.ManagementInterface): """ return list(BOOT_DEVICE_MAPPING_TO_ILO.keys()) + @METRICS.timer('IloManagement.get_boot_device') def get_boot_device(self, task): """Get the current boot device for a node. @@ -152,6 +158,7 @@ class IloManagement(base.ManagementInterface): return {'boot_device': boot_device, 'persistent': persistent} + @METRICS.timer('IloManagement.set_boot_device') @task_manager.require_exclusive_lock def set_boot_device(self, task, device, persistent=False): """Set the boot device for a node. @@ -191,6 +198,7 @@ class IloManagement(base.ManagementInterface): LOG.debug("Node %(uuid)s set to boot from %(device)s.", {'uuid': task.node.uuid, 'device': device}) + @METRICS.timer('IloManagement.get_sensors_data') def get_sensors_data(self, task): """Get sensors data. @@ -207,6 +215,7 @@ class IloManagement(base.ManagementInterface): ipmi_management = ipmitool.IPMIManagement() return ipmi_management.get_sensors_data(task) + @METRICS.timer('IloManagement.reset_ilo') @base.clean_step(priority=CONF.ilo.clean_priority_reset_ilo) def reset_ilo(self, task): """Resets the iLO. @@ -216,6 +225,7 @@ class IloManagement(base.ManagementInterface): """ return _execute_ilo_clean_step(task.node, 'reset_ilo') + @METRICS.timer('IloManagement.reset_ilo_credential') @base.clean_step(priority=CONF.ilo.clean_priority_reset_ilo_credential) def reset_ilo_credential(self, task): """Resets the iLO password. @@ -238,6 +248,7 @@ class IloManagement(base.ManagementInterface): task.node.driver_info = info task.node.save() + @METRICS.timer('IloManagement.reset_bios_to_default') @base.clean_step(priority=CONF.ilo.clean_priority_reset_bios_to_default) def reset_bios_to_default(self, task): """Resets the BIOS settings to default values. @@ -250,6 +261,7 @@ class IloManagement(base.ManagementInterface): """ return _execute_ilo_clean_step(task.node, 'reset_bios_to_default') + @METRICS.timer('IloManagement.reset_secure_boot_keys_to_default') @base.clean_step(priority=CONF.ilo. clean_priority_reset_secure_boot_keys_to_default) def reset_secure_boot_keys_to_default(self, task): @@ -263,6 +275,7 @@ class IloManagement(base.ManagementInterface): """ return _execute_ilo_clean_step(task.node, 'reset_secure_boot_keys') + @METRICS.timer('IloManagement.clear_secure_boot_keys') @base.clean_step(priority=CONF.ilo.clean_priority_clear_secure_boot_keys) def clear_secure_boot_keys(self, task): """Clear all secure boot keys. @@ -275,6 +288,7 @@ class IloManagement(base.ManagementInterface): """ return _execute_ilo_clean_step(task.node, 'clear_secure_boot_keys') + @METRICS.timer('IloManagement.activate_license') @base.clean_step(priority=0, abortable=False, argsinfo={ 'ilo_license_key': { 'description': ( @@ -308,6 +322,7 @@ class IloManagement(base.ManagementInterface): LOG.info(_LI("iLO license activated for node %(node)s."), {'node': node.uuid}) + @METRICS.timer('IloManagement.update_firmware') @base.clean_step(priority=0, abortable=False, argsinfo={ 'firmware_update_mode': { 'description': ( diff --git a/ironic/drivers/modules/ilo/power.py b/ironic/drivers/modules/ilo/power.py index 9c13e66487..feb8df428c 100644 --- a/ironic/drivers/modules/ilo/power.py +++ b/ironic/drivers/modules/ilo/power.py @@ -16,6 +16,7 @@ iLO Power Driver """ +from ironic_lib import metrics_utils from oslo_log import log as logging from oslo_service import loopingcall from oslo_utils import importutils @@ -34,6 +35,8 @@ ilo_error = importutils.try_import('proliantutils.exception') LOG = logging.getLogger(__name__) +METRICS = metrics_utils.get_metrics_logger(__name__) + def _attach_boot_iso_if_needed(task): """Attaches boot ISO for a deployed node. @@ -172,6 +175,7 @@ class IloPower(base.PowerInterface): def get_properties(self): return ilo_common.COMMON_PROPERTIES + @METRICS.timer('IloPower.validate') def validate(self, task): """Check if node.driver_info contains the required iLO credentials. @@ -181,6 +185,7 @@ class IloPower(base.PowerInterface): """ ilo_common.parse_driver_info(task.node) + @METRICS.timer('IloPower.get_power_state') def get_power_state(self, task): """Gets the current power state. @@ -193,6 +198,7 @@ class IloPower(base.PowerInterface): """ return _get_power_state(task.node) + @METRICS.timer('IloPower.set_power_state') @task_manager.require_exclusive_lock def set_power_state(self, task, power_state): """Turn the current power state on or off. @@ -207,6 +213,7 @@ class IloPower(base.PowerInterface): """ _set_power_state(task, power_state) + @METRICS.timer('IloPower.reboot') @task_manager.require_exclusive_lock def reboot(self, task): """Reboot the node diff --git a/ironic/drivers/modules/ilo/vendor.py b/ironic/drivers/modules/ilo/vendor.py index 55e7290adf..341866947d 100644 --- a/ironic/drivers/modules/ilo/vendor.py +++ b/ironic/drivers/modules/ilo/vendor.py @@ -15,6 +15,7 @@ Vendor Interface for iLO drivers and its supporting methods. """ +from ironic_lib import metrics_utils from oslo_log import log as logging from ironic.common import exception @@ -30,10 +31,13 @@ from ironic.drivers.modules import iscsi_deploy LOG = logging.getLogger(__name__) +METRICS = metrics_utils.get_metrics_logger(__name__) + class IloVirtualMediaAgentVendorInterface(agent.AgentVendorInterface): """Interface for vendor passthru related actions.""" + @METRICS.timer('IloVirtualMediaAgentVendorInterface.reboot_to_instance') def reboot_to_instance(self, task): node = task.node LOG.debug('Preparing to reboot to instance for node %s', @@ -54,6 +58,7 @@ class IloVirtualMediaAgentVendorInterface(agent.AgentVendorInterface): class VendorPassthru(iscsi_deploy.VendorPassthru): """Vendor-specific interfaces for iLO deploy drivers.""" + @METRICS.timer('IloVendorPassthru.validate') def validate(self, task, method, **kwargs): """Validate vendor-specific actions. @@ -74,6 +79,7 @@ class VendorPassthru(iscsi_deploy.VendorPassthru): return super(VendorPassthru, self).validate(task, method, **kwargs) + @METRICS.timer('IloVendorPassthru.continue_deploy') @task_manager.require_exclusive_lock def continue_deploy(self, task, **kwargs): """Method invoked when deployed with the IPA ramdisk. @@ -103,6 +109,7 @@ class VendorPassthru(iscsi_deploy.VendorPassthru): deploy_utils.validate_image_properties( task.context, {'image_source': kwargs.get('boot_iso_href')}, []) + @METRICS.timer('IloVendorPassthru.boot_into_iso') @base.passthru(['POST']) @task_manager.require_exclusive_lock def boot_into_iso(self, task, **kwargs):