cloud-init doesn't cache network_config property in cache

Bug #1716773 reported by Ryan Harper on 2017-09-12
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

When init net stage runs, it will restore the cloud object cache in /var/lib/cloud/instance/obj.pkl

This cache dump is created before cloud-init processes the datasource, which means some of the data cloud-init has fetched is not cached.

In particular, we've observed that the 'network_config' attribute is populated and set in init-local mode, but when we run init-net; it will re-run due to the underlying object value still be set to None (the default) as we failed to cache the object after modifying it.

Scott Moser (smoser) on 2017-09-25
Changed in cloud-init:
status: New → Confirmed
importance: Undecided → Medium
Scott Moser (smoser) wrote :

An explanation of what happened here:
 a.) in local mode we did 'instancify()' which (through _reflect_cur_instance) did a '_write_to_cache'. At this poing .network_config had never been called, so the DataSourceAzure did not have the ._network_config property set and thus not stored.
 b.) main called init.apply_network_config(). This ends up calling 'network_config' on the datasource, which sets the ._network_config.
 c.) stages exits because 'if mode == sources.DSMODE_LOCAL'

nothing writes to cache again, so the '._network_config()' never got set.

The easiest solution is to just throw another '._write_to_cache' in before exiting there.

Scott Moser (smoser) wrote :

kind of thought on this yesterday... i dont know wif 'apply_networking' actually makes sense in the network stage. kind of just to think on that.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers