Support host type specific block volume attachment

Add the platform and operating system type to the connector to allow a
Cinder driver to set host type specific configuration attributes when
attaching a Fibre-Channel volume.

Partial-Implements blueprint support-hosttype-on-attach

Change-Id: If37176758b4d7c16727415074ea2907589af6080
This commit is contained in:
Stefan Amann 2015-06-17 13:41:00 +02:00
parent e43d08006c
commit b1a8c2e1f1
2 changed files with 11 additions and 1 deletions

View File

@ -25,6 +25,7 @@ import os
import platform
import re
import socket
import sys
import time
from oslo_concurrency import lockutils
@ -99,6 +100,8 @@ def get_connector_properties(root_helper, my_ip, multipath, enforce_multipath,
props['multipath'] = (multipath and
_check_multipathd_running(root_helper,
enforce_multipath))
props['platform'] = platform.machine()
props['os_type'] = sys.platform
return props

View File

@ -13,6 +13,7 @@
# under the License.
import os.path
import platform
import string
import tempfile
import time
@ -46,6 +47,8 @@ class ConnectorUtilsTestCase(base.TestCase):
return_value=None)
@mock.patch.object(linuxfc.LinuxFibreChannel, 'get_fc_wwnns',
return_value=None)
@mock.patch.object(platform, 'machine', mock.Mock(return_value='s390x'))
@mock.patch('sys.platform', 'linux2')
def _test_brick_get_connector_properties(self, multipath,
enforce_multipath,
multipath_result,
@ -57,10 +60,14 @@ class ConnectorUtilsTestCase(base.TestCase):
multipath,
enforce_multipath,
host=host)
os_type = 'linux2'
platform = 's390x'
props = {'initiator': 'fakeinitiator',
'host': host,
'ip': MY_IP,
'multipath': multipath_result}
'multipath': multipath_result,
'os_type': os_type,
'platform': platform}
self.assertEqual(props, props_actual)
def test_brick_get_connector_properties(self):