def find_disk_dev_for_disk_bus(mapping, bus, last_device=False):
 dev_prefix = get_dev_prefix_for_disk_bus(bus)
 if (dev_prefix is None):
  return None
 max_dev = get_dev_count_for_disk_bus(bus)
 if last_device:
  devs = [(max_dev - 1)]
 else:
  devs = range(max_dev)
 for idx in devs:
  disk_dev = (dev_prefix + chr((ord('a') + idx)))
  if (not has_disk_dev(mapping, disk_dev)):
   return disk_dev
 raise exception.NovaException(_("No free disk device names for prefix '%s'"), dev_prefix)

def find_disk_dev_for_disk_bus ( mapping , bus , last_device = False ) : dev_prefix = get_dev_prefix_for_disk_bus ( bus ) if ( dev_prefix is None ) : return None max_dev = get_dev_count_for_disk_bus ( bus ) if last_device : devs = [ ( max_dev - 1 ) ] else : devs = range ( max_dev ) for idx in devs : disk_dev = ( dev_prefix + chr ( ( ord ( 'a' ) + idx ) ) ) if ( not has_disk_dev ( mapping , disk_dev ) ) : return disk_dev raise exception . NovaException ( _ ( "No free disk device names for prefix '%s'" ) , dev_prefix )
identify a free disk dev name for a bus .