Skip to content

Commit

Permalink
Should finish allocating network before VM reaches ACTIVE
Browse files Browse the repository at this point in the history
This patch can fix issues like tempest caused by async
network allocation. Nova uses NetworkInfoAsyncWrapper
to allocate network in an async manner, and this allows
one to start querying for network info before you know
you will need it. Nova will invoke refresh_cache method
to update instance_cache_info after excuting the
allocate_for_instance method as well.

However, nova rest api will query instance_cache_info
directly, thus maybe get the empty network info before
instance_cache_info table has been updated asynchronously.
Thus will cause VM can exist without a known address
accidentally, the caller is difficult to distinguish
this situation, unless waiting for some internal process
or it will not have an address. So should finish
allocating network before the VM reaches ACTIVE status.
For more detail can refer the bug description.

BTW, almost all create server related unit tests have
coverred this case.

Closes-Bug: #1210483
Change-Id: Iab542df1be7d5c9661d717ec596d2a37b975169a
  • Loading branch information
zhhuabj committed Aug 25, 2013
1 parent 8805ed7 commit c51f238
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nova/compute/manager.py
Expand Up @@ -1323,6 +1323,8 @@ def _set_access_ip_values():
if set_access_ip:
_set_access_ip_values()

if network_info is not None:
network_info.wait(do_raise=True)
return self._instance_update(context, instance['uuid'],
**update_data)

Expand Down

0 comments on commit c51f238

Please sign in to comment.