cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #00496
[Merge] lp:~josephbajin/cloud-init/freebsd-configdrive into lp:cloud-init
Scott Moser has proposed merging lp:~josephbajin/cloud-init/freebsd-configdrive into lp:cloud-init.
Requested reviews:
cloud init development team (cloud-init-dev)
For more details, see:
https://code.launchpad.net/~josephbajin/cloud-init/freebsd-configdrive/+merge/231214
--
https://code.launchpad.net/~josephbajin/cloud-init/freebsd-configdrive/+merge/231214
Your team cloud init development team is requested to review the proposed merge of lp:~josephbajin/cloud-init/freebsd-configdrive into lp:cloud-init.
=== modified file 'cloudinit/sources/DataSourceConfigDrive.py'
--- cloudinit/sources/DataSourceConfigDrive.py 2014-02-25 01:17:07 +0000
+++ cloudinit/sources/DataSourceConfigDrive.py 2014-08-18 15:24:59 +0000
@@ -37,7 +37,9 @@
VALID_DSMODES = ("local", "net", "pass", "disabled")
FS_TYPES = ('vfat', 'iso9660')
LABEL_TYPES = ('config-2',)
-OPTICAL_DEVICES = tuple(('/dev/sr%s' % i for i in range(0, 2)))
+POSSIBLE_MOUNTS = ('sr', 'cd')
+OPTICAL_DEVICES = tuple(('/dev/%s%s' % (z, i) for z in POSSIBLE_MOUNTS
+ for i in range(0, 2)))
class DataSourceConfigDrive(openstack.SourceMixin, sources.DataSource):
@@ -70,7 +72,15 @@
if not found:
for dev in find_candidate_devs():
try:
- results = util.mount_cb(dev, read_config_drive)
+ # Set mtype if freebsd and turn off sync
+ if dev.startswith("/dev/cd"):
+ mtype = "cd9660"
+ sync = False
+ else:
+ mtype = None
+ sync = True
+ results = util.mount_cb(dev, read_config_drive, mtype=mtype,
+ sync=sync)
found = dev
except openstack.NonReadable:
pass
=== modified file 'cloudinit/util.py'
--- cloudinit/util.py 2014-07-24 23:41:10 +0000
+++ cloudinit/util.py 2014-08-18 15:24:59 +0000
@@ -1294,12 +1294,16 @@
@contextlib.contextmanager
-def unmounter(umount):
+def unmounter(umount, lazy_support=True):
try:
yield umount
finally:
if umount:
- umount_cmd = ["umount", '-l', umount]
+ # Do not use Lazy Mode on some systems (freebsd)
+ if lazy_support:
+ umount_cmd = ["umount", '-l', umount]
+ else:
+ umount_cmd = ["umount", umount]
subp(umount_cmd)
@@ -1382,7 +1386,12 @@
# Be nice and ensure it ends with a slash
if not mountpoint.endswith("/"):
mountpoint += "/"
- with unmounter(umount):
+ # Set lazy_support to false if FreeBSD
+ if device.startswith("/dev/cd"):
+ lazy_support = False
+ else:
+ lazy_support = True
+ with unmounter(umount, lazy_support):
if data is None:
ret = callback(mountpoint)
else:
=== added file 'templates/hosts.freebsd.tmpl'
--- templates/hosts.freebsd.tmpl 1970-01-01 00:00:00 +0000
+++ templates/hosts.freebsd.tmpl 2014-08-18 15:24:59 +0000
@@ -0,0 +1,24 @@
+## template:jinja
+{#
+This file /etc/cloud/templates/hosts.freebsd.tmpl is only utilized
+if enabled in cloud-config. Specifically, in order to enable it
+you need to add the following to config:
+ manage_etc_hosts: True
+-#}
+# Your system has configured 'manage_etc_hosts' as True.
+# As a result, if you wish for changes to this file to persist
+# then you will need to either
+# a.) make changes to the master file in /etc/cloud/templates/hosts.freebsd.tmpl
+# b.) change or remove the value of 'manage_etc_hosts' in
+# /etc/cloud/cloud.cfg or cloud-config from user-data
+#
+# The following lines are desirable for IPv4 capable hosts
+127.0.0.1 {{fqdn}} {{hostname}}
+127.0.0.1 localhost.localdomain localhost
+127.0.0.1 localhost4.localdomain4 localhost4
+
+# The following lines are desirable for IPv6 capable hosts
+::1 {{fqdn}} {{hostname}}
+::1 localhost.localdomain localhost
+::1 localhost6.localdomain6 localhost6
+
Follow ups