Merge "Timing metrics for agent deploy classes"
This commit is contained in:
commit
863ffe984c
@ -12,6 +12,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from ironic_lib import metrics_utils
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
@ -39,6 +40,7 @@ from ironic.drivers.modules import deploy_utils
|
|||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
|
METRICS = metrics_utils.get_metrics_logger(__name__)
|
||||||
|
|
||||||
REQUIRED_PROPERTIES = {
|
REQUIRED_PROPERTIES = {
|
||||||
'deploy_kernel': _('UUID (from Glance) of the deployment kernel. '
|
'deploy_kernel': _('UUID (from Glance) of the deployment kernel. '
|
||||||
@ -69,6 +71,7 @@ PARTITION_IMAGE_LABELS = ('kernel', 'ramdisk', 'root_gb', 'root_mb', 'swap_mb',
|
|||||||
'deploy_boot_mode')
|
'deploy_boot_mode')
|
||||||
|
|
||||||
|
|
||||||
|
@METRICS.timer('build_instance_info_for_deploy')
|
||||||
def build_instance_info_for_deploy(task):
|
def build_instance_info_for_deploy(task):
|
||||||
"""Build instance_info necessary for deploying to a node.
|
"""Build instance_info necessary for deploying to a node.
|
||||||
|
|
||||||
@ -118,6 +121,7 @@ def build_instance_info_for_deploy(task):
|
|||||||
return instance_info
|
return instance_info
|
||||||
|
|
||||||
|
|
||||||
|
@METRICS.timer('check_image_size')
|
||||||
def check_image_size(task, image_source):
|
def check_image_size(task, image_source):
|
||||||
"""Check if the requested image is larger than the ram size.
|
"""Check if the requested image is larger than the ram size.
|
||||||
|
|
||||||
@ -155,6 +159,7 @@ def check_image_size(task, image_source):
|
|||||||
raise exception.InvalidParameterValue(msg)
|
raise exception.InvalidParameterValue(msg)
|
||||||
|
|
||||||
|
|
||||||
|
@METRICS.timer('validate_image_proxies')
|
||||||
def validate_image_proxies(node):
|
def validate_image_proxies(node):
|
||||||
"""Check that the provided proxy parameters are valid.
|
"""Check that the provided proxy parameters are valid.
|
||||||
|
|
||||||
@ -193,6 +198,7 @@ def validate_image_proxies(node):
|
|||||||
|
|
||||||
class AgentDeployMixin(agent_base_vendor.AgentDeployMixin):
|
class AgentDeployMixin(agent_base_vendor.AgentDeployMixin):
|
||||||
|
|
||||||
|
@METRICS.timer('AgentDeployMixin.deploy_has_started')
|
||||||
def deploy_has_started(self, task):
|
def deploy_has_started(self, task):
|
||||||
commands = self._client.get_commands_status(task.node)
|
commands = self._client.get_commands_status(task.node)
|
||||||
|
|
||||||
@ -202,6 +208,7 @@ class AgentDeployMixin(agent_base_vendor.AgentDeployMixin):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@METRICS.timer('AgentDeployMixin.deploy_is_done')
|
||||||
def deploy_is_done(self, task):
|
def deploy_is_done(self, task):
|
||||||
commands = self._client.get_commands_status(task.node)
|
commands = self._client.get_commands_status(task.node)
|
||||||
if not commands:
|
if not commands:
|
||||||
@ -219,6 +226,7 @@ class AgentDeployMixin(agent_base_vendor.AgentDeployMixin):
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@METRICS.timer('AgentDeployMixin.continue_deploy')
|
||||||
@task_manager.require_exclusive_lock
|
@task_manager.require_exclusive_lock
|
||||||
def continue_deploy(self, task):
|
def continue_deploy(self, task):
|
||||||
task.process_event('resume')
|
task.process_event('resume')
|
||||||
@ -295,6 +303,7 @@ class AgentDeployMixin(agent_base_vendor.AgentDeployMixin):
|
|||||||
return
|
return
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@METRICS.timer('AgentDeployMixin.check_deploy_success')
|
||||||
def check_deploy_success(self, node):
|
def check_deploy_success(self, node):
|
||||||
# should only ever be called after we've validated that
|
# should only ever be called after we've validated that
|
||||||
# the prepare_image command is complete
|
# the prepare_image command is complete
|
||||||
@ -302,6 +311,7 @@ class AgentDeployMixin(agent_base_vendor.AgentDeployMixin):
|
|||||||
if command['command_status'] == 'FAILED':
|
if command['command_status'] == 'FAILED':
|
||||||
return command['command_error']
|
return command['command_error']
|
||||||
|
|
||||||
|
@METRICS.timer('AgentDeployMixin.reboot_to_instance')
|
||||||
def reboot_to_instance(self, task):
|
def reboot_to_instance(self, task):
|
||||||
task.process_event('resume')
|
task.process_event('resume')
|
||||||
node = task.node
|
node = task.node
|
||||||
@ -353,6 +363,7 @@ class AgentDeploy(AgentDeployMixin, base.DeployInterface):
|
|||||||
"""
|
"""
|
||||||
return COMMON_PROPERTIES
|
return COMMON_PROPERTIES
|
||||||
|
|
||||||
|
@METRICS.timer('AgentDeploy.validate')
|
||||||
def validate(self, task):
|
def validate(self, task):
|
||||||
"""Validate the driver-specific Node deployment info.
|
"""Validate the driver-specific Node deployment info.
|
||||||
|
|
||||||
@ -393,6 +404,7 @@ class AgentDeploy(AgentDeployMixin, base.DeployInterface):
|
|||||||
|
|
||||||
validate_image_proxies(node)
|
validate_image_proxies(node)
|
||||||
|
|
||||||
|
@METRICS.timer('AgentDeploy.deploy')
|
||||||
@task_manager.require_exclusive_lock
|
@task_manager.require_exclusive_lock
|
||||||
def deploy(self, task):
|
def deploy(self, task):
|
||||||
"""Perform a deployment to a node.
|
"""Perform a deployment to a node.
|
||||||
@ -408,6 +420,7 @@ class AgentDeploy(AgentDeployMixin, base.DeployInterface):
|
|||||||
manager_utils.node_power_action(task, states.REBOOT)
|
manager_utils.node_power_action(task, states.REBOOT)
|
||||||
return states.DEPLOYWAIT
|
return states.DEPLOYWAIT
|
||||||
|
|
||||||
|
@METRICS.timer('AgentDeploy.tear_down')
|
||||||
@task_manager.require_exclusive_lock
|
@task_manager.require_exclusive_lock
|
||||||
def tear_down(self, task):
|
def tear_down(self, task):
|
||||||
"""Tear down a previous deployment on the task's node.
|
"""Tear down a previous deployment on the task's node.
|
||||||
@ -426,6 +439,7 @@ class AgentDeploy(AgentDeployMixin, base.DeployInterface):
|
|||||||
|
|
||||||
return states.DELETED
|
return states.DELETED
|
||||||
|
|
||||||
|
@METRICS.timer('AgentDeploy.prepare')
|
||||||
@task_manager.require_exclusive_lock
|
@task_manager.require_exclusive_lock
|
||||||
def prepare(self, task):
|
def prepare(self, task):
|
||||||
"""Prepare the deployment environment for this node.
|
"""Prepare the deployment environment for this node.
|
||||||
@ -457,6 +471,7 @@ class AgentDeploy(AgentDeployMixin, base.DeployInterface):
|
|||||||
deploy_opts = deploy_utils.build_agent_options(node)
|
deploy_opts = deploy_utils.build_agent_options(node)
|
||||||
task.driver.boot.prepare_ramdisk(task, deploy_opts)
|
task.driver.boot.prepare_ramdisk(task, deploy_opts)
|
||||||
|
|
||||||
|
@METRICS.timer('AgentDeploy.clean_up')
|
||||||
@task_manager.require_exclusive_lock
|
@task_manager.require_exclusive_lock
|
||||||
def clean_up(self, task):
|
def clean_up(self, task):
|
||||||
"""Clean up the deployment environment for this node.
|
"""Clean up the deployment environment for this node.
|
||||||
@ -490,6 +505,7 @@ class AgentDeploy(AgentDeployMixin, base.DeployInterface):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@METRICS.timer('AgentDeploy.get_clean_steps')
|
||||||
def get_clean_steps(self, task):
|
def get_clean_steps(self, task):
|
||||||
"""Get the list of clean steps from the agent.
|
"""Get the list of clean steps from the agent.
|
||||||
|
|
||||||
@ -506,6 +522,7 @@ class AgentDeploy(AgentDeployMixin, base.DeployInterface):
|
|||||||
task, interface='deploy',
|
task, interface='deploy',
|
||||||
override_priorities=new_priorities)
|
override_priorities=new_priorities)
|
||||||
|
|
||||||
|
@METRICS.timer('AgentDeploy.execute_clean_step')
|
||||||
def execute_clean_step(self, task, step):
|
def execute_clean_step(self, task, step):
|
||||||
"""Execute a clean step asynchronously on the agent.
|
"""Execute a clean step asynchronously on the agent.
|
||||||
|
|
||||||
@ -517,6 +534,7 @@ class AgentDeploy(AgentDeployMixin, base.DeployInterface):
|
|||||||
"""
|
"""
|
||||||
return deploy_utils.agent_execute_clean_step(task, step)
|
return deploy_utils.agent_execute_clean_step(task, step)
|
||||||
|
|
||||||
|
@METRICS.timer('AgentDeploy.prepare_cleaning')
|
||||||
def prepare_cleaning(self, task):
|
def prepare_cleaning(self, task):
|
||||||
"""Boot into the agent to prepare for cleaning.
|
"""Boot into the agent to prepare for cleaning.
|
||||||
|
|
||||||
@ -530,6 +548,7 @@ class AgentDeploy(AgentDeployMixin, base.DeployInterface):
|
|||||||
return deploy_utils.prepare_inband_cleaning(
|
return deploy_utils.prepare_inband_cleaning(
|
||||||
task, manage_boot=CONF.agent.manage_agent_boot)
|
task, manage_boot=CONF.agent.manage_agent_boot)
|
||||||
|
|
||||||
|
@METRICS.timer('AgentDeploy.tear_down_cleaning')
|
||||||
def tear_down_cleaning(self, task):
|
def tear_down_cleaning(self, task):
|
||||||
"""Clean up the PXE and DHCP files after cleaning.
|
"""Clean up the PXE and DHCP files after cleaning.
|
||||||
|
|
||||||
@ -556,6 +575,7 @@ class AgentRAID(base.RAIDInterface):
|
|||||||
"""Return the properties of the interface."""
|
"""Return the properties of the interface."""
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
@METRICS.timer('AgentRAID.create_configuration')
|
||||||
@base.clean_step(priority=0)
|
@base.clean_step(priority=0)
|
||||||
def create_configuration(self, task,
|
def create_configuration(self, task,
|
||||||
create_root_volume=True,
|
create_root_volume=True,
|
||||||
@ -652,6 +672,7 @@ class AgentRAID(base.RAIDInterface):
|
|||||||
|
|
||||||
raid.update_raid_info(task.node, clean_result)
|
raid.update_raid_info(task.node, clean_result)
|
||||||
|
|
||||||
|
@METRICS.timer('AgentRAID.delete_configuration')
|
||||||
@base.clean_step(priority=0)
|
@base.clean_step(priority=0)
|
||||||
def delete_configuration(self, task):
|
def delete_configuration(self, task):
|
||||||
"""Deletes RAID configuration on the given node.
|
"""Deletes RAID configuration on the given node.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user