Skip to content

Commit

Permalink
Merge "Minor xenapi driver cleanups"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Mar 29, 2012
2 parents 8079d82 + 5874779 commit ebd7a68
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
3 changes: 0 additions & 3 deletions nova/virt/xenapi/__init__.py
Expand Up @@ -26,9 +26,6 @@ class HelperBase(object):
"""
XenAPI = None

def __init__(self):
return

@classmethod
def get_rec(cls, session, record_type, ref):
try:
Expand Down
26 changes: 12 additions & 14 deletions nova/virt/xenapi/vm_utils.py
Expand Up @@ -143,13 +143,12 @@ class VMHelper(xenapi.HelperBase):
@classmethod
def create_vm(cls, session, instance, kernel, ramdisk,
use_pv_kernel=False):
"""Create a VM record. Returns a Deferred that gives the new
VM reference.
"""Create a VM record. Returns new VM reference.
the use_pv_kernel flag indicates whether the guest is HVM or PV
There are 3 scenarios:
1. Using paravirtualization, kernel passed in
1. Using paravirtualization, kernel passed in
2. Using paravirtualization, kernel within the image
Expand Down Expand Up @@ -306,10 +305,10 @@ def create_vbd(cls, session, vm_ref, vdi_ref, userdevice,
vbd_rec['qos_algorithm_params'] = {}
vbd_rec['qos_supported_algorithms'] = []
LOG.debug(_('Creating %(vbd_type)s-type VBD for VM %(vm_ref)s,'
' VDI %(vdi_ref)s ... ') % locals())
' VDI %(vdi_ref)s ... '), locals())
vbd_ref = session.call_xenapi('VBD.create', vbd_rec)
LOG.debug(_('Created VBD %(vbd_ref)s for VM %(vm_ref)s,'
' VDI %(vdi_ref)s.') % locals())
' VDI %(vdi_ref)s.'), locals())
return vbd_ref

@classmethod
Expand Down Expand Up @@ -337,8 +336,8 @@ def create_vdi(cls, session, sr_ref, name_label, virtual_size, read_only):
'sm_config': {},
'tags': []})
LOG.debug(_('Created VDI %(vdi_ref)s (%(name_label)s,'
' %(virtual_size)s, %(read_only)s) on %(sr_ref)s.')
% locals())
' %(virtual_size)s, %(read_only)s) on %(sr_ref)s.'),
locals())
return vdi_ref

@classmethod
Expand Down Expand Up @@ -372,8 +371,8 @@ def get_vdi_for_vm_safely(cls, session, vm_ref):
if vbd_rec['userdevice'] == '0':
vdi_rec = session.call_xenapi("VDI.get_record", vbd_rec['VDI'])
return vbd_rec['VDI'], vdi_rec
raise exception.Error(_("No primary VDI found for"
"%(vm_ref)s") % locals())
raise exception.Error(_("No primary VDI found for %(vm_ref)s") %
locals())

@classmethod
def create_snapshot(cls, session, instance, vm_ref, label):
Expand All @@ -393,7 +392,7 @@ def create_snapshot(cls, session, instance, vm_ref, label):
template_vdi_uuid = template_vdi_rec["uuid"]

LOG.debug(_('Created snapshot %(template_vm_ref)s from'
' VM %(vm_ref)s.') % locals())
' VM %(vm_ref)s.') % locals())

parent_uuid, base_uuid = _wait_for_vhd_coalesce(
session, instance, sr_ref, vm_vdi_ref, original_parent_uuid)
Expand Down Expand Up @@ -852,8 +851,7 @@ def _fetch_image_glance_disk(cls, context, session, instance, image,
meta, image_file = glance_client.get_image(image_id)
virtual_size = int(meta['size'])
vdi_size = virtual_size
LOG.debug(_("Size for image %(image)s:" +
"%(virtual_size)d") % locals())
LOG.debug(_("Size for image %(image)s: %(virtual_size)d"), locals())
if image_type == ImageType.DISK:
# Make room for MBR.
vdi_size += MBR_SIZE_BYTES
Expand Down Expand Up @@ -1201,7 +1199,7 @@ def find_iso_sr(cls, session):
LOG.debug(_("ISO: PBD %(pbd_ref)s disappeared") % locals())
continue
pbd_rec_host = pbd_rec['host']
LOG.debug(_("ISO: PBD matching, want %(pbd_rec)s, " +
LOG.debug(_("ISO: PBD matching, want %(pbd_rec)s, "
"have %(host)s") % locals())
if pbd_rec_host == host:
LOG.debug(_("ISO: SR with local PBD"))
Expand Down Expand Up @@ -1382,7 +1380,7 @@ def walk_vdi_chain(session, vdi_uuid):

def _wait_for_vhd_coalesce(session, instance, sr_ref, vdi_ref,
original_parent_uuid):
""" Spin until the parent VHD is coalesced into its parent VHD
"""Spin until the parent VHD is coalesced into its parent VHD
Before coalesce:
* original_parent_vhd
Expand Down

0 comments on commit ebd7a68

Please sign in to comment.