Merge "Dell SC: Add dell_server_os configuration option"
This commit is contained in:
@@ -2690,7 +2690,7 @@ class DellSCSanAPITestCase(test.TestCase):
|
||||
mock_close_connection,
|
||||
mock_open_connection,
|
||||
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_add_hba.called)
|
||||
self.assertEqual(self.SCSERVER, res, 'Unexpected ScServer')
|
||||
@@ -2719,7 +2719,7 @@ class DellSCSanAPITestCase(test.TestCase):
|
||||
mock_close_connection,
|
||||
mock_open_connection,
|
||||
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_server_folder.called)
|
||||
self.assertTrue(mock_first_result.called)
|
||||
@@ -2750,7 +2750,7 @@ class DellSCSanAPITestCase(test.TestCase):
|
||||
mock_close_connection,
|
||||
mock_open_connection,
|
||||
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.assertEqual(self.SCSERVER, res, 'Unexpected ScServer')
|
||||
|
||||
@@ -2778,7 +2778,7 @@ class DellSCSanAPITestCase(test.TestCase):
|
||||
mock_close_connection,
|
||||
mock_open_connection,
|
||||
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.assertEqual(self.SCSERVER, res, 'Unexpected ScServer')
|
||||
|
||||
@@ -2806,7 +2806,7 @@ class DellSCSanAPITestCase(test.TestCase):
|
||||
mock_close_connection,
|
||||
mock_open_connection,
|
||||
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')
|
||||
|
||||
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
|
||||
@@ -2834,7 +2834,7 @@ class DellSCSanAPITestCase(test.TestCase):
|
||||
mock_open_connection,
|
||||
mock_init):
|
||||
# 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')
|
||||
|
||||
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
|
||||
@@ -2866,7 +2866,7 @@ class DellSCSanAPITestCase(test.TestCase):
|
||||
mock_open_connection,
|
||||
mock_init):
|
||||
# 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.assertIsNone(res, 'None expected')
|
||||
|
||||
|
||||
@@ -1287,6 +1287,7 @@ class StorageCenterApi(object):
|
||||
best for Red Hat and Ubuntu. So we use that.
|
||||
|
||||
: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.
|
||||
"""
|
||||
ssn = self._vet_ssn(ssn)
|
||||
@@ -1306,19 +1307,22 @@ class StorageCenterApi(object):
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
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.
|
||||
"""
|
||||
# Find our folder or make it
|
||||
folder = self._find_server_folder(True, ssn)
|
||||
# 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:
|
||||
return None
|
||||
# Add our HBAs.
|
||||
@@ -1331,7 +1335,7 @@ class StorageCenterApi(object):
|
||||
return None
|
||||
return scserver
|
||||
|
||||
def _create_server(self, servername, folder, ssn):
|
||||
def _create_server(self, servername, folder, serveros, ssn):
|
||||
ssn = self._vet_ssn(ssn)
|
||||
|
||||
LOG.info(_LI('Creating server %s'), servername)
|
||||
@@ -1341,7 +1345,9 @@ class StorageCenterApi(object):
|
||||
payload['Notes'] = self.notes
|
||||
# We pick Red Hat Linux 6.x because it supports multipath and
|
||||
# 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:
|
||||
payload['OperatingSystem'] = scserveros
|
||||
|
||||
@@ -1494,7 +1500,6 @@ class StorageCenterApi(object):
|
||||
LOG.info(_LI('Volume mappings for %(name)s: %(mappings)s'),
|
||||
{'name': scvolume.get('name'),
|
||||
'mappings': mappings})
|
||||
|
||||
return mappings
|
||||
|
||||
def _find_mapping_profiles(self, scvolume):
|
||||
|
||||
@@ -60,7 +60,11 @@ common_opts = [
|
||||
cfg.MultiOpt('excluded_domain_ip',
|
||||
item_type=types.IPAddress(),
|
||||
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__)
|
||||
|
||||
@@ -94,7 +94,8 @@ class DellStorageCenterFCDriver(dell_storagecenter_common.DellCommonDriver,
|
||||
|
||||
# No? Create it.
|
||||
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.
|
||||
scvolume = api.find_volume(volume_name, provider_id, islivevol)
|
||||
if scserver is not None and scvolume is not None:
|
||||
@@ -164,7 +165,8 @@ class DellStorageCenterFCDriver(dell_storagecenter_common.DellCommonDriver,
|
||||
# No? Create it.
|
||||
if secondary is None:
|
||||
secondary = api.create_server(
|
||||
wwns, sclivevolume['secondaryScSerialNumber'])
|
||||
wwns, self.configuration.dell_server_os,
|
||||
sclivevolume['secondaryScSerialNumber'])
|
||||
if secondary:
|
||||
if api.map_secondary_volume(sclivevolume, secondary):
|
||||
# Get mappings.
|
||||
|
||||
@@ -99,7 +99,8 @@ class DellStorageCenterISCSIDriver(dell_storagecenter_common.DellCommonDriver,
|
||||
scserver = api.find_server(initiator_name)
|
||||
# No? Create it.
|
||||
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.
|
||||
scvolume = api.find_volume(volume_name, provider_id)
|
||||
|
||||
@@ -177,7 +178,8 @@ class DellStorageCenterISCSIDriver(dell_storagecenter_common.DellCommonDriver,
|
||||
# No? Create it.
|
||||
if secondary is None:
|
||||
secondary = api.create_server(
|
||||
[initiatorname], sclivevolume['secondaryScSerialNumber'])
|
||||
[initiatorname], self.configuration.dell_server_os,
|
||||
sclivevolume['secondaryScSerialNumber'])
|
||||
if secondary:
|
||||
if api.map_secondary_volume(sclivevolume, secondary):
|
||||
# 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.
|
||||
Reference in New Issue
Block a user