summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2016-09-19 11:48:54 -0400
committerScott Moser <smoser@brickies.net>2016-09-20 13:42:29 -0400
commit80f5ec4be0f781b26eca51d90d51abfab396b3f6 (patch)
tree50075b3a8949324b2c43536bf6ac8ffa2280b597 /cloudinit
parentf94b16cea578062c8abf3dd3a1ada234fa671cd3 (diff)
downloadvyos-cloud-init-80f5ec4be0f781b26eca51d90d51abfab396b3f6.tar.gz
vyos-cloud-init-80f5ec4be0f781b26eca51d90d51abfab396b3f6.zip
Adjust mounts and disk configuration for systemd.
The end result of all of these changes is to get mounts managed by cloud-init to occur only after cloud-init.service is done. We need to do that so that filesystems that are set up by cloud-init (in disk_setup) do not get mounted by stale entries in /etc/fstab before the setup occurs. This can occur in 2 ways: a.) new instance with old /etc/fstab b.) same instance where disk needs adjusting (Azure resize will re-format the ephemeral disk). The list of changes here is: - move mounts and disk_setup module to cloud-init.service rather than config. cloud-init.service runs earlier in boot so it can get those mount points done earlier. - on systemd add 'x-systemd.requires=cloud-init.service' to fstab options - cloud-init-local.service: add Before=basic.target - cloud-init.service: - extend After, Before, and Wants to multiple lines rather than one long line. - sort consistently with cloud-init-local.service - add DefaultDependencies=no - add Before=default.target - add Conflicts=shutdown.target LP: #1611074
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/config/cc_mounts.py4
-rw-r--r--cloudinit/sources/DataSourceAzure.py7
2 files changed, 7 insertions, 4 deletions
diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py
index 2b981935..4084118b 100644
--- a/cloudinit/config/cc_mounts.py
+++ b/cloudinit/config/cc_mounts.py
@@ -265,7 +265,7 @@ 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():
- def_mnt_opts = "defaults,nofail"
+ def_mnt_opts = "defaults,nofail,x-systemd.requires=cloud-init.service"
defvals = [None, None, "auto", def_mnt_opts, "0", "2"]
defvals = cfg.get("mount_default_fields", defvals)
@@ -401,5 +401,5 @@ def handle(_name, cfg, cloud, log, _args):
try:
util.subp(("mount", "-a"))
- except Exception:
+ except util.ProcessExecutionError:
util.logexc(log, "Activating mounts via 'mount -a' failed")
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index dbc2bb68..b802b03e 100644
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -252,7 +252,7 @@ class DataSourceAzureNet(sources.DataSource):
cc_modules_override = support_new_ephemeral(self.sys_cfg)
if cc_modules_override:
- self.cfg['cloud_config_modules'] = cc_modules_override
+ self.cfg['cloud_init_modules'] = cc_modules_override
return True
@@ -283,11 +283,14 @@ def find_fabric_formatted_ephemeral_part():
device_location = potential_location
break
if device_location is None:
+ LOG.debug("no azure resource disk partition path found")
return None
ntfs_devices = util.find_devs_with("TYPE=ntfs")
real_device = os.path.realpath(device_location)
if real_device in ntfs_devices:
return device_location
+ LOG.debug("'%s' existed (%s) but was not ntfs formated",
+ device_location, real_device)
return None
@@ -342,7 +345,7 @@ def support_new_ephemeral(cfg):
LOG.debug("cloud-init will format ephemeral0.1 this boot.")
LOG.debug("setting disk_setup and mounts modules 'always' for this boot")
- cc_modules = cfg.get('cloud_config_modules')
+ cc_modules = cfg.get('cloud_init_modules')
if not cc_modules:
return None