Timing metrics: iRMC drivers

Adds timing metrics for methods in the boot, inspect, management, power
and vendor modules of iRMC drivers.

Change-Id: I743da5510f897fdadf87a51ab28270ee618a8649
Closes-Bug: #1611556
This commit is contained in:
Luong Anh Tuan 2016-09-16 13:09:10 +07:00 committed by Tuan Luong-Anh
parent 5603a215b7
commit 2c76da5f43
5 changed files with 30 additions and 2 deletions

View File

@ -20,6 +20,7 @@ import os
import shutil
import tempfile
from ironic_lib import metrics_utils
from ironic_lib import utils as ironic_utils
from oslo_log import log as logging
from oslo_utils import importutils
@ -47,6 +48,8 @@ except Exception:
LOG = logging.getLogger(__name__)
METRICS = metrics_utils.get_metrics_logger(__name__)
REQUIRED_PROPERTIES = {
'irmc_deploy_iso': _("Deployment ISO image file name. "
"Required."),
@ -533,6 +536,7 @@ class IRMCVirtualMediaBoot(base.BootInterface):
def get_properties(self):
return COMMON_PROPERTIES
@METRICS.timer('IRMCVirtualMediaBoot.validate')
def validate(self, task):
"""Validate the deployment information for the task's node.
@ -557,6 +561,7 @@ class IRMCVirtualMediaBoot(base.BootInterface):
deploy_utils.validate_image_properties(task.context, d_info,
props)
@METRICS.timer('IRMCVirtualMediaBoot.prepare_ramdisk')
def prepare_ramdisk(self, task, ramdisk_params):
"""Prepares the deploy ramdisk using virtual media.
@ -587,6 +592,7 @@ class IRMCVirtualMediaBoot(base.BootInterface):
_setup_deploy_iso(task, ramdisk_params)
@METRICS.timer('IRMCVirtualMediaBoot.clean_up_ramdisk')
def clean_up_ramdisk(self, task):
"""Cleans up the boot of ironic ramdisk.
@ -599,6 +605,7 @@ class IRMCVirtualMediaBoot(base.BootInterface):
"""
_cleanup_vmedia_boot(task)
@METRICS.timer('IRMCVirtualMediaBoot.prepare_instance')
def prepare_instance(self, task):
"""Prepares the boot of instance.
@ -620,6 +627,7 @@ class IRMCVirtualMediaBoot(base.BootInterface):
root_uuid_or_disk_id = driver_internal_info['root_uuid_or_disk_id']
self._configure_vmedia_boot(task, root_uuid_or_disk_id)
@METRICS.timer('IRMCVirtualMediaBoot.clean_up_instance')
def clean_up_instance(self, task):
"""Cleans up the boot of instance.

View File

@ -14,7 +14,7 @@
"""
iRMC Inspect Interface
"""
from ironic_lib import metrics_utils
from oslo_log import log as logging
from oslo_utils import importutils
@ -30,6 +30,8 @@ scci = importutils.try_import('scciclient.irmc.scci')
LOG = logging.getLogger(__name__)
METRICS = metrics_utils.get_metrics_logger(__name__)
"""
SC2.mib: sc2UnitNodeClass returns NIC type.
@ -142,6 +144,7 @@ class IRMCInspect(base.InspectInterface):
"""
return irmc_common.COMMON_PROPERTIES
@METRICS.timer('IRMCInspect.validate')
def validate(self, task):
"""Validate the driver-specific inspection information.
@ -155,6 +158,7 @@ class IRMCInspect(base.InspectInterface):
"""
irmc_common.parse_driver_info(task.node)
@METRICS.timer('IRMCInspect.inspect_hardware')
def inspect_hardware(self, task):
"""Inspect hardware.

View File

@ -14,7 +14,7 @@
"""
iRMC Management Driver
"""
from ironic_lib import metrics_utils
from oslo_log import log as logging
from oslo_utils import importutils
@ -30,6 +30,8 @@ scci = importutils.try_import('scciclient.irmc.scci')
LOG = logging.getLogger(__name__)
METRICS = metrics_utils.get_metrics_logger(__name__)
# Boot Option Parameters #5 Data2 defined in
# Set/Get System Boot Options Command, IPMI spec v2.0.
_BOOTPARAM5_DATA2 = {boot_devices.PXE: '0x04',
@ -113,6 +115,7 @@ class IRMCManagement(ipmitool.IPMIManagement):
"""
return irmc_common.COMMON_PROPERTIES
@METRICS.timer('IRMCManagement.validate')
def validate(self, task):
"""Validate the driver-specific management information.
@ -127,6 +130,7 @@ class IRMCManagement(ipmitool.IPMIManagement):
irmc_common.update_ipmi_properties(task)
super(IRMCManagement, self).validate(task)
@METRICS.timer('IRMCManagement.set_boot_device')
@task_manager.require_exclusive_lock
def set_boot_device(self, task, device, persistent=False):
"""Set the boot device for a node.
@ -177,6 +181,7 @@ class IRMCManagement(ipmitool.IPMIManagement):
cmd8 = bootparam5 % (data1, data2)
ipmitool.send_raw(task, cmd8)
@METRICS.timer('IRMCManagement.get_sensors_data')
def get_sensors_data(self, task):
"""Get sensors data method.

View File

@ -15,6 +15,8 @@
"""
iRMC Power Driver using the Base Server Profile
"""
from ironic_lib import metrics_utils
from oslo_log import log as logging
from oslo_utils import importutils
@ -32,6 +34,8 @@ scci = importutils.try_import('scciclient.irmc.scci')
LOG = logging.getLogger(__name__)
METRICS = metrics_utils.get_metrics_logger(__name__)
if scci:
STATES_MAP = {states.POWER_OFF: scci.POWER_OFF,
states.POWER_ON: scci.POWER_ON,
@ -83,6 +87,7 @@ class IRMCPower(base.PowerInterface):
"""
return irmc_common.COMMON_PROPERTIES
@METRICS.timer('IRMCPower.validate')
def validate(self, task):
"""Validate the driver-specific Node power info.
@ -97,6 +102,7 @@ class IRMCPower(base.PowerInterface):
"""
irmc_common.parse_driver_info(task.node)
@METRICS.timer('IRMCPower.get_power_state')
def get_power_state(self, task):
"""Return the power state of the task's node.
@ -111,6 +117,7 @@ class IRMCPower(base.PowerInterface):
ipmi_power = ipmitool.IPMIPower()
return ipmi_power.get_power_state(task)
@METRICS.timer('IRMCPower.set_power_state')
@task_manager.require_exclusive_lock
def set_power_state(self, task, power_state):
"""Set the power state of the task's node.
@ -124,6 +131,7 @@ class IRMCPower(base.PowerInterface):
"""
_set_power_state(task, power_state)
@METRICS.timer('IRMCPower.reboot')
@task_manager.require_exclusive_lock
def reboot(self, task):
"""Perform a hard reboot of the task's node.

View File

@ -0,0 +1,3 @@
---
features:
- Adds timing metrics to iRMC drivers.