diff -Nru open-iscsi-2.0.874/debian/changelog open-iscsi-2.0.874/debian/changelog --- open-iscsi-2.0.874/debian/changelog 2018-09-17 13:58:34.000000000 +0000 +++ open-iscsi-2.0.874/debian/changelog 2018-11-15 17:57:24.000000000 +0000 @@ -1,3 +1,15 @@ +open-iscsi (2.0.874-5ubuntu9.1) cosmic; urgency=medium + + * d/iscsi-disk.rules, d/rules: Add a udev rule so that iscsid.service + will be started when iscsi disks are attached. (LP: #1802354) + * debian/tests: sync tests with those in disco. + - add check that iscsid.service is run. + - save artifacts from the test run. + - when running vm for iscsi root test, disable snapd.service + and snapd.seeded.service to avoid unnecessary cpu and IO. + + -- Scott Moser Thu, 15 Nov 2018 12:57:24 -0500 + open-iscsi (2.0.874-5ubuntu9) cosmic; urgency=medium * d/net-interface-handler: replace 'domainsearch' with the correct diff -Nru open-iscsi-2.0.874/debian/iscsi-disk.rules open-iscsi-2.0.874/debian/iscsi-disk.rules --- open-iscsi-2.0.874/debian/iscsi-disk.rules 1970-01-01 00:00:00.000000000 +0000 +++ open-iscsi-2.0.874/debian/iscsi-disk.rules 2018-11-15 17:57:24.000000000 +0000 @@ -0,0 +1,3 @@ +# When iscsi disks are present, iscsid.service should be running. LP: #1802354 +# ID_PATH looks like ip-:-iscsi--lun- +SUBSYSTEM=="block", ACTION=="add", ENV{ID_PATH}=="*-iscsi-*", ENV{SYSTEMD_WANTS}="iscsid.service" diff -Nru open-iscsi-2.0.874/debian/open-iscsi.install open-iscsi-2.0.874/debian/open-iscsi.install --- open-iscsi-2.0.874/debian/open-iscsi.install 2018-08-21 17:33:06.000000000 +0000 +++ open-iscsi-2.0.874/debian/open-iscsi.install 2018-11-15 17:57:24.000000000 +0000 @@ -15,4 +15,5 @@ debian/open-iscsi.kmod => /lib/modules-load.d/open-iscsi.conf debian/net-interface-handler /lib/open-iscsi debian/iscsi-network-interface.rules => /lib/udev/rules.d/70-iscsi-network-interface.rules +debian/iscsi-disk.rules => /lib/udev/rules.d/70-iscsi-disk.rules debian/open-iscsi.finalrd /usr/share/finalrd diff -Nru open-iscsi-2.0.874/debian/tests/patch-image open-iscsi-2.0.874/debian/tests/patch-image --- open-iscsi-2.0.874/debian/tests/patch-image 2018-08-21 17:33:06.000000000 +0000 +++ open-iscsi-2.0.874/debian/tests/patch-image 2018-11-15 17:57:24.000000000 +0000 @@ -251,6 +251,10 @@ [ -f "${pkg}" ] && debs[${#debs[@]}]="$pkg" || packages[${packages[@]}]="$pkg" done + if [ "${#packages[@]}" -eq 0 -a "${#debs[@]}" -eq 0 ]; then + packages=( open-iscsi ) + debug 1 "no packages or debs given, using packages=${packages[*]}" + fi fi # if open-iscsi is not in the packages list above, we handle it specifically @@ -309,6 +313,7 @@ mount -o bind /dev "$target"/dev || : mount -o bind /dev/pts "$target"/dev/pts || : + debug 1 "${#packages[@]} packages: ${packages[*]}" if [ "${#packages[@]}" != "0" ]; then DEBIAN_FRONTEND=noninteractive chroot "$target" sh -exc ' mypkg=$1 @@ -322,6 +327,7 @@ fail "failed to install ${packages[*]} in $target" fi + debug 1 "${#debs[@]} debs: ${debs[*]}" if [ "${#debs[@]}" != "0" ]; then local tmpd="" tmpd=$(mktemp -d "${target}/tmp/${0##*/}.XXXXXX") diff -Nru open-iscsi-2.0.874/debian/tests/test-open-iscsi.py open-iscsi-2.0.874/debian/tests/test-open-iscsi.py --- open-iscsi-2.0.874/debian/tests/test-open-iscsi.py 2018-08-21 17:33:06.000000000 +0000 +++ open-iscsi-2.0.874/debian/tests/test-open-iscsi.py 2018-11-15 17:57:24.000000000 +0000 @@ -75,6 +75,13 @@ exit fi systemd-resolve --status --no-pager + + - &get_iscsid_status | + [ "${1:--}" != "-" ] && exec >"$1" 2>&1 + udevadm settle + systemctl is-active iscsid.service + systemctl status --no-pager --full iscsid.service + - &add_and_remove_tuntap | #!/bin/sh # LP: #1785108 would break dns when any device was removed. @@ -86,11 +93,20 @@ ip tuntap del mode tap $tapdev udevadm settle + - &collect_debug_mounts | + [ "${1:--}" != "-" ] && exec >"$1" 2>&1 + [ -x /usr/local/bin/debug-mounts ] || exit 0 + /usr/local/bin/debug-mounts + runcmd: - [ sh, -c, *add_and_remove_tuntap ] - [ mkdir, -p, /output ] - - [ cp, /etc/resolv.conf, /output] - - [ sh, -c, *get_resolved_status, --, /output/systemd-resolve-status.txt] + - [ cp, /etc/resolv.conf, /output ] + - [ sh, -c, *get_resolved_status, --, /output/systemd-resolve-status.txt ] + - [ sh, -c, *get_iscsid_status, --, /output/iscsid-status.txt ] + - [ sh, -c, *collect_debug_mounts, --, /output/debug-mounts.txt ] + - [ sh, -c, 'journalctl --boot=0 --output=short-monotonic > /output/journal.txt' ] + - [ sh, -c, 'dpkg-query --show > /output/manifest.txt' ] - [ tar, -C, /output, -cf, /dev/disk/by-id/virtio-output-disk, . ] power_state: @@ -215,7 +231,7 @@ 'initrd': os.path.join(image_d, 'initrd')} try: get_image(info['image_d'], release) - except CalledProcessError as e: + except subprocess.CalledProcessError as e: if e.return_code != 3: raise e raise unittest.SkipTest( @@ -243,7 +259,7 @@ path = os.path.join(self.tmpdir, 'output-disk.img') subprocess.check_call([ 'qemu-img', 'create', '-f', 'raw', path, '10M']) - return path + return path def extract_files(self, path): # get contents in a dictionary of tarball at 'path' @@ -273,6 +289,10 @@ netdev = ("--netdev=user,net={network},host={host},dns={dns}," "dnssearch={dnssearch}").format(**info) + artifacts_dir = os.environ.get('AUTOPKGTEST_ARTIFACTS') + if artifacts_dir and not os.path.isdir(artifacts_dir): + os.makedirs(artifacts_dir) + output_disk = self.create_output_disk() cmd = [ tgt_boot_cmd, '-v', netdev, @@ -286,8 +306,14 @@ env['BOOT_TIMEOUT'] = env.get('BOOT_TIMEOUT', '60m') subprocess.check_call(cmd, env=env) + if artifacts_dir: + tgz = os.path.join(artifacts_dir, "tgt-collected.tar.gz") + shutil.copy(output_disk, tgz) + print("Copied output_disk '%s' to artifacts dir '%s'" % + (output_disk, tgz)) + files = self.extract_files(output_disk) - print("files: %s" % files) + print("collected files: %s" % files.keys()) resolvconf = files.get('resolv.conf', "NO_RESOLVCONF_FOUND") resolve_status = files.get('systemd-resolve-status.txt') @@ -322,6 +348,15 @@ msg=("search addr '%s' not in systemd-resolve status: %s" % (dns_search, resolve_status))) + # iscsid-status.txt has first line output from + # 'systemctl is-active iscsid.service' and then 'systemcl status' + iscsid_status = files.get('iscsid-status.txt') + is_active = iscsid_status.splitlines()[0] + self.assertEqual( + "active", is_active, + msg=("Expected iscsid.service active, found '%s'.\n%s\n" % + (is_active, iscsid_status))) + def get_image(top_d, release): cmd = ['get-image', top_d, 'cloud-daily', release] diff -Nru open-iscsi-2.0.874/debian/tests/tgt-boot-test open-iscsi-2.0.874/debian/tests/tgt-boot-test --- open-iscsi-2.0.874/debian/tests/tgt-boot-test 2018-08-21 17:33:06.000000000 +0000 +++ open-iscsi-2.0.874/debian/tests/tgt-boot-test 2018-11-15 17:57:24.000000000 +0000 @@ -16,6 +16,8 @@ net.ifnames=0 BOOTIF_DEFAULT=eth0 root={root} {overlay_drive} console=ttyS0 {cmdline_ds} + # LP: #1796137 + systemd.mask=snapd.seeded.service systemd.mask=snapd.service ) DEF_CMDLINE_TMPL="${_DEF_CMDLINE_TMPL[*]}"