~ubuntu-branches/ubuntu/saucy/nova/saucy-proposed

« back to all changes in this revision

Viewing changes to nova/db/sqlalchemy/migrate_repo/versions/012_add_ipv6_flatmanager.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-05-24 13:12:53 UTC
  • mfrom: (1.1.55)
  • Revision ID: package-import@ubuntu.com-20120524131253-ommql08fg1en06ut
Tags: 2012.2~f1-0ubuntu1
* New upstream release.
* Prepare for quantal:
  - Dropped debian/patches/upstream/0006-Use-project_id-in-ec2.cloud._format_image.patch
  - Dropped debian/patches/upstream/0005-Populate-image-properties-with-project_id-again.patch
  - Dropped debian/patches/upstream/0004-Fixed-bug-962840-added-a-test-case.patch
  - Dropped debian/patches/upstream/0003-Allow-unprivileged-RADOS-users-to-access-rbd-volumes.patch
  - Dropped debian/patches/upstream/0002-Stop-libvirt-test-from-deleting-instances-dir.patch
  - Dropped debian/patches/upstream/0001-fix-bug-where-nova-ignores-glance-host-in-imageref.patch 
  - Dropped debian/patches/0001-fix-useexisting-deprecation-warnings.patch
* debian/control: Add python-keystone as a dependency. (LP: #907197)
* debian/patches/kombu_tests_timeout.patch: Refreshed.
* debian/nova.conf, debian/nova-common.postinst: Convert to new ini
  file configuration
* debian/patches/nova-manage_flagfile_location.patch: Refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (c) 2011 NTT.
2
 
# All Rights Reserved.
3
 
#
4
 
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
5
 
#    not use this file except in compliance with the License. You may obtain
6
 
#    a copy of the License at
7
 
#
8
 
#         http://www.apache.org/licenses/LICENSE-2.0
9
 
#
10
 
#    Unless required by applicable law or agreed to in writing, software
11
 
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
 
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
 
#    License for the specific language governing permissions and limitations
14
 
#    under the License.
15
 
 
16
 
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer
17
 
from sqlalchemy import MetaData, String, Table
18
 
 
19
 
 
20
 
def upgrade(migrate_engine):
21
 
    # Upgrade operations go here. Don't create your own engine;
22
 
    # bind migrate_engine to your metadata
23
 
    meta = MetaData()
24
 
    meta.bind = migrate_engine
25
 
 
26
 
    # load tables for fk
27
 
    instances = Table('instances', meta, autoload=True)
28
 
 
29
 
    networks = Table('networks', meta, autoload=True)
30
 
    fixed_ips = Table('fixed_ips', meta, autoload=True)
31
 
 
32
 
    # Alter column name
33
 
    networks.c.ra_server.alter(name='gateway_v6')
34
 
    # Add new column to existing table
35
 
    networks_netmask_v6 = Column(
36
 
            'netmask_v6',
37
 
            String(length=255, convert_unicode=False, assert_unicode=None,
38
 
                   unicode_error=None, _warn_on_bytestring=False))
39
 
    networks.create_column(networks_netmask_v6)
40
 
 
41
 
    # drop existing columns from table
42
 
    fixed_ips.c.addressV6.drop()
43
 
    fixed_ips.c.netmaskV6.drop()
44
 
    fixed_ips.c.gatewayV6.drop()
45
 
 
46
 
 
47
 
def downgrade(migrate_engine):
48
 
    meta = MetaData()
49
 
    meta.bind = migrate_engine
50
 
 
51
 
    # load tables for fk
52
 
    instances = Table('instances', meta, autoload=True)
53
 
 
54
 
    networks = Table('networks', meta, autoload=True)
55
 
    fixed_ips = Table('fixed_ips', meta, autoload=True)
56
 
 
57
 
    networks.c.gateway_v6.alter(name='ra_server')
58
 
    networks.drop_column('netmask_v6')
59
 
 
60
 
    fixed_ips_addressV6 = Column(
61
 
        "addressV6",
62
 
        String(
63
 
            length=255,
64
 
            convert_unicode=False,
65
 
            assert_unicode=None,
66
 
            unicode_error=None,
67
 
            _warn_on_bytestring=False))
68
 
 
69
 
    fixed_ips_netmaskV6 = Column(
70
 
        "netmaskV6",
71
 
        String(
72
 
            length=3,
73
 
            convert_unicode=False,
74
 
            assert_unicode=None,
75
 
            unicode_error=None,
76
 
            _warn_on_bytestring=False))
77
 
 
78
 
    fixed_ips_gatewayV6 = Column(
79
 
        "gatewayV6",
80
 
        String(
81
 
            length=255,
82
 
            convert_unicode=False,
83
 
            assert_unicode=None,
84
 
            unicode_error=None,
85
 
            _warn_on_bytestring=False))
86
 
 
87
 
    for column in (fixed_ips_addressV6,
88
 
                   fixed_ips_netmaskV6,
89
 
                   fixed_ips_gatewayV6):
90
 
        fixed_ips.create_column(column)