Merge lp:~raharper/curtin/new-bionic-upstream-snapshot-v1 into lp:~curtin-dev/curtin/bionic

Proposed by Ryan Harper
Status: Merged
Merged at revision: 83
Proposed branch: lp:~raharper/curtin/new-bionic-upstream-snapshot-v1
Merge into: lp:~curtin-dev/curtin/bionic
Diff against target: 1202 lines (+350/-270)
36 files modified
curtin/block/__init__.py (+11/-5)
curtin/block/clear_holders.py (+33/-4)
curtin/commands/block_meta.py (+23/-20)
curtin/commands/block_wipe.py (+4/-0)
curtin/commands/clear_holders.py (+1/-1)
debian/changelog (+17/-0)
examples/tests/bcache-wipe-xfs.yaml (+74/-0)
examples/tests/uefi_basic.yaml (+23/-0)
tests/unittests/test_clear_holders.py (+82/-0)
tests/unittests/test_commands_block_meta.py (+11/-15)
tests/vmtests/__init__.py (+14/-15)
tests/vmtests/releases.py (+0/-11)
tests/vmtests/test_basic.py (+0/-48)
tests/vmtests/test_bcache_basic.py (+0/-4)
tests/vmtests/test_bcache_bug1718699.py (+21/-0)
tests/vmtests/test_iscsi.py (+0/-4)
tests/vmtests/test_lvm.py (+0/-8)
tests/vmtests/test_lvm_iscsi.py (+0/-4)
tests/vmtests/test_mdadm_iscsi.py (+0/-4)
tests/vmtests/test_network.py (+0/-5)
tests/vmtests/test_network_alias.py (+0/-5)
tests/vmtests/test_network_bonding.py (+0/-8)
tests/vmtests/test_network_enisource.py (+0/-6)
tests/vmtests/test_network_ipv6.py (+0/-5)
tests/vmtests/test_network_ipv6_enisource.py (+0/-7)
tests/vmtests/test_network_ipv6_static.py (+0/-5)
tests/vmtests/test_network_ipv6_vlan.py (+0/-16)
tests/vmtests/test_network_mtu.py (+1/-6)
tests/vmtests/test_network_static.py (+0/-6)
tests/vmtests/test_network_static_routes.py (+0/-6)
tests/vmtests/test_network_vlan.py (+0/-16)
tests/vmtests/test_nvme.py (+0/-5)
tests/vmtests/test_raid5_bcache.py (+0/-5)
tests/vmtests/test_uefi_basic.py (+1/-15)
tools/launch (+10/-10)
tools/xkvm (+24/-1)
To merge this branch: bzr merge lp:~raharper/curtin/new-bionic-upstream-snapshot-v1
Reviewer Review Type Date Requested Status
curtin developers Pending
Review via email: mp+333332@code.launchpad.net

Description of the change

