jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aled Sage (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JCLOUDS-1132) Amazon AWS - Create Volume - query params reported as unrecognized
Date Wed, 03 Oct 2018 15:09:00 GMT

    [ https://issues.apache.org/jira/browse/JCLOUDS-1132?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16637060#comment-16637060
] 

Aled Sage commented on JCLOUDS-1132:
------------------------------------

TL;DR: Is it safe to bump the API version to "2016-11-15" in AWSEC2ApiMetadata?

I successfully tested with \{{Encrypted=1}}, which is in the examples at https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVolume.html#API_CreateVolume_Examples

To do this, you also need to bump the version in org.jclouds.aws.ec2.AWSEC2ApiMetadata (e.g.
to "2016-11-15", from "2012-06-01").

Without the version bump, you still get the error shown below:
{noformat}
j.wire [ager-Z59Bm9lQ-45] >> "Action=CreateVolume&AvailabilityZone=eu-west-1b&Size=4&Encrypted=1&VolumeType=gp2&Version=2012-06-01"
j.headers [ager-Z59Bm9lQ-45] >> POST https://ec2.eu-west-1.amazonaws.com/ HTTP/1.1
j.headers [ager-Z59Bm9lQ-45] >> Host: ec2.eu-west-1.amazonaws.com
j.headers [ager-Z59Bm9lQ-45] >> X-Amz-Date: 20181003T135559Z
j.headers [ager-Z59Bm9lQ-45] >> Authorization: AWS4-HMAC-SHA256 Credential=xxxxxxxxxxxxxxxxxxxx/20181003/eu-west-1/ec2/aws4_request,
SignedHeaders=content-type;host;x-amz-date, Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
j.headers [ager-Z59Bm9lQ-45] >> Content-Type: application/x-www-form-urlencoded
j.headers [ager-Z59Bm9lQ-45] >> Content-Length: 100
j.headers [ager-Z59Bm9lQ-45] << HTTP/1.1 400 Bad Request
j.headers [ager-Z59Bm9lQ-45] << Transfer-Encoding: chunked
j.headers [ager-Z59Bm9lQ-45] << Server: AmazonEC2
j.headers [ager-Z59Bm9lQ-45] << Connection: close
j.headers [ager-Z59Bm9lQ-45] << Date: Wed, 03 Oct 2018 13:55:58 GMT
j.headers [ager-Z59Bm9lQ-45] << Content-Type: application/unknown
j.wire [ager-Z59Bm9lQ-45] << "<?xml version="1.0" encoding="UTF-8"?>[\n]"
j.wire [ager-Z59Bm9lQ-45] << "<Response><Errors><Error><Code>UnknownParameter</Code><Message>The
parameter Encrypted is not recognized</Message></Error></Errors><RequestID>1da4ed2f-112b-49ab-867e-ef56f5656f72</RequestID></Response>"
{noformat}

For the \{{RunInstances}} with \{{BlockDeviceMapping}}, I think it's right to use \{{BlockDeviceMapping.1.Ebs.Encrypted=true}},
but you also need a version like "2016-11-15".

I didn't create an AMI with an encrypted EBS boot volume (see https://aws.amazon.com/blogs/aws/new-encrypted-ebs-boot-volumes/),
so my test didn't work end-to-end, but the error I got back was sensible:
{noformat}
j.wire [nager-aju8Oj09-5] >> "Action=RunInstances&ImageId=ami-3548444c&MinCount=1&MaxCount=1&InstanceType=t2.micro&SecurityGroupId.1=sg-0c764025773c2701e&KeyName=jclouds%23brooklyn-pg12a0-aledsage-ebs-e-jdye-vanillasoftwar-ufot%237c6&UserData=I2Nsb3VkLWNvbmZpZwpyZXBvX3VwZ3JhZGU6IG5vbmUK&BlockDeviceMapping.1.DeviceName=/dev/sda1&BlockDeviceMapping.1.Ebs.VolumeSize=8&BlockDeviceMapping.1.Ebs.DeleteOnTermination=true&BlockDeviceMapping.1.Ebs.VolumeType=gp2&BlockDeviceMapping.1.Ebs.Encrypted=true&Version=2016-11-15"
j.wire [nager-aju8Oj09-5] << "<Response><Errors><Error><Code>InvalidBlockDeviceMapping</Code><Message>the
encrypted flag cannot be specified since device /dev/sda1 has a snapshot specified.</Message></Error></Errors><RequestID>da2e8338-c2c2-4c47-95fe-3b476fc51bef</RequestID></Response>"
{noformat}

