Get disk by providing mount point or ID

		If key is not unique and finds multiple matches only the first
		will be returned
333501
def Get(self,key):
		

		for disk in self.disks:
			if disk.id == key:  return(disk)
			elif key in disk.partition_paths:  return(disk)
1110750
def findEntry(name, flags = FE_EITHER)
      de = nil # found directory entry.
      skip_next = found = false
      offset = 0

      # Look for appropriate records.
      0.step(@data.length - 1, DIR_ENT_SIZE) do|offset|
        # Check allocation status (ignore if deleted, done if not allocated).
        alloc_flags = @data[offset]
        next if alloc_flags == DirectoryEntry::AF_DELETED
        break if alloc_flags == DirectoryEntry::AF_NOT_ALLOCATED

        # Skip LFN entries unless it's the first (last iteration already chewed them all up).
        attrib = @data[offset + ATTRIB_OFFSET]
        if attrib == DirectoryEntry::FA_LFN && (alloc_flags & DirectoryEntry::AF_LFN_LAST != DirectoryEntry::AF_LFN_LAST)
          # Also skip the next entry (it's the base entry for the last dir ent).
          skip_next = true; next
        end
        if skip_next
          skip_next = false; next
        end

        # If a specific type of record was requested, look for only that type.
        # NOTE: You know, it's possible to look ahead and see what the base entry is.
        if flags != FE_EITHER && attrib != DirectoryEntry::FA_LFN
          next if flags == FE_DIR && (attrib & DirectoryEntry::FA_DIRECTORY == 0)
          next if flags == FE_FILE && (attrib & DirectoryEntry::FA_DIRECTORY != 0)
        end

        # Potential match... get a DirectoryEntry & stop if found.
        de = DirectoryEntry.new(@data[offset, MAX_ENT_SIZE])
        # TODO: - what if the name ends with a dot & there's another dot in the name?
        if de.name.downcase == name.downcase || de.shortName.downcase == name.downcase
          found = true
          break
        end
      end
      return nil unless found
      parentLoc = offset.divmod(@bs.bytesPerCluster)
      de.parentCluster = @all_clusters[parentLoc[0]].number
      de.parentOffset = parentLoc[1]
      de
    end
344039
def _mount_points(self):
        
        diskutil_ls = subprocess.Popen(
            ["diskutil", "list", "-plist"], stdout=subprocess.PIPE
        )
        disks = _plist_from_popen(diskutil_ls)

        return {
            disk["DeviceIdentifier"]: disk.get("MountPoint", None)
            for disk in disks["AllDisksAndPartitions"]
        }
248092
def umount(self, forced=True):
        
        if self.is_mounted():
            if is_osx():
                cmd = ["/usr/sbin/diskutil", "unmount",
                       self.connection["mount_point"]]
                if forced:
                    cmd.insert(2, "force")
                subprocess.check_call(cmd)
            else:
                cmd = ["umount", self.connection["mount_point"]]
                if forced:
                    cmd.insert(1, "-f")
                subprocess.check_call(cmd)
1017636
function(partition) {
                     var self = this;
                     var results = {
                         'id': [],
                         'partition': [],
                         'nameUUID': [],
                         'status': []
                     };
                     self.data.partition.map(function(val, i) { // for each partition
                         if (val.match(partition)) { // if the job is on @partition
                             for (var key in self.data) { // keep all the {'key':'value'} corresponding
                                 results[key].push(self.data[key][i]);
                             }
                         }
                     });
                     return results;
                 }
945251
def get_match_value(rexobj, key, index=0):
    '''
    
    '''
    if rexobj is None:
        return None

    if rexobj.res_count == 0:
        return None

    try:
        return rexobj.matches[index].named_groups[key]
    except IndexError:
        return None
    except KeyError:
        return None
512965
def get_hash(self, handle):
        """"""
        fpath = self._fpath_from_handle(handle)
        return DiskStorageBroker.hasher(fpath)
151090
def get(self, key, failobj=None, exact=0):

        """"""

        if not exact:
            try:
                key = self.getfullkey(key)
            except KeyError:
                return failobj
        return self.data.get(key,failobj)
