Comment 2 for bug 1661693

Revision history for this message
Scott Moser (smoser) wrote :

Neil,

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
 http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/identify_ec2_instances.html

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'>
    <system>
      <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>
    </system>

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.