Commit cd1de5f
committed
openstack: Allow discovery in init-local using dhclient in a sandbox.
Network has not yet been configured in the init-local stage so the
openstack datasource will use dhcp-client to temporarily obtain an ipv4
address and query the metadata service at http://169.254.169.254 to get
network_data.json configuration. If present, the datasource will return
network_config version 1 config based on that network_data.json content.
Previously OpenStack datasource only setup dhcp on the fallback interface
so this represents a change in behavior to react to the full config
provided by openstack.
Also significant to OpenStack is the separation of a _crawl_data operation
from get_data(). crawl_data walks the available metadata services and
returns a dict of discovered content. get_data consumes the crawled_data,
caches it in the datasource and reacts to that data.
/run/cloud-init/instance-data.json now published network_data.json or
ec2_metadata key if that data is present on any datasource.
The main reasons for the separation of crawl from get_data:
* Enable performance metrics of cloud-init's metadata crawls on each
* Enable cloud-init modules and scripts to query and consume metadata
content which may have updated/changed after cloud-init's initial cache
during instance boot. (Think hotplug)
Also generalize common logic to base DataSource class/module:
* Move to a common UNSET variable up into base datasource module fix EC2,
ConfigDrive, OpenStack, SmartOS to use the global.
* Drop get_url_settings from Ec2, CloudStack and OpenStack and generalize
DataSource.get_url_params(). Allow subclasses to override url_max_wait,
url_timeout and url_retries params.
* Rename get_network_metadata bool to perform_dhcp_setup as it designates
whether EphemeralDHCPv4 setup is required before crawling metadata.
LP: #17497171 parent 12799d9 commit cd1de5f
File tree
9 files changed
+416
-124
lines changed- cloudinit/sources
- tests
- tests/unittests/test_datasource
9 files changed
+416
-124
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| |||
80 | 84 | | |
81 | 85 | | |
82 | 86 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
| 87 | + | |
| 88 | + | |
90 | 89 | | |
91 | | - | |
| 90 | + | |
92 | 91 | | |
93 | 92 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | 93 | | |
106 | 94 | | |
107 | 95 | | |
108 | | - | |
109 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
110 | 99 | | |
111 | 100 | | |
112 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
| |||
59 | 57 | | |
60 | 58 | | |
61 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
64 | | - | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 69 | + | |
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
| |||
98 | 97 | | |
99 | 98 | | |
100 | 99 | | |
101 | | - | |
| 100 | + | |
102 | 101 | | |
103 | 102 | | |
104 | 103 | | |
| |||
158 | 157 | | |
159 | 158 | | |
160 | 159 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | 160 | | |
178 | 161 | | |
179 | 162 | | |
180 | | - | |
181 | | - | |
| 163 | + | |
| 164 | + | |
182 | 165 | | |
183 | 166 | | |
184 | 167 | | |
| |||
205 | 188 | | |
206 | 189 | | |
207 | 190 | | |
208 | | - | |
| 191 | + | |
| 192 | + | |
209 | 193 | | |
210 | 194 | | |
211 | 195 | | |
| |||
310 | 294 | | |
311 | 295 | | |
312 | 296 | | |
313 | | - | |
| 297 | + | |
314 | 298 | | |
315 | 299 | | |
316 | 300 | | |
317 | | - | |
| 301 | + | |
318 | 302 | | |
319 | 303 | | |
320 | 304 | | |
| |||
353 | 337 | | |
354 | 338 | | |
355 | 339 | | |
356 | | - | |
357 | | - | |
358 | | - | |
| 340 | + | |
359 | 341 | | |
360 | 342 | | |
361 | 343 | | |
| |||
390 | 372 | | |
391 | 373 | | |
392 | 374 | | |
393 | | - | |
| 375 | + | |
394 | 376 | | |
395 | 377 | | |
396 | 378 | | |
| |||
0 commit comments