Here are my code diffs to make this use-case work (against jclouds 2.1.0):
{noformat}
--- a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/AWSEC2ApiMetadata.java
+++ b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/AWSEC2ApiMetadata.java
@@ -62,7 +62,7 @@ public final class AWSEC2ApiMetadata extends BaseHttpApiMetadata<AWSEC2Api>
{
 public static final class Builder extends BaseHttpApiMetadata.Builder<AWSEC2Api, Builder>
{
 public Builder() {
 id("aws-ec2")
- .version("2012-06-01")
+ .version("2016-11-15")

diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/options/CreateVolumeOptions.java b/apis/ec2/src/main/java/org/jclouds/ec2/options/CreateVolumeOptions.java
index 9c2e1821ad..388da7cd43 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/options/CreateVolumeOptions.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/options/CreateVolumeOptions.java
@@ -92,7 +92,7 @@ public class CreateVolumeOptions extends BaseEC2RequestOptions {
 */
 public CreateVolumeOptions isEncrypted(boolean encrypted) {
 if (encrypted)
- formParameters.put("Encrypted", "true");
+ formParameters.put("Encrypted", "1");
 return this;
 }
 
diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/options/CreateVolumeOptionsTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/options/CreateVolumeOptionsTest.java
index 20f74754ca..88ca91688f 100644
--- a/apis/ec2/src/test/java/org/jclouds/ec2/options/CreateVolumeOptionsTest.java
+++ b/apis/ec2/src/test/java/org/jclouds/ec2/options/CreateVolumeOptionsTest.java
@@ -137,7 +137,7 @@ public class CreateVolumeOptionsTest {
 CreateVolumeOptions options = new CreateVolumeOptions();
 options.isEncrypted(true);
 assertEquals(options.buildFormParameters().get("Encrypted"),
- ImmutableList.of("true"));
+ ImmutableList.of("1"));
 }
 
@@ -150,7 +150,7 @@ public class CreateVolumeOptionsTest {
 public void testIsEncryptedStatic() {
 CreateVolumeOptions options = isEncrypted(true);
 assertEquals(options.buildFormParameters().get("Encrypted"),
- ImmutableList.of("true"));
+ ImmutableList.of("1"));
 }
{noformat}

> Amazon AWS - Create Volume - query params reported as unrecognized
> ------------------------------------------------------------------
>
>                 Key: JCLOUDS-1132
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1132
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-compute
>    Affects Versions: 1.9.0, 1.9.2
>         Environment: Amazon AWS EC2 management console
>            Reporter: Tusa Mihail Cristian
>            Priority: Major
>
> Let say that I want to create a Volume that is encrypted. So, I set the encrypted on
"true"... in request query params apear "&Encrypted=true". In this case the error that
I got is: 
> <Response><Errors><Error><Code>UnknownParameter</Code><Message>The
parameter Encrypted is not recognized</Message></Error></Errors><RequestID>c874434a-b00e-425d-baf4-18087441603a</RequestID></Response>

> instead it should be: "&Encrypted=1" as it is shown in Amazon docs: http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVolume.html
in Example/Sample request. The problems are also related with Volume Type. If not specified
than creates a standard volume but if anything specified (any of valid Values: standard |
io1 | gp2 | sc1 | st1 ) the same error with unrecognized param is received.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message