cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #06221
Re: [Merge] ~jasonzio/cloud-init:requestMountAll into cloud-init:master
Thanks for the logs in the bug. I would prefer to avoid adding additional datasource config here if we can avoid it. I think if we check if we're missing a mount, that we can have cc_mounts do the mount -a for us. This would handle things more generally I think.
Something like this (untested):
% git diff cloudinit/config/cc_mounts.py
diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py
index 339baba..f920ea2 100644
--- a/cloudinit/config/cc_mounts.py
+++ b/cloudinit/config/cc_mounts.py
@@ -439,6 +439,7 @@ def handle(_name, cfg, cloud, log, _args):
cc_lines = []
needswap = False
+ needmountall = False
dirs = []
for line in actlist:
# write 'comment' in the fs_mntops, entry, claiming this
@@ -449,11 +450,18 @@ def handle(_name, cfg, cloud, log, _args):
dirs.append(line[1])
cc_lines.append('\t'.join(line))
+ # query current system mountpoints (reads from /proc/mounts)
+ mpoints = [v['mountpoint']
+ for k, v in util.mounts().items() if 'mountpoint' in v]
for d in dirs:
try:
util.ensure_dir(d)
except Exception:
util.logexc(log, "Failed to make '%s' config-mount", d)
+ # if we find a mountpoint from the config not currently mounted
+ # then set the flag
+ if not needmountall and d not in mpoints:
+ needmountall = True
sadds = [WS.sub(" ", n) for n in cc_lines]
sdrops = [WS.sub(" ", n) for n in fstab_removed]
@@ -473,6 +481,8 @@ def handle(_name, cfg, cloud, log, _args):
log.debug("No changes to /etc/fstab made.")
else:
log.debug("Changes to fstab: %s", sops)
+
+ if needmountall or len(sops) > 0:
activate_cmds.append(["mount", "-a"])
if uses_systemd:
activate_cmds.append(["systemctl", "daemon-reload"])
--
https://code.launchpad.net/~jasonzio/cloud-init/+git/cloud-init/+merge/366329
Your team cloud-init commiters is requested to review the proposed merge of ~jasonzio/cloud-init:requestMountAll into cloud-init:master.
References