identify brightbox platform to enable Ec2 datasource

Bug #1661693 reported by Scott Moser on 2017-02-03
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)

Bug Description

Brightbox provides an EC2 Metadata service lookalike, and that is how cloud-init
gets metadata on their platform.

In an effort to avoid polling metadata services in cloud-init we will disable
attempts to reach the MD without positive identification of the cloud.

We need to be able to positively identify that the host platform is
brightbox so we can safely assume there will be a metadata service there.

The easiest thing is for Brightbox to put something in dmi tables that identify
their platform. See bug 1660385 for more information and for how Amazon does

Related bugs
 bug 1660385: Alert user of Ec2 Datasource on lookalike cloud
 bug 1661797: identify lxd-nova platform to enable Openstack datasource
 bug 1661693: identify brightbox platform to enable Ec2 datasource
 bug 1663304: identify openstack kvm platform on arm64
 bug 1663315: identify openstack kvm platform on ppc64

Related branches

Scott Moser (smoser) on 2017-02-03
Changed in cloud-init:
status: New → Confirmed
importance: Undecided → Medium
Scott Moser (smoser) on 2017-02-08
description: updated
Neil Wilson (neil-aldur) wrote :

There isn't a standard way of identifying cloud platforms from what I can see. Are you going to be maintaining a list of the myriad of different mechanisms?

What's the driver for doing this? Is there a newer way of getting metadata into Ubuntu?

Scott Moser (smoser) wrote :


You're right, there is not a standard way of identifying cloud platforms.
One way of doing such is as Openstack Nova does.
I think this is a reasonable "best practice".

Amazon shows what they are doing at

To show what openstack does:
$ cat /sys/class/dmi/id/product_name
OpenStack Nova
$ sudo dmidecode --string=system-product-name
OpenStack Nova

From outside, virsh xml contains:
  <sysinfo type='smbios'>
      <entry name='manufacturer'>OpenStack Foundation</entry>
      <entry name='product'>OpenStack Nova</entry>
      <entry name='version'>13.1.1</entry>
      <entry name='serial'>fb14e3a3-bff8-4e1a-8d27-ee2a2414d822</entry>
      <entry name='uuid'>0c0fb83e-a83f-49c2-b483-db405fbdc8ee</entry>
      <entry name='family'>Virtual Machine</entry>

And qemu cmdline contains:
  -smbios "type=1,manufacturer=OpenStack Foundation,product=OpenStack Nova,version=12.0.3,serial=fb14e3a3-bff8-4e1a-8d27-ee2a2414d822,uuid=bf7f3844-42d3-4bcf-a58c-a33b0c12cb28,family=Virtual Machine"

The driver for doing this is:
a.) to improve boot speed of Ubuntu images by quickly discarding datasources that are not expected to be there.
b.) to utilmately entirely disable cloud-init if no datasource would be found.
c.) to avoid attempting to access network resources that may not be present. That can result in timeouts or other unexpected behavior.

Scott Moser (smoser) on 2017-02-09
description: updated
Scott Moser (smoser) on 2017-02-13
description: updated
Scott Moser (smoser) wrote :

Any thoughts here? Any help I can offer?

Neil Wilson (neil-aldur) wrote :


Apologies. Been knee deep in kernel bugs this week and dropped the ball with this one.

We're thinking of setting the family in DMI table 1 thus:

    <type arch='x86_64'>hvm</type>
    <boot dev='hd'/>
    <smbios mode='sysinfo'/>
  <sysinfo type='smbios'>
      <entry name='family'>Brightbox Cloud</entry>

Which gives:

Handle 0x0100, DMI type 1, 27 bytes
System Information
    Manufacturer: Red Hat
    Product Name: KVM
    Version: RHEL 7.0.0 PC (i440FX + PIIX, 1996)
    Serial Number: Not Specified
    UUID: B4BB19C4-8F2A-4D60-AED9-22CBE259CFF9
    Wake-up Type: Power Switch
    SKU Number: Not Specified
    Family: Brightbox Cloud

Does that work for you?

Scott Moser (smoser) wrote :

I could work with family if I had too. Its less than ideal.
The kernel populates some from the smbios into /sys, but apparently 'Family' is not one of those.

I launched a system with xml like yours above, which renders qemu cmdline like:
 -smbios "type=1,manufacturer=Smoser Foo,family=Brightbox Cloud"

From the inside, dmidecode *does* show me the family as you show above (sudo dmidecode --type system).
However, family is not available with either:
  dmidecode --string=SOME_ARGUMENT
nor is it available in /sys/class/dmi/id/ . So I'd have to run dmidecode and parse its output or otherwise implement a dmi/smbios reader.

An ideal value is something that the kernel exposes, that you can see with:
  $ sudo grep -r . /sys/class/dmi/id

Scott Moser (smoser) wrote :

Just for reference, the product name (libvirt <entry name='product'>, /sys/class/dmi/id/product_name) is used for this purpose on:
  - Google Compute Engine
  - CloudStack
  - CloudSigma
  - OpenStack Nova
  - SmartOS (Joyent cloud)

So I'd like to suggest that that is the working "best practice".

