use of com.amazonaws.services.ec2.AmazonEC2AsyncClient in project photon-model by vmware.
the class TestAWSProvisionTask method assertBootDiskConfiguration.
protected void assertBootDiskConfiguration(AmazonEC2AsyncClient client, Instance awsInstance, String diskLink) {
DiskState diskState = getDiskState(diskLink);
Volume bootVolume = getVolume(client, awsInstance, awsInstance.getRootDeviceName());
assertEquals("Boot Disk capacity in diskstate is not matching the boot disk size of the " + "vm launched in aws", diskState.capacityMBytes, bootVolume.getSize() * 1024);
assertNotNull("Boot disk creation time cannot be empty", diskState.creationTimeMicros);
assertEquals("Boot disk type in diskstate is not same as the type of the volume attached to the VM", diskState.customProperties.get("volumeType"), bootVolume.getVolumeType());
assertEquals("Boot disk iops in diskstate is the same as the iops of the volume attached to the VM", Integer.parseInt(diskState.customProperties.get("iops")), bootVolume.getIops().intValue());
assertEquals("Boot disk attach status is not matching", DiskService.DiskStatus.ATTACHED, diskState.status);
}
use of com.amazonaws.services.ec2.AmazonEC2AsyncClient in project photon-model by vmware.
the class TestAWSProvisionTask method getVolume.
protected Volume getVolume(AmazonEC2AsyncClient client, Instance awsInstance, String deviceName) {
InstanceBlockDeviceMapping bootDiskMapping = awsInstance.getBlockDeviceMappings().stream().filter(blockDeviceMapping -> blockDeviceMapping.getDeviceName().equals(deviceName)).findAny().orElse(null);
// The ami used in this test is an ebs-backed AMI
assertNotNull("Device type should be ebs type", bootDiskMapping.getEbs());
String bootVolumeId = bootDiskMapping.getEbs().getVolumeId();
DescribeVolumesRequest describeVolumesRequest = new DescribeVolumesRequest().withVolumeIds(bootVolumeId);
DescribeVolumesResult describeVolumesResult = client.describeVolumes(describeVolumesRequest);
return describeVolumesResult.getVolumes().get(0);
}
Aggregations