Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-12547

ec2-plugin doesn't allow for multiple EC2 clouds to be configured

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • ec2-plugin
    • None

      When using the ec2-plugin, we configured a connection to EC2 as well as a Eucalyptus cloud. When we tried some operations on the Eucalyptus cloud (specifically looking at logs of an instance or terminating an instance), we get an error;
      Jan 25, 2012 9:44:17 AM hudson.plugins.ec2.EC2Slave terminate
      WARNING: Failed to terminate EC2 instance: i-CCA241AF
      com.xerox.amazonws.ec2.EC2Exception: Client error : The instance ID 'i-cca241af' does not exist
      at com.xerox.amazonws.ec2.Jec2.makeRequestInt(Jec2.java:2359)
      at com.xerox.amazonws.ec2.Jec2.terminateInstances(Jec2.java:776)
      at hudson.plugins.ec2.EC2Slave.terminate(EC2Slave.java:95)
      at hudson.plugins.ec2.EC2Computer.doDoDelete(EC2Computer.java:103)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)

      Eucalyptus never generates this error message. I ran tests with euca2ools and typica to reproduce this error and supplying upper or lower case instance ids never caused this error to come back.
      Looking at the ec2-plugin code (EC2Cloud.java), there's a method get() which returns an EC2Cloud instance. The code will only retrieve a cloud of the class EC2Cloud which precluded having more than one cloud of that type registered.
      public static EC2Cloud get()

      { return Hudson.getInstance().clouds.get(EC2Cloud.class); }

      If the intention is to allow more than one cloud of a specific type to be used at the same time, this should be addressed.

          [JENKINS-12547] ec2-plugin doesn't allow for multiple EC2 clouds to be configured

          Perhaps using clouds.getByName(..) would help fix this.

          David Kavanagh added a comment - Perhaps using clouds.getByName(..) would help fix this.

          Eric Smalling added a comment -

          I think I am running into the same problem - has anyone found a work-around for this?

          Eric Smalling added a comment - I think I am running into the same problem - has anyone found a work-around for this?

          Eric Smalling added a comment -

          Have what I believe to be a fix - will push to my fork in a minute. Will be doing some more testing from our server tomorrow before issuing the pull request.

          Eric Smalling added a comment - Have what I believe to be a fix - will push to my fork in a minute. Will be doing some more testing from our server tomorrow before issuing the pull request.

          Eric Smalling added a comment -

          My commit: https://github.com/ericsmalling/ec2-plugin/commit/15d2c00e247ed54bace3c5cacb5e7ae0022a1f87 has the changes I intend on issuing the pull req from (in case you want to review before I finish testing)

          Eric Smalling added a comment - My commit: https://github.com/ericsmalling/ec2-plugin/commit/15d2c00e247ed54bace3c5cacb5e7ae0022a1f87 has the changes I intend on issuing the pull req from (in case you want to review before I finish testing)

          Eric Smalling added a comment -

          Seeing some problems with my change, will investigate more...

          Eric Smalling added a comment - Seeing some problems with my change, will investigate more...

          Eric Smalling added a comment -

          Sorry for lack of updates here, but I hit a problem and haven't had time to get back to it. Basically, my changes ended up with invalid xml in the config.xml file that causes Jenkins to hard fail on a restart. (square brackets in some of the myCloud resources)

          Eric Smalling added a comment - Sorry for lack of updates here, but I hit a problem and haven't had time to get back to it. Basically, my changes ended up with invalid xml in the config.xml file that causes Jenkins to hard fail on a restart. (square brackets in some of the myCloud resources)

          Ray Sennewald added a comment -

          Ray Sennewald added a comment - This is again a duplicate of JENKINS-15081 which is fixed with this merge: https://github.com/jenkinsci/ec2-plugin/commit/5da8f6be66e839e33923cbf5e8b62b0f6c4b7bfc .

            esmalling Eric Smalling
            dkavanagh David Kavanagh
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: