def create_vdi(session, sr_ref, instance, name_label, disk_type, virtual_size, read_only=False):
 otherconf = {'nova_disk_type': disk_type}
 if instance:
  otherconf['nova_instance_uuid'] = instance['uuid']
 vdi_ref = session.call_xenapi('VDI.create', {'name_label': name_label, 'name_description': disk_type, 'SR': sr_ref, 'virtual_size': str(virtual_size), 'type': 'User', 'sharable': False, 'read_only': read_only, 'xenstore_data': {}, 'other_config': otherconf, 'sm_config': {}, 'tags': []})
 LOG.debug(_('Created VDI %(vdi_ref)s (%(name_label)s, %(virtual_size)s, %(read_only)s) on %(sr_ref)s.'), locals())
 return vdi_ref

def create_vdi ( session , sr_ref , instance , name_label , disk_type , virtual_size , read_only = False ) : otherconf = { 'nova_disk_type' : disk_type } if instance : otherconf [ 'nova_instance_uuid' ] = instance [ 'uuid' ] vdi_ref = session . call_xenapi ( 'VDI.create' , { 'name_label' : name_label , 'name_description' : disk_type , 'SR' : sr_ref , 'virtual_size' : str ( virtual_size ) , 'type' : 'User' , 'sharable' : False , 'read_only' : read_only , 'xenstore_data' : { } , 'other_config' : otherconf , 'sm_config' : { } , 'tags' : [ ] } ) LOG . debug ( _ ( 'Created VDI %(vdi_ref)s (%(name_label)s, %(virtual_size)s, %(read_only)s) on %(sr_ref)s.' ) , locals ( ) ) return vdi_ref
create a vdi record and returns its reference .