1 In-house patch to update the default flavors for use with Solaris. |
1 In-house patch to update the default flavors for use with Solaris. |
2 This patch has not yet been submitted upstream. |
2 This patch has not yet been submitted upstream. |
3 |
3 |
4 --- nova-2013.2.3/nova/db/sqlalchemy/migrate_repo/versions/133_folsom.py.~1~ 2014-04-03 11:49:46.000000000 -0700 |
4 --- nova-2014.2.2/nova/db/sqlalchemy/migrate_repo/versions/216_havana.py.~1~ 2014-10-16 04:52:25.000000000 -0700 |
5 +++ nova-2013.2.3/nova/db/sqlalchemy/migrate_repo/versions/133_folsom.py 2014-05-19 04:14:17.367917095 -0700 |
5 +++ nova-2014.2.2/nova/db/sqlalchemy/migrate_repo/versions/216_havana.py 2014-10-21 15:34:50.909529171 -0700 |
6 @@ -2,6 +2,8 @@ |
6 @@ -1,5 +1,7 @@ |
7 |
|
8 # Copyright 2012 OpenStack Foundation |
7 # Copyright 2012 OpenStack Foundation |
9 # |
8 # |
10 +# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
9 +# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
11 +# |
10 +# |
12 # Licensed under the Apache License, Version 2.0 (the "License"); you may |
11 # Licensed under the Apache License, Version 2.0 (the "License"); you may |
13 # not use this file except in compliance with the License. You may obtain |
12 # not use this file except in compliance with the License. You may obtain |
14 # a copy of the License at |
13 # a copy of the License at |
15 @@ -37,17 +39,45 @@ |
14 @@ -85,17 +87,45 @@ def _create_shadow_tables(migrate_engine |
16 return Text().with_variant(dialects.mysql.MEDIUMTEXT(), 'mysql') |
15 raise |
17 |
16 |
18 |
17 |
19 -def _populate_instance_types(instance_types_table): |
18 -def _populate_instance_types(instance_types_table): |
20 +def _populate_instance_types(instance_types_table, instance_type_extra_specs): |
19 +def _populate_instance_types(instance_types_table, instance_type_extra_specs): |
21 default_inst_types = { |
20 default_inst_types = { |
61 i = instance_types_table.insert() |
60 i = instance_types_table.insert() |
62 + e = instance_type_extra_specs.insert() |
61 + e = instance_type_extra_specs.insert() |
63 + index = 1 |
62 + index = 1 |
64 for name, values in default_inst_types.iteritems(): |
63 for name, values in default_inst_types.iteritems(): |
65 i.execute({'name': name, 'memory_mb': values["mem"], |
64 i.execute({'name': name, 'memory_mb': values["mem"], |
66 'vcpus': values["vcpus"], 'deleted': False, |
65 'vcpus': values["vcpus"], 'deleted': 0, |
67 @@ -58,6 +88,10 @@ |
66 @@ -106,6 +136,10 @@ def _populate_instance_types(instance_ty |
68 'flavorid': values["flavid"], |
67 'flavorid': values["flavid"], |
69 'disabled': False, |
68 'disabled': False, |
70 'is_public': True}) |
69 'is_public': True}) |
71 + e.execute({'instance_type_id': index, |
70 + e.execute({'instance_type_id': index, |
72 + 'deleted': 0, 'key': 'zonecfg:brand', |
71 + 'deleted': 0, 'key': 'zonecfg:brand', |
73 + 'value': values['extra']}) |
72 + 'value': values['extra']}) |
74 + index += 1 |
73 + index += 1 |
75 except Exception: |
74 except Exception: |
76 LOG.info(repr(instance_types_table)) |
75 LOG.info(repr(instance_types_table)) |
77 LOG.exception(_('Exception while seeding instance_types table')) |
76 LOG.exception(_('Exception while seeding instance_types table')) |
78 @@ -1219,7 +1253,7 @@ |
77 @@ -1548,7 +1582,7 @@ def upgrade(migrate_engine): |
79 name='instance_info_caches_instance_id_key').create() |
78 _create_shadow_tables(migrate_engine) |
80 |
79 |
81 # populate initial instance types |
80 # populate initial instance types |
82 - _populate_instance_types(instance_types) |
81 - _populate_instance_types(instance_types) |
83 + _populate_instance_types(instance_types, instance_type_extra_specs) |
82 + _populate_instance_types(instance_types, instance_type_extra_specs) |
84 |
83 |
|
84 _create_dump_tables(migrate_engine) |
85 |
85 |
86 def downgrade(migrate_engine): |
|