Merge lp:~termie/nova/db_migration into lp:~hudson-openstack/nova/trunk
- db_migration
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Vish Ishaya |
Approved revision: | 565 |
Merged at revision: | 581 |
Proposed branch: | lp:~termie/nova/db_migration |
Merge into: | lp:~hudson-openstack/nova/trunk |
Diff against target: |
1141 lines (+920/-88) 15 files modified
MANIFEST.in (+1/-0) bin/nova-manage (+18/-1) nova/db/migration.py (+38/-0) nova/db/sqlalchemy/__init__.py (+0/-28) nova/db/sqlalchemy/migrate_repo/README (+4/-0) nova/db/sqlalchemy/migrate_repo/manage.py (+4/-0) nova/db/sqlalchemy/migrate_repo/migrate.cfg (+20/-0) nova/db/sqlalchemy/migrate_repo/versions/001_austin.py (+547/-0) nova/db/sqlalchemy/migrate_repo/versions/002_bexar.py (+209/-0) nova/db/sqlalchemy/migration.py (+72/-0) nova/db/sqlalchemy/models.py (+0/-45) nova/service.py (+0/-13) nova/tests/__init__.py (+5/-0) run_tests.py (+1/-1) tools/pip-requires (+1/-0) |
To merge this branch: | bzr merge lp:~termie/nova/db_migration |
Related bugs: | |
Related blueprints: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
termie (community) | Approve | ||
Jay Pipes (community) | Approve | ||
Thierry Carrez (community) | ffe | Approve | |
Todd Willey (community) | Approve | ||
Devin Carlen (community) | Approve | ||
Review via email: mp+46073@code.launchpad.net |
Commit message
Description of the change
Allows moving from the Austin-style db to the Bexar-style.
Prevents the db from being created automatically when services run.
Adds nova-manage db sync and nova manage db version to bring the db up-to-date and to check the current version. Must be run with the same privileges as the services who will access the database (or you need to chmod the db afterwards if sqlite)
Todd Willey (xtoddx) wrote : | # |
Awesome.
It would be great to have more sphinx docs about this, from the standpoint of developer needing to modify the schema, as well as a service provider needing to use nova-manage to keep their schema up to date.
OpenStack Infra (hudson-openstack) wrote : | # |
The attempt to merge lp:~termie/nova/db_migration into lp:nova failed. Below is the output from the failed tests.
Soren Hansen (soren) wrote : | # |
/me looks into this.
2011/1/13 OpenStack Hudson <email address hidden>:
> The attempt to merge lp:~termie/nova/db_migration into lp:nova failed. Below is the output from the failed tests.
>
>
>
> --
> https:/
> You are subscribed to branch lp:nova.
>
--
Soren Hansen <email address hidden>
Systems Architect, The Rackspace Cloud
Ubuntu Developer
Soren Hansen (soren) wrote : | # |
python-migrate and python-tempita installed on Hudson box. Retrying.
OpenStack Infra (hudson-openstack) wrote : | # |
The attempt to merge lp:~termie/nova/db_migration into lp:nova failed. Below is the output from the failed tests.
TrialTestCase
runTest ok
AdminAPITest
test_
test_
APITest
test_
Test
test_
test_
test_bad_token ok
test_bad_user ok
test_no_user ok
test_
TestLimiter
test_
TestFaults
test_
test_raise ok
test_
FlavorsTest
test_
test_
GlanceImageServ
test_create ok
test_
test_delete ok
test_update ok
ImageController
test_
test_
LocalImageServi
test_create ok
test_
test_delete ok
test_update ok
LimiterTest
test_minute ok
test_
test_second ok
test_
test_
WSGIAppProxyTest
test_200 ok
test_403 ok
test_failure ok
WSGIAppTest
test_escaping ok
test_good_urls ok
test_
test_
test_
ServersTest
test_
test_
test_
test_
termie (termie) wrote : | # |
looks like something new was added in trunk that found an error in the migration :) (i was dumb and didn't run the tests in the merge branch) anyway, looking into it
termie (termie) wrote : | # |
the column creation isn't working as documented as far as i can tell, rawwwrrrr
termie (termie) wrote : | # |
alright, column creation is working fine, there have just been changes to the models in trunk whilst i was not looking, wee.
should work fine now.
OpenStack Infra (hudson-openstack) wrote : | # |
Attempt to merge into lp:nova failed due to conflicts:
text conflict in tools/pip-requires
Thierry Carrez (ttx) wrote : | # |
This just needs a few more hours to get in. FFe approved for landing before Monday.
termie (termie) wrote : | # |
pushed new version, however there are currently pep8 violations in trunk so i expect there will be more conflicts, i have already fixed the violations in a different branch and i expect somebody else will fix them too... so.... dumb.
OpenStack Infra (hudson-openstack) wrote : | # |
The attempt to merge lp:~termie/nova/db_migration into lp:nova failed. Below is the output from the failed tests.
AdminAPITest
test_
test_
APITest
test_
Test
test_
test_
test_bad_token ok
test_bad_user ok
test_no_user ok
test_
TestLimiter
test_
TestFaults
test_
test_raise ok
test_
FlavorsTest
test_
test_
GlanceImageServ
test_create ok
test_
test_delete ok
test_update ok
ImageController
test_
test_
LocalImageServi
test_create ok
test_
test_delete ok
test_update ok
LimiterTest
test_minute ok
test_
test_second ok
test_
test_
WSGIAppProxyTest
test_200 ok
test_403 ok
test_failure ok
WSGIAppTest
test_escaping ok
test_good_urls ok
test_
test_
test_
ServersTest
test_
test_
test_
test_
test_
test...
termie (termie) wrote : | # |
i'm going to wait a day or so for things to settle before I try to commit this again, tracking other people's schema changes commit-to-commit isn't really on my list of fun things.
Thierry Carrez (ttx) wrote : | # |
@termie: due to featurefreeze you should have the necessary stability for merging this now.
I see only one branch in queue still modifying the schema (https:/
Jay Pipes (jaypipes) wrote : | # |
Heyo.
Mostly good (and necessary!) stuff, Andy. Nice job.
Here's a couple things to address, though (outside of the merge stuff you're currently looking at):
1) Please add sqlalchemy-
2) Copy/paste docstring fail here :)
22 + def sync(self, version=None):
23 + """adds role to user
24 + if project is specified, adds project specific role
25 + arguments: user, role [project]"""
26 + return migration.
3) Nova != Django :)
135 === added file 'nova/db/
136 === added file 'nova/db/
137 --- nova/db/
138 +++ nova/db/
139 @@ -0,0 +1,4 @@
140 +#!/usr/bin/env python
141 +from migrate.
142 +if __name__ == '__main__':
143 + main(debug='False', repository='.')
Not sure if the above is necessary considering the nova-manage db sync. Was this just to achieve parity with Django? I didn't see this script being used anywhere.
4) This code:
951 +def db_sync(
952 + db_version()
953 + repo_path = _find_migrate_
954 + return versioning_
Looks like there is something missing... db_version() returns the numeric version of the database, if it is versioned (returning 0 if not versioned). May I suggest changing the above code to the following:
def db_sync(version=1):
cur_version = db_version()
repo_path = _find_migrate_
if version > cur_version:
return versioning_
return True
Cheers!
jay
termie (termie) wrote : | # |
> Heyo.
>
> Mostly good (and necessary!) stuff, Andy. Nice job.
>
> Here's a couple things to address, though (outside of the merge stuff you're
> currently looking at):
>
> 1) Please add sqlalchemy-
> bomb in a virtualenv
>
sqlalchemy-migrate is already in there.
> 2) Copy/paste docstring fail here :)
>
> 22 + def sync(self, version=None):
> 23 + """adds role to user
> 24 + if project is specified, adds project specific role
> 25 + arguments: user, role [project]"""
> 26 + return migration.
Nice catch.
>
> 3) Nova != Django :)
>
> 135 === added file 'nova/db/
> 136 === added file 'nova/db/
> 137 --- nova/db/
> +0000
> 138 +++ nova/db/
> +0000
> 139 @@ -0,0 +1,4 @@
> 140 +#!/usr/bin/env python
> 141 +from migrate.
> 142 +if __name__ == '__main__':
> 143 + main(debug='False', repository='.')
>
> Not sure if the above is necessary considering the nova-manage db sync. Was
> this just to achieve parity with Django? I didn't see this script being used
> anywhere.
>
This has nothing to do with django, this is the default repository format for sqlalchemy-migrate. There is, however an indentation error.
> 4) This code:
>
> 951 +def db_sync(
> 952 + db_version()
> 953 + repo_path = _find_migrate_
> 954 + return versioning_
> version)
>
> Looks like there is something missing... db_version() returns the numeric
> version of the database, if it is versioned (returning 0 if not versioned).
db_versions ensures that the db version is set correctly (1 if they already had the austin db, 0 if the db is empty).
> May I suggest changing the above code to the following:
>
> def db_sync(version=1):
> cur_version = db_version()
> repo_path = _find_migrate_
> if version > cur_version:
> return versioning_
> return True
>
> Cheers!
Sync already knows about updates and won't update if the version is correct.
I'll fix the nova-manage documentation, however this branch is now waiting on discussion about the live_migration branch.
>
> jay
Jay Pipes (jaypipes) wrote : | # |
> sqlalchemy-migrate is already in there.
Doh. Sorry, missed that :)
> This has nothing to do with django, this is the default repository format for
> sqlalchemy-migrate. There is, however an indentation error.
Ah, OK, sorry. Looked like it was Django-related; thx for the explanation.
> Sync already knows about updates and won't update if the version is correct.
Ah, OK, that wasn't clear...thx for the explanation.
> I'll fix the nova-manage documentation, however this branch is now waiting on
> discussion about the live_migration branch
My vote is to revert the live-migrations patch and proceed with this patch. The live-migration patch needs more baking IMHO.
termie (termie) wrote : | # |
Just to make sure launchpad doesn't try to merge this again and generate an epic error log marking this as needs fixing
termie (termie) wrote : | # |
aight, ready for another looksee, i added string lengths to satisfy MySQL and added the new columns
termie (termie) wrote : | # |
approving myself, not sure whether that will make it try to merge...
OpenStack Infra (hudson-openstack) wrote : | # |
The attempt to merge lp:~termie/nova/db_migration into lp:nova failed. Below is the output from the failed tests.
AdminAPITest
test_
test_
APITest
test_
Test
test_
test_
test_bad_token ok
test_bad_user ok
test_no_user ok
test_
TestLimiter
test_
TestFaults
test_
test_raise ok
test_
FlavorsTest
test_
test_
GlanceImageServ
test_create ok
test_
test_delete ok
test_update ok
ImageController
test_
test_
LocalImageServi
test_create ok
test_
test_delete ok
test_update ok
LimiterTest
test_minute ok
test_
test_second ok
test_
test_
WSGIAppProxyTest
test_200 ok
test_403 ok
test_failure ok
WSGIAppTest
test_escaping ok
test_good_urls ok
test_
test_
test_
ServersTest
test_
test_
test_
test_
test_
test...
termie (termie) wrote : | # |
grr, this is all passing locally with run_tests.sh
termie (termie) wrote : | # |
it looks like hudson is running tests twice, one of which without run_tests.sh (looks like it is running nose)
termie (termie) wrote : | # |
moved db sync into a nose package-level fixture, approving again
Preview Diff
1 | === modified file 'MANIFEST.in' | |||
2 | --- MANIFEST.in 2010-12-22 20:59:53 +0000 | |||
3 | +++ MANIFEST.in 2011-01-19 01:35:10 +0000 | |||
4 | @@ -12,6 +12,7 @@ | |||
5 | 12 | include nova/cloudpipe/client.ovpn.template | 12 | include nova/cloudpipe/client.ovpn.template |
6 | 13 | include nova/compute/fakevirtinstance.xml | 13 | include nova/compute/fakevirtinstance.xml |
7 | 14 | include nova/compute/interfaces.template | 14 | include nova/compute/interfaces.template |
8 | 15 | include nova/db/sqlalchemy/migrate_repo/migrate.cfg | ||
9 | 15 | include nova/virt/interfaces.template | 16 | include nova/virt/interfaces.template |
10 | 16 | include nova/virt/libvirt*.xml.template | 17 | include nova/virt/libvirt*.xml.template |
11 | 17 | include nova/tests/CA/ | 18 | include nova/tests/CA/ |
12 | 18 | 19 | ||
13 | === modified file 'bin/nova-manage' | |||
14 | --- bin/nova-manage 2011-01-18 19:01:16 +0000 | |||
15 | +++ bin/nova-manage 2011-01-19 01:35:10 +0000 | |||
16 | @@ -82,6 +82,7 @@ | |||
17 | 82 | from nova import utils | 82 | from nova import utils |
18 | 83 | from nova.auth import manager | 83 | from nova.auth import manager |
19 | 84 | from nova.cloudpipe import pipelib | 84 | from nova.cloudpipe import pipelib |
20 | 85 | from nova.db import migration | ||
21 | 85 | 86 | ||
22 | 86 | 87 | ||
23 | 87 | logging.basicConfig() | 88 | logging.basicConfig() |
24 | @@ -519,6 +520,21 @@ | |||
25 | 519 | print re.sub('#012', "\n", "\n".join(lines)) | 520 | print re.sub('#012', "\n", "\n".join(lines)) |
26 | 520 | 521 | ||
27 | 521 | 522 | ||
28 | 523 | class DbCommands(object): | ||
29 | 524 | """Class for managing the database.""" | ||
30 | 525 | |||
31 | 526 | def __init__(self): | ||
32 | 527 | pass | ||
33 | 528 | |||
34 | 529 | def sync(self, version=None): | ||
35 | 530 | """Sync the database up to the most recent version.""" | ||
36 | 531 | return migration.db_sync(version) | ||
37 | 532 | |||
38 | 533 | def version(self): | ||
39 | 534 | """Print the current database version.""" | ||
40 | 535 | print migration.db_version() | ||
41 | 536 | |||
42 | 537 | |||
43 | 522 | CATEGORIES = [ | 538 | CATEGORIES = [ |
44 | 523 | ('user', UserCommands), | 539 | ('user', UserCommands), |
45 | 524 | ('project', ProjectCommands), | 540 | ('project', ProjectCommands), |
46 | @@ -528,7 +544,8 @@ | |||
47 | 528 | ('floating', FloatingIpCommands), | 544 | ('floating', FloatingIpCommands), |
48 | 529 | ('network', NetworkCommands), | 545 | ('network', NetworkCommands), |
49 | 530 | ('service', ServiceCommands), | 546 | ('service', ServiceCommands), |
51 | 531 | ('log', LogCommands)] | 547 | ('log', LogCommands), |
52 | 548 | ('db', DbCommands)] | ||
53 | 532 | 549 | ||
54 | 533 | 550 | ||
55 | 534 | def lazy_match(name, key_value_tuples): | 551 | def lazy_match(name, key_value_tuples): |
56 | 535 | 552 | ||
57 | === added file 'nova/db/migration.py' | |||
58 | --- nova/db/migration.py 1970-01-01 00:00:00 +0000 | |||
59 | +++ nova/db/migration.py 2011-01-19 01:35:10 +0000 | |||
60 | @@ -0,0 +1,38 @@ | |||
61 | 1 | # vim: tabstop=4 shiftwidth=4 softtabstop=4 | ||
62 | 2 | |||
63 | 3 | # Copyright 2010 United States Government as represented by the | ||
64 | 4 | # Administrator of the National Aeronautics and Space Administration. | ||
65 | 5 | # All Rights Reserved. | ||
66 | 6 | # | ||
67 | 7 | # Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
68 | 8 | # not use this file except in compliance with the License. You may obtain | ||
69 | 9 | # a copy of the License at | ||
70 | 10 | # | ||
71 | 11 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
72 | 12 | # | ||
73 | 13 | # Unless required by applicable law or agreed to in writing, software | ||
74 | 14 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
75 | 15 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
76 | 16 | # License for the specific language governing permissions and limitations | ||
77 | 17 | # under the License. | ||
78 | 18 | """Database setup and migration commands.""" | ||
79 | 19 | |||
80 | 20 | from nova import flags | ||
81 | 21 | from nova import utils | ||
82 | 22 | |||
83 | 23 | FLAGS = flags.FLAGS | ||
84 | 24 | flags.DECLARE('db_backend', 'nova.db.api') | ||
85 | 25 | |||
86 | 26 | |||
87 | 27 | IMPL = utils.LazyPluggable(FLAGS['db_backend'], | ||
88 | 28 | sqlalchemy='nova.db.sqlalchemy.migration') | ||
89 | 29 | |||
90 | 30 | |||
91 | 31 | def db_sync(version=None): | ||
92 | 32 | """Migrate the database to `version` or the most recent version.""" | ||
93 | 33 | return IMPL.db_sync(version=version) | ||
94 | 34 | |||
95 | 35 | |||
96 | 36 | def db_version(): | ||
97 | 37 | """Display the current database version.""" | ||
98 | 38 | return IMPL.db_version() | ||
99 | 0 | 39 | ||
100 | === modified file 'nova/db/sqlalchemy/__init__.py' | |||
101 | --- nova/db/sqlalchemy/__init__.py 2011-01-07 19:49:07 +0000 | |||
102 | +++ nova/db/sqlalchemy/__init__.py 2011-01-19 01:35:10 +0000 | |||
103 | @@ -15,31 +15,3 @@ | |||
104 | 15 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | 15 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
105 | 16 | # License for the specific language governing permissions and limitations | 16 | # License for the specific language governing permissions and limitations |
106 | 17 | # under the License. | 17 | # under the License. |
107 | 18 | |||
108 | 19 | """ | ||
109 | 20 | SQLAlchemy database backend | ||
110 | 21 | """ | ||
111 | 22 | import time | ||
112 | 23 | |||
113 | 24 | from sqlalchemy.exc import OperationalError | ||
114 | 25 | |||
115 | 26 | from nova import flags | ||
116 | 27 | from nova import log as logging | ||
117 | 28 | from nova.db.sqlalchemy import models | ||
118 | 29 | |||
119 | 30 | |||
120 | 31 | FLAGS = flags.FLAGS | ||
121 | 32 | LOG = logging.getLogger('nova.db.sqlalchemy') | ||
122 | 33 | |||
123 | 34 | |||
124 | 35 | for i in xrange(FLAGS.sql_max_retries): | ||
125 | 36 | if i > 0: | ||
126 | 37 | time.sleep(FLAGS.sql_retry_interval) | ||
127 | 38 | |||
128 | 39 | try: | ||
129 | 40 | models.register_models() | ||
130 | 41 | break | ||
131 | 42 | except OperationalError: | ||
132 | 43 | LOG.exception(_("Data store %s is unreachable." | ||
133 | 44 | " Trying again in %d seconds."), | ||
134 | 45 | FLAGS.sql_connection, FLAGS.sql_retry_interval) | ||
135 | 46 | 18 | ||
136 | === added directory 'nova/db/sqlalchemy/migrate_repo' | |||
137 | === added file 'nova/db/sqlalchemy/migrate_repo/README' | |||
138 | --- nova/db/sqlalchemy/migrate_repo/README 1970-01-01 00:00:00 +0000 | |||
139 | +++ nova/db/sqlalchemy/migrate_repo/README 2011-01-19 01:35:10 +0000 | |||
140 | @@ -0,0 +1,4 @@ | |||
141 | 1 | This is a database migration repository. | ||
142 | 2 | |||
143 | 3 | More information at | ||
144 | 4 | http://code.google.com/p/sqlalchemy-migrate/ | ||
145 | 0 | 5 | ||
146 | === added file 'nova/db/sqlalchemy/migrate_repo/__init__.py' | |||
147 | === added file 'nova/db/sqlalchemy/migrate_repo/manage.py' | |||
148 | --- nova/db/sqlalchemy/migrate_repo/manage.py 1970-01-01 00:00:00 +0000 | |||
149 | +++ nova/db/sqlalchemy/migrate_repo/manage.py 2011-01-19 01:35:10 +0000 | |||
150 | @@ -0,0 +1,4 @@ | |||
151 | 1 | #!/usr/bin/env python | ||
152 | 2 | from migrate.versioning.shell import main | ||
153 | 3 | if __name__ == '__main__': | ||
154 | 4 | main(debug='False', repository='.') | ||
155 | 0 | 5 | ||
156 | === added file 'nova/db/sqlalchemy/migrate_repo/migrate.cfg' | |||
157 | --- nova/db/sqlalchemy/migrate_repo/migrate.cfg 1970-01-01 00:00:00 +0000 | |||
158 | +++ nova/db/sqlalchemy/migrate_repo/migrate.cfg 2011-01-19 01:35:10 +0000 | |||
159 | @@ -0,0 +1,20 @@ | |||
160 | 1 | [db_settings] | ||
161 | 2 | # Used to identify which repository this database is versioned under. | ||
162 | 3 | # You can use the name of your project. | ||
163 | 4 | repository_id=nova | ||
164 | 5 | |||
165 | 6 | # The name of the database table used to track the schema version. | ||
166 | 7 | # This name shouldn't already be used by your project. | ||
167 | 8 | # If this is changed once a database is under version control, you'll need to | ||
168 | 9 | # change the table name in each database too. | ||
169 | 10 | version_table=migrate_version | ||
170 | 11 | |||
171 | 12 | # When committing a change script, Migrate will attempt to generate the | ||
172 | 13 | # sql for all supported databases; normally, if one of them fails - probably | ||
173 | 14 | # because you don't have that database installed - it is ignored and the | ||
174 | 15 | # commit continues, perhaps ending successfully. | ||
175 | 16 | # Databases in this list MUST compile successfully during a commit, or the | ||
176 | 17 | # entire commit will fail. List the databases your application will actually | ||
177 | 18 | # be using to ensure your updates to that database work properly. | ||
178 | 19 | # This must be a list; example: ['postgres','sqlite'] | ||
179 | 20 | required_dbs=[] | ||
180 | 0 | 21 | ||
181 | === added directory 'nova/db/sqlalchemy/migrate_repo/versions' | |||
182 | === added file 'nova/db/sqlalchemy/migrate_repo/versions/001_austin.py' | |||
183 | --- nova/db/sqlalchemy/migrate_repo/versions/001_austin.py 1970-01-01 00:00:00 +0000 | |||
184 | +++ nova/db/sqlalchemy/migrate_repo/versions/001_austin.py 2011-01-19 01:35:10 +0000 | |||
185 | @@ -0,0 +1,547 @@ | |||
186 | 1 | # vim: tabstop=4 shiftwidth=4 softtabstop=4 | ||
187 | 2 | |||
188 | 3 | # Copyright 2010 United States Government as represented by the | ||
189 | 4 | # Administrator of the National Aeronautics and Space Administration. | ||
190 | 5 | # All Rights Reserved. | ||
191 | 6 | # | ||
192 | 7 | # Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
193 | 8 | # not use this file except in compliance with the License. You may obtain | ||
194 | 9 | # a copy of the License at | ||
195 | 10 | # | ||
196 | 11 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
197 | 12 | # | ||
198 | 13 | # Unless required by applicable law or agreed to in writing, software | ||
199 | 14 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
200 | 15 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
201 | 16 | # License for the specific language governing permissions and limitations | ||
202 | 17 | # under the License. | ||
203 | 18 | |||
204 | 19 | ## Table code mostly autogenerated by genmodel.py | ||
205 | 20 | from sqlalchemy import * | ||
206 | 21 | from migrate import * | ||
207 | 22 | |||
208 | 23 | from nova import log as logging | ||
209 | 24 | |||
210 | 25 | |||
211 | 26 | meta = MetaData() | ||
212 | 27 | |||
213 | 28 | |||
214 | 29 | auth_tokens = Table('auth_tokens', meta, | ||
215 | 30 | Column('created_at', DateTime(timezone=False)), | ||
216 | 31 | Column('updated_at', DateTime(timezone=False)), | ||
217 | 32 | Column('deleted_at', DateTime(timezone=False)), | ||
218 | 33 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
219 | 34 | Column('token_hash', | ||
220 | 35 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
221 | 36 | unicode_error=None, _warn_on_bytestring=False), | ||
222 | 37 | primary_key=True, | ||
223 | 38 | nullable=False), | ||
224 | 39 | Column('user_id', Integer()), | ||
225 | 40 | Column('server_manageent_url', | ||
226 | 41 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
227 | 42 | unicode_error=None, _warn_on_bytestring=False)), | ||
228 | 43 | Column('storage_url', | ||
229 | 44 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
230 | 45 | unicode_error=None, _warn_on_bytestring=False)), | ||
231 | 46 | Column('cdn_management_url', | ||
232 | 47 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
233 | 48 | unicode_error=None, _warn_on_bytestring=False)), | ||
234 | 49 | ) | ||
235 | 50 | |||
236 | 51 | |||
237 | 52 | export_devices = Table('export_devices', meta, | ||
238 | 53 | Column('created_at', DateTime(timezone=False)), | ||
239 | 54 | Column('updated_at', DateTime(timezone=False)), | ||
240 | 55 | Column('deleted_at', DateTime(timezone=False)), | ||
241 | 56 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
242 | 57 | Column('id', Integer(), primary_key=True, nullable=False), | ||
243 | 58 | Column('shelf_id', Integer()), | ||
244 | 59 | Column('blade_id', Integer()), | ||
245 | 60 | Column('volume_id', | ||
246 | 61 | Integer(), | ||
247 | 62 | ForeignKey('volumes.id'), | ||
248 | 63 | nullable=True), | ||
249 | 64 | ) | ||
250 | 65 | |||
251 | 66 | |||
252 | 67 | fixed_ips = Table('fixed_ips', meta, | ||
253 | 68 | Column('created_at', DateTime(timezone=False)), | ||
254 | 69 | Column('updated_at', DateTime(timezone=False)), | ||
255 | 70 | Column('deleted_at', DateTime(timezone=False)), | ||
256 | 71 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
257 | 72 | Column('id', Integer(), primary_key=True, nullable=False), | ||
258 | 73 | Column('address', | ||
259 | 74 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
260 | 75 | unicode_error=None, _warn_on_bytestring=False)), | ||
261 | 76 | Column('network_id', | ||
262 | 77 | Integer(), | ||
263 | 78 | ForeignKey('networks.id'), | ||
264 | 79 | nullable=True), | ||
265 | 80 | Column('instance_id', | ||
266 | 81 | Integer(), | ||
267 | 82 | ForeignKey('instances.id'), | ||
268 | 83 | nullable=True), | ||
269 | 84 | Column('allocated', Boolean(create_constraint=True, name=None)), | ||
270 | 85 | Column('leased', Boolean(create_constraint=True, name=None)), | ||
271 | 86 | Column('reserved', Boolean(create_constraint=True, name=None)), | ||
272 | 87 | ) | ||
273 | 88 | |||
274 | 89 | |||
275 | 90 | floating_ips = Table('floating_ips', meta, | ||
276 | 91 | Column('created_at', DateTime(timezone=False)), | ||
277 | 92 | Column('updated_at', DateTime(timezone=False)), | ||
278 | 93 | Column('deleted_at', DateTime(timezone=False)), | ||
279 | 94 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
280 | 95 | Column('id', Integer(), primary_key=True, nullable=False), | ||
281 | 96 | Column('address', | ||
282 | 97 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
283 | 98 | unicode_error=None, _warn_on_bytestring=False)), | ||
284 | 99 | Column('fixed_ip_id', | ||
285 | 100 | Integer(), | ||
286 | 101 | ForeignKey('fixed_ips.id'), | ||
287 | 102 | nullable=True), | ||
288 | 103 | Column('project_id', | ||
289 | 104 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
290 | 105 | unicode_error=None, _warn_on_bytestring=False)), | ||
291 | 106 | Column('host', | ||
292 | 107 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
293 | 108 | unicode_error=None, _warn_on_bytestring=False)), | ||
294 | 109 | ) | ||
295 | 110 | |||
296 | 111 | |||
297 | 112 | instances = Table('instances', meta, | ||
298 | 113 | Column('created_at', DateTime(timezone=False)), | ||
299 | 114 | Column('updated_at', DateTime(timezone=False)), | ||
300 | 115 | Column('deleted_at', DateTime(timezone=False)), | ||
301 | 116 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
302 | 117 | Column('id', Integer(), primary_key=True, nullable=False), | ||
303 | 118 | Column('internal_id', Integer()), | ||
304 | 119 | Column('admin_pass', | ||
305 | 120 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
306 | 121 | unicode_error=None, _warn_on_bytestring=False)), | ||
307 | 122 | Column('user_id', | ||
308 | 123 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
309 | 124 | unicode_error=None, _warn_on_bytestring=False)), | ||
310 | 125 | Column('project_id', | ||
311 | 126 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
312 | 127 | unicode_error=None, _warn_on_bytestring=False)), | ||
313 | 128 | Column('image_id', | ||
314 | 129 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
315 | 130 | unicode_error=None, _warn_on_bytestring=False)), | ||
316 | 131 | Column('kernel_id', | ||
317 | 132 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
318 | 133 | unicode_error=None, _warn_on_bytestring=False)), | ||
319 | 134 | Column('ramdisk_id', | ||
320 | 135 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
321 | 136 | unicode_error=None, _warn_on_bytestring=False)), | ||
322 | 137 | Column('launch_index', Integer()), | ||
323 | 138 | Column('key_name', | ||
324 | 139 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
325 | 140 | unicode_error=None, _warn_on_bytestring=False)), | ||
326 | 141 | Column('key_data', | ||
327 | 142 | Text(length=None, convert_unicode=False, assert_unicode=None, | ||
328 | 143 | unicode_error=None, _warn_on_bytestring=False)), | ||
329 | 144 | Column('state', Integer()), | ||
330 | 145 | Column('state_description', | ||
331 | 146 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
332 | 147 | unicode_error=None, _warn_on_bytestring=False)), | ||
333 | 148 | Column('memory_mb', Integer()), | ||
334 | 149 | Column('vcpus', Integer()), | ||
335 | 150 | Column('local_gb', Integer()), | ||
336 | 151 | Column('hostname', | ||
337 | 152 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
338 | 153 | unicode_error=None, _warn_on_bytestring=False)), | ||
339 | 154 | Column('host', | ||
340 | 155 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
341 | 156 | unicode_error=None, _warn_on_bytestring=False)), | ||
342 | 157 | Column('instance_type', | ||
343 | 158 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
344 | 159 | unicode_error=None, _warn_on_bytestring=False)), | ||
345 | 160 | Column('user_data', | ||
346 | 161 | Text(length=None, convert_unicode=False, assert_unicode=None, | ||
347 | 162 | unicode_error=None, _warn_on_bytestring=False)), | ||
348 | 163 | Column('reservation_id', | ||
349 | 164 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
350 | 165 | unicode_error=None, _warn_on_bytestring=False)), | ||
351 | 166 | Column('mac_address', | ||
352 | 167 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
353 | 168 | unicode_error=None, _warn_on_bytestring=False)), | ||
354 | 169 | Column('scheduled_at', DateTime(timezone=False)), | ||
355 | 170 | Column('launched_at', DateTime(timezone=False)), | ||
356 | 171 | Column('terminated_at', DateTime(timezone=False)), | ||
357 | 172 | Column('display_name', | ||
358 | 173 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
359 | 174 | unicode_error=None, _warn_on_bytestring=False)), | ||
360 | 175 | Column('display_description', | ||
361 | 176 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
362 | 177 | unicode_error=None, _warn_on_bytestring=False)), | ||
363 | 178 | ) | ||
364 | 179 | |||
365 | 180 | |||
366 | 181 | iscsi_targets = Table('iscsi_targets', meta, | ||
367 | 182 | Column('created_at', DateTime(timezone=False)), | ||
368 | 183 | Column('updated_at', DateTime(timezone=False)), | ||
369 | 184 | Column('deleted_at', DateTime(timezone=False)), | ||
370 | 185 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
371 | 186 | Column('id', Integer(), primary_key=True, nullable=False), | ||
372 | 187 | Column('target_num', Integer()), | ||
373 | 188 | Column('host', | ||
374 | 189 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
375 | 190 | unicode_error=None, _warn_on_bytestring=False)), | ||
376 | 191 | Column('volume_id', | ||
377 | 192 | Integer(), | ||
378 | 193 | ForeignKey('volumes.id'), | ||
379 | 194 | nullable=True), | ||
380 | 195 | ) | ||
381 | 196 | |||
382 | 197 | |||
383 | 198 | key_pairs = Table('key_pairs', meta, | ||
384 | 199 | Column('created_at', DateTime(timezone=False)), | ||
385 | 200 | Column('updated_at', DateTime(timezone=False)), | ||
386 | 201 | Column('deleted_at', DateTime(timezone=False)), | ||
387 | 202 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
388 | 203 | Column('id', Integer(), primary_key=True, nullable=False), | ||
389 | 204 | Column('name', | ||
390 | 205 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
391 | 206 | unicode_error=None, _warn_on_bytestring=False)), | ||
392 | 207 | Column('user_id', | ||
393 | 208 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
394 | 209 | unicode_error=None, _warn_on_bytestring=False)), | ||
395 | 210 | Column('fingerprint', | ||
396 | 211 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
397 | 212 | unicode_error=None, _warn_on_bytestring=False)), | ||
398 | 213 | Column('public_key', | ||
399 | 214 | Text(length=None, convert_unicode=False, assert_unicode=None, | ||
400 | 215 | unicode_error=None, _warn_on_bytestring=False)), | ||
401 | 216 | ) | ||
402 | 217 | |||
403 | 218 | |||
404 | 219 | networks = Table('networks', meta, | ||
405 | 220 | Column('created_at', DateTime(timezone=False)), | ||
406 | 221 | Column('updated_at', DateTime(timezone=False)), | ||
407 | 222 | Column('deleted_at', DateTime(timezone=False)), | ||
408 | 223 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
409 | 224 | Column('id', Integer(), primary_key=True, nullable=False), | ||
410 | 225 | Column('injected', Boolean(create_constraint=True, name=None)), | ||
411 | 226 | Column('cidr', | ||
412 | 227 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
413 | 228 | unicode_error=None, _warn_on_bytestring=False)), | ||
414 | 229 | Column('netmask', | ||
415 | 230 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
416 | 231 | unicode_error=None, _warn_on_bytestring=False)), | ||
417 | 232 | Column('bridge', | ||
418 | 233 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
419 | 234 | unicode_error=None, _warn_on_bytestring=False)), | ||
420 | 235 | Column('gateway', | ||
421 | 236 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
422 | 237 | unicode_error=None, _warn_on_bytestring=False)), | ||
423 | 238 | Column('broadcast', | ||
424 | 239 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
425 | 240 | unicode_error=None, _warn_on_bytestring=False)), | ||
426 | 241 | Column('dns', | ||
427 | 242 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
428 | 243 | unicode_error=None, _warn_on_bytestring=False)), | ||
429 | 244 | Column('vlan', Integer()), | ||
430 | 245 | Column('vpn_public_address', | ||
431 | 246 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
432 | 247 | unicode_error=None, _warn_on_bytestring=False)), | ||
433 | 248 | Column('vpn_public_port', Integer()), | ||
434 | 249 | Column('vpn_private_address', | ||
435 | 250 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
436 | 251 | unicode_error=None, _warn_on_bytestring=False)), | ||
437 | 252 | Column('dhcp_start', | ||
438 | 253 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
439 | 254 | unicode_error=None, _warn_on_bytestring=False)), | ||
440 | 255 | Column('project_id', | ||
441 | 256 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
442 | 257 | unicode_error=None, _warn_on_bytestring=False)), | ||
443 | 258 | Column('host', | ||
444 | 259 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
445 | 260 | unicode_error=None, _warn_on_bytestring=False)), | ||
446 | 261 | ) | ||
447 | 262 | |||
448 | 263 | |||
449 | 264 | projects = Table('projects', meta, | ||
450 | 265 | Column('created_at', DateTime(timezone=False)), | ||
451 | 266 | Column('updated_at', DateTime(timezone=False)), | ||
452 | 267 | Column('deleted_at', DateTime(timezone=False)), | ||
453 | 268 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
454 | 269 | Column('id', | ||
455 | 270 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
456 | 271 | unicode_error=None, _warn_on_bytestring=False), | ||
457 | 272 | primary_key=True, | ||
458 | 273 | nullable=False), | ||
459 | 274 | Column('name', | ||
460 | 275 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
461 | 276 | unicode_error=None, _warn_on_bytestring=False)), | ||
462 | 277 | Column('description', | ||
463 | 278 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
464 | 279 | unicode_error=None, _warn_on_bytestring=False)), | ||
465 | 280 | Column('project_manager', | ||
466 | 281 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
467 | 282 | unicode_error=None, _warn_on_bytestring=False), | ||
468 | 283 | ForeignKey('users.id')), | ||
469 | 284 | ) | ||
470 | 285 | |||
471 | 286 | |||
472 | 287 | quotas = Table('quotas', meta, | ||
473 | 288 | Column('created_at', DateTime(timezone=False)), | ||
474 | 289 | Column('updated_at', DateTime(timezone=False)), | ||
475 | 290 | Column('deleted_at', DateTime(timezone=False)), | ||
476 | 291 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
477 | 292 | Column('id', Integer(), primary_key=True, nullable=False), | ||
478 | 293 | Column('project_id', | ||
479 | 294 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
480 | 295 | unicode_error=None, _warn_on_bytestring=False)), | ||
481 | 296 | Column('instances', Integer()), | ||
482 | 297 | Column('cores', Integer()), | ||
483 | 298 | Column('volumes', Integer()), | ||
484 | 299 | Column('gigabytes', Integer()), | ||
485 | 300 | Column('floating_ips', Integer()), | ||
486 | 301 | ) | ||
487 | 302 | |||
488 | 303 | |||
489 | 304 | security_groups = Table('security_groups', meta, | ||
490 | 305 | Column('created_at', DateTime(timezone=False)), | ||
491 | 306 | Column('updated_at', DateTime(timezone=False)), | ||
492 | 307 | Column('deleted_at', DateTime(timezone=False)), | ||
493 | 308 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
494 | 309 | Column('id', Integer(), primary_key=True, nullable=False), | ||
495 | 310 | Column('name', | ||
496 | 311 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
497 | 312 | unicode_error=None, _warn_on_bytestring=False)), | ||
498 | 313 | Column('description', | ||
499 | 314 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
500 | 315 | unicode_error=None, _warn_on_bytestring=False)), | ||
501 | 316 | Column('user_id', | ||
502 | 317 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
503 | 318 | unicode_error=None, _warn_on_bytestring=False)), | ||
504 | 319 | Column('project_id', | ||
505 | 320 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
506 | 321 | unicode_error=None, _warn_on_bytestring=False)), | ||
507 | 322 | ) | ||
508 | 323 | |||
509 | 324 | |||
510 | 325 | security_group_inst_assoc = Table('security_group_instance_association', meta, | ||
511 | 326 | Column('created_at', DateTime(timezone=False)), | ||
512 | 327 | Column('updated_at', DateTime(timezone=False)), | ||
513 | 328 | Column('deleted_at', DateTime(timezone=False)), | ||
514 | 329 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
515 | 330 | Column('id', Integer(), primary_key=True, nullable=False), | ||
516 | 331 | Column('security_group_id', | ||
517 | 332 | Integer(), | ||
518 | 333 | ForeignKey('security_groups.id')), | ||
519 | 334 | Column('instance_id', Integer(), ForeignKey('instances.id')), | ||
520 | 335 | ) | ||
521 | 336 | |||
522 | 337 | |||
523 | 338 | security_group_rules = Table('security_group_rules', meta, | ||
524 | 339 | Column('created_at', DateTime(timezone=False)), | ||
525 | 340 | Column('updated_at', DateTime(timezone=False)), | ||
526 | 341 | Column('deleted_at', DateTime(timezone=False)), | ||
527 | 342 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
528 | 343 | Column('id', Integer(), primary_key=True, nullable=False), | ||
529 | 344 | Column('parent_group_id', | ||
530 | 345 | Integer(), | ||
531 | 346 | ForeignKey('security_groups.id')), | ||
532 | 347 | Column('protocol', | ||
533 | 348 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
534 | 349 | unicode_error=None, _warn_on_bytestring=False)), | ||
535 | 350 | Column('from_port', Integer()), | ||
536 | 351 | Column('to_port', Integer()), | ||
537 | 352 | Column('cidr', | ||
538 | 353 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
539 | 354 | unicode_error=None, _warn_on_bytestring=False)), | ||
540 | 355 | Column('group_id', | ||
541 | 356 | Integer(), | ||
542 | 357 | ForeignKey('security_groups.id')), | ||
543 | 358 | ) | ||
544 | 359 | |||
545 | 360 | |||
546 | 361 | services = Table('services', meta, | ||
547 | 362 | Column('created_at', DateTime(timezone=False)), | ||
548 | 363 | Column('updated_at', DateTime(timezone=False)), | ||
549 | 364 | Column('deleted_at', DateTime(timezone=False)), | ||
550 | 365 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
551 | 366 | Column('id', Integer(), primary_key=True, nullable=False), | ||
552 | 367 | Column('host', | ||
553 | 368 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
554 | 369 | unicode_error=None, _warn_on_bytestring=False)), | ||
555 | 370 | Column('binary', | ||
556 | 371 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
557 | 372 | unicode_error=None, _warn_on_bytestring=False)), | ||
558 | 373 | Column('topic', | ||
559 | 374 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
560 | 375 | unicode_error=None, _warn_on_bytestring=False)), | ||
561 | 376 | Column('report_count', Integer(), nullable=False), | ||
562 | 377 | Column('disabled', Boolean(create_constraint=True, name=None)), | ||
563 | 378 | ) | ||
564 | 379 | |||
565 | 380 | |||
566 | 381 | users = Table('users', meta, | ||
567 | 382 | Column('created_at', DateTime(timezone=False)), | ||
568 | 383 | Column('updated_at', DateTime(timezone=False)), | ||
569 | 384 | Column('deleted_at', DateTime(timezone=False)), | ||
570 | 385 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
571 | 386 | Column('id', | ||
572 | 387 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
573 | 388 | unicode_error=None, _warn_on_bytestring=False), | ||
574 | 389 | primary_key=True, | ||
575 | 390 | nullable=False), | ||
576 | 391 | Column('name', | ||
577 | 392 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
578 | 393 | unicode_error=None, _warn_on_bytestring=False)), | ||
579 | 394 | Column('access_key', | ||
580 | 395 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
581 | 396 | unicode_error=None, _warn_on_bytestring=False)), | ||
582 | 397 | Column('secret_key', | ||
583 | 398 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
584 | 399 | unicode_error=None, _warn_on_bytestring=False)), | ||
585 | 400 | Column('is_admin', Boolean(create_constraint=True, name=None)), | ||
586 | 401 | ) | ||
587 | 402 | |||
588 | 403 | |||
589 | 404 | user_project_association = Table('user_project_association', meta, | ||
590 | 405 | Column('created_at', DateTime(timezone=False)), | ||
591 | 406 | Column('updated_at', DateTime(timezone=False)), | ||
592 | 407 | Column('deleted_at', DateTime(timezone=False)), | ||
593 | 408 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
594 | 409 | Column('user_id', | ||
595 | 410 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
596 | 411 | unicode_error=None, _warn_on_bytestring=False), | ||
597 | 412 | ForeignKey('users.id'), | ||
598 | 413 | primary_key=True, | ||
599 | 414 | nullable=False), | ||
600 | 415 | Column('project_id', | ||
601 | 416 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
602 | 417 | unicode_error=None, _warn_on_bytestring=False), | ||
603 | 418 | ForeignKey('projects.id'), | ||
604 | 419 | primary_key=True, | ||
605 | 420 | nullable=False), | ||
606 | 421 | ) | ||
607 | 422 | |||
608 | 423 | |||
609 | 424 | user_project_role_association = Table('user_project_role_association', meta, | ||
610 | 425 | Column('created_at', DateTime(timezone=False)), | ||
611 | 426 | Column('updated_at', DateTime(timezone=False)), | ||
612 | 427 | Column('deleted_at', DateTime(timezone=False)), | ||
613 | 428 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
614 | 429 | Column('user_id', | ||
615 | 430 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
616 | 431 | unicode_error=None, _warn_on_bytestring=False), | ||
617 | 432 | primary_key=True, | ||
618 | 433 | nullable=False), | ||
619 | 434 | Column('project_id', | ||
620 | 435 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
621 | 436 | unicode_error=None, _warn_on_bytestring=False), | ||
622 | 437 | primary_key=True, | ||
623 | 438 | nullable=False), | ||
624 | 439 | Column('role', | ||
625 | 440 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
626 | 441 | unicode_error=None, _warn_on_bytestring=False), | ||
627 | 442 | primary_key=True, | ||
628 | 443 | nullable=False), | ||
629 | 444 | ForeignKeyConstraint(['user_id', | ||
630 | 445 | 'project_id'], | ||
631 | 446 | ['user_project_association.user_id', | ||
632 | 447 | 'user_project_association.project_id']), | ||
633 | 448 | ) | ||
634 | 449 | |||
635 | 450 | |||
636 | 451 | user_role_association = Table('user_role_association', meta, | ||
637 | 452 | Column('created_at', DateTime(timezone=False)), | ||
638 | 453 | Column('updated_at', DateTime(timezone=False)), | ||
639 | 454 | Column('deleted_at', DateTime(timezone=False)), | ||
640 | 455 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
641 | 456 | Column('user_id', | ||
642 | 457 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
643 | 458 | unicode_error=None, _warn_on_bytestring=False), | ||
644 | 459 | ForeignKey('users.id'), | ||
645 | 460 | primary_key=True, | ||
646 | 461 | nullable=False), | ||
647 | 462 | Column('role', | ||
648 | 463 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
649 | 464 | unicode_error=None, _warn_on_bytestring=False), | ||
650 | 465 | primary_key=True, | ||
651 | 466 | nullable=False), | ||
652 | 467 | ) | ||
653 | 468 | |||
654 | 469 | |||
655 | 470 | volumes = Table('volumes', meta, | ||
656 | 471 | Column('created_at', DateTime(timezone=False)), | ||
657 | 472 | Column('updated_at', DateTime(timezone=False)), | ||
658 | 473 | Column('deleted_at', DateTime(timezone=False)), | ||
659 | 474 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
660 | 475 | Column('id', Integer(), primary_key=True, nullable=False), | ||
661 | 476 | Column('ec2_id', | ||
662 | 477 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
663 | 478 | unicode_error=None, _warn_on_bytestring=False)), | ||
664 | 479 | Column('user_id', | ||
665 | 480 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
666 | 481 | unicode_error=None, _warn_on_bytestring=False)), | ||
667 | 482 | Column('project_id', | ||
668 | 483 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
669 | 484 | unicode_error=None, _warn_on_bytestring=False)), | ||
670 | 485 | Column('host', | ||
671 | 486 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
672 | 487 | unicode_error=None, _warn_on_bytestring=False)), | ||
673 | 488 | Column('size', Integer()), | ||
674 | 489 | Column('availability_zone', | ||
675 | 490 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
676 | 491 | unicode_error=None, _warn_on_bytestring=False)), | ||
677 | 492 | Column('instance_id', | ||
678 | 493 | Integer(), | ||
679 | 494 | ForeignKey('instances.id'), | ||
680 | 495 | nullable=True), | ||
681 | 496 | Column('mountpoint', | ||
682 | 497 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
683 | 498 | unicode_error=None, _warn_on_bytestring=False)), | ||
684 | 499 | Column('attach_time', | ||
685 | 500 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
686 | 501 | unicode_error=None, _warn_on_bytestring=False)), | ||
687 | 502 | Column('status', | ||
688 | 503 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
689 | 504 | unicode_error=None, _warn_on_bytestring=False)), | ||
690 | 505 | Column('attach_status', | ||
691 | 506 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
692 | 507 | unicode_error=None, _warn_on_bytestring=False)), | ||
693 | 508 | Column('scheduled_at', DateTime(timezone=False)), | ||
694 | 509 | Column('launched_at', DateTime(timezone=False)), | ||
695 | 510 | Column('terminated_at', DateTime(timezone=False)), | ||
696 | 511 | Column('display_name', | ||
697 | 512 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
698 | 513 | unicode_error=None, _warn_on_bytestring=False)), | ||
699 | 514 | Column('display_description', | ||
700 | 515 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
701 | 516 | unicode_error=None, _warn_on_bytestring=False)), | ||
702 | 517 | ) | ||
703 | 518 | |||
704 | 519 | |||
705 | 520 | def upgrade(migrate_engine): | ||
706 | 521 | # Upgrade operations go here. Don't create your own engine; | ||
707 | 522 | # bind migrate_engine to your metadata | ||
708 | 523 | meta.bind = migrate_engine | ||
709 | 524 | |||
710 | 525 | for table in (auth_tokens, export_devices, fixed_ips, floating_ips, | ||
711 | 526 | instances, iscsi_targets, key_pairs, networks, | ||
712 | 527 | projects, quotas, security_groups, security_group_inst_assoc, | ||
713 | 528 | security_group_rules, services, users, | ||
714 | 529 | user_project_association, user_project_role_association, | ||
715 | 530 | user_role_association, volumes): | ||
716 | 531 | try: | ||
717 | 532 | table.create() | ||
718 | 533 | except Exception: | ||
719 | 534 | logging.info(repr(table)) | ||
720 | 535 | logging.exception('Exception while creating table') | ||
721 | 536 | raise | ||
722 | 537 | |||
723 | 538 | |||
724 | 539 | def downgrade(migrate_engine): | ||
725 | 540 | # Operations to reverse the above upgrade go here. | ||
726 | 541 | for table in (auth_tokens, export_devices, fixed_ips, floating_ips, | ||
727 | 542 | instances, iscsi_targets, key_pairs, networks, | ||
728 | 543 | projects, quotas, security_groups, security_group_inst_assoc, | ||
729 | 544 | security_group_rules, services, users, | ||
730 | 545 | user_project_association, user_project_role_association, | ||
731 | 546 | user_role_association, volumes): | ||
732 | 547 | table.drop() | ||
733 | 0 | 548 | ||
734 | === added file 'nova/db/sqlalchemy/migrate_repo/versions/002_bexar.py' | |||
735 | --- nova/db/sqlalchemy/migrate_repo/versions/002_bexar.py 1970-01-01 00:00:00 +0000 | |||
736 | +++ nova/db/sqlalchemy/migrate_repo/versions/002_bexar.py 2011-01-19 01:35:10 +0000 | |||
737 | @@ -0,0 +1,209 @@ | |||
738 | 1 | # vim: tabstop=4 shiftwidth=4 softtabstop=4 | ||
739 | 2 | |||
740 | 3 | # Copyright 2010 United States Government as represented by the | ||
741 | 4 | # Administrator of the National Aeronautics and Space Administration. | ||
742 | 5 | # All Rights Reserved. | ||
743 | 6 | # | ||
744 | 7 | # Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
745 | 8 | # not use this file except in compliance with the License. You may obtain | ||
746 | 9 | # a copy of the License at | ||
747 | 10 | # | ||
748 | 11 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
749 | 12 | # | ||
750 | 13 | # Unless required by applicable law or agreed to in writing, software | ||
751 | 14 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
752 | 15 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
753 | 16 | # License for the specific language governing permissions and limitations | ||
754 | 17 | # under the License. | ||
755 | 18 | |||
756 | 19 | from sqlalchemy import * | ||
757 | 20 | from migrate import * | ||
758 | 21 | |||
759 | 22 | from nova import log as logging | ||
760 | 23 | |||
761 | 24 | |||
762 | 25 | meta = MetaData() | ||
763 | 26 | |||
764 | 27 | |||
765 | 28 | # Just for the ForeignKey and column creation to succeed, these are not the | ||
766 | 29 | # actual definitions of instances or services. | ||
767 | 30 | instances = Table('instances', meta, | ||
768 | 31 | Column('id', Integer(), primary_key=True, nullable=False), | ||
769 | 32 | ) | ||
770 | 33 | |||
771 | 34 | |||
772 | 35 | services = Table('services', meta, | ||
773 | 36 | Column('id', Integer(), primary_key=True, nullable=False), | ||
774 | 37 | ) | ||
775 | 38 | |||
776 | 39 | |||
777 | 40 | networks = Table('networks', meta, | ||
778 | 41 | Column('id', Integer(), primary_key=True, nullable=False), | ||
779 | 42 | ) | ||
780 | 43 | |||
781 | 44 | |||
782 | 45 | # | ||
783 | 46 | # New Tables | ||
784 | 47 | # | ||
785 | 48 | certificates = Table('certificates', meta, | ||
786 | 49 | Column('created_at', DateTime(timezone=False)), | ||
787 | 50 | Column('updated_at', DateTime(timezone=False)), | ||
788 | 51 | Column('deleted_at', DateTime(timezone=False)), | ||
789 | 52 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
790 | 53 | Column('id', Integer(), primary_key=True, nullable=False), | ||
791 | 54 | Column('user_id', | ||
792 | 55 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
793 | 56 | unicode_error=None, _warn_on_bytestring=False)), | ||
794 | 57 | Column('project_id', | ||
795 | 58 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
796 | 59 | unicode_error=None, _warn_on_bytestring=False)), | ||
797 | 60 | Column('file_name', | ||
798 | 61 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
799 | 62 | unicode_error=None, _warn_on_bytestring=False)), | ||
800 | 63 | ) | ||
801 | 64 | |||
802 | 65 | |||
803 | 66 | consoles = Table('consoles', meta, | ||
804 | 67 | Column('created_at', DateTime(timezone=False)), | ||
805 | 68 | Column('updated_at', DateTime(timezone=False)), | ||
806 | 69 | Column('deleted_at', DateTime(timezone=False)), | ||
807 | 70 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
808 | 71 | Column('id', Integer(), primary_key=True, nullable=False), | ||
809 | 72 | Column('instance_name', | ||
810 | 73 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
811 | 74 | unicode_error=None, _warn_on_bytestring=False)), | ||
812 | 75 | Column('instance_id', Integer()), | ||
813 | 76 | Column('password', | ||
814 | 77 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
815 | 78 | unicode_error=None, _warn_on_bytestring=False)), | ||
816 | 79 | Column('port', Integer(), nullable=True), | ||
817 | 80 | Column('pool_id', | ||
818 | 81 | Integer(), | ||
819 | 82 | ForeignKey('console_pools.id')), | ||
820 | 83 | ) | ||
821 | 84 | |||
822 | 85 | |||
823 | 86 | console_pools = Table('console_pools', meta, | ||
824 | 87 | Column('created_at', DateTime(timezone=False)), | ||
825 | 88 | Column('updated_at', DateTime(timezone=False)), | ||
826 | 89 | Column('deleted_at', DateTime(timezone=False)), | ||
827 | 90 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
828 | 91 | Column('id', Integer(), primary_key=True, nullable=False), | ||
829 | 92 | Column('address', | ||
830 | 93 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
831 | 94 | unicode_error=None, _warn_on_bytestring=False)), | ||
832 | 95 | Column('username', | ||
833 | 96 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
834 | 97 | unicode_error=None, _warn_on_bytestring=False)), | ||
835 | 98 | Column('password', | ||
836 | 99 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
837 | 100 | unicode_error=None, _warn_on_bytestring=False)), | ||
838 | 101 | Column('console_type', | ||
839 | 102 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
840 | 103 | unicode_error=None, _warn_on_bytestring=False)), | ||
841 | 104 | Column('public_hostname', | ||
842 | 105 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
843 | 106 | unicode_error=None, _warn_on_bytestring=False)), | ||
844 | 107 | Column('host', | ||
845 | 108 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
846 | 109 | unicode_error=None, _warn_on_bytestring=False)), | ||
847 | 110 | Column('compute_host', | ||
848 | 111 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
849 | 112 | unicode_error=None, _warn_on_bytestring=False)), | ||
850 | 113 | ) | ||
851 | 114 | |||
852 | 115 | |||
853 | 116 | instance_actions = Table('instance_actions', meta, | ||
854 | 117 | Column('created_at', DateTime(timezone=False)), | ||
855 | 118 | Column('updated_at', DateTime(timezone=False)), | ||
856 | 119 | Column('deleted_at', DateTime(timezone=False)), | ||
857 | 120 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
858 | 121 | Column('id', Integer(), primary_key=True, nullable=False), | ||
859 | 122 | Column('instance_id', | ||
860 | 123 | Integer(), | ||
861 | 124 | ForeignKey('instances.id')), | ||
862 | 125 | Column('action', | ||
863 | 126 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
864 | 127 | unicode_error=None, _warn_on_bytestring=False)), | ||
865 | 128 | Column('error', | ||
866 | 129 | Text(length=None, convert_unicode=False, assert_unicode=None, | ||
867 | 130 | unicode_error=None, _warn_on_bytestring=False)), | ||
868 | 131 | ) | ||
869 | 132 | |||
870 | 133 | |||
871 | 134 | # | ||
872 | 135 | # Tables to alter | ||
873 | 136 | # | ||
874 | 137 | auth_tokens = Table('auth_tokens', meta, | ||
875 | 138 | Column('created_at', DateTime(timezone=False)), | ||
876 | 139 | Column('updated_at', DateTime(timezone=False)), | ||
877 | 140 | Column('deleted_at', DateTime(timezone=False)), | ||
878 | 141 | Column('deleted', Boolean(create_constraint=True, name=None)), | ||
879 | 142 | Column('token_hash', | ||
880 | 143 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
881 | 144 | unicode_error=None, _warn_on_bytestring=False), | ||
882 | 145 | primary_key=True, | ||
883 | 146 | nullable=False), | ||
884 | 147 | Column('user_id', Integer()), | ||
885 | 148 | Column('server_manageent_url', | ||
886 | 149 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
887 | 150 | unicode_error=None, _warn_on_bytestring=False)), | ||
888 | 151 | Column('storage_url', | ||
889 | 152 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
890 | 153 | unicode_error=None, _warn_on_bytestring=False)), | ||
891 | 154 | Column('cdn_management_url', | ||
892 | 155 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
893 | 156 | unicode_error=None, _warn_on_bytestring=False)), | ||
894 | 157 | ) | ||
895 | 158 | |||
896 | 159 | |||
897 | 160 | instances_availability_zone = Column( | ||
898 | 161 | 'availability_zone', | ||
899 | 162 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
900 | 163 | unicode_error=None, _warn_on_bytestring=False)) | ||
901 | 164 | |||
902 | 165 | |||
903 | 166 | instances_locked = Column('locked', | ||
904 | 167 | Boolean(create_constraint=True, name=None)) | ||
905 | 168 | |||
906 | 169 | |||
907 | 170 | networks_cidr_v6 = Column( | ||
908 | 171 | 'cidr_v6', | ||
909 | 172 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
910 | 173 | unicode_error=None, _warn_on_bytestring=False)) | ||
911 | 174 | |||
912 | 175 | networks_ra_server = Column( | ||
913 | 176 | 'ra_server', | ||
914 | 177 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
915 | 178 | unicode_error=None, _warn_on_bytestring=False)) | ||
916 | 179 | |||
917 | 180 | |||
918 | 181 | services_availability_zone = Column( | ||
919 | 182 | 'availability_zone', | ||
920 | 183 | String(length=255, convert_unicode=False, assert_unicode=None, | ||
921 | 184 | unicode_error=None, _warn_on_bytestring=False)) | ||
922 | 185 | |||
923 | 186 | |||
924 | 187 | def upgrade(migrate_engine): | ||
925 | 188 | # Upgrade operations go here. Don't create your own engine; | ||
926 | 189 | # bind migrate_engine to your metadata | ||
927 | 190 | meta.bind = migrate_engine | ||
928 | 191 | for table in (certificates, consoles, console_pools, instance_actions): | ||
929 | 192 | try: | ||
930 | 193 | table.create() | ||
931 | 194 | except Exception: | ||
932 | 195 | logging.info(repr(table)) | ||
933 | 196 | logging.exception('Exception while creating table') | ||
934 | 197 | raise | ||
935 | 198 | |||
936 | 199 | auth_tokens.c.user_id.alter(type=String(length=255, | ||
937 | 200 | convert_unicode=False, | ||
938 | 201 | assert_unicode=None, | ||
939 | 202 | unicode_error=None, | ||
940 | 203 | _warn_on_bytestring=False)) | ||
941 | 204 | |||
942 | 205 | instances.create_column(instances_availability_zone) | ||
943 | 206 | instances.create_column(instances_locked) | ||
944 | 207 | networks.create_column(networks_cidr_v6) | ||
945 | 208 | networks.create_column(networks_ra_server) | ||
946 | 209 | services.create_column(services_availability_zone) | ||
947 | 0 | 210 | ||
948 | === added file 'nova/db/sqlalchemy/migrate_repo/versions/__init__.py' | |||
949 | === added file 'nova/db/sqlalchemy/migration.py' | |||
950 | --- nova/db/sqlalchemy/migration.py 1970-01-01 00:00:00 +0000 | |||
951 | +++ nova/db/sqlalchemy/migration.py 2011-01-19 01:35:10 +0000 | |||
952 | @@ -0,0 +1,72 @@ | |||
953 | 1 | # vim: tabstop=4 shiftwidth=4 softtabstop=4 | ||
954 | 2 | |||
955 | 3 | # Copyright 2010 United States Government as represented by the | ||
956 | 4 | # Administrator of the National Aeronautics and Space Administration. | ||
957 | 5 | # All Rights Reserved. | ||
958 | 6 | # | ||
959 | 7 | # Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
960 | 8 | # not use this file except in compliance with the License. You may obtain | ||
961 | 9 | # a copy of the License at | ||
962 | 10 | # | ||
963 | 11 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
964 | 12 | # | ||
965 | 13 | # Unless required by applicable law or agreed to in writing, software | ||
966 | 14 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
967 | 15 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
968 | 16 | # License for the specific language governing permissions and limitations | ||
969 | 17 | # under the License. | ||
970 | 18 | |||
971 | 19 | import os | ||
972 | 20 | |||
973 | 21 | from nova import flags | ||
974 | 22 | |||
975 | 23 | import sqlalchemy | ||
976 | 24 | from migrate.versioning import api as versioning_api | ||
977 | 25 | from migrate.versioning import exceptions as versioning_exceptions | ||
978 | 26 | |||
979 | 27 | FLAGS = flags.FLAGS | ||
980 | 28 | |||
981 | 29 | |||
982 | 30 | def db_sync(version=None): | ||
983 | 31 | db_version() | ||
984 | 32 | repo_path = _find_migrate_repo() | ||
985 | 33 | return versioning_api.upgrade(FLAGS.sql_connection, repo_path, version) | ||
986 | 34 | |||
987 | 35 | |||
988 | 36 | def db_version(): | ||
989 | 37 | repo_path = _find_migrate_repo() | ||
990 | 38 | try: | ||
991 | 39 | return versioning_api.db_version(FLAGS.sql_connection, repo_path) | ||
992 | 40 | except versioning_exceptions.DatabaseNotControlledError: | ||
993 | 41 | # If we aren't version controlled we may already have the database | ||
994 | 42 | # in the state from before we started version control, check for that | ||
995 | 43 | # and set up version_control appropriately | ||
996 | 44 | meta = sqlalchemy.MetaData() | ||
997 | 45 | engine = sqlalchemy.create_engine(FLAGS.sql_connection, echo=False) | ||
998 | 46 | meta.reflect(bind=engine) | ||
999 | 47 | try: | ||
1000 | 48 | for table in ('auth_tokens', 'export_devices', 'fixed_ips', | ||
1001 | 49 | 'floating_ips', 'instances', 'iscsi_targets', | ||
1002 | 50 | 'key_pairs', 'networks', 'projects', 'quotas', | ||
1003 | 51 | 'security_group_rules', | ||
1004 | 52 | 'security_group_instance_association', 'services', | ||
1005 | 53 | 'users', 'user_project_association', | ||
1006 | 54 | 'user_project_role_association', 'volumes'): | ||
1007 | 55 | assert table in meta.tables | ||
1008 | 56 | return db_version_control(1) | ||
1009 | 57 | except AssertionError: | ||
1010 | 58 | return db_version_control(0) | ||
1011 | 59 | |||
1012 | 60 | |||
1013 | 61 | def db_version_control(version=None): | ||
1014 | 62 | repo_path = _find_migrate_repo() | ||
1015 | 63 | versioning_api.version_control(FLAGS.sql_connection, repo_path, version) | ||
1016 | 64 | return version | ||
1017 | 65 | |||
1018 | 66 | |||
1019 | 67 | def _find_migrate_repo(): | ||
1020 | 68 | """Get the path for the migrate repository.""" | ||
1021 | 69 | path = os.path.join(os.path.abspath(os.path.dirname(__file__)), | ||
1022 | 70 | 'migrate_repo') | ||
1023 | 71 | assert os.path.exists(path) | ||
1024 | 72 | return path | ||
1025 | 0 | 73 | ||
1026 | === modified file 'nova/db/sqlalchemy/models.py' | |||
1027 | --- nova/db/sqlalchemy/models.py 2011-01-18 19:01:16 +0000 | |||
1028 | +++ nova/db/sqlalchemy/models.py 2011-01-19 01:35:10 +0000 | |||
1029 | @@ -100,51 +100,6 @@ | |||
1030 | 100 | return local.iteritems() | 100 | return local.iteritems() |
1031 | 101 | 101 | ||
1032 | 102 | 102 | ||
1033 | 103 | # TODO(vish): Store images in the database instead of file system | ||
1034 | 104 | #class Image(BASE, NovaBase): | ||
1035 | 105 | # """Represents an image in the datastore""" | ||
1036 | 106 | # __tablename__ = 'images' | ||
1037 | 107 | # id = Column(Integer, primary_key=True) | ||
1038 | 108 | # ec2_id = Column(String(12), unique=True) | ||
1039 | 109 | # user_id = Column(String(255)) | ||
1040 | 110 | # project_id = Column(String(255)) | ||
1041 | 111 | # image_type = Column(String(255)) | ||
1042 | 112 | # public = Column(Boolean, default=False) | ||
1043 | 113 | # state = Column(String(255)) | ||
1044 | 114 | # location = Column(String(255)) | ||
1045 | 115 | # arch = Column(String(255)) | ||
1046 | 116 | # default_kernel_id = Column(String(255)) | ||
1047 | 117 | # default_ramdisk_id = Column(String(255)) | ||
1048 | 118 | # | ||
1049 | 119 | # @validates('image_type') | ||
1050 | 120 | # def validate_image_type(self, key, image_type): | ||
1051 | 121 | # assert(image_type in ['machine', 'kernel', 'ramdisk', 'raw']) | ||
1052 | 122 | # | ||
1053 | 123 | # @validates('state') | ||
1054 | 124 | # def validate_state(self, key, state): | ||
1055 | 125 | # assert(state in ['available', 'pending', 'disabled']) | ||
1056 | 126 | # | ||
1057 | 127 | # @validates('default_kernel_id') | ||
1058 | 128 | # def validate_kernel_id(self, key, val): | ||
1059 | 129 | # if val != 'machine': | ||
1060 | 130 | # assert(val is None) | ||
1061 | 131 | # | ||
1062 | 132 | # @validates('default_ramdisk_id') | ||
1063 | 133 | # def validate_ramdisk_id(self, key, val): | ||
1064 | 134 | # if val != 'machine': | ||
1065 | 135 | # assert(val is None) | ||
1066 | 136 | # | ||
1067 | 137 | # | ||
1068 | 138 | # TODO(vish): To make this into its own table, we need a good place to | ||
1069 | 139 | # create the host entries. In config somwhere? Or the first | ||
1070 | 140 | # time any object sets host? This only becomes particularly | ||
1071 | 141 | # important if we need to store per-host data. | ||
1072 | 142 | #class Host(BASE, NovaBase): | ||
1073 | 143 | # """Represents a host where services are running""" | ||
1074 | 144 | # __tablename__ = 'hosts' | ||
1075 | 145 | # id = Column(String(255), primary_key=True) | ||
1076 | 146 | |||
1077 | 147 | |||
1078 | 148 | class Service(BASE, NovaBase): | 103 | class Service(BASE, NovaBase): |
1079 | 149 | """Represents a running service on a host.""" | 104 | """Represents a running service on a host.""" |
1080 | 150 | 105 | ||
1081 | 151 | 106 | ||
1082 | === modified file 'nova/service.py' | |||
1083 | --- nova/service.py 2011-01-18 19:01:16 +0000 | |||
1084 | +++ nova/service.py 2011-01-19 01:35:10 +0000 | |||
1085 | @@ -209,19 +209,6 @@ | |||
1086 | 209 | self.model_disconnected = True | 209 | self.model_disconnected = True |
1087 | 210 | logging.exception(_("model server went away")) | 210 | logging.exception(_("model server went away")) |
1088 | 211 | 211 | ||
1089 | 212 | try: | ||
1090 | 213 | # NOTE(vish): This is late-loaded to make sure that the | ||
1091 | 214 | # database is not created before flags have | ||
1092 | 215 | # been loaded. | ||
1093 | 216 | from nova.db.sqlalchemy import models | ||
1094 | 217 | models.register_models() | ||
1095 | 218 | except OperationalError: | ||
1096 | 219 | logging.exception(_("Data store %s is unreachable." | ||
1097 | 220 | " Trying again in %d seconds.") % | ||
1098 | 221 | (FLAGS.sql_connection, | ||
1099 | 222 | FLAGS.sql_retry_interval)) | ||
1100 | 223 | time.sleep(FLAGS.sql_retry_interval) | ||
1101 | 224 | |||
1102 | 225 | 212 | ||
1103 | 226 | def serve(*services): | 213 | def serve(*services): |
1104 | 227 | FLAGS(sys.argv) | 214 | FLAGS(sys.argv) |
1105 | 228 | 215 | ||
1106 | === modified file 'nova/tests/__init__.py' | |||
1107 | --- nova/tests/__init__.py 2010-12-11 20:10:24 +0000 | |||
1108 | +++ nova/tests/__init__.py 2011-01-19 01:35:10 +0000 | |||
1109 | @@ -34,3 +34,8 @@ | |||
1110 | 34 | # The code below enables nosetests to work with i18n _() blocks | 34 | # The code below enables nosetests to work with i18n _() blocks |
1111 | 35 | import __builtin__ | 35 | import __builtin__ |
1112 | 36 | setattr(__builtin__, '_', lambda x: x) | 36 | setattr(__builtin__, '_', lambda x: x) |
1113 | 37 | |||
1114 | 38 | |||
1115 | 39 | def setup(): | ||
1116 | 40 | from nova.db import migration | ||
1117 | 41 | migration.db_sync() | ||
1118 | 37 | 42 | ||
1119 | === modified file 'run_tests.py' | |||
1120 | --- run_tests.py 2011-01-04 20:57:18 +0000 | |||
1121 | +++ run_tests.py 2011-01-19 01:35:10 +0000 | |||
1122 | @@ -17,7 +17,7 @@ | |||
1123 | 17 | # See the License for the specific language governing permissions and | 17 | # See the License for the specific language governing permissions and |
1124 | 18 | # limitations under the License. | 18 | # limitations under the License. |
1125 | 19 | 19 | ||
1127 | 20 | 20 | import gettext | |
1128 | 21 | import os | 21 | import os |
1129 | 22 | import unittest | 22 | import unittest |
1130 | 23 | import sys | 23 | import sys |
1131 | 24 | 24 | ||
1132 | === modified file 'tools/pip-requires' | |||
1133 | --- tools/pip-requires 2011-01-14 15:51:42 +0000 | |||
1134 | +++ tools/pip-requires 2011-01-19 01:35:10 +0000 | |||
1135 | @@ -25,5 +25,6 @@ | |||
1136 | 25 | Twisted>=10.1.0 | 25 | Twisted>=10.1.0 |
1137 | 26 | PasteDeploy | 26 | PasteDeploy |
1138 | 27 | paste | 27 | paste |
1139 | 28 | sqlalchemy-migrate | ||
1140 | 28 | netaddr | 29 | netaddr |
1141 | 29 | glance | 30 | glance |
approve, nice work