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
This commit is contained in:
Drew Thorstensen
2015-07-21 09:46:09 -04:00
parent 7db154ac92
commit a0d328df08

View File

@@ -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)