Attaches an EBS volume to the instance

@param string $volume_href The HREF of an existing EBS volume which will be attached
@param string $device The OS device the EBS volume will be attached to
351933
public function attach_volume($volume_href, $device) {
		$this->executeCommand($this->_path_for_regex . '_attach_volume',
			array('id' => $this->id, 'server[ec2_ebs_volume_href]' => $volume_href, 'server[device]' => $device)
		);		
	}
159494
private function store_links(&$file, $hub, $self) {
		if (isset($file->headers['link']['hub']) ||
			  (isset($file->headers['link']) &&
			   preg_match('/rel=hub/', $file->headers['link'])))
		{
			return;
		}

		if ($hub)
		{
			if (isset($file->headers['link']))
			{
				if ($file->headers['link'] !== '')
				{
					$file->headers['link'] = ', ';
				}
			}
			else
			{
				$file->headers['link'] = '';
			}
			$file->headers['link'] .= '<'.$hub.'>; rel=hub';
			if ($self)
			{
				$file->headers['link'] .= ', <'.$self.'>; rel=self';
			}
		}
	}
773109
public void attachPipe(Pipe pipe)
    {
        assert (!isTerminating());
        assert (this.pipe == null);
        assert (pipe != null);
        this.pipe = pipe;
        this.pipe.setEventSink(this);
    }
1348906
function(id, callback) {
        var self = this;

        var requestOptions = {
            uri: '/volumes/' + id,
            endpoint: rackspace.Endpoints.CloudBlockStorage
        };

        self.authorizedRequest(requestOptions, function(err, res, body) {
            if (err || !body.volume) {
                callback(err ? err : body);
                return;
            }

            callback(err, new rackspace.Volume(self, body.volume));
        });
    }
253212
public function setSelfLink($href, array $meta=[], $level=Document::LEVEL_ROOT) {
		$this->addLink('self', $href, $meta, $level);
	}
405379
def attach_volume(self, volume_id, instance_id, device):
        """"""
        query = self.query_factory(
            action="AttachVolume", creds=self.creds, endpoint=self.endpoint,
            other_params={"VolumeId": volume_id, "InstanceId": instance_id,
                          "Device": device})
        d = query.submit()
        return d.addCallback(self.parser.attach_volume)
519133
public void serviceName_linkDevice_POST(String serviceName, String deviceId) throws IOException {
		String qPath = "/overTheBox/{serviceName}/linkDevice";
		StringBuilder sb = path(qPath, serviceName);
		HashMap<String, Object>o = new HashMap<String, Object>();
		addBody(o, "deviceId", deviceId);
		exec(qPath, "POST", sb.toString(), o);
	}
515519
def ebs_volume_exists(connection, region, volume_id):
    
    for vol in connection.get_all_volumes():
        if vol.id == volume_id:
            return True
    return False
587009
def destroy_ebs_volume(region, volume_id, access_key_id, secret_access_key):
    
    conn = connect_to_ec2(region, access_key_id, secret_access_key)

    if ebs_volume_exists(region, volume_id, access_key_id, secret_access_key):
        log_yellow('destroying EBS volume ...')
        conn.delete_volume(volume_id)
10856
def mount_volume(volume, device='/dev/xvdf', mountpoint='/mnt/data', fstype='ext4'):
    '''
    
    '''
    _ec2().attach_volume(volume, _host_node()['id'], device)
    time.sleep(1)
    sudo('mkdir -p "%s"' % mountpoint)
    sudo('mount -t "%s" "%s" "%s"' % (fstype, device, mountpoint))
1342209
def attach_planned_volume(mapping)
      # preserve the initial list of disks/volumes before attachment for comparison later.
      vm = RightScale::Platform.volume_manager
      InstanceState.planned_volume_state.disks ||= vm.disks
      InstanceState.planned_volume_state.volumes ||= vm.volumes

      # attach.
      payload = {:agent_identity => @agent_identity, :volume_id => mapping[:volume_id], :device_name => mapping[:device_name]}
      Log.info("Attaching volume #{mapping[:volume_id]}.")
      req = RetryableRequest.new("/storage_valet/attach_volume", payload, :retry_delay => VolumeManagement::VOLUME_RETRY_SECONDS)
      
      req.callback do |res|
        # don't set :volume_status here as that should only be queried
        mapping[:management_status] = 'attached'
        mapping[:attempts] = nil
        yield if block_given?
      end

      req.errback do |res|
        # volume could already be attaching or have been deleted
        # which we can't see because of latency; go around again
        # and check state of volume later.
        Log.error("Failed to attach volume #{mapping[:volume_id]} (#{res})")
        mapping[:attempts] ||= 0
        mapping[:attempts] += 1
        # retry indefinitely so long as core api instructs us to retry or else fail after max attempts.
        if mapping[:attempts] >= VolumeManagement::MAX_VOLUME_ATTEMPTS
          strand("Exceeded maximum of #{VolumeManagement::MAX_VOLUME_ATTEMPTS} attempts attaching volume #{mapping[:volume_id]} with error: #{res}")
        else
          yield if block_given?
        end
      end

      req.run
    end
1285532
def attach(self, volume_id, instance_id, device_path):
        """"""
        return self.call("AttachVolume",
                         VolumeId=volume_id, InstanceId=instance_id,
                         Device=device_path)
468758
protected static function addStructure(array $structure, vfsStreamDirectory $baseDir): vfsStreamDirectory
    {
        foreach ($structure as $name => $data) {
            $name = (string) $name;
            if (is_array($data) === true) {
                self::addStructure($data, self::newDirectory($name)->at($baseDir));
            } elseif (is_string($data) === true) {
                $matches = null;
                preg_match('/^\[(.*)\]$/', $name, $matches);
                if ($matches !== []) {
                    self::newBlock($matches[1])->withContent($data)->at($baseDir);
                } else {
                    self::newFile($name)->withContent($data)->at($baseDir);
                }
            } elseif ($data instanceof FileContent) {
                self::newFile($name)->withContent($data)->at($baseDir);
            } elseif ($data instanceof vfsStreamFile) {
                $baseDir->addChild($data);
            }
        }

        return $baseDir;
    }
1182643
def _update_device_from_fs(self, device):
        
        try:
            directory_entries = listdir(device["mount_point"])

            # Always try to update using daplink compatible boards processself.
            # This is done for backwards compatibility.
            lowercase_directory_entries = [e.lower() for e in directory_entries]
            if self.MBED_HTM_NAME.lower() in lowercase_directory_entries:
                self._update_device_from_htm(device)

        except (OSError, IOError) as e:
            logger.warning(
                'Marking device with mount point "%s" as unmounted due to the '
                "following error: %s",
                device["mount_point"],
                e,
            )
            device["mount_point"] = None
319050
protected function attach($absolutePath, $element)
    {
        $this->uploads[$element] = $absolutePath;

        return $this->storeInput($element, $absolutePath);
    }
496477
public static function rm($force = false, $remove_volumes = false)
    {
        $args = [];
        if ($force) {
            $args[] = '-f';
        }
        if ($remove_volumes) {
            $args[] = '-v';
        }
        return self::runCommand('rm', $args);
    }
132504
def add_volume(self, volume):
        
        for old_vol in self.volumes:
            if volume == old_vol:
                return
        self.volumes.append(volume)