diff options
-rw-r--r-- | nova/db/sqlalchemy/migrate_repo/versions/009_add_os_type_to_instances.py (renamed from nova/db/sqlalchemy/migrate_repo/versions/007_add_os_type_to_instances.py) | 11 | ||||
-rw-r--r-- | nova/virt/xenapi/vm_utils.py | 8 |
2 files changed, 15 insertions, 4 deletions
diff --git a/nova/db/sqlalchemy/migrate_repo/versions/007_add_os_type_to_instances.py b/nova/db/sqlalchemy/migrate_repo/versions/009_add_os_type_to_instances.py index d6d964b95..a50f31e16 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/007_add_os_type_to_instances.py +++ b/nova/db/sqlalchemy/migrate_repo/versions/009_add_os_type_to_instances.py @@ -17,6 +17,7 @@ # under the License. from sqlalchemy import * +from sqlalchemy.sql import text from migrate import * from nova import log as logging @@ -43,3 +44,13 @@ def upgrade(migrate_engine): meta.bind = migrate_engine instances.create_column(instances_os_type) + migrate_engine.execute(instances.update()\ + .where(instances.c.os_type==None)\ + .values(os_type='linux')) + + +def downgrade(migrate_engine): + meta.bind = migrate_engine + + instances.drop_column('os_type') + diff --git a/nova/virt/xenapi/vm_utils.py b/nova/virt/xenapi/vm_utils.py index 7bff81b66..150824400 100644 --- a/nova/virt/xenapi/vm_utils.py +++ b/nova/virt/xenapi/vm_utils.py @@ -117,7 +117,7 @@ class VMHelper(HelperBase): 'memory_target': mem, 'name_description': '', 'name_label': instance.name, -# 'other_config': {'allowvssprovider': False}, + 'other_config': {'allowvssprovider': False}, 'other_config': {}, 'PCI_bus': '', 'platform': {'acpi': 'true', 'apic': 'true', 'pae': 'true', @@ -313,14 +313,14 @@ class VMHelper(HelperBase): logging.debug(_("Asking xapi to upload %(vdi_uuids)s as" " ID %(image_id)s") % locals()) - # TODO(dubs): os_type is currently defaulting to linux, we actually - # want to make this a NOT NULL column and require it to be specified. + os_type = instance.os_type and instance.os_type or 'linux' + params = {'vdi_uuids': vdi_uuids, 'image_id': image_id, 'glance_host': FLAGS.glance_host, 'glance_port': FLAGS.glance_port, 'sr_path': get_sr_path(session), - 'os_type': instance.os_type} + 'os_type': os_type} kwargs = {'params': pickle.dumps(params)} task = session.async_call_plugin('glance', 'upload_vhd', kwargs) |