diff options
7 files changed, 0 insertions, 687 deletions
diff --git a/debian/patches/cpick-18203bf-disk_setup-Use-sectors-as-unit-when-formatting-MBR-disks b/debian/patches/cpick-18203bf-disk_setup-Use-sectors-as-unit-when-formatting-MBR-disks deleted file mode 100644 index 1b6ec81b..00000000 --- a/debian/patches/cpick-18203bf-disk_setup-Use-sectors-as-unit-when-formatting-MBR-disks +++ /dev/null @@ -1,155 +0,0 @@ -commit 18203bf101dc04c28b53a92cd95c8be88959c428 -Author: Daniel Watkins <daniel.watkins@canonical.com> -Date: Tue Nov 22 09:58:55 2016 -0500 - - disk_setup: Use sectors as unit when formatting MBR disks with sfdisk. - - The version of sfdisk in wily (and onwards) only accepts sectors as a - valid disk size. As such, this refactors the MBR code path in - cc_disk_setup to use sectors. - - - use --unit=S: while newer versions of sfdisk assume --unit=S, older - versions do not so we specifically pass it in. Versions of sfdisk - found in supported OSes such as centos6 wont assume --unit=S. - - add --force: this exists back to centos 6 (2.17.2), so it should - be fine, and is what we ultimately want. - "do what I say, even if it is stupid" - - keep --Linux. Even though this has been deprecated for quite some - time, we keep it until versions that want it are unsupported. - If necessary at some point we could check for util linux version - and if it had --Linux and use it in those cases. - - Additionally, improve usefulness of some log messages. - - LP: #1460715 - ---- a/cloudinit/config/cc_disk_setup.py -+++ b/cloudinit/config/cc_disk_setup.py -@@ -436,14 +436,13 @@ def get_dyn_func(*args): - - - def get_mbr_hdd_size(device): -- size_cmd = [SFDISK_CMD, '--show-size', device] -- size = None - try: -- size, _err = util.subp(size_cmd) -+ size_in_bytes, _ = util.subp([BLKDEV_CMD, '--getsize64', device]) -+ sector_size, _ = util.subp([BLKDEV_CMD, '--getss', device]) - except Exception as e: - raise Exception("Failed to get %s size\n%s" % (device, e)) - -- return int(size.strip()) -+ return int(size_in_bytes) / int(sector_size) - - - def get_gpt_hdd_size(device): -@@ -588,7 +587,7 @@ def get_partition_mbr_layout(size, layou - raise Exception("Partition was incorrectly defined: %s" % part) - percent, part_type = part - -- part_size = int((float(size) * (float(percent) / 100)) / 1024) -+ part_size = int(float(size) * (float(percent) / 100)) - - if part_num == last_part_num: - part_definition.append(",,%s" % part_type) -@@ -692,7 +691,7 @@ def exec_mkpart_mbr(device, layout): - types, i.e. gpt - """ - # Create the partitions -- prt_cmd = [SFDISK_CMD, "--Linux", "-uM", device] -+ prt_cmd = [SFDISK_CMD, "--Linux", "--unit=S", "--force", device] - try: - util.subp(prt_cmd, data="%s\n" % layout) - except Exception as e: -@@ -909,7 +908,8 @@ def mkfs(fs_cfg): - LOG.debug("Error in device identification handling.") - return - -- LOG.debug("File system %s will be created on %s", label, device) -+ LOG.debug("File system type '%s' with label '%s' will be created on %s", -+ fs_type, label, device) - - # Make sure the device is defined - if not device: ---- a/tests/unittests/test_handler/test_handler_disk_setup.py -+++ b/tests/unittests/test_handler/test_handler_disk_setup.py -@@ -1,3 +1,5 @@ -+import random -+ - from cloudinit.config import cc_disk_setup - from ..helpers import ExitStack, mock, TestCase - -@@ -28,3 +30,73 @@ class TestIsDiskUsed(TestCase): - self.enumerate_disk.return_value = (mock.MagicMock() for _ in range(1)) - self.check_fs.return_value = (mock.MagicMock(), None, mock.MagicMock()) - self.assertFalse(cc_disk_setup.is_disk_used(mock.MagicMock())) -+ -+ -+class TestGetMbrHddSize(TestCase): -+ -+ def setUp(self): -+ super(TestGetMbrHddSize, self).setUp() -+ self.patches = ExitStack() -+ self.subp = self.patches.enter_context( -+ mock.patch.object(cc_disk_setup.util, 'subp')) -+ -+ def tearDown(self): -+ super(TestGetMbrHddSize, self).tearDown() -+ self.patches.close() -+ -+ def _configure_subp_mock(self, hdd_size_in_bytes, sector_size_in_bytes): -+ def _subp(cmd, *args, **kwargs): -+ self.assertEqual(3, len(cmd)) -+ if '--getsize64' in cmd: -+ return hdd_size_in_bytes, None -+ elif '--getss' in cmd: -+ return sector_size_in_bytes, None -+ raise Exception('Unexpected blockdev command called') -+ -+ self.subp.side_effect = _subp -+ -+ def _test_for_sector_size(self, sector_size): -+ size_in_bytes = random.randint(10000, 10000000) * 512 -+ size_in_sectors = size_in_bytes / sector_size -+ self._configure_subp_mock(size_in_bytes, sector_size) -+ self.assertEqual(size_in_sectors, -+ cc_disk_setup.get_mbr_hdd_size('/dev/sda1')) -+ -+ def test_size_for_512_byte_sectors(self): -+ self._test_for_sector_size(512) -+ -+ def test_size_for_1024_byte_sectors(self): -+ self._test_for_sector_size(1024) -+ -+ def test_size_for_2048_byte_sectors(self): -+ self._test_for_sector_size(2048) -+ -+ def test_size_for_4096_byte_sectors(self): -+ self._test_for_sector_size(4096) -+ -+ -+class TestGetPartitionMbrLayout(TestCase): -+ -+ def test_single_partition_using_boolean(self): -+ self.assertEqual('0,', -+ cc_disk_setup.get_partition_mbr_layout(1000, True)) -+ -+ def test_single_partition_using_list(self): -+ disk_size = random.randint(1000000, 1000000000000) -+ self.assertEqual( -+ ',,83', -+ cc_disk_setup.get_partition_mbr_layout(disk_size, [100])) -+ -+ def test_half_and_half(self): -+ disk_size = random.randint(1000000, 1000000000000) -+ expected_partition_size = int(float(disk_size) / 2) -+ self.assertEqual( -+ ',{0},83\n,,83'.format(expected_partition_size), -+ cc_disk_setup.get_partition_mbr_layout(disk_size, [50, 50])) -+ -+ def test_thirds_with_different_partition_type(self): -+ disk_size = random.randint(1000000, 1000000000000) -+ expected_partition_size = int(float(disk_size) * 0.33) -+ self.assertEqual( -+ ',{0},83\n,,82'.format(expected_partition_size), -+ cc_disk_setup.get_partition_mbr_layout(disk_size, [33, [66, 82]])) diff --git a/debian/patches/cpick-2d2ec70-OpenStack-extend-physical-types-to-include-hyperv-hw_veb b/debian/patches/cpick-2d2ec70-OpenStack-extend-physical-types-to-include-hyperv-hw_veb deleted file mode 100644 index 5292e491..00000000 --- a/debian/patches/cpick-2d2ec70-OpenStack-extend-physical-types-to-include-hyperv-hw_veb +++ /dev/null @@ -1,43 +0,0 @@ -commit 2d2ec70f06015f0624f1d0d328cc97f1fb5c29de -Author: Scott Moser <smoser@brickies.net> -Date: Tue Nov 22 16:39:13 2016 -0500 - - OpenStack: extend physical types to include hyperv, hw_veb, vhost_user. - - This extends the list of device 'types' that are considered to be physical - to include hyperv, hw_veb, and vhost_user. - - LP: #1642679 - ---- a/cloudinit/sources/helpers/openstack.py -+++ b/cloudinit/sources/helpers/openstack.py -@@ -61,6 +61,19 @@ OS_VERSIONS = ( - OS_LIBERTY, - ) - -+PHYSICAL_TYPES = ( -+ None, -+ 'bridge', -+ 'ethernet', -+ 'hw_veb', -+ 'hyperv', -+ 'ovs', -+ 'phy', -+ 'tap', -+ 'vhostuser', -+ 'vif', -+) -+ - - class NonReadable(IOError): - pass -@@ -583,8 +596,7 @@ def convert_net_json(network_json=None, - subnet['ipv6'] = True - subnets.append(subnet) - cfg.update({'subnets': subnets}) -- if link['type'] in [None, 'ethernet', 'vif', 'ovs', 'phy', -- 'bridge', 'tap']: -+ if link['type'] in PHYSICAL_TYPES: - cfg.update({'type': 'physical', 'mac_address': link_mac_addr}) - elif link['type'] in ['bond']: - params = {} diff --git a/debian/patches/cpick-6e92c5f-net-cmdline-Consider-ip-or-ip6-on-command-line-not-only b/debian/patches/cpick-6e92c5f-net-cmdline-Consider-ip-or-ip6-on-command-line-not-only deleted file mode 100644 index 86c9b1fe..00000000 --- a/debian/patches/cpick-6e92c5f-net-cmdline-Consider-ip-or-ip6-on-command-line-not-only +++ /dev/null @@ -1,173 +0,0 @@ -commit 6e92c5f2fccaad24afb89f79f260cb496fb8d67f -Author: Scott Moser <smoser@brickies.net> -Date: Tue Nov 8 20:59:23 2016 -0500 - - net/cmdline: Consider ip= or ip6= on command line not only ip= - - The previous behavior would miss ip6= on the command line and - would not pay attention to the written net-* or net6-* files if - only ip6= was found. - - The fix here enables parsing the files if either ip= or ip6= is found, - and adds some tests as well. - - LP: #1639930 - ---- a/cloudinit/net/cmdline.py -+++ b/cloudinit/net/cmdline.py -@@ -57,7 +57,7 @@ def _load_shell_content(content, add_emp - - - def _klibc_to_config_entry(content, mac_addrs=None): -- """Convert a klibc writtent shell content file to a 'config' entry -+ """Convert a klibc written shell content file to a 'config' entry - When ip= is seen on the kernel command line in debian initramfs - and networking is brought up, ipconfig will populate - /run/net-<name>.cfg. -@@ -140,7 +140,7 @@ def _klibc_to_config_entry(content, mac_ - - def config_from_klibc_net_cfg(files=None, mac_addrs=None): - if files is None: -- files = glob.glob('/run/net*.conf') -+ files = glob.glob('/run/net-*.conf') + glob.glob('/run/net6-*.conf') - - entries = [] - names = {} -@@ -148,12 +148,19 @@ def config_from_klibc_net_cfg(files=None - name, entry = _klibc_to_config_entry(util.load_file(cfg_file), - mac_addrs=mac_addrs) - if name in names: -- raise ValueError( -- "device '%s' defined multiple times: %s and %s" % ( -- name, names[name], cfg_file)) -+ prev = names[name]['entry'] -+ if prev.get('mac_address') != entry.get('mac_address'): -+ raise ValueError( -+ "device '%s' was defined multiple times (%s)" -+ " but had differing mac addresses: %s -> %s.", -+ (name, ' '.join(names[name]['files']), -+ prev.get('mac_address'), entry.get('mac_address'))) -+ prev['subnets'].extend(entry['subnets']) -+ names[name]['files'].append(cfg_file) -+ else: -+ names[name] = {'files': [cfg_file], 'entry': entry} -+ entries.append(entry) - -- names[name] = cfg_file -- entries.append(entry) - return {'config': entries, 'version': 1} - - -@@ -199,7 +206,7 @@ def read_kernel_cmdline_config(files=Non - if data64: - return util.load_yaml(_b64dgz(data64)) - -- if 'ip=' not in cmdline: -+ if 'ip=' not in cmdline and 'ip6=' not in cmdline: - return None - - if mac_addrs is None: ---- a/tests/unittests/test_net.py -+++ b/tests/unittests/test_net.py -@@ -8,6 +8,8 @@ from cloudinit import util - - from .helpers import dir2dict - from .helpers import mock -+from .helpers import populate_dir -+from .helpers import TempDirTestCase - from .helpers import TestCase - - import base64 -@@ -54,22 +56,9 @@ DHCP_EXPECTED_1 = { - } - - DHCP6_CONTENT_1 = """ --DEVICE=eno1 -+DEVICE6=eno1 - HOSTNAME= - DNSDOMAIN= --reason='PREINIT' --interface='eno1' --DEVICE=eno1 --HOSTNAME= --DNSDOMAIN= --reason='FAIL' --interface='eno1' --DEVICE=eno1 --HOSTNAME= --DNSDOMAIN= --reason='PREINIT6' --interface='eno1' --DEVICE=eno1 - IPV6PROTO=dhcp6 - IPV6ADDR=2001:67c:1562:8010:0:1:: - IPV6NETMASK=64 -@@ -77,11 +66,6 @@ IPV6DNS0=2001:67c:1562:8010::2:1 - IPV6DOMAINSEARCH= - HOSTNAME= - DNSDOMAIN= --reason='BOUND6' --interface='eno1' --new_ip6_address='2001:67c:1562:8010:0:1::' --new_ip6_prefixlen='64' --new_dhcp6_name_servers='2001:67c:1562:8010::2:1' - """ - - DHCP6_EXPECTED_1 = { -@@ -677,6 +661,56 @@ class TestCmdlineConfigParsing(TestCase) - self.assertEqual(found, self.simple_cfg) - - -+class TestCmdlineReadKernelConfig(TempDirTestCase): -+ def test_ip_cmdline_read_kernel_cmdline_ip(self): -+ content = {'net-eth0.conf': DHCP_CONTENT_1} -+ populate_dir(self.tmp, content) -+ files = [os.path.join(self.tmp, k) for k in content.keys()] -+ found = cmdline.read_kernel_cmdline_config( -+ files=files, cmdline='foo ip=dhcp') -+ self.assertEqual(found['version'], 1) -+ self.assertEqual(found['config'], [DHCP_EXPECTED_1]) -+ -+ def test_ip_cmdline_read_kernel_cmdline_ip6(self): -+ content = {'net6-eno1.conf': DHCP6_CONTENT_1} -+ populate_dir(self.tmp, content) -+ files = [os.path.join(self.tmp, k) for k in content.keys()] -+ found = cmdline.read_kernel_cmdline_config( -+ files=files, cmdline='foo ip6=dhcp root=/dev/sda') -+ self.assertEqual( -+ found, -+ {'version': 1, 'config': [ -+ {'type': 'physical', 'name': 'eno1', -+ 'subnets': [ -+ {'dns_nameservers': ['2001:67c:1562:8010::2:1'], -+ 'control': 'manual', 'type': 'dhcp6', 'netmask': '64'}]}]}) -+ -+ def test_ip_cmdline_read_kernel_cmdline_none(self): -+ # if there is no ip= or ip6= on cmdline, return value should be None -+ content = {'net6-eno1.conf': DHCP6_CONTENT_1} -+ populate_dir(self.tmp, content) -+ files = [os.path.join(self.tmp, k) for k in content.keys()] -+ found = cmdline.read_kernel_cmdline_config( -+ files=files, cmdline='foo root=/dev/sda') -+ self.assertEqual(found, None) -+ -+ def test_ip_cmdline_both_ip_ip6(self): -+ content = {'net-eth0.conf': DHCP_CONTENT_1, -+ 'net6-eth0.conf': DHCP6_CONTENT_1.replace('eno1', 'eth0')} -+ populate_dir(self.tmp, content) -+ files = [os.path.join(self.tmp, k) for k in sorted(content.keys())] -+ found = cmdline.read_kernel_cmdline_config( -+ files=files, cmdline='foo ip=dhcp ip6=dhcp') -+ -+ eth0 = copy.deepcopy(DHCP_EXPECTED_1) -+ eth0['subnets'].append( -+ {'control': 'manual', 'type': 'dhcp6', -+ 'netmask': '64', 'dns_nameservers': ['2001:67c:1562:8010::2:1']}) -+ expected = [eth0] -+ self.assertEqual(found['version'], 1) -+ self.assertEqual(found['config'], expected) -+ -+ - class TestEniRoundTrip(TestCase): - def setUp(self): - super(TestCase, self).setUp() diff --git a/debian/patches/cpick-8c6878a-tests-fix-assumptions-that-expected-no-eth0-in-system b/debian/patches/cpick-8c6878a-tests-fix-assumptions-that-expected-no-eth0-in-system deleted file mode 100644 index 2ec38217..00000000 --- a/debian/patches/cpick-8c6878a-tests-fix-assumptions-that-expected-no-eth0-in-system +++ /dev/null @@ -1,73 +0,0 @@ -commit 8c6878a04eff2fd75115b5f23faa2665cabb5ccd -Author: Scott Moser <smoser@brickies.net> -Date: Tue Nov 22 22:49:07 2016 -0500 - - tests: fix assumptions that expected no eth0 in system. - - The previous commit added tests that would fail on any system that had - a nic named eth0 or eno1. The changes here supply the expected macs to - the function being tested so it does not query the system. - - LP: #1644043 - ---- a/tests/unittests/test_net.py -+++ b/tests/unittests/test_net.py -@@ -662,25 +662,34 @@ class TestCmdlineConfigParsing(TestCase) - - - class TestCmdlineReadKernelConfig(TempDirTestCase): -+ macs = { -+ 'eth0': '14:02:ec:42:48:00', -+ 'eno1': '14:02:ec:42:48:01', -+ } -+ - def test_ip_cmdline_read_kernel_cmdline_ip(self): - content = {'net-eth0.conf': DHCP_CONTENT_1} - populate_dir(self.tmp, content) - files = [os.path.join(self.tmp, k) for k in content.keys()] - found = cmdline.read_kernel_cmdline_config( -- files=files, cmdline='foo ip=dhcp') -+ files=files, cmdline='foo ip=dhcp', mac_addrs=self.macs) -+ exp1 = copy.deepcopy(DHCP_EXPECTED_1) -+ exp1['mac_address'] = self.macs['eth0'] - self.assertEqual(found['version'], 1) -- self.assertEqual(found['config'], [DHCP_EXPECTED_1]) -+ self.assertEqual(found['config'], [exp1]) - - def test_ip_cmdline_read_kernel_cmdline_ip6(self): - content = {'net6-eno1.conf': DHCP6_CONTENT_1} - populate_dir(self.tmp, content) - files = [os.path.join(self.tmp, k) for k in content.keys()] - found = cmdline.read_kernel_cmdline_config( -- files=files, cmdline='foo ip6=dhcp root=/dev/sda') -+ files=files, cmdline='foo ip6=dhcp root=/dev/sda', -+ mac_addrs=self.macs) - self.assertEqual( - found, - {'version': 1, 'config': [ - {'type': 'physical', 'name': 'eno1', -+ 'mac_address': self.macs['eno1'], - 'subnets': [ - {'dns_nameservers': ['2001:67c:1562:8010::2:1'], - 'control': 'manual', 'type': 'dhcp6', 'netmask': '64'}]}]}) -@@ -691,7 +700,7 @@ class TestCmdlineReadKernelConfig(TempDi - populate_dir(self.tmp, content) - files = [os.path.join(self.tmp, k) for k in content.keys()] - found = cmdline.read_kernel_cmdline_config( -- files=files, cmdline='foo root=/dev/sda') -+ files=files, cmdline='foo root=/dev/sda', mac_addrs=self.macs) - self.assertEqual(found, None) - - def test_ip_cmdline_both_ip_ip6(self): -@@ -700,9 +709,10 @@ class TestCmdlineReadKernelConfig(TempDi - populate_dir(self.tmp, content) - files = [os.path.join(self.tmp, k) for k in sorted(content.keys())] - found = cmdline.read_kernel_cmdline_config( -- files=files, cmdline='foo ip=dhcp ip6=dhcp') -+ files=files, cmdline='foo ip=dhcp ip6=dhcp', mac_addrs=self.macs) - - eth0 = copy.deepcopy(DHCP_EXPECTED_1) -+ eth0['mac_address'] = self.macs['eth0'] - eth0['subnets'].append( - {'control': 'manual', 'type': 'dhcp6', - 'netmask': '64', 'dns_nameservers': ['2001:67c:1562:8010::2:1']}) diff --git a/debian/patches/cpick-a9d41de-CloudSigma-Fix-bug-where-datasource-was-not-loaded-in b/debian/patches/cpick-a9d41de-CloudSigma-Fix-bug-where-datasource-was-not-loaded-in deleted file mode 100644 index b886853c..00000000 --- a/debian/patches/cpick-a9d41de-CloudSigma-Fix-bug-where-datasource-was-not-loaded-in +++ /dev/null @@ -1,133 +0,0 @@ -From a9d41de47a58d967ae3fd6a7749f8143a14424d3 Mon Sep 17 00:00:00 2001 -From: Scott Moser <smoser@ubuntu.com> -Date: Wed, 7 Dec 2016 19:17:03 +0100 -Subject: [PATCH] CloudSigma: Fix bug where datasource was not loaded in local - search. - -CloudSigma would not get any datasources loaded during cloud-init local. -Thus, when the network datasource was removed, *no* CloudSigma -datasources would be loaded. - -LP: #1648380 ---- - cloudinit/sources/DataSourceCloudSigma.py | 2 +- - tests/unittests/test_datasource/test_cloudsigma.py | 15 +++++ - tests/unittests/test_datasource/test_common.py | 73 ++++++++++++++++++++++ - 3 files changed, 89 insertions(+), 1 deletion(-) - create mode 100644 tests/unittests/test_datasource/test_common.py - ---- a/cloudinit/sources/DataSourceCloudSigma.py -+++ b/cloudinit/sources/DataSourceCloudSigma.py -@@ -115,7 +115,7 @@ DataSourceCloudSigmaNet = DataSourceClou - # Used to match classes to dependencies. Since this datasource uses the serial - # port network is not really required, so it's okay to load without it, too. - datasources = [ -- (DataSourceCloudSigma, (sources.DEP_FILESYSTEM)), -+ (DataSourceCloudSigma, (sources.DEP_FILESYSTEM, )), - ] - - ---- a/tests/unittests/test_datasource/test_cloudsigma.py -+++ b/tests/unittests/test_datasource/test_cloudsigma.py -@@ -3,6 +3,7 @@ - import copy - - from cloudinit.cs_utils import Cepko -+from cloudinit import sources - from cloudinit.sources import DataSourceCloudSigma - - from .. import helpers as test_helpers -@@ -97,3 +98,17 @@ class DataSourceCloudSigmaTest(test_help - self.datasource.get_data() - - self.assertIsNone(self.datasource.vendordata_raw) -+ -+ -+class DsLoads(test_helpers.TestCase): -+ def test_get_datasource_list_returns_in_local(self): -+ deps = (sources.DEP_FILESYSTEM,) -+ ds_list = DataSourceCloudSigma.get_datasource_list(deps) -+ self.assertEqual(ds_list, -+ [DataSourceCloudSigma.DataSourceCloudSigma]) -+ -+ def test_list_sources_finds_ds(self): -+ found = sources.list_sources( -+ ['CloudSigma'], (sources.DEP_FILESYSTEM,), ['cloudinit.sources']) -+ self.assertEqual([DataSourceCloudSigma.DataSourceCloudSigma], -+ found) ---- /dev/null -+++ b/tests/unittests/test_datasource/test_common.py -@@ -0,0 +1,73 @@ -+from cloudinit import settings -+from cloudinit import sources -+from cloudinit import type_utils -+from cloudinit.sources import ( -+ DataSourceAliYun as AliYun, -+ DataSourceAltCloud as AltCloud, -+ DataSourceAzure as Azure, -+ DataSourceBigstep as Bigstep, -+ DataSourceCloudSigma as CloudSigma, -+ DataSourceCloudStack as CloudStack, -+ DataSourceConfigDrive as ConfigDrive, -+ DataSourceDigitalOcean as DigitalOcean, -+ DataSourceEc2 as Ec2, -+ DataSourceGCE as GCE, -+ DataSourceMAAS as MAAS, -+ DataSourceNoCloud as NoCloud, -+ DataSourceOpenNebula as OpenNebula, -+ DataSourceOpenStack as OpenStack, -+ DataSourceOVF as OVF, -+ DataSourceSmartOS as SmartOS, -+) -+from cloudinit.sources import DataSourceNone as DSNone -+ -+from .. import helpers as test_helpers -+ -+DEFAULT_LOCAL = [ -+ CloudSigma.DataSourceCloudSigma, -+ ConfigDrive.DataSourceConfigDrive, -+ DigitalOcean.DataSourceDigitalOcean, -+ NoCloud.DataSourceNoCloud, -+ OpenNebula.DataSourceOpenNebula, -+ OVF.DataSourceOVF, -+ SmartOS.DataSourceSmartOS, -+] -+ -+DEFAULT_NETWORK = [ -+ AltCloud.DataSourceAltCloud, -+ Azure.DataSourceAzureNet, -+ Bigstep.DataSourceBigstep, -+ CloudStack.DataSourceCloudStack, -+ DSNone.DataSourceNone, -+ Ec2.DataSourceEc2, -+ GCE.DataSourceGCE, -+ MAAS.DataSourceMAAS, -+ NoCloud.DataSourceNoCloudNet, -+ OpenStack.DataSourceOpenStack, -+ OVF.DataSourceOVFNet, -+] -+ -+ -+class ExpectedDataSources(test_helpers.TestCase): -+ builtin_list = settings.CFG_BUILTIN['datasource_list'] -+ deps_local = [sources.DEP_FILESYSTEM] -+ deps_network = [sources.DEP_FILESYSTEM, sources.DEP_NETWORK] -+ pkg_list = [type_utils.obj_name(sources)] -+ -+ def test_expected_default_local_sources_found(self): -+ found = sources.list_sources( -+ self.builtin_list, self.deps_local, self.pkg_list) -+ self.assertEqual(set(DEFAULT_LOCAL), set(found)) -+ -+ def test_expected_default_network_sources_found(self): -+ found = sources.list_sources( -+ self.builtin_list, self.deps_network, self.pkg_list) -+ self.assertEqual(set(DEFAULT_NETWORK), set(found)) -+ -+ def test_expected_nondefault_network_sources_found(self): -+ found = sources.list_sources( -+ ['AliYun'], self.deps_network, self.pkg_list) -+ self.assertEqual(set([AliYun.DataSourceAliYun]), set(found)) -+ -+ -+# vi: ts=4 expandtab diff --git a/debian/patches/cpick-c9c9197-mounts-use-mount-a-again-to-accomplish-mounts b/debian/patches/cpick-c9c9197-mounts-use-mount-a-again-to-accomplish-mounts deleted file mode 100644 index 3dd0e3cb..00000000 --- a/debian/patches/cpick-c9c9197-mounts-use-mount-a-again-to-accomplish-mounts +++ /dev/null @@ -1,104 +0,0 @@ -From c9c9197a3210ac24a039a4096214150d0e8cebb8 Mon Sep 17 00:00:00 2001 -From: Scott Moser <smoser@ubuntu.com> -Date: Wed, 7 Dec 2016 09:44:41 +0100 -Subject: [PATCH] mounts: use mount -a again to accomplish mounts - -During recent changes to cc_mounts, on systemd systems, we started using - systemctl daemon-reload -rather than 'mount -a' to get mounts done. - -The belief was that since entries in /etc/fstab would be written -to tell systemd that they should be after cloud-init -(x-systemd.requires=cloud-init.service) that the reload would then -let systemd mount the units as expected. - -That doesn't seem to work, and new mount entries end up not getting -mounted. The change here moves back to using 'mount -a', but -then also does a systemctl daemon-reload. - -LP: #1647708 ---- - cloudinit/config/cc_mounts.py | 52 ++++++++++++++++++++++++++++--------------- - 1 file changed, 34 insertions(+), 18 deletions(-) - ---- a/cloudinit/config/cc_mounts.py -+++ b/cloudinit/config/cc_mounts.py -@@ -327,6 +327,8 @@ def handle(_name, cfg, cloud, log, _args - if "mounts" in cfg: - cfgmnt = cfg["mounts"] - -+ LOG.debug("mounts configuration is %s", cfgmnt) -+ - for i in range(len(cfgmnt)): - # skip something that wasn't a list - if not isinstance(cfgmnt[i], list): -@@ -423,37 +425,51 @@ def handle(_name, cfg, cloud, log, _args - cc_lines.append('\t'.join(line)) - - fstab_lines = [] -+ removed = [] - for line in util.load_file(FSTAB_PATH).splitlines(): - try: - toks = WS.split(line) - if toks[3].find(comment) != -1: -+ removed.append(line) - continue - except Exception: - pass - fstab_lines.append(line) - -+ for d in dirs: -+ try: -+ util.ensure_dir(d) -+ except Exception: -+ util.logexc(log, "Failed to make '%s' config-mount", d) -+ -+ sadds = [WS.sub(" ", n) for n in cc_lines] -+ sdrops = [WS.sub(" ", n) for n in removed] -+ -+ sops = (["- " + drop for drop in sdrops if drop not in sadds] + -+ ["+ " + add for add in sadds if add not in sdrops]) -+ - fstab_lines.extend(cc_lines) - contents = "%s\n" % ('\n'.join(fstab_lines)) - util.write_file(FSTAB_PATH, contents) - -+ activate_cmds = [] - if needswap: -- try: -- util.subp(("swapon", "-a")) -- except Exception: -- util.logexc(log, "Activating swap via 'swapon -a' failed") -+ activate_cmds.append(["swapon", "-a"]) - -- for d in dirs: -+ if len(sops) == 0: -+ log.debug("No changes to /etc/fstab made.") -+ else: -+ log.debug("Changes to fstab: %s", sops) -+ activate_cmds.append(["mount", "-a"]) -+ if uses_systemd: -+ activate_cmds.append(["systemctl", "daemon-reload"]) -+ -+ fmt = "Activating swap and mounts with: %s" -+ for cmd in activate_cmds: -+ fmt = "Activate mounts: %s:" + ' '.join(cmd) - try: -- util.ensure_dir(d) -- except Exception: -- util.logexc(log, "Failed to make '%s' config-mount", d) -- -- activate_cmd = ["mount", "-a"] -- if uses_systemd: -- activate_cmd = ["systemctl", "daemon-reload"] -- fmt = "Activate mounts: %s:" + ' '.join(activate_cmd) -- try: -- util.subp(activate_cmd) -- LOG.debug(fmt, "PASS") -- except util.ProcessExecutionError: -- util.logexc(log, fmt, "FAIL") -+ util.subp(cmd) -+ log.debug(fmt, "PASS") -+ except util.ProcessExecutionError: -+ log.warn(fmt, "FAIL") -+ util.logexc(log, fmt, "FAIL") diff --git a/debian/patches/series b/debian/patches/series deleted file mode 100644 index bbb09c74..00000000 --- a/debian/patches/series +++ /dev/null @@ -1,6 +0,0 @@ -cpick-18203bf-disk_setup-Use-sectors-as-unit-when-formatting-MBR-disks -cpick-6e92c5f-net-cmdline-Consider-ip-or-ip6-on-command-line-not-only -cpick-8c6878a-tests-fix-assumptions-that-expected-no-eth0-in-system -cpick-2d2ec70-OpenStack-extend-physical-types-to-include-hyperv-hw_veb -cpick-a9d41de-CloudSigma-Fix-bug-where-datasource-was-not-loaded-in -cpick-c9c9197-mounts-use-mount-a-again-to-accomplish-mounts |