summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2017-01-10 11:25:27 -0500
committerScott Moser <smoser@brickies.net>2017-01-10 11:25:27 -0500
commit0c1398edee59a80da08c7262c7fc7981ac0ba488 (patch)
treed2fa1dad52a5519c8e0ee4c40925a519f16aba9a
parentfeb55d787f642473221c886c385f7c657298b51c (diff)
downloadcloud-init-git-0c1398edee59a80da08c7262c7fc7981ac0ba488.tar.gz
Import version 0.7.5-0ubuntu1.4ubuntu/0.7.5-0ubuntu1.4
Imported using git-import-dsc
-rw-r--r--debian/changelog16
-rw-r--r--debian/patches/lp-1383794-gce-short_name.patch37
-rw-r--r--debian/patches/lp-1404311-gce-data_encoding.patch40
-rw-r--r--debian/patches/lp-1422919-azure-g5_ephemeral.patch213
-rw-r--r--debian/patches/series3
5 files changed, 309 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index dbd69dd9..0f8c9aeb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,19 @@
+cloud-init (0.7.5-0ubuntu1.4) trusty; urgency=medium
+
+ [ Ben Howard ]
+ * d/patches/lp-1383794-gce-short_name.patch: Use short hostname for GCE
+ (LP: #1383794).
+
+ [ Wayne Witzel III ]
+ * d/patches/lp-1404311-gce-data_encoding.patch: Enable user-data encoding
+ support for GCE (LP: #1404311).
+
+ [ Daniel Watkins ]
+ * d/patches/lp-1422919-azure-g5_ephemeral.patch: Properly format G5 series
+ cloud instances (LP: #1422919).
+
+ -- Ben Howard <ben.howard@ubuntu.com> Tue, 17 Feb 2015 14:56:16 -0700
+
cloud-init (0.7.5-0ubuntu1.3) trusty-proposed; urgency=medium
* d/patches/lp-1336855-grub_xvda.patch: include xvda devices for
diff --git a/debian/patches/lp-1383794-gce-short_name.patch b/debian/patches/lp-1383794-gce-short_name.patch
new file mode 100644
index 00000000..90cd8e87
--- /dev/null
+++ b/debian/patches/lp-1383794-gce-short_name.patch
@@ -0,0 +1,37 @@
+Description: Use the shortname for GCE
+ GCE FDQN's may exceed 64 characters. A number of programs like Hadoop,
+ Easyrsa, Java, etc., have issues with long hostnames.
+Author: Ben Howard <ben.howard@ubuntu.com>
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1383794
+--- a/cloudinit/sources/DataSourceGCE.py
++++ b/cloudinit/sources/DataSourceGCE.py
+@@ -115,7 +115,8 @@
+ return self.metadata['public-keys']
+
+ def get_hostname(self, fqdn=False, _resolve_ip=False):
+- return self.metadata['local-hostname']
++ # GCE has long FDQN's and has asked for short hostnames
++ return self.metadata['local-hostname'].split('.')[0]
+
+ def get_userdata_raw(self):
+ return self.metadata['user-data']
+--- a/tests/unittests/test_datasource/test_gce.py
++++ b/tests/unittests/test_datasource/test_gce.py
+@@ -80,7 +80,8 @@
+ body=_request_callback)
+ self.ds.get_data()
+
+- self.assertEqual(GCE_META.get('instance/hostname'),
++ shostname = GCE_META.get('instance/hostname').split('.')[0]
++ self.assertEqual(shostname,
+ self.ds.get_hostname())
+
+ self.assertEqual(GCE_META.get('instance/id'),
+@@ -107,5 +108,5 @@
+ self.assertEqual(GCE_META_PARTIAL.get('instance/id'),
+ self.ds.get_instance_id())
+
+- self.assertEqual(GCE_META_PARTIAL.get('instance/hostname'),
+- self.ds.get_hostname())
++ shostname = GCE_META_PARTIAL.get('instance/hostname').split('.')[0]
++ self.assertEqual(shostname, self.ds.get_hostname())
diff --git a/debian/patches/lp-1404311-gce-data_encoding.patch b/debian/patches/lp-1404311-gce-data_encoding.patch
new file mode 100644
index 00000000..e9026de8
--- /dev/null
+++ b/debian/patches/lp-1404311-gce-data_encoding.patch
@@ -0,0 +1,40 @@
+Author: Ben Howard <ben.howard.@ubuntu.com>
+Bug: https://launchpad.net/bugs/1404311
+Applied-Upstream: yes
+Description: Allow for user-defined encoding on user-data to address
+ GCE's mangling of meta-data.
+--- a/cloudinit/sources/DataSourceGCE.py
++++ b/cloudinit/sources/DataSourceGCE.py
+@@ -15,6 +15,8 @@
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
++from base64 import b64decode
++
+ from cloudinit import log as logging
+ from cloudinit import util
+ from cloudinit import sources
+@@ -58,6 +60,8 @@
+ ('local-hostname', 'instance/hostname', True),
+ ('public-keys', 'project/attributes/sshKeys', False),
+ ('user-data', 'instance/attributes/user-data', False),
++ ('user-data-encoding', 'instance/attributes/user-data-encoding',
++ False),
+ ]
+
+ # if we cannot resolve the metadata server, then no point in trying
+@@ -101,6 +105,14 @@
+ lines = self.metadata['public-keys'].splitlines()
+ self.metadata['public-keys'] = [self._trim_key(k) for k in lines]
+
++ encoding = self.metadata.get('user-data-encoding')
++ if encoding:
++ if encoding == 'base64':
++ self.metadata['user-data'] = b64decode(
++ self.metadata['user-data'])
++ else:
++ LOG.warn('unknown user-data-encoding: %s, ignoring', encoding)
++
+ return found
+
+ @property
diff --git a/debian/patches/lp-1422919-azure-g5_ephemeral.patch b/debian/patches/lp-1422919-azure-g5_ephemeral.patch
new file mode 100644
index 00000000..0592e64c
--- /dev/null
+++ b/debian/patches/lp-1422919-azure-g5_ephemeral.patch
@@ -0,0 +1,213 @@
+Author: Ben Howard <ben.howard.@ubuntu.com>
+Bug: https://launchpad.net/bugs/1422919
+Applied-Upstream: yes
+Description: Add GPT partition support
+ Microsoft Azure now has G4/G5 instances that use the GPT partitioning for the
+ ephemeral devices. This patch supports GPT partitioning in both the Azure
+ Datasource and cloud-init generally.
+--- a/cloudinit/config/cc_disk_setup.py
++++ b/cloudinit/config/cc_disk_setup.py
+@@ -27,6 +27,7 @@
+ # Define the commands to use
+ UDEVADM_CMD = util.which('udevadm')
+ SFDISK_CMD = util.which("sfdisk")
++SGDISK_CMD = util.which("sgdisk")
+ LSBLK_CMD = util.which("lsblk")
+ BLKID_CMD = util.which("blkid")
+ BLKDEV_CMD = util.which("blockdev")
+@@ -151,7 +152,7 @@
+ name: the device name, i.e. sda
+ """
+
+- lsblk_cmd = [LSBLK_CMD, '--pairs', '--out', 'NAME,TYPE,FSTYPE,LABEL',
++ lsblk_cmd = [LSBLK_CMD, '--pairs', '--output', 'NAME,TYPE,FSTYPE,LABEL',
+ device]
+
+ if nodeps:
+@@ -315,22 +316,6 @@
+ return False
+
+
+-def get_hdd_size(device):
+- """
+- Returns the hard disk size.
+- This works with any disk type, including GPT.
+- """
+-
+- size_cmd = [SFDISK_CMD, '--show-size', device]
+- size = None
+- try:
+- size, _err = util.subp(size_cmd)
+- except Exception as e:
+- raise Exception("Failed to get %s size\n%s" % (device, e))
+-
+- return int(size.strip())
+-
+-
+ def get_dyn_func(*args):
+ """
+ Call the appropriate function.
+@@ -358,6 +343,30 @@
+ raise Exception("No such function %s to call!" % func_name)
+
+
++def get_mbr_hdd_size(device):
++ size_cmd = [SFDISK_CMD, '--show-size', device]
++ size = None
++ try:
++ size, _err = util.subp(size_cmd)
++ except Exception as e:
++ raise Exception("Failed to get %s size\n%s" % (device, e))
++
++ return int(size.strip())
++
++
++def get_gpt_hdd_size(device):
++ out, _ = util.subp([SGDISK_CMD, '-p', device])
++ return out.splitlines()[0].split()[2]
++
++
++def get_hdd_size(table_type, device):
++ """
++ Returns the hard disk size.
++ This works with any disk type, including GPT.
++ """
++ return get_dyn_func("get_%s_hdd_size", table_type, device)
++
++
+ def check_partition_mbr_layout(device, layout):
+ """
+ Returns true if the partition layout matches the one on the disk
+@@ -393,6 +402,36 @@
+ break
+
+ found_layout.append(type_label)
++ return found_layout
++
++
++def check_partition_gpt_layout(device, layout):
++ prt_cmd = [SGDISK_CMD, '-p', device]
++ try:
++ out, _err = util.subp(prt_cmd)
++ except Exception as e:
++ raise Exception("Error running partition command on %s\n%s" % (
++ device, e))
++
++ out_lines = iter(out.splitlines())
++ # Skip header
++ for line in out_lines:
++ if line.strip().startswith('Number'):
++ break
++
++ return [line.strip().split()[-1] for line in out_lines]
++
++
++def check_partition_layout(table_type, device, layout):
++ """
++ See if the partition lay out matches.
++
++ This is future a future proofing function. In order
++ to add support for other disk layout schemes, add a
++ function called check_partition_%s_layout
++ """
++ found_layout = get_dyn_func(
++ "check_partition_%s_layout", table_type, device, layout)
+
+ if isinstance(layout, bool):
+ # if we are using auto partitioning, or "True" be happy
+@@ -417,18 +456,6 @@
+ return False
+
+
+-def check_partition_layout(table_type, device, layout):
+- """
+- See if the partition lay out matches.
+-
+- This is future a future proofing function. In order
+- to add support for other disk layout schemes, add a
+- function called check_partition_%s_layout
+- """
+- return get_dyn_func("check_partition_%s_layout", table_type, device,
+- layout)
+-
+-
+ def get_partition_mbr_layout(size, layout):
+ """
+ Calculate the layout of the partition table. Partition sizes
+@@ -481,6 +508,29 @@
+ return sfdisk_definition
+
+
++def get_partition_gpt_layout(size, layout):
++ if isinstance(layout, bool):
++ return [(None, [0, 0])]
++
++ partition_specs = []
++ for partition in layout:
++ if isinstance(partition, list):
++ if len(partition) != 2:
++ raise Exception(
++ "Partition was incorrectly defined: %s" % partition)
++ percent, partition_type = partition
++ else:
++ percent = partition
++ partition_type = None
++
++ part_size = int(float(size) * (float(percent) / 100))
++ partition_specs.append((partition_type, [0, '+{}'.format(part_size)]))
++
++ # The last partition should use up all remaining space
++ partition_specs[-1][-1][-1] = 0
++ return partition_specs
++
++
+ def purge_disk_ptable(device):
+ # wipe the first and last megabyte of a disk (or file)
+ # gpt stores partition table both at front and at end.
+@@ -556,6 +606,22 @@
+ read_parttbl(device)
+
+
++def exec_mkpart_gpt(device, layout):
++ try:
++ util.subp([SGDISK_CMD, '-Z', device])
++ for index, (partition_type, (start, end)) in enumerate(layout):
++ index += 1
++ util.subp([SGDISK_CMD,
++ '-n', '{}:{}:{}'.format(index, start, end), device])
++ if partition_type is not None:
++ util.subp(
++ [SGDISK_CMD,
++ '-t', '{}:{}'.format(index, partition_type), device])
++ except Exception:
++ print "Failed to partition device %s" % (device,)
++ raise
++
++
+ def exec_mkpart(table_type, device, layout):
+ """
+ Fetches the function for creating the table type.
+@@ -618,7 +684,7 @@
+ return
+
+ LOG.debug("Checking for device size")
+- device_size = get_hdd_size(device)
++ device_size = get_hdd_size(table_type, device)
+
+ LOG.debug("Calculating partition layout")
+ part_definition = get_partition_layout(table_type, device_size, layout)
+--- a/cloudinit/sources/DataSourceAzure.py
++++ b/cloudinit/sources/DataSourceAzure.py
+@@ -53,9 +53,9 @@
+
+ BUILTIN_CLOUD_CONFIG = {
+ 'disk_setup': {
+- 'ephemeral0': {'table_type': 'mbr',
+- 'layout': True,
+- 'overwrite': False},
++ 'ephemeral0': {'table_type': 'gpt',
++ 'layout': [100],
++ 'overwrite': True},
+ },
+ 'fs_setup': [{'filesystem': 'ext4',
+ 'device': 'ephemeral0.1',
diff --git a/debian/patches/series b/debian/patches/series
index 4d3be115..dd6aad96 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,6 @@
lp1316475-1303986-cloudsigma.patch
lp-1353008-cloud-init-local-needs-run.conf
lp-1336855-grub_xvda.patch
+lp-1383794-gce-short_name.patch
+lp-1404311-gce-data_encoding.patch
+lp-1422919-azure-g5_ephemeral.patch