Scott Moser has proposed merging ~smoser/cloud-init:bug/1611074 into 
cloud-init:master.

Requested reviews:
  cloud init development team (cloud-init-dev)
Related bugs:
  Bug #1611074 in cloud-init: "Reformatting of ephemeral drive fails on resize 
of Azure VM"
  https://bugs.launchpad.net/cloud-init/+bug/1611074

For more details, see:
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/306145
-- 
Your team cloud init development team is requested to review the proposed merge 
of ~smoser/cloud-init:bug/1611074 into cloud-init:master.
diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py
index 2b98193..4084118 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 dbc2bb6..ddba368 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
 
@@ -342,7 +342,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
 
diff --git a/config/cloud.cfg b/config/cloud.cfg
index 7c94ec5..3b4c538 100644
--- a/config/cloud.cfg
+++ b/config/cloud.cfg
@@ -30,6 +30,8 @@ cloud_init_modules:
  - write-files
  - growpart
  - resizefs
+ - disk_setup
+ - mounts
  - set_hostname
  - update_hostname
  - update_etc_hosts
@@ -43,8 +45,6 @@ cloud_config_modules:
 # Emit the cloud config ready event
 # this can be used by upstart jobs for 'start on cloud-config'.
  - emit_upstart
- - disk_setup
- - mounts
  - ntp
  - ssh-import-id
  - locale
diff --git a/systemd/cloud-init-local.service b/systemd/cloud-init-local.service
index b19eeae..bc2db60 100644
--- a/systemd/cloud-init-local.service
+++ b/systemd/cloud-init-local.service
@@ -4,9 +4,10 @@ DefaultDependencies=no
 Wants=local-fs.target
 Wants=network-pre.target
 After=local-fs.target
-Conflicts=shutdown.target
+Before=basic.target
 Before=network-pre.target
 Before=shutdown.target
+Conflicts=shutdown.target
 
 [Service]
 Type=oneshot
diff --git a/systemd/cloud-init.service b/systemd/cloud-init.service
index 6fb655e..1e392a3 100644
--- a/systemd/cloud-init.service
+++ b/systemd/cloud-init.service
@@ -1,9 +1,19 @@
 [Unit]
 Description=Initial cloud-init job (metadata service crawler)
-After=cloud-init-local.service networking.service
-Before=network-online.target sshd.service sshd-keygen.service systemd-user-sessions.service
+DefaultDependencies=no
+Wants=cloud-init-local.service
+Wants=local-fs.target
+Wants=sshd-keygen.service
+Wants=sshd.service
+After=cloud-init-local.service
+After=networking.service
 Requires=networking.service
-Wants=local-fs.target cloud-init-local.service sshd.service sshd-keygen.service
+Before=basic.target
+Before=network-online.target
+Before=sshd-keygen.service
+Before=sshd.service
+Before=systemd-user-sessions.service
+Conflicts=shutdown.target
 
 [Service]
 Type=oneshot
_______________________________________________
Mailing list: https://launchpad.net/~cloud-init-dev
Post to     : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to