diff options
author | Cory Wright <cory.wright@rackspace.com> | 2011-03-08 14:35:53 +0000 |
---|---|---|
committer | Cory Wright <cory.wright@rackspace.com> | 2011-03-08 14:35:53 +0000 |
commit | b8a0fdca4df454a4d60df40d06ebd82bcc2ba3da (patch) | |
tree | 80d2f054ac3c8ecf93541d598c71d89e22ea048f | |
parent | 4937a1ec17beadb6e1737ac126adf68fd6dbf2c8 (diff) | |
download | nova-b8a0fdca4df454a4d60df40d06ebd82bcc2ba3da.tar.gz nova-b8a0fdca4df454a4d60df40d06ebd82bcc2ba3da.tar.xz nova-b8a0fdca4df454a4d60df40d06ebd82bcc2ba3da.zip |
* pep8 cleanups in migrations
* a few bugfixes
-rw-r--r-- | nova/db/sqlalchemy/migrate_repo/versions/009_add_os_type_to_instances.py | 5 | ||||
-rw-r--r-- | nova/tests/test_xenapi.py | 4 | ||||
-rw-r--r-- | nova/virt/xenapi/vm_utils.py | 2 |
3 files changed, 4 insertions, 7 deletions
diff --git a/nova/db/sqlalchemy/migrate_repo/versions/009_add_os_type_to_instances.py b/nova/db/sqlalchemy/migrate_repo/versions/009_add_os_type_to_instances.py index a50f31e16..514b92b81 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/009_add_os_type_to_instances.py +++ b/nova/db/sqlalchemy/migrate_repo/versions/009_add_os_type_to_instances.py @@ -29,8 +29,6 @@ instances = Table('instances', meta, Column('id', Integer(), primary_key=True, nullable=False), ) -# FIXME(dubs) should this be not null? Maybe create as nullable, then -# populate all existing rows with 'linux', then adding not null constraint. instances_os_type = Column('os_type', String(length=255, convert_unicode=False, assert_unicode=None, unicode_error=None, @@ -45,7 +43,7 @@ def upgrade(migrate_engine): instances.create_column(instances_os_type) migrate_engine.execute(instances.update()\ - .where(instances.c.os_type==None)\ + .where(instances.c.os_type == None)\ .values(os_type='linux')) @@ -53,4 +51,3 @@ def downgrade(migrate_engine): meta.bind = migrate_engine instances.drop_column('os_type') - diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index 27f0e5dd7..25070e108 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -251,7 +251,7 @@ class XenAPIVMTestCase(test.TestCase): self.vm_info = vm_info self.vm = vm - def check_vm_record(self): + def check_vm_record(self, conn): # Check that m1.large above turned into the right thing. instance_type = db.instance_type_get_by_name(conn, 'm1.large') mem_kib = long(instance_type['memory_mb']) << 10 @@ -321,7 +321,7 @@ class XenAPIVMTestCase(test.TestCase): instance = db.instance_create(values) conn.spawn(instance) self.create_vm_record(conn, os_type) - self.check_vm_record() + self.check_vm_record(conn) def test_spawn_not_enough_memory(self): FLAGS.xenapi_image_service = 'glance' diff --git a/nova/virt/xenapi/vm_utils.py b/nova/virt/xenapi/vm_utils.py index 150824400..604e8a4e0 100644 --- a/nova/virt/xenapi/vm_utils.py +++ b/nova/virt/xenapi/vm_utils.py @@ -324,7 +324,7 @@ class VMHelper(HelperBase): kwargs = {'params': pickle.dumps(params)} task = session.async_call_plugin('glance', 'upload_vhd', kwargs) - session.wait_for_task(task, instance_id) + session.wait_for_task(task, instance.id) @classmethod def fetch_image(cls, session, instance_id, image, user, project, |