Merge "Fix: ServerProfile._validate_volume_type() missing 1 required positional argument: 'name_or_id'"
This commit is contained in:
commit
5552e197b3
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixed a bug where exception raised in the `_resolve_bdm` method of the
|
||||
`senlin.profile.os.nova.server` profile would cause cluster cannot create
|
||||
new nodes.
|
|
@ -50,8 +50,9 @@ class CinderClient(base.DriverBase):
|
|||
return self.conn.block_store.get_snapshot(snapshot)
|
||||
|
||||
@sdk.translate_exception
|
||||
def volume_type_get(self, volume_type):
|
||||
return self.conn.block_store.get_type(volume_type)
|
||||
def volume_type_get(self, volume_type, ignore_missing=True):
|
||||
return self.conn.block_store.find_type(volume_type,
|
||||
ignore_missing=ignore_missing)
|
||||
|
||||
@sdk.translate_exception
|
||||
def volume_type_create(self, **attr):
|
||||
|
|
|
@ -508,8 +508,9 @@ class ServerProfile(base.Profile):
|
|||
if bd[key] is None:
|
||||
del bd[key]
|
||||
if 'volume_type' in bd:
|
||||
bd['volume_type'] = self._validate_volume_type(
|
||||
bd['volume_type'])
|
||||
volume_type = self._validate_volume_type(obj,
|
||||
bd['volume_type'])
|
||||
bd['volume_type'] = volume_type.name
|
||||
if 'uuid' in bd and 'source_type' in bd:
|
||||
if bd['source_type'] == 'image':
|
||||
self._validate_image(obj, bd['uuid'], reason)
|
||||
|
@ -1104,7 +1105,7 @@ class ServerProfile(base.Profile):
|
|||
"""Check if there is a new name to be assigned to the server.
|
||||
|
||||
:param obj: The node object to operate on.
|
||||
:param new_profile: The new profile which may contain a name for
|
||||
:param profile: The new profile which may contain a name for
|
||||
the server instance.
|
||||
:return: A tuple consisting a boolean indicating whether the name
|
||||
needs change and the server name determined.
|
||||
|
@ -1185,8 +1186,6 @@ class ServerProfile(base.Profile):
|
|||
"""Update server flavor.
|
||||
|
||||
:param obj: The node object to operate on.
|
||||
:param old_flavor: The identity of the current flavor.
|
||||
:param new_flavor: The identity of the new flavor.
|
||||
:returns: Returns true if the flavor was updated or false otherwise.
|
||||
:raises: `EResourceUpdate` when operation was a failure.
|
||||
"""
|
||||
|
@ -1347,7 +1346,7 @@ class ServerProfile(base.Profile):
|
|||
# If network properties didn't contain floating ip,
|
||||
# then we should better not make a port with floating ip
|
||||
# as candidate.
|
||||
if (floating and not floating_network and not floating_ip_address):
|
||||
if floating and not floating_network and not floating_ip_address:
|
||||
continue
|
||||
port_id = net.get(self.PORT, None)
|
||||
if port_id and p['id'] != port_id:
|
||||
|
@ -1412,8 +1411,8 @@ class ServerProfile(base.Profile):
|
|||
obj.data['internal_ports'] = internal_ports
|
||||
node_obj.Node.update(self.context, obj.id, {'data': obj.data})
|
||||
|
||||
def _nw_compare(self, n1, n2, property):
|
||||
return n1.get(property, None) == n2.get(property, None)
|
||||
def _nw_compare(self, n1, n2, attribute):
|
||||
return n1.get(attribute, None) == n2.get(attribute, None)
|
||||
|
||||
def _update_network_update_port(self, obj, networks):
|
||||
"""Update existing port in network from the node.
|
||||
|
@ -1845,7 +1844,7 @@ class ServerProfile(base.Profile):
|
|||
id=obj.physical_id,
|
||||
message=str(ex))
|
||||
|
||||
if (server is None or server.status != consts.VS_ACTIVE):
|
||||
if server is None or server.status != consts.VS_ACTIVE:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
|
|
@ -102,4 +102,5 @@ class TestCinderV2(base.SenlinTestCase):
|
|||
|
||||
def test_volume_type_get(self):
|
||||
self.vo.volume_type_get('foo')
|
||||
self.volume.get_type.assert_called_once_with('foo')
|
||||
self.volume.find_type.assert_called_once_with('foo',
|
||||
ignore_missing=True)
|
||||
|
|
|
@ -98,8 +98,12 @@ class TestNovaServerBasic(base.SenlinTestCase):
|
|||
res
|
||||
)
|
||||
|
||||
def _stubout_profile(self, profile, mock_image=False, mock_flavor=False,
|
||||
mock_keypair=False, mock_net=False):
|
||||
def _stubout_profile(self, profile,
|
||||
mock_image=False,
|
||||
mock_flavor=False,
|
||||
mock_keypair=False,
|
||||
mock_net=False,
|
||||
mock_volume_type=False):
|
||||
if mock_image:
|
||||
image = mock.Mock(id='FAKE_IMAGE_ID')
|
||||
self.patchobject(profile, '_validate_image', return_value=image)
|
||||
|
@ -127,6 +131,12 @@ class TestNovaServerBasic(base.SenlinTestCase):
|
|||
}]
|
||||
self.patchobject(profile, '_create_ports_from_properties',
|
||||
return_value=fake_ports)
|
||||
if mock_volume_type:
|
||||
fake_volume_type = mock.Mock()
|
||||
fake_volume_type.id = '588854a9'
|
||||
fake_volume_type.name = 'FAKE_VOLUME_TYPE'
|
||||
self.patchobject(profile, '_validate_volume_type',
|
||||
return_value=fake_volume_type)
|
||||
|
||||
def test_do_create(self):
|
||||
cc = mock.Mock()
|
||||
|
@ -656,7 +666,8 @@ class TestNovaServerBasic(base.SenlinTestCase):
|
|||
profile._computeclient = cc
|
||||
profile._networkclient = nc
|
||||
self._stubout_profile(profile, mock_image=True, mock_flavor=True,
|
||||
mock_keypair=True, mock_net=True)
|
||||
mock_keypair=True, mock_net=True,
|
||||
mock_volume_type=True)
|
||||
mock_zone_info = self.patchobject(profile, '_update_zone_info')
|
||||
node_obj = mock.Mock(id='NODE_ID', cluster_id='', index=-1, data={})
|
||||
node_obj.name = None
|
||||
|
|
Loading…
Reference in New Issue