jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Downer (JIRA)" <j...@apache.org>
Subject [jira] [Created] (JCLOUDS-1351) AWS CentOS marketplace AMI misdetecting OS type
Date Thu, 02 Nov 2017 12:29:00 GMT
Richard Downer created JCLOUDS-1351:
---------------------------------------

             Summary: AWS CentOS marketplace AMI misdetecting OS type
                 Key: JCLOUDS-1351
                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1351
             Project: jclouds
          Issue Type: Bug
          Components: jclouds-compute
    Affects Versions: 2.0.2
            Reporter: Richard Downer
            Priority: Minor


When jclouds encounters an official CentOS Linux AMI from the AWS Marketplace, it detects
the operating system as "unrecognized".

To reproduce, set the {{jclouds.ec2.ami-query}} / {{jclouds.ec2.cc-ami-query}} properties
to search the AWS Marketplace for CentOS images. Example: {{owner-id=679593333241;state=available;image-type=machine;root-device-type=ebs;architecture=x86_64;virtualization-type=hvm;name=CentOS
Linux *}}

jclouds will discover from AWS AMIs such as this one:

{code:xml}
<item>
    <imageId>ami-061b1560</imageId>
    <imageLocation>aws-marketplace/CentOS Linux 7 x86_64 HVM EBS 1704_01-b7ee8a69-ee97-4a49-9e68-afaee216db2e-ami-d52f5bc3.4</imageLocation>
    <imageState>available</imageState>
    <imageOwnerId>679593333241</imageOwnerId>
    <isPublic>true</isPublic>
    <productCodes>
        <item>
            <productCode>aw0evgkw8e5c1q413zgy5pjce</productCode>
            <type>marketplace</type>
        </item>
    </productCodes>
    <architecture>x86_64</architecture>
    <imageType>machine</imageType>
    <imageOwnerAlias>aws-marketplace</imageOwnerAlias>
    <name>CentOS Linux 7 x86_64 HVM EBS 1704_01-b7ee8a69-ee97-4a49-9e68-afaee216db2e-ami-d52f5bc3.4</name>
    <description>CentOS Linux 7 x86_64 HVM EBS 1704_01</description>
    <rootDeviceType>ebs</rootDeviceType>
    <rootDeviceName>/dev/sda1</rootDeviceName>
    <blockDeviceMapping>
        <item>
            <deviceName>/dev/sda1</deviceName>
            <ebs>
                <snapshotId>snap-00f18f3f6413c7879</snapshotId>
                <volumeSize>8</volumeSize>
                <deleteOnTermination>false</deleteOnTermination>
            </ebs>
        </item>
    </blockDeviceMapping>
    <virtualizationType>hvm</virtualizationType>
    <hypervisor>xen</hypervisor>
</item>
{code}

While parsing this, execution will end up here: https://github.com/jclouds/jclouds/blob/574c7fc3c1234037608c8daf96375673265e904f/compute/src/main/java/org/jclouds/compute/util/ComputeServiceUtils.java#L141

{code}
   public static org.jclouds.compute.domain.OsFamily parseOsFamilyOrUnrecognized(String in)
{
      org.jclouds.compute.domain.OsFamily myOs = null;
      for (org.jclouds.compute.domain.OsFamily os : org.jclouds.compute.domain.OsFamily.values())
{
         if (in.toLowerCase().replaceAll("\\s", "").indexOf(os.toString()) != -1) {
            myOs = os;
         }
      }
      return myOs != null ? myOs : OsFamily.UNRECOGNIZED;
   }
{code}

This enumerates over the known OS names to see if there's a match in the AMI name. The string
{{CentOS Linux 7 x86_64 HVM EBS 1704_01-b7ee8a69-ee97-4a49-9e68-afaee216db2e-ami-d52f5bc3.4}}
contains matches two enum values: *CENTOS* and *LINUX*. It seems that the alphabetically-last
value is the one that is selected, so that this method returns LINUX and not CENTOS.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message