jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JCLOUDS-1351) AWS CentOS marketplace AMI misdetecting OS type
Date Fri, 03 Nov 2017 11:53:00 GMT

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

ASF subversion and git services commented on JCLOUDS-1351:
----------------------------------------------------------

Commit 4dbba815caa77ad44d7e8d75fde1692a6810d862 in jclouds's branch refs/heads/2.0.x from
[~rdowner]
[ https://git-wip-us.apache.org/repos/asf?p=jclouds.git;h=4dbba81 ]

JCLOUDS-1351: improve OS Family parsing

Modifies OsFamily to have two tiers of known OSes, so that generic OS
names such as “Linux” cannot end up taking priority over more specific
OS names. This fixes the case where “CentOS Linux” was detected as LINUX
and not CENTOS.

> 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
>              Labels: aws-ec2
>             Fix For: 2.1.0
>
>
> 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