Commit 53f03512 authored by Scott Moser's avatar Scott Moser

apply networking less often

Do not apply networking configuration whenever a previous datasource
has been loaded from disk and found to be valid (via positive
 return 'check_instance_id' or user configuration of manual_cache_clean).

This effectively means that we apply fallback networking only once
per instance rather than every boot on any datasource with
'check_instance_id' implemented.

LP: #1571004
parents f7d6eaef 53931ee1
......@@ -266,7 +266,12 @@ def main_init(name, args):
return (None, ["No instance datasource found."])
if args.local:
if not init.ds_restored:
# if local mode and the datasource was not restored from cache
# (this is not first boot) then apply networking.
LOG.debug("skipping networking config from restored datasource.")
# Stage 6
iid = init.instancify()
......@@ -66,6 +66,7 @@ class Init(object):
self._distro = None
# Changed only when a fetch occurs
self.datasource = NULL_DATA_SOURCE
self.ds_restored = False
if reporter is None:
reporter = events.ReportEventStack(
......@@ -80,6 +81,7 @@ class Init(object):
self._distro = None
if reset_ds:
self.datasource = NULL_DATA_SOURCE
self.ds_restored = False
def distro(self):
......@@ -231,6 +233,8 @@ class Init(object):
ds = None
myrep.description = "no cache found"
self.ds_restored = bool(ds)
if not ds:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment