com.amazonaws.services.ec2.model.VolumeAttachment Java Examples

The following examples show how to use com.amazonaws.services.ec2.model.VolumeAttachment. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AwsVolumeProcess.java    From primecloud-controller with GNU General Public License v2.0 6 votes vote down vote up
public void detachVolume(AwsProcessClient awsProcessClient, Long instanceNo, Long volumeNo) {
    AwsVolume awsVolume = awsVolumeDao.read(volumeNo);
    String volumeId = awsVolume.getVolumeId();

    //イベントログ出力
    Component component = null;
    if (awsVolume.getComponentNo() != null) {
        component = componentDao.read(awsVolume.getComponentNo());
    }
    Instance instance = instanceDao.read(instanceNo);
    processLogger.debug(component, instance, "AwsEbsDetach",
            new Object[] { instance.getInstanceName(), awsVolume.getVolumeId(), awsVolume.getDevice() });

    // ボリュームのデタッチ
    DetachVolumeRequest request = new DetachVolumeRequest();
    request.withVolumeId(volumeId);
    request.withInstanceId(awsVolume.getInstanceId());
    request.withDevice(awsVolume.getDevice());
    DetachVolumeResult result = awsProcessClient.getEc2Client().detachVolume(request);
    VolumeAttachment attachment = result.getAttachment();

    // ログ出力
    if (log.isInfoEnabled()) {
        log.info(MessageUtils.getMessage("IPROCESS-100125", volumeId, attachment.getInstanceId()));
    }
}
 
Example #2
Source File: VolumeAttachmentConverter.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected VolumeAttachment convertObject(AttachmentInfo from) {
    VolumeAttachment to = new VolumeAttachment();

    to.setVolumeId(from.getVolumeId());
    to.setInstanceId(from.getInstanceId());
    to.setDevice(from.getDevice());
    to.setState(from.getStatus());
    to.setAttachTime(from.getAttachTime().getTime());

    // 未実装
    to.setDeleteOnTermination(false);

    return to;
}
 
Example #3
Source File: AwsVolumeProcess.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
public void attachVolume(AwsProcessClient awsProcessClient, Long instanceNo, Long volumeNo) {
    AwsInstance awsInstance = awsInstanceDao.read(instanceNo);
    AwsVolume awsVolume = awsVolumeDao.read(volumeNo);
    String volumeId = awsVolume.getVolumeId();

    //イベントログ出力
    Component component = null;
    if (awsVolume.getComponentNo() != null) {
        component = componentDao.read(awsVolume.getComponentNo());
    }
    Instance instance = instanceDao.read(instanceNo);
    processLogger.debug(component, instance, "AwsEbsAttach",
            new Object[] { instance.getInstanceName(), awsVolume.getVolumeId(), awsVolume.getDevice() });

    // ボリュームのアタッチ
    AttachVolumeRequest request = new AttachVolumeRequest();
    request.withVolumeId(volumeId);
    request.withInstanceId(awsInstance.getInstanceId());
    request.withDevice(awsVolume.getDevice());
    AttachVolumeResult result = awsProcessClient.getEc2Client().attachVolume(request);
    VolumeAttachment attachment = result.getAttachment();

    // ログ出力
    if (log.isInfoEnabled()) {
        log.info(MessageUtils.getMessage("IPROCESS-100123", volumeId, attachment.getInstanceId()));
    }

    // データベースの更新
    awsVolume.setInstanceId(attachment.getInstanceId());
    awsVolumeDao.update(awsVolume);
}
 
Example #4
Source File: VolumeImpl.java    From aws-sdk-java-resources with Apache License 2.0 4 votes vote down vote up
@Override
public List<VolumeAttachment> getAttachments() {
    return (List<VolumeAttachment>) resource.getAttribute("Attachments");
}
 
Example #5
Source File: Volume.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the value of the Attachments attribute. If this resource is not yet
 * loaded, a call to {@code load()} is made to retrieve the value of the
 * attribute.
 */
List<VolumeAttachment> getAttachments();