Skip to content

Commit

Permalink
remove db access in xen driver.
Browse files Browse the repository at this point in the history
fix bug 1081949

Change-Id: I0b0369921b974d068b92c90db8b3cf0ae396cc2d
  • Loading branch information
yaguangtang committed Nov 22, 2012
1 parent 4ff9b97 commit 2b097ea
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions nova/virt/xenapi/vm_utils.py
Expand Up @@ -35,7 +35,6 @@
from eventlet import greenthread

from nova import block_device
from nova.compute import instance_types
from nova.compute import power_state
from nova import exception
from nova.image import glance
Expand Down Expand Up @@ -204,8 +203,7 @@ def create_vm(session, instance, name_label, kernel, ramdisk,
3. Using hardware virtualization
"""
inst_type_id = instance['instance_type_id']
instance_type = instance_types.get_instance_type(inst_type_id)
instance_type = instance['instance_type']
mem = str(long(instance_type['memory_mb']) * 1024 * 1024)
vcpus = str(instance_type['vcpus'])

Expand Down Expand Up @@ -320,7 +318,7 @@ def _is_vm_shutdown(session, vm_ref):

def ensure_free_mem(session, instance):
inst_type_id = instance['instance_type_id']
instance_type = instance_types.get_instance_type(inst_type_id)
instance_type = instance['instance_type']
mem = long(instance_type['memory_mb']) * 1024 * 1024
host = session.get_xenapi_host()
host_free_mem = long(session.call_xenapi("host.compute_free_memory",
Expand Down Expand Up @@ -1139,8 +1137,7 @@ def _check_vdi_size(context, session, instance, vdi_uuid):

# FIXME(jk0): this was copied directly from compute.manager.py, let's
# refactor this to a common area
instance_type_id = instance['instance_type_id']
instance_type = instance_types.get_instance_type(instance_type_id)
instance_type = instance['instance_type']
allowed_size_gb = instance_type['root_gb']
allowed_size_bytes = allowed_size_gb * 1024 * 1024 * 1024

Expand Down

0 comments on commit 2b097ea

Please sign in to comment.