144035
def _get_disks(dom):
    '''
    
    '''
    disks = {}
    doc = ElementTree.fromstring(dom.XMLDesc(0))
    for elem in doc.findall('devices/disk'):
        source = elem.find('source')
        if source is None:
            continue
        target = elem.find('target')
        if target is None:
            continue
        if 'dev' in target.attrib:
            qemu_target = source.get('file', '')
            if not qemu_target:
                qemu_target = source.get('dev', '')
            elif qemu_target.startswith('/dev/zvol/'):
                disks[target.get('dev')] = {
                        'file': qemu_target,
                        'zfs': True}
                continue
            if not qemu_target and 'protocol' in source.attrib and 'name' in source.attrib:  # for rbd network
                qemu_target = '{0}:{1}'.format(
                        source.get('protocol'),
                        source.get('name'))
            if not qemu_target:
                continue

            disk = {'file': qemu_target, 'type': elem.get('device')}

            driver = elem.find('driver')
            if driver is not None and driver.get('type') == 'qcow2':
                try:
                    stdout = subprocess.Popen(
                                ['qemu-img', 'info', '--output', 'json', '--backing-chain', disk['file']],
                                shell=False,
                                stdout=subprocess.PIPE).communicate()[0]
                    qemu_output = salt.utils.stringutils.to_str(stdout)
                    output = _parse_qemu_img_info(qemu_output)
                    disk.update(output)
                except TypeError:
                    disk.update({'file': 'Does not exist'})

            disks[target.get('dev')] = disk
    return disks
175133
def GetRawDevice(path):
  """"""
  device_map = GetMountpoints()

  path = utils.SmartUnicode(path)
  mount_point = path = utils.NormalizePath(path, "/")

  result = rdf_paths.PathSpec(pathtype=rdf_paths.PathSpec.PathType.OS)

  # Assign the most specific mount point to the result
  while mount_point:
    try:
      result.path, fs_type = device_map[mount_point]
      if fs_type in [
          "ext2", "ext3", "ext4", "vfat", "ntfs", "Apple_HFS", "hfs", "msdos"
      ]:
        # These are read filesystems
        result.pathtype = rdf_paths.PathSpec.PathType.OS
      else:
        result.pathtype = rdf_paths.PathSpec.PathType.UNSET

      # Drop the mount point
      path = utils.NormalizePath(path[len(mount_point):])

      return result, path
    except KeyError:
      mount_point = os.path.dirname(mount_point)
26248
def get_key(key, host=None, port=None, db=None, password=None):
    '''
    
    '''
    server = _connect(host, port, db, password)
    return server.get(key)
697188
def find(self, name, limit=None):
        """"""
        if name == self.name:
            if limit is not None:
                assert limit == 1
                self.subdirs = []
            return self
        for subdir in self.subdirs:
            res = subdir.find(name, limit)
            if res is not None:
                return res
        return None
1251477
def get(self, key):
        
        if not self.servers:
            return self.miss

        key = self._qualified_key(key)
        hashed_key = self.key_hasher(key)
        entry = self.client.get(hashed_key)

        if isinstance(entry, tuple) and len(entry) == 2:
            key_, result = entry
            if key_ == key:
                self.logger("HIT: %s", key)
                return result

        self.logger("MISS: %s", key)
        return self.miss
985382
def Find(cls, setting_matcher, port_path=None, serial=None, timeout_ms=None):
        """"""
        if port_path:
            device_matcher = cls.PortPathMatcher(port_path)
            usb_info = port_path
        elif serial:
            device_matcher = cls.SerialMatcher(serial)
            usb_info = serial
        else:
            device_matcher = None
            usb_info = 'first'
        return cls.FindFirst(setting_matcher, device_matcher,
                             usb_info=usb_info, timeout_ms=timeout_ms)
512394
def find_first(self, name=None, ns_uri=None):
        
        return self.find(name=name, ns_uri=ns_uri, first_only=True)
663152
def _get_first(self, keys, default=None):
        
        d = self.device
        for k in keys:
            v = d.get(k)
            if not v is None:
                return v
        return default
1109325
def _find(self, id_):
        
        cur = self._connection.cursor()
        cur.execute(
            'SELECT fileNumber, offset FROM sequences WHERE id = ?', (id_,))
        row = cur.fetchone()
        if row is None:
            return None
        else:
            return self._getFilename(row[0]), row[1]