Generates volume options to run methods.

        :param volumes: tuple or list of tuples in form target x source,target x source,target,mode.
        :return: list of the form ["-v", "/source:/target", "-v", "/other/source:/destination:z", ...]
420233
def get_volume_options(volumes):
        
        if not isinstance(volumes, list):
            volumes = [volumes]
        volumes = [Volume.create_from_tuple(v) for v in volumes]
        result = []
        for v in volumes:
            result += ["-v", str(v)]
        return result
1284666
def set_volume(self, volume):
        
        volume = min(max(0, volume), 1)
        self.logger.info("Receiver:setting volume to %.1f", volume)
        self.send_message({MESSAGE_TYPE: 'SET_VOLUME',
                           'volume': {'level': volume}})
        return volume
757553
def get_volumes_for_vtree(self, vtreeObj):
        
        self.conn.connection._check_login()
        all_volumes = []
        response = self._do_get("{}/{}{}/{}".format(self.conn.connection._api_url, 'instances/VTree::', vtreeObj.id, 'relationships/Volume')).json()
        for vtree_volume in response:
            all_volumes.append(
                Volume.from_dict(vtree_volume)
            )
        return all_volumes
320882
async def volume(dev: Device, volume, output):
    
    vol = None
    vol_controls = await dev.get_volume_information()
    if output is not None:
        click.echo("Using output: %s" % output)
        output_uri = (await dev.get_zone(output)).uri
        for v in vol_controls:
            if v.output == output_uri:
                vol = v
                break
    else:
        vol = vol_controls[0]

    if vol is None:
        err("Unable to find volume controller: %s" % output)
        return

    if volume and volume == "mute":
        click.echo("Muting")
        await vol.set_mute(True)
    elif volume and volume == "unmute":
        click.echo("Unmuting")
        await vol.set_mute(False)
    elif volume:
        click.echo("Setting volume to %s" % volume)
        await vol.set_volume(volume)

    if output is not None:
        click.echo(vol)
    else:
        [click.echo(x) for x in vol_controls]
949382
def create_attach_volumes(name, kwargs, call=None, wait_to_finish=True):
    '''
    
    '''
    if call != 'action':
        raise SaltCloudSystemExit(
            'The create_attach_volumes action must be called with '
            '-a or --action.'
        )

    if 'instance_id' not in kwargs:
        kwargs['instance_id'] = _get_node(name)['instanceId']

    if isinstance(kwargs['volumes'], six.string_types):
        volumes = salt.utils.yaml.safe_load(kwargs['volumes'])
    else:
        volumes = kwargs['volumes']

    ret = []
    for volume in volumes:
        created = False
        volume_name = '{0} on {1}'.format(volume['device'], name)

        volume_dict = {
            'volume_name': volume_name,
            'zone': kwargs['zone']
        }
        if 'volume_id' in volume:
            volume_dict['volume_id'] = volume['volume_id']
        elif 'snapshot' in volume:
            volume_dict['snapshot'] = volume['snapshot']
        elif 'size' in volume:
            volume_dict['size'] = volume['size']
        else:
            raise SaltCloudConfigError(
                'Cannot create volume.  Please define one of \'volume_id\', '
                '\'snapshot\', or \'size\''
            )

        if 'tags' in volume:
            volume_dict['tags'] = volume['tags']
        if 'type' in volume:
            volume_dict['type'] = volume['type']
        if 'iops' in volume:
            volume_dict['iops'] = volume['iops']
        if 'encrypted' in volume:
            volume_dict['encrypted'] = volume['encrypted']
        if 'kmskeyid' in volume:
            volume_dict['kmskeyid'] = volume['kmskeyid']

        if 'volume_id' not in volume_dict:
            created_volume = create_volume(volume_dict, call='function', wait_to_finish=wait_to_finish)
            created = True
            if 'volumeId' in created_volume:
                volume_dict['volume_id'] = created_volume['volumeId']

        attach = attach_volume(
            name,
            {'volume_id': volume_dict['volume_id'],
             'device': volume['device']},
            instance_id=kwargs['instance_id'],
            call='action'
        )

        # Update the delvol parameter for this volume
        delvols_on_destroy = kwargs.get('del_all_vols_on_destroy', None)

        if attach and created and delvols_on_destroy is not None:
            _toggle_delvol(instance_id=kwargs['instance_id'],
                           device=volume['device'],
                           value=delvols_on_destroy)

        if attach:
            msg = (
                '{0} attached to {1} (aka {2}) as device {3}'.format(
                    volume_dict['volume_id'],
                    kwargs['instance_id'],
                    name,
                    volume['device']
                )
            )
            log.info(msg)
            ret.append(msg)
    return ret