* New upstream snapshot.
  - Drop Precise from vmtest
  - clear_holders: bcache log IO/OS exceptions but do not raise
  - vmtest: Support newer qemu and multipath.
  - block: enable control over exclusive_open use when wiping volumes
  - block: handle wiping bcache parts (LP: #1718699)
  - vmtests: Defer ArtfulNetworkMtu SkipbyDate to 2018
  - bcache: accept sysfs write failure in shutdown handler if path missing
    (LP: #1700564)
  - vmtest: Rephrase a message about no disks to be less scary
  - block_meta: use block.wipe_volume(mode=superblock) to clear MBR/GPT tables
    (LP: #1722322)

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'curtin/block/__init__.py'
--- curtin/block/__init__.py 2017-08-03 19:48:07 +0000
+++ curtin/block/__init__.py 2017-11-07 18:32:47 +0000
@@ -776,17 +776,21 @@
776776
777777
778@contextmanager778@contextmanager
779def exclusive_open(path):779def exclusive_open(path, exclusive=True):
780 """780 """
781 Obtain an exclusive file-handle to the file/device specified781 Obtain an exclusive file-handle to the file/device specified unless
782 caller specifics exclusive=False.
782 """783 """
783 mode = 'rb+'784 mode = 'rb+'
784 fd = None785 fd = None
785 if not os.path.exists(path):786 if not os.path.exists(path):
786 raise ValueError("No such file at path: %s" % path)787 raise ValueError("No such file at path: %s" % path)
787788
789 flags = os.O_RDWR
790 if exclusive:
791 flags += os.O_EXCL
788 try:792 try:
789 fd = os.open(path, os.O_RDWR | os.O_EXCL)793 fd = os.open(path, flags)
790 try:794 try:
791 fd_needs_closing = True795 fd_needs_closing = True
792 with os.fdopen(fd, mode) as fo:796 with os.fdopen(fd, mode) as fo:
@@ -875,7 +879,8 @@
875 return zero_file_at_offsets(path, offsets, buflen=buflen, count=count)879 return zero_file_at_offsets(path, offsets, buflen=buflen, count=count)
876880
877881
878def zero_file_at_offsets(path, offsets, buflen=1024, count=1024, strict=False):882def zero_file_at_offsets(path, offsets, buflen=1024, count=1024, strict=False,
883 exclusive=True):
879 """884 """
880 write zeros to file at specified offsets885 write zeros to file at specified offsets
881 """886 """
@@ -890,7 +895,8 @@
890 tot = buflen * count895 tot = buflen * count
891 msg_vals = {'path': path, 'tot': buflen * count}896 msg_vals = {'path': path, 'tot': buflen * count}
892897
893 with exclusive_open(path) as fp:898 # allow caller to control if we require exclusive open
899 with exclusive_open(path, exclusive=exclusive) as fp:
894 # get the size by seeking to end.900 # get the size by seeking to end.
895 fp.seek(0, 2)901 fp.seek(0, 2)
896 size = fp.tell()902 size = fp.tell()
897903
=== modified file 'curtin/block/clear_holders.py'
--- curtin/block/clear_holders.py 2017-06-12 19:43:55 +0000
+++ curtin/block/clear_holders.py 2017-11-07 18:32:47 +0000
@@ -93,6 +93,24 @@
93 return path93 return path
9494
9595
96def maybe_stop_bcache_device(device):
97 """Attempt to stop the provided device_path or raise unexpected errors."""
98 bcache_stop = os.path.join(device, 'stop')
99 try:
100 util.write_file(bcache_stop, '1', mode=None)
101 except (IOError, OSError) as e:
102 # Note: if we get any exceptions in the above exception classes
103 # it is a result of attempting to write "1" into the sysfs path
104 # The range of errors changes depending on when we race with
105 # the kernel asynchronously removing the sysfs path. Therefore
106 # we log the exception errno we got, but do not re-raise as
107 # the calling process is watching whether the same sysfs path
108 # is being removed; if it fails to go away then we'll have
109 # a log of the exceptions to debug.
110 LOG.debug('Error writing to bcache stop file %s, device removed: %s',
111 bcache_stop, e)
112
113
96def shutdown_bcache(device):114def shutdown_bcache(device):
97 """115 """
98 Shut down bcache for specified bcache device116 Shut down bcache for specified bcache device
@@ -132,8 +150,7 @@
132 os.path.basename(bcache_cache_sysfs))150 os.path.basename(bcache_cache_sysfs))
133 else:151 else:
134 LOG.info('stopping bcache cacheset at: %s', bcache_cache_sysfs)152 LOG.info('stopping bcache cacheset at: %s', bcache_cache_sysfs)
135 util.write_file(os.path.join(bcache_cache_sysfs, 'stop'),153 maybe_stop_bcache_device(bcache_cache_sysfs)
136 '1', mode=None)
137 try:154 try:
138 util.wait_for_removal(bcache_cache_sysfs, retries=removal_retries)155 util.wait_for_removal(bcache_cache_sysfs, retries=removal_retries)
139 except OSError:156 except OSError:
@@ -162,8 +179,7 @@
162 return179 return
163 else:180 else:
164 LOG.info('stopping bcache backing device at: %s', bcache_block_sysfs)181 LOG.info('stopping bcache backing device at: %s', bcache_block_sysfs)
165 util.write_file(os.path.join(bcache_block_sysfs, 'stop'),182 maybe_stop_bcache_device(bcache_block_sysfs)
166 '1', mode=None)
167 try:183 try:
168 # wait for them all to go away184 # wait for them all to go away
169 for dev in [device, bcache_block_sysfs] + slave_paths:185 for dev in [device, bcache_block_sysfs] + slave_paths:
@@ -244,6 +260,19 @@
244 LOG.info("extended partitions do not need wiping, so skipping: '%s'",260 LOG.info("extended partitions do not need wiping, so skipping: '%s'",
245 blockdev)261 blockdev)
246 else:262 else:
263 # some volumes will be claimed by the bcache layer but do not surface
264 # an actual /dev/bcacheN device which owns the parts (backing, cache)
265 # The result is that some volumes cannot be wiped while bcache claims
266 # the device. Resolve this by stopping bcache layer on those volumes
267 # if present.
268 for bcache_path in ['bcache', 'bcache/set']:
269 stop_path = os.path.join(device, bcache_path)
270 if os.path.exists(stop_path):
271 LOG.debug('Attempting to release bcache layer from device: %s',
272 device)
273 maybe_stop_bcache_device(stop_path)
274 continue
275
247 retries = [1, 3, 5, 7]276 retries = [1, 3, 5, 7]
248 LOG.info('wiping superblock on %s', blockdev)277 LOG.info('wiping superblock on %s', blockdev)
249 for attempt, wait in enumerate(retries):278 for attempt, wait in enumerate(retries):
250279
=== modified file 'curtin/commands/block_meta.py'
--- curtin/commands/block_meta.py 2017-06-12 19:43:55 +0000
+++ curtin/commands/block_meta.py 2017-11-07 18:32:47 +0000
@@ -384,7 +384,11 @@
384 LOG.info("labeling device: '%s' with '%s' partition table", disk,384 LOG.info("labeling device: '%s' with '%s' partition table", disk,
385 ptable)385 ptable)
386 if ptable == "gpt":386 if ptable == "gpt":
387 util.subp(["sgdisk", "--clear", disk])387 # Wipe both MBR and GPT that may be present on the disk.
388 # N.B.: wipe_volume wipes 1M at front and end of the disk.
389 # This could destroy disk data in filesystems that lived
390 # there.
391 block.wipe_volume(disk, mode='superblock')
388 elif ptable in _dos_names:392 elif ptable in _dos_names:
389 util.subp(["parted", disk, "--script", "mklabel", "msdos"])393 util.subp(["parted", disk, "--script", "mklabel", "msdos"])
390 else:394 else:
@@ -544,6 +548,24 @@
544 info.get('id'), device, disk_ptable)548 info.get('id'), device, disk_ptable)
545 LOG.debug("partnum: %s offset_sectors: %s length_sectors: %s",549 LOG.debug("partnum: %s offset_sectors: %s length_sectors: %s",
546 partnumber, offset_sectors, length_sectors)550 partnumber, offset_sectors, length_sectors)
551
552 # Wipe the partition if told to do so, do not wipe dos extended partitions
553 # as this may damage the extended partition table
554 if config.value_as_boolean(info.get('wipe')):
555 LOG.info("Preparing partition location on disk %s", disk)
556 if info.get('flag') == "extended":
557 LOG.warn("extended partitions do not need wiping, so skipping: "
558 "'%s'" % info.get('id'))
559 else:
560 # wipe the start of the new partition first by zeroing 1M at the
561 # length of the previous partition
562 wipe_offset = int(offset_sectors * logical_block_size_bytes)
563 LOG.debug('Wiping 1M on %s at offset %s', disk, wipe_offset)
564 # We don't require exclusive access as we're wiping data at an
565 # offset and the current holder maybe part of the current storage
566 # configuration.
567 block.zero_file_at_offsets(disk, [wipe_offset], exclusive=False)
568
547 if disk_ptable == "msdos":569 if disk_ptable == "msdos":
548 if flag in ["extended", "logical", "primary"]:570 if flag in ["extended", "logical", "primary"]:
549 partition_type = flag571 partition_type = flag
@@ -565,25 +587,6 @@
565 else:587 else:
566 raise ValueError("parent partition has invalid partition table")588 raise ValueError("parent partition has invalid partition table")
567589
568 # check if we've triggered hidden metadata like md, lvm or bcache
569 part_kname = get_path_to_storage_volume(info.get('id'), storage_config)
570 holders = clear_holders.get_holders(part_kname)
571 if len(holders) > 0:
572 LOG.debug('Detected block holders on partition %s: %s', part_kname,
573 holders)
574 clear_holders.clear_holders(part_kname)
575 clear_holders.assert_clear(part_kname)
576
577 # Wipe the partition if told to do so, do not wipe dos extended partitions
578 # as this may damage the extended partition table
579 if config.value_as_boolean(info.get('wipe')):
580 if info.get('flag') == "extended":
581 LOG.warn("extended partitions do not need wiping, so skipping: "
582 "'%s'" % info.get('id'))
583 else:
584 block.wipe_volume(
585 get_path_to_storage_volume(info.get('id'), storage_config),
586 mode=info.get('wipe'))
587 # Make the name if needed590 # Make the name if needed
588 if storage_config.get(device).get('name') and partition_type != 'extended':591 if storage_config.get(device).get('name') and partition_type != 'extended':
589 make_dname(info.get('id'), storage_config)592 make_dname(info.get('id'), storage_config)
590593
=== modified file 'curtin/commands/block_wipe.py'
--- curtin/commands/block_wipe.py 2016-09-29 18:31:02 +0000
+++ curtin/commands/block_wipe.py 2017-11-07 18:32:47 +0000
@@ -18,11 +18,15 @@
18import sys18import sys
19import curtin.block as block19import curtin.block as block
20from . import populate_one_subcmd20from . import populate_one_subcmd
21from .. import log
22
23LOG = log.LOG
2124
2225
23def wipe_main(args):26def wipe_main(args):
24 for blockdev in args.devices:27 for blockdev in args.devices:
25 try:28 try:
29 LOG.debug('Wiping volume %s with mode=%s', blockdev, args.mode)
26 block.wipe_volume(blockdev, mode=args.mode)30 block.wipe_volume(blockdev, mode=args.mode)
27 except Exception as e:31 except Exception as e:
28 sys.stderr.write(32 sys.stderr.write(
2933
=== modified file 'curtin/commands/clear_holders.py'
--- curtin/commands/clear_holders.py 2016-09-29 18:31:02 +0000
+++ curtin/commands/clear_holders.py 2017-11-07 18:32:47 +0000
@@ -28,7 +28,7 @@
28 raise ValueError('invalid devices specified')28 raise ValueError('invalid devices specified')
29 block.clear_holders.start_clear_holders_deps()29 block.clear_holders.start_clear_holders_deps()
30 block.clear_holders.clear_holders(args.devices, try_preserve=args.preserve)30 block.clear_holders.clear_holders(args.devices, try_preserve=args.preserve)
31 if args.try_preserve:31 if args.preserve:
32 print('ran clear_holders attempting to preserve data. however, '32 print('ran clear_holders attempting to preserve data. however, '
33 'hotplug support for some devices may cause holders to restart ')33 'hotplug support for some devices may cause holders to restart ')
34 block.clear_holders.assert_clear(args.devices)34 block.clear_holders.assert_clear(args.devices)
3535
=== modified file 'debian/changelog'
--- debian/changelog 2017-10-06 02:22:45 +0000
+++ debian/changelog 2017-11-07 18:32:47 +0000
@@ -1,3 +1,20 @@
1curtin (0.1.0~bzr541-0ubuntu1) bionic; urgency=medium
2
3 * New upstream snapshot.
4 - Drop Precise from vmtest
5 - clear_holders: bcache log IO/OS exceptions but do not raise
6 - vmtest: Support newer qemu and multipath.
7 - block: enable control over exclusive_open use when wiping volumes
8 - block: handle wiping bcache parts (LP: #1718699)
9 - vmtests: Defer ArtfulNetworkMtu SkipbyDate to 2018
10 - bcache: accept sysfs write failure in shutdown handler if path missing
11 (LP: #1700564)
12 - vmtest: Rephrase a message about no disks to be less scary
13 - block_meta: use block.wipe_volume(mode=superblock) to clear MBR/GPT tables
14 (LP: #1722322)
15
16 -- Ryan Harper <ryan.harper@canonical.com> Tue, 07 Nov 2017 11:13:00 -0600
17
1curtin (0.1.0~bzr532-0ubuntu1) artful; urgency=medium18curtin (0.1.0~bzr532-0ubuntu1) artful; urgency=medium
219
3 * New upstream snapshot.20 * New upstream snapshot.
421
=== added file 'examples/tests/bcache-wipe-xfs.yaml'
--- examples/tests/bcache-wipe-xfs.yaml 1970-01-01 00:00:00 +0000
+++ examples/tests/bcache-wipe-xfs.yaml 2017-11-07 18:32:47 +0000
@@ -0,0 +1,74 @@
1showtrace: true
2
3early_commands:
4 # Create a partitioned disk with bcache metadata in one of the partitions.
5 # Then, wipe the partition table. This leaves "buried" bcache data that
6 # would be seen as soon as the disk was partitioned and cause problems
7 # for curtin's use of the disk.
8 # This config recreates issue LP: #1718699
9 00_blockmeta: [env, -u, OUTPUT_FSTAB, TARGET_MOUNT_POINT=/tmp/my.bdir/target,
10 WORKING_DIR=/tmp/my.bdir/work.d, curtin, --showtrace, -v,
11 block-meta, --umount, custom]
12 01_clear_holders: [curtin, clear-holders, --preserve, /dev/vdb]
13 02_quick_erase: [curtin, block-wipe, --mode, superblock, /dev/vdb]
14
15storage:
16 config:
17 - grub_device: true
18 id: vdb
19 name: vdb
20 path: /dev/vdb
21 ptable: msdos
22 type: disk
23 wipe: superblock
24 - id: vdc
25 name: vdc
26 path: /dev/vdc
27 type: disk
28 wipe: superblock
29 - device: vdb
30 id: vdb-part1
31 name: vdb-part1
32 number: 1
33 offset: 4194304B
34 size: 3997171712B
35 type: partition
36 uuid: 1d112703-1ff7-49fb-9655-741016e216bf
37 wipe: superblock
38 - device: vdb
39 id: vdb-part2
40 name: vdb-part2
41 number: 2
42 size: 3997171712B
43 type: partition
44 uuid: ec219a2e-c4a5-4623-b66a-965da2c6c1f1
45 wipe: superblock
46 - backing_device: vdc
47 cache_device: vdb-part2
48 cache_mode: writeback
49 id: bcache0
50 name: bcache0
51 type: bcache
52 - fstype: ext4
53 id: vdb-part1_format
54 label: ''
55 type: format
56 uuid: 0687dc8f-c089-4f30-8603-0ddf646a5dd7
57 volume: vdb-part1
58 - fstype: xfs
59 id: bcache0_format
60 label: ''
61 type: format
62 uuid: c40a45b2-1f12-454e-a0ec-784eb4ded4e6
63 volume: bcache0
64 - device: vdb-part1_format
65 id: vdb-part1_mount
66 options: ''
67 path: /
68 type: mount
69 - device: bcache0_format
70 id: bcache0_mount
71 options: ''
72 path: /var/lib/ceph-bcache/test-disk
73 type: mount
74 version: 1
075
=== modified file 'examples/tests/uefi_basic.yaml'
--- examples/tests/uefi_basic.yaml 2016-08-05 20:47:14 +0000
+++ examples/tests/uefi_basic.yaml 2017-11-07 18:32:47 +0000
@@ -1,4 +1,12 @@
1showtrace: true1showtrace: true
2
3early_commands:
4 # Recreate and test LP:1722322
5 # Make one disk dirty with an MBR and a storage configuration
6 # GPT and don't supply wipe: superblock. This will exercise
7 # curtin use of sgdisk --zap-all instead of --clear (GPT only)
8 blockmeta: ["parted", /dev/vdc, "--script", "mklabel", "msdos"]
9
2storage:10storage:
3 config:11 config:
4 - id: id_disk012 - id: id_disk0
@@ -55,4 +63,19 @@
55 id: id_efi_mount63 id: id_efi_mount
56 path: /boot/efi64 path: /boot/efi
57 type: mount65 type: mount
66 - id: pnum_disk
67 type: disk
68 path: /dev/vdc
69 name: pnum_disk
70 ptable: gpt
71 - id: pnum_disk_p1
72 type: partition
73 number: 1
74 size: 1GB
75 device: pnum_disk
76 - id: pnum_disk_p2
77 type: partition
78 number: 10
79 size: 1GB
80 device: pnum_disk
58 version: 181 version: 1
5982
=== modified file 'tests/unittests/test_clear_holders.py'
--- tests/unittests/test_clear_holders.py 2017-08-03 19:48:07 +0000
+++ tests/unittests/test_clear_holders.py 2017-11-07 18:32:47 +0000
@@ -1,3 +1,4 @@
1import errno
1import mock2import mock
2import os3import os
3import textwrap4import textwrap
@@ -329,6 +330,52 @@
329 mock.call(cset, retries=self.remove_retries)330 mock.call(cset, retries=self.remove_retries)
330 ])331 ])
331332
333 # test bcache shutdown with 'stop' sysfs write failure
334 @mock.patch('curtin.block.clear_holders.udev.udevadm_settle')
335 @mock.patch('curtin.block.clear_holders.get_bcache_sys_path')
336 @mock.patch('curtin.block.clear_holders.util')
337 @mock.patch('curtin.block.clear_holders.os')
338 @mock.patch('curtin.block.clear_holders.LOG')
339 @mock.patch('curtin.block.clear_holders.get_bcache_using_dev')
340 def test_shutdown_bcache_stop_sysfs_write_fails(self, mock_get_bcache,
341 mock_log, mock_os,
342 mock_util,
343 mock_get_bcache_block,
344 mock_udevadm_settle):
345 """Test writes sysfs write failures pass if file not present"""
346 device = "/sys/class/block/null"
347 mock_os.path.exists.side_effect = iter([
348 True, # backing device exists
349 True, # cset device not present (already removed)
350 False, # backing device is removed with cset
351 False, # bcache/stop sysfs is missing (already removed)
352 ])
353 cset = '/sys/fs/bcache/fake'
354 mock_get_bcache.return_value = cset
355 mock_get_bcache_block.return_value = device + '/bcache'
356 mock_os.path.join.side_effect = os.path.join
357
358 # make writes to sysfs fail
359 mock_util.write_file.side_effect = IOError(errno.ENOENT,
360 "File not found")
361
362 clear_holders.shutdown_bcache(device)
363
364 self.assertEqual(2, len(mock_log.info.call_args_list))
365 self.assertEqual(3, len(mock_os.path.exists.call_args_list))
366 self.assertEqual(1, len(mock_get_bcache.call_args_list))
367 self.assertEqual(1, len(mock_get_bcache_block.call_args_list))
368 self.assertEqual(1, len(mock_util.write_file.call_args_list))
369 self.assertEqual(1, len(mock_util.wait_for_removal.call_args_list))
370
371 mock_get_bcache.assert_called_with(device, strict=False)
372 mock_util.write_file.assert_has_calls([
373 mock.call(cset + '/stop', '1', mode=None),
374 ])
375 mock_util.wait_for_removal.assert_has_calls([
376 mock.call(cset, retries=self.remove_retries)
377 ])
378
332 @mock.patch('curtin.block.clear_holders.LOG')379 @mock.patch('curtin.block.clear_holders.LOG')
333 @mock.patch('curtin.block.clear_holders.block.sys_block_path')380 @mock.patch('curtin.block.clear_holders.block.sys_block_path')
334 @mock.patch('curtin.block.clear_holders.lvm')381 @mock.patch('curtin.block.clear_holders.lvm')
@@ -531,6 +578,41 @@
531 for tree, result in test_trees_and_results:578 for tree, result in test_trees_and_results:
532 self.assertEqual(clear_holders.format_holders_tree(tree), result)579 self.assertEqual(clear_holders.format_holders_tree(tree), result)
533580
581 @mock.patch('curtin.block.clear_holders.util.write_file')
582 def test_maybe_stop_bcache_device_raises_errors(self, m_write_file):
583 """Non-IO/OS exceptions are raised by maybe_stop_bcache_device."""
584 m_write_file.side_effect = ValueError('Crazy Value Error')
585 with self.assertRaises(ValueError) as cm:
586 clear_holders.maybe_stop_bcache_device('does/not/matter')
587 self.assertEqual('Crazy Value Error', str(cm.exception))
588 self.assertEqual(
589 mock.call('does/not/matter/stop', '1', mode=None),
590 m_write_file.call_args)
591
592 @mock.patch('curtin.block.clear_holders.LOG')
593 @mock.patch('curtin.block.clear_holders.util.write_file')
594 def test_maybe_stop_bcache_device_handles_oserror(self, m_write_file,
595 m_log):
596 """When OSError.NOENT is raised, log the condition and move on."""
597 m_write_file.side_effect = OSError(errno.ENOENT, 'Expected oserror')
598 clear_holders.maybe_stop_bcache_device('does/not/matter')
599 self.assertEqual(
600 'Error writing to bcache stop file %s, device removed: %s',
601 m_log.debug.call_args[0][0])
602 self.assertEqual('does/not/matter/stop', m_log.debug.call_args[0][1])
603
604 @mock.patch('curtin.block.clear_holders.LOG')
605 @mock.patch('curtin.block.clear_holders.util.write_file')
606 def test_maybe_stop_bcache_device_handles_ioerror(self, m_write_file,
607 m_log):
608 """When IOError.NOENT is raised, log the condition and move on."""
609 m_write_file.side_effect = IOError(errno.ENOENT, 'Expected ioerror')
610 clear_holders.maybe_stop_bcache_device('does/not/matter')
611 self.assertEqual(
612 'Error writing to bcache stop file %s, device removed: %s',
613 m_log.debug.call_args[0][0])
614 self.assertEqual('does/not/matter/stop', m_log.debug.call_args[0][1])
615
534 def test_get_holder_types(self):616 def test_get_holder_types(self):
535 """test clear_holders.get_holder_types"""617 """test clear_holders.get_holder_types"""
536 test_trees_and_results = [618 test_trees_and_results = [
537619
=== modified file 'tests/unittests/test_commands_block_meta.py'
--- tests/unittests/test_commands_block_meta.py 2017-08-03 19:48:07 +0000
+++ tests/unittests/test_commands_block_meta.py 2017-11-07 18:32:47 +0000
@@ -130,6 +130,8 @@
130 'mock_clear_holders')130 'mock_clear_holders')
131 self.add_patch('curtin.block.clear_holders.assert_clear',131 self.add_patch('curtin.block.clear_holders.assert_clear',
132 'mock_assert_clear')132 'mock_assert_clear')
133 self.add_patch('curtin.block.zero_file_at_offsets',
134 'mock_block_zero_file')
133135
134 self.target = "my_target"136 self.target = "my_target"
135 self.config = {137 self.config = {
@@ -177,32 +179,26 @@
177 self.mock_clear_holders.assert_called_with(disk)179 self.mock_clear_holders.assert_called_with(disk)
178 self.mock_assert_clear.assert_called_with(disk)180 self.mock_assert_clear.assert_called_with(disk)
179181
180 def test_partition_handler_calls_clear_holder(self):182 def test_partition_handler_wipes_at_partition_offset(self):
183 """ Test wiping partition at offset prior to creating partition"""
181 disk_info = self.storage_config.get('sda')184 disk_info = self.storage_config.get('sda')
182 part_info = self.storage_config.get('sda-part1')185 part_info = self.storage_config.get('sda-part1')
183 disk_kname = disk_info.get('path')186 disk_kname = disk_info.get('path')
184 part_kname = disk_kname + '1'187 part_kname = disk_kname + '1'
185 self.mock_getpath.side_effect = iter([188 self.mock_getpath.side_effect = iter([
186 disk_info.get('id'),189 disk_kname,
187 part_kname,
188 part_kname,
189 part_kname,190 part_kname,
190 ])191 ])
191
192 self.mock_block_get_part_table_type.return_value = 'dos'192 self.mock_block_get_part_table_type.return_value = 'dos'
193 kname = 'xxx'193 kname = 'xxx'
194 self.mock_block_path_to_kname.return_value = kname194 self.mock_block_path_to_kname.return_value = kname
195 self.mock_block_sys_block_path.return_value = '/sys/class/block/xxx'195 self.mock_block_sys_block_path.return_value = '/sys/class/block/xxx'
196 self.mock_subp.side_effect = iter([
197 ("", 0), # parted mkpart
198 ("", 0), # ??
199 ])
200 holders = ['md1']
201 self.mock_get_holders.return_value = holders
202196
203 block_meta.partition_handler(part_info, self.storage_config)197 block_meta.partition_handler(part_info, self.storage_config)
204198
205 print("clear_holders: %s" % self.mock_clear_holders.call_args_list)199 part_offset = 2048 * 512
206 print("assert_clear: %s" % self.mock_assert_clear.call_args_list)200 self.mock_block_zero_file.assert_called_with(disk_kname, [part_offset],
207 self.mock_clear_holders.assert_called_with(part_kname)201 exclusive=False)
208 self.mock_assert_clear.assert_called_with(part_kname)202 self.mock_subp.assert_called_with(['parted', disk_kname, '--script',
203 'mkpart', 'primary', '2048s',
204 '1001471s'], capture=True)
209205
=== modified file 'tests/vmtests/__init__.py'
--- tests/vmtests/__init__.py 2017-10-06 02:20:08 +0000
+++ tests/vmtests/__init__.py 2017-11-07 18:32:47 +0000
@@ -699,9 +699,6 @@
699 logger.info('Detected centos, adding default config %s',699 logger.info('Detected centos, adding default config %s',
700 centos_default)700 centos_default)
701701
702 if cls.multipath:
703 disks = disks * cls.multipath_num_paths
704
705 # set reporting logger702 # set reporting logger
706 cls.reporting_log = os.path.join(cls.td.logs, 'webhooks-events.json')703 cls.reporting_log = os.path.join(cls.td.logs, 'webhooks-events.json')
707 reporting_logger = CaptureReporting(cls.reporting_log)704 reporting_logger = CaptureReporting(cls.reporting_log)
@@ -727,7 +724,7 @@
727 }))724 }))
728 configs.append(reporting_config)725 configs.append(reporting_config)
729726
730 cmd.extend(uefi_flags + netdevs + disks +727 cmd.extend(uefi_flags + netdevs + cls.mpath_diskargs(disks) +
731 [ftypes['vmtest.root-image'], "--kernel=%s" %728 [ftypes['vmtest.root-image'], "--kernel=%s" %
732 ftypes['boot-kernel'], "--initrd=%s" %729 ftypes['boot-kernel'], "--initrd=%s" %
733 ftypes['boot-initrd'], "--", "curtin", "-vv", "install"] +730 ftypes['boot-initrd'], "--", "curtin", "-vv", "install"] +
@@ -825,11 +822,6 @@
825 # unlike NVMe disks, we do not want to configure the iSCSI disks822 # unlike NVMe disks, we do not want to configure the iSCSI disks
826 # via KVM, which would use qemu's iSCSI target layer.823 # via KVM, which would use qemu's iSCSI target layer.
827824
828 if cls.multipath:
829 target_disks = target_disks * cls.multipath_num_paths
830 extra_disks = extra_disks * cls.multipath_num_paths
831 nvme_disks = nvme_disks * cls.multipath_num_paths
832
833 # output disk is always virtio-blk, with serial of output_disk.img825 # output disk is always virtio-blk, with serial of output_disk.img
834 output_disk = '--disk={},driver={},format={},{},{}'.format(826 output_disk = '--disk={},driver={},format={},{},{}'.format(
835 cls.td.output_disk, 'virtio-blk',827 cls.td.output_disk, 'virtio-blk',
@@ -840,11 +832,9 @@
840 # create xkvm cmd832 # create xkvm cmd
841 cmd = (["tools/xkvm", "-v", dowait] +833 cmd = (["tools/xkvm", "-v", dowait] +
842 uefi_flags + netdevs +834 uefi_flags + netdevs +
843 target_disks + extra_disks + nvme_disks +835 cls.mpath_diskargs(target_disks + extra_disks + nvme_disks) +
844 ["--", "-drive",836 ["--disk=file=%s,if=virtio,media=cdrom" % cls.td.seed_disk] +
845 "file=%s,if=virtio,media=cdrom" % cls.td.seed_disk,837 ["--", "-smp", cls.get_config_smp(), "-m", "1024"])
846 "-smp", cls.get_config_smp(),
847 "-m", "1024"])
848838
849 if not cls.interactive:839 if not cls.interactive:
850 if cls.arch == 's390x':840 if cls.arch == 's390x':
@@ -1007,6 +997,15 @@
1007 # prepending ./ makes '/root/file' or 'root/file' work as expected.997 # prepending ./ makes '/root/file' or 'root/file' work as expected.
1008 return os.path.normpath(os.path.join(cls.td.collect, "./" + path))998 return os.path.normpath(os.path.join(cls.td.collect, "./" + path))
1009999
1000 @classmethod
1001 def mpath_diskargs(cls, disks):
1002 """make multipath versions of --disk args in disks."""
1003 if not cls.multipath:
1004 return disks
1005 opt = ",file.locking=off"
1006 return ([d if d == "--disk" else d + opt for d in disks] *
1007 cls.multipath_num_paths)
1008
1010 # Misc functions that are useful for many tests1009 # Misc functions that are useful for many tests
1011 def output_files_exist(self, files):1010 def output_files_exist(self, files):
1012 logger.debug('checking files exist: %s', files)1011 logger.debug('checking files exist: %s', files)
@@ -1459,7 +1458,7 @@
1459 logger.info('Taring %s disks sparsely to %s', len(disks), outfile)1458 logger.info('Taring %s disks sparsely to %s', len(disks), outfile)
1460 util.subp(cmd, capture=True)1459 util.subp(cmd, capture=True)
1461 else:1460 else:
1462 logger.error('Failed to find "disks" dir under tmpdir: %s', tmpdir)1461 logger.debug('No "disks" dir found in tmpdir: %s', tmpdir)
14631462
14641463
1465def boot_log_wrap(name, func, cmd, console_log, timeout, purpose):1464def boot_log_wrap(name, func, cmd, console_log, timeout, purpose):
14661465
=== modified file 'tests/vmtests/releases.py'
--- tests/vmtests/releases.py 2017-08-03 19:48:07 +0000
+++ tests/vmtests/releases.py 2017-11-07 18:32:47 +0000
@@ -39,15 +39,6 @@
39 target_release = "centos66"39 target_release = "centos66"
4040
4141
42class _PreciseBase(_UbuntuBase):
43 release = "precise"
44
45
46class _PreciseHWET(_UbuntuBase):
47 release = "precise"
48 krel = "trusty"
49
50
51class _TrustyBase(_UbuntuBase):42class _TrustyBase(_UbuntuBase):
52 release = "trusty"43 release = "trusty"
5344
@@ -90,8 +81,6 @@
9081
9182
92class _Releases(object):83class _Releases(object):
93 precise = _PreciseBase
94 precise_hwe_t = _PreciseHWET
95 trusty = _TrustyBase84 trusty = _TrustyBase
96 trusty_hwe_u = _TrustyHWEU85 trusty_hwe_u = _TrustyHWEU
97 trusty_hwe_v = _TrustyHWEV86 trusty_hwe_v = _TrustyHWEV
9887
=== modified file 'tests/vmtests/test_basic.py'
--- tests/vmtests/test_basic.py 2017-08-03 19:48:07 +0000
+++ tests/vmtests/test_basic.py 2017-11-07 18:32:47 +0000
@@ -137,49 +137,6 @@
137 self.assertEqual(source_version, installed_version)137 self.assertEqual(source_version, installed_version)
138138
139139
140class PreciseTestBasic(relbase.precise, TestBasicAbs):
141 __test__ = True
142
143 collect_scripts = [textwrap.dedent("""
144 cd OUTPUT_COLLECT_D
145 blkid -o export /dev/vda > blkid_output_vda
146 blkid -o export /dev/vda1 > blkid_output_vda1
147 blkid -o export /dev/vda2 > blkid_output_vda2
148 f="btrfs_uuid_vdd"
149 btrfs-show /dev/vdd | awk '/uuid/ {print $4}' > $f
150 cat /proc/partitions > proc_partitions
151 ls -al /dev/disk/by-uuid/ > ls_uuid
152 cat /etc/fstab > fstab
153 mkdir -p /dev/disk/by-dname
154 ls /dev/disk/by-dname/ > ls_dname
155 find /etc/network/interfaces.d > find_interfacesd
156
157 v=""
158 out=$(apt-config shell v Acquire::HTTP::Proxy)
159 eval "$out"
160 echo "$v" > apt-proxy
161 """)]
162
163 def test_whole_disk_format(self):
164 # confirm the whole disk format is the expected device
165 btrfs_uuid = self.load_collect_file("btrfs_uuid_vdd").strip()
166
167 self.assertTrue(btrfs_uuid is not None)
168 self.assertEqual(len(btrfs_uuid), 36)
169
170 # extract uuid from ls_uuid by kname
171 kname_uuid = self._kname_to_uuid('vdd')
172
173 # compare them
174 self.assertEqual(kname_uuid, btrfs_uuid)
175
176 def test_ptable(self):
177 print("test_ptable does not work for Precise")
178
179 def test_dname(self):
180 print("test_dname does not work for Precise")
181
182
183class TrustyTestBasic(relbase.trusty, TestBasicAbs):140class TrustyTestBasic(relbase.trusty, TestBasicAbs):
184 __test__ = True141 __test__ = True
185142
@@ -193,11 +150,6 @@
193 print("test_ptable does not work for Trusty")150 print("test_ptable does not work for Trusty")
194151
195152
196class PreciseHWETTestBasic(relbase.precise_hwe_t, PreciseTestBasic):
197 # FIXME: off due to test_whole_disk_format failing
198 __test__ = False
199
200
201class TrustyHWEXTestBasic(relbase.trusty_hwe_x, TrustyTestBasic):153class TrustyHWEXTestBasic(relbase.trusty_hwe_x, TrustyTestBasic):
202 __test__ = True154 __test__ = True
203155
204156
=== modified file 'tests/vmtests/test_bcache_basic.py'
--- tests/vmtests/test_bcache_basic.py 2017-08-03 19:48:07 +0000
+++ tests/vmtests/test_bcache_basic.py 2017-11-07 18:32:47 +0000
@@ -43,10 +43,6 @@
43 self.check_file_regex("cmdline", r"root=UUID=")43 self.check_file_regex("cmdline", r"root=UUID=")
4444
4545
46class PreciseHWETBcacheBasic(relbase.precise_hwe_t, TestBcacheBasic):
47 __test__ = True
48
49
50class TrustyBcacheBasic(relbase.trusty, TestBcacheBasic):46class TrustyBcacheBasic(relbase.trusty, TestBcacheBasic):
51 __test__ = False # covered by test_raid5_bcache47 __test__ = False # covered by test_raid5_bcache
5248
5349
=== added file 'tests/vmtests/test_bcache_bug1718699.py'
--- tests/vmtests/test_bcache_bug1718699.py 1970-01-01 00:00:00 +0000
+++ tests/vmtests/test_bcache_bug1718699.py 2017-11-07 18:32:47 +0000
@@ -0,0 +1,21 @@
1from .releases import base_vm_classes as relbase
2from .test_bcache_basic import TestBcacheBasic
3
4
5class TestBcacheBug1718699(TestBcacheBasic):
6 conf_file = "examples/tests/bcache-wipe-xfs.yaml"
7 dirty_disks = False
8 nr_cpus = 2
9 extra_disks = ['10G']
10
11
12class XenialTestBcacheBug1718699(relbase.xenial, TestBcacheBug1718699):
13 __test__ = True
14
15
16class ZestyTestBcacheBug1718699(relbase.zesty, TestBcacheBug1718699):
17 __test__ = True
18
19
20class ArtfulTestBcacheBug1718699(relbase.artful, TestBcacheBug1718699):
21 __test__ = True
022
=== modified file 'tests/vmtests/test_iscsi.py'
--- tests/vmtests/test_iscsi.py 2017-08-03 19:48:07 +0000
+++ tests/vmtests/test_iscsi.py 2017-11-07 18:32:47 +0000
@@ -47,10 +47,6 @@
47 (testfile, expected_content, content))47 (testfile, expected_content, content))
4848
4949
50class PreciseTestIscsiBasic(relbase.precise, TestBasicIscsiAbs):
51 __test__ = True
52
53
54class TrustyTestIscsiBasic(relbase.trusty, TestBasicIscsiAbs):50class TrustyTestIscsiBasic(relbase.trusty, TestBasicIscsiAbs):
55 __test__ = True51 __test__ = True
5652
5753
=== modified file 'tests/vmtests/test_lvm.py'
--- tests/vmtests/test_lvm.py 2017-08-03 19:48:07 +0000
+++ tests/vmtests/test_lvm.py 2017-11-07 18:32:47 +0000
@@ -48,14 +48,6 @@
48 raise SkipTest("test_dname does not work for %s" % self.release)48 raise SkipTest("test_dname does not work for %s" % self.release)
4949
5050
51class PreciseTestLvm(relbase.precise, TestLvmAbs):
52 __test__ = True
53
54
55class PreciseHWETTestLvm(relbase.precise_hwe_t, PreciseTestLvm):
56 __test__ = True
57
58
59class TrustyTestLvm(relbase.trusty, TestLvmAbs):51class TrustyTestLvm(relbase.trusty, TestLvmAbs):
60 __test__ = True52 __test__ = True
6153
6254
=== modified file 'tests/vmtests/test_lvm_iscsi.py'
--- tests/vmtests/test_lvm_iscsi.py 2017-10-06 02:20:08 +0000
+++ tests/vmtests/test_lvm_iscsi.py 2017-11-07 18:32:47 +0000
@@ -47,10 +47,6 @@
47 self.check_file_strippedline("pvs", "vg2=/dev/sdb6")47 self.check_file_strippedline("pvs", "vg2=/dev/sdb6")
4848
4949
50class PreciseTestIscsiLvm(relbase.precise, TestLvmIscsiAbs):
51 __test__ = True
52
53
54class TrustyTestIscsiLvm(relbase.trusty, TestLvmIscsiAbs):50class TrustyTestIscsiLvm(relbase.trusty, TestLvmIscsiAbs):
55 __test__ = True51 __test__ = True
5652
5753
=== modified file 'tests/vmtests/test_mdadm_iscsi.py'
--- tests/vmtests/test_mdadm_iscsi.py 2017-10-06 02:20:08 +0000
+++ tests/vmtests/test_mdadm_iscsi.py 2017-11-07 18:32:47 +0000
@@ -22,10 +22,6 @@
22 """)]22 """)]
2323
2424
25class PreciseTestIscsiMdadm(relbase.precise, TestMdadmIscsiAbs):
26 __test__ = True
27
28
29class TrustyTestIscsiMdadm(relbase.trusty, TestMdadmIscsiAbs):25class TrustyTestIscsiMdadm(relbase.trusty, TestMdadmIscsiAbs):
30 __test__ = True26 __test__ = True
3127
3228
=== modified file 'tests/vmtests/test_network.py'
--- tests/vmtests/test_network.py 2017-10-06 02:20:08 +0000
+++ tests/vmtests/test_network.py 2017-11-07 18:32:47 +0000
@@ -449,11 +449,6 @@
449 pass449 pass
450450
451451
452class PreciseHWETTestNetworkBasic(relbase.precise_hwe_t, TestNetworkBasicAbs):
453 # FIXME: off due to hang at test: Starting execute cloud user/final scripts
454 __test__ = False
455
456
457class TrustyTestNetworkBasic(relbase.trusty, TestNetworkBasicAbs):452class TrustyTestNetworkBasic(relbase.trusty, TestNetworkBasicAbs):
458 __test__ = True453 __test__ = True
459454
460455
=== modified file 'tests/vmtests/test_network_alias.py'
--- tests/vmtests/test_network_alias.py 2017-08-03 19:48:07 +0000
+++ tests/vmtests/test_network_alias.py 2017-11-07 18:32:47 +0000
@@ -41,11 +41,6 @@
41 __test__ = True41 __test__ = True
4242
4343
44class PreciseHWETTestNetworkAlias(relbase.precise_hwe_t, TestNetworkAliasAbs):
45 # FIXME: off due to hang at test: Starting execute cloud user/final scripts
46 __test__ = True
47
48
49class TrustyTestNetworkAlias(relbase.trusty, TestNetworkAliasAbs):44class TrustyTestNetworkAlias(relbase.trusty, TestNetworkAliasAbs):
50 __test__ = True45 __test__ = True
5146
5247
=== modified file 'tests/vmtests/test_network_bonding.py'
--- tests/vmtests/test_network_bonding.py 2017-10-06 02:20:08 +0000
+++ tests/vmtests/test_network_bonding.py 2017-11-07 18:32:47 +0000
@@ -38,14 +38,6 @@
38 pass38 pass
3939
4040
41class PreciseHWETTestBonding(relbase.precise_hwe_t, TestNetworkBondingAbs):
42 __test__ = True
43
44 def test_ifenslave_installed(self):
45 self.assertIn("ifenslave-2.6", self.debian_packages,
46 "ifenslave deb not installed")
47
48
49class TrustyTestBonding(relbase.trusty, TestNetworkBondingAbs):41class TrustyTestBonding(relbase.trusty, TestNetworkBondingAbs):
50 __test__ = False42 __test__ = False
5143
5244
=== modified file 'tests/vmtests/test_network_enisource.py'
--- tests/vmtests/test_network_enisource.py 2017-10-06 02:20:08 +0000
+++ tests/vmtests/test_network_enisource.py 2017-11-07 18:32:47 +0000
@@ -79,12 +79,6 @@
79 self.assertEqual(_nocidr(expected_address), _nocidr(actual_address))79 self.assertEqual(_nocidr(expected_address), _nocidr(actual_address))
8080
8181
82class PreciseTestNetworkENISource(relbase.precise, TestNetworkENISource):
83 __test__ = False
84 # not working, still debugging though; possible older ifupdown doesn't
85 # like the multiple iface method.
86
87
88class TrustyTestNetworkENISource(relbase.trusty, TestNetworkENISource):82class TrustyTestNetworkENISource(relbase.trusty, TestNetworkENISource):
89 __test__ = True83 __test__ = True
9084
9185
=== modified file 'tests/vmtests/test_network_ipv6.py'
--- tests/vmtests/test_network_ipv6.py 2017-10-06 02:20:08 +0000
+++ tests/vmtests/test_network_ipv6.py 2017-11-07 18:32:47 +0000
@@ -40,11 +40,6 @@
40 pass40 pass
4141
4242
43class PreciseHWETTestNetwork(relbase.precise_hwe_t, TestNetworkIPV6Abs):
44 # FIXME: off due to hang at test: Starting execute cloud user/final scripts
45 __test__ = False
46
47
48class TrustyTestNetworkIPV6(relbase.trusty, TestNetworkIPV6Abs):43class TrustyTestNetworkIPV6(relbase.trusty, TestNetworkIPV6Abs):
49 __test__ = True44 __test__ = True
5045
5146
=== modified file 'tests/vmtests/test_network_ipv6_enisource.py'
--- tests/vmtests/test_network_ipv6_enisource.py 2017-10-06 02:20:08 +0000
+++ tests/vmtests/test_network_ipv6_enisource.py 2017-11-07 18:32:47 +0000
@@ -12,13 +12,6 @@
12 pass12 pass
1313
1414
15class PreciseTestNetworkIPV6ENISource(relbase.precise,
16 TestNetworkIPV6ENISource):
17 __test__ = False
18 # not working, still debugging though; possible older ifupdown doesn't
19 # like the multiple iface method.
20
21
22class TrustyTestNetworkIPV6ENISource(relbase.trusty, TestNetworkIPV6ENISource):15class TrustyTestNetworkIPV6ENISource(relbase.trusty, TestNetworkIPV6ENISource):
23 __test__ = True16 __test__ = True
2417
2518
=== modified file 'tests/vmtests/test_network_ipv6_static.py'
--- tests/vmtests/test_network_ipv6_static.py 2017-08-03 19:48:07 +0000
+++ tests/vmtests/test_network_ipv6_static.py 2017-11-07 18:32:47 +0000
@@ -13,11 +13,6 @@
13 conf_file = "examples/tests/basic_network_static_ipv6.yaml"13 conf_file = "examples/tests/basic_network_static_ipv6.yaml"
1414
1515
16class PreciseHWETTestNetworkIPV6Static(relbase.precise_hwe_t,
17 TestNetworkIPV6StaticAbs):
18 __test__ = True
19
20
21class TrustyTestNetworkIPV6Static(relbase.trusty, TestNetworkIPV6StaticAbs):16class TrustyTestNetworkIPV6Static(relbase.trusty, TestNetworkIPV6StaticAbs):
22 __test__ = True17 __test__ = True
2318
2419
=== modified file 'tests/vmtests/test_network_ipv6_vlan.py'
--- tests/vmtests/test_network_ipv6_vlan.py 2017-10-06 02:20:08 +0000
+++ tests/vmtests/test_network_ipv6_vlan.py 2017-11-07 18:32:47 +0000
@@ -12,22 +12,6 @@
12 conf_file = "examples/tests/vlan_network_ipv6.yaml"12 conf_file = "examples/tests/vlan_network_ipv6.yaml"
1313
1414
15class PreciseTestNetworkIPV6Vlan(relbase.precise, TestNetworkIPV6VlanAbs):
16 __test__ = True
17
18 # precise ip -d link show output is different (of course)
19 def test_vlan_enabled(self):
20
21 # we must have at least one
22 self.assertGreaterEqual(len(self.get_vlans()), 1)
23
24 # did they get configured?
25 for vlan in self.get_vlans():
26 link_file = "ip_link_show_" + vlan['name']
27 vlan_msg = "vlan id " + str(vlan['vlan_id'])
28 self.check_file_regex(link_file, vlan_msg)
29
30
31class TrustyTestNetworkIPV6Vlan(relbase.trusty, TestNetworkIPV6VlanAbs):15class TrustyTestNetworkIPV6Vlan(relbase.trusty, TestNetworkIPV6VlanAbs):
32 __test__ = True16 __test__ = True
3317
3418
=== modified file 'tests/vmtests/test_network_mtu.py'
--- tests/vmtests/test_network_mtu.py 2017-10-06 02:20:08 +0000
+++ tests/vmtests/test_network_mtu.py 2017-11-07 18:32:47 +0000
@@ -155,11 +155,6 @@
155 pass155 pass
156156
157157
158class PreciseHWETTestNetworkMtu(relbase.precise_hwe_t, TestNetworkMtuAbs):
159 # FIXME: Precise mtu / ipv6 is buggy
160 __test__ = False
161
162
163class TrustyTestNetworkMtu(relbase.trusty, TestNetworkMtuAbs):158class TrustyTestNetworkMtu(relbase.trusty, TestNetworkMtuAbs):
164 __test__ = True159 __test__ = True
165160
@@ -203,7 +198,7 @@
203 @classmethod198 @classmethod
204 def setUpClass(cls):199 def setUpClass(cls):
205 cls.skip_by_date(cls.__name__, cls.release, "1671951",200 cls.skip_by_date(cls.__name__, cls.release, "1671951",
206 fixby=(2017, 10, 20), removeby=(2018, 1, 23))201 fixby=(2018, 1, 20), removeby=(2018, 2, 23))
207 super().setUpClass()202 super().setUpClass()
208203
209204
210205
=== modified file 'tests/vmtests/test_network_static.py'
--- tests/vmtests/test_network_static.py 2017-08-03 19:48:07 +0000
+++ tests/vmtests/test_network_static.py 2017-11-07 18:32:47 +0000
@@ -28,12 +28,6 @@
28 pass28 pass
2929
3030
31class PreciseHWETTestNetworkStatic(relbase.precise_hwe_t,
32 TestNetworkStaticAbs):
33 # FIXME: off due to hang at test: Starting execute cloud user/final scripts
34 __test__ = False
35
36
37class TrustyTestNetworkStatic(relbase.trusty, TestNetworkStaticAbs):31class TrustyTestNetworkStatic(relbase.trusty, TestNetworkStaticAbs):
38 __test__ = True32 __test__ = True
3933
4034
=== modified file 'tests/vmtests/test_network_static_routes.py'
--- tests/vmtests/test_network_static_routes.py 2017-08-03 19:48:07 +0000
+++ tests/vmtests/test_network_static_routes.py 2017-11-07 18:32:47 +0000
@@ -16,12 +16,6 @@
16 conf_file = "examples/tests/network_static_routes.yaml"16 conf_file = "examples/tests/network_static_routes.yaml"
1717
1818
19class PreciseHWETTestNetworkStaticRoutes(relbase.precise_hwe_t,
20 TestNetworkStaticRoutesAbs):
21 # FIXME: off due to hang at test: Starting execute cloud user/final scripts
22 __test__ = False
23
24
25class TrustyTestNetworkStaticRoutes(relbase.trusty,19class TrustyTestNetworkStaticRoutes(relbase.trusty,
26 TestNetworkStaticRoutesAbs):20 TestNetworkStaticRoutesAbs):
27 __test__ = True21 __test__ = True
2822
=== modified file 'tests/vmtests/test_network_vlan.py'
--- tests/vmtests/test_network_vlan.py 2017-10-06 02:20:08 +0000
+++ tests/vmtests/test_network_vlan.py 2017-11-07 18:32:47 +0000
@@ -68,22 +68,6 @@
68 pass68 pass
6969
7070
71class PreciseTestNetworkVlan(relbase.precise, TestNetworkVlanAbs):
72 __test__ = True
73
74 # precise ip -d link show output is different (of course)
75 def test_vlan_enabled(self):
76
77 # we must have at least one
78 self.assertGreaterEqual(len(self.get_vlans()), 1)
79
80 # did they get configured?
81 for vlan in self.get_vlans():
82 link_file = "ip_link_show_" + vlan['name']
83 vlan_msg = "vlan id " + str(vlan['vlan_id'])
84 self.check_file_regex(link_file, vlan_msg)
85
86
87class TrustyTestNetworkVlan(relbase.trusty, TestNetworkVlanAbs):71class TrustyTestNetworkVlan(relbase.trusty, TestNetworkVlanAbs):
88 __test__ = True72 __test__ = True
8973
9074
=== modified file 'tests/vmtests/test_nvme.py'
--- tests/vmtests/test_nvme.py 2017-08-03 19:48:07 +0000
+++ tests/vmtests/test_nvme.py 2017-11-07 18:32:47 +0000
@@ -53,11 +53,6 @@
53 self.check_file_strippedline("ls_dev_nvme", "/dev/nvme1")53 self.check_file_strippedline("ls_dev_nvme", "/dev/nvme1")
5454
5555
56class PreciseTestNvme(relbase.precise, TestNvmeAbs):
57 __test__ = False
58 # Precise kernel doesn't have NVME support, with TrustyHWE it would
59
60
61class TrustyTestNvme(relbase.trusty, TestNvmeAbs):56class TrustyTestNvme(relbase.trusty, TestNvmeAbs):
62 __test__ = True57 __test__ = True
6358
6459
=== modified file 'tests/vmtests/test_raid5_bcache.py'
--- tests/vmtests/test_raid5_bcache.py 2017-08-03 19:48:07 +0000
+++ tests/vmtests/test_raid5_bcache.py 2017-11-07 18:32:47 +0000
@@ -65,11 +65,6 @@
65 self.check_file_regex("bcache_cache_mode", r"\[writeback\]")65 self.check_file_regex("bcache_cache_mode", r"\[writeback\]")
6666
6767
68class PreciseHWETTestRaid5Bcache(relbase.precise_hwe_t, TestMdadmBcacheAbs):
69 # FIXME: off due to failing install: RUN_ARRAY failed: Invalid argument
70 __test__ = False
71
72
73class TrustyTestRaid5Bcache(relbase.trusty, TestMdadmBcacheAbs):68class TrustyTestRaid5Bcache(relbase.trusty, TestMdadmBcacheAbs):
74 __test__ = True69 __test__ = True
75 # FIXME(LP: #1523037): dname does not work on trusty, so we cannot expect70 # FIXME(LP: #1523037): dname does not work on trusty, so we cannot expect
7671
=== modified file 'tests/vmtests/test_uefi_basic.py'
--- tests/vmtests/test_uefi_basic.py 2017-08-03 19:48:07 +0000
+++ tests/vmtests/test_uefi_basic.py 2017-11-07 18:32:47 +0000
@@ -9,7 +9,7 @@
9 interactive = False9 interactive = False
10 arch_skip = ["s390x"]10 arch_skip = ["s390x"]
11 conf_file = "examples/tests/uefi_basic.yaml"11 conf_file = "examples/tests/uefi_basic.yaml"
12 extra_disks = []12 extra_disks = ['4G']
13 uefi = True13 uefi = True
14 disk_to_check = [('main_disk', 1), ('main_disk', 2), ('main_disk', 3)]14 disk_to_check = [('main_disk', 1), ('main_disk', 2), ('main_disk', 3)]
15 collect_scripts = [textwrap.dedent("""15 collect_scripts = [textwrap.dedent("""
@@ -76,16 +76,6 @@
76 self.assertEqual(self.disk_block_size, size)76 self.assertEqual(self.disk_block_size, size)
7777
7878
79class PreciseUefiTestBasic(relbase.precise, TestBasicAbs):
80 __test__ = True
81
82 def test_ptable(self):
83 print("test_ptable does not work for Precise")
84
85 def test_dname(self):
86 print("test_dname does not work for Precise")
87
88
89class TrustyUefiTestBasic(relbase.trusty, TestBasicAbs):79class TrustyUefiTestBasic(relbase.trusty, TestBasicAbs):
90 __test__ = True80 __test__ = True
9181
@@ -115,10 +105,6 @@
115 __test__ = True105 __test__ = True
116106
117107
118class PreciseUefiTestBasic4k(PreciseUefiTestBasic):
119 disk_block_size = 4096
120
121
122class TrustyUefiTestBasic4k(TrustyUefiTestBasic):108class TrustyUefiTestBasic4k(TrustyUefiTestBasic):
123 disk_block_size = 4096109 disk_block_size = 4096
124110
125111
=== modified file 'tools/launch'
--- tools/launch 2017-08-03 19:48:07 +0000
+++ tools/launch 2017-11-07 18:32:47 +0000
@@ -583,11 +583,10 @@
583 bs_args="${bs_args},physical_block_size=$phybs"583 bs_args="${bs_args},physical_block_size=$phybs"
584 bs_args="${bs_args},min_io_size=$logbs"584 bs_args="${bs_args},min_io_size=$logbs"
585585
586 disk_args=( "${disk_args[@]}" "-drive"586 t="file=${src},if=none,cache=unsafe,format=$fmt,"
587 "file=${src},if=none,cache=unsafe,format=$fmt,id=drv${id},index=$id" )587 t="${t}id=drv${id},index=$id,"
588588 t="${t}driver=${driver},${bs_args}${devopts}"
589 disk_args=( "${disk_args[@]}" "-device"589 disk_args[${#disk_args[@]}]="--disk=$t"
590 "${driver},drive=drv${id},${bs_args}${devopts}" )
591590
592 done591 done
593592
@@ -754,7 +753,7 @@
754 seed="${TEMP_D}/seed.img"753 seed="${TEMP_D}/seed.img"
755 cloud-localds "$seed" "$udata" "$mdata" ||754 cloud-localds "$seed" "$udata" "$mdata" ||
756 { error "failed cloud-localds"; return 1; }755 { error "failed cloud-localds"; return 1; }
757 seedargs=( "-drive" "file=${seed},if=virtio,media=cdrom" )756 seedargs=( "--disk=file=${seed},if=virtio,media=cdrom" )
758 fi757 fi
759758
760 local netargs759 local netargs
@@ -779,13 +778,14 @@
779 fi778 fi
780 fi779 fi
781 # -monitor stdio780 # -monitor stdio
781 local bootdisk="--disk=file=$bootimg,id=boot,index=1,cache=unsafe"
782 cmd=(782 cmd=(
783 xkvm "${pt[@]}" "${netargs[@]}" --783 xkvm "${pt[@]}" "${netargs[@]}"
784 "$bootdisk"
785 "${disk_args[@]}"
786 --
784 -smp ${smp}787 -smp ${smp}
785 -m ${mem} ${serial_args} ${video}788 -m ${mem} ${serial_args} ${video}
786 -drive "file=$bootimg,if=none,cache=unsafe,format=qcow2,id=boot,index=0"
787 -device "virtio-blk,drive=boot"
788 "${disk_args[@]}"
789 "${seedargs[@]}"789 "${seedargs[@]}"
790 )790 )
791791
792792
=== modified file 'tools/xkvm'
--- tools/xkvm 2016-12-02 02:04:27 +0000
+++ tools/xkvm 2017-11-07 18:32:47 +0000
@@ -11,6 +11,8 @@
11# OVS_CLEANUP gets populated with bridge:devname pairs used with ovs11# OVS_CLEANUP gets populated with bridge:devname pairs used with ovs
12OVS_CLEANUP=( )12OVS_CLEANUP=( )
13MAC_PREFIX="52:54:00:12:34"13MAC_PREFIX="52:54:00:12:34"
14# allow this to be set externally.
15_QEMU_SUPPORTS_FILE_LOCKING="${_QEMU_SUPPORTS_FILE_LOCKING}"
14KVM="kvm"16KVM="kvm"
15declare -A KVM_DEVOPTS17declare -A KVM_DEVOPTS
1618
@@ -119,6 +121,21 @@
119 return 1121 return 1
120}122}
121123
124qemu_supports_file_locking() {
125 # hackily check if qemu has file.locking in -drive params (LP: #1716028)
126 if [ -z "$_QEMU_SUPPORTS_FILE_LOCKING" ]; then
127 # The only way we could find to check presense of file.locking is
128 # qmp (query-qmp-schema). Simply checking if the virtio-blk driver
129 # supports 'share-rw' is expected to be equivalent and simpler.
130 isdevopt virtio-blk share-rw &&
131 _QEMU_SUPPORTS_FILE_LOCKING=true ||
132 _QEMU_SUPPORTS_FILE_LOCKING=false
133 debug 1 "qemu supports file locking = ${_QEMU_SUPPORTS_FILE_LOCKING}"
134 fi
135 [ "$_QEMU_SUPPORTS_FILE_LOCKING" = "true" ]
136 return
137}
138
122padmac() {139padmac() {
123 # return a full mac, given a subset.140 # return a full mac, given a subset.
124 # assume whatever is input is the last portion to be141 # assume whatever is input is the last portion to be
@@ -443,7 +460,7 @@
443 out=$(LANG=C qemu-img info "$file") &&460 out=$(LANG=C qemu-img info "$file") &&
444 fmt=$(echo "$out" | awk '$0 ~ /^file format:/ { print $3 }') ||461 fmt=$(echo "$out" | awk '$0 ~ /^file format:/ { print $3 }') ||
445 { error "failed to determine format of $file"; return 1; }462 { error "failed to determine format of $file"; return 1; }
446 else463 elif [ -z "$fmt" ]; then
447 fmt=raw464 fmt=raw
448 fi465 fi
449 if [ -z "$driver" ]; then466 if [ -z "$driver" ]; then
@@ -470,6 +487,12 @@
470 id=*|if=*|driver=*|$file|file=*) continue;;487 id=*|if=*|driver=*|$file|file=*) continue;;
471 fmt=*|format=*) continue;;488 fmt=*|format=*) continue;;
472 serial=*|bus=*|unit=*|index=*) continue;;489 serial=*|bus=*|unit=*|index=*) continue;;
490 file.locking=*)
491 qemu_supports_file_locking || {
492 debug 2 "qemu has no file locking." \
493 "Dropping '$tok' from: $cur"
494 continue
495 };;
473 esac496 esac
474 isdevopt "$driver" "$tok" && devopts="${devopts},$tok" ||497 isdevopt "$driver" "$tok" && devopts="${devopts},$tok" ||
475 diskopts="${diskopts},${tok}"498 diskopts="${diskopts},${tok}"

Subscribers

People subscribed via source and target branches

to all changes: