def snapshot_name_to_id(name, snap_name, strict=False, runas=None):
 name = _sdecode(name)
 snap_name = _sdecode(snap_name)
 info = prlctl('snapshot-list', name, runas=runas)
 snap_ids = _find_guids(info)
 named_ids = []
 for snap_id in snap_ids:
  if (snapshot_id_to_name(name, snap_id, runas=runas) == snap_name):
   named_ids.append(snap_id)
 if (len(named_ids) == 0):
  raise SaltInvocationError(u'No snapshots for VM "{0}" have name "{1}"'.format(name, snap_name))
 elif (len(named_ids) == 1):
  return named_ids[0]
 else:
  multi_msg = u'Multiple snapshots for VM "{0}" have name "{1}"'.format(name, snap_name)
  if strict:
   raise SaltInvocationError(multi_msg)
  else:
   log.warning(multi_msg)
  return named_ids

def snapshot_name_to_id ( name , snap_name , strict = False , runas = None ) : name = _sdecode ( name ) snap_name = _sdecode ( snap_name ) info = prlctl ( 'snapshot-list' , name , runas = runas ) snap_ids = _find_guids ( info ) named_ids = [ ] for snap_id in snap_ids : if ( snapshot_id_to_name ( name , snap_id , runas = runas ) == snap_name ) : named_ids . append ( snap_id ) if ( len ( named_ids ) == 0 ) : raise SaltInvocationError ( u'No snapshots for VM "{0}" have name "{1}"' . format ( name , snap_name ) ) elif ( len ( named_ids ) == 1 ) : return named_ids [ 0 ] else : multi_msg = u'Multiple snapshots for VM "{0}" have name "{1}"' . format ( name , snap_name ) if strict : raise SaltInvocationError ( multi_msg ) else : log . warning ( multi_msg ) return named_ids
attempt to convert a snapshot name to a snapshot id .