From a0d328df0875f2c5d8a87b4ea4a3783b144820c7 Mon Sep 17 00:00:00 2001 From: Drew Thorstensen Date: Tue, 21 Jul 2015 09:46:09 -0400 Subject: [PATCH] Add helpers to the pypowervm adapter Helpers are a utility within the pypowervm adapter that help with edge scenarios that can occur when interacting with the API. This change set adds two of the more common helpers to the ceilometer-powervm adapter creation. The first is the log helper. In the event of error scenarios, this helper will log the error. The second is the helper for the vio busy. In the case of a Virtual I/O Server being busy, this will retry the requests after a short period of time. Change-Id: I65634f394416714c452fbd9fdc48db87b9c8ed61 --- ceilometer_powervm/compute/virt/powervm/inspector.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ceilometer_powervm/compute/virt/powervm/inspector.py b/ceilometer_powervm/compute/virt/powervm/inspector.py index 30f9a8b..2173301 100644 --- a/ceilometer_powervm/compute/virt/powervm/inspector.py +++ b/ceilometer_powervm/compute/virt/powervm/inspector.py @@ -16,6 +16,8 @@ from oslo_log import log as logging from pypowervm import adapter as pvm_adpt +from pypowervm.helpers import log_helper as log_hlp +from pypowervm.helpers import vios_busy as vio_hlp from pypowervm.tasks.monitor import util as pvm_mon_util from pypowervm.utils import uuid as pvm_uuid from pypowervm.wrappers import managed_system as pvm_ms @@ -37,7 +39,9 @@ class PowerVMInspector(virt_inspector.Inspector): super(PowerVMInspector, self).__init__() # Build the adapter to the PowerVM API. - adpt = pvm_adpt.Adapter(pvm_adpt.Session()) + adpt = pvm_adpt.Adapter( + pvm_adpt.Session(), helpers=[log_hlp.log_helper, + vio_hlp.vios_busy_retry_helper]) # Get the host system UUID host_uuid = self._get_host_uuid(adpt)