Neil Wilson (neil-aldur) wrote :

But not on AWS or Digital Ocean?


On 22 February 2017 at 17:54, Neil Wilson <email address hidden> wrote:
> But not on AWS or Digital Ocean?

On Digital Ocean:
$ cat /sys/class/dmi/id/product_name

I don't have access to AWS to check that.



Neil Wilson (neil-aldur) wrote :

systemd code on RHEL 7 looks like it checks the product name.

Similarly virt-tools on RHEL looks for KVM in the product name

So there are problems with the 'product-name' approach from our point of view.

John Leach (johnleach) wrote :

puppet also uses the product name to provide it's is_virtual fact:

It knows about "KVM" and a few others, though it at least looks for KVM anywhere in the product name. But it currently won't understand about the above names.

This situation seems like a bit of a mess - no standard way of providing this info, everyone doing their own thing.

Neil Wilson (neil-aldur) wrote :

The system serial number is empty under KVM and exposed in the sysfs, so I propose putting the fqdn of the server into that field.

That way you can pick up a Brightbox cloud server fairly easily:

with open('/sys/devices/virtual/dmi/id/product_serial', 'r') as content_file:
    content =

if content.rstrip().endswith(""):
    print("Brightbox VM")
    print("Not a Brightbox VM")

Scott Moser (smoser) wrote :

For further reference, DigitalOcean sets sys_vendor to 'DigitalOcean'.
AWS's is described at
its crappy as they abuse UUID, which will result in false-positive if randomly generated uuid starts with 'ec2'. Its better on kvm guests there then it is on xen in that system-serial-number and system-uuid have to be equal and start with ec2, so a false positive there is pretty unlikely.

Scott Moser (smoser) wrote :

Neil, i'm fine with product_serial containing 'brightbox'.
Given the fact that Google and Openstack and others use the product_name as shown above, it feels like puppet and rhel must have other ways of determining this. But I respect your interest in not breaking anything.

I'll add a check for brightbox today.

Scott Moser (smoser) on 2017-02-27
Changed in cloud-init:
status: Confirmed → Fix Committed
Changed in cloud-init (Ubuntu):
status: New → Fix Released
importance: Undecided → Medium
Scott Moser (smoser) wrote :

New zesty images with cloud-init 0.7.9-38-g83606ae-0ubuntu1 or better should now identify brightbox by looking for in the serial as Neil suggested in comment 11.

It does not appear that the change is made on the host side yet. I launched an instance just now and see:

$ ( cd /sys/class/dmi/id && sudo grep -r . *) 2>/dev/null
chassis_vendor:Red Hat
product_version:RHEL 6.6.0 PC
sys_vendor:Red Hat

Neil Wilson (neil-aldur) wrote :

The serial update is now in production. Latest zesty image we have is from 15th Feb and is not picking up the network (probably as expected).

Scott Moser (smoser) wrote :

Verified this is working on brightbox now. Thanks for your cooperation and help, Neil.

Booted img-foxkf (

$ cat /etc/cloud/
build_name: server
serial: 20170228.1

$ dpkg-query --show cloud-init
cloud-init 0.7.9-38-g83606ae-0ubuntu1

$ grep brightbox -i /var/log/cloud-init.log
2017-03-01 19:17:17,514 -[DEBUG]: dmi data /sys/class/dmi/id/product_serial returned
2017-03-01 19:17:17,514 -[DEBUG]: strict_mode: warn, cloud_platform=Brightbox
2017-03-01 19:17:19,755 -[DEBUG]: Setting the hostname to (srv-fajvm)
2017-03-01 19:17:19,764 -[DEBUG]: Updating hostname to (srv-fajvm)

$ grep -i ec2 /run/cloud-init/ds-identify.log
/etc/cloud/cloud.cfg.d/90_dpkg.cfg set datasource_list: [ NoCloud, ConfigDrive, OpenNebula, DigitalOcean, Azure, AltCloud, OVF, MAAS, GCE, OpenStack, CloudSigma, SmartOS, Ec2, CloudStack, None ]
DSLIST=NoCloud ConfigDrive OpenNebula DigitalOcean Azure AltCloud OVF MAAS GCE OpenStack CloudSigma SmartOS Ec2 CloudStack None
ec2 platform is 'Brightbox'.
check for 'Ec2' returned found
Found single datasource: Ec2

$ ( cd /sys/class/dmi/id && sudo grep -r . . ) 2>/dev/null
./product_version:RHEL 6.6.0 PC
./chassis_vendor:Red Hat
./sys_vendor:Red Hat

$ cat /var/lib/cloud/data/instance-id

Scott Moser (smoser) on 2017-03-03
tags: added: dsid
Scott Moser (smoser) wrote :

Just a comment.
This should now be 'fix-released' in xenial, and yakkety also with 0.7.9-48-g1c795b9-0ubuntu1~16.04.1 and 0.7.9-48-g1c795b9-0ubuntu1~16.10.1 respectively.

This bug is believed to be fixed in cloud-init in 17.1. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Fix Committed → Fix Released
tags: added: id-5893565c611597333b35fa8b
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers