Use set instead of list of server_deferred_statuses

We only use this list to test for membership, so it's more efficient to
use a set.

Change-Id: I520fd87a18f37da3ae2e61c56fe00063348540b4
This commit is contained in:
Zane Bitter 2019-01-28 18:54:24 +13:00
parent e311443b6e
commit 9a4012ba9d
3 changed files with 4 additions and 4 deletions

View File

@ -48,7 +48,7 @@ CLIENT_NAME = 'nova'
class NovaClientPlugin(microversion_mixin.MicroversionMixin,
client_plugin.ClientPlugin):
deferred_server_statuses = ['BUILD',
deferred_server_statuses = {'BUILD',
'HARD_REBOOT',
'PASSWORD',
'REBOOT',
@ -57,7 +57,7 @@ class NovaClientPlugin(microversion_mixin.MicroversionMixin,
'REVERT_RESIZE',
'SHUTOFF',
'SUSPENDED',
'VERIFY_RESIZE']
'VERIFY_RESIZE'}
exceptions_module = exceptions

View File

@ -865,7 +865,7 @@ class Instance(resource.Resource, sh.SchedulerHintsMixin):
status = cp.get_status(server)
LOG.debug('%(name)s check_suspend_complete status = %(status)s',
{'name': self.name, 'status': status})
if status in list(cp.deferred_server_statuses + ['ACTIVE']):
if status in (cp.deferred_server_statuses | {'ACTIVE'}):
return status == 'SUSPENDED'
else:
exc = exception.ResourceUnknownStatus(

View File

@ -1701,7 +1701,7 @@ class Server(server_base.BaseServer, sh.SchedulerHintsMixin,
status = cp.get_status(server)
LOG.debug('%(name)s check_suspend_complete status = %(status)s',
{'name': self.name, 'status': status})
if status in list(cp.deferred_server_statuses + ['ACTIVE']):
if status in (cp.deferred_server_statuses | {'ACTIVE'}):
return status == 'SUSPENDED'
else:
exc = exception.ResourceUnknownStatus(