Uploaded image for project: 'jclouds'
  1. jclouds
  2. JCLOUDS-1269

Jclouds doesn't get the VPC when subnetId parameter is provided

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.1.0, 2.0.2
    • Component/s: jclouds-compute
    • Labels:

      Description

      When subnetId is specified jclouds fails to obtain an existing AWS subnet in
      CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions#vpcIdForSubnet

      Optional<Subnet> subnet = awsEC2Api.getSubnetApi().get().filter(new SubnetFilterBuilder().subnetId(subnetId).build()).first();
      

      with

       java.lang.IllegalArgumentException: Subnet subnet-bb8aded2 not found
              at org.jclouds.aws.ec2.compute.strategy.CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.vpcIdForSubnet(CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.java:208)
              at org.jclouds.aws.ec2.compute.strategy.CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.addSecurityGroups(CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.java:195)
              at org.jclouds.ec2.compute.strategy.CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.execute(CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.java:80)
              at org.jclouds.aws.ec2.compute.strategy.CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.execute(CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.java:88)
              at org.jclouds.aws.ec2.compute.strategy.CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.execute(CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.java:55)
              at org.jclouds.ec2.compute.strategy.EC2CreateNodesInGroupThenAddToSet.createKeyPairAndSecurityGroupsAsNeededThenRunInstances(EC2CreateNodesInGroupThenAddToSet.java:213)
              at org.jclouds.ec2.compute.strategy.EC2CreateNodesInGroupThenAddToSet.runInstancesAndWarnOnInvisible(EC2CreateNodesInGroupThenAddToSet.java:151)
              at org.jclouds.ec2.compute.strategy.EC2CreateNodesInGroupThenAddToSet.execute(EC2CreateNodesInGroupThenAddToSet.java:132)
              at org.jclouds.compute.internal.BaseComputeService.createNodesInGroup(BaseComputeService.java:217)
              at org.jclouds.ec2.compute.EC2ComputeService.createNodesInGroup(EC2ComputeService.java:148)
      
      

        Activity

        Hide
        nacx Ignasi Barrera added a comment -

        Does the subnet actually exist in the configured regions? Could you enable the wire logs and share here the request and AWS response that is returned for that subnet API call? The exact AWS response will help understanding the root cause of the issue.

        Show
        nacx Ignasi Barrera added a comment - Does the subnet actually exist in the configured regions? Could you enable the wire logs and share here the request and AWS response that is returned for that subnet API call? The exact AWS response will help understanding the root cause of the issue.
        Hide
        andreaturli Andrea Turli added a comment -

        Ignasi BarreraI think Yavor is right. I actually spent a couple of hours with that and I'm working on a fix which by the way could also fix https://issues.apache.org/jira/browse/JCLOUDS-1120

        More soon, hopefully

        Show
        andreaturli Andrea Turli added a comment - Ignasi Barrera I think Yavor is right. I actually spent a couple of hours with that and I'm working on a fix which by the way could also fix https://issues.apache.org/jira/browse/JCLOUDS-1120 More soon, hopefully
        Hide
        svet Svetoslav Neykov added a comment -

        A workaround it to explicitly set the endpoint when creating the context: ContextBuilder.newBuilder("aws-ec2").endpoint("https://ec2.us-west-2.amazonaws.com"). This will force jclouds to talk to the correct region and find the subnet.

        Show
        svet Svetoslav Neykov added a comment - A workaround it to explicitly set the endpoint when creating the context: ContextBuilder.newBuilder("aws-ec2").endpoint("https://ec2.us-west-2.amazonaws.com") . This will force jclouds to talk to the correct region and find the subnet.
        Hide
        nacx Ignasi Barrera added a comment -

        Or set the jclouds.regions property to only the region you want to work with.
        This said, should the fix be as simple as calling awsEC2Api.getSubnetApiForRegion(region) instead of just calling the getSubnetApi()?

        Show
        nacx Ignasi Barrera added a comment - Or set the jclouds.regions property to only the region you want to work with. This said, should the fix be as simple as calling awsEC2Api.getSubnetApiForRegion(region) instead of just calling the getSubnetApi() ?
        Hide
        andreaturli Andrea Turli added a comment -

        Yes

        Show
        andreaturli Andrea Turli added a comment - Yes
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 1c6c36b81af44b14b534c9dd5be663cbcd16c8b8 in jclouds's branch refs/heads/master from Andrea Turli
        [ https://git-wip-us.apache.org/repos/asf?p=jclouds.git;h=1c6c36b ]

        JCLOUDS-1269; JCLOUDS-1120: ec2 subnet/securityGroups fixes

        Show
        jira-bot ASF subversion and git services added a comment - Commit 1c6c36b81af44b14b534c9dd5be663cbcd16c8b8 in jclouds's branch refs/heads/master from Andrea Turli [ https://git-wip-us.apache.org/repos/asf?p=jclouds.git;h=1c6c36b ] JCLOUDS-1269 ; JCLOUDS-1120 : ec2 subnet/securityGroups fixes
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit a9cc10c490e4695d0385e228a9aba60a0e151fff in jclouds's branch refs/heads/2.0.x from Andrea Turli
        [ https://git-wip-us.apache.org/repos/asf?p=jclouds.git;h=a9cc10c ]

        JCLOUDS-1269; JCLOUDS-1120: ec2 subnet/securityGroups fixes

        Show
        jira-bot ASF subversion and git services added a comment - Commit a9cc10c490e4695d0385e228a9aba60a0e151fff in jclouds's branch refs/heads/2.0.x from Andrea Turli [ https://git-wip-us.apache.org/repos/asf?p=jclouds.git;h=a9cc10c ] JCLOUDS-1269 ; JCLOUDS-1120 : ec2 subnet/securityGroups fixes
        Hide
        andreaturli Andrea Turli added a comment -

        Yavor Yanchev does this commit solve your issue?

        Show
        andreaturli Andrea Turli added a comment - Yavor Yanchev does this commit solve your issue?
        Hide
        yanchev Yavor Yanchev added a comment -

        Andrea Turli Yes, it does. Thanks for the prompt reaction resolving this issue.

        Show
        yanchev Yavor Yanchev added a comment - Andrea Turli Yes, it does. Thanks for the prompt reaction resolving this issue.
        Hide
        andreaturli Andrea Turli added a comment -

        Cool, thanks Yavor Yanchev for helping with that!

        Show
        andreaturli Andrea Turli added a comment - Cool, thanks Yavor Yanchev for helping with that!

          People

          • Assignee:
            andreaturli Andrea Turli
            Reporter:
            yanchev Yavor Yanchev
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development