From 1eb36726e2c7107aa5f99fe1b7b528a82e4a28b9 Mon Sep 17 00:00:00 2001 From: Devananda van der Veen Date: Thu, 7 Feb 2013 16:42:29 -0800 Subject: Remove nova.db call from baremetal PXE driver Baremetal PXE driver was fetching instance_type from the nova db. Now that no-db-compute is done, that's not possible. Also, there's a more efficient way -- just call extract_instance_type(instance)! Baremetal unit tests should check for instance_types with swap = 0 and with swap > 0. This required changing test/utils to include a real copy of instance_types in instance['system_metadata']. Change-Id: I2a91e5c026782946f6b01e4189ec85d30ba87583 --- nova/virt/baremetal/pxe.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'nova/virt') diff --git a/nova/virt/baremetal/pxe.py b/nova/virt/baremetal/pxe.py index a169e13e5..9a8a4fed0 100644 --- a/nova/virt/baremetal/pxe.py +++ b/nova/virt/baremetal/pxe.py @@ -167,11 +167,9 @@ def get_pxe_config_file_path(instance): def get_partition_sizes(instance): - type_id = instance['instance_type_id'] - root_mb = instance['root_gb'] * 1024 - - # NOTE(deva): is there a way to get swap_mb directly from instance? - swap_mb = instance_types.get_instance_type(type_id)['swap'] + instance_type = instance_types.extract_instance_type(instance) + root_mb = instance_type['root_gb'] * 1024 + swap_mb = instance_type['swap'] # NOTE(deva): For simpler code paths on the deployment side, # we always create a swap partition. If the flavor -- cgit