Hi eveyone,
It is my first message to this mailing list. I have been using jclouds for
a while but I feel that I need some help to do some basic tasks.
I am creating an instance in E2C and I would like to add an extra io1
volume, but I am having problems:
final String POLL_PERIOD_TWENTY_SECONDS =
String.valueOf(SECONDS.toMillis(20));
Properties overrides = new Properties();
overrides.setProperty(ComputeServiceProperties.POLL_INITIAL_PERIOD,
POLL_PERIOD_TWENTY_SECONDS);
overrides.setProperty(ComputeServiceProperties.POLL_MAX_PERIOD,
POLL_PERIOD_TWENTY_SECONDS);
Iterable<Module> modules = ImmutableSet.<Module> of(new
SshjSshClientModule(), new SLF4JLoggingModule());
//Iterable<Module> modules = ImmutableSet.<Module> of(new
SshjSshClientModule());
ComputeServiceContext context = ContextBuilder.newBuilder("aws-ec2")
.credentials("xxx", "xxx")
.modules(modules)
.overrides(overrides)
.buildView(ComputeServiceContext.class);
ComputeService computeService = context.getComputeService();
// UBUNTU
Template template = computeService.templateBuilder()
.locationId("us-east-1")
.imageId("us-east-1/ami-7c807d14")
.hardwareId("t1.micro")
.build();
// Cant mount straight away (maybe needed to create partition
and format ?)
//
template.getOptions().as(EC2TemplateOptions.class).mapNewVolumeToDeviceName("/dev/sdm",
100, true );
template.getOptions().as(EC2TemplateOptions.class).mapNewVolumeToDeviceName("/dev/sdm",
100, true, "io1", null, false );
15:14:47.284 [main] DEBUG jclouds.wire - >>
"Action=RunInstances&ImageId=ami-7c807d14&MinCount=1&MaxCount=1&InstanceType=t1.micro&SecurityGroup.1=jclouds%23m456&KeyName=jclouds%23m456%23f05&UserData=I2Nsb3VkLWNvbmZpZwpyZXBvX3VwZ3JhZGU6IG5vbmUK&BlockDeviceMapping.1.DeviceName=/dev/sdm&BlockDeviceMapping.1.Ebs.VolumeSize=100&BlockDeviceMapping.1.Ebs.DeleteOnTermination=true&BlockDeviceMapping.1.Ebs.VolumeType=io1&Version=2012-06-01"
15:14:47.285 [main] DEBUG jclouds.headers - >> POST
https://ec2.us-east-1.amazonaws.com/ HTTP/1.1
15:14:47.285 [main] DEBUG jclouds.headers - >> Host:
ec2.us-east-1.amazonaws.com
15:14:47.286 [main] DEBUG jclouds.headers - >> X-Amz-Date: 20150211T041447Z
15:14:47.286 [main] DEBUG jclouds.headers - >> Authorization:
AWS4-HMAC-SHA256 Credential=xx/20150211/us-east-1/ec2/aws4_request,
SignedHeaders=content-type;host;x-amz-date,
Signature=83fd5d0d5723e87b03ff274d503e5a3952851ce0091dbf9fa42113b1a778ca8d
15:14:47.286 [main] DEBUG jclouds.headers - >> Content-Type:
application/x-www-form-urlencoded
15:14:47.287 [main] DEBUG jclouds.headers - >> Content-Length: 388
15:14:47.771 [main] DEBUG o.j.h.i.JavaUrlHttpCommandExecutorService -
Receiving response 1653682173: HTTP/1.1 400 Bad Request
15:14:47.771 [main] DEBUG jclouds.headers - << HTTP/1.1 400 Bad Request
15:14:47.771 [main] DEBUG jclouds.headers - << Date: Wed, 11 Feb 2015
04:14:46 GMT
15:14:47.772 [main] DEBUG jclouds.headers - << Transfer-Encoding: chunked
15:14:47.772 [main] DEBUG jclouds.headers - << Server: AmazonEC2
15:14:47.772 [main] DEBUG jclouds.headers - << Cneonction: close
15:14:47.772 [main] DEBUG jclouds.headers - << Content-Type:
application/unknown
15:14:47.772 [main] DEBUG jclouds.wire - << "<?xml version="1.0"
encoding="UTF-8"?>[\n]"
15:14:47.773 [main] DEBUG jclouds.wire - <<
"<Response><Errors><Error><Code>UnknownParameter</Code><Message>The
parameter VolumeType is not
recognized</Message></Error></Errors><RequestID>e37d4d05-dbd4-45d7-bfd6-2c39e43a48c2</RequestID></Response>"
org.jclouds.aws.AWSResponseException: request POST
https://ec2.us-east-1.amazonaws.com/ HTTP/1.1 failed with code 400, error:
AWSError{requestId='e37d4d05-dbd4-45d7-bfd6-2c39e43a48c2',
requestToken='null', code='UnknownParameter', message='The parameter
VolumeType is not recognized', context='{Response=, Errors=}'}
But as far I understand io1 is an accepted value for the VolumeType as
specified here:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
If I run the code with
template.getOptions().as(EC2TemplateOptions.class).mapNewVolumeToDeviceName("/dev/sdm",
100, true );
it works, but if I try to specify the volume type it fails.
How can I create an extra volume specifying the volume type ?
Thanks in advance,
Ruben