diff options
author | Scott Moser <smoser@brickies.net> | 2016-11-17 14:46:23 -0500 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2016-11-18 16:33:51 -0500 |
commit | 9e904bbc3336b96475bfd00fb3bf1262ae4de49f (patch) | |
tree | e22e9c0048d723f1b4d99634969a760c34d8da22 /cloudinit/config | |
parent | 9d826b8855797bd37e477b6da43153c49529afe8 (diff) | |
download | vyos-cloud-init-9e904bbc3336b96475bfd00fb3bf1262ae4de49f.tar.gz vyos-cloud-init-9e904bbc3336b96475bfd00fb3bf1262ae4de49f.zip |
Add activate_datasource, for datasource specific code paths.
This adds a call to 'activate_datasource'. That will be called
during init stage (or init-local in the event of a 'local' dsmode).
It is present so that the datasource can do platform specific operations
that may be necessary. It is passed the fully rendered cloud-config
and whether or not the instance is a new instance.
The Azure datasource uses this to address formatting of the ephemeral
devices. It does so by
a.) waiting for the device to come online
b.) removing the marker files for the disk_setup and mounts modules
if it finds that the ephemeral device has been reset.
LP: #1611074
Diffstat (limited to 'cloudinit/config')
-rw-r--r-- | cloudinit/config/cc_mounts.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py index dfc4b598..452c9e83 100644 --- a/cloudinit/config/cc_mounts.py +++ b/cloudinit/config/cc_mounts.py @@ -312,7 +312,8 @@ def handle_swapcfg(swapcfg): def handle(_name, cfg, cloud, log, _args): # fs_spec, fs_file, fs_vfstype, fs_mntops, fs-freq, fs_passno def_mnt_opts = "defaults,nobootwait" - if cloud.distro.uses_systemd(): + uses_systemd = cloud.distro.uses_systemd() + if uses_systemd: def_mnt_opts = "defaults,nofail,x-systemd.requires=cloud-init.service" defvals = [None, None, "auto", def_mnt_opts, "0", "2"] @@ -447,7 +448,12 @@ def handle(_name, cfg, cloud, log, _args): except Exception: util.logexc(log, "Failed to make '%s' config-mount", d) + activate_cmd = ["mount", "-a"] + if uses_systemd: + activate_cmd = ["systemctl", "daemon-reload"] + fmt = "Activate mounts: %s:" + ' '.join(activate_cmd) try: - util.subp(("mount", "-a")) + util.subp(activate_cmd) + LOG.debug(fmt, "PASS") except util.ProcessExecutionError: - util.logexc(log, "Activating mounts via 'mount -a' failed") + util.logexc(log, fmt, "FAIL") |