Change breaks cloud-init on Ali
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
High
|
Unassigned |
Bug Description
Hi,
cloud-init change
https:/
appears to break cloud-init on Aliyun. We had been using a version 20.2 or more precisely
http://
with no issues. Version 20.4.1 or more precisely
http://
breaks with the log output shown below. As the key device-number is not used in 20.2 this clearly points to the change referenced above. It is kind of unclear where that key is supposed to be configured as there is no other reference to that in the code.
This is more or less a standard Debian configuration that we are using from the packages referenced above. This appears to cause user and group management to be skipped which is causing us headache. Quite interestingly
it does work find on AWS which appears to use the same code.
Let me know if you need anything else.
2021-03-05 16:47:30,866 - util.py[DEBUG]: loaded blob returned None, returning default.
2021-03-05 16:47:30,867 - util.py[DEBUG]: Reading from /sys/class/
2021-03-05 16:47:30,867 - util.py[DEBUG]: Read 18 bytes from /sys/class/
2021-03-05 16:47:30,867 - util.py[DEBUG]: Reading from /sys/class/
2021-03-05 16:47:30,867 - util.py[DEBUG]: Read 18 bytes from /sys/class/
2021-03-05 16:47:30,868 - util.py[DEBUG]: Reading from /sys/class/
2021-03-05 16:47:30,868 - util.py[DEBUG]: Read 2 bytes from /sys/class/
2021-03-05 16:47:30,868 - util.py[DEBUG]: Reading from /sys/class/
2021-03-05 16:47:30,868 - util.py[DEBUG]: Read 2 bytes from /sys/class/
2021-03-05 16:47:30,868 - util.py[DEBUG]: Reading from /sys/class/
2021-03-05 16:47:30,868 - util.py[DEBUG]: Read 18 bytes from /sys/class/
2021-03-05 16:47:30,868 - util.py[DEBUG]: Reading from /sys/class/
2021-03-05 16:47:30,868 - util.py[DEBUG]: Read 2 bytes from /sys/class/
2021-03-05 16:47:30,868 - util.py[DEBUG]: Reading from /sys/class/
2021-03-05 16:47:30,868 - util.py[DEBUG]: Read 23 bytes from /sys/class/
2021-03-05 16:47:30,868 - util.py[DEBUG]: Reading from /sys/class/
2021-03-05 16:47:30,868 - util.py[DEBUG]: Read 18 bytes from /sys/class/
2021-03-05 16:47:30,868 - util.py[DEBUG]: Reading from /sys/class/
2021-03-05 16:47:30,868 - util.py[DEBUG]: Reading from /sys/class/
2021-03-05 16:47:30,868 - util.py[DEBUG]: Read 2 bytes from /sys/class/
2021-03-05 16:47:30,868 - util.py[DEBUG]: Reading from /sys/class/
2021-03-05 16:47:30,869 - util.py[DEBUG]: Read 25 bytes from /sys/class/
2021-03-05 16:47:30,869 - util.py[DEBUG]: Reading from /sys/class/
2021-03-05 16:47:30,869 - util.py[DEBUG]: Read 18 bytes from /sys/class/
2021-03-05 16:47:30,869 - util.py[DEBUG]: Reading from /sys/class/
2021-03-05 16:47:30,869 - util.py[DEBUG]: Read 7 bytes from /sys/class/
2021-03-05 16:47:30,869 - util.py[DEBUG]: Reading from /sys/class/
2021-03-05 16:47:30,869 - util.py[DEBUG]: Read 4 bytes from /sys/class/
2021-03-05 16:47:30,869 - util.py[DEBUG]: Reading from /sys/class/
2021-03-05 16:47:30,869 - util.py[DEBUG]: Read 2 bytes from /sys/class/
2021-03-05 16:47:30,869 - util.py[WARNING]: failed stage init
2021-03-05 16:47:30,869 - util.py[DEBUG]: failed stage init
Traceback (most recent call last):
File "/usr/lib/
ret = functor(name, args)
File "/usr/lib/
init.
File "/usr/lib/
netcfg, src = self._find_
File "/usr/lib/
if self.datasource and hasattr(
File "/usr/lib/
result = convert_
File "/usr/lib/
nic_idx = int(nic_
KeyError: 'device-number'
2021-03-05 16:47:30,870 - atomic_
2021-03-05 16:47:30,870 - util.py[DEBUG]: Reading from /proc/uptime (quiet=False)
2021-03-05 16:47:30,870 - util.py[DEBUG]: Read 12 bytes from /proc/uptime
2021-03-05 16:47:30,870 - util.py[DEBUG]: cloud-init mode 'init' took 1.744 seconds (1.74)
2021-03-05 16:47:30,870 - handlers.py[DEBUG]: finish: init-network: SUCCESS: searching for network datasources
description: | updated |
Hi Dirk,
Thanks for using cloud-init and taking the time to file this bug! `device-number` is an attribute that the EC2 IMDS sets in its network configuration; on an EC2 instance I see:
$ cloud-init query ds.meta_ data.network. interfaces. macs 3f:3d:e0: 49": { f3a9ba9" ,
{
"0a:30:
"device_number": "0",
"interface_id": "eni-014a09bfdd
<snip>
}
}
(The use of an underscore vs. a dash here is not material: `query` normalises dashes to underscores when producing its output.)
Aliyun's datasource is based on the EC2 datasource (via inheritance), so it inherited this new behaviour. However, it's evidently the case that Aliyun do not expose `device-number` in their network metadata. We should handle this case gracefully, as there will be other EC2-a-like metadata services which don't do so.
Having said that, it's possible that Aliyun do expose this information but in a way we don't handle: would you be able to paste the output of `cloud-init query ds.meta_ data.network. interfaces. macs` back in this bug report?
Thanks!
Dan