872305
def build(self, targets: Iterable[str]) -> Iterable[str]:
        
        return generate_source_directories(
            targets, build=self._build, prompt=self._prompt
        )
145354
def listVolumes(self):
        
        for (vol, paths) in self.paths.items():
            for path in paths:
                if path.startswith('/'):
                    continue
                if path == '.':
                    continue
                if self.userVolume is not None and os.path.basename(path) != self.userVolume:
                    continue
                yield vol
                break
222307
def get_reachable_volume_templates(self, start=0, count=-1, filter='', query='', sort='',
                                       networks=None, scope_uris='', private_allowed_only=False):
        
        uri = self.URI + "/reachable-volume-templates"

        uri += "?networks={}&privateAllowedOnly={}".format(networks, private_allowed_only)

        get_uri = self._client.build_query_uri(start=start, count=count, filter=filter,
                                               query=query, sort=sort, uri=uri, scope_uris=scope_uris)
        return self._client.get(get_uri)
1027963
def _func(self, volume, params):
        
        e0, b0, b1, v0 = tuple(params)
        eta = (volume / v0) ** (1. / 3.)
        squiggle = -3.*np.log(eta)
        return e0 + b0 * v0 * squiggle ** 2 / 6. * (3. + squiggle * (b1 - 2))
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
856096
def ingest_volumes_param(self, volumes):
        
        data = {}

        for volume in volumes:
            if volume.get('host', {}).get('sourcePath'):
                data[volume.get('name')] = {
                    'path': volume.get('host', {}).get('sourcePath'),
                    'readonly': volume.get('readOnly', False)
                }
            else:
                data[volume.get('name')] = {
                    'path': '/tmp/{}'.format(uuid.uuid4().hex[:8]),
                    'readonly': volume.get('readOnly', False)
                }
        return data
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]
638577
def volume(self):
        
        volume = float(np.product(self.primitive.extents))
        return volume
1187885
def get_volume_list(self) -> list:
        
        # Initialising empty list
        volumes = []

        # Raise an exception if we are not a manager
        if not self._manager:
            raise RuntimeError('Only the Swarm manager node can retrieve'
                               ' all the services.')

        volume_list = self._client.volumes.list()
        for v_list in volume_list:
            volumes.append(v_list.name)
        return volumes
1269933
def _convert_volume_from(self, volume_from):
        
        if ':' in volume_from:
            container, permissions = volume_from.split(':')
        else:
            container = volume_from
            permissions = 'rw'

        if permissions not in ('ro', 'rw'):
            raise ValueError("only permissions supported for volumes_from are rw and ro.")

        return "{0}:{1}".format(container, permissions)
1005458
def get_volumes(self):
        
        vols = [self.find_volume(name) for name in self.virsp.listVolumes()]
        return vols
1251001
def denormalize_volume(volume):
        ''''''
        id = volume.get('id', None)
        res = dict()
        res.update(volume['metadata'])
        denorm_attachments = list()
        for a in volume['attachments']:
            denorm_attachments.append(Archivant.denormalize_attachment(a))
        res['_attachments'] = denorm_attachments
        return id, res