Given a generic volume definition, create the volumes element
512266
def _build_volume(self, volume):
        
        self.volumes[self._build_volume_name(volume.get('host'))] = {
            'name': self._build_volume_name(volume.get('host')),
            'hostPath': {
                'path': volume.get('host')
            }
        }
        response = {
            'name': self._build_volume_name(volume.get('host')),
            'mountPath': volume.get('container'),

        }
        if volume.get('readonly', False):
            response['readOnly'] = bool(volume.get('readonly', False))
        return response
926534
def attach_volume(self, volume, device="/dev/sdp"):
        
        if hasattr(volume, "id"):
            volume_id = volume.id
        else:
            volume_id = volume
        return self.ec2.attach_volume(volume_id=volume_id, instance_id=self.instance_id, device=device)
132504
def add_volume(self, volume):
        
        for old_vol in self.volumes:
            if volume == old_vol:
                return
        self.volumes.append(volume)
1255943
function buildArgs (source, givenOutput, loop, initialVolume, showOsd) {
	let output = '';

	if (givenOutput) {

		if (ALLOWED_OUTPUTS.indexOf(givenOutput) === -1) {
			throw new Error(`Output ${givenOutput} not allowed.`);
		}

		output = givenOutput;

	} else {
		output = 'local';
	}

	let osd = false;
	if (showOsd) {
		osd = showOsd;
	}

	let args = [source, '-o', output, '--blank', osd ? '' : '--no-osd'];

	// Handle the loop argument, if provided
	if (loop) {
		args.push('--loop');
	}

	// Handle the initial volume argument, if provided
	if (Number.isInteger(initialVolume)) {
		args.push('--vol', initialVolume);
	}

	return args;

}
597327
private Map<String, Map> volumes() {
    final ImmutableMap.Builder<String, Map> volumes = ImmutableMap.builder();
    for (final Map.Entry<String, String> entry : job.getVolumes().entrySet()) {
      final String path = entry.getKey();
      final String source = entry.getValue();
      if (Strings.isNullOrEmpty(source)) {
        volumes.put(path, new HashMap());
      }
    }
    return volumes.build();
  }
1230113
def volumes(self):
    """"""
    if not self._is_parsed:
      self._Parse()
      self._is_parsed = True

    return iter(self._volumes.values())
519297
def format_volume(citation_elements):
    
    re_roman = re.compile(re_roman_numbers + u'$', re.UNICODE)
    for el in citation_elements:
        if el['type'] == 'JOURNAL' and re_roman.match(el['volume']):
            el['volume'] = str(roman2arabic(el['volume'].upper()))
    return citation_elements
1274823
def resize(self, size):
        
        self.instance.resize_volume(size)
        self.size = size
205862
def create(self, name, **kwargs):
        
        # These arguments are required
        self.required('create', kwargs, ['hostname', 'port',
                      'storage_hostname', 'volume_type_name', 'size'])
        kwargs['name'] = name
        return self.http_post('/nodes', params=kwargs)
1129408
def construct_segmentation_volume
      if @volumes.first.shape == @original_volumes.first.shape
        # Just reshape the vector (and ensure that it remains byte type):
        @true_segmentation = @true_segmentation_vector.reshape(*@original_volumes.first.shape).to_type(1)
      else
        # Need to take into account exactly which indices (slices, columns, rows) have been removed.
        # To achieve a correct reconstruction, we will use the information on the original volume indices of our
        # current volume, and apply it for each dimension.
        @true_segmentation = NArray.byte(*@original_volumes.first.shape)
        true_segmentation_in_reduced_volume = @true_segmentation_vector.reshape(*@volumes.first.shape)
        @true_segmentation[*@original_indices] = true_segmentation_in_reduced_volume
      end
    end
874809
def volume(self, volume):
        """"""
        volume = int(volume)
        volume = max(0, min(volume, 100))  # Coerce in range
        self.renderingControl.SetVolume([
            ('InstanceID', 0),
            ('Channel', 'Master'),
            ('DesiredVolume', volume)
        ])
1051257
def _populate(self, json):
        
        from .volume import Volume

        DerivedBase._populate(self, json)

        devices = {}
        for device_index, device in json['devices'].items():
            if not device:
                devices[device_index] = None
                continue

            dev = None
            if 'disk_id' in device and device['disk_id']: # this is a disk
                dev = Disk.make_instance(device['disk_id'], self._client,
                        parent_id=self.linode_id)
            else:
                dev = Volume.make_instance(device['volume_id'], self._client,
                        parent_id=self.linode_id)
            devices[device_index] = dev

        self._set('devices', MappedObject(**devices))
860684
def disk_xml(identifier, pool_xml, base_volume_xml, cow):
    
    pool = etree.fromstring(pool_xml)
    base_volume = etree.fromstring(base_volume_xml)
    pool_path = pool.find('.//path').text
    base_path = base_volume.find('.//target/path').text
    target_path = os.path.join(pool_path, '%s.qcow2' % identifier)
    volume_xml = VOLUME_DEFAULT_CONFIG.format(identifier, target_path)
    volume = etree.fromstring(volume_xml)
    base_volume_capacity = base_volume.find(".//capacity")

    volume.append(base_volume_capacity)

    if cow:
        backing_xml = BACKING_STORE_DEFAULT_CONFIG.format(base_path)
        backing_store = etree.fromstring(backing_xml)
        volume.append(backing_store)

    return etree.tostring(volume).decode('utf-8')
1237306
def new(self):
        # type: () -> None
        '''
        
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('UDF Logical Volume Descriptor already initialized')

        self.desc_tag = UDFTag()
        self.desc_tag.new(6)  # FIXME: we should let the user set serial_number

        self.vol_desc_seqnum = 3
        self.desc_char_set = _unicodecharset()

        self.logical_vol_ident = _ostaunicode_zero_pad('CDROM', 128)

        self.domain_ident = UDFEntityID()
        self.domain_ident.new(0, b'*OSTA UDF Compliant', b'\x02\x01\x03')

        self.logical_volume_contents_use = UDFLongAD()
        self.logical_volume_contents_use.new(4096, 0)

        self.impl_ident = UDFEntityID()
        self.impl_ident.new(0, b'*pycdlib')

        self.implementation_use = b'\x00' * 128  # FIXME: let the user set this
        self.integrity_sequence_length = 4096
        self.integrity_sequence_extent = 0  # This will get set later

        self.partition_map = UDFPartitionMap()
        self.partition_map.new()

        self._initialized = True
1197021
def add_volumes_to_volume_set(set_name, setmembers)
      begin
        @volume_set.add_volumes_to_volume_set(set_name, setmembers)
      rescue => ex
        Util.log_exception(ex, caller_locations(1, 1)[0].label)
        raise ex
      end
    end
1292052
def make_vol_opt(hostdir, contdir, options=None):
    ''''''
    vol = '--volume={}:{}'.format(hostdir, contdir)
    if options != None:
        if isinstance(options, str):
            options = (options,)
        vol += ':' + ','.join(options)
    return vol
1249984
async def SetVolumeInfo(self, volumes):
        '''
        
        '''
        # map input types to rpc msg
        _params = dict()
        msg = dict(type='StorageProvisioner',
                   request='SetVolumeInfo',
                   version=4,
                   params=_params)
        _params['volumes'] = volumes
        reply = await self.rpc(msg)
        return reply