diff options
| author | Trey Morris <trey.morris@rackspace.com> | 2011-06-30 14:20:59 -0500 |
|---|---|---|
| committer | Trey Morris <trey.morris@rackspace.com> | 2011-06-30 14:20:59 -0500 |
| commit | fa8f7421f48a3bd1f6b01b2ff3cc754c24e0a424 (patch) | |
| tree | a1cbb2835c9c8bd6ea9866115d4fb22c8b1b0aae /nova/db | |
| parent | 46c321d044d6a2db44a22466624a1e7dc71d5935 (diff) | |
| parent | c7ee39c3d00fdc799850b308fefd08f482edb5e5 (diff) | |
trunk merge with migration renumbering
Diffstat (limited to 'nova/db')
| -rw-r--r-- | nova/db/api.py | 2 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/api.py | 2 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/migrate_repo/versions/029_add_zone_weight_offsets.py | 38 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/migrate_repo/versions/030_multi_nic.py (renamed from nova/db/sqlalchemy/migrate_repo/versions/029_multi_nic.py) | 0 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/migrate_repo/versions/031_fk_fixed_ips_virtual_interface_id.py (renamed from nova/db/sqlalchemy/migrate_repo/versions/030_fk_fixed_ips_virtual_interface_id.py) | 0 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/migrate_repo/versions/031_sqlite_downgrade.sql (renamed from nova/db/sqlalchemy/migrate_repo/versions/030_sqlite_downgrade.sql) | 0 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/migrate_repo/versions/031_sqlite_upgrade.sql (renamed from nova/db/sqlalchemy/migrate_repo/versions/030_sqlite_upgrade.sql) | 0 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/models.py | 4 |
8 files changed, 43 insertions, 3 deletions
diff --git a/nova/db/api.py b/nova/db/api.py index 14998a7a0..b7c5700e5 100644 --- a/nova/db/api.py +++ b/nova/db/api.py @@ -1338,7 +1338,7 @@ def zone_create(context, values): def zone_update(context, zone_id, values): """Update a child Zone entry.""" - return IMPL.zone_update(context, values) + return IMPL.zone_update(context, zone_id, values) def zone_delete(context, zone_id): diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 4b77e4dc9..a5ebb1195 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -3042,7 +3042,7 @@ def zone_update(context, zone_id, values): if not zone: raise exception.ZoneNotFound(zone_id=zone_id) zone.update(values) - zone.save() + zone.save(session=session) return zone diff --git a/nova/db/sqlalchemy/migrate_repo/versions/029_add_zone_weight_offsets.py b/nova/db/sqlalchemy/migrate_repo/versions/029_add_zone_weight_offsets.py new file mode 100644 index 000000000..1b7871e5f --- /dev/null +++ b/nova/db/sqlalchemy/migrate_repo/versions/029_add_zone_weight_offsets.py @@ -0,0 +1,38 @@ +# Copyright 2011 OpenStack LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from sqlalchemy import Column, Float, Integer, MetaData, Table + +meta = MetaData() + +zones = Table('zones', meta, + Column('id', Integer(), primary_key=True, nullable=False), + ) + +weight_offset = Column('weight_offset', Float(), default=0.0) +weight_scale = Column('weight_scale', Float(), default=1.0) + + +def upgrade(migrate_engine): + meta.bind = migrate_engine + + zones.create_column(weight_offset) + zones.create_column(weight_scale) + + +def downgrade(migrate_engine): + meta.bind = migrate_engine + + zones.drop_column(weight_offset) + zones.drop_column(weight_scale) diff --git a/nova/db/sqlalchemy/migrate_repo/versions/029_multi_nic.py b/nova/db/sqlalchemy/migrate_repo/versions/030_multi_nic.py index 4a117bb11..4a117bb11 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/029_multi_nic.py +++ b/nova/db/sqlalchemy/migrate_repo/versions/030_multi_nic.py diff --git a/nova/db/sqlalchemy/migrate_repo/versions/030_fk_fixed_ips_virtual_interface_id.py b/nova/db/sqlalchemy/migrate_repo/versions/031_fk_fixed_ips_virtual_interface_id.py index 56e927717..56e927717 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/030_fk_fixed_ips_virtual_interface_id.py +++ b/nova/db/sqlalchemy/migrate_repo/versions/031_fk_fixed_ips_virtual_interface_id.py diff --git a/nova/db/sqlalchemy/migrate_repo/versions/030_sqlite_downgrade.sql b/nova/db/sqlalchemy/migrate_repo/versions/031_sqlite_downgrade.sql index c1d26b180..c1d26b180 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/030_sqlite_downgrade.sql +++ b/nova/db/sqlalchemy/migrate_repo/versions/031_sqlite_downgrade.sql diff --git a/nova/db/sqlalchemy/migrate_repo/versions/030_sqlite_upgrade.sql b/nova/db/sqlalchemy/migrate_repo/versions/031_sqlite_upgrade.sql index 2a9362545..2a9362545 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/030_sqlite_upgrade.sql +++ b/nova/db/sqlalchemy/migrate_repo/versions/031_sqlite_upgrade.sql diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py index fe899cc4f..d29d3d6f1 100644 --- a/nova/db/sqlalchemy/models.py +++ b/nova/db/sqlalchemy/models.py @@ -21,7 +21,7 @@ SQLAlchemy models for nova data. from sqlalchemy.orm import relationship, backref, object_mapper from sqlalchemy import Column, Integer, String, schema -from sqlalchemy import ForeignKey, DateTime, Boolean, Text +from sqlalchemy import ForeignKey, DateTime, Boolean, Text, Float from sqlalchemy.exc import IntegrityError from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.schema import ForeignKeyConstraint @@ -756,6 +756,8 @@ class Zone(BASE, NovaBase): api_url = Column(String(255)) username = Column(String(255)) password = Column(String(255)) + weight_offset = Column(Float(), default=0.0) + weight_scale = Column(Float(), default=1.0) class AgentBuild(BASE, NovaBase): |
