You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2014/08/25 08:37:50 UTC

[06/10] git commit: prefer 64-bit images (it makes sense, and without this it can sometimes pick a 32-bit os w a 64-bit hw, e.g. minRam 4096 in AWS VA, gives ami c68150ae on m3.large); also include the new ubuntu lts (14.04) as a slightly preferred; and

prefer 64-bit images (it makes sense, and without this it can sometimes pick a 32-bit os w a 64-bit hw, e.g. minRam 4096 in AWS VA, gives ami c68150ae on m3.large);
also include the new ubuntu lts (14.04) as a slightly preferred;
and a bit more jclouds template logging (previously we did not log the templateBuilder)


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/63fe4b3a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/63fe4b3a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/63fe4b3a

Branch: refs/heads/master
Commit: 63fe4b3abaabc64293d72e47e28ea7d5694ab692
Parents: d4d95fc
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Fri Aug 8 02:05:22 2014 -0400
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Aug 25 07:24:40 2014 +0100

----------------------------------------------------------------------
 .../location/jclouds/BrooklynImageChooser.java  | 44 +++++++++++---------
 .../location/jclouds/JcloudsLocation.java       |  7 +++-
 2 files changed, 30 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/63fe4b3a/locations/jclouds/src/main/java/brooklyn/location/jclouds/BrooklynImageChooser.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/java/brooklyn/location/jclouds/BrooklynImageChooser.java b/locations/jclouds/src/main/java/brooklyn/location/jclouds/BrooklynImageChooser.java
index be934e2..75d761f 100644
--- a/locations/jclouds/src/main/java/brooklyn/location/jclouds/BrooklynImageChooser.java
+++ b/locations/jclouds/src/main/java/brooklyn/location/jclouds/BrooklynImageChooser.java
@@ -115,33 +115,39 @@ public class BrooklynImageChooser {
         score += punishmentForOldOsVersions(img, OsFamily.CENTOS, 6);
 
         OperatingSystem os = img.getOperatingSystem();
-        if (os!=null && os.getFamily()!=null) {
-            // preference for these open, popular OS (but only wrt versions above) 
-            if (os.getFamily().equals(OsFamily.CENTOS)) score += 2;
-            else if (os.getFamily().equals(OsFamily.UBUNTU)) {
-                score += 1;
-                
-                // 12.04 is LTS, so prefer it slightly above others
-                if ("12.04".equals(os.getVersion())) score += 1;
-                
-                // NB some 13.10 images take 20m+ before they are sshable on AWS
-                // with "vesafb: module verification error" showing in the AWS system log
-            }
+        if (os!=null) {
+            if (os.getFamily()!=null) {
+                // preference for these open, popular OS (but only wrt versions above) 
+                if (os.getFamily().equals(OsFamily.CENTOS)) score += 2;
+                else if (os.getFamily().equals(OsFamily.UBUNTU)) {
+                    score += 2;
+
+                    // prefer these LTS releases slightly above others (including above CentOS)
+                    // (but note in AWS Virginia, at least, version is empty for the 14.04 images for some reason, as of Aug 2014)
+                    if ("14.04".equals(os.getVersion())) score += 0.2;
+                    else if ("12.04".equals(os.getVersion())) score += 0.1;
+
+                    // NB some 13.10 images take 20m+ before they are sshable on AWS
+                    // with "vesafb: module verification error" showing in the AWS system log
+                }
 
-            // slight preference for these 
-            else if (os.getFamily().equals(OsFamily.RHEL)) score += 1;
-            else if (os.getFamily().equals(OsFamily.AMZN_LINUX)) score += 1;
-            else if (os.getFamily().equals(OsFamily.DEBIAN)) score += 1;
+                // slight preference for these 
+                else if (os.getFamily().equals(OsFamily.RHEL)) score += 1;
+                else if (os.getFamily().equals(OsFamily.AMZN_LINUX)) score += 1;
+                else if (os.getFamily().equals(OsFamily.DEBIAN)) score += 1;
 
-            // prefer to take our chances with unknown / unlabelled linux than something explicitly windows
-            else if (os.getFamily().equals(OsFamily.WINDOWS)) score -= 1;
+                // prefer to take our chances with unknown / unlabelled linux than something explicitly windows
+                else if (os.getFamily().equals(OsFamily.WINDOWS)) score -= 1;
+            }
+            // prefer 64-bit
+            if (os.is64Bit()) score += 0.5;
         }
 
         // TODO prefer known providerIds
 
         if (log.isTraceEnabled())
             log.trace("initial score "+score+" for "+img);
-
+        
         return score;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/63fe4b3a/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java b/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
index bc2c457..670806c 100644
--- a/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
+++ b/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
@@ -998,7 +998,7 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
         if (templateBuilder==null) {
             templateBuilder = new PortableTemplateBuilder<PortableTemplateBuilder<?>>();
         } else {
-            LOG.debug("jclouds using templateBuilder {} as base for provisioning in {} for {}", new Object[] {
+            LOG.debug("jclouds using templateBuilder {} as custom base for provisioning in {} for {}", new Object[] {
                     templateBuilder, this, config.getDescription()});
         }
         if (templateBuilder instanceof PortableTemplateBuilder<?>) {
@@ -1040,12 +1040,15 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
             customizer.customize(this, computeService, templateBuilder);
         }
         
+        LOG.debug("jclouds using templateBuilder {} for provisioning in {} for {}", new Object[] {
+            templateBuilder, this, config.getDescription()});
+        
         // Finally try to build the template
         Template template;
         try {
             template = templateBuilder.build();
             if (template==null) throw new NullPointerException("No template found (templateBuilder.build returned null)");
-            LOG.debug(""+this+" got template "+template+" (image "+template.getImage()+")");
+            LOG.debug("jclouds found template "+template+" (image "+template.getImage()+") for provisioning in "+this+" for "+config.getDescription());
             if (template.getImage()==null) throw new NullPointerException("Template does not contain an image (templateBuilder.build returned invalid template)");
         } catch (AuthorizationException e) {
             LOG.warn("Error resolving template: not authorized (rethrowing: "+e+")");