summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Alekseyev <ialekseev@griddynamics.com>2011-04-12 02:44:44 +0400
committerIlya Alekseyev <ialekseev@griddynamics.com>2011-04-12 02:44:44 +0400
commit4a2c973fe5c7cf68ff7f45a4927dc6d2e0a3986b (patch)
tree7b2e374ce42f564ce396c35265c5793478edbd52
parent9ce66a4a09094d2b0403deea77416149aa789f3c (diff)
migaration and pep8 fixes
-rw-r--r--nova/api/openstack/contrib/volumes.py3
-rw-r--r--nova/compute/manager.py4
-rw-r--r--nova/db/api.py2
-rw-r--r--nova/db/sqlalchemy/migrate_repo/versions/015_add_auto_assign_to_floating_ips.py38
4 files changed, 42 insertions, 5 deletions
diff --git a/nova/api/openstack/contrib/volumes.py b/nova/api/openstack/contrib/volumes.py
index 6efacce52..18de2ec71 100644
--- a/nova/api/openstack/contrib/volumes.py
+++ b/nova/api/openstack/contrib/volumes.py
@@ -322,8 +322,7 @@ class Volumes(extensions.ExtensionDescriptor):
# Does this matter?
res = extensions.ResourceExtension('volumes',
VolumeController(),
- collection_actions={'detail': 'GET'}
- )
+ collection_actions={'detail': 'GET'})
resources.append(res)
res = extensions.ResourceExtension('volume_attachments',
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 86273b6b4..af3551708 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -73,7 +73,7 @@ flags.DEFINE_integer('live_migration_retry_count', 30,
flags.DEFINE_integer("rescue_timeout", 0,
"Automatically unrescue an instance after N seconds."
" Set to 0 to disable.")
-flags.DEFINE_bool('auto_assign_floating_ip',False, 'Autoassigning floating'
+flags.DEFINE_bool('auto_assign_floating_ip', False, 'Autoassigning floating'
' ip to VM')
LOG = logging.getLogger('nova.compute.manager')
@@ -235,7 +235,6 @@ class ComputeManager(manager.SchedulerDependentManager):
instance_id=instance_id,
address=public_ip)
-
# TODO(vish) check to make sure the availability zone matches
self.db.instance_set_state(context,
instance_id,
@@ -283,7 +282,6 @@ class ComputeManager(manager.SchedulerDependentManager):
network_topic,
{"method": "disassociate_floating_ip",
"args": {"floating_address": address}})
-
if FLAGS.auto_assign_floating_ip:
LOG.debug(_("Deallocating floating ip %s"),
floating_ip['address'], context=context)
diff --git a/nova/db/api.py b/nova/db/api.py
index 859acc146..6b465c021 100644
--- a/nova/db/api.py
+++ b/nova/db/api.py
@@ -290,12 +290,14 @@ def floating_ip_update(context, address, values):
"""Update a floating ip by address or raise if it doesn't exist."""
return IMPL.floating_ip_update(context, address, values)
+
def floating_ip_set_auto_assigned(context, address):
"""Set auto_assigned flag to floating ip"""
return IMPL.floating_ip_set_auto_assigned(context, address)
####################
+
def migration_update(context, id, values):
"""Update a migration instance"""
return IMPL.migration_update(context, id, values)
diff --git a/nova/db/sqlalchemy/migrate_repo/versions/015_add_auto_assign_to_floating_ips.py b/nova/db/sqlalchemy/migrate_repo/versions/015_add_auto_assign_to_floating_ips.py
new file mode 100644
index 000000000..b7e480e67
--- /dev/null
+++ b/nova/db/sqlalchemy/migrate_repo/versions/015_add_auto_assign_to_floating_ips.py
@@ -0,0 +1,38 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2011 OpenStack LLC.
+# Copyright 2011 Grid Dynamics
+#
+# 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 *
+from sqlalchemy.sql import text
+from migrate import *
+
+
+meta = MetaData()
+
+c_auto_assigned = Column('auto_assigned',Boolean, default=False)
+
+
+def upgrade(migrate_engine):
+ # Upgrade operations go here. Don't create your own engine;
+ # bind migrate_engine to your metadata
+ meta.bind = migrate_engine
+
+ floating_ips = Table('floating_ips', meta, autoload=True,
+ autoload_with=migrate_engine)
+
+ floating_ips.create_column(c_auto_assigned)
+
+ \ No newline at end of file