Dell SC: Add dell_server_os configuration option

Added dell_server_os option. If a server is created on the Dell
DSM via the Dell SC Cinder driver it is created using this as
the Server OS type.

The default is still Red Hat Linux 6.x.

DocImpact
Change-Id: I681c40beef56fb29b72cb673edc8eb43cfb553e4
This commit is contained in:
Tom Swanson 2016-07-21 17:12:10 -05:00
parent 807c00f469
commit 38549395f8
6 changed files with 38 additions and 17 deletions

@ -2690,7 +2690,7 @@ class DellSCSanAPITestCase(test.TestCase):
mock_close_connection, mock_close_connection,
mock_open_connection, mock_open_connection,
mock_init): mock_init):
res = self.scapi.create_server(self.WWNS) res = self.scapi.create_server(self.WWNS, 'Red Hat Linux 6.x')
self.assertTrue(mock_create_server.called) self.assertTrue(mock_create_server.called)
self.assertTrue(mock_add_hba.called) self.assertTrue(mock_add_hba.called)
self.assertEqual(self.SCSERVER, res, 'Unexpected ScServer') self.assertEqual(self.SCSERVER, res, 'Unexpected ScServer')
@ -2719,7 +2719,7 @@ class DellSCSanAPITestCase(test.TestCase):
mock_close_connection, mock_close_connection,
mock_open_connection, mock_open_connection,
mock_init): mock_init):
res = self.scapi.create_server(self.IQN) res = self.scapi.create_server(self.IQN, 'Red Hat Linux 6.x')
self.assertTrue(mock_find_serveros.called) self.assertTrue(mock_find_serveros.called)
self.assertTrue(mock_find_server_folder.called) self.assertTrue(mock_find_server_folder.called)
self.assertTrue(mock_first_result.called) self.assertTrue(mock_first_result.called)
@ -2750,7 +2750,7 @@ class DellSCSanAPITestCase(test.TestCase):
mock_close_connection, mock_close_connection,
mock_open_connection, mock_open_connection,
mock_init): mock_init):
res = self.scapi.create_server(self.IQN) res = self.scapi.create_server(self.IQN, 'Red Hat Binux 6.x')
self.assertTrue(mock_find_serveros.called) self.assertTrue(mock_find_serveros.called)
self.assertEqual(self.SCSERVER, res, 'Unexpected ScServer') self.assertEqual(self.SCSERVER, res, 'Unexpected ScServer')
@ -2778,7 +2778,7 @@ class DellSCSanAPITestCase(test.TestCase):
mock_close_connection, mock_close_connection,
mock_open_connection, mock_open_connection,
mock_init): mock_init):
res = self.scapi.create_server(self.IQN) res = self.scapi.create_server(self.IQN, 'Red Hat Linux 6.x')
self.assertTrue(mock_find_server_folder.called) self.assertTrue(mock_find_server_folder.called)
self.assertEqual(self.SCSERVER, res, 'Unexpected ScServer') self.assertEqual(self.SCSERVER, res, 'Unexpected ScServer')
@ -2806,7 +2806,7 @@ class DellSCSanAPITestCase(test.TestCase):
mock_close_connection, mock_close_connection,
mock_open_connection, mock_open_connection,
mock_init): mock_init):
res = self.scapi.create_server(self.IQN) res = self.scapi.create_server(self.IQN, 'Red Hat Linux 6.x')
self.assertIsNone(res, 'None expected') self.assertIsNone(res, 'None expected')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi, @mock.patch.object(dell_storagecenter_api.StorageCenterApi,
@ -2834,7 +2834,7 @@ class DellSCSanAPITestCase(test.TestCase):
mock_open_connection, mock_open_connection,
mock_init): mock_init):
# Test create server where _first_result is None # Test create server where _first_result is None
res = self.scapi.create_server(self.IQN) res = self.scapi.create_server(self.IQN, 'Red Hat Linux 6.x')
self.assertIsNone(res, 'None expected') self.assertIsNone(res, 'None expected')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi, @mock.patch.object(dell_storagecenter_api.StorageCenterApi,
@ -2866,7 +2866,7 @@ class DellSCSanAPITestCase(test.TestCase):
mock_open_connection, mock_open_connection,
mock_init): mock_init):
# Tests create server where add hba fails # Tests create server where add hba fails
res = self.scapi.create_server(self.IQN) res = self.scapi.create_server(self.IQN, 'Red Hat Linux 6.x')
self.assertTrue(mock_delete_server.called) self.assertTrue(mock_delete_server.called)
self.assertIsNone(res, 'None expected') self.assertIsNone(res, 'None expected')

