Skip to content

Commit

Permalink
create_db_entry_for_new_instance did not call sgh for default
Browse files Browse the repository at this point in the history
When an instance is launched create_db_entry_for_new_instance() is
called which calls self.db.instance_create(). Then,
db.security_group_ensure_default() is called which creates the
default security group entry in the nova db. Though the sgh handler was
not called. Alternatively, if any nova secgroup-* call is made the sgh
is called which creates the default security group. This patch adds
a call to ensure_default() before db.instance_create() so the sgh
is called. Fixes a case missed in  bug 1050982

Change-Id: I9649b5ef026ca18a55abfb66e87fd0e358eba6f2
  • Loading branch information
aaronorosen committed Nov 14, 2012
1 parent dbe2b2d commit 45402ff
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nova/compute/api.py
Expand Up @@ -732,6 +732,10 @@ def create_db_entry_for_new_instance(self, context, instance_type, image,
self._populate_instance_shutdown_terminate(instance, image,
block_device_mapping)

# ensure_default security group is called before the instance
# is created so the creation of the default security group is
# proxied to the sgh.
self.security_group_api.ensure_default(context)
instance = self.db.instance_create(context, instance)

self._populate_instance_for_bdm(context, instance,
Expand Down

0 comments on commit 45402ff

Please sign in to comment.