summaryrefslogtreecommitdiffstats
path: root/nova/db
diff options
context:
space:
mode:
authorRyu Ishimoto <ryu@midokura.jp>2011-08-19 10:22:24 +0900
committerRyu Ishimoto <ryu@midokura.jp>2011-08-19 10:22:24 +0900
commit93bf9b46a8ca28063752bc9e6c14ed59e91c50a9 (patch)
treeaf112b10f3e1a352afea8eea25cdcd59d9ce87b9 /nova/db
parent54883a4ca07fe6b2f966a604f84e1127477d9a55 (diff)
parent862dc7acaf86bcfaebfce423c8198ea18b5e07c4 (diff)
Merged trunk
Diffstat (limited to 'nova/db')
-rw-r--r--nova/db/sqlalchemy/api.py3
-rw-r--r--nova/db/sqlalchemy/migrate_repo/versions/037_instances_drop_admin_pass.py37
-rw-r--r--nova/db/sqlalchemy/migrate_repo/versions/038_add_uuid_to_virtual_interfaces.py (renamed from nova/db/sqlalchemy/migrate_repo/versions/037_add_uuid_to_virtual_interfaces.py)0
-rw-r--r--nova/db/sqlalchemy/models.py1
-rw-r--r--nova/db/sqlalchemy/session.py4
5 files changed, 42 insertions, 3 deletions
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index 95ec3f715..fe80056ab 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -1222,7 +1222,8 @@ def instance_get_all_by_filters(context, filters):
options(joinedload('security_groups')).\
options(joinedload_all('fixed_ips.network')).\
options(joinedload('metadata')).\
- options(joinedload('instance_type'))
+ options(joinedload('instance_type')).\
+ filter_by(deleted=can_read_deleted(context))
# Make a copy of the filters dictionary to use going forward, as we'll
# be modifying it and we shouldn't affect the caller's use of it.
diff --git a/nova/db/sqlalchemy/migrate_repo/versions/037_instances_drop_admin_pass.py b/nova/db/sqlalchemy/migrate_repo/versions/037_instances_drop_admin_pass.py
new file mode 100644
index 000000000..b957666c2
--- /dev/null
+++ b/nova/db/sqlalchemy/migrate_repo/versions/037_instances_drop_admin_pass.py
@@ -0,0 +1,37 @@
+# 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, MetaData, Table, String
+
+meta = MetaData()
+
+admin_pass = Column(
+ 'admin_pass',
+ String(length=255, convert_unicode=False, assert_unicode=None,
+ unicode_error=None, _warn_on_bytestring=False),
+ nullable=True)
+
+
+def upgrade(migrate_engine):
+ meta.bind = migrate_engine
+ instances = Table('instances', meta, autoload=True,
+ autoload_with=migrate_engine)
+ instances.drop_column('admin_pass')
+
+
+def downgrade(migrate_engine):
+ meta.bind = migrate_engine
+ instances = Table('instances', meta, autoload=True,
+ autoload_with=migrate_engine)
+ instances.create_column(admin_pass)
diff --git a/nova/db/sqlalchemy/migrate_repo/versions/037_add_uuid_to_virtual_interfaces.py b/nova/db/sqlalchemy/migrate_repo/versions/038_add_uuid_to_virtual_interfaces.py
index 0f542cbec..0f542cbec 100644
--- a/nova/db/sqlalchemy/migrate_repo/versions/037_add_uuid_to_virtual_interfaces.py
+++ b/nova/db/sqlalchemy/migrate_repo/versions/038_add_uuid_to_virtual_interfaces.py
diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py
index 32fe64b4f..0e2bace83 100644
--- a/nova/db/sqlalchemy/models.py
+++ b/nova/db/sqlalchemy/models.py
@@ -173,7 +173,6 @@ class Instance(BASE, NovaBase):
base_name += "-rescue"
return base_name
- admin_pass = Column(String(255))
user_id = Column(String(255))
project_id = Column(String(255))
diff --git a/nova/db/sqlalchemy/session.py b/nova/db/sqlalchemy/session.py
index 07f281938..643e2338e 100644
--- a/nova/db/sqlalchemy/session.py
+++ b/nova/db/sqlalchemy/session.py
@@ -73,9 +73,11 @@ def get_engine():
elif MySQLdb and "mysql" in connection_dict.drivername:
LOG.info(_("Using mysql/eventlet db_pool."))
+ # MySQLdb won't accept 'None' in the password field
+ password = connection_dict.password or ''
pool_args = {
"db": connection_dict.database,
- "passwd": connection_dict.password,
+ "passwd": password,
"host": connection_dict.host,
"user": connection_dict.username,
"min_size": FLAGS.sql_min_pool_size,