@ -1287,6 +1287,7 @@ class StorageCenterApi(object):
best for Red Hat and Ubuntu. So we use that. best for Red Hat and Ubuntu. So we use that.
:param osname: The name of the OS to look for. :param osname: The name of the OS to look for.
:param ssn: ssn of the backend SC to use. Default if -1.
:returns: InstanceId of the ScServerOperatingSystem object. :returns: InstanceId of the ScServerOperatingSystem object.
""" """
ssn = self._vet_ssn(ssn) ssn = self._vet_ssn(ssn)
@ -1306,19 +1307,22 @@ class StorageCenterApi(object):
return None return None
def create_server(self, wwnlist, ssn=-1): def create_server(self, wwnlist, serveros, ssn=-1):
"""Creates a server with multiple WWNS associated with it. """Creates a server with multiple WWNS associated with it.
Same as create_server except it can take a list of HBAs. Same as create_server except it can take a list of HBAs.
:param wwnlist: A list of FC WWNs or iSCSI IQNs associated with this :param wwnlist: A list of FC WWNs or iSCSI IQNs associated with this
server. server.
:param serveros: Name of server OS to use when creating the server.
:param ssn: ssn of the backend SC to use. Default if -1.
:returns: Dell server object. :returns: Dell server object.
""" """
# Find our folder or make it # Find our folder or make it
folder = self._find_server_folder(True, ssn) folder = self._find_server_folder(True, ssn)
# Create our server. # Create our server.
scserver = self._create_server('Server_' + wwnlist[0], folder, ssn) scserver = self._create_server('Server_' + wwnlist[0], folder,
serveros, ssn)
if not scserver: if not scserver:
return None return None
# Add our HBAs. # Add our HBAs.
@ -1331,7 +1335,7 @@ class StorageCenterApi(object):
return None return None
return scserver return scserver
def _create_server(self, servername, folder, ssn): def _create_server(self, servername, folder, serveros, ssn):
ssn = self._vet_ssn(ssn) ssn = self._vet_ssn(ssn)
LOG.info(_LI('Creating server %s'), servername) LOG.info(_LI('Creating server %s'), servername)
@ -1341,7 +1345,9 @@ class StorageCenterApi(object):
payload['Notes'] = self.notes payload['Notes'] = self.notes
# We pick Red Hat Linux 6.x because it supports multipath and # We pick Red Hat Linux 6.x because it supports multipath and
# will attach luns to paths as they are found. # will attach luns to paths as they are found.
scserveros = self._find_serveros('Red Hat Linux 6.x', ssn) scserveros = self._find_serveros(serveros, ssn)
if not scserveros:
scserveros = self._find_serveros(ssn=ssn)
if scserveros is not None: if scserveros is not None:
payload['OperatingSystem'] = scserveros payload['OperatingSystem'] = scserveros
@ -1494,7 +1500,6 @@ class StorageCenterApi(object):
LOG.info(_LI('Volume mappings for %(name)s: %(mappings)s'), LOG.info(_LI('Volume mappings for %(name)s: %(mappings)s'),
{'name': scvolume.get('name'), {'name': scvolume.get('name'),
'mappings': mappings}) 'mappings': mappings})
return mappings return mappings
def _find_mapping_profiles(self, scvolume): def _find_mapping_profiles(self, scvolume):

@ -60,7 +60,11 @@ common_opts = [
cfg.MultiOpt('excluded_domain_ip', cfg.MultiOpt('excluded_domain_ip',
item_type=types.IPAddress(), item_type=types.IPAddress(),
default=None, default=None,
help='Domain IP to be excluded from iSCSI returns.') help='Domain IP to be excluded from iSCSI returns.'),
cfg.StrOpt('dell_server_os',
default='Red Hat Linux 6.x',
help='Server OS type to use when creating a new server on the '
'Storage Center.')
] ]
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

@ -94,7 +94,8 @@ class DellStorageCenterFCDriver(dell_storagecenter_common.DellCommonDriver,
# No? Create it. # No? Create it.
if scserver is None: if scserver is None:
scserver = api.create_server(wwpns) scserver = api.create_server(
wwpns, self.configuration.dell_server_os)
# Find the volume on the storage center. # Find the volume on the storage center.
scvolume = api.find_volume(volume_name, provider_id, islivevol) scvolume = api.find_volume(volume_name, provider_id, islivevol)
if scserver is not None and scvolume is not None: if scserver is not None and scvolume is not None:
@ -164,7 +165,8 @@ class DellStorageCenterFCDriver(dell_storagecenter_common.DellCommonDriver,
# No? Create it. # No? Create it.
if secondary is None: if secondary is None:
secondary = api.create_server( secondary = api.create_server(
wwns, sclivevolume['secondaryScSerialNumber']) wwns, self.configuration.dell_server_os,
sclivevolume['secondaryScSerialNumber'])
if secondary: if secondary:
if api.map_secondary_volume(sclivevolume, secondary): if api.map_secondary_volume(sclivevolume, secondary):
# Get mappings. # Get mappings.

@ -99,7 +99,8 @@ class DellStorageCenterISCSIDriver(dell_storagecenter_common.DellCommonDriver,
scserver = api.find_server(initiator_name) scserver = api.find_server(initiator_name)
# No? Create it. # No? Create it.
if scserver is None: if scserver is None:
scserver = api.create_server([initiator_name]) scserver = api.create_server(
[initiator_name], self.configuration.dell_server_os)
# Find the volume on the storage center. # Find the volume on the storage center.
scvolume = api.find_volume(volume_name, provider_id) scvolume = api.find_volume(volume_name, provider_id)
@ -177,7 +178,8 @@ class DellStorageCenterISCSIDriver(dell_storagecenter_common.DellCommonDriver,
# No? Create it. # No? Create it.
if secondary is None: if secondary is None:
secondary = api.create_server( secondary = api.create_server(
[initiatorname], sclivevolume['secondaryScSerialNumber']) [initiatorname], self.configuration.dell_server_os,
sclivevolume['secondaryScSerialNumber'])
if secondary: if secondary:
if api.map_secondary_volume(sclivevolume, secondary): if api.map_secondary_volume(sclivevolume, secondary):
# Get our volume and get our properties. # Get our volume and get our properties.

@ -0,0 +1,8 @@
---
features:
- dell_server_os option added to the Dell SC driver.
This option allows the selection of the server type
used when creating a server on the Dell DSM during
initialize connection. This is only used if the
server does not exist. Valid values are from the
Dell DSM create server list.