Comment 4 for bug 1673637

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

I dug around some on this, and talked a bit to Robert Jennings who gave me some more info.
softlayer works to feed cloud-init a datasource in 2 ways
a.) /var/lib/cloud/seed/nocloud-net/ has data in it in the image.
    /etc/cloud/cloud.cfg.d/99_networklayer_common.cfg contained
    datasource_list: [ ConfigDrive, NoCloud ]

b.) if user provides metadata (or userdata) then a disk (xvdh1) is attached
    that has openstack config drive like data on it.

    of note here is that it contains *only* 'latest' as the version.

I really dont like that they provided the versioned information 'latest'.
I consider it a bug that cloud-init reads that at all.

The best way forward here is either:
 1.) modify the openstack datasource (and ds-identify) to consider this 'METADATA' disk to be a ConfigDrive. That will actually mean that Ubuntu images do not need the tricks they have to mount that disk over /var/lib/cloud/seed/config-drive and would also remove some possible race conditions there. What I don't like about this is that the word 'METADATA' is so generic, and ds-identify doesn't actually mount anything, meaning it could return true for this datasource on someone elses system that just happened to have a disk named METADATA.

 2.) create a specific datasource for softlayer that basically just does the above, but only in more specific scenario and not enabled by default.

Heres some information for my own reference later.

# sudo blkid
/dev/xvdh1: SEC_TYPE="msdos" LABEL="METADATA" UUID="681B-8C5D" TYPE="vfat" PARTUUID="3d631e09-01"
/dev/xvdb1: LABEL="SWAP-xvdb1" UUID="d51fcca0-6b10-4934-a572-f3898dfd8840" TYPE="swap" PARTUUID="00025cdb-01"
/dev/xvda1: LABEL="cloudimg-bootfs" UUID="85caed83-8815-4770-94b5-853ca2e03431" TYPE="ext3" PARTUUID="974bb19a-01"
/dev/xvda2: LABEL="cloudimg-rootfs" UUID="22ca45b9-13f2-481d-9251-0dd08d36eace" TYPE="ext4" PARTUUID="974bb19a-02"

# mount /dev/xvdh1 /mnt
# ( cd /mnt && for f in $(find * -type f); do echo == $f ==; cat $f; echo; done )
== meta.js ==
["#!\/bin\/sh\r\nssh-import-id smoser"]
== openstack/latest/user_data ==
#!/bin/sh
ssh-import-id smoser
== openstack/latest/meta_data.json ==
{"files":[[]],"network_config":{"content_path":"\/content\/interfaces"},"hostname":"smfoo2","name":"smfoo2","domain":"softlayer.brickies.net","meta":{"dsmode":"net"},"uuid":"f20e93bb-212e-2a17-6d70-c33dbf891c12"}
== openstack/content/interfaces ==
auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet static
address 10.170.230.200
netmask 255.255.255.192
post-up route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.170.230.193
post-up route add -net 161.26.0.0 netmask 255.255.0.0 gw 10.170.230.193

auto eth1
allow-hotplug eth1
iface eth1 inet static
address 169.45.206.71
netmask 255.255.255.240
gateway 169.45.206.65

# rm -f /run/cloud-init/ds-identify.log
# sudo DEBUG_LEVEL=3 /usr/lib/cloud-init/ds-identify --force
# cat /run/cloud-init/ds-identify.log
# cat /run/cloud-init/ds-identify.log
[up 11015.19s] ds-identify --force
policy loaded: mode=report report=false found=all maybe=all notfound=enabled
/etc/cloud/cloud.cfg.d/99_networklayer_common.cfg set datasource_list: [ ConfigDrive, NoCloud ]
DMI_PRODUCT_NAME=unavailable
DMI_SYS_VENDOR=unavailable
DMI_PRODUCT_SERIAL=unavailable
DMI_PRODUCT_UUID=unavailable
PID_1_PLATFORM=unavailable
FS_LABELS=METADATA,SWAP-xvdb1,cloudimg-bootfs,cloudimg-rootfs
KERNEL_CMDLINE=root=UUID=22ca45b9-13f2-481d-9251-0dd08d36eace ro console=hvc0 elevator=noop
VIRT=xen
UNAME_KERNEL_NAME=Linux
UNAME_KERNEL_RELEASE=4.4.0-45-generic
UNAME_KERNEL_VERSION=#66-Ubuntu SMP Wed Oct 19 14:12:37 UTC 2016
UNAME_MACHINE=x86_64
UNAME_NODENAME=smfoo2
UNAME_OPERATING_SYSTEM=GNU/Linux
DSNAME=
DSLIST=ConfigDrive NoCloud
MODE=report
ON_FOUND=all
ON_MAYBE=all
ON_NOTFOUND=enabled
pid=10895 ppid=10894
is_container=false
Checking for datasource 'ConfigDrive' via 'dscheck_ConfigDrive'
check for 'ConfigDrive' returned not-found[1]
Checking for datasource 'NoCloud' via 'dscheck_NoCloud'
check for 'NoCloud' returned found
found=NoCloud maybe=
Found single datasource: NoCloud
[up 11015.24s] returning 0