diff options
| author | Unmesh Gurjar <unmesh.gurjar@vertex.co.in> | 2011-10-19 14:44:01 +0530 |
|---|---|---|
| committer | Unmesh Gurjar <unmesh.gurjar@vertex.co.in> | 2011-10-31 11:32:09 +0530 |
| commit | bef4ae509256683fefe8785ce62ef2e423009653 (patch) | |
| tree | 371af1013a3eb15842ec9cdc09450a6ea1aa96db | |
| parent | 5b8133a83939fd552b569c4b034cef43907ea1ce (diff) | |
| download | nova-bef4ae509256683fefe8785ce62ef2e423009653.tar.gz nova-bef4ae509256683fefe8785ce62ef2e423009653.tar.xz nova-bef4ae509256683fefe8785ce62ef2e423009653.zip | |
Fix lp:861160 -- newly created network has no uuid
Implemented code review changes.
Fixed issue causing pep8 build failure.
Change-Id: If2cc0e23be8d4e1558a10fa86e6ba4cdec61b7d1
| -rw-r--r-- | Authors | 1 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/api.py | 1 | ||||
| -rw-r--r-- | nova/tests/test_db_api.py | 9 |
3 files changed, 11 insertions, 0 deletions
@@ -122,6 +122,7 @@ Todd Willey <todd@ansolabs.com> Trey Morris <trey.morris@rackspace.com> Troy Toman <troy.toman@rackspace.com> Tushar Patil <tushar.vitthal.patil@gmail.com> +Unmesh Gurjar <unmesh.gurjar@vertex.co.in> Vasiliy Shlykov <vash@vasiliyshlykov.org> Vishvananda Ishaya <vishvananda@gmail.com> Vivek Y S <vivek.ys@gmail.com> diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 47efb9019..b49ae1801 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -1792,6 +1792,7 @@ def network_count_reserved_ips(context, network_id): @require_admin_context def network_create_safe(context, values): network_ref = models.Network() + network_ref['uuid'] = str(utils.gen_uuid()) network_ref.update(values) try: network_ref.save() diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py index 6f6269e52..590505a23 100644 --- a/nova/tests/test_db_api.py +++ b/nova/tests/test_db_api.py @@ -147,3 +147,12 @@ class DbApiTestCase(test.TestCase): results = db.instance_get_all_hung_in_rebooting(ctxt, 10) self.assertEqual(0, len(results)) db.instance_update(ctxt, instance.id, {"task_state": None}) + + def test_network_create_safe(self): + ctxt = context.get_admin_context() + values = {'host': 'localhost', 'project_id': 'project1'} + network = db.network_create_safe(ctxt, values) + self.assertNotEqual(None, network.uuid) + self.assertEqual(36, len(network.uuid)) + db_network = db.network_get(ctxt, network.id) + self.assertEqual(network.uuid, db_network.uuid) |
