def _get_volume_id(path_or_id):
 if isinstance(path_or_id, int):
  return path_or_id
 volume_id = path_or_id[(path_or_id.find(':volume-') + 1):]
 if (volume_id == path_or_id):
  volume_id = path_or_id[(path_or_id.find('-volume--') + 1):]
  volume_id = volume_id.replace('volume--', '')
 else:
  volume_id = volume_id.replace('volume-', '')
  volume_id = volume_id[0:volume_id.find('-')]
 return int(volume_id)

def _get_volume_id ( path_or_id ) : if isinstance ( path_or_id , int ) : return path_or_id volume_id = path_or_id [ ( path_or_id . find ( ':volume-' ) + 1 ) : ] if ( volume_id == path_or_id ) : volume_id = path_or_id [ ( path_or_id . find ( '-volume--' ) + 1 ) : ] volume_id = volume_id . replace ( 'volume--' , '' ) else : volume_id = volume_id . replace ( 'volume-' , '' ) volume_id = volume_id [ 0 : volume_id . find ( '-' ) ] return int ( volume_id )
retrieve the volume id from device_path .