Don't override brick's execute function

There was a custom_execute added into os-brick that
takes additional parameters, and now if we just pass
in putils.execute it blows up in places we call
execute with the new parameters.

Short term fix is to just pass in None by default
which gives us the custom_execute, under the hood
it just uses putils.execute anyway.

Change-Id: If5d5fdcf140a557aa2b273e65c0fcdb64aa56f17
This commit is contained in:
Patrick East
2017-06-30 09:53:24 -07:00
parent a1c0aef194
commit 8ad341db04
2 changed files with 6 additions and 10 deletions

View File

@@ -16,7 +16,6 @@ import cinderclient
from cinderclient import api_versions from cinderclient import api_versions
from cinderclient import exceptions from cinderclient import exceptions
from os_brick.initiator import connector from os_brick.initiator import connector
from oslo_concurrency import processutils
from oslo_utils import uuidutils from oslo_utils import uuidutils
from pbr import version as pbr_version from pbr import version as pbr_version
@@ -56,7 +55,7 @@ class Client(object):
self._use_legacy_attach = False self._use_legacy_attach = False
def _brick_get_connector(self, protocol, driver=None, def _brick_get_connector(self, protocol, driver=None,
execute=processutils.execute, execute=None,
use_multipath=False, use_multipath=False,
device_scan_attempts=3, device_scan_attempts=3,
*args, **kwargs): *args, **kwargs):
@@ -81,7 +80,7 @@ class Client(object):
brick_utils.get_ip(nic), brick_utils.get_ip(nic),
multipath=multipath, multipath=multipath,
enforce_multipath=(enforce_multipath), enforce_multipath=(enforce_multipath),
execute=processutils.execute) execute=None)
return conn_prop return conn_prop
def attach(self, volume_id, hostname, mountpoint=None, mode='rw', def attach(self, volume_id, hostname, mountpoint=None, mode='rw',

View File

@@ -53,12 +53,11 @@ class TestBrickClient(base.BaseTestCase):
return conn_props, mock_connect return conn_props, mock_connect
@mock.patch('oslo_concurrency.processutils.execute')
@mock.patch('brick_cinderclient_ext.brick_utils.get_my_ip') @mock.patch('brick_cinderclient_ext.brick_utils.get_my_ip')
@mock.patch('brick_cinderclient_ext.brick_utils.get_root_helper') @mock.patch('brick_cinderclient_ext.brick_utils.get_root_helper')
@mock.patch('os_brick.initiator.connector.get_connector_properties') @mock.patch('os_brick.initiator.connector.get_connector_properties')
def test_get_connector(self, mock_connector, mock_root_helper, def test_get_connector(self, mock_connector, mock_root_helper,
mock_my_ip, mock_execute): mock_my_ip):
mock_root_helper.return_value = 'root-helper' mock_root_helper.return_value = 'root-helper'
mock_my_ip.return_value = '1.0.0.0' mock_my_ip.return_value = '1.0.0.0'
@@ -66,15 +65,13 @@ class TestBrickClient(base.BaseTestCase):
mock_connector.assert_called_with('root-helper', '1.0.0.0', mock_connector.assert_called_with('root-helper', '1.0.0.0',
enforce_multipath=False, enforce_multipath=False,
multipath=False, multipath=False,
execute=mock_execute) execute=None)
@mock.patch('oslo_concurrency.processutils.execute')
@mock.patch('brick_cinderclient_ext.brick_utils.get_my_ip') @mock.patch('brick_cinderclient_ext.brick_utils.get_my_ip')
@mock.patch('brick_cinderclient_ext.brick_utils.get_root_helper') @mock.patch('brick_cinderclient_ext.brick_utils.get_root_helper')
@mock.patch('os_brick.initiator.connector.get_connector_properties') @mock.patch('os_brick.initiator.connector.get_connector_properties')
def test_get_connector_with_multipath(self, mock_connector, def test_get_connector_with_multipath(self, mock_connector,
mock_root_helper, mock_my_ip, mock_root_helper, mock_my_ip):
mock_execute):
mock_root_helper.return_value = 'root-helper' mock_root_helper.return_value = 'root-helper'
mock_my_ip.return_value = '1.0.0.0' mock_my_ip.return_value = '1.0.0.0'
@@ -82,7 +79,7 @@ class TestBrickClient(base.BaseTestCase):
mock_connector.assert_called_with('root-helper', '1.0.0.0', mock_connector.assert_called_with('root-helper', '1.0.0.0',
enforce_multipath=True, enforce_multipath=True,
multipath=True, multipath=True,
execute=mock_execute) execute=None)
def test_client_use_new_attach_no_volumes_client(self): def test_client_use_new_attach_no_volumes_client(self):
brick_client = client.Client(None) brick_client = client.Client(None)