Return a dictionary for which key are volume names according to the
        output of gluster volume info stored in volume_file.
10905
def get_volume_names(self, volume_file):
        
        out = []
        fp = open(volume_file, 'r')
        for line in fp.readlines():
            if not line.startswith("Volume Name:"):
                continue
            volname = line[12:-1]
            out.append(volname)
        fp.close()
        return out
1052212
def status(name):
    '''
    
    '''
    # Get volume status
    root = _gluster_xml('volume status {0}'.format(name))
    if not _gluster_ok(root):
        # Most probably non-existing volume, the error output is logged
        # This return value is easy to test and intuitive
        return None

    ret = {'bricks': {}, 'nfs': {}, 'healers': {}}

    def etree_legacy_wrap(t):
        ret = _etree_to_dict(t)
        ret['online'] = (ret['status'] == '1')
        ret['host'] = ret['hostname']
        return ret

    # Build a hash to map hostname to peerid
    hostref = {}
    for node in _iter(root, 'node'):
        peerid = node.find('peerid').text
        hostname = node.find('hostname').text
        if hostname not in ('NFS Server', 'Self-heal Daemon'):
            hostref[peerid] = hostname

    for node in _iter(root, 'node'):
        hostname = node.find('hostname').text
        if hostname not in ('NFS Server', 'Self-heal Daemon'):
            path = node.find('path').text
            ret['bricks'][
                '{0}:{1}'.format(hostname, path)] = etree_legacy_wrap(node)
        elif hostname == 'NFS Server':
            peerid = node.find('peerid').text
            true_hostname = hostref[peerid]
            ret['nfs'][true_hostname] = etree_legacy_wrap(node)
        else:
            peerid = node.find('peerid').text
            true_hostname = hostref[peerid]
            ret['healers'][true_hostname] = etree_legacy_wrap(node)

    return ret
368247
def list_volume_schedules(self, volume_id):
        
        volume_detail = self.client.call(
            'Network_Storage',
            'getObject',
            id=volume_id,
            mask='schedules[type,properties[type]]')

        return utils.lookup(volume_detail, 'schedules')
1220078
def get_shm_volumes():
    
    volumes, volume_mounts = [], []
    shm_volume = client.V1Volume(
        name=constants.SHM_VOLUME,
        empty_dir=client.V1EmptyDirVolumeSource(medium='Memory')
    )
    volumes.append(shm_volume)
    shm_volume_mount = client.V1VolumeMount(name=shm_volume.name, mount_path='/dev/shm')
    volume_mounts.append(shm_volume_mount)
    return volumes, volume_mounts
589199
def asDictionary(self):
        
        self._dict = {
            "type" : self._type,
            "workspaceId" : self._workspaceId,
            "dataSourceName": self._dataSourceName,
            "gdbVersion" : self._gdbVersion
        }
        return self._dict
995544
def get_volumes(self):
        """"""

        if self.volumes:
            volumes = []
            for v in self.volumes:
                volumes.extend(v.get_volumes())
            volumes.append(self)
            return volumes
        else:
            return [self]
671430
def get_summary_dict(self):
        
        d = defaultdict(list)
        d["pressure"] = self.pressure
        d["poisson"] = self.poisson
        d["mass"] = self.mass
        d["natoms"] = int(self.natoms)
        d["bulk_modulus"] = self.bulk_modulus
        d["gibbs_free_energy"] = self.gibbs_free_energy
        d["temperatures"] = self.temperatures
        d["optimum_volumes"] = self.optimum_volumes
        for v, t in zip(self.optimum_volumes, self.temperatures):
            d["debye_temperature"].append(self.debye_temperature(v))
            d["gruneisen_parameter"].append(self.gruneisen_parameter(t, v))
            d["thermal_conductivity"].append(self.thermal_conductivity(t, v))
        return d
619517
def ident_dict(self):
        """"""

        SKIP_KEYS = ['name','vname','fqname','vid','cache_key']
        return {k: v for k, v in iteritems(self.dict) if k not in SKIP_KEYS}
1166339
def find_volume_groups(self):
        

        os.environ['LVM_SUPPRESS_FD_WARNINGS'] = '1'

        # find volume groups
        try:
            result = _util.check_output_(['pvdisplay'])
            pvname = vgname = None
            for line in result.splitlines():
                if '--- Physical volume ---' in line:
                    pvname = vgname = None
                elif "PV Name" in line:
                    pvname = line.replace("PV Name", "").strip()
                elif "VG Name" in line:
                    vgname = line.replace("VG Name", "").strip()

                if pvname and vgname:
                    try:
                        # unmount volume groups with a physical volume originating from a disk image
                        if re.match(self.orig_re_pattern, self.loopbacks[pvname]):
                            yield vgname, pvname
                    except Exception:
                        pass
                    pvname = vgname = None

        except Exception:
            pass
52078
def list_quota_volume(name):
    '''
    
    '''
    cmd = 'volume quota {0}'.format(name)
    cmd += ' list'

    root = _gluster_xml(cmd)
    if not _gluster_ok(root):
        return None

    ret = {}
    for limit in _iter(root, 'limit'):
        path = limit.find('path').text
        ret[path] = _etree_to_dict(limit)

    return ret
188433
def volumes(self):
        
        return sys_volumes.VolumeCollection(
            self._conn, utils.get_subresource_path_by(self, 'Volumes'),
            redfish_version=self.redfish_version)
921719
def info(name):
    '''
    
    '''
    try:
        grinfo = grp.getgrnam(name)
    except KeyError:
        return {}
    else:
        return {'name': grinfo.gr_name,
                'passwd': grinfo.gr_passwd,
                'gid': grinfo.gr_gid,
                'members': grinfo.gr_mem}
1115702
def by_vol_id(blocks, slist=None):
    

    vol_blocks = {}

    # sort block by volume
    # not reliable with multiple partitions (fifo)

    for i in blocks:
        if slist and i not in slist:
            continue
        elif not blocks[i].is_valid:
            continue

        if blocks[i].vid_hdr.vol_id not in vol_blocks:
            vol_blocks[blocks[i].vid_hdr.vol_id] = []

        vol_blocks[blocks[i].vid_hdr.vol_id].append(blocks[i].peb_num)

    return vol_blocks
1277222
def _get_all_volumes_paths(conn):
    '''
    
    '''
    volumes = [vol for l in [obj.listAllVolumes() for obj in conn.listAllStoragePools()] for vol in l]
    return {vol.path(): [path.text for path in ElementTree.fromstring(vol.XMLDesc()).findall('.//backingStore/path')]
            for vol in volumes if _is_valid_volume(vol)}
806813
def sealed_keys(self):
        """"""
        return dict([(a, e) for a, e in self.entries.items()
                     if isinstance(e, BksSealedKeyEntry)])
1151355
def info(gandi, resource):
    
    output_keys = ['name', 'state', 'size', 'type', 'id', 'dc', 'vm',
                   'profile', 'kernel', 'cmdline']

    resource = sorted(tuple(set(resource)))
    vms = dict([(vm['id'], vm) for vm in gandi.iaas.list()])
    datacenters = gandi.datacenter.list()

    result = []
    for num, item in enumerate(resource):
        if num:
            gandi.separator_line()
        disk = gandi.disk.info(item)
        output_disk(gandi, disk, datacenters, vms, [], output_keys)
        result.append(disk)

    return result
742311
def output_files(self):
        """"""
        output_list = []

        pm_dict = self.get_dict()
        output_list.append(pm_dict['output_surface'])
        if pm_dict['target_volume'] != 0.0:
            output_list.append(pm_dict['output_surface'] + str(".cell"))

        return output_list