~ubuntu-cloud-archive/ubuntu/precise/nova/trunk

« back to all changes in this revision

Viewing changes to nova/db/sqlalchemy/migrate_repo/versions/133_aggregate_delete_fix.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Adam Gandelman, Chuck Short, Vishvananda Ishaya
  • Date: 2012-09-20 07:45:50 UTC
  • mfrom: (1.1.62)
  • Revision ID: package-import@ubuntu.com-20120920074550-fzmmmzqcntnw1vu7
Tags: 2012.2~rc1-0ubuntu1
[ Adam Gandelman ]
* Ensure /etc/nova/rootwrap.d/ is only writable by root, ensure
  those permissions on /etc/nova/rootwrap.conf as well as
  all individual filter configurations.

[ Chuck Short ]
* Fix lintian warnings
* debian/*.lograote: compress logfiles when they are rotated. (LP:
  #1049915)
* debian/control: 
  - Suggest ceph-common for nova-volume.
  - Add python-cinderclient as a build depends.

[Vishvananda Ishaya]
* Split up vncproxy and xvpvncproxy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2012 OpenStack LLC.
 
2
#
 
3
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 
4
#    not use this file except in compliance with the License. You may obtain
 
5
#    a copy of the License at
 
6
#
 
7
#         http://www.apache.org/licenses/LICENSE-2.0
 
8
#
 
9
#    Unless required by applicable law or agreed to in writing, software
 
10
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
11
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
12
#    License for the specific language governing permissions and limitations
 
13
#    under the License.
 
14
 
 
15
from sqlalchemy import String, Column, MetaData, Table
 
16
from migrate.changeset import UniqueConstraint
 
17
 
 
18
from nova.openstack.common import log as logging
 
19
 
 
20
LOG = logging.getLogger(__name__)
 
21
 
 
22
 
 
23
def upgrade(migrate_engine):
 
24
    meta = MetaData()
 
25
    meta.bind = migrate_engine
 
26
 
 
27
    dialect = migrate_engine.url.get_dialect().name
 
28
 
 
29
    aggregates = Table('aggregates', meta, autoload=True)
 
30
    if dialect.startswith('sqlite'):
 
31
        aggregates.c.name.alter(unique=False)
 
32
    elif dialect.startswith('postgres'):
 
33
        ucon = UniqueConstraint('name',
 
34
                                name='aggregates_name_key',
 
35
                                table=aggregates)
 
36
        ucon.drop()
 
37
 
 
38
    else:
 
39
        col2 = aggregates.c.name
 
40
        UniqueConstraint(col2, name='name').drop()
 
41
 
 
42
 
 
43
def downgrade(migrate_engine):
 
44
    meta = MetaData()
 
45
    meta.bind = migrate_engine
 
46
 
 
47
    aggregates = Table('aggregates', meta, autoload=True)
 
48
    aggregates.c.name.alter(unique=True)