Skip to content

Commit

Permalink
Fix the fake nova server implementation
Browse files Browse the repository at this point in the history
* rename 'hostId' attribute to 'host'
* remove duplicate initialization of 'host' attribute in account
  models.

Fixes: Bug #1235278

Change-Id: If0110bef1beec5f570209379f24f183927908218
  • Loading branch information
Robert Myers committed Oct 4, 2013
1 parent 5250639 commit eb05b12
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion trove/extensions/account/models.py
Expand Up @@ -32,7 +32,6 @@ def __init__(self, server):
self.id = server['id']
self.status = server['status']
self.name = server['name']
self.host = server['hostId']
self.host = server.get('hostId') or server['host']

@staticmethod
Expand Down
6 changes: 3 additions & 3 deletions trove/tests/fakes/nova.py
Expand Up @@ -117,7 +117,7 @@ def __init__(self, parent, owner, id, name, image_id, flavor_ref,
for volume in self.volumes:
info_vols.append({'id': volume.id})
volume.set_attachment(id)
self.hostId = FAKE_HOSTS[0]
self.host = FAKE_HOSTS[0]
self.old_host = None
setattr(self, 'OS-EXT-AZ:availability_zone', 'nova')

Expand All @@ -135,7 +135,7 @@ def confirm_resize(self):
def revert_resize(self):
if self.status != "VERIFY_RESIZE":
raise RuntimeError("Not in resize confirm mode.")
self.hostId = self.old_host
self.host = self.old_host
self.old_host = None
self.flavor_ref = self.old_flavor_ref
self.old_flavor_ref = None
Expand Down Expand Up @@ -533,7 +533,7 @@ def _servers_to_dict(self, servers):
server_dict['id'] = server.id
server_dict['name'] = server.name
server_dict['status'] = server.status
server_dict['hostId'] = server.hostId
server_dict['host'] = server.host
ret.append(server_dict)
return ret

Expand Down

0 comments on commit eb05b12

Please sign in to comment.