Update baremetal to use proxy logger
We added a logger to the Proxy object. Use it. Change-Id: Id84b845ca6400296514f86d4bf2fcc6dd66c9426
This commit is contained in:
parent
d8db601f21
commit
667fc55bf3
|
@ -10,7 +10,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from openstack import _log
|
||||
from openstack.baremetal.v1 import _common
|
||||
from openstack.baremetal.v1 import allocation as _allocation
|
||||
from openstack.baremetal.v1 import chassis as _chassis
|
||||
|
@ -22,9 +21,6 @@ from openstack import proxy
|
|||
from openstack import utils
|
||||
|
||||
|
||||
_logger = _log.setup_logging('openstack')
|
||||
|
||||
|
||||
class Proxy(proxy.Proxy):
|
||||
|
||||
retriable_status_codes = _common.RETRIABLE_STATUS_CODES
|
||||
|
@ -367,10 +363,11 @@ class Proxy(proxy.Proxy):
|
|||
if not remaining:
|
||||
return finished
|
||||
|
||||
_logger.debug('Still waiting for nodes %(nodes)s to reach state '
|
||||
'"%(target)s"',
|
||||
{'nodes': ', '.join(n.id for n in remaining),
|
||||
'target': expected_state})
|
||||
self.log.debug(
|
||||
'Still waiting for nodes %(nodes)s to reach state '
|
||||
'"%(target)s"',
|
||||
{'nodes': ', '.join(n.id for n in remaining),
|
||||
'target': expected_state})
|
||||
|
||||
def set_node_power_state(self, node, target):
|
||||
"""Run an action modifying node's power state.
|
||||
|
|
|
@ -10,16 +10,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from openstack import _log
|
||||
from openstack.baremetal.v1 import _common
|
||||
from openstack import exceptions
|
||||
from openstack import resource
|
||||
from openstack import utils
|
||||
|
||||
|
||||
_logger = _log.setup_logging('openstack')
|
||||
|
||||
|
||||
class Allocation(_common.ListMixin, resource.Resource):
|
||||
|
||||
resources_key = 'allocations'
|
||||
|
@ -93,6 +89,7 @@ class Allocation(_common.ListMixin, resource.Resource):
|
|||
elif self.state != 'allocating':
|
||||
return self
|
||||
|
||||
_logger.debug('Still waiting for the allocation %(allocation)s '
|
||||
'to become active, the current state is %(state)s',
|
||||
{'allocation': self.id, 'state': self.state})
|
||||
session.log.debug(
|
||||
'Still waiting for the allocation %(allocation)s '
|
||||
'to become active, the current state is %(state)s',
|
||||
{'allocation': self.id, 'state': self.state})
|
||||
|
|
|
@ -10,16 +10,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from openstack import _log
|
||||
from openstack.baremetal.v1 import _common
|
||||
from openstack import exceptions
|
||||
from openstack import resource
|
||||
from openstack import utils
|
||||
|
||||
|
||||
_logger = _log.setup_logging('openstack')
|
||||
|
||||
|
||||
class ValidationResult(object):
|
||||
"""Result of a single interface validation.
|
||||
|
||||
|
@ -415,10 +411,11 @@ class Node(_common.ListMixin, resource.Resource):
|
|||
abort_on_failed_state):
|
||||
return self
|
||||
|
||||
_logger.debug('Still waiting for node %(node)s to reach state '
|
||||
'"%(target)s", the current state is "%(state)s"',
|
||||
{'node': self.id, 'target': expected_state,
|
||||
'state': self.provision_state})
|
||||
session.log.debug(
|
||||
'Still waiting for node %(node)s to reach state '
|
||||
'"%(target)s", the current state is "%(state)s"',
|
||||
{'node': self.id, 'target': expected_state,
|
||||
'state': self.provision_state})
|
||||
|
||||
def wait_for_reservation(self, session, timeout=None):
|
||||
"""Wait for a lock on the node to be released.
|
||||
|
@ -454,9 +451,10 @@ class Node(_common.ListMixin, resource.Resource):
|
|||
if self.reservation is None:
|
||||
return self
|
||||
|
||||
_logger.debug('Still waiting for the lock to be released on node '
|
||||
'%(node)s, currently locked by conductor %(host)s',
|
||||
{'node': self.id, 'host': self.reservation})
|
||||
session.log.debug(
|
||||
'Still waiting for the lock to be released on node '
|
||||
'%(node)s, currently locked by conductor %(host)s',
|
||||
{'node': self.id, 'host': self.reservation})
|
||||
|
||||
def _check_state_reached(self, session, expected_state,
|
||||
abort_on_failed_state=True):
|
||||
|
@ -602,8 +600,9 @@ class Node(_common.ListMixin, resource.Resource):
|
|||
retriable_status_codes=_common.RETRIABLE_STATUS_CODES)
|
||||
|
||||
if ignore_missing and response.status_code == 400:
|
||||
_logger.debug('VIF %(vif)s was already removed from node %(node)s',
|
||||
{'vif': vif_id, 'node': self.id})
|
||||
session.log.debug(
|
||||
'VIF %(vif)s was already removed from node %(node)s',
|
||||
{'vif': vif_id, 'node': self.id})
|
||||
return False
|
||||
|
||||
msg = ("Failed to detach VIF {vif} from bare metal node {node}"
|
||||
|
|
|
@ -79,6 +79,7 @@ class TestWaitForAllocation(base.TestCase):
|
|||
super(TestWaitForAllocation, self).setUp()
|
||||
self.session = mock.Mock(spec=adapter.Adapter)
|
||||
self.session.default_microversion = '1.52'
|
||||
self.session.log = mock.Mock()
|
||||
self.fake = dict(FAKE, state='allocating', node_uuid=None)
|
||||
self.allocation = allocation.Allocation(**self.fake)
|
||||
|
||||
|
|
|
@ -380,6 +380,7 @@ class TestNodeVif(base.TestCase):
|
|||
super(TestNodeVif, self).setUp()
|
||||
self.session = mock.Mock(spec=adapter.Adapter)
|
||||
self.session.default_microversion = '1.28'
|
||||
self.session.log = mock.Mock()
|
||||
self.node = node.Node(id='c29db401-b6a7-4530-af8e-20a720dee946',
|
||||
driver=FAKE['driver'])
|
||||
self.vif_id = '714bdf6d-2386-4b5e-bd0d-bc036f04b1ef'
|
||||
|
@ -505,6 +506,7 @@ class TestNodeWaitForReservation(base.TestCase):
|
|||
super(TestNodeWaitForReservation, self).setUp()
|
||||
self.session = mock.Mock(spec=adapter.Adapter)
|
||||
self.session.default_microversion = '1.6'
|
||||
self.session.log = mock.Mock()
|
||||
self.node = node.Node(**FAKE)
|
||||
|
||||
def test_no_reservation(self, mock_fetch):
|
||||
|
|
Loading…
Reference in New Issue