1296 + {'database': self.migrate_engine.url.database, |
1296 + {'database': self.migrate_engine.url.database, |
1297 + 'mysql_storage_engine': CONF.database.mysql_storage_engine}) |
1297 + 'mysql_storage_engine': CONF.database.mysql_storage_engine}) |
1298 count = noninnodb.scalar() |
1298 count = noninnodb.scalar() |
1299 self.assertEqual(count, 0, "%d non InnoDB tables created" % count) |
1299 self.assertEqual(count, 0, "%d non InnoDB tables created" % count) |
1300 |
1300 |
|
1301 --- nova-13.1.0/nova/db/sqlalchemy/api.py.orig 2016-10-31 15:15:23.984379619 +0000 |
|
1302 +++ nova-13.1.0/nova/db/sqlalchemy/api.py 2016-10-31 15:15:50.528785047 +0000 |
|
1303 @@ -2920,11 +2920,17 @@ def instance_info_cache_update(context, |
|
1304 needs_create = True |
|
1305 |
|
1306 try: |
|
1307 - with main_context_manager.writer.savepoint.using(context): |
|
1308 + if CONF.database.mysql_storage_engine == 'NDBCLUSTER': |
|
1309 if needs_create: |
|
1310 info_cache.save(context.session) |
|
1311 else: |
|
1312 info_cache.update(values) |
|
1313 + else: |
|
1314 + with main_context_manager.writer.savepoint.using(context): |
|
1315 + if needs_create: |
|
1316 + info_cache.save(context.session) |
|
1317 + else: |
|
1318 + info_cache.update(values) |
|
1319 except db_exc.DBDuplicateEntry: |
|
1320 # NOTE(sirp): Possible race if two greenthreads attempt to |
|
1321 # recreate the instance cache entry at the same time. First one |
|
1322 @@ -4282,8 +4288,11 @@ def security_group_create(context, value |
|
1323 security_group_ref.rules |
|
1324 security_group_ref.update(values) |
|
1325 try: |
|
1326 - with main_context_manager.writer.savepoint.using(context): |
|
1327 + if CONF.database.mysql_storage_engine == 'NDBCLUSTER': |
|
1328 security_group_ref.save(context.session) |
|
1329 + else: |
|
1330 + with main_context_manager.writer.savepoint.using(context): |
|
1331 + security_group_ref.save(context.session) |
|
1332 except db_exc.DBDuplicateEntry: |
|
1333 raise exception.SecurityGroupExists( |
|
1334 project_id=values['project_id'], |
|
1335 @@ -5220,17 +5229,25 @@ def flavor_extra_specs_update_or_create( |
|
1336 for spec_ref in spec_refs: |
|
1337 key = spec_ref["key"] |
|
1338 existing_keys.add(key) |
|
1339 - with main_context_manager.writer.savepoint.using(context): |
|
1340 + if CONF.database.mysql_storage_engine == 'NDBCLUSTER': |
|
1341 spec_ref.update({"value": specs[key]}) |
|
1342 + else: |
|
1343 + with main_context_manager.writer.savepoint.using(context): |
|
1344 + spec_ref.update({"value": specs[key]}) |
|
1345 |
|
1346 for key, value in specs.items(): |
|
1347 if key in existing_keys: |
|
1348 continue |
|
1349 spec_ref = models.InstanceTypeExtraSpecs() |
|
1350 - with main_context_manager.writer.savepoint.using(context): |
|
1351 + if CONF.database.mysql_storage_engine == 'NDBCLUSTER': |
|
1352 spec_ref.update({"key": key, "value": value, |
|
1353 "instance_type_id": instance_type_id}) |
|
1354 context.session.add(spec_ref) |
|
1355 + else: |
|
1356 + with main_context_manager.writer.savepoint.using(context): |
|
1357 + spec_ref.update({"key": key, "value": value, |
|
1358 + "instance_type_id": instance_type_id}) |
|
1359 + context.session.add(spec_ref) |
|
1360 |
|
1361 return specs |
|
1362 except db_exc.DBDuplicateEntry: |
|
1363 @@ -6824,8 +6841,11 @@ def instance_tag_add(context, instance_u |
|
1364 |
|
1365 try: |
|
1366 _check_instance_exists_in_project(context, instance_uuid) |
|
1367 - with get_context_manager(context).writer.savepoint.using(context): |
|
1368 + if CONF.database.mysql_storage_engine == 'NDBCLUSTER': |
|
1369 context.session.add(tag_ref) |
|
1370 + else: |
|
1371 + with get_context_manager(context).writer.savepoint.using(context): |
|
1372 + context.session.add(tag_ref) |
|
1373 except db_exc.DBDuplicateEntry: |
|
1374 # NOTE(snikitin): We should ignore tags duplicates |
|
1375 pass |