def pick_disk_driver_name(hypervisor_version, is_block_dev=False):
 if (CONF.libvirt.virt_type == 'xen'):
  if is_block_dev:
   return 'phy'
  else:
   if (hypervisor_version >= 4002000):
    try:
     execute('xend', 'status', run_as_root=True, check_exit_code=True)
    except OSError as exc:
     if (exc.errno == errno.ENOENT):
      LOG.debug('xend is not found')
      return 'qemu'
     else:
      raise
    except processutils.ProcessExecutionError:
     LOG.debug('xend is not started')
     return 'qemu'
   try:
    (out, err) = execute('tap-ctl', 'check', check_exit_code=False)
    if (out == 'ok\n'):
     if (hypervisor_version > 4000000):
      return 'tap2'
     else:
      return 'tap'
    else:
     LOG.info(_LI('tap-ctl check: %s'), out)
   except OSError as exc:
    if (exc.errno == errno.ENOENT):
     LOG.debug('tap-ctl tool is not installed')
    else:
     raise
   return 'file'
 elif (CONF.libvirt.virt_type in ('kvm', 'qemu')):
  return 'qemu'
 else:
  return None

def pick_disk_driver_name ( hypervisor_version , is_block_dev = False ) : if ( CONF . libvirt . virt_type == 'xen' ) : if is_block_dev : return 'phy' else : if ( hypervisor_version >= 4002000 ) : try : execute ( 'xend' , 'status' , run_as_root = True , check_exit_code = True ) except OSError as exc : if ( exc . errno == errno . ENOENT ) : LOG . debug ( 'xend is not found' ) return 'qemu' else : raise except processutils . ProcessExecutionError : LOG . debug ( 'xend is not started' ) return 'qemu' try : ( out , err ) = execute ( 'tap-ctl' , 'check' , check_exit_code = False ) if ( out == 'ok\n' ) : if ( hypervisor_version > 4000000 ) : return 'tap2' else : return 'tap' else : LOG . info ( _LI ( 'tap-ctl check: %s' ) , out ) except OSError as exc : if ( exc . errno == errno . ENOENT ) : LOG . debug ( 'tap-ctl tool is not installed' ) else : raise return 'file' elif ( CONF . libvirt . virt_type in ( 'kvm' , 'qemu' ) ) : return 'qemu' else : return None
pick the libvirt primary backend driver name if the hypervisor supports multiple backend drivers .