Merge ~rafaeldtinoco/ubuntu/+source/open-iscsi:lp1891374-groovy into ~rafaeldtinoco/ubuntu/+source/open-iscsi:lp1891374-debian_sid
- Git
- lp:~rafaeldtinoco/ubuntu/+source/open-iscsi
- lp1891374-groovy
- Merge into lp1891374-debian_sid
| Status: | Merged | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Approved by: | Rafael David Tinoco | ||||||||||||||||||||
| Approved revision: | 018d257cc28f78773fcfb9b4e5761027586e9ad0 | ||||||||||||||||||||
| Merge reported by: | Rafael David Tinoco | ||||||||||||||||||||
| Merged at revision: | 018d257cc28f78773fcfb9b4e5761027586e9ad0 | ||||||||||||||||||||
| Proposed branch: | ~rafaeldtinoco/ubuntu/+source/open-iscsi:lp1891374-groovy | ||||||||||||||||||||
| Merge into: | ~rafaeldtinoco/ubuntu/+source/open-iscsi:lp1891374-debian_sid | ||||||||||||||||||||
| Diff against target: |
24923 lines (+4835/-457) 29 files modified
debian/changelog (+987/-0) debian/control (+4/-2) debian/extra/initramfs.hook (+1/-1) debian/extra/initramfs.local-bottom (+20/-0) debian/extra/initramfs.local-top (+30/-2) debian/extra/net-interface-handler (+80/-0) debian/iscsi-network-interface.rules (+3/-0) debian/iscsid.service (+1/-1) debian/open-iscsi.finalrd (+40/-0) debian/open-iscsi.postinst (+25/-40) debian/open-iscsi.service (+6/-6) debian/patches/lp1755858-default-iscsid_conf-to-iscsid_socket.patch (+30/-0) debian/patches/series (+1/-0) debian/rules (+27/-8) debian/tests/README-boot-test.md (+139/-0) debian/tests/control (+4/-0) debian/tests/get-image (+227/-0) debian/tests/install (+5/-2) debian/tests/patch-image (+374/-0) debian/tests/test-open-iscsi.py (+426/-0) debian/tests/testlib.py (+1153/-0) debian/tests/testsuite (+7/-0) debian/tests/tgt-boot-test (+534/-0) debian/tests/xkvm (+704/-0) dev/null (+0/-395) iscsiuio/src/.gitignore (+1/-0) iscsiuio/src/unix/.gitignore (+1/-0) test/.gitignore (+3/-0) test/harness/.gitignore (+2/-0) |
||||||||||||||||||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Bryce Harrington (community) | Approve | ||
| Canonical Server | Pending | ||
| Rafael David Tinoco | Pending | ||
|
Review via email:
|
|||
Commit message
Description of the change
| Rafael David Tinoco (rafaeldtinoco) wrote : | # |
| Rafael David Tinoco (rafaeldtinoco) wrote : | # |
Doing the procedure above, you should ignore:
00040fa 2.1.1-1 (patches unapplied)
as it is the manual delta added.
And the git command:
$ git log lp1891374/
will give you the logical delta if this would be an git-ubuntu merge (I'm keeping this for future import).
| Rafael David Tinoco (rafaeldtinoco) wrote : | # |
NOTE:
I'm still testing this open-iscsi package but I would like very much for a review to start taking place, so we don't take too much longer to merge this new open-iscsi version.
Thank you
| Rafael David Tinoco (rafaeldtinoco) wrote : | # |
Upgrading existing open-iscsi installations with active iscsi disks:
----
Installing new version of config file /etc/init.
Installing new version of config file /etc/iscsi/
grep: /lib/modules-
open-iscsi postinst: since the check in preinst some iSCSI sessions have
Setting up iscsiuio (2.1.1-1ubuntu1) ...
Created symlink /etc/systemd/
NOTE: I need to fix this "No such file or directory"
----
(k)rafaeldtinoc
disabled
(k)rafaeldtinoc
enabled
NOTE: Turned/kept open-iscsi installation "socket" enabled only (this is Ubuntu delta)
----
(k)rafaeldtinoc
/dev/sda /dev/sdb
$ journalctl _SYSTEMD_
-- Logs begin at Tue 2020-08-11 21:20:41 UTC, end at Thu 2020-08-13 13:42:36 UTC. --
Aug 13 13:40:30 iscsiubu logout-
Aug 13 13:40:30 iscsiubu iscsiadm[2260]: iscsiadm: iscsi01: 1 session requested, but 1 already present.
Aug 13 13:40:30 iscsiubu iscsiadm[2260]: iscsiadm: Could not log into all portals
$ journalctl _SYSTEMD_
Aug 12 17:36:17 iscsiubu iscsid[525]: iSCSI logger with pid=529 started!
Aug 12 17:36:17 iscsiubu iscsid[529]: iSCSI daemon with pid=530 started!
Aug 12 17:36:18 iscsiubu iscsid[529]: Connection1:0 to [target: iqn.2003-
Aug 13 13:40:30 iscsiubu iscsid[530]: semop down failed 22
Aug 13 13:40:30 iscsiubu iscsid[2142]: iSCSI logger with pid=2143 started!
Aug 13 13:40:31 iscsiubu iscsid[2143]: iSCSI daemon with pid=2144 started!
Aug 13 13:40:31 iscsiubu iscsid[2143]: session cannot be terminated because it's trying to reconnect: try again later
Aug 13 13:40:31 iscsiubu iscsid[2143]: connection1:0 is operational after recovery (1 attempts)
Aug 13 13:40:31 iscsiubu iscsid[2144]: semop down failed 22
Aug 13 13:40:31 iscsiubu iscsid[2282]: iSCSI logger with pid=2283 started!
Aug 13 13:40:32 iscsiubu iscsid[2283]: iSCSI daemon with pid=2284 started!
Aug 13 13:40:34 iscsiubu iscsid[2283]: connection1:0 is operational after recovery (1 attempts)
----
NOTE: iscsi sessions were re-established:
$ sudo iscsiadm --mode session -P3
iSCSI Transport Class version 2.0-870
version 2.1.1
Target: iqn.2003-
Current Portal: 10.250.94.10:3260,1
Persistent Portal: 10.250.94.10:3260,1
**********
Interface:
**********
Iface Name: tcp.52:
Iface Transport: tcp
Iface Initiatorname: iqn.1993-
Iface IPaddress: 10.250.94.172
Iface HWaddress: 52:54:00:fd:e1:4e
Iface Netdev: default
SID: 1
iSCSI Connection State: LOGGED ...
| Rafael David Tinoco (rafaeldtinoco) wrote : | # |
I am missing this also:
Description: default in iscid.conf to use iscsid.socket
People do not want iscsid to run if not needed.
To do so it is configured to be socket activated.
Internally iscsid code has a fallback if the service is missing to run the
command specified in iscsid.conf as "iscsid.startup".
Set this to ensure the socket is active instead of calling the binary, which
would not be what we want anyway as it would not be from the .service context.
Forwarded: no (Downstream config)
Author: Christian Ehrhardt <email address hidden>
Bug-Ubuntu: https:/
Last-Update: 2018-05-23
I removed it and did not put it back yet.
| Rafael David Tinoco (rafaeldtinoco) wrote : | # |
Working in getting a PPA ready.
| Rafael David Tinoco (rafaeldtinoco) wrote : | # |
- 867262d... by Rafael David Tinoco
-
* d/rules: Don't FTBFS due to warnings new in gcc10 regarding bounds and
initialization, because upstream's gcc10 support is incomplete. This
change can be dropped when upstream has completed their gcc support.
| Rafael David Tinoco (rafaeldtinoco) wrote : | # |
I think I have finished addressing all compilation (gcc10) issues in all arches (in the PPA). Waiting for all of them to finish compiling.
Good to go (be reviewed).
| Bryce Harrington (bryce) wrote : | # |
The package installs/
The autopkgtests skipped for me running in lxc since it lacked 'revert-
This change doesn't appear in the changelog and should be added:
* Make iscsid.socket the default startup method in iscsid.conf
(a7654ebc10
The diff attached to this MP appears to include both the ubuntu delta and the debian delta (at least, it is showing removal of d/docs, d/p/bugfixes/*, etc. that sound like they were part of 2.1.1-1). Apologies if some of my review comments are against the debian delta rather than the ubuntu delta.
I've also flagged typos I spotted (I can't help but notice spelling errors...) but it's not important to me whether they're included or not; none of them are user-visible. I know sometimes it's not worth changing existing delta, so leave them to your call.
Other review comments are inline below. Hopefully they make sense.
| Rafael David Tinoco (rafaeldtinoco) wrote : | # |
* Make iscsid.socket the default startup method in iscsid.conf is actually:
/d/p/lp1755858-
and documented in changelog at:
- make iscsid socket-activated to only activate it as needed
- d/iscsid.socket: systemd socket file for iscsid
- d/open-
- d/rules: install and enable iscsid.socket
- d/p/lp1755858-
- d/open-
- run restart logic only if service is running on upgrade
- drop no longer reachable upgrade path that affects iscsid
- disable iscsid.service on upgrade
- handle iscsid.socket to be started if the service is not running yet
- d/iscsi-disk.rules: Add a udev rule so that iscsid.service will be run
when udev disks are attached.
- d/iscsid.service: Remove ExecStop= directive.
- d/tests/install: fix tests to work with socket activation
it was a git log done apart from that change because I had to re-create it due to upstream code modifications. Git log and changelog entry were different so, to be more clear about this, I'm adding:
debian/
* make iscsid socket-activated to only activate it as needed:
- debian/
- debian/
- debian/rules: install and enable iscsid.socket
- debian/
- debian/
- run restart logic only if service is running on upgrade
- drop no longer reachable upgrade path that affects iscsid
- disable iscsid.service on upgrade
- handle iscsid.socket to be started if the service is not running yet
- d/iscsi-disk.rules: Add a udev rule so that iscsid.service will be
run when udev disks are attached.
- d/iscsid.service: Remove ExecStop= directive.
- debian/
Dropped:
* make iscsid socket-activated to only activate it as needed:
- debian/
socket. This patch was renamed only.
- debian/
that affects iscsid
- d/iscsi-disk.rules: Add a udev rule so that iscsid.service will be
run when udev disks are attached.
and changing changelog to the same (without the Dropped as these drops were already documented in the Debian version).
| Rafael David Tinoco (rafaeldtinoco) wrote : | # |
I still need to finish some changes...
| Rafael David Tinoco (rafaeldtinoco) wrote : | # |
Okay I think I have addressed all the highlights and, if all good, will submit this to bileto to make sure its all good for migration.
| Christian Ehrhardt (paelzer) wrote : | # |
"Imported using rafaeldtinoco's hands" is nice one :-)
I can understand that you have
"Note: this suite should be replaced as soon as TGT is replaced by LIO (targetcli-fb) in main archive." in the commit, but it does IMHO not belong into the changelog here.
"else" in "* add IPv6 support" has one space too much for correct indent.
Since we added socket support which we still carry in "* Make iscsid socket-activated to only activate it as needed" upstream has added "etc/systemd/
Can we re-use this (identical) file and drop ours. That way we would pick up fixes by upstream in that file.
In a similar fashion (Not for the scope of this merge) it would be great to some day be able to unify ./etc/systemd/
- Also=iscsid.socket might make sense in ours.
- Type notify, Notify MAIN and -f (foregrund) might work for us as well
Other differences between the to might go vice versa and be suggested upstream.
Typo:
"to be explcit to start" (probably mine)
Ubuntu already has made the transition TO the socket activation.
I think we could loose many special code in e.g. debian/
e.g. the whole block around "dpkg --compare-versions "$2" le-nl "2.0.874-5ubuntu3"" which is part of "* Make iscsid socket-activated to only activate it as needed:". In the past we needed odd rules for the transition and debhelper couldn't handle service+socket with conflicts on restart.
But in Groovy things are fine now - feel free to take a look and convert much of that into just 1-2 lines of dh_installsystemd - take a look at the libvirt merge if you want.
Note - this is an optimization that can take place later as well, but then note it down for next time.
The gcc-10 changes are fine (ignore the warnings for now).
I was also trying to run the multipath-tools and tgt tests against your PPA but LP api hates my tests today. But when you run yours in bileto we will see the same results - so waiting for those.
| Christian Ehrhardt (paelzer) wrote : | # |
Since I pointed you to it (fo dh systemd things) but it isn't ready yet (waiting on Debian to upload experimental and one upstream fix) you can find the current state of the libvirt 6.6 merge at https:/
| Rafael David Tinoco (rafaeldtinoco) wrote : | # |
Replies to @paelzer:
"Imported using rafaeldtinoco's hands" is nice one :-)
I can understand that you have "Note: this suite should be replaced as soon as
TGT is replaced by LIO (targetcli-fb) in main archive." in the commit, but it
does IMHO not belong into the changelog here.
> alright. kept it in git log only.
"else" in "* add IPv6 support" has one space too much for correct indent.
> I could not find what you refer to.
Since we added socket support which we still carry in "* Make iscsid
socket-activated to only activate it as needed" upstream has added
"etc/systemd/
That way we would pick up fixes by upstream in that file.
> Okay. FTRO, I will upstream our open-iscsi delta, but I'm planning a
refactoring for the iscsi root support and that would be too much for this
effort.
In a similar fashion (Not for the scope of this merge) it would be great to some
day be able to unify ./etc/systemd/
But they are so different that will take a while - yet we can learn a bit.
- Also=iscsid.socket might make sense in ours.
- Type notify, Notify MAIN and -f (foregrund) might work for us as well
Other differences between the to might go vice versa and be suggested upstream.
> This is planned for the next work. My final intent for open-iscsi is to take
full iscsi root support to Debian and drop delta (max I can).
Typo:
"to be explcit to start" (probably mine)
> Fixed.
Ubuntu already has made the transition TO the socket activation.
I think we could loose many special code in e.g. debian/
e.g. the whole block around "dpkg --compare-versions "$2" le-nl
"2.0.874-5ubuntu3"" which is part of "* Make iscsid socket-activated to only
activate it as needed:". In the past we needed odd rules for the transition and
debhelper couldn't handle service+socket with conflicts on restart.
> I got rid of all upgrade paths from Debian for the same reason. I was afraid
of this one because of upgrade paths. BUT, to be honest, this has little
importance over the others as the max side effect would be to have the
daemon enabled, together with the socket... so I guess its okay to remove it.
But in Groovy things are fine now - feel free to take a look and convert much of
that into just 1-2 lines of dh_installsystemd - take a look at the libvirt merge
if you want.
Note - this is an optimization that can take place later as well, but then note
it down for next time.
> I'm taking a note for this one, cause I want to read better what debhelper
can do for situations like this (disabling service, keeping socket enabled
when upgrading, etc).
> Also, this is the part I want to test after Bileto (installing, upgrading
with iscsid enabled / disabled, with and without automatic LUNs, etc). So,
IF something does not work, I'll have to revisit this anyway.
> Added to git log:
Note:
* Need to revisit upgrade paths and systemd service/socket activation.
It is very likely that this part can be optimized.
The gcc-10 changes are fine (ignore the warnings for now).
I was also trying to run the multipath-tools and tgt tests against your PPA but
...
| Bryce Harrington (bryce) wrote : | # |
Sounds like you've addressed the points I've made. I'm glad Christian is adding his suggestions too, so will mark my part approved and you can upload once Christian's happy as well.
| Rafael David Tinoco (rafaeldtinoco) wrote : | # |
@paelzer,
bileto tells me that "install" test failed. That happens because iscsid.socket is enabled but not running after installation. Will fix this and make bileto happy about all tests.
| Rafael David Tinoco (rafaeldtinoco) wrote : | # |
Alright,
autopkgtests have passed. I have made several tests regarding iscsid.
I have uploaded it:
$ dput ubuntu open-iscsi_
Checking signature on .changes
gpg: /home/rafaeldti
Checking signature on .dsc
gpg: /home/rafaeldti
Package includes an .orig.tar.gz file although the debian revision suggests
that it might not be required. Multiple uploads of the .orig.tar.gz may be
rejected by the upload queue management software.
Uploading to ubuntu (via ftp to upload.ubuntu.com):
Uploading open-iscsi_
Uploading open-iscsi_
Uploading open-iscsi_
Uploading open-iscsi_
Uploading open-iscsi_
Successfully uploaded packages.
And will keep git-ubuntu history for future merges (when 2.1.1-1 is imported from Debian).
Preview Diff
| 1 | diff --git a/debian/TODO.Debian b/debian/TODO.Debian |
| 2 | deleted file mode 100644 |
| 3 | index 6233bc9..0000000 |
| 4 | --- a/debian/TODO.Debian |
| 5 | +++ /dev/null |
| 6 | @@ -1,5 +0,0 @@ |
| 7 | -TODO for package open-iscsi |
| 8 | ---------------------------- |
| 9 | - |
| 10 | - - find a way to make event-based activation work on sysvinit systems |
| 11 | - and then deprecate the current LVM hacks |
| 12 | diff --git a/debian/changelog b/debian/changelog |
| 13 | index 0b6e4e8..acaa069 100644 |
| 14 | --- a/debian/changelog |
| 15 | +++ b/debian/changelog |
| 16 | @@ -1,3 +1,73 @@ |
| 17 | +open-iscsi (2.1.1-1ubuntu1) groovy; urgency=medium |
| 18 | + |
| 19 | + * New upstream version 2.1.1 |
| 20 | + * d/rules: Don't FTBFS due to warnings new in gcc10 regarding bounds |
| 21 | + and initialization, because upstream's gcc10 support is incomplete. |
| 22 | + This change can be dropped when upstream has completed their gcc |
| 23 | + support. |
| 24 | + * Merge with Debian unstable (LP: #1891374). Remaining changes: |
| 25 | + - debian/tests: Add Ubuntu autopkgtest suite: |
| 26 | + - README-boot-test.md |
| 27 | + - tgt-boot-test: tests |
| 28 | + - test-open-iscsi.py |
| 29 | + - testlib.py |
| 30 | + - get-image |
| 31 | + - patch-image |
| 32 | + - testsuite |
| 33 | + - xkvm |
| 34 | + - d/iscsid.service: Let iscsid systemd job run in privileged containers |
| 35 | + but not in unprivileged ones |
| 36 | + - d/extra/initramfs.local-top: handle iSCSI iBFT DHCP to correctly |
| 37 | + run ipconfig to gather all DHCP config info, including DNS search |
| 38 | + domain, which iBFT can't provide. |
| 39 | + - Remove initramfs interfaces stamp in case no iscsi devs mounted. |
| 40 | + If iscsi root was requested, but no iscsi devices were mounted, remove |
| 41 | + the initramfs interfaces stamp file. Meaning, that on shutdown there is |
| 42 | + no 30s delay, whilst trying to re-establish iscsi login to perform a |
| 43 | + logout. |
| 44 | + - add IPv6 support |
| 45 | + - Source /run/net6-*.conf when needed. |
| 46 | + - d/extra/initramfs.local-top: handle IPv6 configs being shipped in |
| 47 | + DEVICE6 or /run/net6-*.conf in the initramfs, so we can fill in |
| 48 | + .interface |
| 49 | + - d/rules, d/open-iscsi.finalrd, d/control: ship the finalrd iscsi logout |
| 50 | + hook and recommend finalrd and busybox for the logout hook to work. |
| 51 | + - Make iscsid socket-activated to only activate it as needed: |
| 52 | + - debian/open-iscsi.service: do not start or check iscsid.service |
| 53 | + - debian/rules: install and enable iscsid.socket |
| 54 | + - debian/open-iscsi.postinst: |
| 55 | + - run restart logic only if service is running on upgrade |
| 56 | + - drop no longer reachable upgrade path that affects iscsid |
| 57 | + - disable iscsid.service on upgrade |
| 58 | + - handle iscsid.socket to be started if the service is not running yet |
| 59 | + - d/iscsi-disk.rules: Add a udev rule so that iscsid.service will be |
| 60 | + run when udev disks are attached. |
| 61 | + - d/iscsid.service: Remove ExecStop= directive. |
| 62 | + - debian/tests/install: fix tests to work with socket activation |
| 63 | + - debian/patches/lp1755858-default-iscsid_conf-to-iscsid_socket.patch |
| 64 | + - debian/open-iscsi.service: Start open-iscsi systemd job when either |
| 65 | + /etc/iscsi/nodes or /sys/class/iscsi_session have content. |
| 66 | + - Prevent network interface that contains iscsi root from bouncing |
| 67 | + during boot or going down during shutdown if the system is using |
| 68 | + resolvconf or ifupdown: |
| 69 | + - d/iscsi-network-interface.rules |
| 70 | + - d/extra/net-interface-handler |
| 71 | + - d/extra/initramfs.hook: add ib_iser to the list of modules included in |
| 72 | + the initramfs, so that we can in principle support iscsi root on |
| 73 | + infiniband. |
| 74 | + - d/open-iscsi.kmod drop: (LP #1833586) |
| 75 | + no static module list is needed if we let iscsid load modules itself. |
| 76 | + - Stop producing udebs on i386 where we no longer have d-i or a kernel. |
| 77 | + - Use python2 instead of python in the autopkg tests: Next step for |
| 78 | + open-iscsi is to revist all iscsi-root feature and autopkgtests, so |
| 79 | + keep python2 to avoid re-work later. |
| 80 | + - d/extra/initramfs.local-{top,bottom}: move removal of |
| 81 | + open-iscsi.interface file from local-top to local-bottom, and fix shell |
| 82 | + quoting issue that would result in /run/initramfs/ open-iscsi.interface |
| 83 | + always being removed (LP #1872813) |
| 84 | + |
| 85 | + -- Rafael David Tinoco <rafaeldtinoco@ubuntu.com> Thu, 13 Aug 2020 04:29:43 +0000 |
| 86 | + |
| 87 | open-iscsi (2.1.1-1) experimental; urgency=medium |
| 88 | |
| 89 | [ Rafael David Tinoco ] |
| 90 | @@ -42,6 +112,98 @@ open-iscsi (2.1.1-1) experimental; urgency=medium |
| 91 | |
| 92 | -- Ritesh Raj Sarraf <rrs@debian.org> Tue, 23 Jun 2020 20:38:47 +0530 |
| 93 | |
| 94 | +open-iscsi (2.0.874-7.1ubuntu6.1) focal; urgency=medium |
| 95 | + |
| 96 | + [ Ben Swartzlander ] |
| 97 | + * allow open-iscsi to disable auto-scan feature (LP: #1877617) |
| 98 | + - d/p/lp1877617-Allow-disabling-auto-LUN-scans.patch |
| 99 | + - d/p/lp1877617-Fix-manual-LUN-scans-feature.patch |
| 100 | + |
| 101 | + -- Rafael David Tinoco <rafaeldtinoco@ubuntu.com> Mon, 11 May 2020 02:03:33 +0000 |
| 102 | + |
| 103 | +open-iscsi (2.0.874-7.1ubuntu6) focal; urgency=medium |
| 104 | + |
| 105 | + * d/extra/initramfs.local-{top,bottom}: move removal of open-iscsi.interface |
| 106 | + file from local-top to local-bottom, and fix shell quoting issue that |
| 107 | + would result in /run/initramfs/open-iscsi.interface always being removed |
| 108 | + (LP: #1872813) |
| 109 | + |
| 110 | + -- Daniel Watkins <oddbloke@ubuntu.com> Tue, 14 Apr 2020 16:54:37 -0400 |
| 111 | + |
| 112 | +open-iscsi (2.0.874-7.1ubuntu5) focal; urgency=medium |
| 113 | + |
| 114 | + * Use python2 instead of python in the autopkg tests. |
| 115 | + |
| 116 | + -- Matthias Klose <doko@ubuntu.com> Thu, 30 Jan 2020 10:14:16 +0100 |
| 117 | + |
| 118 | +open-iscsi (2.0.874-7.1ubuntu3) eoan; urgency=medium |
| 119 | + |
| 120 | + * Stop producing udebs on i386 where we no longer have d-i or a kernel. |
| 121 | + |
| 122 | + -- Adam Conrad <adconrad@ubuntu.com> Wed, 09 Oct 2019 14:10:37 -0600 |
| 123 | + |
| 124 | +open-iscsi (2.0.874-7.1ubuntu2) eoan; urgency=medium |
| 125 | + |
| 126 | + * debian/open-iscsi.kmod: drop; no static module list is needed if we let |
| 127 | + iscsid load modules itself. LP: #1833586. |
| 128 | + * debian/extra/initramfs.hook: add ib_iser to the list of modules |
| 129 | + included in the initramfs, so that we can in principle support iscsi |
| 130 | + root on infiniband. |
| 131 | + |
| 132 | + -- Steve Langasek <steve.langasek@ubuntu.com> Thu, 20 Jun 2019 13:48:46 -0700 |
| 133 | + |
| 134 | +open-iscsi (2.0.874-7.1ubuntu1) eoan; urgency=low |
| 135 | + |
| 136 | + * Merge from Debian unstable. Remaining changes: |
| 137 | + - debian/tests: Add Ubuntu autopkgtest. |
| 138 | + - debian/iscsi-network-interface.rules, debian/net-interface-handler, |
| 139 | + debian/open-iscsi.install: |
| 140 | + Prevent network interface that contains iscsi root from bouncing |
| 141 | + during boot or going down during shutdown if the system is using |
| 142 | + resolvconf or ifupdown. |
| 143 | + - Let iscsid systemd job run in privileged containers but not in |
| 144 | + unprivileged ones |
| 145 | + - Start open-iscsi systemd job when either /etc/iscsi/nodes or |
| 146 | + /sys/class/iscsi_session have content |
| 147 | + - add IPv6 support |
| 148 | + + Source /run/net6-*.conf when needed. |
| 149 | + + debian/extra/initramfs.local-top: handle IPv6 configs being |
| 150 | + shipped in DEVICE6 or /run/net6-*.conf in the initramfs, so we |
| 151 | + can fill in /run/initramfs/open-iscsi.interface |
| 152 | + - make iscsid socket-activated to only activate it as needed |
| 153 | + + debian/iscsid.socket: systemd socket file for iscsid |
| 154 | + + debian/open-iscsi.service: do not start or check iscsid.service |
| 155 | + + debian/rules: install and enable iscsid.socket |
| 156 | + + debian/patches/iscid-conf-use-systemd.socket-patch: default to the |
| 157 | + socket |
| 158 | + + debian/open-iscsi.postinst: |
| 159 | + * run restart logic only if service is running on upgrade |
| 160 | + * drop no longer reachable upgrade path that affects iscsid |
| 161 | + * disable iscsid.service on upgrade |
| 162 | + * handle iscsid.socket to be started if the service is not running |
| 163 | + yet |
| 164 | + + d/iscsi-disk.rules: Add a udev rule so that iscsid.service will be |
| 165 | + run when udev disks are attached. |
| 166 | + + d/iscsid.service: Remove ExecStop= directive. |
| 167 | + + debian/tests/install: fix tests to work with socket activation |
| 168 | + - Ship finalrd logout hook. |
| 169 | + - debian/extra/initramfs.local-top: handle iSCSI iBFT DHCP to correctly |
| 170 | + run ipconfig to gather all DHCP config info, including DNS search |
| 171 | + domain, which iBFT can't provide. |
| 172 | + - If iscsi root was requested, but no iscsi devices were mounted, remove |
| 173 | + the initramfs interfaces stamp file. Meaning, that on shutdown there |
| 174 | + is no 30s delay, whilst trying to re-establish iscsi login to perform |
| 175 | + a logout. |
| 176 | + * Dropped changes, included in Debian: |
| 177 | + - Fix fail to build from source due to undefined reference to |
| 178 | + minor |
| 179 | + * Drop breaks on never-released version of finalrd. |
| 180 | + * debian/net-interface-handler: drop upstart support, unused since bionic. |
| 181 | + * Drop cleanup of upstart jobs, no longer needed post bionic. |
| 182 | + * debian/tests/daemon: drop, unused. |
| 183 | + |
| 184 | + -- Steve Langasek <steve.langasek@ubuntu.com> Mon, 29 Apr 2019 16:13:37 -0700 |
| 185 | + |
| 186 | open-iscsi (2.0.874-7) unstable; urgency=medium |
| 187 | |
| 188 | * [eeda27c] Enable back pristine-tar as we have now committed it |
| 189 | @@ -57,6 +219,158 @@ open-iscsi (2.0.874-6) unstable; urgency=medium |
| 190 | |
| 191 | -- Ritesh Raj Sarraf <rrs@debian.org> Fri, 05 Oct 2018 11:31:19 +0530 |
| 192 | |
| 193 | +open-iscsi (2.0.874-5ubuntu15) disco; urgency=medium |
| 194 | + |
| 195 | + * d/iscsid.service: Remove ExecStop= directive. Letting systemd |
| 196 | + handle termination prevents restart failures. (LP: #1821255) |
| 197 | + |
| 198 | + -- Heitor R. Alves de Siqueira <halves@canonical.com> Thu, 28 Mar 2019 10:21:24 -0300 |
| 199 | + |
| 200 | +open-iscsi (2.0.874-5ubuntu14) disco; urgency=medium |
| 201 | + |
| 202 | + * debian/iscsi-disk.rules: Fix bug with LVM on top of iscsi devices. |
| 203 | + (LP: #1807978) |
| 204 | + |
| 205 | + -- Scott Moser <smoser@ubuntu.com> Tue, 11 Dec 2018 19:01:14 -0500 |
| 206 | + |
| 207 | +open-iscsi (2.0.874-5ubuntu13) disco; urgency=medium |
| 208 | + |
| 209 | + [ Robert C Jennings & Dimitri John Ledkov ] |
| 210 | + * If iscsi root was requested, but no iscsi devices were mounted, remove |
| 211 | + the initramfs interfaces stamp file. Meaning, that on shutdown there |
| 212 | + is no 30s delay, whilst trying to re-establish iscsi login to perform |
| 213 | + a logout. LP: #1800681 |
| 214 | + |
| 215 | + -- Dimitri John Ledkov <xnox@ubuntu.com> Sun, 09 Dec 2018 22:29:20 +0000 |
| 216 | + |
| 217 | +open-iscsi (2.0.874-5ubuntu12) disco; urgency=medium |
| 218 | + |
| 219 | + [Scott Moser] |
| 220 | + * debian/extra/initramfs.local-top: handle iSCSI iBFT DHCP to correctly |
| 221 | + run ipconfig to gather all DHCP config info, including DNS search |
| 222 | + domain, which iBFT can't provide. (LP: #1806777) |
| 223 | + |
| 224 | + -- Dan Streetman <ddstreet@canonical.com> Wed, 05 Dec 2018 11:28:12 -0500 |
| 225 | + |
| 226 | +open-iscsi (2.0.874-5ubuntu11) disco; urgency=medium |
| 227 | + |
| 228 | + * debian/tests/test-open-iscsi.py: Fix called process error. |
| 229 | + If no image was available for a release, a NameError exception would be |
| 230 | + raised. |
| 231 | + |
| 232 | + -- Scott Moser <smoser@ubuntu.com> Wed, 14 Nov 2018 16:50:29 -0500 |
| 233 | + |
| 234 | +open-iscsi (2.0.874-5ubuntu10) disco; urgency=medium |
| 235 | + |
| 236 | + * d/iscsi-disk.rules, d/tests: Add a udev rule so that iscsid.service |
| 237 | + will be run when udev disks are attached. (LP: #1802354) |
| 238 | + * debian/tests: improve tgt boot test |
| 239 | + - disable snapd and snap.seeded services to avoid unnecessary |
| 240 | + resource consumption during tests. |
| 241 | + - save artifacts from the test run. |
| 242 | + |
| 243 | + -- Scott Moser <smoser@ubuntu.com> Wed, 14 Nov 2018 16:05:46 -0500 |
| 244 | + |
| 245 | +open-iscsi (2.0.874-5ubuntu9) cosmic; urgency=medium |
| 246 | + |
| 247 | + * d/net-interface-handler: replace 'domainsearch' with the correct |
| 248 | + configuration option 'search' in net-interface-handler (LP: #1791108) |
| 249 | + |
| 250 | + -- Victor Tapia <victor.tapia@canonical.com> Mon, 17 Sep 2018 15:58:34 +0200 |
| 251 | + |
| 252 | +open-iscsi (2.0.874-5ubuntu8) cosmic; urgency=medium |
| 253 | + |
| 254 | + * d/tests: insert some debug units in an attempt to diagnose any |
| 255 | + occurences of bug 1788188. |
| 256 | + * Fix fail to build from source due to undefined reference to |
| 257 | + minor (LP: #1791154) |
| 258 | + |
| 259 | + -- Scott Moser <smoser@ubuntu.com> Tue, 21 Aug 2018 13:33:06 -0400 |
| 260 | + |
| 261 | +open-iscsi (2.0.874-5ubuntu7) cosmic; urgency=medium |
| 262 | + |
| 263 | + * d/tests: make interactive use of tgt-boot-test more usable by |
| 264 | + only using 'timeout' from the test harness. |
| 265 | + * debian/tests/README-boot-test.md: minor doc fixes and whitespace. |
| 266 | + * d/net-interface-handler: Apply changes only for the iscsi-root interface. |
| 267 | + (LP: #1785108) |
| 268 | + |
| 269 | + -- Scott Moser <smoser@ubuntu.com> Tue, 07 Aug 2018 16:37:13 -0400 |
| 270 | + |
| 271 | +open-iscsi (2.0.874-5ubuntu6) cosmic; urgency=medium |
| 272 | + |
| 273 | + * Ship finalrd logout hook. |
| 274 | + |
| 275 | + -- Dimitri John Ledkov <xnox@ubuntu.com> Fri, 03 Aug 2018 15:03:51 +0100 |
| 276 | + |
| 277 | +open-iscsi (2.0.874-5ubuntu5) cosmic; urgency=medium |
| 278 | + |
| 279 | + * Harden dep8 tests against effects due to slow execution on Launchpad |
| 280 | + infrastructure (LP: #1732028). |
| 281 | + - debian/tests/patch-image: remove problematic fstab entries |
| 282 | + - debian/tests/tgt-boot-test: ran xkvm in verbose mode |
| 283 | + |
| 284 | + -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Thu, 19 Jul 2018 18:22:39 +0200 |
| 285 | + |
| 286 | +open-iscsi (2.0.874-5ubuntu4) cosmic; urgency=medium |
| 287 | + |
| 288 | + * debian/tests/install: ignore the potential stderr of the probing command |
| 289 | + that is meant to activate iscsid indirectly via the socket. |
| 290 | + |
| 291 | + -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Wed, 30 May 2018 15:42:12 +0200 |
| 292 | + |
| 293 | +open-iscsi (2.0.874-5ubuntu3) cosmic; urgency=medium |
| 294 | + |
| 295 | + * make iscsid socket activated to only activate it as-needed (LP: #1755858) |
| 296 | + - debian/iscsid.socket: systemd socket file for iscsid |
| 297 | + - debian/open-iscsi.service: do not start or check iscsid.service |
| 298 | + - debian/rules: install and enable iscsid.socket |
| 299 | + - debian/patches/iscid-conf-use-systemd.socket-patch: default to the socket |
| 300 | + - debian/open-iscsi.postinst: |
| 301 | + + run restart logic only if service is running on upgrade |
| 302 | + + drop no more reachable upgrade path that affects iscsid |
| 303 | + + disable iscsid.service on upgrade |
| 304 | + + handle iscsid.socket to be started if the service is not running yet |
| 305 | + - debian/tests/install: fix tests to work with socket activation |
| 306 | + |
| 307 | + -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Wed, 23 May 2018 15:50:01 +0200 |
| 308 | + |
| 309 | +open-iscsi (2.0.874-5ubuntu2) bionic; urgency=medium |
| 310 | + |
| 311 | + * debian/tests: |
| 312 | + - tgt-boot-test: Use 'timeout' to force a 60m timeout of the boot test. |
| 313 | + - README-boot-test.md: document environment variables BOOT_TIMEOUT |
| 314 | + and _USE_KVM. |
| 315 | + |
| 316 | + -- Scott Moser <smoser@ubuntu.com> Wed, 21 Feb 2018 13:19:17 -0500 |
| 317 | + |
| 318 | +open-iscsi (2.0.874-5ubuntu1) bionic; urgency=low |
| 319 | + |
| 320 | + * Merge with Debian unstable. Remaining changes: |
| 321 | + - debian/tests: Add Ubuntu autopkgtests. |
| 322 | + - debian/iscsi-network-interface.rules, debian/net-interface-handler, |
| 323 | + debian/open-iscsi.install: |
| 324 | + Prevent network interface that contains iscsi root from bouncing |
| 325 | + during boot or going down during shutdown. |
| 326 | + Integrates with resolvconf and initramfs code that writes |
| 327 | + /run/initramfs/open-iscsi.interface |
| 328 | + - debian/open-iscsi.maintscript: clean up the obsolete |
| 329 | + iscsi-network-interface upstart job, file on upgrade. |
| 330 | + - Let iscsid systemd job run in privileged containers but not in |
| 331 | + unprivileged ones |
| 332 | + - Start open-iscsi systemd job when either /etc/iscsi/nodes or |
| 333 | + /sys/class/iscsi_session have content |
| 334 | + Based on patch by Nish Aravamudan, thanks! (LP #1576341) |
| 335 | + - add IPv6 support |
| 336 | + + add support for IPV6{DOMAINSEARCH,DNS0,DNS1} to net-interface-handler |
| 337 | + LP #1621507 |
| 338 | + + Source /run/net6-*.conf when needed. |
| 339 | + + debian/extra/initramfs.local-top: handle IPv6 configs being |
| 340 | + shipped in DEVICE6 or /run/net6-*.conf in the initramfs, so we |
| 341 | + can fill in /run/initramfs/open-iscsi.interface (LP #1621507) |
| 342 | + |
| 343 | + -- Dimitri John Ledkov <xnox@ubuntu.com> Fri, 12 Jan 2018 14:00:59 +0000 |
| 344 | + |
| 345 | open-iscsi (2.0.874-5) unstable; urgency=high |
| 346 | |
| 347 | * [aeb86f7] Fix multiple security issues in iscsiuio. (CVE-2017-17840) |
| 348 | @@ -64,6 +378,74 @@ open-iscsi (2.0.874-5) unstable; urgency=high |
| 349 | |
| 350 | -- Christian Seiler <christian@iwakd.de> Sat, 23 Dec 2017 11:30:44 +0100 |
| 351 | |
| 352 | +open-iscsi (2.0.874-4ubuntu5) bionic; urgency=medium |
| 353 | + |
| 354 | + * debian/tests/patch-image: mount auxilary filesystems before upgrading |
| 355 | + packages. Fixes ADT tests, when triggered by packages, that need |
| 356 | + /proc, /dev, etc mounted to complete the upgrade. |
| 357 | + |
| 358 | + -- Dimitri John Ledkov <xnox@ubuntu.com> Wed, 03 Jan 2018 12:21:05 +0000 |
| 359 | + |
| 360 | +open-iscsi (2.0.874-4ubuntu4) bionic; urgency=medium |
| 361 | + |
| 362 | + * debian/tests/test-open-iscsi.py: skip test if cloud image is unavailable. |
| 363 | + This solves flaky tests in restricted network environments as well as in |
| 364 | + the short period after opening a new release (LP: #1731907). |
| 365 | + |
| 366 | + -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Thu, 16 Nov 2017 12:06:34 +0100 |
| 367 | + |
| 368 | +open-iscsi (2.0.874-4ubuntu3) artful; urgency=medium |
| 369 | + |
| 370 | + * debian/tests/xkvm: do not use kvm (-enable-kvm) by default if |
| 371 | + operating inside a vm. nested kvm is finicky. |
| 372 | + |
| 373 | + -- Scott Moser <smoser@ubuntu.com> Wed, 11 Oct 2017 18:14:08 -0400 |
| 374 | + |
| 375 | +open-iscsi (2.0.874-4ubuntu2) artful; urgency=medium |
| 376 | + |
| 377 | + * debian/tests/test-open-iscsi.py: query systemd-resolved if present. |
| 378 | + Ubuntu images now have systemd-resolved managing /etc/resolv.conf |
| 379 | + so support test if that is the case (LP: #1715468). |
| 380 | + |
| 381 | + -- Scott Moser <smoser@ubuntu.com> Wed, 06 Sep 2017 16:20:16 -0400 |
| 382 | + |
| 383 | +open-iscsi (2.0.874-4ubuntu1) artful; urgency=medium |
| 384 | + |
| 385 | + * Merge with Debian unstable. Remaining changes: |
| 386 | + - debian/tests: Add Ubuntu autopkgtests. |
| 387 | + - debian/iscsi-network-interface.rules, debian/net-interface-handler, |
| 388 | + debian/open-iscsi.install: |
| 389 | + Prevent network interface that contains iscsi root from bouncing |
| 390 | + during boot or going down during shutdown. |
| 391 | + Integrates with resolvconf and initramfs code that writes |
| 392 | + /run/initramfs/open-iscsi.interface |
| 393 | + - debian/open-iscsi.maintscript: clean up the obsolete |
| 394 | + iscsi-network-interface upstart job, file on upgrade. |
| 395 | + - Let iscsid systemd job run in privileged containers but not in |
| 396 | + unprivileged ones |
| 397 | + - Start open-iscsi systemd job when either /etc/iscsi/nodes or |
| 398 | + /sys/class/iscsi_session have content |
| 399 | + Based on patch by Nish Aravamudan, thanks! (LP #1576341) |
| 400 | + - add IPv6 support |
| 401 | + + add support for IPV6{DOMAINSEARCH,DNS0,DNS1} to net-interface-handler |
| 402 | + LP #1621507 |
| 403 | + + Source /run/net6-*.conf when needed. |
| 404 | + + debian/extra/initramfs.local-top: handle IPv6 configs being |
| 405 | + shipped in DEVICE6 or /run/net6-*.conf in the initramfs, so we |
| 406 | + can fill in /run/initramfs/open-iscsi.interface (LP #1621507) |
| 407 | + * Drop: |
| 408 | + - d/extra/initramfs.local-top: When booting from iBFT, |
| 409 | + set the PROTO= entry in /run/net-*.conf accordingly, |
| 410 | + so that other tools, such as cloud-init, can use that |
| 411 | + information. (cloud-init fails if the current PROTO=none |
| 412 | + is used.) (LP: #1684039) (Closes: #866213) |
| 413 | + [ Fixed in Debian 2.0.874-4 ] |
| 414 | + * d/t/test-open-iscsi.py: drop test_daemon test |
| 415 | + - With the updates to the systemd units, the services do not run |
| 416 | + unless iSCSI is configured. |
| 417 | + |
| 418 | + -- Nishanth Aravamudan <nish.aravamudan@canonical.com> Tue, 08 Aug 2017 16:16:27 -0700 |
| 419 | + |
| 420 | open-iscsi (2.0.874-4) unstable; urgency=medium |
| 421 | |
| 422 | * [0347300] initramfs: populate PROTO= entry in /run/net-*.conf from iBFT |
| 423 | @@ -78,6 +460,64 @@ open-iscsi (2.0.874-3) unstable; urgency=medium |
| 424 | |
| 425 | -- Christian Seiler <christian@iwakd.de> Sun, 18 Jun 2017 22:01:22 +0200 |
| 426 | |
| 427 | +open-iscsi (2.0.874-2ubuntu3) artful; urgency=medium |
| 428 | + |
| 429 | + * d/t/test-open-iscsi.py: drop test_daemon test |
| 430 | + - With the updates to the systemd units, the services do not run |
| 431 | + unless iSCSI is configured. |
| 432 | + |
| 433 | + -- Nishanth Aravamudan <nish.aravamudan@canonical.com> Tue, 08 Aug 2017 16:05:29 -0700 |
| 434 | + |
| 435 | +open-iscsi (2.0.874-2ubuntu2) artful; urgency=medium |
| 436 | + |
| 437 | + * d/extra/initramfs.local-top: When booting from iBFT, |
| 438 | + set the PROTO= entry in /run/net-*.conf accordingly, |
| 439 | + so that other tools, such as cloud-init, can use that |
| 440 | + information. (cloud-init fails if the current PROTO=none |
| 441 | + is used.) (LP: #1684039) (Closes: #866213) |
| 442 | + |
| 443 | + -- Eric Desrochers <eric.desrochers@canonical.com> Wed, 05 Jul 2017 09:02:12 -0400 |
| 444 | + |
| 445 | +open-iscsi (2.0.874-2ubuntu1) artful; urgency=medium |
| 446 | + |
| 447 | + [ Nishanth Aravamudan ] |
| 448 | + * Merge with Debian unstable. Remaining changes: |
| 449 | + - debian/tests: Add Ubuntu autopkgtests. |
| 450 | + - debian/iscsi-network-interface.rules, debian/net-interface-handler, |
| 451 | + debian/open-iscsi.install: |
| 452 | + Prevent network interface that contains iscsi root from bouncing |
| 453 | + during boot or going down during shutdown. |
| 454 | + Integrates with resolvconf and initramfs code that writes |
| 455 | + /run/initramfs/open-iscsi.interface |
| 456 | + - debian/open-iscsi.maintscript: clean up the obsolete |
| 457 | + iscsi-network-interface upstart job, file on upgrade. |
| 458 | + - add IPv6 support |
| 459 | + + add support for IPV6{DOMAINSEARCH,DNS0,DNS1} to net-interface-handler |
| 460 | + LP #1621507 |
| 461 | + + Source /run/net6-*.conf when needed. |
| 462 | + + debian/extra/initramfs.local-top: handle IPv6 configs being |
| 463 | + shipped in DEVICE6 or /run/net6-*.conf in the initramfs, so we |
| 464 | + can fill in /run/initramfs/open-iscsi.interface (LP #1621507) |
| 465 | + * Drop: |
| 466 | + - Make systemd job not run in containers (LP #1576341) |
| 467 | + [ This prevents running iscsi in privileged containers. |
| 468 | + Fixed differently in this upload. ] |
| 469 | + - Cherry-pick from Debian git repository (Christian Seiler): |
| 470 | + + open-iscsi-udeb: drop Depends: libnss-files-udeb |
| 471 | + (Closes #819685) |
| 472 | + [ Fixed in Debian ] |
| 473 | + - d/extra/initramfs.local-top whitespace change |
| 474 | + [ previously undocumented ] |
| 475 | + |
| 476 | + [ Balint Reczey ] |
| 477 | + * Let iscsid systemd job run in privileged containers but not in |
| 478 | + unprivileged ones |
| 479 | + * Start open-iscsi systemd job when either /etc/iscsi/nodes or |
| 480 | + /sys/class/iscsi_session have content |
| 481 | + Based on patch by Nish Aravamudan, thanks! (LP #1576341) |
| 482 | + |
| 483 | + -- Nishanth Aravamudan <nish.aravamudan@canonical.com> Tue, 09 May 2017 09:24:23 -0700 |
| 484 | + |
| 485 | open-iscsi (2.0.874-2) unstable; urgency=medium |
| 486 | |
| 487 | [ Christian Seiler ] |
| 488 | @@ -217,6 +657,155 @@ open-iscsi (2.0.873+git0.3b4b4500-15) unstable; urgency=medium |
| 489 | |
| 490 | -- Christian Seiler <christian@iwakd.de> Fri, 20 May 2016 09:52:46 +0200 |
| 491 | |
| 492 | +open-iscsi (2.0.873+git0.3b4b4500-14ubuntu17) zesty; urgency=medium |
| 493 | + |
| 494 | + * debian/tests: |
| 495 | + - README-boot-test.md: mention limited space caveat. |
| 496 | + - patch-image: fix handling of ADT_TEST_TRIGGERS if source package |
| 497 | + built more than one binary package. |
| 498 | + - test-open-iscsi.py: change to rely on patch-image |
| 499 | + adding package 'open-iscsi' rather than passing it in itself. |
| 500 | + |
| 501 | + -- Scott Moser <smoser@ubuntu.com> Thu, 16 Feb 2017 15:47:58 -0500 |
| 502 | + |
| 503 | +open-iscsi (2.0.873+git0.3b4b4500-14ubuntu16) zesty; urgency=medium |
| 504 | + |
| 505 | + * debian/tests: many improvements to the open-iscsi and tgt boot test. |
| 506 | + - only run test on amd64. just avoid timeout errors or other unrelated |
| 507 | + issues causing failure. |
| 508 | + - debian/tests/README-boot-test.md: add doc describing the tgt-boot-test |
| 509 | + - rename get-maas-eph to get-image |
| 510 | + - use a cloud image instead of a maas image for booting. The value in |
| 511 | + this is that we can then install open-iscsi inside the image and get an |
| 512 | + updated initramfs. |
| 513 | + - use subprocess.check_call rather than subprocess.call so that we |
| 514 | + actually catch errors. |
| 515 | + - update xkvm to what is in curtin/tools/xkvm |
| 516 | + - improve updating of images to consider ADT_TEST_TRIGGERS if set. |
| 517 | + |
| 518 | + -- Scott Moser <smoser@ubuntu.com> Tue, 14 Feb 2017 17:07:00 -0500 |
| 519 | + |
| 520 | +open-iscsi (2.0.873+git0.3b4b4500-14ubuntu15) zesty; urgency=medium |
| 521 | + |
| 522 | + * debian/tests/tgt-boot-test: set HOST_IP harder for the testsuite test. |
| 523 | + |
| 524 | + -- Mathieu Trudel-Lapierre <cyphermox@ubuntu.com> Sun, 29 Jan 2017 13:05:47 -0500 |
| 525 | + |
| 526 | +open-iscsi (2.0.873+git0.3b4b4500-14ubuntu14) zesty; urgency=medium |
| 527 | + |
| 528 | + * Make systemd job not run in containers (LP: #1576341) |
| 529 | + |
| 530 | + -- Serge Hallyn <serge.hallyn@ubuntu.com> Sun, 15 Jan 2017 23:08:29 -0600 |
| 531 | + |
| 532 | +open-iscsi (2.0.873+git0.3b4b4500-14ubuntu13) zesty; urgency=medium |
| 533 | + |
| 534 | + * Fix syntax error in previous changes. LP: #1621507 |
| 535 | + |
| 536 | + -- LaMont Jones <lamont@ubuntu.com> Fri, 09 Dec 2016 12:35:45 +0100 |
| 537 | + |
| 538 | +open-iscsi (2.0.873+git0.3b4b4500-14ubuntu12) zesty; urgency=medium |
| 539 | + |
| 540 | + * debian/tests/tgt-boot-test: set HOST_IP to 10.0.2.2; it's suboptimal but |
| 541 | + given the test setup this will allow the right IPs to be used to bring up |
| 542 | + the iscsi target in the xkvm. |
| 543 | + |
| 544 | + -- Mathieu Trudel-Lapierre <cyphermox@ubuntu.com> Thu, 08 Dec 2016 11:00:12 +0100 |
| 545 | + |
| 546 | +open-iscsi (2.0.873+git0.3b4b4500-14ubuntu11) zesty; urgency=medium |
| 547 | + |
| 548 | + * debian/tests/tgt-boot-test: drop -serial stdio altogether since running |
| 549 | + the VM in -nographics mode will already output to stdout. |
| 550 | + |
| 551 | + -- Mathieu Trudel-Lapierre <cyphermox@ubuntu.com> Tue, 22 Nov 2016 11:27:55 -0500 |
| 552 | + |
| 553 | +open-iscsi (2.0.873+git0.3b4b4500-14ubuntu10) zesty; urgency=medium |
| 554 | + |
| 555 | + * debian/tests/tgt-boot-test: always log qemu serial to stdio so we can |
| 556 | + actually see what is going on during the tests. |
| 557 | + |
| 558 | + -- Mathieu Trudel-Lapierre <cyphermox@ubuntu.com> Thu, 17 Nov 2016 11:01:27 -0500 |
| 559 | + |
| 560 | +open-iscsi (2.0.873+git0.3b4b4500-14ubuntu9) zesty; urgency=medium |
| 561 | + |
| 562 | + [ LaMont Jones ] |
| 563 | + * Clean up net-interface-handler |
| 564 | + * Source /run/net6-*.conf when needed. |
| 565 | + |
| 566 | + [ Mathieu Trudel-Lapierre ] |
| 567 | + * debian/extra/initramfs.local-top: handle IPv6 configs being shipped in |
| 568 | + DEVICE6 or /run/net6-*.conf in the initramfs, so we can fill in |
| 569 | + /run/initramfs/open-iscsi.interface (LP: #1621507) |
| 570 | + |
| 571 | + -- Mathieu Trudel-Lapierre <cyphermox@ubuntu.com> Thu, 03 Nov 2016 16:30:37 -0600 |
| 572 | + |
| 573 | +open-iscsi (2.0.873+git0.3b4b4500-14ubuntu8) yakkety; urgency=medium |
| 574 | + |
| 575 | + * debian/tests/xkvm: don't --enable-kvm. |
| 576 | + |
| 577 | + -- Mathieu Trudel-Lapierre <cyphermox@ubuntu.com> Wed, 05 Oct 2016 12:58:21 -0400 |
| 578 | + |
| 579 | +open-iscsi (2.0.873+git0.3b4b4500-14ubuntu7) yakkety; urgency=medium |
| 580 | + |
| 581 | + * debian/tests/test-open-iscsi.py: glob to pick up open-iscsi.deb, which may |
| 582 | + be named differently depending on how autopkgtests are run. |
| 583 | + |
| 584 | + -- Mathieu Trudel-Lapierre <cyphermox@ubuntu.com> Wed, 05 Oct 2016 09:56:25 -0400 |
| 585 | + |
| 586 | +open-iscsi (2.0.873+git0.3b4b4500-14ubuntu6) yakkety; urgency=medium |
| 587 | + |
| 588 | + * debian/tests/test-open-iscsi.py: install the open-iscsi binary into a test |
| 589 | + MAAS image, so we can check bootability. Download the open-iscsi explicitly |
| 590 | + to /tmp before trying to copy it; so that we don't need to depend on ugly |
| 591 | + internal autopkgtest paths. |
| 592 | + |
| 593 | + -- Mathieu Trudel-Lapierre <cyphermox@ubuntu.com> Tue, 04 Oct 2016 09:05:56 -0400 |
| 594 | + |
| 595 | +open-iscsi (2.0.873+git0.3b4b4500-14ubuntu5) yakkety; urgency=medium |
| 596 | + |
| 597 | + * debian/tests/control: add build-needed since some of the new tests |
| 598 | + appear to require that (so they can reach open-iscsi.deb which is a build |
| 599 | + artifact from building in autopkgtest). |
| 600 | + |
| 601 | + -- Mathieu Trudel-Lapierre <cyphermox@ubuntu.com> Mon, 03 Oct 2016 16:10:54 -0400 |
| 602 | + |
| 603 | +open-iscsi (2.0.873+git0.3b4b4500-14ubuntu4) yakkety; urgency=medium |
| 604 | + |
| 605 | + * add support for IPV6{DOMAINSEARCH,DNS0,DNS1} to net-interface-handler |
| 606 | + LP: #1621507 |
| 607 | + |
| 608 | + -- LaMont Jones <lamont@canonical.com> Tue, 20 Sep 2016 08:05:41 -0600 |
| 609 | + |
| 610 | +open-iscsi (2.0.873+git0.3b4b4500-14ubuntu3) xenial; urgency=medium |
| 611 | + |
| 612 | + * Cherry-pick from Debian git repository (Christian Seiler): |
| 613 | + - open-iscsi-udeb: drop Depends: libnss-files-udeb (Closes: #819685) |
| 614 | + |
| 615 | + -- Colin Watson <cjwatson@ubuntu.com> Fri, 15 Apr 2016 16:54:26 +0100 |
| 616 | + |
| 617 | +open-iscsi (2.0.873+git0.3b4b4500-14ubuntu2) xenial; urgency=medium |
| 618 | + |
| 619 | + * debian/tests: add two new tests. One to verify net-interface-handler is |
| 620 | + installed executable, and one to actually test that /etc/resolv.conf is |
| 621 | + updated with dhcp dns responses. |
| 622 | + |
| 623 | + -- Diogo Matsubara <diogo.matsubara@gmail.com> Wed, 09 Mar 2016 12:56:42 -0300 |
| 624 | + |
| 625 | +open-iscsi (2.0.873+git0.3b4b4500-14ubuntu1) xenial; urgency=medium |
| 626 | + |
| 627 | + * Merge from debian. Remaining changes: |
| 628 | + - debian/tests: Add Ubuntu autopkgtest. |
| 629 | + - debian/iscsi-network-interface.rules, debian/net-interface-handler, |
| 630 | + debian/open-iscsi.install: |
| 631 | + Prevent network interface that contains iscsi root from bouncing |
| 632 | + during boot or going down during shutdown. |
| 633 | + Integrates with resolvconf and initramfs code that writes |
| 634 | + /run/initramfs/open-iscsi.interface |
| 635 | + - debian/open-iscsi.maintscript: clean up the obsolete |
| 636 | + iscsi-network-interface upstart job, file on upgrade. |
| 637 | + * make debian/net-interface-handler executable (LP: #1553017) |
| 638 | + |
| 639 | + -- Scott Moser <smoser@ubuntu.com> Fri, 04 Mar 2016 13:17:45 -0500 |
| 640 | + |
| 641 | open-iscsi (2.0.873+git0.3b4b4500-14) unstable; urgency=medium |
| 642 | |
| 643 | [ Christian Seiler ] |
| 644 | @@ -229,6 +818,21 @@ open-iscsi (2.0.873+git0.3b4b4500-14) unstable; urgency=medium |
| 645 | |
| 646 | -- Christian Seiler <christian@iwakd.de> Thu, 03 Mar 2016 18:47:46 +0100 |
| 647 | |
| 648 | +open-iscsi (2.0.873+git0.3b4b4500-13ubuntu1) xenial; urgency=medium |
| 649 | + |
| 650 | + * Merge from Debian (LP: #1546877). Remaining changes: |
| 651 | + - debian/tests: Add Ubuntu autopkgtest. |
| 652 | + - debian/iscsi-network-interface.rules, debian/net-interface-handler, |
| 653 | + debian/open-iscsi.install: |
| 654 | + Prevent network interface that contains iscsi root from bouncing |
| 655 | + during boot or going down during shutdown. |
| 656 | + Integrates with resolvconf and initramfs code that writes |
| 657 | + /run/initramfs/open-iscsi.interface |
| 658 | + - debian/open-iscsi.maintscript: clean up the obsolete |
| 659 | + iscsi-network-interface upstart job, file on upgrade. |
| 660 | + |
| 661 | + -- Scott Moser <smoser@ubuntu.com> Thu, 18 Feb 2016 00:53:37 -0500 |
| 662 | + |
| 663 | open-iscsi (2.0.873+git0.3b4b4500-13) unstable; urgency=medium |
| 664 | |
| 665 | [ Christian Seiler ] |
| 666 | @@ -450,6 +1054,115 @@ open-iscsi (2.0.873+git0.3b4b4500-1) unstable; urgency=low |
| 667 | |
| 668 | -- Ritesh Raj Sarraf <rrs@debian.org> Tue, 05 Nov 2013 21:45:47 +0530 |
| 669 | |
| 670 | +open-iscsi (2.0.873-3ubuntu13) wily; urgency=medium |
| 671 | + |
| 672 | + * debian/net-interface-handler: Create the resolvconf dir, to avoid failure |
| 673 | + when resolvconf did not start yet; the udev rules run in parallel with |
| 674 | + it. (LP: #1501033) |
| 675 | + |
| 676 | + -- Martin Pitt <martin.pitt@ubuntu.com> Tue, 06 Oct 2015 07:05:48 +0200 |
| 677 | + |
| 678 | +open-iscsi (2.0.873-3ubuntu12) wily; urgency=medium |
| 679 | + |
| 680 | + * Drop debian/ifup@.service.conf again, it ceased to work with net.agent in |
| 681 | + wily and the whole idea of net-interface-handler is to *stop* ifupdown |
| 682 | + from fiddling with the iscsi interface. Replace with udev rules |
| 683 | + (debian/iscsi-network-interface.rules) which achieves this without relying |
| 684 | + on ifupdown or a particular init system. (LP: #1463461) |
| 685 | + * Drop debian/open-iscsi.iscsi-network-interface.upstart as well, obsolete |
| 686 | + now. Also clean it up on upgrades. |
| 687 | + |
| 688 | + -- Martin Pitt <martin.pitt@ubuntu.com> Thu, 11 Jun 2015 11:58:29 +0200 |
| 689 | + |
| 690 | +open-iscsi (2.0.873-3ubuntu11) vivid; urgency=medium |
| 691 | + |
| 692 | + * Factor out logic from debian/open-iscsi.iscsi-network-interface.upstart |
| 693 | + into debian/net-interface-handler, and install the latter in debian/rules. |
| 694 | + * Add debian/ifup@.service.conf: Drop-in for ifup@.service to run |
| 695 | + net-interface-handler under systemd. (LP: #1432829) |
| 696 | + |
| 697 | + -- Martin Pitt <martin.pitt@ubuntu.com> Fri, 27 Mar 2015 09:51:05 +0100 |
| 698 | + |
| 699 | +open-iscsi (2.0.873-3ubuntu10) vivid; urgency=medium |
| 700 | + |
| 701 | + * Start open-iscsi after installation and make sure initiatorname is |
| 702 | + generated. (Patch backported from Debian) |
| 703 | + * debian/tests/daemon: Stop calling the init.d script as we expect the |
| 704 | + daemon to start automatically now. |
| 705 | + |
| 706 | + -- Martin Pitt <martin.pitt@ubuntu.com> Fri, 06 Mar 2015 13:17:26 +0100 |
| 707 | + |
| 708 | +open-iscsi (2.0.873-3ubuntu9) trusty; urgency=medium |
| 709 | + |
| 710 | + * Add missing python test dependency. |
| 711 | + |
| 712 | + -- Martin Pitt <martin.pitt@ubuntu.com> Wed, 26 Feb 2014 16:07:37 +0100 |
| 713 | + |
| 714 | +open-iscsi (2.0.873-3ubuntu8) trusty; urgency=medium |
| 715 | + |
| 716 | + * open-iscsi-udeb: Enable builds on armhf, arm64, ppc64el, x32 (LP: #1274203) |
| 717 | + |
| 718 | + -- dann frazier <dann.frazier@canonical.com> Wed, 29 Jan 2014 12:34:45 -0700 |
| 719 | + |
| 720 | +open-iscsi (2.0.873-3ubuntu7) saucy; urgency=low |
| 721 | + |
| 722 | + * Use dh_autotools-dev to update config.sub|guess. |
| 723 | + |
| 724 | + -- Dmitrijs Ledkovs <dmitrij.ledkov@ubuntu.com> Fri, 11 Oct 2013 17:03:37 +0100 |
| 725 | + |
| 726 | +open-iscsi (2.0.873-3ubuntu6) saucy; urgency=low |
| 727 | + |
| 728 | + * debian/tests: Add autopkgtest. |
| 729 | + |
| 730 | + -- Yolanda <yolanda.robla@canonical.com> Mon, 27 May 2013 10:39:35 +0200 |
| 731 | + |
| 732 | +open-iscsi (2.0.873-3ubuntu5) quantal-proposed; urgency=low |
| 733 | + |
| 734 | + * Ensure all udev events have been processed before trying to configure |
| 735 | + iscsi networking in the initramfs (LP: #1066945): |
| 736 | + - debian/extra/initramfs.local-top: Restore wait_for_udev call before |
| 737 | + configure_networking to ensure network devices are present. |
| 738 | + |
| 739 | + -- James Page <james.page@ubuntu.com> Wed, 17 Oct 2012 12:37:43 +0100 |
| 740 | + |
| 741 | +open-iscsi (2.0.873-3ubuntu4) quantal-proposed; urgency=low |
| 742 | + |
| 743 | + * Generate initiator name on install, not first boot, ensuring that the |
| 744 | + initramfs built during install contains a valid iSCSI initiator name |
| 745 | + resulting in a iSCSI based root volume that will actually boot |
| 746 | + (LP: #1057635): |
| 747 | + - debian/{rules,initiatorname.iscsi}: Don't install a default |
| 748 | + initiatorname.iscsi. |
| 749 | + - debian/open-iscsi.postinst: Generate initiatorname.iscsi on install. |
| 750 | + |
| 751 | + -- James Page <james.page@ubuntu.com> Mon, 15 Oct 2012 12:42:53 +0100 |
| 752 | + |
| 753 | +open-iscsi (2.0.873-3ubuntu3) quantal; urgency=low |
| 754 | + |
| 755 | + * debian/open-iscsi.iscsi-network-interface.upstart: fix bad syntax |
| 756 | + in 'post-stop' |
| 757 | + |
| 758 | + -- Scott Moser <smoser@ubuntu.com> Mon, 17 Sep 2012 16:50:22 -0400 |
| 759 | + |
| 760 | +open-iscsi (2.0.873-3ubuntu2) quantal; urgency=low |
| 761 | + |
| 762 | + * debian/extra/initramfs.local-top: start writing |
| 763 | + /run/initramfs/open-iscsi.interface file again (LP: #1050480) |
| 764 | + * debian/open-iscsi.iscsi-network-interface.upstart: integrate with |
| 765 | + resolvconf (LP: #1050487) |
| 766 | + |
| 767 | + -- Scott Moser <smoser@ubuntu.com> Mon, 17 Sep 2012 15:46:26 -0400 |
| 768 | + |
| 769 | +open-iscsi (2.0.873-3ubuntu1) quantal; urgency=low |
| 770 | + |
| 771 | + * Merge from Debian. Remaining changes: (LP: #961114, LP: #677333) |
| 772 | + - Add upstart job iscsi-network-interface |
| 773 | + - Migrate from /var/run and /lib/init/rw to /run, from /var/lock to |
| 774 | + /run/lock. |
| 775 | + * Turn open-iscsi-utils into a transitional package |
| 776 | + |
| 777 | + -- Stéphane Graber <stgraber@ubuntu.com> Tue, 10 Jul 2012 13:53:52 -0400 |
| 778 | + |
| 779 | open-iscsi (2.0.873-3) unstable; urgency=low |
| 780 | |
| 781 | * [4939401] Fix build to install udeb stuff only on supported architectures |
| 782 | @@ -624,6 +1337,239 @@ open-iscsi (2.0.871-1) unstable; urgency=low |
| 783 | |
| 784 | -- Ritesh Raj Sarraf <rrs@researchut.com> Sat, 06 Feb 2010 20:28:23 +0530 |
| 785 | |
| 786 | +open-iscsi (2.0.871-0ubuntu9) oneiric-proposed; urgency=low |
| 787 | + |
| 788 | + * Make sure the upstart job triggers ifupdown's upstart script to avoid |
| 789 | + waiting 2 minutes at boot time for network to come up. (LP: #870214) |
| 790 | + |
| 791 | + -- Stéphane Graber <stgraber@ubuntu.com> Tue, 11 Oct 2011 22:31:39 +0100 |
| 792 | + |
| 793 | +open-iscsi (2.0.871-0ubuntu8) oneiric; urgency=low |
| 794 | + |
| 795 | + * Disable open-iscsi init script when root is on iscsi (LP: #838809) |
| 796 | + |
| 797 | + -- Stéphane Graber <stgraber@ubuntu.com> Thu, 15 Sep 2011 10:01:12 -0400 |
| 798 | + |
| 799 | +open-iscsi (2.0.871-0ubuntu7) oneiric; urgency=low |
| 800 | + |
| 801 | + * Migrate from /var/run and /lib/init/rw to /run, from /var/lock to |
| 802 | + /run/lock, and from /dev/.initramfs to /run/initramfs. |
| 803 | + |
| 804 | + -- Colin Watson <cjwatson@ubuntu.com> Thu, 14 Jul 2011 17:01:42 +0100 |
| 805 | + |
| 806 | +open-iscsi (2.0.871-0ubuntu6) oneiric; urgency=low |
| 807 | + |
| 808 | + * Fix initramfs iSCSI login (many thanks to Amos Hayes for lending me a |
| 809 | + test system; LP: #728088): |
| 810 | + - Write out /dev/.initramfs/open-iscsi.interface in the same subshell as |
| 811 | + configure_networking, so that we can get at the value of DEVICE. |
| 812 | + - Wait for udev to settle before attempting to configure networking. |
| 813 | + |
| 814 | + -- Colin Watson <cjwatson@ubuntu.com> Fri, 27 May 2011 23:27:31 +0100 |
| 815 | + |
| 816 | +open-iscsi (2.0.871-0ubuntu5) maverick; urgency=low |
| 817 | + |
| 818 | + * Include <sys/types.h> and <sys/stat.h> in usr/iscsi_sysfs.c for S_* |
| 819 | + macros (LP: #600953). |
| 820 | + |
| 821 | + -- Colin Watson <cjwatson@ubuntu.com> Fri, 02 Jul 2010 17:08:14 +0100 |
| 822 | + |
| 823 | +open-iscsi (2.0.871-0ubuntu4) lucid; urgency=low |
| 824 | + |
| 825 | + * Revert ISCSI_NETDEVICE change; it's normally better to select the |
| 826 | + interface by MAC address (LP: #473036). |
| 827 | + |
| 828 | + -- Colin Watson <cjwatson@ubuntu.com> Fri, 05 Feb 2010 12:06:06 -0800 |
| 829 | + |
| 830 | +open-iscsi (2.0.871-0ubuntu3) lucid; urgency=low |
| 831 | + |
| 832 | + * If ISCSI_NETDEVICE is set, configure that interface in the initramfs |
| 833 | + (LP: #473036). |
| 834 | + |
| 835 | + -- Colin Watson <cjwatson@ubuntu.com> Fri, 22 Jan 2010 17:01:17 +0000 |
| 836 | + |
| 837 | +open-iscsi (2.0.871-0ubuntu2) lucid; urgency=low |
| 838 | + |
| 839 | + * Fix handling of ISCSI_USERNAME, ISCSI_PASSWORD, ISCSI_IN_USERNAME, and |
| 840 | + ISCSI_IN_PASSWORD in iscsi.initramfs (closes: #525053). |
| 841 | + |
| 842 | + -- Colin Watson <cjwatson@ubuntu.com> Mon, 14 Dec 2009 12:24:42 +0000 |
| 843 | + |
| 844 | +open-iscsi (2.0.871-0ubuntu1) lucid; urgency=low |
| 845 | + |
| 846 | + * New upstream release. |
| 847 | + * If the root filesystem is on iSCSI, prevent the network interface used |
| 848 | + for it from being brought up or down automatically (LP: #457767). |
| 849 | + * Backport from upstream: |
| 850 | + - Allow updating of discovery records (Hannes Reinecke). |
| 851 | + - Fix discovery record use, rather than always using iscsid.conf |
| 852 | + settings (Mike Christie). |
| 853 | + |
| 854 | + -- Colin Watson <cjwatson@ubuntu.com> Thu, 10 Dec 2009 18:19:20 +0000 |
| 855 | + |
| 856 | +open-iscsi (2.0.870.1-0ubuntu12) karmic; urgency=low |
| 857 | + |
| 858 | + * debian/open-iscsi-udeb.finish-install: Stop checking |
| 859 | + disk-detect/iscsi/enable, as that template doesn't exist any more. |
| 860 | + |
| 861 | + -- Colin Watson <cjwatson@ubuntu.com> Fri, 02 Oct 2009 18:49:18 +0100 |
| 862 | + |
| 863 | +open-iscsi (2.0.870.1-0ubuntu11) karmic; urgency=low |
| 864 | + |
| 865 | + * open-iscsi-utils Replaces: old versions of open-iscsi. |
| 866 | + * SECURITY UPDATE: temporary file vulnerability (LP: #408915) |
| 867 | + - utils/iscsi_discovery: store iscsiadm -m discovery result in a |
| 868 | + variable rather than writing it to an insecurely-created temporary |
| 869 | + file |
| 870 | + - CVE-2009-1297 |
| 871 | + |
| 872 | + -- Colin Watson <cjwatson@ubuntu.com> Mon, 24 Aug 2009 23:42:10 +0100 |
| 873 | + |
| 874 | +open-iscsi (2.0.870.1-0ubuntu10) karmic; urgency=low |
| 875 | + |
| 876 | + * debian/control, debian/open-iscsi-utils.install, |
| 877 | + open-iscsi-utils.manpages : create a new binary package which |
| 878 | + contains /sbin/iscsiadm, needed for some packages to build against |
| 879 | + (eg, libvirt), but not containing the init script, LP: #414986 |
| 880 | + |
| 881 | + -- Dustin Kirkland <kirkland@ubuntu.com> Tue, 18 Aug 2009 08:11:34 -0500 |
| 882 | + |
| 883 | +open-iscsi (2.0.870.1-0ubuntu9) karmic; urgency=low |
| 884 | + |
| 885 | + * debian/open-iscsi.init: don't exit with error if |
| 886 | + /lib/init/rw/sendsigs.omit.d/ doesn't exist (LP: #414986) |
| 887 | + |
| 888 | + -- Jamie Strandboge <jamie@ubuntu.com> Mon, 17 Aug 2009 14:12:01 -0500 |
| 889 | + |
| 890 | +open-iscsi (2.0.870.1-0ubuntu8) karmic; urgency=low |
| 891 | + |
| 892 | + * Make sure network devices are always included in the initramfs if |
| 893 | + booting with / on iSCSI. |
| 894 | + * Retry initramfs network configuration for a while until it works (LP: |
| 895 | + #237460). |
| 896 | + |
| 897 | + -- Colin Watson <cjwatson@ubuntu.com> Tue, 11 Aug 2009 13:05:43 +0100 |
| 898 | + |
| 899 | +open-iscsi (2.0.870.1-0ubuntu7) karmic; urgency=low |
| 900 | + |
| 901 | + [ Colin Watson ] |
| 902 | + * debian/open-iscsi-udeb.postinst, debian/open-iscsi-udeb.templates: |
| 903 | + Remove; this is being taken over by disk-detect and partman-iscsi. |
| 904 | + * debian/control: Remove XB-Installer-Menu-Item. |
| 905 | + |
| 906 | + [ Mathias Gug ] |
| 907 | + * debian/open-iscsi.postinst: Fix backwards use of update-rc.d (LP: |
| 908 | + #306678). |
| 909 | + * debian/open-iscsi.init: Overwrite existing pid file symlinks in |
| 910 | + /lib/init/rw/sendsigs.omit.d/. |
| 911 | + |
| 912 | + -- Colin Watson <cjwatson@ubuntu.com> Mon, 10 Aug 2009 13:28:41 +0100 |
| 913 | + |
| 914 | +open-iscsi (2.0.870.1-0ubuntu6) karmic; urgency=low |
| 915 | + |
| 916 | + * utils/iscsi_discovery: Fix several bashisms (test ==, &> redirection, |
| 917 | + trap with numeric signals). |
| 918 | + |
| 919 | + -- Colin Watson <cjwatson@ubuntu.com> Tue, 04 Aug 2009 12:30:44 +0100 |
| 920 | + |
| 921 | +open-iscsi (2.0.870.1-0ubuntu5) karmic; urgency=low |
| 922 | + |
| 923 | + * utils/iscsi_discovery: replace uses of awk with other shell voodoo, so |
| 924 | + that this works in the installer. LP: #236640. |
| 925 | + * debian/rules, debian/open-iscsi-udeb.dirs: install the open-isci-udeb |
| 926 | + finish script to /usr/lib/finish-install.d, not to /lib/finish-install.d. |
| 927 | + * debian/open-iscsi-udeb.finish-install: copy the config from the root |
| 928 | + to the correct directory in the target. |
| 929 | + |
| 930 | + -- Steve Langasek <steve.langasek@ubuntu.com> Tue, 07 Jul 2009 22:10:17 -0700 |
| 931 | + |
| 932 | +open-iscsi (2.0.870.1-0ubuntu4) karmic; urgency=low |
| 933 | + |
| 934 | + * debian/extra/initramfs.hook: iscsistart is in /sbin, not /usr/sbin (LP: |
| 935 | + #364616). |
| 936 | + |
| 937 | + -- Colin Watson <cjwatson@ubuntu.com> Thu, 02 Jul 2009 14:12:25 +0100 |
| 938 | + |
| 939 | +open-iscsi (2.0.870.1-0ubuntu3) jaunty; urgency=low |
| 940 | + |
| 941 | + * Invoke iscsi-iname using normal $PATH lookup rather than using an |
| 942 | + incorrect explicit path (see LP #236640). |
| 943 | + |
| 944 | + -- Colin Watson <cjwatson@ubuntu.com> Thu, 09 Apr 2009 16:49:08 +0100 |
| 945 | + |
| 946 | +open-iscsi (2.0.870.1-0ubuntu2) jaunty; urgency=low |
| 947 | + |
| 948 | + * debian/control: Drop udeb dependency on crypto-modules; as best as I can |
| 949 | + tell, this is required for crc32c support, which is now built-in to the |
| 950 | + Ubuntu kernels. |
| 951 | + |
| 952 | + -- Dustin Kirkland <kirkland@ubuntu.com> Tue, 03 Feb 2009 11:20:35 +0100 |
| 953 | + |
| 954 | +open-iscsi (2.0.870.1-0ubuntu1) jaunty; urgency=low |
| 955 | + |
| 956 | + * New upstream release: |
| 957 | + - Support 2.6.26/27 kernels (LP: #289470). |
| 958 | + - Fix iscsid shutdown (LP: #181188). |
| 959 | + * Merge from Debian. Remaining Ubuntu changes: |
| 960 | + - Note: Debian version isn't 870~rc3 but 869.2 which leads to a big |
| 961 | + .diff.gz file. Only files in debian/ have been considered for this merge |
| 962 | + since debian hasn't patched the source. |
| 963 | + - debian/control, debian/rules, debian/open-iscsi-udeb*: |
| 964 | + + Add open-iscsi-udeb. |
| 965 | + - debian/open-iscsi.dirs: |
| 966 | + + rename dirs to open-iscsi.dirs because of open-iscsi-udeb addition. |
| 967 | + + drop network/if-up.d/ directory since we're using symlinks instead. |
| 968 | + + utilities installed in /bin,/sbin rather than /usr/bin,/usr/sbin. |
| 969 | + - debian/open-iscsi.init: |
| 970 | + + utilities installed in /bin,/sbin rather than /usr/bin,/usr/sbin. |
| 971 | + + lsb log messages. |
| 972 | + + Don't generate initiatorname name (moved to postinst). |
| 973 | + + Support for being called from ifup/ifdown scripts. |
| 974 | + + Refactor start functions: |
| 975 | + - move daemon start to startdaemon function. |
| 976 | + - call udevadm settle rather then udevsettle (which doesn't do anything |
| 977 | + useful). |
| 978 | + - don't exit if the daemon is already running during sanitychecks. |
| 979 | + Instead check in startdaemon if the daemon needs to be started. |
| 980 | + - only start automatic targets if necessary. |
| 981 | + - add waitfordevices function: called during rcS, waits for all |
| 982 | + automatic targets to be ready. Iscsi targets are considered as |
| 983 | + local block devices - they don't need to be marked with _netdev in |
| 984 | + fstab. (LP: #227848) |
| 985 | + - start targets if not run from rcS. |
| 986 | + + Check status of iscsid daemon in addition to listing the iscsi sessions |
| 987 | + when status action is called. |
| 988 | + + Add iscsid to the list of processes that should not be killed by |
| 989 | + sendsigs during shutdown (LP: #192080). |
| 990 | + + Add starttargets, stoptargets and restarttargets to usage message. |
| 991 | + - debian/rules: |
| 992 | + + Install utilities /bin,/sbin rather than /usr/bin,/usr/sbin. |
| 993 | + + Start open-iscsi at S25 (waiting for devices created by ifupdown |
| 994 | + calls and before local filesystems are checked and mounted) |
| 995 | + + stop at S41 (after local filesystems are unmounted). Don't use |
| 996 | + umountiscsi.sh script from debian. (LP: #192080). |
| 997 | + - debian/initiatorname.iscsi, debian/open-iscsi.postinst: |
| 998 | + + Generate the random initiatorname during postinstall rather than in the |
| 999 | + init script. |
| 1000 | + + Don't ship a default initiatorname.iscsi file. |
| 1001 | + - debian/open-iscsi.postinst: |
| 1002 | + + fix init script ordering on upgrades. |
| 1003 | + - debian/open-iscsi.links: |
| 1004 | + + symlink open-iscsi init script in if-up.d and if-down.d directory so |
| 1005 | + that the iscsi subsystem is started/stopped when network interfaces |
| 1006 | + are configured. |
| 1007 | + - debian/open-iscsi.postrm: |
| 1008 | + + delete iscsi configuration when the package is purged. |
| 1009 | + - utils/iscsi_discovery: De-bashify iscsi_discovery. |
| 1010 | + - usr/idbm.c: Fix build failure with new glibc. LP: #299843. |
| 1011 | + * Dropped: |
| 1012 | + - Exit without error if /sys is not available. Otherwise, it's not possible |
| 1013 | + to use this package as a build-dependency (in Debian). |
| 1014 | + - Drop upstream url in long description now that it's in the Homepage |
| 1015 | + field (in Debian). |
| 1016 | + |
| 1017 | + -- Mathias Gug <mathiaz@ubuntu.com> Mon, 01 Dec 2008 10:45:03 -0500 |
| 1018 | + |
| 1019 | open-iscsi (2.0.870~rc3-0.6) unstable; urgency=low |
| 1020 | |
| 1021 | * Non-maintainer upload. |
| 1022 | @@ -723,6 +1669,47 @@ open-iscsi (2.0.869~rc4-1) experimental; urgency=low |
| 1023 | |
| 1024 | -- Philipp Hug <debian@hug.cx> Sat, 12 Apr 2008 15:53:12 +0200 |
| 1025 | |
| 1026 | +open-iscsi (2.0.865-1ubuntu5) jaunty; urgency=low |
| 1027 | + |
| 1028 | + * Fix build failure with new glibc. LP: #299843. |
| 1029 | + |
| 1030 | + -- Matthias Klose <doko@ubuntu.com> Thu, 27 Nov 2008 15:58:15 +0100 |
| 1031 | + |
| 1032 | +open-iscsi (2.0.865-1ubuntu4) intrepid; urgency=low |
| 1033 | + |
| 1034 | + * Exit without error if /sys is not available. Otherwise, it's not possible |
| 1035 | + to use this package as a build-dependency. |
| 1036 | + |
| 1037 | + -- Soren Hansen <soren@ubuntu.com> Fri, 02 May 2008 00:57:02 +0200 |
| 1038 | + |
| 1039 | +open-iscsi (2.0.865-1ubuntu3) hardy; urgency=low |
| 1040 | + |
| 1041 | + * Migration of /usr/{bin,sbin,lib} -> to /{bin,sbin,lib}. |
| 1042 | + (LP: #208441) |
| 1043 | + * Push the shutdown scripts back. (LP: #196748) |
| 1044 | + * Update control to 3.7.3. |
| 1045 | + * Updated the maintainer according to spec. |
| 1046 | + |
| 1047 | + -- Chuck Short <zulcss@ubuntu.com> Wed, 09 Apr 2008 18:09:28 -0400 |
| 1048 | + |
| 1049 | +open-iscsi (2.0.865-1ubuntu2) hardy; urgency=low |
| 1050 | + |
| 1051 | + * Fixed init script to point to the right iscsiadm. (LP: #206520) |
| 1052 | + |
| 1053 | + -- Chuck Short <zulcss@ubuntu.com> Tue, 25 Mar 2008 09:53:08 -0400 |
| 1054 | + |
| 1055 | +open-iscsi (2.0.865-1ubuntu1) hardy; urgency=low |
| 1056 | + |
| 1057 | + * Add open-iscsi-udeb. |
| 1058 | + * Include iscsi_discovery. |
| 1059 | + * De-bashify iscsi_discovery. |
| 1060 | + * Start open-iscsi in single user mode. |
| 1061 | + * Properly lsb-ify init script. |
| 1062 | + * Modify Maintainer value to match the DebianMaintainerField |
| 1063 | + specification. |
| 1064 | + |
| 1065 | + -- Soren Hansen <soren@ubuntu.com> Fri, 08 Feb 2008 11:56:11 +0100 |
| 1066 | + |
| 1067 | open-iscsi (2.0.865-1) unstable; urgency=low |
| 1068 | |
| 1069 | * New upstream release |
| 1070 | diff --git a/debian/control b/debian/control |
| 1071 | index 66645ef..70565f2 100644 |
| 1072 | --- a/debian/control |
| 1073 | +++ b/debian/control |
| 1074 | @@ -1,7 +1,8 @@ |
| 1075 | Source: open-iscsi |
| 1076 | Section: net |
| 1077 | Priority: optional |
| 1078 | -Maintainer: Debian iSCSI Maintainers <open-iscsi@packages.debian.org> |
| 1079 | +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> |
| 1080 | +XSBC-Original-Maintainer: Debian iSCSI Maintainers <open-iscsi@packages.debian.org> |
| 1081 | Uploaders: Ritesh Raj Sarraf <rrs@debian.org>, |
| 1082 | Christian Seiler <christian@iwakd.de> |
| 1083 | Build-Depends: bison, |
| 1084 | @@ -29,6 +30,7 @@ Depends: ${misc:Depends}, |
| 1085 | ${shlibs:Depends}, |
| 1086 | libopeniscsiusr, |
| 1087 | udev |
| 1088 | +Recommends: ${busybox:Recommends}, finalrd (>= 3) |
| 1089 | Pre-Depends: debconf | debconf-2.0 |
| 1090 | Description: iSCSI initiator tools |
| 1091 | The Open-iSCSI project is a high-performance, transport independent, |
| 1092 | @@ -136,7 +138,7 @@ Package: open-iscsi-udeb |
| 1093 | # linux kernel udebs) must exist for these architectures - so |
| 1094 | # check that before adding them to this list; the other |
| 1095 | # scsi-(core|common|...)-modules are NOT sufficient! |
| 1096 | -Architecture: amd64 arm64 armhf i386 ia64 mips mipsel powerpc ppc64 ppc64el s390x |
| 1097 | +Architecture: amd64 arm64 armhf ia64 mips mipsel powerpc ppc64 ppc64el s390x |
| 1098 | Section: debian-installer |
| 1099 | Package-Type: udeb |
| 1100 | Depends: ${misc:Depends}, |
| 1101 | diff --git a/debian/dirs b/debian/dirs |
| 1102 | deleted file mode 100644 |
| 1103 | index 0f7e9be..0000000 |
| 1104 | --- a/debian/dirs |
| 1105 | +++ /dev/null |
| 1106 | @@ -1,8 +0,0 @@ |
| 1107 | -etc/default |
| 1108 | -etc/init.d |
| 1109 | -etc/iscsi |
| 1110 | -etc/network/if-up.d |
| 1111 | -lib/modules-load.d |
| 1112 | -lib/open-iscsi |
| 1113 | -usr/share/initramfs-tools/hooks/ |
| 1114 | -usr/share/initramfs-tools/scripts/local-top/ |
| 1115 | diff --git a/debian/docs b/debian/docs |
| 1116 | deleted file mode 100644 |
| 1117 | index dde07eb..0000000 |
| 1118 | --- a/debian/docs |
| 1119 | +++ /dev/null |
| 1120 | @@ -1,3 +0,0 @@ |
| 1121 | -README |
| 1122 | -sysfs-documentation |
| 1123 | -THANKS |
| 1124 | diff --git a/debian/extra/initramfs.hook b/debian/extra/initramfs.hook |
| 1125 | index 6a430eb..7458571 100755 |
| 1126 | --- a/debian/extra/initramfs.hook |
| 1127 | +++ b/debian/extra/initramfs.hook |
| 1128 | @@ -32,7 +32,7 @@ if [ -r /etc/iscsi/iscsi.initramfs ] ; then |
| 1129 | cp /etc/iscsi/iscsi.initramfs $DESTDIR/etc |
| 1130 | fi |
| 1131 | |
| 1132 | -for x in crc32c libcrc32c iscsi_tcp libiscsi scsi_transport_iscsi iscsi_ibft; do |
| 1133 | +for x in crc32c libcrc32c ib_iser iscsi_tcp libiscsi scsi_transport_iscsi iscsi_ibft; do |
| 1134 | manual_add_modules ${x} |
| 1135 | done |
| 1136 | for x in cxgb3i cxgb4i; do |
| 1137 | diff --git a/debian/extra/initramfs.local-bottom b/debian/extra/initramfs.local-bottom |
| 1138 | index c32e5fe..06ddc56 100755 |
| 1139 | --- a/debian/extra/initramfs.local-bottom |
| 1140 | +++ b/debian/extra/initramfs.local-bottom |
| 1141 | @@ -7,4 +7,24 @@ if [ -x /sbin/iscsiuio ] && [ -e /run/initramfs/iscsiuio.pid ] ; then |
| 1142 | --name iscsiuio --exec /sbin/iscsiuio || : |
| 1143 | fi |
| 1144 | |
| 1145 | +# Remove the interface file if no disks are present |
| 1146 | +if [ -f /run/initramfs/open-iscsi.interface ] ; then |
| 1147 | + found=0 |
| 1148 | + for disk in /dev/disk/by-path/*-iscsi-*; do |
| 1149 | + if [ ! -e "$disk" ] ; then |
| 1150 | + # If we have no matches, we stil go through the for loop once with |
| 1151 | + # the pattern as a string |
| 1152 | + continue |
| 1153 | + fi |
| 1154 | + if ! readlink -f "$disk" > /dev/null ; then |
| 1155 | + continue |
| 1156 | + fi |
| 1157 | + found=1 |
| 1158 | + break; |
| 1159 | + done |
| 1160 | + if [ $found = 0 ] ; then |
| 1161 | + rm /run/initramfs/open-iscsi.interface |
| 1162 | + fi |
| 1163 | +fi |
| 1164 | + |
| 1165 | exit 0 |
| 1166 | diff --git a/debian/extra/initramfs.local-top b/debian/extra/initramfs.local-top |
| 1167 | index 1045c50..9f3af32 100755 |
| 1168 | --- a/debian/extra/initramfs.local-top |
| 1169 | +++ b/debian/extra/initramfs.local-top |
| 1170 | @@ -93,6 +93,7 @@ do_iscsi_login () |
| 1171 | . /scripts/functions |
| 1172 | |
| 1173 | udevadm settle |
| 1174 | + IBFT_DHCP_DEVICE="" |
| 1175 | |
| 1176 | if [ -n "$ISCSI_AUTO" ] ; then |
| 1177 | # try to auto-configure network interface based |
| 1178 | @@ -136,7 +137,13 @@ do_iscsi_login () |
| 1179 | echo "UPTIME='${UPTIME}'" |
| 1180 | echo "DHCPLEASETIME='${DHCPLEASETIME}'" |
| 1181 | echo "DOMAINSEARCH=''" |
| 1182 | - } > "/run/net-${DEVICE}.conf" |
| 1183 | + } > "/run/net-${DEVICE}.conf.ibft" |
| 1184 | + if [ "$PROTO" != "dhcp" -a "$DHCPLEASETIME" = "0" ]; then |
| 1185 | + # this is static ibft configuration. |
| 1186 | + mv "/run/net-${DEVICE}.conf.ibft" "/run/net-${DEVICE}.conf" |
| 1187 | + else |
| 1188 | + IBFT_DHCP_DEVICE="$DEVICE" |
| 1189 | + fi |
| 1190 | echo "${DEVICE}" > /run/initramfs/open-iscsi.interface |
| 1191 | # iscsistart -N doesn't set the default gateway. Therefore, |
| 1192 | # we need to add it ourselves. However, the ip command is |
| 1193 | @@ -172,9 +179,23 @@ do_iscsi_login () |
| 1194 | |
| 1195 | # run configure_networking even if we have iscsi_auto, because there |
| 1196 | # could be other network interfaces that need to be configured |
| 1197 | - # manually |
| 1198 | + # also, if we set up DHCP iBFT, we need ipconfig to run so it creates |
| 1199 | + # a proper /run/net-${DEVICE}.conf file that includes the DNS search |
| 1200 | + # domain, which we don't get in our iBFT data (see LP: #1806777) |
| 1201 | configure_networking |
| 1202 | |
| 1203 | + if [ -n "$IBFT_DHCP_DEVICE" ]; then |
| 1204 | + if ! [ -e "/run/net-${DEVICE}.conf" ] ; then |
| 1205 | + echo "WARN: ipconfig dhcp failed, using iSCSI iBFT config - DNS search domain may be missing at runtime" >&2 |
| 1206 | + # We have DHCP iBFT, but ipconfig DHCP failed; |
| 1207 | + # so we should fallback to just using the iBFT config, |
| 1208 | + # though that will not include the DNS search domain |
| 1209 | + mv "/run/net-${DEVICE}.conf.ibft" "/run/net-${DEVICE}.conf" |
| 1210 | + # need to re-run configure_networking to process conf file |
| 1211 | + configure_networking |
| 1212 | + fi |
| 1213 | + fi |
| 1214 | + |
| 1215 | # Save network device we configured via configure_networking, but only |
| 1216 | # if we didn't already get one from autoconfiguration (then we always |
| 1217 | # prefer that). |
| 1218 | @@ -186,6 +207,13 @@ do_iscsi_login () |
| 1219 | fi |
| 1220 | if [ -n "${DEVICE}" ] ; then |
| 1221 | echo "${DEVICE}" > /run/initramfs/open-iscsi.interface |
| 1222 | + else |
| 1223 | + for i in /run/net6-*.conf; do |
| 1224 | + [ -e "${i}" ] && { . "${i}" ; break ; } |
| 1225 | + done |
| 1226 | + fi |
| 1227 | + if [ -z "${DEVICE}" ] && [ -n "${DEVICE6}" ] ; then |
| 1228 | + echo "${DEVICE6}" > /run/initramfs/open-iscsi.interface |
| 1229 | fi |
| 1230 | fi |
| 1231 | |
| 1232 | diff --git a/debian/extra/net-interface-handler b/debian/extra/net-interface-handler |
| 1233 | new file mode 100755 |
| 1234 | index 0000000..9cd6e1e |
| 1235 | --- /dev/null |
| 1236 | +++ b/debian/extra/net-interface-handler |
| 1237 | @@ -0,0 +1,80 @@ |
| 1238 | +#!/bin/sh -e |
| 1239 | +# suppress configuration of network interface used |
| 1240 | +# by iSCSI root device |
| 1241 | +# |
| 1242 | +# If the root filesystem is on iSCSI, then we must take care to avoid |
| 1243 | +# changing the state of its network interface. To this end, the initramfs |
| 1244 | +# leaves a note for us which interface was used, and we mangle |
| 1245 | +# /run/network/ifstate manually to stop it being brought up or down |
| 1246 | +# automatically. This is a slight layering violation, but, unfortunately, |
| 1247 | +# ifupdown appears to have no way to do this without also running |
| 1248 | +# /etc/network/*.d/ scripts. |
| 1249 | + |
| 1250 | +assert_interface() { |
| 1251 | + # udev sets INTERFACE to the name of the currently-processed nic. |
| 1252 | + [ -n "$INTERFACE" ] && return 0 |
| 1253 | + echo "environment variable INTERFACE not set." 1>&2; |
| 1254 | + return 1 |
| 1255 | +} |
| 1256 | + |
| 1257 | +start() { |
| 1258 | + CR=" |
| 1259 | +" |
| 1260 | + assert_interface || return |
| 1261 | + ifile=/run/initramfs/open-iscsi.interface |
| 1262 | + |
| 1263 | + [ -f "$ifile" ] && read iface < "$ifile" || return 0 |
| 1264 | + [ "$INTERFACE" = "$iface" ] || return |
| 1265 | + |
| 1266 | + if ! grep -qs "^$iface=" /run/network/ifstate; then |
| 1267 | + mkdir -p /run/network |
| 1268 | + echo "$iface=$iface" >>/run/network/ifstate |
| 1269 | + |
| 1270 | + if [ -f /run/net-$iface.conf ]; then |
| 1271 | + conf=/run/net-$iface.conf |
| 1272 | + elif [ -f /run/net6-$iface.conf ]; then |
| 1273 | + conf=/run/net6-$iface.conf |
| 1274 | + else |
| 1275 | + conf="" |
| 1276 | + fi |
| 1277 | + if command -v resolvconf >/dev/null && |
| 1278 | + [ -n "$conf" ]; then |
| 1279 | + . "$conf" |
| 1280 | + R="" |
| 1281 | + [ -n "$DOMAINSEARCH" ] && R="$R${CR}search $DOMAINSEARCH" |
| 1282 | + [ -n "$IPV6DOMAINSEARCH" ] && R="$R${CR}search $IPV6DOMAINSEARCH" |
| 1283 | + for ns in "$IPV4DNS0" "$IPV4DNS1" "$IPV6DNS0" "$IPV6DNS1"; do |
| 1284 | + [ -n "$ns" -a "$ns" != "0.0.0.0" ] && R="$R${CR}nameserver $ns" |
| 1285 | + done |
| 1286 | + if [ -n "$R" ]; then |
| 1287 | + # create the dir in case resolvconf did not start yet |
| 1288 | + mkdir -p /run/resolvconf/interface |
| 1289 | + resolvconf -a $iface.iscsi-network <<EOF |
| 1290 | +${R#${CR}} |
| 1291 | +EOF |
| 1292 | + fi |
| 1293 | + fi |
| 1294 | + fi |
| 1295 | +} |
| 1296 | + |
| 1297 | +stop() { |
| 1298 | + assert_interface || return |
| 1299 | + ifile=/run/initramfs/open-iscsi.interface |
| 1300 | + [ -f "$ifile" ] && read iface < "$ifile" || return 0 |
| 1301 | + [ "$INTERFACE" = "$iface" ] || return |
| 1302 | + |
| 1303 | + if grep -qs "^$iface=" /run/network/ifstate; then |
| 1304 | + grep -v "^$iface=" /run/network/ifstate >/run/network/.ifstate.tmp || true |
| 1305 | + mv /run/network/.ifstate.tmp /run/network/ifstate |
| 1306 | + |
| 1307 | + if command -v resolvconf >/dev/null; then |
| 1308 | + resolvconf -d $iface.iscsi-network |
| 1309 | + fi |
| 1310 | + fi |
| 1311 | +} |
| 1312 | + |
| 1313 | +case "$1" in |
| 1314 | + start) start ;; |
| 1315 | + stop) stop ;; |
| 1316 | + *) echo "ERROR: must be called with 'start' or 'stop'" >&2; exit 1 ;; |
| 1317 | +esac |
| 1318 | diff --git a/debian/iscsi-network-interface.rules b/debian/iscsi-network-interface.rules |
| 1319 | new file mode 100644 |
| 1320 | index 0000000..e0408d7 |
| 1321 | --- /dev/null |
| 1322 | +++ b/debian/iscsi-network-interface.rules |
| 1323 | @@ -0,0 +1,3 @@ |
| 1324 | +# run before 80-networking.rules to run before ifupdown |
| 1325 | +SUBSYSTEM=="net", ACTION=="add", RUN+="/lib/open-iscsi/net-interface-handler start" |
| 1326 | +SUBSYSTEM=="net", ACTION=="remove", RUN+="/lib/open-iscsi/net-interface-handler stop" |
| 1327 | diff --git a/debian/iscsid.service b/debian/iscsid.service |
| 1328 | index d05953d..c98fd7e 100644 |
| 1329 | --- a/debian/iscsid.service |
| 1330 | +++ b/debian/iscsid.service |
| 1331 | @@ -7,13 +7,13 @@ After=network.target network-online.target |
| 1332 | DefaultDependencies=no |
| 1333 | Conflicts=shutdown.target |
| 1334 | Before=shutdown.target |
| 1335 | +ConditionVirtualization=!private-users |
| 1336 | |
| 1337 | [Service] |
| 1338 | Type=forking |
| 1339 | PIDFile=/run/iscsid.pid |
| 1340 | ExecStartPre=/lib/open-iscsi/startup-checks.sh |
| 1341 | ExecStart=/sbin/iscsid |
| 1342 | -ExecStop=/sbin/iscsiadm -k 0 2 |
| 1343 | |
| 1344 | [Install] |
| 1345 | WantedBy=sysinit.target |
| 1346 | diff --git a/debian/iscsiuio.docs b/debian/iscsiuio.docs |
| 1347 | deleted file mode 100644 |
| 1348 | index 1067403..0000000 |
| 1349 | --- a/debian/iscsiuio.docs |
| 1350 | +++ /dev/null |
| 1351 | @@ -1,2 +0,0 @@ |
| 1352 | -iscsiuio/RELEASE.TXT |
| 1353 | -iscsiuio/README |
| 1354 | diff --git a/debian/iscsiuio.install b/debian/iscsiuio.install |
| 1355 | deleted file mode 100755 |
| 1356 | index ecd9f4a..0000000 |
| 1357 | --- a/debian/iscsiuio.install |
| 1358 | +++ /dev/null |
| 1359 | @@ -1,3 +0,0 @@ |
| 1360 | -#!/usr/bin/dh-exec |
| 1361 | -iscsiuio/src/unix/iscsiuio /sbin |
| 1362 | -debian/extra/iscsiuio.initramfs.hook => /usr/share/initramfs-tools/hooks/iscsiuio |
| 1363 | diff --git a/debian/iscsiuio.manpages b/debian/iscsiuio.manpages |
| 1364 | deleted file mode 100644 |
| 1365 | index 788a438..0000000 |
| 1366 | --- a/debian/iscsiuio.manpages |
| 1367 | +++ /dev/null |
| 1368 | @@ -1 +0,0 @@ |
| 1369 | -iscsiuio/docs/iscsiuio.8 |
| 1370 | diff --git a/debian/manpages b/debian/manpages |
| 1371 | deleted file mode 100644 |
| 1372 | index a01cd9a..0000000 |
| 1373 | --- a/debian/manpages |
| 1374 | +++ /dev/null |
| 1375 | @@ -1,5 +0,0 @@ |
| 1376 | -doc/iscsi-iname.8 |
| 1377 | -doc/iscsi_discovery.8 |
| 1378 | -doc/iscsiadm.8 |
| 1379 | -doc/iscsid.8 |
| 1380 | -doc/iscsistart.8 |
| 1381 | diff --git a/debian/open-iscsi-udeb.dirs b/debian/open-iscsi-udeb.dirs |
| 1382 | deleted file mode 100644 |
| 1383 | index f094192..0000000 |
| 1384 | --- a/debian/open-iscsi-udeb.dirs |
| 1385 | +++ /dev/null |
| 1386 | @@ -1,4 +0,0 @@ |
| 1387 | -bin |
| 1388 | -etc/iscsi |
| 1389 | -sbin |
| 1390 | -usr/lib/finish-install.d |
| 1391 | diff --git a/debian/open-iscsi-udeb.install b/debian/open-iscsi-udeb.install |
| 1392 | deleted file mode 100755 |
| 1393 | index 9847b88..0000000 |
| 1394 | --- a/debian/open-iscsi-udeb.install |
| 1395 | +++ /dev/null |
| 1396 | @@ -1,11 +0,0 @@ |
| 1397 | -#!/usr/bin/dh-exec |
| 1398 | -usr/iscsiadm /bin |
| 1399 | -utils/iscsi-iname /sbin |
| 1400 | -utils/iscsi_discovery /sbin |
| 1401 | -usr/iscsid /sbin |
| 1402 | -usr/iscsistart /sbin |
| 1403 | -etc/iscsid.conf /etc/iscsi |
| 1404 | -debian/open-iscsi-udeb.start => /sbin/iscsi-start |
| 1405 | -debian/open-iscsi-udeb.finish-install => /usr/lib/finish-install.d/10open-iscsi |
| 1406 | -# dh_lintian ignores udebs, force installation |
| 1407 | -debian/open-iscsi-udeb.lintian-overrides => /usr/share/lintian/overrides/open-iscsi-udeb |
| 1408 | diff --git a/debian/open-iscsi-udeb.lintian-overrides b/debian/open-iscsi-udeb.lintian-overrides |
| 1409 | deleted file mode 100644 |
| 1410 | index a76bddf..0000000 |
| 1411 | --- a/debian/open-iscsi-udeb.lintian-overrides |
| 1412 | +++ /dev/null |
| 1413 | @@ -1 +0,0 @@ |
| 1414 | -open-iscsi-udeb udeb: non-standard-file-perm etc/iscsi/iscsid.conf 0600 != 0644 |
| 1415 | diff --git a/debian/open-iscsi.finalrd b/debian/open-iscsi.finalrd |
| 1416 | new file mode 100755 |
| 1417 | index 0000000..d8c8a21 |
| 1418 | --- /dev/null |
| 1419 | +++ b/debian/open-iscsi.finalrd |
| 1420 | @@ -0,0 +1,40 @@ |
| 1421 | +#!/bin/sh |
| 1422 | +# SPDX-License-Identifier: GPL-3.0-only |
| 1423 | + |
| 1424 | +set -e |
| 1425 | + |
| 1426 | +if [ "$1" = "setup" ] |
| 1427 | +then |
| 1428 | + . /usr/share/initramfs-tools/hook-functions |
| 1429 | + copy_exec /bin/grep |
| 1430 | + copy_exec /bin/sleep |
| 1431 | + copy_exec /sbin/iscsiadm |
| 1432 | + copy_exec /sbin/iscsid |
| 1433 | + # hm, not sure why expr is copied |
| 1434 | + copy_exec /usr/bin/expr |
| 1435 | + copy_file config /etc/iscsi/iscsid.conf |
| 1436 | + copy_file config /etc/iscsi/initiatorname.iscsi |
| 1437 | + exit 0 |
| 1438 | +fi |
| 1439 | + |
| 1440 | +# re-establish connection and logout during shutdown |
| 1441 | +# if initramfs did bring up open-iscsi on boot |
| 1442 | +[ -f /open-iscsi.interface ] || exit 0 |
| 1443 | + |
| 1444 | +iscsid |
| 1445 | + |
| 1446 | +# After restarting iscsid, wait for an active connection. |
| 1447 | +# Limit the wait time in case of unexpected failure of iscsid. |
| 1448 | +MAX_RETRIES=30 |
| 1449 | +RETRY=0 |
| 1450 | +while ! iscsiadm -m session -P 1 | grep -q "iSCSI Connection State: LOGGED IN"; do |
| 1451 | + RETRY=$(($RETRY + 1)) |
| 1452 | + if [ $RETRY -gt $MAX_RETRIES ]; then |
| 1453 | + echo "Unexpected iSCSI Connection State, forcing iSCSI logout." |
| 1454 | + break |
| 1455 | + fi |
| 1456 | + sleep 1 |
| 1457 | +done |
| 1458 | + |
| 1459 | +# Issue an iSCSI logout. |
| 1460 | +iscsiadm -m node -u |
| 1461 | diff --git a/debian/open-iscsi.install b/debian/open-iscsi.install |
| 1462 | deleted file mode 100755 |
| 1463 | index 8e2a7d6..0000000 |
| 1464 | --- a/debian/open-iscsi.install |
| 1465 | +++ /dev/null |
| 1466 | @@ -1,15 +0,0 @@ |
| 1467 | -#!/usr/bin/dh-exec |
| 1468 | -usr/iscsiadm /sbin |
| 1469 | -build.deb/iscsid /sbin |
| 1470 | -build.deb/iscsistart /sbin |
| 1471 | -utils/iscsi_discovery /sbin |
| 1472 | -utils/iscsi-iname /sbin |
| 1473 | -etc/iscsid.conf /etc/iscsi |
| 1474 | -debian/extra/initramfs.hook => /usr/share/initramfs-tools/hooks/iscsi |
| 1475 | -debian/extra/initramfs.local-top => /usr/share/initramfs-tools/scripts/local-top/iscsi |
| 1476 | -debian/extra/initramfs.local-bottom => /usr/share/initramfs-tools/scripts/local-bottom/iscsi |
| 1477 | -debian/extra/umountiscsi.sh /lib/open-iscsi |
| 1478 | -debian/extra/logout-all.sh /lib/open-iscsi |
| 1479 | -debian/extra/startup-checks.sh /lib/open-iscsi |
| 1480 | -debian/extra/activate-storage.sh /lib/open-iscsi |
| 1481 | -debian/open-iscsi.kmod => /lib/modules-load.d/open-iscsi.conf |
| 1482 | diff --git a/debian/open-iscsi.kmod b/debian/open-iscsi.kmod |
| 1483 | deleted file mode 100644 |
| 1484 | index c5f90f3..0000000 |
| 1485 | --- a/debian/open-iscsi.kmod |
| 1486 | +++ /dev/null |
| 1487 | @@ -1,2 +0,0 @@ |
| 1488 | -iscsi_tcp |
| 1489 | -ib_iser |
| 1490 | diff --git a/debian/open-iscsi.links b/debian/open-iscsi.links |
| 1491 | deleted file mode 100644 |
| 1492 | index 96e050d..0000000 |
| 1493 | --- a/debian/open-iscsi.links |
| 1494 | +++ /dev/null |
| 1495 | @@ -1 +0,0 @@ |
| 1496 | -sbin/iscsiadm usr/bin/iscsiadm |
| 1497 | diff --git a/debian/open-iscsi.lintian-overrides b/debian/open-iscsi.lintian-overrides |
| 1498 | deleted file mode 100644 |
| 1499 | index 80b7911..0000000 |
| 1500 | --- a/debian/open-iscsi.lintian-overrides |
| 1501 | +++ /dev/null |
| 1502 | @@ -1,5 +0,0 @@ |
| 1503 | -open-iscsi: non-standard-file-perm etc/iscsi/iscsid.conf 0600 != 0644 |
| 1504 | -open-iscsi: postinst-uses-db-input |
| 1505 | - |
| 1506 | -# See discussion in Bug #797860 |
| 1507 | -open-iscsi: too-long-extended-description-in-templates open-iscsi/remove_even_with_active_sessions |
| 1508 | diff --git a/debian/open-iscsi.maintscript b/debian/open-iscsi.maintscript |
| 1509 | deleted file mode 100644 |
| 1510 | index c079324..0000000 |
| 1511 | --- a/debian/open-iscsi.maintscript |
| 1512 | +++ /dev/null |
| 1513 | @@ -1 +0,0 @@ |
| 1514 | -rm_conffile /etc/init.d/umountiscsi.sh 2.0.873+git0.3b4b4500-9 |
| 1515 | diff --git a/debian/open-iscsi.postinst b/debian/open-iscsi.postinst |
| 1516 | index f9867d4..505f7c1 100644 |
| 1517 | --- a/debian/open-iscsi.postinst |
| 1518 | +++ b/debian/open-iscsi.postinst |
| 1519 | @@ -17,16 +17,6 @@ restore_old_timeouts() |
| 1520 | case "$1" in |
| 1521 | configure) |
| 1522 | |
| 1523 | - # We switched over to modules-load.d logic, this is needed |
| 1524 | - MODULES_FILE=/lib/modules-load.d/open-iscsi.conf |
| 1525 | - if [ -f /etc/modules-load.d/open-iscsi.conf ] ; then |
| 1526 | - MODULES_FILE=/etc/modules-load.d/open-iscsi.conf |
| 1527 | - fi |
| 1528 | - grep '^[^#]' $MODULES_FILE | while read module args ; do |
| 1529 | - [ "$module" ] || continue |
| 1530 | - modprobe $module $args >/dev/null 2>&1 || true |
| 1531 | - done |
| 1532 | - |
| 1533 | # Compatibility symlinks |
| 1534 | for file in iscsid iscsi_discovery iscsi-iname iscsistart; do |
| 1535 | if [ ! -e /usr/sbin/$file ]; then |
| 1536 | @@ -65,7 +55,9 @@ esac |
| 1537 | |
| 1538 | #DEBHELPER# |
| 1539 | |
| 1540 | -if [ "$1" = configure ] ; then |
| 1541 | +if [ "$1" = configure ] && [ -n "$2" ] && [ -d /run/systemd/system ] && |
| 1542 | + systemctl is-active iscsid.service > /dev/null |
| 1543 | +then |
| 1544 | # There already is a check in preinst with a debconf prompt that |
| 1545 | # allows the administrator to abort. Don't abort here, because |
| 1546 | # leaving the package in a half-configured state is probably worse. |
| 1547 | @@ -109,25 +101,9 @@ if [ "$1" = configure ] ; then |
| 1548 | # Just in case something goes wrong: |
| 1549 | sync |
| 1550 | |
| 1551 | - # Note: 3>&- is required because iscsid doesn't close unused |
| 1552 | - # FDs, but debconf/confmodule will make the fd 3 point to |
| 1553 | - # the original stdout (and stdout to stderr) to make sure |
| 1554 | - # no program accidentally issues a command on stdout. On |
| 1555 | - # sysvinit systems this combination (iscsid not closing |
| 1556 | - # fds, fd 3 remaining open) will cause dpkg to wait |
| 1557 | - # forever for the maintscript to finish. (iscsid keeps |
| 1558 | - # this end of the pipe open even though the maintscript |
| 1559 | - # is finished, so dpkg will never receive a POLLHUP on |
| 1560 | - # its end of the pipe, waiting forever.) Closing fd 3 |
| 1561 | - # here is the simplest solution. This issue does not |
| 1562 | - # occur with other init systems, since they start |
| 1563 | - # services in a clean environment without any extraneous |
| 1564 | - # open fds. |
| 1565 | - if [ -n "$2" ]; then |
| 1566 | - invoke-rc.d iscsid restart 3>&- |
| 1567 | - else |
| 1568 | - invoke-rc.d iscsid start 3>&- |
| 1569 | - fi |
| 1570 | + # we want to be able to be explicit to start .service, but follow policy.d |
| 1571 | + # therefore use deb-systemd-invoke |
| 1572 | + deb-systemd-invoke restart iscsid.service || true |
| 1573 | |
| 1574 | RETRIES=0 |
| 1575 | while cat /sys/class/iscsi_session/session*/state 2>/dev/null | grep -qv LOGGED_IN ; do |
| 1576 | @@ -149,17 +125,26 @@ if [ "$1" = configure ] ; then |
| 1577 | |
| 1578 | restore_old_timeouts |
| 1579 | trap - EXIT |
| 1580 | +fi |
| 1581 | |
| 1582 | - # Don't restart (and therefore stop) open-iscsi, because we don't |
| 1583 | - # want to logout from targets during a simple upgrade. But also, |
| 1584 | - # if for some reason there's some misconfigured target in the |
| 1585 | - # config that couldn't be activated, don't break postinst, so |
| 1586 | - # ignore the exit code. |
| 1587 | - # See above for why 3>&- is here. (Technically it's not required |
| 1588 | - # for postinst to work, but vgchange likes to complain about leaked |
| 1589 | - # file descriptors, and we don't need to show that message to the |
| 1590 | - # user.) |
| 1591 | - invoke-rc.d open-iscsi start 3>&- || true |
| 1592 | +if [ "$1" = configure ]; then |
| 1593 | + # With socket based activation one wants iscsid.socket to be active |
| 1594 | + # But on upgrades the iscsid.service might already be active |
| 1595 | + # Due to that directly starting iscsid.socket might fail: |
| 1596 | + # systemd[1]: iscsid.socket: Socket service iscsid.service already active, refusing. |
| 1597 | + # Therefore check if iscsid.service is: |
| 1598 | + # - active: |
| 1599 | + # - ok for now, do not start iscsid.socket as it would conflict |
| 1600 | + # - on a reboot .socket will be started as it is enabled |
| 1601 | + # - inactive: |
| 1602 | + # - start iscsid.socket - to be ready |
| 1603 | + # In both cases: |
| 1604 | + # - disable iscsid.service so it only starts by the socket after reboot |
| 1605 | + if [ -d /run/systemd/system ]; then |
| 1606 | + if ! systemctl is-active iscsid.service > /dev/null; then |
| 1607 | + deb-systemd-invoke start iscsid.socket || true |
| 1608 | + fi |
| 1609 | + fi |
| 1610 | fi |
| 1611 | |
| 1612 | exit 0 |
| 1613 | diff --git a/debian/open-iscsi.service b/debian/open-iscsi.service |
| 1614 | index a62825e..06f83fe 100644 |
| 1615 | --- a/debian/open-iscsi.service |
| 1616 | +++ b/debian/open-iscsi.service |
| 1617 | @@ -1,12 +1,16 @@ |
| 1618 | [Unit] |
| 1619 | Description=Login to default iSCSI targets |
| 1620 | Documentation=man:iscsiadm(8) man:iscsid(8) |
| 1621 | -Wants=network-online.target remote-fs-pre.target iscsid.service |
| 1622 | +Wants=network-online.target remote-fs-pre.target |
| 1623 | After=network-online.target iscsid.service |
| 1624 | Before=remote-fs-pre.target |
| 1625 | DefaultDependencies=no |
| 1626 | Conflicts=shutdown.target |
| 1627 | Before=shutdown.target |
| 1628 | +# Must have some pre-defined targets to login to |
| 1629 | +ConditionDirectoryNotEmpty=|/etc/iscsi/nodes |
| 1630 | +# or have a session to use via iscsid |
| 1631 | +ConditionDirectoryNotEmpty=|/sys/class/iscsi_session |
| 1632 | |
| 1633 | [Service] |
| 1634 | Type=oneshot |
| 1635 | @@ -15,11 +19,7 @@ RemainAfterExit=true |
| 1636 | # and 15 if a session is alread logged in (which we do not |
| 1637 | # consider an error) |
| 1638 | SuccessExitStatus=15 21 |
| 1639 | -# iscsiadm will only work if iscsid is running. But we can't use a |
| 1640 | -# Requires= dependency, since restarts of iscsid would then be |
| 1641 | -# propagated to this service - and that would cause all sorts of |
| 1642 | -# mayhem. Therefore, check it in ExecStartPre. |
| 1643 | -ExecStartPre=/bin/systemctl --quiet is-active iscsid.service |
| 1644 | +# Note: iscsid will be socket activated by iscsiadm |
| 1645 | ExecStart=/sbin/iscsiadm -m node --loginall=automatic |
| 1646 | ExecStart=/lib/open-iscsi/activate-storage.sh |
| 1647 | ExecStop=/lib/open-iscsi/umountiscsi.sh |
| 1648 | diff --git a/debian/patches/bugfixes/fix_iscsiuio_long_options.patch b/debian/patches/bugfixes/fix_iscsiuio_long_options.patch |
| 1649 | deleted file mode 100644 |
| 1650 | index 6d01e4e..0000000 |
| 1651 | --- a/debian/patches/bugfixes/fix_iscsiuio_long_options.patch |
| 1652 | +++ /dev/null |
| 1653 | @@ -1,71 +0,0 @@ |
| 1654 | -Description: Fix iscsiuio long options |
| 1655 | -Author: Andrew Patterson <andrew.patterson@hpe.com> |
| 1656 | -Bug: https://groups.google.com/forum/?_escaped_fragment_=msg/open-iscsi/PsT65Z4$ |
| 1657 | -Bug-Debian: https://bugs.debian.org/850057 |
| 1658 | -Last-Update: 2017-01-24 |
| 1659 | ---- |
| 1660 | -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ |
| 1661 | ---- a/iscsiuio/src/unix/main.c |
| 1662 | -+++ b/iscsiuio/src/unix/main.c |
| 1663 | -@@ -82,10 +82,12 @@ |
| 1664 | - * Global Variables |
| 1665 | - ******************************************************************************/ |
| 1666 | - static const struct option long_options[] = { |
| 1667 | -- {"debug", 0, 0, 0}, |
| 1668 | -- {"version", 0, 0, 0}, |
| 1669 | -- {"help", 0, 0, 0}, |
| 1670 | -- {0, 0, 0, 0} |
| 1671 | -+ {"foreground", no_argument, NULL, 'f'}, |
| 1672 | -+ {"debug", required_argument, NULL, 'd'}, |
| 1673 | -+ {"pid", required_argument, NULL, 'p'}, |
| 1674 | -+ {"version", no_argument, NULL, 'v'}, |
| 1675 | -+ {"help", no_argument, NULL, 'h'}, |
| 1676 | -+ {NULL, no_argument, NULL, 0} |
| 1677 | - }; |
| 1678 | - |
| 1679 | - struct options opt = { |
| 1680 | -@@ -172,7 +174,7 @@ |
| 1681 | - printf("iscsiuio daemon.\n" |
| 1682 | - "-f, --foreground make the program run in the foreground\n" |
| 1683 | - "-d, --debug debuglevel print debugging information\n" |
| 1684 | -- "-p, --pid=pidfile use pid file (default %s).\n" |
| 1685 | -+ "-p, --pid pidfile use pid file (default %s).\n" |
| 1686 | - "-h, --help display this help and exit\n" |
| 1687 | - "-v, --version display version and exit\n", |
| 1688 | - default_pid_filepath); |
| 1689 | ---- a/iscsiuio/docs/iscsiuio.8 |
| 1690 | -+++ b/iscsiuio/docs/iscsiuio.8 |
| 1691 | -@@ -45,7 +45,7 @@ |
| 1692 | - .SH PARAMETERS |
| 1693 | - There are very few parameters when running this application. |
| 1694 | - .TP |
| 1695 | --.BI -d <debug level> |
| 1696 | -+.BI -d|--debug <debug level> |
| 1697 | - This is to enable debug mode where debug messages will be sent to stdout |
| 1698 | - The following debug modes are supported |
| 1699 | - .P |
| 1700 | -@@ -61,20 +61,20 @@ |
| 1701 | - .PP |
| 1702 | - .TP |
| 1703 | - .TP |
| 1704 | --.BI -f |
| 1705 | -+.BI -f|--foreground |
| 1706 | - This is to enable foreground mode so that this application doesn't get sent |
| 1707 | - into the background. |
| 1708 | - .PP |
| 1709 | - .TP |
| 1710 | --.BI -v |
| 1711 | -+.BI -v|--version |
| 1712 | - This is to print the version. |
| 1713 | - .PP |
| 1714 | - .TP |
| 1715 | --.BI -p <pidfile> |
| 1716 | -+.BI -p|--pid <pidfile> |
| 1717 | - Use pidfile (default /var/run/iscsiuio.pid ) |
| 1718 | - .PP |
| 1719 | - .TP |
| 1720 | --.BI -h |
| 1721 | -+.BI -h|--help |
| 1722 | - Display this help and exit. |
| 1723 | - |
| 1724 | - |
| 1725 | diff --git a/debian/patches/bugfixes/move_offload_discovery_to_fw_get_targets.patch b/debian/patches/bugfixes/move_offload_discovery_to_fw_get_targets.patch |
| 1726 | deleted file mode 100644 |
| 1727 | index 135db12..0000000 |
| 1728 | --- a/debian/patches/bugfixes/move_offload_discovery_to_fw_get_targets.patch |
| 1729 | +++ /dev/null |
| 1730 | @@ -1,91 +0,0 @@ |
| 1731 | -Description: Move iscsistart offload discovery/setup to fw_get_targets() |
| 1732 | -Author: Andrew Patterson <andrew.patterson@hpe.com> |
| 1733 | -Bug: https://groups.google.com/forum/?_escaped_fragment_=msg/open-iscsi/PsT65Z4$ |
| 1734 | -Bug-Debian: https://bugs.debian.org/850057 |
| 1735 | -Last-Update: 2017-01-24 |
| 1736 | ---- |
| 1737 | -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ |
| 1738 | ---- a/utils/fwparam_ibft/fw_entry.c |
| 1739 | -+++ b/utils/fwparam_ibft/fw_entry.c |
| 1740 | -@@ -64,26 +64,40 @@ |
| 1741 | - * For each target in iBFT bring up required NIC and use routing |
| 1742 | - * to force iSCSI traffic through correct NIC |
| 1743 | - */ |
| 1744 | -- list_for_each_entry(context, &targets, list) { |
| 1745 | -- /* if it is a offload nic ignore it */ |
| 1746 | -- if (!net_get_transport_name_from_netdev(context->iface, |
| 1747 | -- transport)) |
| 1748 | -- continue; |
| 1749 | -- |
| 1750 | -+ list_for_each_entry(context, &targets, list) { |
| 1751 | - if (iface_prev == NULL || strcmp(context->iface, iface_prev)) { |
| 1752 | -- /* Note: test above works because there is a |
| 1753 | -- * maximum of two targets in the iBFT |
| 1754 | -- */ |
| 1755 | -- iface_prev = context->iface; |
| 1756 | -- needs_bringup = 1; |
| 1757 | -+ /* Note: test above works because there is a |
| 1758 | -+ * maximum of two targets in the iBFT |
| 1759 | -+ */ |
| 1760 | -+ iface_prev = context->iface; |
| 1761 | -+ needs_bringup = 1; |
| 1762 | - } |
| 1763 | -+ if (net_get_transport_name_from_netdev(context->iface, transport)) { |
| 1764 | -+ /* Setup software NIC, */ |
| 1765 | -+ printf("Setting up software interface %s\n", context->iface); |
| 1766 | -+ err = net_setup_netdev(context->iface, context->ipaddr, |
| 1767 | -+ context->mask, context->gateway, |
| 1768 | -+ context->vlan, |
| 1769 | -+ context->target_ipaddr, needs_bringup); |
| 1770 | -+ if (err) { |
| 1771 | -+ printf("Setting up software interface %s failed\n", |
| 1772 | -+ context->iface); |
| 1773 | -+ ret = err; |
| 1774 | -+ } |
| 1775 | -+ } else { |
| 1776 | -+ /* Setup offload NIC. */ |
| 1777 | -+ struct iface_rec iface; |
| 1778 | -+ |
| 1779 | -+ memset(&iface, 0, sizeof(iface)); |
| 1780 | -+ iface_setup_defaults(&iface); |
| 1781 | -+ printf("Setting up offload interface %s\n", context->iface); |
| 1782 | -+ if (!iface_setup_from_boot_context(&iface, context)) { |
| 1783 | -+ printf("Setting up offload interface %s failed\n", |
| 1784 | -+ context->iface); |
| 1785 | - |
| 1786 | -- err = net_setup_netdev(context->iface, context->ipaddr, |
| 1787 | -- context->mask, context->gateway, |
| 1788 | -- context->vlan, |
| 1789 | -- context->target_ipaddr, needs_bringup); |
| 1790 | -- if (err) |
| 1791 | -- ret = err; |
| 1792 | -+ ret = ISCSI_ERR; |
| 1793 | -+ } |
| 1794 | -+ } |
| 1795 | - } |
| 1796 | - |
| 1797 | - fw_free_targets(&targets); |
| 1798 | -@@ -147,11 +161,7 @@ |
| 1799 | - |
| 1800 | - static void dump_initiator(struct boot_context *context) |
| 1801 | - { |
| 1802 | -- struct iface_rec iface; |
| 1803 | -- |
| 1804 | -- memset(&iface, 0, sizeof(iface)); |
| 1805 | -- iface_setup_defaults(&iface); |
| 1806 | -- iface_setup_from_boot_context(&iface, context); |
| 1807 | -+ char transport_name[ISCSI_TRANSPORT_NAME_MAXLEN]; |
| 1808 | - |
| 1809 | - if (strlen(context->initiatorname)) |
| 1810 | - printf("%s = %s\n", IFACE_INAME, context->initiatorname); |
| 1811 | -@@ -159,7 +169,9 @@ |
| 1812 | - if (strlen(context->isid)) |
| 1813 | - printf("%s = %s\n", IFACE_ISID, context->isid); |
| 1814 | - |
| 1815 | -- printf("%s = %s\n", IFACE_TRANSPORTNAME, iface.transport_name); |
| 1816 | -+ memset(transport_name, 0, ISCSI_TRANSPORT_NAME_MAXLEN); |
| 1817 | -+ if (!net_get_transport_name_from_netdev(context->iface, transport_name)) |
| 1818 | -+ printf("%s = %s\n", IFACE_TRANSPORTNAME, transport_name); |
| 1819 | - } |
| 1820 | - |
| 1821 | - static void dump_target(struct boot_context *context) |
| 1822 | diff --git a/debian/patches/bugfixes/need_iscsiuio_for_hardware_offload.patch b/debian/patches/bugfixes/need_iscsiuio_for_hardware_offload.patch |
| 1823 | deleted file mode 100644 |
| 1824 | index c8a1d6f..0000000 |
| 1825 | --- a/debian/patches/bugfixes/need_iscsiuio_for_hardware_offload.patch |
| 1826 | +++ /dev/null |
| 1827 | @@ -1,50 +0,0 @@ |
| 1828 | -Description: iscsiuio must be present to use hardware offload for bnx2x |
| 1829 | -Author: Andrew Patterson <andrew.patterson@hpe.com> |
| 1830 | -Bug: https://groups.google.com/forum/?_escaped_fragment_=msg/open-iscsi/PsT65Z4Gx3I/GUObdlVvCQAJ#!msg/open-iscsi/PsT65Z4Gx3I/GUObdlVvCQAJ |
| 1831 | -Bug-Debian: https://bugs.debian.org/850057 |
| 1832 | -Last-Update: 2017-01-24 |
| 1833 | ---- |
| 1834 | -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ |
| 1835 | ---- a/include/iscsi_net_util.h |
| 1836 | -+++ b/include/iscsi_net_util.h |
| 1837 | -@@ -2,6 +2,7 @@ |
| 1838 | - #define __ISCSI_NET_UTIL_h__ |
| 1839 | - |
| 1840 | - #define ISCSI_HWADDRESS_BUF_SIZE 18 |
| 1841 | -+#define ISCSIUIO_PATH "/sbin/iscsiuio" |
| 1842 | - |
| 1843 | - extern int net_get_transport_name_from_netdev(char *netdev, char *transport); |
| 1844 | - extern int net_get_netdev_from_hwaddress(char *hwaddress, char *netdev); |
| 1845 | ---- a/usr/iscsi_net_util.c |
| 1846 | -+++ b/usr/iscsi_net_util.c |
| 1847 | -@@ -27,6 +27,7 @@ |
| 1848 | - #include <sys/socket.h> |
| 1849 | - #include <sys/ioctl.h> |
| 1850 | - #include <sys/socket.h> |
| 1851 | -+#include <sys/stat.h> |
| 1852 | - #include <linux/sockios.h> |
| 1853 | - #include <linux/if_vlan.h> |
| 1854 | - #include <net/if_arp.h> |
| 1855 | -@@ -81,6 +82,22 @@ int net_get_transport_name_from_netdev(c |
| 1856 | - goto close_sock; |
| 1857 | - } |
| 1858 | - |
| 1859 | -+ /* |
| 1860 | -+ * iSCSI hardware offload for bnx2{,x} is only supported if the |
| 1861 | -+ * iscsiuio executable is available. |
| 1862 | -+ */ |
| 1863 | -+ if (!strcmp(drvinfo.driver, "bnx2x") || |
| 1864 | -+ !strcmp(drvinfo.driver, "bnx2")) { |
| 1865 | -+ struct stat buf; |
| 1866 | -+ |
| 1867 | -+ if (stat(ISCSIUIO_PATH, &buf) < 0) { |
| 1868 | -+ log_debug(1, "ISCSI offload not supported " |
| 1869 | -+ "(%s not found).", ISCSIUIO_PATH); |
| 1870 | -+ err = ENODEV; |
| 1871 | -+ goto close_sock; |
| 1872 | -+ } |
| 1873 | -+ } |
| 1874 | -+ |
| 1875 | - for (i = 0; net_drivers[i].net_drv_name != NULL; i++) { |
| 1876 | - struct iscsi_net_driver *net_driver = &net_drivers[i]; |
| 1877 | - |
| 1878 | diff --git a/debian/patches/bugfixes/no-make-clean-kernel.patch b/debian/patches/bugfixes/no-make-clean-kernel.patch |
| 1879 | deleted file mode 100644 |
| 1880 | index 0d55dca..0000000 |
| 1881 | --- a/debian/patches/bugfixes/no-make-clean-kernel.patch |
| 1882 | +++ /dev/null |
| 1883 | @@ -1,18 +0,0 @@ |
| 1884 | -Description: Don't run make -C kernel clean |
| 1885 | - The kernel modules are no longer built (part of mainline), so don't |
| 1886 | - run make -C kernel clean on make clean. |
| 1887 | -Author: Christian Seiler <christian@iwakd.de> |
| 1888 | -Forwarded: not-yet |
| 1889 | -Last-Update: 2016-07-27 |
| 1890 | ---- |
| 1891 | -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ |
| 1892 | ---- a/Makefile |
| 1893 | -+++ b/Makefile |
| 1894 | -@@ -75,7 +75,6 @@ clean: |
| 1895 | - $(MAKE) -C utils/fwparam_ibft clean |
| 1896 | - $(MAKE) -C utils clean |
| 1897 | - $(MAKE) -C usr clean |
| 1898 | -- $(MAKE) -C kernel clean |
| 1899 | - [ ! -f iscsiuio/Makefile ] || $(MAKE) -C iscsiuio clean |
| 1900 | - [ ! -f iscsiuio/Makefile ] || $(MAKE) -C iscsiuio distclean |
| 1901 | - |
| 1902 | diff --git a/debian/patches/debian/dont-link-against-openssl.patch b/debian/patches/debian/dont-link-against-openssl.patch |
| 1903 | deleted file mode 100644 |
| 1904 | index 446ebf8..0000000 |
| 1905 | --- a/debian/patches/debian/dont-link-against-openssl.patch |
| 1906 | +++ /dev/null |
| 1907 | @@ -1,27 +0,0 @@ |
| 1908 | -Description: Don't link against OpenSSL |
| 1909 | - GPL programs are legally not allowed to be linked against OpenSSL in |
| 1910 | - Debian. Link against libisns-nocrypto instead of libisns, and don't |
| 1911 | - link against libcrypto. |
| 1912 | - . |
| 1913 | - As the iSNS functionality in open-iscsi does not use the cryptographic |
| 1914 | - capabilities of open-isns anyway, this has no impact on functionality. |
| 1915 | -Author: Christian Seiler <christian@iwakd.de> |
| 1916 | -Forwarded: not-needed (Debian-specific) |
| 1917 | -Last-Update: 2016-07-27 |
| 1918 | ---- |
| 1919 | -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ |
| 1920 | ---- a/usr/Makefile |
| 1921 | -+++ b/usr/Makefile |
| 1922 | -@@ -54,10 +54,10 @@ all: $(PROGRAMS) |
| 1923 | - |
| 1924 | - iscsid: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(DISCOVERY_SRCS) \ |
| 1925 | - iscsid.o session_mgmt.o discoveryd.o mntcheck.o |
| 1926 | -- $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -lisns -lcrypto -lrt -lmount |
| 1927 | -+ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -lisns-nocrypto -lrt -lmount |
| 1928 | - |
| 1929 | - iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o session_mgmt.o mntcheck.o |
| 1930 | -- $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -lisns -lcrypto -lmount |
| 1931 | -+ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -lisns-nocrypto -lmount |
| 1932 | - |
| 1933 | - iscsistart: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \ |
| 1934 | - iscsistart.o statics.o |
| 1935 | diff --git a/debian/patches/debian/udeb-without-libmount.patch b/debian/patches/debian/udeb-without-libmount.patch |
| 1936 | deleted file mode 100644 |
| 1937 | index de5b3fb..0000000 |
| 1938 | --- a/debian/patches/debian/udeb-without-libmount.patch |
| 1939 | +++ /dev/null |
| 1940 | @@ -1,115 +0,0 @@ |
| 1941 | -Description: Temporarily support builds without libmount |
| 1942 | - libmount is not available as an udeb at the moment, so in order for |
| 1943 | - the udeb not to break, temporarily support builds without libmount |
| 1944 | - for d-i environments (removing the safety check at session shutdown). |
| 1945 | - This is not intended for upstream, only as a stop-gap measure until |
| 1946 | - a libmount udeb is available again. |
| 1947 | -Forwarded: no |
| 1948 | -Author: Christian Seiler <christian@iwakd.de> |
| 1949 | -Bug-Debian: https://bugs.debian.org/834241 |
| 1950 | -Last-Update: 2016-08-14 |
| 1951 | ---- |
| 1952 | -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ |
| 1953 | ---- a/usr/Makefile |
| 1954 | -+++ b/usr/Makefile |
| 1955 | -@@ -33,6 +33,8 @@ WARNFLAGS ?= -Wall -Wstrict-prototypes |
| 1956 | - CFLAGS += $(WARNFLAGS) -I../include -I. -D$(OSNAME) $(IPC_CFLAGS) |
| 1957 | - PROGRAMS = iscsid iscsiadm iscsistart |
| 1958 | - |
| 1959 | -+LIBMOUNT_LIB = -lmount |
| 1960 | -+ |
| 1961 | - # libc compat files |
| 1962 | - SYSDEPS_SRCS = $(sort $(wildcard ../utils/sysdeps/*.o)) |
| 1963 | - # sources shared between iscsid, iscsiadm and iscsistart |
| 1964 | -@@ -54,10 +56,10 @@ all: $(PROGRAMS) |
| 1965 | - |
| 1966 | - iscsid: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(DISCOVERY_SRCS) \ |
| 1967 | - iscsid.o session_mgmt.o discoveryd.o mntcheck.o |
| 1968 | -- $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -lisns-nocrypto -lrt -lmount |
| 1969 | -+ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -lisns-nocrypto -lrt $(LIBMOUNT_LIB) |
| 1970 | - |
| 1971 | - iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o session_mgmt.o mntcheck.o |
| 1972 | -- $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -lisns-nocrypto -lmount |
| 1973 | -+ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -lisns-nocrypto $(LIBMOUNT_LIB) |
| 1974 | - |
| 1975 | - iscsistart: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \ |
| 1976 | - iscsistart.o statics.o |
| 1977 | ---- a/usr/initiator_common.c |
| 1978 | -+++ b/usr/initiator_common.c |
| 1979 | -@@ -24,7 +24,9 @@ |
| 1980 | - #include <stdlib.h> |
| 1981 | - #include <errno.h> |
| 1982 | - #include <dirent.h> |
| 1983 | -+#ifndef NO_LIBMOUNT |
| 1984 | - #include <libmount/libmount.h> |
| 1985 | -+#endif |
| 1986 | - |
| 1987 | - #include "initiator.h" |
| 1988 | - #include "transport.h" |
| 1989 | ---- a/usr/mntcheck.c |
| 1990 | -+++ b/usr/mntcheck.c |
| 1991 | -@@ -22,7 +22,9 @@ |
| 1992 | - #include <stdlib.h> |
| 1993 | - #include <errno.h> |
| 1994 | - #include <dirent.h> |
| 1995 | -+#ifndef NO_LIBMOUNT |
| 1996 | - #include <libmount/libmount.h> |
| 1997 | -+#endif |
| 1998 | - |
| 1999 | - #include "initiator.h" |
| 2000 | - #include "transport.h" |
| 2001 | -@@ -37,6 +39,7 @@ |
| 2002 | - #include "iscsi_err.h" |
| 2003 | - #include "iscsi_net_util.h" |
| 2004 | - |
| 2005 | -+#ifndef NO_LIBMOUNT |
| 2006 | - static struct libmnt_table *mtab, *swaps; |
| 2007 | - static struct libmnt_cache *mntcache; |
| 2008 | - |
| 2009 | -@@ -66,6 +69,7 @@ static int libmount_init(void) |
| 2010 | - mnt_table_parse_swaps(swaps, NULL); |
| 2011 | - return 0; |
| 2012 | - } |
| 2013 | -+#endif |
| 2014 | - |
| 2015 | - static int trans_filter(const struct dirent *d) |
| 2016 | - { |
| 2017 | -@@ -97,6 +101,7 @@ static int is_partition(const char *path |
| 2018 | - |
| 2019 | - static int blockdev_check_mnts(char *syspath) |
| 2020 | - { |
| 2021 | -+#ifndef NO_LIBMOUNT |
| 2022 | - struct libmnt_fs *fs; |
| 2023 | - char *devname = NULL; |
| 2024 | - char *_devname = NULL; |
| 2025 | -@@ -123,6 +128,9 @@ out: |
| 2026 | - free(devname); |
| 2027 | - free(_devname); |
| 2028 | - return rc; |
| 2029 | -+#else |
| 2030 | -+ return 0; |
| 2031 | -+#endif |
| 2032 | - } |
| 2033 | - |
| 2034 | - static int count_device_users(char *syspath); |
| 2035 | -@@ -218,16 +226,20 @@ int session_in_use(int sid) |
| 2036 | - int host_no = -1, err = 0; |
| 2037 | - int count = 0; |
| 2038 | - |
| 2039 | -+#ifndef NO_LIBMOUNT |
| 2040 | - if (libmount_init()) { |
| 2041 | - log_error("Failed to initialize libmount, " |
| 2042 | - "not checking for active mounts on session [%d].", sid); |
| 2043 | - return 0; |
| 2044 | - } |
| 2045 | -+#endif |
| 2046 | - |
| 2047 | - host_no = iscsi_sysfs_get_host_no_from_sid(sid, &err); |
| 2048 | - if (!err) |
| 2049 | - iscsi_sysfs_for_each_device(&count, host_no, sid, device_in_use); |
| 2050 | - |
| 2051 | -+#ifndef NO_LIBMOUNT |
| 2052 | - libmount_cleanup(); |
| 2053 | -+#endif |
| 2054 | - return count; |
| 2055 | - } |
| 2056 | diff --git a/debian/patches/debian/var-run-lock.patch b/debian/patches/debian/var-run-lock.patch |
| 2057 | deleted file mode 100644 |
| 2058 | index 69e756c..0000000 |
| 2059 | --- a/debian/patches/debian/var-run-lock.patch |
| 2060 | +++ /dev/null |
| 2061 | @@ -1,39 +0,0 @@ |
| 2062 | -Description: Move from /var/lock and /var/run to /run/lock and /run |
| 2063 | -Author: Stéphane Graber <stgraber@ubuntu.com> |
| 2064 | - |
| 2065 | ---- a/doc/iscsid.8 |
| 2066 | -+++ b/doc/iscsid.8 |
| 2067 | -@@ -40,7 +40,7 @@ do not write a process ID file. |
| 2068 | - .TP |
| 2069 | - .BI [-p|--pid=]\fIpid\-file\fP |
| 2070 | - write process ID to \fIpid\-file\fR rather than the default |
| 2071 | --\fI/var/run/iscsid.pid\fR |
| 2072 | -+\fI/run/iscsid.pid\fR |
| 2073 | - .TP |
| 2074 | - .BI [-h|--help] |
| 2075 | - display this help and exit |
| 2076 | ---- a/usr/initiator.h |
| 2077 | -+++ b/usr/initiator.h |
| 2078 | -@@ -38,9 +38,9 @@ |
| 2079 | - #define CONFIG_FILE ISCSI_CONFIG_ROOT"iscsid.conf" |
| 2080 | - #define INITIATOR_NAME_FILE ISCSI_CONFIG_ROOT"initiatorname.iscsi" |
| 2081 | - |
| 2082 | --#define PID_FILE "/var/run/iscsid.pid" |
| 2083 | -+#define PID_FILE "/run/iscsid.pid" |
| 2084 | - #ifndef LOCK_DIR |
| 2085 | --#define LOCK_DIR "/var/lock/iscsi" |
| 2086 | -+#define LOCK_DIR "/run/lock/iscsi" |
| 2087 | - #endif |
| 2088 | - #define LOCK_FILE LOCK_DIR"/lock" |
| 2089 | - #define LOCK_WRITE_FILE LOCK_DIR"/lock.write" |
| 2090 | ---- a/iscsiuio/src/unix/main.c |
| 2091 | -+++ b/iscsiuio/src/unix/main.c |
| 2092 | -@@ -76,7 +76,7 @@ |
| 2093 | - ******************************************************************************/ |
| 2094 | - #define PFX "main " |
| 2095 | - |
| 2096 | --static const char default_pid_filepath[] = "/var/run/iscsiuio.pid"; |
| 2097 | -+static const char default_pid_filepath[] = "/run/iscsiuio.pid"; |
| 2098 | - |
| 2099 | - /******************************************************************************* |
| 2100 | - * Global Variables |
| 2101 | diff --git a/debian/patches/include-sys-sysmacros.h-to-properly-define-minor.patch b/debian/patches/include-sys-sysmacros.h-to-properly-define-minor.patch |
| 2102 | deleted file mode 100644 |
| 2103 | index 857acd2..0000000 |
| 2104 | --- a/debian/patches/include-sys-sysmacros.h-to-properly-define-minor.patch |
| 2105 | +++ /dev/null |
| 2106 | @@ -1,27 +0,0 @@ |
| 2107 | -Description: Include <sys/sysmacros.h> to properly define minor() |
| 2108 | -Origin: upstream, https://github.com/open-iscsi/open-iscsi/commit/6d68ef5871c94c6ebbbe6e6b1fe0bc2dce711052 |
| 2109 | - |
| 2110 | -Index: open-iscsi/iscsiuio/src/unix/libs/bnx2x.c |
| 2111 | -=================================================================== |
| 2112 | ---- open-iscsi.orig/iscsiuio/src/unix/libs/bnx2x.c |
| 2113 | -+++ open-iscsi/iscsiuio/src/unix/libs/bnx2x.c |
| 2114 | -@@ -50,6 +50,7 @@ |
| 2115 | - #include <sys/user.h> |
| 2116 | - #include <fcntl.h> |
| 2117 | - #include <unistd.h> |
| 2118 | -+#include <sys/sysmacros.h> |
| 2119 | - |
| 2120 | - #include "config.h" |
| 2121 | - |
| 2122 | -Index: open-iscsi/iscsiuio/src/unix/libs/bnx2.c |
| 2123 | -=================================================================== |
| 2124 | ---- open-iscsi.orig/iscsiuio/src/unix/libs/bnx2.c |
| 2125 | -+++ open-iscsi/iscsiuio/src/unix/libs/bnx2.c |
| 2126 | -@@ -46,6 +46,7 @@ |
| 2127 | - #include <sys/user.h> |
| 2128 | - #include <fcntl.h> |
| 2129 | - #include <unistd.h> |
| 2130 | -+#include <sys/sysmacros.h> |
| 2131 | - |
| 2132 | - #include "config.h" |
| 2133 | - |
| 2134 | diff --git a/debian/patches/lp1755858-default-iscsid_conf-to-iscsid_socket.patch b/debian/patches/lp1755858-default-iscsid_conf-to-iscsid_socket.patch |
| 2135 | new file mode 100644 |
| 2136 | index 0000000..af236fd |
| 2137 | --- /dev/null |
| 2138 | +++ b/debian/patches/lp1755858-default-iscsid_conf-to-iscsid_socket.patch |
| 2139 | @@ -0,0 +1,30 @@ |
| 2140 | +Description: default in iscid.conf to use iscsid.socket |
| 2141 | + |
| 2142 | +People do not want iscsid to run if not needed. |
| 2143 | +To do so it is configured to be socket activated. |
| 2144 | +Internally iscsid code has a fallback if the service is missing to run the |
| 2145 | +command specified in iscsid.conf as "iscsid.startup". |
| 2146 | +Set this to ensure the socket is active instead of calling the binary, which |
| 2147 | +would not be what we want anyway as it would not be from the .service context. |
| 2148 | + |
| 2149 | +Forwarded: no (Downstream config) |
| 2150 | +Author: Christian Ehrhardt <christian.ehrhardt@canonical.com> |
| 2151 | +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1755858 |
| 2152 | +Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com> |
| 2153 | +Last-Update: 2020-08-13 |
| 2154 | + |
| 2155 | +--- open-iscsi-2.1.1.orig/etc/iscsid.conf |
| 2156 | ++++ open-iscsi-2.1.1/etc/iscsid.conf |
| 2157 | +@@ -18,9 +18,9 @@ |
| 2158 | + # maintainers. If you leave the iscsid daemon running all |
| 2159 | + # the time then leave this attribute commented out. |
| 2160 | + # |
| 2161 | +-# Default for Fedora and RHEL. (uncomment to activate). |
| 2162 | +-# iscsid.startup = /bin/systemctl start iscsid.socket iscsiuio.soccket |
| 2163 | +-# |
| 2164 | ++# iscsid.startup = /bin/systemctl start iscsid.socket iscsiuio.socket |
| 2165 | ++iscsid.startup = /bin/systemctl start iscsid.socket |
| 2166 | ++# |
| 2167 | + # Default if you are not using systemd (uncomment to activate) |
| 2168 | + # iscsid.startup = /usr/bin/service start iscsid |
| 2169 | + |
| 2170 | diff --git a/debian/patches/security/Check-for-root-peer-user-for-iscsiuio-IPC.patch b/debian/patches/security/Check-for-root-peer-user-for-iscsiuio-IPC.patch |
| 2171 | deleted file mode 100644 |
| 2172 | index c484703..0000000 |
| 2173 | --- a/debian/patches/security/Check-for-root-peer-user-for-iscsiuio-IPC.patch |
| 2174 | +++ /dev/null |
| 2175 | @@ -1,122 +0,0 @@ |
| 2176 | -From e313bd648a4c8a9526421e270eb597a5de1e0c7f Mon Sep 17 00:00:00 2001 |
| 2177 | -From: Lee Duncan <lduncan@suse.com> |
| 2178 | -Date: Fri, 15 Dec 2017 10:36:11 -0800 |
| 2179 | -Subject: [PATCH 1/8] Check for root peer user for iscsiuio IPC |
| 2180 | - |
| 2181 | -This fixes a possible vulnerability where a non-root |
| 2182 | -process could connect with iscsiuio. Fouund by Qualsys. |
| 2183 | ---- |
| 2184 | - iscsiuio/src/unix/Makefile.am | 3 ++- |
| 2185 | - iscsiuio/src/unix/iscsid_ipc.c | 47 ++++++++++++++++++++++++++++++++++++++++++ |
| 2186 | - 2 files changed, 49 insertions(+), 1 deletion(-) |
| 2187 | - |
| 2188 | ---- a/iscsiuio/src/unix/Makefile.am |
| 2189 | -+++ b/iscsiuio/src/unix/Makefile.am |
| 2190 | -@@ -20,7 +20,8 @@ iscsiuio_SOURCES = build_date.c \ |
| 2191 | - nic_utils.c \ |
| 2192 | - packet.c \ |
| 2193 | - iscsid_ipc.c \ |
| 2194 | -- ping.c |
| 2195 | -+ ping.c \ |
| 2196 | -+ ${top_srcdir}/../utils/sysdeps/sysdeps.c |
| 2197 | - |
| 2198 | - iscsiuio_CFLAGS = $(AM_CFLAGS) \ |
| 2199 | - $(LIBNL_CFLAGS) \ |
| 2200 | ---- a/iscsiuio/src/unix/iscsid_ipc.c |
| 2201 | -+++ b/iscsiuio/src/unix/iscsid_ipc.c |
| 2202 | -@@ -37,6 +37,8 @@ |
| 2203 | - * |
| 2204 | - */ |
| 2205 | - |
| 2206 | -+#define _GNU_SOURCE |
| 2207 | -+ |
| 2208 | - #include <errno.h> |
| 2209 | - #include <pthread.h> |
| 2210 | - #include <signal.h> |
| 2211 | -@@ -47,6 +49,8 @@ |
| 2212 | - #include <sys/socket.h> |
| 2213 | - #include <sys/time.h> |
| 2214 | - #include <sys/un.h> |
| 2215 | -+#include <sys/types.h> |
| 2216 | -+#include <pwd.h> |
| 2217 | - |
| 2218 | - #define PFX "iscsi_ipc " |
| 2219 | - |
| 2220 | -@@ -61,6 +65,7 @@ |
| 2221 | - #include "iscsid_ipc.h" |
| 2222 | - #include "uip.h" |
| 2223 | - #include "uip_mgmt_ipc.h" |
| 2224 | -+#include "sysdeps.h" |
| 2225 | - |
| 2226 | - #include "logger.h" |
| 2227 | - #include "uip.h" |
| 2228 | -@@ -102,6 +107,7 @@ struct iface_rec_decode { |
| 2229 | - uint16_t mtu; |
| 2230 | - }; |
| 2231 | - |
| 2232 | -+#define PEERUSER_MAX 64 |
| 2233 | - |
| 2234 | - /****************************************************************************** |
| 2235 | - * iscsid_ipc Constants |
| 2236 | -@@ -1029,6 +1035,40 @@ static void iscsid_loop_close(void *arg) |
| 2237 | - LOG_INFO(PFX "iSCSI daemon socket closed"); |
| 2238 | - } |
| 2239 | - |
| 2240 | -+/* |
| 2241 | -+ * check that the peer user is privilidged |
| 2242 | -+ * |
| 2243 | -+ * return 1 if peer is ok else 0 |
| 2244 | -+ * |
| 2245 | -+ * XXX: this function is copied from iscsid_ipc.c and should be |
| 2246 | -+ * moved into a common library |
| 2247 | -+ */ |
| 2248 | -+static int |
| 2249 | -+mgmt_peeruser(int sock, char *user) |
| 2250 | -+{ |
| 2251 | -+ struct ucred peercred; |
| 2252 | -+ socklen_t so_len = sizeof(peercred); |
| 2253 | -+ struct passwd *pass; |
| 2254 | -+ |
| 2255 | -+ errno = 0; |
| 2256 | -+ if (getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &peercred, |
| 2257 | -+ &so_len) != 0 || so_len != sizeof(peercred)) { |
| 2258 | -+ /* We didn't get a valid credentials struct. */ |
| 2259 | -+ LOG_ERR(PFX "peeruser_unux: error receiving credentials: %m"); |
| 2260 | -+ return 0; |
| 2261 | -+ } |
| 2262 | -+ |
| 2263 | -+ pass = getpwuid(peercred.uid); |
| 2264 | -+ if (pass == NULL) { |
| 2265 | -+ LOG_ERR(PFX "peeruser_unix: unknown local user with uid %d", |
| 2266 | -+ (int) peercred.uid); |
| 2267 | -+ return 0; |
| 2268 | -+ } |
| 2269 | -+ |
| 2270 | -+ strlcpy(user, pass->pw_name, PEERUSER_MAX); |
| 2271 | -+ return 1; |
| 2272 | -+} |
| 2273 | -+ |
| 2274 | - /** |
| 2275 | - * iscsid_loop() - This is the function which will process the broadcast |
| 2276 | - * messages from iscsid |
| 2277 | -@@ -1038,6 +1078,7 @@ static void *iscsid_loop(void *arg) |
| 2278 | - { |
| 2279 | - int rc; |
| 2280 | - sigset_t set; |
| 2281 | -+ char user[PEERUSER_MAX]; |
| 2282 | - |
| 2283 | - pthread_cleanup_push(iscsid_loop_close, arg); |
| 2284 | - |
| 2285 | -@@ -1077,6 +1118,12 @@ static void *iscsid_loop(void *arg) |
| 2286 | - continue; |
| 2287 | - } |
| 2288 | - |
| 2289 | -+ if (!mgmt_peeruser(iscsid_opts.fd, user) || strncmp(user, "root", PEERUSER_MAX)) { |
| 2290 | -+ close(s2); |
| 2291 | -+ LOG_ERR(PFX "Access error: non-administrative connection rejected"); |
| 2292 | -+ break; |
| 2293 | -+ } |
| 2294 | -+ |
| 2295 | - process_iscsid_broadcast(s2); |
| 2296 | - close(s2); |
| 2297 | - } |
| 2298 | diff --git a/debian/patches/security/Check-iscsiuio-ping-data-length-for-validity.patch b/debian/patches/security/Check-iscsiuio-ping-data-length-for-validity.patch |
| 2299 | deleted file mode 100644 |
| 2300 | index 170f8a5..0000000 |
| 2301 | --- a/debian/patches/security/Check-iscsiuio-ping-data-length-for-validity.patch |
| 2302 | +++ /dev/null |
| 2303 | @@ -1,49 +0,0 @@ |
| 2304 | -From 59ede2cf4eee8729a4221000a5d1ecdd312a31ac Mon Sep 17 00:00:00 2001 |
| 2305 | -From: Lee Duncan <lduncan@suse.com> |
| 2306 | -Date: Fri, 15 Dec 2017 11:21:15 -0800 |
| 2307 | -Subject: [PATCH 7/8] Check iscsiuio ping data length for validity |
| 2308 | - |
| 2309 | -We do not trust that the received ping packet data length |
| 2310 | -is correct, so sanity check it. Found by Qualsys. |
| 2311 | ---- |
| 2312 | - iscsiuio/src/unix/iscsid_ipc.c | 5 +++++ |
| 2313 | - iscsiuio/src/unix/packet.c | 2 +- |
| 2314 | - iscsiuio/src/unix/packet.h | 2 ++ |
| 2315 | - 3 files changed, 8 insertions(+), 1 deletion(-) |
| 2316 | - |
| 2317 | ---- a/iscsiuio/src/unix/iscsid_ipc.c |
| 2318 | -+++ b/iscsiuio/src/unix/iscsid_ipc.c |
| 2319 | -@@ -333,6 +333,11 @@ static void *perform_ping(void *arg) |
| 2320 | - |
| 2321 | - data = (iscsid_uip_broadcast_t *)png_c->data; |
| 2322 | - datalen = data->u.ping_rec.datalen; |
| 2323 | -+ if ((datalen > STD_MTU_SIZE) || (datalen < 0)) { |
| 2324 | -+ LOG_ERR(PFX "Ping datalen invalid: %d", datalen); |
| 2325 | -+ rc = -EINVAL; |
| 2326 | -+ goto ping_done; |
| 2327 | -+ } |
| 2328 | - |
| 2329 | - memset(dst_addr, 0, sizeof(uip_ip6addr_t)); |
| 2330 | - if (nic_iface->protocol == AF_INET) { |
| 2331 | ---- a/iscsiuio/src/unix/packet.c |
| 2332 | -+++ b/iscsiuio/src/unix/packet.c |
| 2333 | -@@ -112,7 +112,7 @@ int alloc_free_queue(nic_t *nic, size_t |
| 2334 | - for (i = 0; i < num_of_packets; i++) { |
| 2335 | - packet_t *pkt; |
| 2336 | - |
| 2337 | -- pkt = alloc_packet(1500, 1500); |
| 2338 | -+ pkt = alloc_packet(STD_MTU_SIZE, STD_MTU_SIZE); |
| 2339 | - if (pkt == NULL) { |
| 2340 | - goto done; |
| 2341 | - } |
| 2342 | ---- a/iscsiuio/src/unix/packet.h |
| 2343 | -+++ b/iscsiuio/src/unix/packet.h |
| 2344 | -@@ -43,6 +43,8 @@ |
| 2345 | - |
| 2346 | - #include "nic.h" |
| 2347 | - |
| 2348 | -+#define STD_MTU_SIZE 1500 |
| 2349 | -+ |
| 2350 | - struct nic; |
| 2351 | - struct nic_interface; |
| 2352 | - |
| 2353 | diff --git a/debian/patches/security/Do-not-double-close-IPC-file-stream-to-iscsid.patch b/debian/patches/security/Do-not-double-close-IPC-file-stream-to-iscsid.patch |
| 2354 | deleted file mode 100644 |
| 2355 | index 68f1ea4..0000000 |
| 2356 | --- a/debian/patches/security/Do-not-double-close-IPC-file-stream-to-iscsid.patch |
| 2357 | +++ /dev/null |
| 2358 | @@ -1,51 +0,0 @@ |
| 2359 | -From 5504053cc08df38d8d85032fa1691e363dfcfb92 Mon Sep 17 00:00:00 2001 |
| 2360 | -From: Lee Duncan <lduncan@suse.com> |
| 2361 | -Date: Fri, 15 Dec 2017 11:13:29 -0800 |
| 2362 | -Subject: [PATCH 4/8] Do not double-close IPC file stream to iscsid |
| 2363 | - |
| 2364 | -A double-close of a file descriptor and its associated FILE stream |
| 2365 | -can be an issue in multi-threaded cases. Found by Qualsys. |
| 2366 | ---- |
| 2367 | - iscsiuio/src/unix/iscsid_ipc.c | 9 +++++++-- |
| 2368 | - 1 file changed, 7 insertions(+), 2 deletions(-) |
| 2369 | - |
| 2370 | ---- a/iscsiuio/src/unix/iscsid_ipc.c |
| 2371 | -+++ b/iscsiuio/src/unix/iscsid_ipc.c |
| 2372 | -@@ -913,6 +913,9 @@ early_exit: |
| 2373 | - /** |
| 2374 | - * process_iscsid_broadcast() - This function is used to process the |
| 2375 | - * broadcast messages from iscsid |
| 2376 | -+ * |
| 2377 | -+ * s2 is an open file descriptor, which |
| 2378 | -+ * must not be left open upon return |
| 2379 | - */ |
| 2380 | - int process_iscsid_broadcast(int s2) |
| 2381 | - { |
| 2382 | -@@ -928,6 +931,7 @@ int process_iscsid_broadcast(int s2) |
| 2383 | - if (fd == NULL) { |
| 2384 | - LOG_ERR(PFX "Couldn't open file descriptor: %d(%s)", |
| 2385 | - errno, strerror(errno)); |
| 2386 | -+ close(s2); |
| 2387 | - return -EIO; |
| 2388 | - } |
| 2389 | - |
| 2390 | -@@ -1030,7 +1034,8 @@ int process_iscsid_broadcast(int s2) |
| 2391 | - } |
| 2392 | - |
| 2393 | - error: |
| 2394 | -- free(data); |
| 2395 | -+ if (data) |
| 2396 | -+ free(data); |
| 2397 | - fclose(fd); |
| 2398 | - |
| 2399 | - return rc; |
| 2400 | -@@ -1132,8 +1137,8 @@ static void *iscsid_loop(void *arg) |
| 2401 | - break; |
| 2402 | - } |
| 2403 | - |
| 2404 | -+ /* this closes the file descriptor s2 */ |
| 2405 | - process_iscsid_broadcast(s2); |
| 2406 | -- close(s2); |
| 2407 | - } |
| 2408 | - |
| 2409 | - pthread_cleanup_pop(0); |
| 2410 | diff --git a/debian/patches/security/Ensure-all-fields-in-iscsiuio-IPC-response-are-set.patch b/debian/patches/security/Ensure-all-fields-in-iscsiuio-IPC-response-are-set.patch |
| 2411 | deleted file mode 100644 |
| 2412 | index 50884d0..0000000 |
| 2413 | --- a/debian/patches/security/Ensure-all-fields-in-iscsiuio-IPC-response-are-set.patch |
| 2414 | +++ /dev/null |
| 2415 | @@ -1,23 +0,0 @@ |
| 2416 | -From be58eed849f5457bb49b79e94aa6a26971ba6deb Mon Sep 17 00:00:00 2001 |
| 2417 | -From: Lee Duncan <lduncan@suse.com> |
| 2418 | -Date: Fri, 15 Dec 2017 11:11:17 -0800 |
| 2419 | -Subject: [PATCH 3/8] Ensure all fields in iscsiuio IPC response are set |
| 2420 | - |
| 2421 | -Make sure all fields in the response strcuture are set, |
| 2422 | -or info from the stack can be leaked to our caller. |
| 2423 | -Found by Qualsys. |
| 2424 | ---- |
| 2425 | - iscsiuio/src/unix/iscsid_ipc.c | 2 ++ |
| 2426 | - 1 file changed, 2 insertions(+) |
| 2427 | - |
| 2428 | ---- a/iscsiuio/src/unix/iscsid_ipc.c |
| 2429 | -+++ b/iscsiuio/src/unix/iscsid_ipc.c |
| 2430 | -@@ -960,6 +960,8 @@ int process_iscsid_broadcast(int s2) |
| 2431 | - LOG_DEBUG(PFX "recv iscsid request: cmd: %d, payload_len: %d", |
| 2432 | - cmd, payload_len); |
| 2433 | - |
| 2434 | -+ memset(&rsp, 0, sizeof(rsp)); |
| 2435 | -+ |
| 2436 | - switch (cmd) { |
| 2437 | - case ISCSID_UIP_IPC_GET_IFACE: |
| 2438 | - size = fread(&data->u.iface_rec, payload_len, 1, fd); |
| 2439 | diff --git a/debian/patches/security/Ensure-strings-from-peer-are-copied-correctly.patch b/debian/patches/security/Ensure-strings-from-peer-are-copied-correctly.patch |
| 2440 | deleted file mode 100644 |
| 2441 | index a1e04d3..0000000 |
| 2442 | --- a/debian/patches/security/Ensure-strings-from-peer-are-copied-correctly.patch |
| 2443 | +++ /dev/null |
| 2444 | @@ -1,67 +0,0 @@ |
| 2445 | -From 85f647c4300a888bb6cbc27f33138549cab617e3 Mon Sep 17 00:00:00 2001 |
| 2446 | -From: Lee Duncan <lduncan@suse.com> |
| 2447 | -Date: Fri, 15 Dec 2017 11:15:26 -0800 |
| 2448 | -Subject: [PATCH 5/8] Ensure strings from peer are copied correctly. |
| 2449 | - |
| 2450 | -The method of using strlen() and strcpy()/strncpy() has |
| 2451 | -a couple of holes. Do not try to measure the length of |
| 2452 | -strings supplied from peer, and ensure copied strings are |
| 2453 | -NULL-terminated. Use the new strlcpy() instead. |
| 2454 | -Found by Qualsys. |
| 2455 | ---- |
| 2456 | - iscsiuio/src/unix/iscsid_ipc.c | 24 ++++++------------------ |
| 2457 | - 1 file changed, 6 insertions(+), 18 deletions(-) |
| 2458 | - |
| 2459 | ---- a/iscsiuio/src/unix/iscsid_ipc.c |
| 2460 | -+++ b/iscsiuio/src/unix/iscsid_ipc.c |
| 2461 | -@@ -152,10 +152,7 @@ static int decode_cidr(char *in_ipaddr_s |
| 2462 | - struct in_addr ia; |
| 2463 | - struct in6_addr ia6; |
| 2464 | - |
| 2465 | -- if (strlen(in_ipaddr_str) > NI_MAXHOST) |
| 2466 | -- strncpy(ipaddr_str, in_ipaddr_str, NI_MAXHOST); |
| 2467 | -- else |
| 2468 | -- strcpy(ipaddr_str, in_ipaddr_str); |
| 2469 | -+ strlcpy(ipaddr_str, in_ipaddr_str, NI_MAXHOST); |
| 2470 | - |
| 2471 | - /* Find the CIDR if any */ |
| 2472 | - tmp = strchr(ipaddr_str, '/'); |
| 2473 | -@@ -287,22 +284,16 @@ static int decode_iface(struct iface_rec |
| 2474 | - |
| 2475 | - /* For LL on, ignore the IPv6 addr in the iface */ |
| 2476 | - if (ird->linklocal_autocfg == IPV6_LL_AUTOCFG_OFF) { |
| 2477 | -- if (strlen(rec->ipv6_linklocal) > NI_MAXHOST) |
| 2478 | -- strncpy(ipaddr_str, rec->ipv6_linklocal, |
| 2479 | -- NI_MAXHOST); |
| 2480 | -- else |
| 2481 | -- strcpy(ipaddr_str, rec->ipv6_linklocal); |
| 2482 | -+ strlcpy(ipaddr_str, rec->ipv6_linklocal, |
| 2483 | -+ NI_MAXHOST); |
| 2484 | - inet_pton(AF_INET6, ipaddr_str, |
| 2485 | - &ird->ipv6_linklocal); |
| 2486 | - } |
| 2487 | - |
| 2488 | - /* For RTR on, ignore the IPv6 addr in the iface */ |
| 2489 | - if (ird->router_autocfg == IPV6_RTR_AUTOCFG_OFF) { |
| 2490 | -- if (strlen(rec->ipv6_router) > NI_MAXHOST) |
| 2491 | -- strncpy(ipaddr_str, rec->ipv6_router, |
| 2492 | -- NI_MAXHOST); |
| 2493 | -- else |
| 2494 | -- strcpy(ipaddr_str, rec->ipv6_router); |
| 2495 | -+ strlcpy(ipaddr_str, rec->ipv6_router, |
| 2496 | -+ NI_MAXHOST); |
| 2497 | - inet_pton(AF_INET6, ipaddr_str, |
| 2498 | - &ird->ipv6_router); |
| 2499 | - } |
| 2500 | -@@ -316,10 +307,7 @@ static int decode_iface(struct iface_rec |
| 2501 | - calculate_default_netmask( |
| 2502 | - ird->ipv4_addr.s_addr); |
| 2503 | - |
| 2504 | -- if (strlen(rec->gateway) > NI_MAXHOST) |
| 2505 | -- strncpy(ipaddr_str, rec->gateway, NI_MAXHOST); |
| 2506 | -- else |
| 2507 | -- strcpy(ipaddr_str, rec->gateway); |
| 2508 | -+ strlcpy(ipaddr_str, rec->gateway, NI_MAXHOST); |
| 2509 | - inet_pton(AF_INET, ipaddr_str, &ird->ipv4_gateway); |
| 2510 | - } |
| 2511 | - } else { |
| 2512 | diff --git a/debian/patches/security/Skip-useless-strcopy-and-validate-CIDR-length.patch b/debian/patches/security/Skip-useless-strcopy-and-validate-CIDR-length.patch |
| 2513 | deleted file mode 100644 |
| 2514 | index 26efcf1..0000000 |
| 2515 | --- a/debian/patches/security/Skip-useless-strcopy-and-validate-CIDR-length.patch |
| 2516 | +++ /dev/null |
| 2517 | @@ -1,33 +0,0 @@ |
| 2518 | -From a7a96131bd2ea342f6def0e46be514baf8037ae8 Mon Sep 17 00:00:00 2001 |
| 2519 | -From: Lee Duncan <lduncan@suse.com> |
| 2520 | -Date: Fri, 15 Dec 2017 11:18:35 -0800 |
| 2521 | -Subject: [PATCH 6/8] Skip useless strcopy, and validate CIDR length |
| 2522 | - |
| 2523 | -Remove a useless strcpy() that copies a string onto itself, |
| 2524 | -and ensure the CIDR length "keepbits" is not negative. |
| 2525 | -Found by Qualsys. |
| 2526 | ---- |
| 2527 | - iscsiuio/src/unix/iscsid_ipc.c | 5 ++--- |
| 2528 | - 1 file changed, 2 insertions(+), 3 deletions(-) |
| 2529 | - |
| 2530 | ---- a/iscsiuio/src/unix/iscsid_ipc.c |
| 2531 | -+++ b/iscsiuio/src/unix/iscsid_ipc.c |
| 2532 | -@@ -148,7 +148,7 @@ static int decode_cidr(char *in_ipaddr_s |
| 2533 | - char *tmp, *tok; |
| 2534 | - char ipaddr_str[NI_MAXHOST]; |
| 2535 | - char str[INET6_ADDRSTRLEN]; |
| 2536 | -- int keepbits = 0; |
| 2537 | -+ unsigned long keepbits = 0; |
| 2538 | - struct in_addr ia; |
| 2539 | - struct in6_addr ia6; |
| 2540 | - |
| 2541 | -@@ -161,8 +161,7 @@ static int decode_cidr(char *in_ipaddr_s |
| 2542 | - tmp = ipaddr_str; |
| 2543 | - tok = strsep(&tmp, "/"); |
| 2544 | - LOG_INFO(PFX "in cidr: bitmask '%s' ip '%s'", tmp, tok); |
| 2545 | -- keepbits = atoi(tmp); |
| 2546 | -- strcpy(ipaddr_str, tok); |
| 2547 | -+ keepbits = strtoull(tmp, NULL, 10); |
| 2548 | - } |
| 2549 | - |
| 2550 | - /* Determine if the IP address passed from the iface file is |
| 2551 | diff --git a/debian/patches/security/iscsiuio-should-ignore-bogus-iscsid-broadcast-packet.patch b/debian/patches/security/iscsiuio-should-ignore-bogus-iscsid-broadcast-packet.patch |
| 2552 | deleted file mode 100644 |
| 2553 | index 46a9ea5..0000000 |
| 2554 | --- a/debian/patches/security/iscsiuio-should-ignore-bogus-iscsid-broadcast-packet.patch |
| 2555 | +++ /dev/null |
| 2556 | @@ -1,28 +0,0 @@ |
| 2557 | -From b9c33683bdc0aed28ffe31c3f3d50bf5cdf519ea Mon Sep 17 00:00:00 2001 |
| 2558 | -From: Lee Duncan <lduncan@suse.com> |
| 2559 | -Date: Fri, 15 Dec 2017 10:37:56 -0800 |
| 2560 | -Subject: [PATCH 2/8] iscsiuio should ignore bogus iscsid broadcast packets |
| 2561 | - |
| 2562 | -When iscsiuio is receiving broadcast packets from iscsid, |
| 2563 | -if the 'payload_len', carried in the packet, is too |
| 2564 | -large then ignore the packet and print a message. |
| 2565 | -Found by Qualsys. |
| 2566 | ---- |
| 2567 | - iscsiuio/src/unix/iscsid_ipc.c | 6 ++++++ |
| 2568 | - 1 file changed, 6 insertions(+) |
| 2569 | - |
| 2570 | ---- a/iscsiuio/src/unix/iscsid_ipc.c |
| 2571 | -+++ b/iscsiuio/src/unix/iscsid_ipc.c |
| 2572 | -@@ -950,6 +950,12 @@ int process_iscsid_broadcast(int s2) |
| 2573 | - |
| 2574 | - cmd = data->header.command; |
| 2575 | - payload_len = data->header.payload_len; |
| 2576 | -+ if (payload_len > sizeof(data->u)) { |
| 2577 | -+ LOG_ERR(PFX "Data payload length too large (%d). Corrupt payload?", |
| 2578 | -+ payload_len); |
| 2579 | -+ rc = -EINVAL; |
| 2580 | -+ goto error; |
| 2581 | -+ } |
| 2582 | - |
| 2583 | - LOG_DEBUG(PFX "recv iscsid request: cmd: %d, payload_len: %d", |
| 2584 | - cmd, payload_len); |
| 2585 | diff --git a/debian/patches/series b/debian/patches/series |
| 2586 | index a38505a..e33871b 100644 |
| 2587 | --- a/debian/patches/series |
| 2588 | +++ b/debian/patches/series |
| 2589 | @@ -1 +1,2 @@ |
| 2590 | adapt-chap-auth-algorithms-to-debian.patch |
| 2591 | +lp1755858-default-iscsid_conf-to-iscsid_socket.patch |
| 2592 | diff --git a/debian/rules b/debian/rules |
| 2593 | index 7d7cbfe..c4f553c 100755 |
| 2594 | --- a/debian/rules |
| 2595 | +++ b/debian/rules |
| 2596 | @@ -10,6 +10,10 @@ VERSION_DEBIAN := $(shell echo "$(VERSION_COMPLETE)" | sed -e 's,^[^-]*-,,') |
| 2597 | DPKG_EXPORT_BUILDFLAGS = 1 |
| 2598 | include /usr/share/dpkg/buildflags.mk |
| 2599 | |
| 2600 | +# Fix gcc10 warnings as errors while upstream doesn't catch up |
| 2601 | +export DEB_CFLAGS_PREPEND=-Wno-error=zero-length-bounds -Wno-error=format-overflow= -Wno-error=format-truncation= -Wno-error=maybe-uninitialized |
| 2602 | +export DEB_CXXFLAGS_PREPEND=${DEB_CFLAGS_PREPEND} |
| 2603 | + |
| 2604 | %: |
| 2605 | dh $@ |
| 2606 | |
| 2607 | @@ -39,6 +43,9 @@ override_dh_auto_install: |
| 2608 | dh_install -p open-iscsi debian/extra/logout-all.sh lib/open-iscsi/ |
| 2609 | dh_install -p open-iscsi debian/extra/startup-checks.sh lib/open-iscsi/ |
| 2610 | dh_install -p open-iscsi debian/extra/activate-storage.sh lib/open-iscsi/ |
| 2611 | + dh_install -p open-iscsi debian/extra/net-interface-handler lib/open-iscsi/ |
| 2612 | + dh_install -p open-iscsi debian/open-iscsi.finalrd usr/share/finalrd/ |
| 2613 | + dh_install -p open-iscsi etc/systemd/iscsid.socket lib/systemd/system/ |
| 2614 | mkdir -p debian/open-iscsi/usr/bin |
| 2615 | ln -s /sbin/iscsiadm debian/open-iscsi/usr/bin/iscsiadm |
| 2616 | mkdir -p debian/open-iscsi/usr/share/initramfs-tools/hooks |
| 2617 | @@ -47,10 +54,9 @@ override_dh_auto_install: |
| 2618 | cp -p debian/extra/initramfs.hook debian/open-iscsi/usr/share/initramfs-tools/hooks/iscsi |
| 2619 | cp -p debian/extra/initramfs.local-top debian/open-iscsi/usr/share/initramfs-tools/scripts/local-top/iscsi |
| 2620 | cp -p debian/extra/initramfs.local-bottom debian/open-iscsi/usr/share/initramfs-tools/scripts/local-bottom/iscsi |
| 2621 | - mkdir -p debian/open-iscsi/lib/modules-load.d/ |
| 2622 | - cp -p debian/open-iscsi.kmod debian/open-iscsi/lib/modules-load.d/open-iscsi.conf |
| 2623 | mkdir -p debian/open-iscsi/lib/udev/rules.d/ |
| 2624 | cp -p debian/open-iscsi.rules debian/open-iscsi/lib/udev/rules.d/70-open-iscsi.rules |
| 2625 | + cp -p debian/iscsi-network-interface.rules debian/open-iscsi/lib/udev/rules.d/70-iscsi-network-interface.rules |
| 2626 | |
| 2627 | @# iscsiuio |
| 2628 | dh_install -p iscsiuio iscsiuio/src/unix/iscsiuio /sbin |
| 2629 | @@ -68,17 +74,19 @@ override_dh_auto_install: |
| 2630 | dh_install -p open-iscsi-udeb debian/open-iscsi-udeb.finish-install usr/lib/finish-install.d/10open-iscsi |
| 2631 | |
| 2632 | override_dh_installinit: |
| 2633 | - dh_installinit -p open-iscsi --name=iscsid |
| 2634 | - dh_installinit -p open-iscsi |
| 2635 | - dh_installinit -p iscsiuio |
| 2636 | + dh_installinit -p open-iscsi --no-start --no-enable --no-restart-on-upgrade --name=iscsid |
| 2637 | + dh_installinit -p open-iscsi --no-start --no-enable --no-restart-on-upgrade |
| 2638 | + dh_installinit -p iscsiuio --no-start --no-enable --no-restart-on-upgrade |
| 2639 | |
| 2640 | override_dh_systemd_enable: |
| 2641 | - dh_systemd_enable -p open-iscsi --name=iscsid |
| 2642 | - dh_systemd_enable -p open-iscsi |
| 2643 | + dh_systemd_enable -p open-iscsi --name=iscsid --no-enable iscsid.service |
| 2644 | + dh_systemd_enable -p open-iscsi --name=iscsid iscsid.socket |
| 2645 | + dh_systemd_enable -p open-iscsi open-iscsi.service |
| 2646 | dh_systemd_enable -p iscsiuio |
| 2647 | |
| 2648 | override_dh_systemd_start: |
| 2649 | - dh_systemd_start -p open-iscsi --no-restart-on-upgrade iscsid.service open-iscsi.service |
| 2650 | + dh_systemd_start -p open-iscsi --no-restart-on-upgrade iscsid.socket |
| 2651 | + dh_systemd_start -p open-iscsi --no-restart-on-upgrade open-iscsi.service |
| 2652 | dh_systemd_start -p iscsiuio --no-restart-on-upgrade iscsiuio.service |
| 2653 | |
| 2654 | override_dh_installman: |
| 2655 | @@ -94,3 +102,14 @@ override_dh_installdocs: |
| 2656 | |
| 2657 | override_dh_missing: |
| 2658 | dh_missing --fail-missing |
| 2659 | + |
| 2660 | +# The following is taken from the initramfs-tools package. (We recommend |
| 2661 | +# busybox in the initramfs because otherwise we don't have access to the |
| 2662 | +# ip utility to set the default gateway after iscsistart -N is done.) |
| 2663 | +# On Debian we can use either busybox or busybox-static, but on Ubuntu |
| 2664 | +# and derivatives only busybox-initramfs will work. |
| 2665 | +BUSYBOX_PACKAGES := $(shell if dpkg-vendor --derives-from ubuntu; then echo busybox-initramfs; else echo busybox busybox-static; fi) |
| 2666 | + |
| 2667 | +override_dh_gencontrol: |
| 2668 | + echo >> debian/open-iscsi.substvars "busybox:Recommends=$(wordlist 2,100,$(BUSYBOX_PACKAGES:%=| %))" |
| 2669 | + dh_gencontrol |
| 2670 | diff --git a/debian/tests/README-boot-test.md b/debian/tests/README-boot-test.md |
| 2671 | new file mode 100644 |
| 2672 | index 0000000..e45bbf0 |
| 2673 | --- /dev/null |
| 2674 | +++ b/debian/tests/README-boot-test.md |
| 2675 | @@ -0,0 +1,139 @@ |
| 2676 | +## open-iscsi boot test |
| 2677 | +The purpose of this test (`CloudImageTest`) is to test the boot of a system |
| 2678 | +using an iscsi root target. In order to accomplish that, the tests does |
| 2679 | + |
| 2680 | + 1. Download Ubuntu cloud image |
| 2681 | + 2. installs the open-iscsi deb inside |
| 2682 | + 3. collect kernel and initramfs from inside |
| 2683 | + 4. register the image as a read-only iscsi target served by tgt |
| 2684 | + 5. boot kernel and initramfs with a command line to use the image as root. |
| 2685 | + And additionally attach a local disk for collecting output. |
| 2686 | + 6. provide user-data that executes commands, colects files and writes them |
| 2687 | + to the output disk and then shuts the system down. |
| 2688 | + 7. extract the collected files from the output disk and inspect them. |
| 2689 | + |
| 2690 | +The `CloudImageTest` uses qemu user networking. |
| 2691 | + |
| 2692 | + |
| 2693 | +## Caveats |
| 2694 | + |
| 2695 | + 1. It depends on a cloud-image being present. |
| 2696 | + |
| 2697 | + Cloud-images are often not available for the first few weeks of a cycle. |
| 2698 | + If no cloud-image of 'REL' is available, then boot-test will skip. |
| 2699 | + If 'REL' is not known in distro-info-data, then test will fail. |
| 2700 | + |
| 2701 | + This means that uploads of open-iscsi (or its dependencies) will not |
| 2702 | + be properly tested until a cloud-image is available, and will fail |
| 2703 | + until distro-info-data is uploaded. |
| 2704 | + |
| 2705 | + 2. Installation of large packages via patch-image may fail. |
| 2706 | + An ubuntu image downloaded has only a small amount of extra space. |
| 2707 | + Installation of a new kernel into the target would probably fail. |
| 2708 | + |
| 2709 | + If this becomes a problem, we could grow the disk like done at |
| 2710 | + https://gist.github.com/smoser/6a048a0e2795b48221fc44962202fa14 |
| 2711 | + |
| 2712 | + |
| 2713 | +### testing manually ### |
| 2714 | +The test case in `debian/tests/test-open-iscsi.py` uses some helper tools. |
| 2715 | + |
| 2716 | + * **patch-image**: this is used to install packages into the pristine image |
| 2717 | + and collect the kernel and initramfs out of the image. This allows us to |
| 2718 | + test the portions of open-iscsi that update the initramfs. Without |
| 2719 | + using the updated initramfs we wouldn't really be testing the new |
| 2720 | + open-iscsi. |
| 2721 | + |
| 2722 | + It will upgrade any packages inside that are mentioned in |
| 2723 | + ADT_TEST_TRIGGERS environment. It will also install open-iscsi if |
| 2724 | + it is not in that list. |
| 2725 | + |
| 2726 | + It installs packages into the target by copying the host system's |
| 2727 | + /etc/apt content in, and also includes copying local (file://) apt |
| 2728 | + repos into the target. This is necessary for the autopackage test |
| 2729 | + environment that adds local package repositories to sources.list.d. |
| 2730 | + |
| 2731 | + It may also make other changes to the image to workaround bugs. |
| 2732 | + See --help output for list of bugs. |
| 2733 | + |
| 2734 | + * **get-image**: This downloads an image from cloud-images.ubuntu.com. See |
| 2735 | + its Usage for more information. it downloads via stream data and verifies |
| 2736 | + download. One thing to note is that it does not overwrite existing files. |
| 2737 | + |
| 2738 | + * **tgt-boot-test**: this registers an image in tgt locally, and then boots |
| 2739 | + kernel and initramfs to mount that. It knows how to build iscsi kernel |
| 2740 | + command lines. |
| 2741 | + |
| 2742 | + By default, the xkvm process that is started will be allowed `60m` to |
| 2743 | + complete. This can be adjusted by setting `BOOT_TIMEOUT` in the |
| 2744 | + environment. |
| 2745 | + |
| 2746 | + * **xkvm**: this is a helper/wrapper around qemu. It is taken from the curtin |
| 2747 | + projects tools/ directory. It allows some simplified command lines, and |
| 2748 | + most usefully, the '--netdev=<bridge>' argument will create a tun/tap |
| 2749 | + device and attach it to the bridge. |
| 2750 | + |
| 2751 | + If the host system is not bare metal, kvm will not be |
| 2752 | + enabled in the guest that is lauched. To force use of kvm, set |
| 2753 | + _USE_KVM=1 in the environment. See 'should_try_kvm' in xkvm for details. |
| 2754 | + |
| 2755 | +Testing manually looks like this: |
| 2756 | + |
| 2757 | + ## set up path to include debian/tests directory. |
| 2758 | + $ PATH=$PWD/debian/tests:$PATH |
| 2759 | + |
| 2760 | + ## Get the image you want. This creates out.d/disk.img and disk.img.dist |
| 2761 | + $ get-image xenial.d xenial |
| 2762 | + |
| 2763 | + ## patch the image with an open-iscsi, which creates xenial.d/kernel |
| 2764 | + ## and xenial.d/initrd from the kernel and initramfs inside the image. |
| 2765 | + $ apt-get download open-iscsi |
| 2766 | + $ deb=$(ls open-iscsi_*.deb | tail -n 1) |
| 2767 | + $ sudo ./debian/tests/patch-image \ |
| 2768 | + --kernel=xenial.d/kernel --initrd=xenial.d/initrd |
| 2769 | + xenial.d/disk.img "$deb" |
| 2770 | + |
| 2771 | + ## Boot the system, log in, look around. |
| 2772 | + $ tgt-boot-test -v xenial.d/disk.img xenial.d/kernel xenial.d/initrd |
| 2773 | + |
| 2774 | + |
| 2775 | +### Features of tgt-boot-test ### |
| 2776 | + |
| 2777 | +tgt-boot-test does a number of useful things. |
| 2778 | + |
| 2779 | + * determines the host address that the guest will use. |
| 2780 | + This should support ipv6 and ipv4 addresses on bridges, and |
| 2781 | + knows values that qemu's user networking uses. Flags passed to `--netdev` |
| 2782 | + are read intelligently. This can be overriden with `--host-addr`, but |
| 2783 | + it does a good job of determining what the right values are. |
| 2784 | + |
| 2785 | + * provides a nocloud metadata service with a python web server that |
| 2786 | + supports ipv4 and ipv6. |
| 2787 | + |
| 2788 | + * provides the ability to provide additional kernel command line options |
| 2789 | + or to provide a 'template' that references variables it knows such as |
| 2790 | + {iserver} (iscsi server) or {seed_url}. |
| 2791 | + |
| 2792 | + * Sets ubuntu (passw0rd) and root password (root) and imports users |
| 2793 | + ssh keys to the ubuntu user. |
| 2794 | + |
| 2795 | +One thing to note is that yakkety's version of qemu does not run an ipv6 |
| 2796 | +dhcp server on its user-network, so a stateful dhclient request will not |
| 2797 | +work. |
| 2798 | + |
| 2799 | +In order to create a bridge easily with a ipv6 dhcp server, you can use |
| 2800 | +lxd at sufficent version (https://github.com/lxc/lxd/issues/2481). |
| 2801 | +Assuming that bug is fixed, to create an ipv6 only bridge: |
| 2802 | + |
| 2803 | + $ netname="ipv6-only" |
| 2804 | + $ lxc network create $netname |
| 2805 | + $ lxc network unset $netname ipv4.address |
| 2806 | + $ lxc network unset $netname ipv4.nat |
| 2807 | + $ lxc network set $netname ipv6.dhcp.stateful true |
| 2808 | + |
| 2809 | +Then, you can use tgt-boot-test with that: |
| 2810 | + |
| 2811 | + $ PATH=$PWD/debian/tests:$PATH |
| 2812 | + $ ./debian/tests/tgt-boot-test -vv --netdev=ipv6-only \ |
| 2813 | + --cmdline-ip="ip=off ip6=dhcp" \ |
| 2814 | + disk.img kernel initramfs |
| 2815 | diff --git a/debian/tests/control b/debian/tests/control |
| 2816 | index 7b3c9e2..026cfc9 100644 |
| 2817 | --- a/debian/tests/control |
| 2818 | +++ b/debian/tests/control |
| 2819 | @@ -1,6 +1,10 @@ |
| 2820 | Tests: install |
| 2821 | Restrictions: needs-root, isolation-machine, breaks-testbed |
| 2822 | |
| 2823 | +Tests: testsuite |
| 2824 | +Restrictions: needs-root isolation-machine breaks-testbed |
| 2825 | +Depends: open-iscsi, python2, tgt, qemu-system, ubuntu-cloudimage-keyring, simplestreams, python-netifaces, distro-info, cloud-image-utils, dctrl-tools, rsync |
| 2826 | + |
| 2827 | Tests: nested |
| 2828 | Restrictions: needs-root, isolation-machine, breaks-testbed, allow-stderr |
| 2829 | Depends: targetcli-fb, qemu-system, qemu-utils, python3, python3-netifaces |
| 2830 | diff --git a/debian/tests/get-image b/debian/tests/get-image |
| 2831 | new file mode 100755 |
| 2832 | index 0000000..41b903c |
| 2833 | --- /dev/null |
| 2834 | +++ b/debian/tests/get-image |
| 2835 | @@ -0,0 +1,227 @@ |
| 2836 | +#!/bin/bash |
| 2837 | +Usage() { |
| 2838 | + cat <<EOF |
| 2839 | +${0##*/} out-directory release |
| 2840 | + |
| 2841 | +By default, the cloud image for 'release' is downloaded from the |
| 2842 | +daily cloud image stream. |
| 2843 | + |
| 2844 | +Additional arguments can change behavior of what is downloaded. |
| 2845 | +Some supported arguments: |
| 2846 | + * cloud-daily: use daily stream [default] |
| 2847 | + * cloud-release: use release stream rather than daily stream. |
| 2848 | + * maas-release, maas-daily: download maas images instead of cloud-image |
| 2849 | + * hwe-N: download the hwe kernel from release 'N' instead of default |
| 2850 | + this is only respected if maas stream is used. |
| 2851 | + * YYYYMMDD[.X] : download the specific build version |
| 2852 | + |
| 2853 | +example: |
| 2854 | + ${0##*/} xenial_dir xenial cloud-daily |
| 2855 | +EOF |
| 2856 | +} |
| 2857 | +TEMP_D="" |
| 2858 | + |
| 2859 | +NO_IMAGE_AVAILABLE_RC=3 |
| 2860 | + |
| 2861 | +cleanup() { |
| 2862 | + [ ! -d "${TEMP_D}" ] || rm -Rf "${TEMP_D}" |
| 2863 | +} |
| 2864 | +VERBOSITY=1 |
| 2865 | +inargs() { |
| 2866 | + local n=$1 x=""; |
| 2867 | + shift; |
| 2868 | + for x in "$@"; do [ "$n" = "$x" ] && return 0; done; |
| 2869 | + return 1 |
| 2870 | +} |
| 2871 | +debug() { [ $1 -ge $VERBOSITY ] || return 0; shift; echo "$@" 1>&2; } |
| 2872 | +error() { echo "$@" 1>&2; } |
| 2873 | +fail() { [ $# -eq 0 ] || error "$@"; exit 1; } |
| 2874 | + |
| 2875 | +VERBOSITY=0 |
| 2876 | +TEMP_D=$(mktemp -d ${TMPDIR:-/tmp}/${0##*/}.XXXXXX) || exit 1 |
| 2877 | +trap cleanup EXIT |
| 2878 | + |
| 2879 | +arches=( ppc64el i386 amd64 ) |
| 2880 | +releases=( $(ubuntu-distro-info --all) ) |
| 2881 | +mbase="http://maas.ubuntu.com/images/ephemeral-v2" |
| 2882 | +cbase="http://cloud-images.ubuntu.com" |
| 2883 | +def_stream_type="cloud" |
| 2884 | +stream_src="" |
| 2885 | +curbase="$mbase" |
| 2886 | +def_rel="xenial" |
| 2887 | +vername="" |
| 2888 | + |
| 2889 | +[ "$1" = "-h" -o "$1" = "--help" ] && { Usage; exit 0; } |
| 2890 | +[ $# -lt 2 ] && { Usage 1>&2; exit 1; } |
| 2891 | +out_d="$1" |
| 2892 | +shift |
| 2893 | + |
| 2894 | +myarch=$(uname -m) |
| 2895 | +case "$myarch" in |
| 2896 | + ppc64*) def_arch="ppc64el";; |
| 2897 | + i?86) def_arch="i386";; |
| 2898 | + x86_64) def_arch="amd64";; |
| 2899 | + arm*) def_arch="armel";; |
| 2900 | +esac |
| 2901 | + |
| 2902 | +pt=( ) |
| 2903 | +for x in "$@"; do |
| 2904 | + inargs "$x" "${arches[@]}" && pt[${#pt[@]}]=arch=$x && arch="$x" && continue |
| 2905 | + inargs "$x" "${releases[@]}" && pt[${#pt[@]}]="release=$x" && release=$x && continue |
| 2906 | + [ "$x" = "released" -o "$x" = "release" ] && x="releases" |
| 2907 | + case "$x" in |
| 2908 | + cloud-released|cloud-release) x="cloud-releases";; |
| 2909 | + maas-released|maas-release) x="maas-releases";; |
| 2910 | + esac |
| 2911 | + |
| 2912 | + case "$x" in |
| 2913 | + maas|cloud) stream_type="$x";; |
| 2914 | + cloud-daily|maas-daily|cloud-releases|maas-releases) |
| 2915 | + stream_type="${x%-*}" |
| 2916 | + stream_sub=${x#*-};; |
| 2917 | + http://*) stream=$x;; |
| 2918 | + hwe-*) subarch="$x";; |
| 2919 | + subarch=*) subarch=${x#*=};; |
| 2920 | + *=*) pt[${#pt[@]}]="$x";; |
| 2921 | + *~*) pt[${#pt[@]}]="$x";; |
| 2922 | + [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].[0-9]) |
| 2923 | + pt[${#pt[@]}]="version_name=$x" |
| 2924 | + vername="$x";; |
| 2925 | + *) fail "Confused by input token '$x'";; |
| 2926 | + esac |
| 2927 | +done |
| 2928 | + |
| 2929 | +[ -n "$stream_type" ] || stream_type="${def_stream_type}" |
| 2930 | +if [ -z "$stream" ]; then |
| 2931 | + stream_sub=${stream_sub:-daily} |
| 2932 | + case "$stream_type" in |
| 2933 | + maas) stream="$mbase/$stream_sub";; |
| 2934 | + cloud) stream="$cbase/$stream_sub";; |
| 2935 | + *) fail "unknown stream_type '$stream_type'";; |
| 2936 | + esac |
| 2937 | +fi |
| 2938 | + |
| 2939 | +[ -n "$arch" ] || pt[${#pt[@]}]="arch=$def_arch" |
| 2940 | + |
| 2941 | +if [ "$stream_type" = "maas" ]; then |
| 2942 | + if [ -z "$subarch" ]; then |
| 2943 | + t=${release#?} |
| 2944 | + first_letter=${release%${t}} |
| 2945 | + subarch="hwe-${first_letter}" |
| 2946 | + error "selected subarch=${subarch} for $release" |
| 2947 | + fi |
| 2948 | + pt[${#pt[@]}]="subarch=$subarch" |
| 2949 | + ofmt="%(sha256)s %(ftype)s %(subarch)s %(item_url)s" |
| 2950 | +else |
| 2951 | + ofmt="%(sha256)s %(ftype)s %(item_url)s" |
| 2952 | +fi |
| 2953 | + |
| 2954 | +OIFS="$IFS" |
| 2955 | +mkdir -p "$out_d" |
| 2956 | +case "$stream" in |
| 2957 | + *.json) :;; |
| 2958 | + *) keyring="/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg";; |
| 2959 | +esac |
| 2960 | + |
| 2961 | +needs="" |
| 2962 | +[ -n "$keyring" -a ! -f "$keyring" ] && |
| 2963 | + needs="${needs} ubuntu-cloudimage-keyring" |
| 2964 | + |
| 2965 | +for pair in sstream-query:simplestreams tgt-admin:tgt; do |
| 2966 | + cmd=${pair%:*} |
| 2967 | + pkg=${pair#*:} |
| 2968 | + command -v "$cmd" >/dev/null 2>&1 || needs="$needs $pkg" |
| 2969 | +done |
| 2970 | + |
| 2971 | +if [ -n "${needs# }" ]; then |
| 2972 | + error "missing dependencies" |
| 2973 | + fail "sudo apt-get install -qy ${needs# }" |
| 2974 | +fi |
| 2975 | + |
| 2976 | +qcmd=( sstream-query ${keyring:+"--keyring=$keyring"} ${vername:---max=1} |
| 2977 | + --output-format="$ofmt" "${stream}" datatype="image-downloads" |
| 2978 | + "${pt[@]}" ) |
| 2979 | +echo "${qcmd[@]}" |
| 2980 | +"${qcmd[@]}" > "${TEMP_D}/qout" |
| 2981 | +roots=$(awk '$2 == "root-image.gz" || $2 == "disk1.img" { print $2 }' \ |
| 2982 | + "${TEMP_D}/qout" | sort -u | wc -l) |
| 2983 | +if [ "$roots" = "0" ]; then |
| 2984 | + error "No image available for $release in $stream${pt:+ (${pt[*]})}" |
| 2985 | + exit ${NO_IMAGE_AVAILABLE_RC} |
| 2986 | +elif [ "$roots" != "1" ]; then |
| 2987 | + error "query resulted in '$roots' root images. expect 1 and only 1" |
| 2988 | + error "cmd was ${qcmd[*]}" |
| 2989 | + cat "${TEMP_D}/qout" |
| 2990 | + fail |
| 2991 | +fi |
| 2992 | + |
| 2993 | +set -f |
| 2994 | +while read line; do |
| 2995 | + set -- $line |
| 2996 | + if [ "$stream_type" = "maas" ]; then |
| 2997 | + sha256="$1"; ftype="$2"; subarch="$3"; url="$4" |
| 2998 | + else |
| 2999 | + sha256="$1"; ftype="$2"; url="$3" |
| 3000 | + fi |
| 3001 | + case "$ftype" in |
| 3002 | + boot-kernel|boot-initrd|root-image.gz|disk1.img) :;; |
| 3003 | + *) continue |
| 3004 | + esac |
| 3005 | + if [ "$ftype" = "root-image.gz" ]; then |
| 3006 | + fname="$ftype" |
| 3007 | + image_src="$out_d/$fname" |
| 3008 | + image="$out_d/root-image" |
| 3009 | + elif [ "$ftype" = "disk1.img" ]; then |
| 3010 | + fname="disk.img.dist" |
| 3011 | + image_src="$out_d/$fname" |
| 3012 | + image="$out_d/disk.img" |
| 3013 | + else |
| 3014 | + fname="$subarch/$ftype" |
| 3015 | + fi |
| 3016 | + out_f="${out_d}/$fname" |
| 3017 | + if [ -f "$out_f" ]; then |
| 3018 | + debug 1 "reusing existing '$out_f' rather than downloading $url." |
| 3019 | + continue |
| 3020 | + fi |
| 3021 | + [ -d "${out_f%/*}" ] || mkdir -p "${out_f%/*}" |
| 3022 | + tmp="${out_f}.tmp" |
| 3023 | + wget --progress=dot:mega -O "$tmp" "$url" || { |
| 3024 | + error "Failed to download $url to $tmp." |
| 3025 | + rm -f "$tmp" |
| 3026 | + exit 3 |
| 3027 | + } |
| 3028 | + debug 1 "checksumming $tmp from $url" |
| 3029 | + out=$(sha256sum "$tmp") || { |
| 3030 | + error "Failed to checksum $tmp" |
| 3031 | + rm -f "$tmp" |
| 3032 | + exit 3; |
| 3033 | + } |
| 3034 | + found=${out% *} |
| 3035 | + if [ "$found" != "$sha256" ]; then |
| 3036 | + error "$tmp from $url found sha256 of $found. expected $sha256." |
| 3037 | + ls -l "$tmp" 1>&2 |
| 3038 | + rm -f "$tmp" |
| 3039 | + exit 3 |
| 3040 | + fi |
| 3041 | + mv "$tmp" "$out_f" || fail "failed renaming $tmp to $out_f" |
| 3042 | + echo "$fname" "$url" >> "$out_d/contents" |
| 3043 | +done < "${TEMP_D}/qout" |
| 3044 | + |
| 3045 | +if [ ! -f "$image" ]; then |
| 3046 | + case "$image_src" in |
| 3047 | + */root-image.gz) |
| 3048 | + debug 1 "decompressing $image_src" |
| 3049 | + zcat "$image_src" > "$image.tmp" && |
| 3050 | + mv "$image.tmp" "$image" || |
| 3051 | + { rm -f "$image.tmp"; exit 1; } |
| 3052 | + ;; |
| 3053 | + */disk.img.dist) |
| 3054 | + debug 1 "converting qcow2 in $image_src -> raw in $image" |
| 3055 | + qemu-img convert -O raw "$image_src" "$image.tmp" && |
| 3056 | + mv "$image.tmp" "$image" || |
| 3057 | + { rm -f "$image.tmp"; exit 1; } |
| 3058 | + ;; |
| 3059 | + esac |
| 3060 | +fi |
| 3061 | + |
| 3062 | +# vi: ts=4 expandtab |
| 3063 | diff --git a/debian/tests/install b/debian/tests/install |
| 3064 | index ae2fe79..5077b7b 100755 |
| 3065 | --- a/debian/tests/install |
| 3066 | +++ b/debian/tests/install |
| 3067 | @@ -28,5 +28,8 @@ grep -vq '^GenerateName=yes' /etc/iscsi/initiatorname.iscsi || die_with_file /et |
| 3068 | grep -q '^InitiatorName=' /etc/iscsi/initiatorname.iscsi || die_with_file /etc/iscsi/initiatorname.iscsi "InitiatorName is not set" |
| 3069 | |
| 3070 | # Make sure the daemon is started |
| 3071 | -service iscsid status || die "iscsid not running" |
| 3072 | -pgrep -c iscsid >/dev/null || die "iscsid not running" |
| 3073 | +systemctl is-active iscsid.socket || die "iscsid socket not running" |
| 3074 | +# no-op discovery to socket activate service |
| 3075 | +iscsiadm -m discovery -t sendtargets -p 127.0.0.1 >/dev/null 2>&1|| /bin/true |
| 3076 | +systemctl is-active iscsid.service || die "iscsid service not running" |
| 3077 | +pgrep -c iscsid >/dev/null || die "iscsid process not running" |
| 3078 | diff --git a/debian/tests/patch-image b/debian/tests/patch-image |
| 3079 | new file mode 100755 |
| 3080 | index 0000000..0688912 |
| 3081 | --- /dev/null |
| 3082 | +++ b/debian/tests/patch-image |
| 3083 | @@ -0,0 +1,374 @@ |
| 3084 | +#!/bin/bash |
| 3085 | + |
| 3086 | +VERBOSITY=1 |
| 3087 | +TEMP_D="" |
| 3088 | + |
| 3089 | +error() { echo "$@" 1>&2; } |
| 3090 | +fail() { local r=$?; [ $r -eq 0 ] && r=1; failrc "$r" "$@"; } |
| 3091 | +failrc() { local r=$1; shift; [ $# -eq 0 ] || error "$@"; exit $r; } |
| 3092 | + |
| 3093 | +Usage() { |
| 3094 | + cat <<EOF |
| 3095 | +Usage: ${0##*/} [options] image [packages] |
| 3096 | + Patch image, upgrading [packages]. |
| 3097 | + --kernel FILE copy kernel out to FILE |
| 3098 | + --initrd FILE copy initrd out to FILE |
| 3099 | + |
| 3100 | + --krd-only only copy out kernel/initrd do not change image. |
| 3101 | + this is incompatible with 'packages' |
| 3102 | + it is a short-cut to specifying all the '--no-*' |
| 3103 | + options below. |
| 3104 | + |
| 3105 | + --no-copy-apt do not copy host's apt repos in. |
| 3106 | + |
| 3107 | + image modifications: |
| 3108 | + --no-update-fstab do not modify fstab (LP: #1732028) |
| 3109 | + |
| 3110 | + if no packages are provided, and ADT_TEST_TRIGGERS is set |
| 3111 | + in environment, then it will be read for the list of packages. |
| 3112 | + to override that behavior pass package 'none'. |
| 3113 | +EOF |
| 3114 | + |
| 3115 | +} |
| 3116 | + |
| 3117 | +bad_Usage() { Usage 1>&2; [ $# -eq 0 ] || error "$@"; return 1; } |
| 3118 | +cleanup() { |
| 3119 | + [ -z "${TEMP_D}" -o ! -d "${TEMP_D}" ] || rm -Rf "${TEMP_D}" |
| 3120 | +} |
| 3121 | + |
| 3122 | +debug() { |
| 3123 | + local level=${1}; shift; |
| 3124 | + [ "${level}" -gt "${VERBOSITY}" ] && return |
| 3125 | + error "${@}" |
| 3126 | +} |
| 3127 | + |
| 3128 | +adt_test_triggers_to_bin_pkgs() { |
| 3129 | + # ADT_TEST_TRIGGERS is space delimited <src>/version |
| 3130 | + # returns a scalar '_RET', caller has to expand |
| 3131 | + local tok src="" ver="" binpkgs="" |
| 3132 | + for tok in "$@"; do |
| 3133 | + src=${tok%/*} |
| 3134 | + ver=${tok#*/} |
| 3135 | + bin_packages_from_source_pkg "$src" "$ver" || return |
| 3136 | + if [ -z "${_RET}" ]; then |
| 3137 | + error "$tok: (source=$src ver=$ver) No packages available!" |
| 3138 | + return 1 |
| 3139 | + fi |
| 3140 | + binpkgs="${binpkgs} ${_RET}" |
| 3141 | + done |
| 3142 | + _RET=${binpkgs# } |
| 3143 | +} |
| 3144 | + |
| 3145 | +bin_packages_from_source_pkg() { |
| 3146 | + local pkg=$1 ver=${2} cmd="" out="" p="" ret="" |
| 3147 | + if ! command -v grep-aptavail >/dev/null; then |
| 3148 | + error "No command grep-aptavail: apt-get install dctrl-tools" |
| 3149 | + return 1 |
| 3150 | + fi |
| 3151 | + cmd=( grep-aptavail --show-field=Package |
| 3152 | + --exact-match --field=Source:Package "$pkg" ) |
| 3153 | + if [ -n "$ver" ]; then |
| 3154 | + cmd=( "${cmd[@]}" --and --field=Version "$ver" ) |
| 3155 | + fi |
| 3156 | + out=$("${cmd[@]}" | sed 's,Package: ,,') |
| 3157 | + ret="" |
| 3158 | + for p in $out; do |
| 3159 | + ret="$ret ${p#Package: }${ver:+=${ver}}" |
| 3160 | + done |
| 3161 | + # if no version was provided, we could have multiple results |
| 3162 | + _RET=$(set -f; for i in ${ret}; do echo "$i"; done | sort -u) |
| 3163 | +} |
| 3164 | + |
| 3165 | +update_fstab() { |
| 3166 | + # update_fstab(path) modify the fstab at path |
| 3167 | + # to remove problematic entries (LP: #1732028) |
| 3168 | + local fstab="$1" |
| 3169 | + if [ ! -e "$fstab.patch-image-dist" ]; then |
| 3170 | + cp "$fstab" "$fstab.patch-image-dist" || |
| 3171 | + { error "failed backing up $fstab to $fstab.dist"; return 1; } |
| 3172 | + fi |
| 3173 | + sed -i '/^LABEL=UEFI/s/^/#/' "$fstab" |
| 3174 | +} |
| 3175 | + |
| 3176 | +cat_debug_script() { |
| 3177 | + cat <<"EOF" |
| 3178 | +#!/bin/sh |
| 3179 | +set -f |
| 3180 | +NAME=${1:-debug-pid-$$} |
| 3181 | +[ "$(id -u)" = "0" ] && log="/run/${NAME}.log" || log="/tmp/${NAME}.log" |
| 3182 | + |
| 3183 | +msg() { |
| 3184 | + echo "===" "$@" "===" 1>&2 |
| 3185 | +} |
| 3186 | +showcmd() { |
| 3187 | + msg "showcmd$" "$@" |
| 3188 | + "$@" |
| 3189 | +} |
| 3190 | + |
| 3191 | +main() { |
| 3192 | + issues=$(journalctl | egrep "[.]mount: ") |
| 3193 | + if [ -z "$issues" ]; then |
| 3194 | + msg "$NAME:" "MOUNT ISSUES FOUND: NO" |
| 3195 | + else |
| 3196 | + msg "$NAME:" "MOUNT ISSUES FOUND: YES" |
| 3197 | + fi |
| 3198 | + showcmd systemctl list-units --no-pager --all --full "*.mount" |
| 3199 | + showcmd systemctl cat --no-pager --all --full "*.mount" |
| 3200 | + showcmd systemctl status --no-pager --all --full "*.mount" |
| 3201 | + showcmd cat /etc/fstab |
| 3202 | + showcmd cat /proc/1/mountinfo |
| 3203 | +} |
| 3204 | + |
| 3205 | +main > "$log" 2>&1 |
| 3206 | +echo "============ $NAME =============" |
| 3207 | +cat "$log" |
| 3208 | +EOF |
| 3209 | +} |
| 3210 | + |
| 3211 | +add_systemd_job() { |
| 3212 | + local target="$1" name="$2" after="$3" start="$4" |
| 3213 | + local spath="lib/systemd/system/xdebug-$name.service" |
| 3214 | + debug 1 "writing $name to $target/$spath" |
| 3215 | + cat > "$target/$spath" <<EOF |
| 3216 | +[Unit] |
| 3217 | +Description=Execute xdebug ${name} |
| 3218 | +After=${after} |
| 3219 | + |
| 3220 | +[Service] |
| 3221 | +Type=oneshot |
| 3222 | +ExecStart=${start} ${name} |
| 3223 | +RemainAfterExit=yes |
| 3224 | +StandardOutput=journal+console |
| 3225 | + |
| 3226 | +[Install] |
| 3227 | +WantedBy=multi-user.target |
| 3228 | +EOF |
| 3229 | + [ $? -eq 0 ] || { error "failed writing $target/$spath"; return 1; } |
| 3230 | + local wantsdir="$target/etc/systemd/system/multi-user.target.wants" |
| 3231 | + ln -s "/$spath" "$wantsdir/" || |
| 3232 | + { error "failed ln -s '/$spath' '$wantsdir/'"; return 1; } |
| 3233 | +} |
| 3234 | + |
| 3235 | +insert_debug_1788188() { |
| 3236 | + # This is an attempt to collect more debug information in the |
| 3237 | + # event that the tests trigger LP: #1788188. |
| 3238 | + local target="$1" |
| 3239 | + [ "$target" = "/" -o -z "$target" ] && |
| 3240 | + { error "target was / in insert_debug"; return 1; } |
| 3241 | + local script="usr/local/bin/debug-mounts" |
| 3242 | + cat_debug_script > "$target/$script" && |
| 3243 | + chmod 755 "$target/$script" || |
| 3244 | + { error "failed writing $target/script"; return 1; } |
| 3245 | + local name="" |
| 3246 | + ( set +f; |
| 3247 | + rm -f "$target/lib/systemd/system/xdebug"-*.service \ |
| 3248 | + "$target/etc/systemd/system/"*.wants/xdebug*.service ) |
| 3249 | + add_systemd_job "$target" network network-online.target "/$script" && |
| 3250 | + add_systemd_job "$target" local-fs local-fs.target "/$script" || |
| 3251 | + { error "failed adding systemd jobs"; return 1; } |
| 3252 | +} |
| 3253 | + |
| 3254 | +main() { |
| 3255 | + local short_opts="hv" |
| 3256 | + local long_opts="help,no-copy-apt,initrd:,kernel:,verbose" |
| 3257 | + local getopt_out="" orig_args="" |
| 3258 | + orig_args=( "$@" ) |
| 3259 | + getopt_out=$(getopt --name "${0##*/}" \ |
| 3260 | + --options "${short_opts}" --long "${long_opts}" -- "$@") && |
| 3261 | + eval set -- "${getopt_out}" || |
| 3262 | + { bad_Usage; return; } |
| 3263 | + |
| 3264 | + local cur="" next="" |
| 3265 | + local kernel="" initrd="" copy_apt=true krd_only=false |
| 3266 | + local update_fstab=true |
| 3267 | + |
| 3268 | + while [ $# -ne 0 ]; do |
| 3269 | + cur="$1"; next="$2"; |
| 3270 | + case "$cur" in |
| 3271 | + -h|--help) Usage ; exit 0;; |
| 3272 | + --krd-only) krd_only=true; shift;; |
| 3273 | + --no-copy-apt) copy_apt=false; shift;; |
| 3274 | + --no-update-fstab) update_fstab=false; shift;; |
| 3275 | + --kernel) kernel=$next; shift;; |
| 3276 | + --initrd) initrd=$next; shift;; |
| 3277 | + -v|--verbose) VERBOSITY=$((${VERBOSITY}+1));; |
| 3278 | + --) shift; break;; |
| 3279 | + esac |
| 3280 | + shift; |
| 3281 | + done |
| 3282 | + |
| 3283 | + [ $# -ne 0 ] || { bad_Usage "must provide at least image"; return; } |
| 3284 | + |
| 3285 | + [ "$(id -u)" = "0" ] || fail "not root" |
| 3286 | + target="$1" |
| 3287 | + shift |
| 3288 | + if [ -f "$target" ]; then |
| 3289 | + local nargs="" |
| 3290 | + nargs=( "${orig_args[@]}" ) |
| 3291 | + # replace the first occurance of target in orig args with _MOUNTPOINT_ |
| 3292 | + for((i=0;i<${#nargs[@]};i++)); do |
| 3293 | + [ "${nargs[$i]}" = "$target" ] && nargs[$i]=_MOUNTPOINT_ && break |
| 3294 | + done |
| 3295 | + debug 1 "mic $target -- $0 ${nargs[*]}" |
| 3296 | + IMAGE="$target" exec mount-image-callback \ |
| 3297 | + --system-resolvconf "$target" -- "$0" "${nargs[@]}" |
| 3298 | + fi |
| 3299 | + |
| 3300 | + if [ ! -d "$target" ]; then |
| 3301 | + fail "$target: not a directory or file" |
| 3302 | + fi |
| 3303 | + |
| 3304 | + local tsrc=${IMAGE:-${target}} |
| 3305 | + local packages=( ) |
| 3306 | + packages=( "$@" ) |
| 3307 | + |
| 3308 | + if $krd_only; then |
| 3309 | + if [ "${#packages[@]}" != 0 -a "${packages[*]}" != "none" ]; then |
| 3310 | + error "--krd-only is incompatible with packages." |
| 3311 | + return 1 |
| 3312 | + fi |
| 3313 | + debug 1 "--krd-only provided no changes will be done." |
| 3314 | + copy_apt=false |
| 3315 | + update_fstab=false |
| 3316 | + packages=( "none" ) |
| 3317 | + fi |
| 3318 | + |
| 3319 | + if [ "${#packages[@]}" = "1" -a "${packages[0]}" = "none" ]; then |
| 3320 | + packages=( ) |
| 3321 | + elif [ "${#packages[@]}" -eq 0 -a -n "${ADT_TEST_TRIGGERS}" ]; then |
| 3322 | + adt_test_triggers_to_bin_pkgs ${ADT_TEST_TRIGGERS} || |
| 3323 | + fail "failed to find binary packages " \ |
| 3324 | + "from ADT_TEST_TRIGGERS=$ADT_TEST_TRIGGERS" |
| 3325 | + packages=( $_RET ) |
| 3326 | + debug 1 "read ADT_TEST_TRIGGERS=$ADT_TEST_TRIGGERS to set" \ |
| 3327 | + "packages=${packages[*]}" |
| 3328 | + else |
| 3329 | + local opackages="" debs="" pkg="" |
| 3330 | + opackages=( "${packages[@]}" ) |
| 3331 | + packages=( ) |
| 3332 | + debs=( ) |
| 3333 | + for pkg in "${opackages[@]}"; do |
| 3334 | + [ -f "${pkg}" ] && debs[${#debs[@]}]="$pkg" || |
| 3335 | + packages[${packages[@]}]="$pkg" |
| 3336 | + done |
| 3337 | + if [ "${#packages[@]}" -eq 0 -a "${#debs[@]}" -eq 0 ]; then |
| 3338 | + packages=( open-iscsi ) |
| 3339 | + debug 1 "no packages or debs given, using packages=${packages[*]}" |
| 3340 | + fi |
| 3341 | + fi |
| 3342 | + |
| 3343 | + # if open-iscsi is not in the packages list above, we handle it specifically |
| 3344 | + # so that even if the image did not have open-iscsi, it will get it. |
| 3345 | + local pkg="" mypkg="open-iscsi" |
| 3346 | + for pkg in "${packages[@]}"; do |
| 3347 | + case "$pkg" in |
| 3348 | + open-iscsi|open-iscsi/*) mypkg="none";; |
| 3349 | + esac |
| 3350 | + done |
| 3351 | + |
| 3352 | + TEMP_D=$(mktemp -d "${TMPDIR:-/tmp}/${0##*/}.XXXXXX") || |
| 3353 | + fail "failed to make tempdir" |
| 3354 | + trap cleanup EXIT |
| 3355 | + |
| 3356 | + if $copy_apt; then |
| 3357 | + local distdir="${target}/etc/apt.dist.${0##*/}" |
| 3358 | + if [ ! -d "$distdir" ]; then |
| 3359 | + mv "$target/etc/apt" "$distdir" || |
| 3360 | + fail "failed to backup /etc/apt in $tsrc" |
| 3361 | + fi |
| 3362 | + cp -a /etc/apt "$target/etc/" || |
| 3363 | + fail "failed to replace /etc/apt in $tsrc" |
| 3364 | + |
| 3365 | + # find file:// repos in apt sources and copy them in |
| 3366 | + local file_repos="" |
| 3367 | + file_repos=$( |
| 3368 | + fm='s,.*[[:space:]]file:///*\([^[[:space:]]*\).*,/\1,p' |
| 3369 | + shopt -s nullglob |
| 3370 | + for f in /etc/apt/sources.list /etc/apt/sources.list.d/*.list; do |
| 3371 | + sed -n -e 's/#.*//' -e "$fm" "$f" |
| 3372 | + done |
| 3373 | + ) |
| 3374 | + local dir="" bdir="" tdir="" |
| 3375 | + for dir in ${file_repos}; do |
| 3376 | + tdir="${target}$(dirname $dir)/$(basename ${dir})" |
| 3377 | + if [ -d "$dir" ]; then |
| 3378 | + debug 1 "copying $dir -> $tdir" |
| 3379 | + mkdir -p "$tdir" || |
| 3380 | + fail "failed to create $tdir" |
| 3381 | + rsync --delete -a "$dir/" "$tdir" || |
| 3382 | + fail "failed copy from $dir/ to $tdir" |
| 3383 | + fi |
| 3384 | + done |
| 3385 | + fi |
| 3386 | + |
| 3387 | + if $update_fstab; then |
| 3388 | + update_fstab "$target/etc/fstab" || |
| 3389 | + { error "failed updating /etc/fstab in target"; return 1; } |
| 3390 | + fi |
| 3391 | + |
| 3392 | + insert_debug_1788188 "$target" || return 1 |
| 3393 | + |
| 3394 | + mount -o bind /sys "$target"/sys || : |
| 3395 | + mount -o bind /proc "$target"/proc || : |
| 3396 | + mount -o bind /dev "$target"/dev || : |
| 3397 | + mount -o bind /dev/pts "$target"/dev/pts || : |
| 3398 | + |
| 3399 | + debug 1 "${#packages[@]} packages: ${packages[*]}" |
| 3400 | + if [ "${#packages[@]}" != "0" ]; then |
| 3401 | + DEBIAN_FRONTEND=noninteractive chroot "$target" sh -exc ' |
| 3402 | + mypkg=$1 |
| 3403 | + shift |
| 3404 | + apt-get update -q |
| 3405 | + if [ "$mypkg" != "none" ]; then |
| 3406 | + apt-get install -qy "$mypkg" |
| 3407 | + fi |
| 3408 | + apt-get install -qy --only-upgrade "$@"' \ |
| 3409 | + chroot-inst "$mypkg" "${packages[@]}" || |
| 3410 | + fail "failed to install ${packages[*]} in $target" |
| 3411 | + fi |
| 3412 | + |
| 3413 | + debug 1 "${#debs[@]} debs: ${debs[*]}" |
| 3414 | + if [ "${#debs[@]}" != "0" ]; then |
| 3415 | + local tmpd="" |
| 3416 | + tmpd=$(mktemp -d "${target}/tmp/${0##*/}.XXXXXX") |
| 3417 | + cp "${debs[@]}" "$tmpd" |
| 3418 | + DEBIAN_FRONTEND=noninteractive chroot "$target" sh -exc \ |
| 3419 | + 'cd "$1"; shift; dpkg -i *.deb' debinstalls "${tmpd#${target}}" |
| 3420 | + rm -Rf "${tmpd}" |
| 3421 | + fi |
| 3422 | + |
| 3423 | + umount "$target"/dev/pts || : |
| 3424 | + umount "$target"/dev || : |
| 3425 | + umount "$target"/proc || : |
| 3426 | + umount "$target"/sys || : |
| 3427 | + |
| 3428 | + local kpath="" ipath="" |
| 3429 | + for f in "$target/boot/"*; do |
| 3430 | + case "${f##*/}" in |
| 3431 | + *.signed) continue;; |
| 3432 | + vmlinu?-*) kpath="$f";; |
| 3433 | + initrd.img-*) ipath="$f";; |
| 3434 | + esac |
| 3435 | + done |
| 3436 | + |
| 3437 | + if [ -n "$kernel" ]; then |
| 3438 | + [ -n "$kpath" ] || fail "unable to find kernel in $tsrc" |
| 3439 | + debug 1 "using kernel ${kpath#${target}}" |
| 3440 | + cp "$kpath" "$kernel" || |
| 3441 | + fail "failed copy $kpath to $kernel" |
| 3442 | + [ -z "$IMAGE" ] || chown "--reference=$IMAGE" "$kernel" |
| 3443 | + fi |
| 3444 | + |
| 3445 | + if [ -n "$initrd" ]; then |
| 3446 | + [ -n "$ipath" ] || fail "unable to find initrd in $tsrc" |
| 3447 | + debug 1 "using initrd ${ipath#${target}}" |
| 3448 | + cp "$ipath" "$initrd" || |
| 3449 | + fail "failed copy $ipath to $initrd" |
| 3450 | + [ -z "$IMAGE" ] || chown "--reference=$IMAGE" "$initrd" |
| 3451 | + fi |
| 3452 | + |
| 3453 | +} |
| 3454 | + |
| 3455 | +main "$@" |
| 3456 | + |
| 3457 | +# vi: ts=4 expandtab |
| 3458 | diff --git a/debian/tests/test-open-iscsi.py b/debian/tests/test-open-iscsi.py |
| 3459 | new file mode 100644 |
| 3460 | index 0000000..cce02fb |
| 3461 | --- /dev/null |
| 3462 | +++ b/debian/tests/test-open-iscsi.py |
| 3463 | @@ -0,0 +1,426 @@ |
| 3464 | +#!/usr/bin/python2 |
| 3465 | +# |
| 3466 | +# test-open-iscsi.py quality assurance test script for open-iscsi |
| 3467 | +# Copyright (C) 2011 Canonical Ltd. |
| 3468 | +# Author: Jamie Strandboge <jamie@canonical.com> |
| 3469 | +# |
| 3470 | +# This program is free software: you can redistribute it and/or modify |
| 3471 | +# it under the terms of the GNU General Public License version 3, |
| 3472 | +# as published by the Free Software Foundation. |
| 3473 | +# |
| 3474 | +# This program is distributed in the hope that it will be useful, |
| 3475 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 3476 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 3477 | +# GNU General Public License for more details. |
| 3478 | +# |
| 3479 | +# You should have received a copy of the GNU General Public License |
| 3480 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 3481 | +# |
| 3482 | +# packages required for test to run: |
| 3483 | +# QRT-Packages: open-iscsi |
| 3484 | +# packages where more than one package can satisfy a runtime requirement: |
| 3485 | +# QRT-Alternates: |
| 3486 | +# files and directories required for the test to run: |
| 3487 | +# QRT-Depends: |
| 3488 | +# privilege required for the test to run (remove line if running as user is okay): |
| 3489 | +# QRT-Privilege: root |
| 3490 | + |
| 3491 | +''' |
| 3492 | + In general, this test should be run in a virtual machine (VM) or possibly |
| 3493 | + a chroot and not on a production machine. While efforts are made to make |
| 3494 | + these tests non-destructive, there is no guarantee this script will not |
| 3495 | + alter the machine. You have been warned. |
| 3496 | + |
| 3497 | + How to run in a clean VM: |
| 3498 | + $ sudo apt-get -y install python-unit <QRT-Packages> && sudo ./test-PKG.py -v' |
| 3499 | + |
| 3500 | + How to run in a clean schroot named 'lucid': |
| 3501 | + $ schroot -c lucid -u root -- sh -c 'apt-get -y install python-unit <QRT-Packages> && ./test-PKG.py -v' |
| 3502 | + |
| 3503 | + |
| 3504 | + NOTES: |
| 3505 | + - currently only tested on Ubuntu 8.04 |
| 3506 | +''' |
| 3507 | + |
| 3508 | + |
| 3509 | +from netifaces import gateways, AF_INET |
| 3510 | +import unittest, subprocess, sys, os, glob |
| 3511 | +import shutil |
| 3512 | +import testlib |
| 3513 | +import textwrap |
| 3514 | +from tempfile import mkdtemp |
| 3515 | +import time |
| 3516 | + |
| 3517 | +# There are setup based on README.multipurpose-vm. Feel free to override. |
| 3518 | +remote_server = '' |
| 3519 | +username = 'ubuntu' |
| 3520 | +password = 'passwd' |
| 3521 | +username_in = 'ubuntu' |
| 3522 | +password_in = 'ubuntupasswd' |
| 3523 | +initiatorname = 'iqn.2009-10.com.example.hardy-multi:iscsi-01' |
| 3524 | + |
| 3525 | +COLLECT_USER_DATA = """\ |
| 3526 | +#cloud-config |
| 3527 | +bukket: |
| 3528 | + - &get_resolved_status | |
| 3529 | + if [ "${1:--}" != "-" ]; then |
| 3530 | + exec >"$1" 2>&1 |
| 3531 | + fi |
| 3532 | + if ! command -v systemd-resolve >/dev/null 2>&1; then |
| 3533 | + echo "systemd-resolve: not available." |
| 3534 | + exit |
| 3535 | + fi |
| 3536 | + if ! ( systemd-resolve --help | grep -q -- --status ); then |
| 3537 | + echo "systemd-resolve: no --status." |
| 3538 | + exit |
| 3539 | + fi |
| 3540 | + systemd-resolve --status --no-pager |
| 3541 | + |
| 3542 | + - &get_iscsid_status | |
| 3543 | + [ "${1:--}" != "-" ] && exec >"$1" 2>&1 |
| 3544 | + udevadm settle |
| 3545 | + systemctl is-active iscsid.service |
| 3546 | + systemctl status --no-pager --full iscsid.service |
| 3547 | + |
| 3548 | + - &add_and_remove_tuntap | |
| 3549 | + #!/bin/sh |
| 3550 | + # LP: #1785108 would break dns when any device was removed. |
| 3551 | + tapdev="mytap0" |
| 3552 | + echo ==== Adding $tapdev ==== |
| 3553 | + ip tuntap add mode tap user root $tapdev |
| 3554 | + udevadm settle |
| 3555 | + echo ==== Removing $tapdev ==== |
| 3556 | + ip tuntap del mode tap $tapdev |
| 3557 | + udevadm settle |
| 3558 | + |
| 3559 | + - &collect_debug_mounts | |
| 3560 | + [ "${1:--}" != "-" ] && exec >"$1" 2>&1 |
| 3561 | + [ -x /usr/local/bin/debug-mounts ] || exit 0 |
| 3562 | + /usr/local/bin/debug-mounts |
| 3563 | + |
| 3564 | +runcmd: |
| 3565 | + - [ sh, -c, *add_and_remove_tuntap ] |
| 3566 | + - [ mkdir, -p, /output ] |
| 3567 | + - [ cp, /etc/resolv.conf, /output ] |
| 3568 | + - [ sh, -c, *get_resolved_status, --, /output/systemd-resolve-status.txt ] |
| 3569 | + - [ sh, -c, *get_iscsid_status, --, /output/iscsid-status.txt ] |
| 3570 | + - [ sh, -c, *collect_debug_mounts, --, /output/debug-mounts.txt ] |
| 3571 | + - [ sh, -c, 'journalctl --boot=0 --output=short-monotonic > /output/journal.txt' ] |
| 3572 | + - [ sh, -c, 'dpkg-query --show > /output/manifest.txt' ] |
| 3573 | + - [ tar, -C, /output, -cf, /dev/disk/by-id/virtio-output-disk, . ] |
| 3574 | + |
| 3575 | +power_state: |
| 3576 | + mode: poweroff |
| 3577 | + message: cloud-init finished. Shutting down. |
| 3578 | + timeout: 60 |
| 3579 | +""" |
| 3580 | + |
| 3581 | +try: |
| 3582 | + from private.qrt.OpenIscsi import PrivateOpenIscsiTest |
| 3583 | +except ImportError: |
| 3584 | + class PrivateOpenIscsiTest(object): |
| 3585 | + '''Empty class''' |
| 3586 | + print >>sys.stdout, "Skipping private tests" |
| 3587 | + |
| 3588 | +class OpenIscsiTest(testlib.TestlibCase, PrivateOpenIscsiTest): |
| 3589 | + '''Test my thing.''' |
| 3590 | + |
| 3591 | + def setUp(self): |
| 3592 | + '''Set up prior to each test_* function''' |
| 3593 | + self.pidfile = "/var/run/iscsid.pid" |
| 3594 | + self.exe = "/sbin/iscsid" |
| 3595 | + self.daemon = testlib.TestDaemon(["service", "open-iscsi"]) |
| 3596 | + self.initiatorname_iscsi = '/etc/iscsi/initiatorname.iscsi' |
| 3597 | + self.iscsid_conf = '/etc/iscsi/iscsid.conf' |
| 3598 | + |
| 3599 | + def tearDown(self): |
| 3600 | + '''Clean up after each test_* function''' |
| 3601 | + global remote_server |
| 3602 | + global initiatorname |
| 3603 | + |
| 3604 | + # If remote server is setup, convert back to manual, logout, remove |
| 3605 | + # testlib configs and restart (in that order) |
| 3606 | + if remote_server != '': |
| 3607 | + testlib.cmd(['iscsiadm', '-m', 'node', '--targetname', initiatorname, '-p', '%s:3260' % remote_server, '--op=update', '--name', 'node.startup', '--value=manual']) |
| 3608 | + testlib.cmd(['iscsiadm', '-m', 'node', '--targetname', initiatorname, '-p', '%s:3260' % remote_server, '--op=update', '--name', 'node.conn[0].startup', '--value=manual']) |
| 3609 | + testlib.cmd(['iscsiadm', '-m', 'node', '--targetname', initiatorname, '-p', '%s:3260' % remote_server, '--logout']) |
| 3610 | + |
| 3611 | + testlib.config_restore(self.initiatorname_iscsi) |
| 3612 | + testlib.config_restore(self.iscsid_conf) |
| 3613 | + self.daemon.restart() |
| 3614 | + |
| 3615 | + def test_discovery_with_server(self): |
| 3616 | + '''Test iscsi_discovery to remote server''' |
| 3617 | + global remote_server |
| 3618 | + global username |
| 3619 | + global password |
| 3620 | + global username_in |
| 3621 | + global password_in |
| 3622 | + global initiatorname |
| 3623 | + |
| 3624 | + if remote_server == '': |
| 3625 | + return self._skipped("--remote-server not specified") |
| 3626 | + |
| 3627 | + contents = ''' |
| 3628 | +InitiatorName=%s |
| 3629 | +InitiatorAlias=ubuntu |
| 3630 | +''' % (initiatorname) |
| 3631 | + testlib.config_replace(self.initiatorname_iscsi, contents, True) |
| 3632 | + |
| 3633 | + contents = ''' |
| 3634 | +node.session.auth.authmethod = CHAP |
| 3635 | +node.session.auth.username = %s |
| 3636 | +node.session.auth.password = %s |
| 3637 | +node.session.auth.username_in = %s |
| 3638 | +node.session.auth.password_in = %s |
| 3639 | + |
| 3640 | +discovery.sendtargets.auth.authmethod = CHAP |
| 3641 | +discovery.sendtargets.auth.username = %s |
| 3642 | +discovery.sendtargets.auth.password = %s |
| 3643 | +discovery.sendtargets.auth.username_in = %s |
| 3644 | +discovery.sendtargets.auth.password_in = %s |
| 3645 | +''' % (username, password, username_in, password_in, username, password, username_in, password_in) |
| 3646 | + testlib.config_replace(self.iscsid_conf, contents, True) |
| 3647 | + |
| 3648 | + self.assertTrue(self.daemon.restart()) |
| 3649 | + time.sleep(2) |
| 3650 | + self.assertTrue(self.daemon.status()[0]) |
| 3651 | + |
| 3652 | + rc, report = testlib.cmd(["/sbin/iscsi_discovery", remote_server]) |
| 3653 | + expected = 0 |
| 3654 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 3655 | + self.assertEquals(expected, rc, result + report) |
| 3656 | + for i in ['starting discovery to %s' % remote_server, |
| 3657 | + 'Testing iser-login to target %s portal %s' % (initiatorname, remote_server), |
| 3658 | + 'starting to test tcp-login to target %s portal %s' % (initiatorname, remote_server), |
| 3659 | + 'discovered 1 targets at %s, connected to 1' % remote_server]: |
| 3660 | + result = "Could not find '%s' in report:\n" % i |
| 3661 | + self.assertTrue(i in report, result + report) |
| 3662 | + |
| 3663 | + def test_net_interface_handler_execute_bit(self): |
| 3664 | + '''Test /lib/open-iscsi/net-interface-handler is executable.''' |
| 3665 | + nih_path = '/lib/open-iscsi/net-interface-handler' |
| 3666 | + self.assertTrue(os.access(nih_path, os.X_OK)) |
| 3667 | + |
| 3668 | +class CloudImageTest(testlib.TestlibCase, PrivateOpenIscsiTest): |
| 3669 | + '''Test the cloud image can boot on iscsi root. |
| 3670 | + |
| 3671 | + See README-boot-test.md for more information. |
| 3672 | + ''' |
| 3673 | + |
| 3674 | + @classmethod |
| 3675 | + def setUpClass(cls): |
| 3676 | + reason = ( |
| 3677 | + "Skipped Cloud Image test on {arch}. whitelisted are: {whitelist}") |
| 3678 | + whitelisted = os.environ.get('WHITELIST_ARCHES', 'amd64').split(",") |
| 3679 | + curarch = testlib.manager.dpkg_arch |
| 3680 | + if testlib.manager.dpkg_arch not in whitelisted: |
| 3681 | + raise unittest.SkipTest( |
| 3682 | + reason.format(arch=curarch, whitelist=whitelisted)) |
| 3683 | + |
| 3684 | + here = os.path.dirname(os.path.abspath(__file__)) |
| 3685 | + os.environ['PATH'] = "%s:%s" % (here, os.environ['PATH']) |
| 3686 | + release = os.environ.get( |
| 3687 | + "ISCSI_TEST_RELEASE", testlib.ubuntu_release()) |
| 3688 | + image_d = os.path.join(here, '{}.d'.format(release)) |
| 3689 | + # Download MAAS ephemeral image. |
| 3690 | + info = {'release': release, |
| 3691 | + 'image_d': image_d, |
| 3692 | + 'root_image': os.path.join(image_d, 'disk.img'), |
| 3693 | + 'kernel': os.path.join(image_d, 'kernel'), |
| 3694 | + 'initrd': os.path.join(image_d, 'initrd')} |
| 3695 | + try: |
| 3696 | + get_image(info['image_d'], release) |
| 3697 | + except subprocess.CalledProcessError as e: |
| 3698 | + if e.return_code != 3: |
| 3699 | + raise e |
| 3700 | + raise unittest.SkipTest( |
| 3701 | + "Cloud Image not available for release '%s'." % release) |
| 3702 | + if os.environ.get("NO_PATCH_IMAGE", "0") == "0": |
| 3703 | + patch_image(info['root_image'], |
| 3704 | + kernel=info['kernel'], initrd=info['initrd']) |
| 3705 | + cls.info = info |
| 3706 | + cls.here = here |
| 3707 | + |
| 3708 | + def tearDown(self): |
| 3709 | + super(CloudImageTest, self).tearDown() |
| 3710 | + if os.path.exists(self.tmpdir): |
| 3711 | + shutil.rmtree(self.tmpdir) |
| 3712 | + |
| 3713 | + def setUp(self): |
| 3714 | + super(CloudImageTest, self).setUp() |
| 3715 | + self.tmpdir = mkdtemp() |
| 3716 | + udp = os.path.join(self.tmpdir, 'user-data') |
| 3717 | + with open(udp, "w") as fp: |
| 3718 | + fp.write(COLLECT_USER_DATA) |
| 3719 | + self.info['user-data'] = udp |
| 3720 | + |
| 3721 | + def create_output_disk(self): |
| 3722 | + path = os.path.join(self.tmpdir, 'output-disk.img') |
| 3723 | + subprocess.check_call([ |
| 3724 | + 'qemu-img', 'create', '-f', 'raw', path, '10M']) |
| 3725 | + return path |
| 3726 | + |
| 3727 | + def extract_files(self, path): |
| 3728 | + # get contents in a dictionary of tarball at 'path' |
| 3729 | + tmpdir = mkdtemp() |
| 3730 | + try: |
| 3731 | + subprocess.check_call(['tar', '-C', tmpdir, '-xf', path]) |
| 3732 | + flist = {} |
| 3733 | + prefix = len(tmpdir) + 1 |
| 3734 | + for root, dirs, files in os.walk(tmpdir): |
| 3735 | + for fname in files: |
| 3736 | + fpath = os.path.join(root, fname) |
| 3737 | + key = fpath[prefix:] |
| 3738 | + with open(fpath, "r") as fp: |
| 3739 | + flist[key] = fp.read() |
| 3740 | + return flist |
| 3741 | + finally: |
| 3742 | + shutil.rmtree(tmpdir) |
| 3743 | + |
| 3744 | + def test_tgt_boot(self): |
| 3745 | + tgt_boot_cmd = os.path.join(self.here, 'tgt-boot-test') |
| 3746 | + # Add self.here to PATH so xkvm will be available to tgt-boot-test |
| 3747 | + dns_addr = '10.1.1.4' |
| 3748 | + rel_dir = '{}.d'.format(self.info['release']) |
| 3749 | + dns_search = 'example.com' |
| 3750 | + info = {'host': '10.1.1.2', 'dns': dns_addr, |
| 3751 | + 'dnssearch': dns_search, 'network': '10.1.1.0/24'} |
| 3752 | + netdev = ("--netdev=user,net={network},host={host},dns={dns}," |
| 3753 | + "dnssearch={dnssearch}").format(**info) |
| 3754 | + |
| 3755 | + artifacts_dir = os.environ.get('AUTOPKGTEST_ARTIFACTS') |
| 3756 | + if artifacts_dir and not os.path.isdir(artifacts_dir): |
| 3757 | + os.makedirs(artifacts_dir) |
| 3758 | + |
| 3759 | + output_disk = self.create_output_disk() |
| 3760 | + cmd = [ |
| 3761 | + tgt_boot_cmd, '-v', netdev, |
| 3762 | + '--disk=%s,serial=output-disk' % output_disk, |
| 3763 | + '--user-data-add=%s' % self.info['user-data'], |
| 3764 | + self.info['root_image'], self.info['kernel'], |
| 3765 | + self.info['initrd']] |
| 3766 | + sys.stderr.write(' '.join(cmd) + "\n") |
| 3767 | + |
| 3768 | + env = os.environ.copy() |
| 3769 | + env['BOOT_TIMEOUT'] = env.get('BOOT_TIMEOUT', '60m') |
| 3770 | + subprocess.check_call(cmd, env=env) |
| 3771 | + |
| 3772 | + if artifacts_dir: |
| 3773 | + tgz = os.path.join(artifacts_dir, "tgt-collected.tar.gz") |
| 3774 | + shutil.copy(output_disk, tgz) |
| 3775 | + print("Copied output_disk '%s' to artifacts dir '%s'" % |
| 3776 | + (output_disk, tgz)) |
| 3777 | + |
| 3778 | + files = self.extract_files(output_disk) |
| 3779 | + print("collected files: %s" % files.keys()) |
| 3780 | + resolvconf = files.get('resolv.conf', "NO_RESOLVCONF_FOUND") |
| 3781 | + resolve_status = files.get('systemd-resolve-status.txt') |
| 3782 | + |
| 3783 | + resolvconf_id = 'generated by resolvconf' |
| 3784 | + resolved_addr = "127.0.0.53" |
| 3785 | + if resolvconf_id in resolvconf: |
| 3786 | + print("resolvconf manages resolvconf.\n") |
| 3787 | + self.assertIn( |
| 3788 | + dns_addr, resolvconf, |
| 3789 | + msg = ("%s not in resolvconf contents: \n%s" % |
| 3790 | + (dns_addr, resolvconf))) |
| 3791 | + if dns_search in resolvconf: |
| 3792 | + print("%s was found in resolv.conf." % dns_search) |
| 3793 | + elif resolved_addr in resolvconf and dns_search in resolve_status: |
| 3794 | + # zesty has resolvconf and systemd-resolved. |
| 3795 | + print("%s was in resolve_status and %s in resolv.conf" % |
| 3796 | + (resolved_addr, dns_search)) |
| 3797 | + else: |
| 3798 | + raise AssertionError( |
| 3799 | + "%s domain is not being searched." % dns_search) |
| 3800 | + |
| 3801 | + else: |
| 3802 | + print("systemd-resolved managing resolve.conf\n") |
| 3803 | + self.assertIn( |
| 3804 | + resolved_addr, resolvconf, |
| 3805 | + msg="%s not in resolved resolv.conf: %s" % (resolved_addr, |
| 3806 | + resolvconf)) |
| 3807 | + self.assertIn(dns_addr, resolve_status, |
| 3808 | + msg=("%s not in systemd-resolve status: %s" % |
| 3809 | + (dns_addr, resolve_status))) |
| 3810 | + self.assertIn(dns_search, resolve_status, |
| 3811 | + msg=("search addr '%s' not in systemd-resolve status: %s" % |
| 3812 | + (dns_search, resolve_status))) |
| 3813 | + |
| 3814 | + # iscsid-status.txt has first line output from |
| 3815 | + # 'systemctl is-active iscsid.service' and then 'systemcl status' |
| 3816 | + iscsid_status = files.get('iscsid-status.txt') |
| 3817 | + is_active = iscsid_status.splitlines()[0] |
| 3818 | + self.assertEqual( |
| 3819 | + "active", is_active, |
| 3820 | + msg=("Expected iscsid.service active, found '%s'.\n%s\n" % |
| 3821 | + (is_active, iscsid_status))) |
| 3822 | + |
| 3823 | + |
| 3824 | +def get_image(top_d, release): |
| 3825 | + cmd = ['get-image', top_d, 'cloud-daily', release] |
| 3826 | + subprocess.check_call(cmd) |
| 3827 | + |
| 3828 | + |
| 3829 | +def patch_image(image, packages=None, kernel=None, initrd=None): |
| 3830 | + '''Patch root-image with dep8 built open-iscsi package.''' |
| 3831 | + |
| 3832 | + if packages is None: |
| 3833 | + # an empty 'packages' to patch-image still installs open-iscsi |
| 3834 | + packages = [] |
| 3835 | + |
| 3836 | + cmd = ['patch-image', image] |
| 3837 | + if kernel: |
| 3838 | + cmd.append('--kernel=%s' % kernel) |
| 3839 | + if initrd: |
| 3840 | + cmd.append('--initrd=%s' % initrd) |
| 3841 | + cmd.extend(packages) |
| 3842 | + |
| 3843 | + subprocess.check_call(cmd) |
| 3844 | + |
| 3845 | + |
| 3846 | +if __name__ == '__main__': |
| 3847 | + import optparse |
| 3848 | + parser = optparse.OptionParser() |
| 3849 | + parser.add_option("-v", "--verbose", dest="verbose", help="Verbose", action="store_true") |
| 3850 | + parser.add_option("-s", "--remote-server", dest="remote_server", help="Specify host with available iSCSI volumes", metavar="HOST") |
| 3851 | + |
| 3852 | + parser.add_option("-n", "--initiatorname", dest="initiatorname", help="Specify initiatorname for use with --remote-server", metavar="NAME") |
| 3853 | + |
| 3854 | + parser.add_option("--password", dest="password", help="Specify password for use with --remote-server", metavar="PASS") |
| 3855 | + parser.add_option("--password-in", dest="password_in", help="Specify password_in for use with --remote-server", metavar="PASS") |
| 3856 | + |
| 3857 | + parser.add_option("--username", dest="username", help="Specify username for use with --remote-server", metavar="USER") |
| 3858 | + parser.add_option("--username-in", dest="username_in", help="Specify username_in for use with --remote-server", metavar="USER") |
| 3859 | + |
| 3860 | + (options, args) = parser.parse_args() |
| 3861 | + |
| 3862 | + if options.remote_server: |
| 3863 | + remote_server = options.remote_server |
| 3864 | + |
| 3865 | + if options.username: |
| 3866 | + username = options.username |
| 3867 | + if options.password: |
| 3868 | + password = options.password |
| 3869 | + if options.username_in: |
| 3870 | + username_in = options.username_in |
| 3871 | + if options.password_in: |
| 3872 | + password_in = options.password_in |
| 3873 | + if options.initiatorname: |
| 3874 | + initiatorname = options.initiatorname |
| 3875 | + print "Connecting to remote server with:" |
| 3876 | + print " host = %s " % remote_server |
| 3877 | + print ' initiatorname = %s' % initiatorname |
| 3878 | + print ' username = %s' % username |
| 3879 | + print ' password = %s' % password |
| 3880 | + print ' username_in = %s' % username_in |
| 3881 | + print ' password_in = %s' % password_in |
| 3882 | + |
| 3883 | + suite = unittest.TestSuite() |
| 3884 | + suite.addTest(unittest.TestLoader().loadTestsFromTestCase(OpenIscsiTest)) |
| 3885 | + suite.addTest(unittest.TestLoader().loadTestsFromTestCase( |
| 3886 | + CloudImageTest)) |
| 3887 | + rc = unittest.TextTestRunner(verbosity=2).run(suite) |
| 3888 | + if not rc.wasSuccessful(): |
| 3889 | + sys.exit(1) |
| 3890 | diff --git a/debian/tests/testlib.py b/debian/tests/testlib.py |
| 3891 | new file mode 100644 |
| 3892 | index 0000000..b17c3fc |
| 3893 | --- /dev/null |
| 3894 | +++ b/debian/tests/testlib.py |
| 3895 | @@ -0,0 +1,1153 @@ |
| 3896 | +# |
| 3897 | +# testlib.py quality assurance test script |
| 3898 | +# Copyright (C) 2008-2011 Canonical Ltd. |
| 3899 | +# |
| 3900 | +# This library is free software; you can redistribute it and/or |
| 3901 | +# modify it under the terms of the GNU Library General Public |
| 3902 | +# License as published by the Free Software Foundation; either |
| 3903 | +# version 2 of the License. |
| 3904 | +# |
| 3905 | +# This library is distributed in the hope that it will be useful, |
| 3906 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 3907 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 3908 | +# Library General Public License for more details. |
| 3909 | +# |
| 3910 | +# You should have received a copy of the GNU Library General Public |
| 3911 | +# License along with this program. If not, see |
| 3912 | +# <http://www.gnu.org/licenses/>. |
| 3913 | +# |
| 3914 | + |
| 3915 | +'''Common classes and functions for package tests.''' |
| 3916 | + |
| 3917 | +import string, random, crypt, subprocess, pwd, grp, signal, time, unittest, tempfile, shutil, os, os.path, re, glob |
| 3918 | +import sys, socket, gzip |
| 3919 | +from stat import * |
| 3920 | +from encodings import string_escape |
| 3921 | + |
| 3922 | +import warnings |
| 3923 | +warnings.filterwarnings('ignore', message=r'.*apt_pkg\.TagFile.*', category=DeprecationWarning) |
| 3924 | +try: |
| 3925 | + import apt_pkg |
| 3926 | + apt_pkg.InitSystem(); |
| 3927 | +except: |
| 3928 | + # On non-Debian system, fall back to simple comparison without debianisms |
| 3929 | + class apt_pkg(object): |
| 3930 | + def VersionCompare(one, two): |
| 3931 | + list_one = one.split('.') |
| 3932 | + list_two = two.split('.') |
| 3933 | + while len(list_one)>0 and len(list_two)>0: |
| 3934 | + if list_one[0] > list_two[0]: |
| 3935 | + return 1 |
| 3936 | + if list_one[0] < list_two[0]: |
| 3937 | + return -1 |
| 3938 | + list_one.pop(0) |
| 3939 | + list_two.pop(0) |
| 3940 | + return 0 |
| 3941 | + |
| 3942 | +bogus_nxdomain = "208.69.32.132" |
| 3943 | + |
| 3944 | +# http://www.chiark.greenend.org.uk/ucgi/~cjwatson/blosxom/2009-07-02-python-sigpipe.html |
| 3945 | +# This is needed so that the subprocesses that produce endless output |
| 3946 | +# actually quit when the reader goes away. |
| 3947 | +import signal |
| 3948 | +def subprocess_setup(): |
| 3949 | + # Python installs a SIGPIPE handler by default. This is usually not what |
| 3950 | + # non-Python subprocesses expect. |
| 3951 | + signal.signal(signal.SIGPIPE, signal.SIG_DFL) |
| 3952 | + |
| 3953 | +class TimedOutException(Exception): |
| 3954 | + def __init__(self, value = "Timed Out"): |
| 3955 | + self.value = value |
| 3956 | + def __str__(self): |
| 3957 | + return repr(self.value) |
| 3958 | + |
| 3959 | +def _restore_backup(path): |
| 3960 | + pathbackup = path + '.autotest' |
| 3961 | + if os.path.exists(pathbackup): |
| 3962 | + shutil.move(pathbackup, path) |
| 3963 | + |
| 3964 | +def _save_backup(path): |
| 3965 | + pathbackup = path + '.autotest' |
| 3966 | + if os.path.exists(path) and not os.path.exists(pathbackup): |
| 3967 | + shutil.copy2(path, pathbackup) |
| 3968 | + # copy2 does not copy ownership, so do it here. |
| 3969 | + # Reference: http://docs.python.org/library/shutil.html |
| 3970 | + a = os.stat(path) |
| 3971 | + os.chown(pathbackup, a[4], a[5]) |
| 3972 | + |
| 3973 | +def config_copydir(path): |
| 3974 | + if os.path.exists(path) and not os.path.isdir(path): |
| 3975 | + raise OSError, "'%s' is not a directory" % (path) |
| 3976 | + _restore_backup(path) |
| 3977 | + |
| 3978 | + pathbackup = path + '.autotest' |
| 3979 | + if os.path.exists(path): |
| 3980 | + shutil.copytree(path, pathbackup, symlinks=True) |
| 3981 | + |
| 3982 | +def config_replace(path,contents,append=False): |
| 3983 | + '''Replace (or append) to a config file''' |
| 3984 | + _restore_backup(path) |
| 3985 | + if os.path.exists(path): |
| 3986 | + _save_backup(path) |
| 3987 | + if append: |
| 3988 | + contents = file(path).read() + contents |
| 3989 | + open(path, 'w').write(contents) |
| 3990 | + |
| 3991 | +def config_comment(path, field): |
| 3992 | + _save_backup(path) |
| 3993 | + contents = "" |
| 3994 | + for line in file(path): |
| 3995 | + if re.search("^\s*%s\s*=" % (field), line): |
| 3996 | + line = "#" + line |
| 3997 | + contents += line |
| 3998 | + |
| 3999 | + open(path+'.new', 'w').write(contents) |
| 4000 | + os.rename(path+'.new', path) |
| 4001 | + |
| 4002 | +def config_set(path, field, value, spaces=True): |
| 4003 | + _save_backup(path) |
| 4004 | + contents = "" |
| 4005 | + if spaces==True: |
| 4006 | + setting = '%s = %s\n' % (field, value) |
| 4007 | + else: |
| 4008 | + setting = '%s=%s\n' % (field, value) |
| 4009 | + found = False |
| 4010 | + for line in file(path): |
| 4011 | + if re.search("^\s*%s\s*=" % (field), line): |
| 4012 | + found = True |
| 4013 | + line = setting |
| 4014 | + contents += line |
| 4015 | + if not found: |
| 4016 | + contents += setting |
| 4017 | + |
| 4018 | + open(path+'.new', 'w').write(contents) |
| 4019 | + os.rename(path+'.new', path) |
| 4020 | + |
| 4021 | +def config_patch(path, patch, depth=1): |
| 4022 | + '''Patch a config file''' |
| 4023 | + _restore_backup(path) |
| 4024 | + _save_backup(path) |
| 4025 | + |
| 4026 | + handle, name = mkstemp_fill(patch) |
| 4027 | + rc = subprocess.call(['/usr/bin/patch', '-p%s' %(depth), path], stdin=handle, stdout=subprocess.PIPE) |
| 4028 | + os.unlink(name) |
| 4029 | + if rc != 0: |
| 4030 | + raise Exception("Patch failed") |
| 4031 | + |
| 4032 | +def config_restore(path): |
| 4033 | + '''Rename a replaced config file back to its initial state''' |
| 4034 | + _restore_backup(path) |
| 4035 | + |
| 4036 | +def timeout(secs, f, *args): |
| 4037 | + def handler(signum, frame): |
| 4038 | + raise TimedOutException() |
| 4039 | + |
| 4040 | + old = signal.signal(signal.SIGALRM, handler) |
| 4041 | + result = None |
| 4042 | + signal.alarm(secs) |
| 4043 | + try: |
| 4044 | + result = f(*args) |
| 4045 | + finally: |
| 4046 | + signal.alarm(0) |
| 4047 | + signal.signal(signal.SIGALRM, old) |
| 4048 | + |
| 4049 | + return result |
| 4050 | + |
| 4051 | +def require_nonroot(): |
| 4052 | + if os.geteuid() == 0: |
| 4053 | + print >>sys.stderr, "This series of tests should be run as a regular user with sudo access, not as root." |
| 4054 | + sys.exit(1) |
| 4055 | + |
| 4056 | +def require_root(): |
| 4057 | + if os.geteuid() != 0: |
| 4058 | + print >>sys.stderr, "This series of tests should be run with root privileges (e.g. via sudo)." |
| 4059 | + sys.exit(1) |
| 4060 | + |
| 4061 | +def require_sudo(): |
| 4062 | + if os.geteuid() != 0 or os.environ.get('SUDO_USER', None) == None: |
| 4063 | + print >>sys.stderr, "This series of tests must be run under sudo." |
| 4064 | + sys.exit(1) |
| 4065 | + if os.environ['SUDO_USER'] == 'root': |
| 4066 | + print >>sys.stderr, 'Please run this test using sudo from a regular user. (You ran sudo from root.)' |
| 4067 | + sys.exit(1) |
| 4068 | + |
| 4069 | +def random_string(length,lower=False): |
| 4070 | + '''Return a random string, consisting of ASCII letters, with given |
| 4071 | + length.''' |
| 4072 | + |
| 4073 | + s = '' |
| 4074 | + selection = string.letters |
| 4075 | + if lower: |
| 4076 | + selection = string.lowercase |
| 4077 | + maxind = len(selection)-1 |
| 4078 | + for l in range(length): |
| 4079 | + s += selection[random.randint(0, maxind)] |
| 4080 | + return s |
| 4081 | + |
| 4082 | +def mkstemp_fill(contents,suffix='',prefix='testlib-',dir=None): |
| 4083 | + '''As tempfile.mkstemp does, return a (file, name) pair, but with |
| 4084 | + prefilled contents.''' |
| 4085 | + |
| 4086 | + handle, name = tempfile.mkstemp(suffix=suffix,prefix=prefix,dir=dir) |
| 4087 | + os.close(handle) |
| 4088 | + handle = file(name,"w+") |
| 4089 | + handle.write(contents) |
| 4090 | + handle.flush() |
| 4091 | + handle.seek(0) |
| 4092 | + |
| 4093 | + return handle, name |
| 4094 | + |
| 4095 | +def create_fill(path, contents, mode=0644): |
| 4096 | + '''Safely create a page''' |
| 4097 | + # make the temp file in the same dir as the destination file so we |
| 4098 | + # don't get invalid cross-device link errors when we rename |
| 4099 | + handle, name = mkstemp_fill(contents, dir=os.path.dirname(path)) |
| 4100 | + handle.close() |
| 4101 | + os.rename(name, path) |
| 4102 | + os.chmod(path, mode) |
| 4103 | + |
| 4104 | +def login_exists(login): |
| 4105 | + '''Checks whether the given login exists on the system.''' |
| 4106 | + |
| 4107 | + try: |
| 4108 | + pwd.getpwnam(login) |
| 4109 | + return True |
| 4110 | + except KeyError: |
| 4111 | + return False |
| 4112 | + |
| 4113 | +def group_exists(group): |
| 4114 | + '''Checks whether the given login exists on the system.''' |
| 4115 | + |
| 4116 | + try: |
| 4117 | + grp.getgrnam(group) |
| 4118 | + return True |
| 4119 | + except KeyError: |
| 4120 | + return False |
| 4121 | + |
| 4122 | +def recursive_rm(dirPath, contents_only=False): |
| 4123 | + '''recursively remove directory''' |
| 4124 | + names = os.listdir(dirPath) |
| 4125 | + for name in names: |
| 4126 | + path = os.path.join(dirPath, name) |
| 4127 | + if os.path.islink(path) or not os.path.isdir(path): |
| 4128 | + os.unlink(path) |
| 4129 | + else: |
| 4130 | + recursive_rm(path) |
| 4131 | + if contents_only == False: |
| 4132 | + os.rmdir(dirPath) |
| 4133 | + |
| 4134 | +def check_pidfile(exe, pidfile): |
| 4135 | + '''Checks if pid in pidfile is running''' |
| 4136 | + if not os.path.exists(pidfile): |
| 4137 | + return False |
| 4138 | + |
| 4139 | + # get the pid |
| 4140 | + try: |
| 4141 | + fd = open(pidfile, 'r') |
| 4142 | + pid = fd.readline().rstrip('\n') |
| 4143 | + fd.close() |
| 4144 | + except: |
| 4145 | + return False |
| 4146 | + |
| 4147 | + return check_pid(exe, pid) |
| 4148 | + |
| 4149 | +def check_pid(exe, pid): |
| 4150 | + '''Checks if pid is running''' |
| 4151 | + cmdline = "/proc/%s/cmdline" % (str(pid)) |
| 4152 | + if not os.path.exists(cmdline): |
| 4153 | + return False |
| 4154 | + |
| 4155 | + # get the command line |
| 4156 | + try: |
| 4157 | + fd = open(cmdline, 'r') |
| 4158 | + tmp = fd.readline().split('\0') |
| 4159 | + fd.close() |
| 4160 | + except: |
| 4161 | + return False |
| 4162 | + |
| 4163 | + # this allows us to match absolute paths or just the executable name |
| 4164 | + if re.match('^' + exe + '$', tmp[0]) or \ |
| 4165 | + re.match('.*/' + exe + '$', tmp[0]) or \ |
| 4166 | + re.match('^' + exe + ': ', tmp[0]) or \ |
| 4167 | + re.match('^\(' + exe + '\)', tmp[0]): |
| 4168 | + return True |
| 4169 | + |
| 4170 | + return False |
| 4171 | + |
| 4172 | +def check_port(port, proto, ver=4): |
| 4173 | + '''Check if something is listening on the specified port. |
| 4174 | + WARNING: for some reason this does not work with a bind mounted /proc |
| 4175 | + ''' |
| 4176 | + assert (port >= 1) |
| 4177 | + assert (port <= 65535) |
| 4178 | + assert (proto.lower() == "tcp" or proto.lower() == "udp") |
| 4179 | + assert (ver == 4 or ver == 6) |
| 4180 | + |
| 4181 | + fn = "/proc/net/%s" % (proto) |
| 4182 | + if ver == 6: |
| 4183 | + fn += str(ver) |
| 4184 | + |
| 4185 | + rc, report = cmd(['cat', fn]) |
| 4186 | + assert (rc == 0) |
| 4187 | + |
| 4188 | + hport = "%0.4x" % port |
| 4189 | + |
| 4190 | + if re.search(': [0-9a-f]{8}:%s [0-9a-f]' % str(hport).lower(), report.lower()): |
| 4191 | + return True |
| 4192 | + return False |
| 4193 | + |
| 4194 | +def get_arch(): |
| 4195 | + '''Get the current architecture''' |
| 4196 | + rc, report = cmd(['uname', '-m']) |
| 4197 | + assert (rc == 0) |
| 4198 | + return report.strip() |
| 4199 | + |
| 4200 | +def get_memory(): |
| 4201 | + '''Gets total ram and swap''' |
| 4202 | + meminfo = "/proc/meminfo" |
| 4203 | + memtotal = 0 |
| 4204 | + swaptotal = 0 |
| 4205 | + if not os.path.exists(meminfo): |
| 4206 | + return (False, False) |
| 4207 | + |
| 4208 | + try: |
| 4209 | + fd = open(meminfo, 'r') |
| 4210 | + for line in fd.readlines(): |
| 4211 | + splitline = line.split() |
| 4212 | + if splitline[0] == 'MemTotal:': |
| 4213 | + memtotal = int(splitline[1]) |
| 4214 | + elif splitline[0] == 'SwapTotal:': |
| 4215 | + swaptotal = int(splitline[1]) |
| 4216 | + fd.close() |
| 4217 | + except: |
| 4218 | + return (False, False) |
| 4219 | + |
| 4220 | + return (memtotal,swaptotal) |
| 4221 | + |
| 4222 | +def is_running_in_vm(): |
| 4223 | + '''Check if running under a VM''' |
| 4224 | + # add other virtualization environments here |
| 4225 | + for search in ['QEMU Virtual CPU']: |
| 4226 | + rc, report = cmd_pipe(['dmesg'], ['grep', search]) |
| 4227 | + if rc == 0: |
| 4228 | + return True |
| 4229 | + return False |
| 4230 | + |
| 4231 | +def ubuntu_release(): |
| 4232 | + '''Get the Ubuntu release''' |
| 4233 | + f = "/etc/lsb-release" |
| 4234 | + try: |
| 4235 | + size = os.stat(f)[ST_SIZE] |
| 4236 | + except: |
| 4237 | + return "UNKNOWN" |
| 4238 | + |
| 4239 | + if size > 1024*1024: |
| 4240 | + raise IOError, 'Could not open "%s" (too big)' % f |
| 4241 | + |
| 4242 | + try: |
| 4243 | + fh = open("/etc/lsb-release", 'r') |
| 4244 | + except: |
| 4245 | + raise |
| 4246 | + |
| 4247 | + lines = fh.readlines() |
| 4248 | + fh.close() |
| 4249 | + |
| 4250 | + pat = re.compile(r'DISTRIB_CODENAME') |
| 4251 | + for line in lines: |
| 4252 | + if pat.search(line): |
| 4253 | + return line.split('=')[1].rstrip('\n').rstrip('\r') |
| 4254 | + |
| 4255 | + return "UNKNOWN" |
| 4256 | + |
| 4257 | +def cmd(command, input = None, stderr = subprocess.STDOUT, stdout = subprocess.PIPE, stdin = None, timeout = None): |
| 4258 | + '''Try to execute given command (array) and return its stdout, or return |
| 4259 | + a textual error if it failed.''' |
| 4260 | + |
| 4261 | + try: |
| 4262 | + sp = subprocess.Popen(command, stdin=stdin, stdout=stdout, stderr=stderr, close_fds=True, preexec_fn=subprocess_setup) |
| 4263 | + except OSError, e: |
| 4264 | + return [127, str(e)] |
| 4265 | + |
| 4266 | + out, outerr = sp.communicate(input) |
| 4267 | + # Handle redirection of stdout |
| 4268 | + if out == None: |
| 4269 | + out = '' |
| 4270 | + # Handle redirection of stderr |
| 4271 | + if outerr == None: |
| 4272 | + outerr = '' |
| 4273 | + return [sp.returncode,out+outerr] |
| 4274 | + |
| 4275 | +def cmd_pipe(command1, command2, input = None, stderr = subprocess.STDOUT, stdin = None): |
| 4276 | + '''Try to pipe command1 into command2.''' |
| 4277 | + try: |
| 4278 | + sp1 = subprocess.Popen(command1, stdin=stdin, stdout=subprocess.PIPE, stderr=stderr, close_fds=True) |
| 4279 | + sp2 = subprocess.Popen(command2, stdin=sp1.stdout, stdout=subprocess.PIPE, stderr=stderr, close_fds=True) |
| 4280 | + except OSError, e: |
| 4281 | + return [127, str(e)] |
| 4282 | + |
| 4283 | + out = sp2.communicate(input)[0] |
| 4284 | + return [sp2.returncode,out] |
| 4285 | + |
| 4286 | +def cwd_has_enough_space(cdir, total_bytes): |
| 4287 | + '''Determine if the partition of the current working directory has 'bytes' |
| 4288 | + free.''' |
| 4289 | + rc, df_output = cmd(['df']) |
| 4290 | + result = 'Got exit code %d, expected %d\n' % (rc, 0) |
| 4291 | + if rc != 0: |
| 4292 | + return False |
| 4293 | + |
| 4294 | + kb = total_bytes / 1024 |
| 4295 | + |
| 4296 | + mounts = dict() |
| 4297 | + for line in df_output.splitlines(): |
| 4298 | + if '/' not in line: |
| 4299 | + continue |
| 4300 | + tmp = line.split() |
| 4301 | + mounts[tmp[5]] = int(tmp[3]) |
| 4302 | + |
| 4303 | + cdir = os.getcwd() |
| 4304 | + while cdir != '/': |
| 4305 | + if not mounts.has_key(cdir): |
| 4306 | + cdir = os.path.dirname(cdir) |
| 4307 | + continue |
| 4308 | + if kb < mounts[cdir]: |
| 4309 | + return True |
| 4310 | + else: |
| 4311 | + return False |
| 4312 | + |
| 4313 | + if kb < mounts['/']: |
| 4314 | + return True |
| 4315 | + |
| 4316 | + return False |
| 4317 | + |
| 4318 | +def get_md5(filename): |
| 4319 | + '''Gets the md5sum of the file specified''' |
| 4320 | + |
| 4321 | + (rc, report) = cmd(["/usr/bin/md5sum", "-b", filename]) |
| 4322 | + expected = 0 |
| 4323 | + assert (expected == rc) |
| 4324 | + |
| 4325 | + return report.split(' ')[0] |
| 4326 | + |
| 4327 | +def dpkg_compare_installed_version(pkg, check, version): |
| 4328 | + '''Gets the version for the installed package, and compares it to the |
| 4329 | + specified version. |
| 4330 | + ''' |
| 4331 | + (rc, report) = cmd(["/usr/bin/dpkg", "-s", pkg]) |
| 4332 | + assert (rc == 0) |
| 4333 | + assert ("Status: install ok installed" in report) |
| 4334 | + installed_version = "" |
| 4335 | + for line in report.splitlines(): |
| 4336 | + if line.startswith("Version: "): |
| 4337 | + installed_version = line.split()[1] |
| 4338 | + |
| 4339 | + assert (installed_version != "") |
| 4340 | + |
| 4341 | + (rc, report) = cmd(["/usr/bin/dpkg", "--compare-versions", installed_version, check, version]) |
| 4342 | + assert (rc == 0 or rc == 1) |
| 4343 | + if rc == 0: |
| 4344 | + return True |
| 4345 | + return False |
| 4346 | + |
| 4347 | +def prepare_source(source, builder, cached_src, build_src, patch_system): |
| 4348 | + '''Download and unpack source package, installing necessary build depends, |
| 4349 | + adjusting the permissions for the 'builder' user, and returning the |
| 4350 | + directory of the unpacked source. Patch system can be one of: |
| 4351 | + - cdbs |
| 4352 | + - dpatch |
| 4353 | + - quilt |
| 4354 | + - quiltv3 |
| 4355 | + - None (not the string) |
| 4356 | + |
| 4357 | + This is normally used like this: |
| 4358 | + |
| 4359 | + def setUp(self): |
| 4360 | + ... |
| 4361 | + self.topdir = os.getcwd() |
| 4362 | + self.cached_src = os.path.join(os.getcwd(), "source") |
| 4363 | + self.tmpdir = tempfile.mkdtemp(prefix='testlib', dir='/tmp') |
| 4364 | + self.builder = testlib.TestUser() |
| 4365 | + testlib.cmd(['chgrp', self.builder.login, self.tmpdir]) |
| 4366 | + os.chmod(self.tmpdir, 0775) |
| 4367 | + |
| 4368 | + def tearDown(self): |
| 4369 | + ... |
| 4370 | + self.builder = None |
| 4371 | + self.topdir = os.getcwd() |
| 4372 | + if os.path.exists(self.tmpdir): |
| 4373 | + testlib.recursive_rm(self.tmpdir) |
| 4374 | + |
| 4375 | + def test_suite_build(self): |
| 4376 | + ... |
| 4377 | + build_dir = testlib.prepare_source('foo', \ |
| 4378 | + self.builder, \ |
| 4379 | + self.cached_src, \ |
| 4380 | + os.path.join(self.tmpdir, \ |
| 4381 | + os.path.basename(self.cached_src)), |
| 4382 | + "quilt") |
| 4383 | + os.chdir(build_dir) |
| 4384 | + |
| 4385 | + # Example for typical build, adjust as necessary |
| 4386 | + print "" |
| 4387 | + print " make clean" |
| 4388 | + rc, report = testlib.cmd(['sudo', '-u', self.builder.login, 'make', 'clean']) |
| 4389 | + |
| 4390 | + print " configure" |
| 4391 | + rc, report = testlib.cmd(['sudo', '-u', self.builder.login, './configure', '--prefix=%s' % self.tmpdir, '--enable-debug']) |
| 4392 | + |
| 4393 | + print " make (will take a while)" |
| 4394 | + rc, report = testlib.cmd(['sudo', '-u', self.builder.login, 'make']) |
| 4395 | + |
| 4396 | + print " make check (will take a while)", |
| 4397 | + rc, report = testlib.cmd(['sudo', '-u', self.builder.login, 'make', 'check']) |
| 4398 | + expected = 0 |
| 4399 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 4400 | + self.assertEquals(expected, rc, result + report) |
| 4401 | + |
| 4402 | + def test_suite_cleanup(self): |
| 4403 | + ... |
| 4404 | + if os.path.exists(self.cached_src): |
| 4405 | + testlib.recursive_rm(self.cached_src) |
| 4406 | + |
| 4407 | + It is up to the caller to clean up cached_src and build_src (as in the |
| 4408 | + above example, often the build_src is in a tmpdir that is cleaned in |
| 4409 | + tearDown() and the cached_src is cleaned in a one time clean-up |
| 4410 | + operation (eg 'test_suite_cleanup()) which must be run after the build |
| 4411 | + suite test (obviously). |
| 4412 | + ''' |
| 4413 | + |
| 4414 | + # Make sure we have a clean slate |
| 4415 | + assert (os.path.exists(os.path.dirname(build_src))) |
| 4416 | + assert (not os.path.exists(build_src)) |
| 4417 | + |
| 4418 | + cdir = os.getcwd() |
| 4419 | + if os.path.exists(cached_src): |
| 4420 | + shutil.copytree(cached_src, build_src) |
| 4421 | + os.chdir(build_src) |
| 4422 | + else: |
| 4423 | + # Only install the build dependencies on the initial setup |
| 4424 | + rc, report = cmd(['apt-get','-y','--force-yes','build-dep',source]) |
| 4425 | + assert (rc == 0) |
| 4426 | + |
| 4427 | + os.makedirs(build_src) |
| 4428 | + os.chdir(build_src) |
| 4429 | + |
| 4430 | + # These are always needed |
| 4431 | + pkgs = ['build-essential', 'dpkg-dev', 'fakeroot'] |
| 4432 | + rc, report = cmd(['apt-get','-y','--force-yes','install'] + pkgs) |
| 4433 | + assert (rc == 0) |
| 4434 | + |
| 4435 | + rc, report = cmd(['apt-get','source',source]) |
| 4436 | + assert (rc == 0) |
| 4437 | + shutil.copytree(build_src, cached_src) |
| 4438 | + |
| 4439 | + unpacked_dir = os.path.join(build_src, glob.glob('%s-*' % source)[0]) |
| 4440 | + |
| 4441 | + # Now apply the patches. Do it here so that we don't mess up our cached |
| 4442 | + # sources. |
| 4443 | + os.chdir(unpacked_dir) |
| 4444 | + assert (patch_system in ['cdbs', 'dpatch', 'quilt', 'quiltv3', None]) |
| 4445 | + if patch_system != None and patch_system != "quiltv3": |
| 4446 | + if patch_system == "quilt": |
| 4447 | + os.environ.setdefault('QUILT_PATCHES','debian/patches') |
| 4448 | + rc, report = cmd(['quilt', 'push', '-a']) |
| 4449 | + assert (rc == 0) |
| 4450 | + elif patch_system == "cdbs": |
| 4451 | + rc, report = cmd(['./debian/rules', 'apply-patches']) |
| 4452 | + assert (rc == 0) |
| 4453 | + elif patch_system == "dpatch": |
| 4454 | + rc, report = cmd(['dpatch', 'apply-all']) |
| 4455 | + assert (rc == 0) |
| 4456 | + |
| 4457 | + cmd(['chown', '-R', '%s:%s' % (builder.uid, builder.gid), build_src]) |
| 4458 | + os.chdir(cdir) |
| 4459 | + |
| 4460 | + return unpacked_dir |
| 4461 | + |
| 4462 | +def _aa_status(): |
| 4463 | + '''Get aa-status output''' |
| 4464 | + exe = "/usr/sbin/aa-status" |
| 4465 | + assert (os.path.exists(exe)) |
| 4466 | + if os.geteuid() == 0: |
| 4467 | + return cmd([exe]) |
| 4468 | + return cmd(['sudo', exe]) |
| 4469 | + |
| 4470 | +def is_apparmor_loaded(path): |
| 4471 | + '''Check if profile is loaded''' |
| 4472 | + rc, report = _aa_status() |
| 4473 | + if rc != 0: |
| 4474 | + return False |
| 4475 | + |
| 4476 | + for line in report.splitlines(): |
| 4477 | + if line.endswith(path): |
| 4478 | + return True |
| 4479 | + return False |
| 4480 | + |
| 4481 | +def is_apparmor_confined(path): |
| 4482 | + '''Check if application is confined''' |
| 4483 | + rc, report = _aa_status() |
| 4484 | + if rc != 0: |
| 4485 | + return False |
| 4486 | + |
| 4487 | + for line in report.splitlines(): |
| 4488 | + if re.search('%s \(' % path, line): |
| 4489 | + return True |
| 4490 | + return False |
| 4491 | + |
| 4492 | +def check_apparmor(path, first_ubuntu_release, is_running=True): |
| 4493 | + '''Check if path is loaded and confined for everything higher than the |
| 4494 | + first Ubuntu release specified. |
| 4495 | + |
| 4496 | + Usage: |
| 4497 | + rc, report = testlib.check_apparmor('/usr/sbin/foo', 8.04, is_running=True) |
| 4498 | + if rc < 0: |
| 4499 | + return self._skipped(report) |
| 4500 | + |
| 4501 | + expected = 0 |
| 4502 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 4503 | + self.assertEquals(expected, rc, result + report) |
| 4504 | + ''' |
| 4505 | + global manager |
| 4506 | + rc = -1 |
| 4507 | + |
| 4508 | + if manager.lsb_release["Release"] < first_ubuntu_release: |
| 4509 | + return (rc, "Skipped apparmor check") |
| 4510 | + |
| 4511 | + if not os.path.exists('/sbin/apparmor_parser'): |
| 4512 | + return (rc, "Skipped (couldn't find apparmor_parser)") |
| 4513 | + |
| 4514 | + rc = 0 |
| 4515 | + msg = "" |
| 4516 | + if not is_apparmor_loaded(path): |
| 4517 | + rc = 1 |
| 4518 | + msg = "Profile not loaded for '%s'" % path |
| 4519 | + |
| 4520 | + # this check only makes sense it the 'path' is currently executing |
| 4521 | + if is_running and rc == 0 and not is_apparmor_confined(path): |
| 4522 | + rc = 1 |
| 4523 | + msg = "'%s' is not running in enforce mode" % path |
| 4524 | + |
| 4525 | + return (rc, msg) |
| 4526 | + |
| 4527 | +def get_gcc_version(gcc, full=True): |
| 4528 | + gcc_version = 'none' |
| 4529 | + if not gcc.startswith('/'): |
| 4530 | + gcc = '/usr/bin/%s' % (gcc) |
| 4531 | + if os.path.exists(gcc): |
| 4532 | + gcc_version = 'unknown' |
| 4533 | + lines = cmd([gcc,'-v'])[1].strip().splitlines() |
| 4534 | + version_lines = [x for x in lines if x.startswith('gcc version')] |
| 4535 | + if len(version_lines) == 1: |
| 4536 | + gcc_version = " ".join(version_lines[0].split()[2:]) |
| 4537 | + if not full: |
| 4538 | + return gcc_version.split()[0] |
| 4539 | + return gcc_version |
| 4540 | + |
| 4541 | +def is_kdeinit_running(): |
| 4542 | + '''Test if kdeinit is running''' |
| 4543 | + # applications that use kdeinit will spawn it if it isn't running in the |
| 4544 | + # test. This is a problem because it does not exit. This is a helper to |
| 4545 | + # check for it. |
| 4546 | + rc, report = cmd(['ps', 'x']) |
| 4547 | + if 'kdeinit4 Running' not in report: |
| 4548 | + print >>sys.stderr, ("kdeinit not running (you may start/stop any KDE application then run this script again)") |
| 4549 | + return False |
| 4550 | + return True |
| 4551 | + |
| 4552 | +def get_pkgconfig_flags(libs=[]): |
| 4553 | + '''Find pkg-config flags for libraries''' |
| 4554 | + assert (len(libs) > 0) |
| 4555 | + rc, pkg_config = cmd(['pkg-config', '--cflags', '--libs'] + libs) |
| 4556 | + expected = 0 |
| 4557 | + if rc != expected: |
| 4558 | + print >>sys.stderr, 'Got exit code %d, expected %d\n' % (rc, expected) |
| 4559 | + assert(rc == expected) |
| 4560 | + return pkg_config.split() |
| 4561 | + |
| 4562 | +class TestDaemon: |
| 4563 | + '''Helper class to manage daemons consistently''' |
| 4564 | + def __init__(self, init): |
| 4565 | + '''Setup daemon attributes''' |
| 4566 | + self.initscript = init |
| 4567 | + |
| 4568 | + def _build_command(self, suffix): |
| 4569 | + command = [] |
| 4570 | + if isinstance(self.initscript, list): |
| 4571 | + command.extend(self.initscript) |
| 4572 | + else: |
| 4573 | + command.append(self.initscript) |
| 4574 | + command.append(suffix) |
| 4575 | + return command |
| 4576 | + |
| 4577 | + def start(self): |
| 4578 | + '''Start daemon''' |
| 4579 | + rc, report = cmd(self._build_command('start')) |
| 4580 | + expected = 0 |
| 4581 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 4582 | + time.sleep(2) |
| 4583 | + if expected != rc: |
| 4584 | + return (False, result + report) |
| 4585 | + |
| 4586 | + if "fail" in report: |
| 4587 | + return (False, "Found 'fail' in report\n" + report) |
| 4588 | + |
| 4589 | + return (True, "") |
| 4590 | + |
| 4591 | + def stop(self): |
| 4592 | + '''Stop daemon''' |
| 4593 | + rc, report = cmd(self._build_command('stop')) |
| 4594 | + expected = 0 |
| 4595 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 4596 | + if expected != rc: |
| 4597 | + return (False, result + report) |
| 4598 | + |
| 4599 | + if "fail" in report: |
| 4600 | + return (False, "Found 'fail' in report\n" + report) |
| 4601 | + |
| 4602 | + return (True, "") |
| 4603 | + |
| 4604 | + def reload(self): |
| 4605 | + '''Reload daemon''' |
| 4606 | + rc, report = cmd(self._build_command('force-reload')) |
| 4607 | + expected = 0 |
| 4608 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 4609 | + if expected != rc: |
| 4610 | + return (False, result + report) |
| 4611 | + |
| 4612 | + if "fail" in report: |
| 4613 | + return (False, "Found 'fail' in report\n" + report) |
| 4614 | + |
| 4615 | + return (True, "") |
| 4616 | + |
| 4617 | + def restart(self): |
| 4618 | + '''Restart daemon''' |
| 4619 | + (res, str) = self.stop() |
| 4620 | + if not res: |
| 4621 | + return (res, str) |
| 4622 | + |
| 4623 | + (res, str) = self.start() |
| 4624 | + if not res: |
| 4625 | + return (res, str) |
| 4626 | + |
| 4627 | + return (True, "") |
| 4628 | + |
| 4629 | + def status(self): |
| 4630 | + '''Check daemon status''' |
| 4631 | + rc, report = cmd(self._build_command('status')) |
| 4632 | + expected = 0 |
| 4633 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 4634 | + if expected != rc: |
| 4635 | + return (False, result + report) |
| 4636 | + |
| 4637 | + if "fail" in report: |
| 4638 | + return (False, "Found 'fail' in report\n" + report) |
| 4639 | + |
| 4640 | + return (True, "") |
| 4641 | + |
| 4642 | +class TestlibManager(object): |
| 4643 | + '''Singleton class used to set up per-test-run information''' |
| 4644 | + def __init__(self): |
| 4645 | + # Set glibc aborts to dump to stderr instead of the tty so test output |
| 4646 | + # is more sane. |
| 4647 | + os.environ.setdefault('LIBC_FATAL_STDERR_','1') |
| 4648 | + |
| 4649 | + # check verbosity |
| 4650 | + self.verbosity = False |
| 4651 | + if (len(sys.argv) > 1 and '-v' in sys.argv[1:]): |
| 4652 | + self.verbosity = True |
| 4653 | + |
| 4654 | + # Load LSB release file |
| 4655 | + self.lsb_release = dict() |
| 4656 | + if not os.path.exists('/usr/bin/lsb_release') and not os.path.exists('/bin/lsb_release'): |
| 4657 | + raise OSError, "Please install 'lsb-release'" |
| 4658 | + for line in subprocess.Popen(['lsb_release','-a'],stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()[0].splitlines(): |
| 4659 | + field, value = line.split(':',1) |
| 4660 | + value=value.strip() |
| 4661 | + field=field.strip() |
| 4662 | + # Convert numerics |
| 4663 | + try: |
| 4664 | + value = float(value) |
| 4665 | + except: |
| 4666 | + pass |
| 4667 | + self.lsb_release.setdefault(field,value) |
| 4668 | + |
| 4669 | + # FIXME: hack OEM releases into known-Ubuntu versions |
| 4670 | + if self.lsb_release['Distributor ID'] == "HP MIE (Mobile Internet Experience)": |
| 4671 | + if self.lsb_release['Release'] == 1.0: |
| 4672 | + self.lsb_release['Distributor ID'] = "Ubuntu" |
| 4673 | + self.lsb_release['Release'] = 8.04 |
| 4674 | + else: |
| 4675 | + raise OSError, "Unknown version of HP MIE" |
| 4676 | + |
| 4677 | + # FIXME: hack to assume a most-recent release if we're not |
| 4678 | + # running under Ubuntu. |
| 4679 | + if self.lsb_release['Distributor ID'] not in ["Ubuntu","Linaro"]: |
| 4680 | + self.lsb_release['Release'] = 10000 |
| 4681 | + # Adjust Linaro release to pretend to be Ubuntu |
| 4682 | + if self.lsb_release['Distributor ID'] in ["Linaro"]: |
| 4683 | + self.lsb_release['Distributor ID'] = "Ubuntu" |
| 4684 | + self.lsb_release['Release'] -= 0.01 |
| 4685 | + |
| 4686 | + # Load arch |
| 4687 | + if not os.path.exists('/usr/bin/dpkg'): |
| 4688 | + machine = cmd(['uname','-m'])[1].strip() |
| 4689 | + if machine.endswith('86'): |
| 4690 | + self.dpkg_arch = 'i386' |
| 4691 | + elif machine.endswith('_64'): |
| 4692 | + self.dpkg_arch = 'amd64' |
| 4693 | + elif machine.startswith('arm'): |
| 4694 | + self.dpkg_arch = 'armel' |
| 4695 | + else: |
| 4696 | + raise ValueError, "Unknown machine type '%s'" % (machine) |
| 4697 | + else: |
| 4698 | + self.dpkg_arch = cmd(['dpkg','--print-architecture'])[1].strip() |
| 4699 | + |
| 4700 | + # Find kernel version |
| 4701 | + self.kernel_is_ubuntu = False |
| 4702 | + self.kernel_version_signature = None |
| 4703 | + self.kernel_version = cmd(["uname","-r"])[1].strip() |
| 4704 | + versig = '/proc/version_signature' |
| 4705 | + if os.path.exists(versig): |
| 4706 | + self.kernel_is_ubuntu = True |
| 4707 | + self.kernel_version_signature = file(versig).read().strip() |
| 4708 | + self.kernel_version_ubuntu = self.kernel_version |
| 4709 | + elif os.path.exists('/usr/bin/dpkg'): |
| 4710 | + # this can easily be inaccurate but is only an issue for Dapper |
| 4711 | + rc, out = cmd(['dpkg','-l','linux-image-%s' % (self.kernel_version)]) |
| 4712 | + if rc == 0: |
| 4713 | + self.kernel_version_signature = out.strip().split('\n').pop().split()[2] |
| 4714 | + self.kernel_version_ubuntu = self.kernel_version_signature |
| 4715 | + if self.kernel_version_signature == None: |
| 4716 | + # Attempt to fall back to something for non-Debian-based |
| 4717 | + self.kernel_version_signature = self.kernel_version |
| 4718 | + self.kernel_version_ubuntu = self.kernel_version |
| 4719 | + # Build ubuntu version without hardware suffix |
| 4720 | + try: |
| 4721 | + self.kernel_version_ubuntu = "-".join([x for x in self.kernel_version_signature.split(' ')[1].split('-') if re.search('^[0-9]', x)]) |
| 4722 | + except: |
| 4723 | + pass |
| 4724 | + |
| 4725 | + # Find gcc version |
| 4726 | + self.gcc_version = get_gcc_version('gcc') |
| 4727 | + |
| 4728 | + # Find libc |
| 4729 | + self.path_libc = [x.split()[2] for x in cmd(['ldd','/bin/ls'])[1].splitlines() if x.startswith('\tlibc.so.')][0] |
| 4730 | + |
| 4731 | + # Report self |
| 4732 | + if self.verbosity: |
| 4733 | + kernel = self.kernel_version_ubuntu |
| 4734 | + if kernel != self.kernel_version_signature: |
| 4735 | + kernel += " (%s)" % (self.kernel_version_signature) |
| 4736 | + print >>sys.stdout, "Running test: '%s' distro: '%s %.2f' kernel: '%s' arch: '%s' uid: %d/%d SUDO_USER: '%s')" % ( \ |
| 4737 | + sys.argv[0], |
| 4738 | + self.lsb_release['Distributor ID'], |
| 4739 | + self.lsb_release['Release'], |
| 4740 | + kernel, |
| 4741 | + self.dpkg_arch, |
| 4742 | + os.geteuid(), os.getuid(), |
| 4743 | + os.environ.get('SUDO_USER', '')) |
| 4744 | + sys.stdout.flush() |
| 4745 | + |
| 4746 | + # Additional heuristics |
| 4747 | + #if os.environ.get('SUDO_USER', os.environ.get('USER', '')) in ['mdeslaur']: |
| 4748 | + # sys.stdout.write("Replying to Marc Deslauriers in http://launchpad.net/bugs/%d: " % random.randint(600000, 980000)) |
| 4749 | + # sys.stdout.flush() |
| 4750 | + # time.sleep(0.5) |
| 4751 | + # sys.stdout.write("destroyed\n") |
| 4752 | + # time.sleep(0.5) |
| 4753 | + |
| 4754 | + def hello(self, msg): |
| 4755 | + print >>sys.stderr, "Hello from %s" % (msg) |
| 4756 | +# The central instance |
| 4757 | +manager = TestlibManager() |
| 4758 | + |
| 4759 | +class TestlibCase(unittest.TestCase): |
| 4760 | + def __init__(self, *args): |
| 4761 | + '''This is called for each TestCase test instance, which isn't much better |
| 4762 | + than SetUp.''' |
| 4763 | + |
| 4764 | + unittest.TestCase.__init__(self, *args) |
| 4765 | + |
| 4766 | + # Attach to and duplicate dicts from manager singleton |
| 4767 | + self.manager = manager |
| 4768 | + #self.manager.hello(repr(self) + repr(*args)) |
| 4769 | + self.my_verbosity = self.manager.verbosity |
| 4770 | + self.lsb_release = self.manager.lsb_release |
| 4771 | + self.dpkg_arch = self.manager.dpkg_arch |
| 4772 | + self.kernel_version = self.manager.kernel_version |
| 4773 | + self.kernel_version_signature = self.manager.kernel_version_signature |
| 4774 | + self.kernel_version_ubuntu = self.manager.kernel_version_ubuntu |
| 4775 | + self.kernel_is_ubuntu = self.manager.kernel_is_ubuntu |
| 4776 | + self.gcc_version = self.manager.gcc_version |
| 4777 | + self.path_libc = self.manager.path_libc |
| 4778 | + |
| 4779 | + def version_compare(self, one, two): |
| 4780 | + return apt_pkg.VersionCompare(one,two) |
| 4781 | + |
| 4782 | + def assertFileType(self, filename, filetype): |
| 4783 | + '''Checks the file type of the file specified''' |
| 4784 | + |
| 4785 | + (rc, report, out) = self._testlib_shell_cmd(["/usr/bin/file", "-b", filename]) |
| 4786 | + out = out.strip() |
| 4787 | + expected = 0 |
| 4788 | + # Absolutely no idea why this happens on Hardy |
| 4789 | + if self.lsb_release['Release'] == 8.04 and rc == 255 and len(out) > 0: |
| 4790 | + rc = 0 |
| 4791 | + result = 'Got exit code %d, expected %d:\n%s\n' % (rc, expected, report) |
| 4792 | + self.assertEquals(expected, rc, result) |
| 4793 | + |
| 4794 | + filetype = '^%s$' % (filetype) |
| 4795 | + result = 'File type reported by file: [%s], expected regex: [%s]\n' % (out, filetype) |
| 4796 | + self.assertNotEquals(None, re.search(filetype, out), result) |
| 4797 | + |
| 4798 | + def yank_commonname_from_cert(self, certfile): |
| 4799 | + '''Extract the commonName from a given PEM''' |
| 4800 | + rc, out = cmd(['openssl','asn1parse','-in',certfile]) |
| 4801 | + if rc == 0: |
| 4802 | + ready = False |
| 4803 | + for line in out.splitlines(): |
| 4804 | + if ready: |
| 4805 | + return line.split(':')[-1] |
| 4806 | + if ':commonName' in line: |
| 4807 | + ready = True |
| 4808 | + return socket.getfqdn() |
| 4809 | + |
| 4810 | + def announce(self, text): |
| 4811 | + if self.my_verbosity: |
| 4812 | + print >>sys.stdout, "(%s) " % (text), |
| 4813 | + sys.stdout.flush() |
| 4814 | + |
| 4815 | + def make_clean(self): |
| 4816 | + rc, output = self.shell_cmd(['make','clean']) |
| 4817 | + self.assertEquals(rc, 0, output) |
| 4818 | + |
| 4819 | + def get_makefile_compiler(self): |
| 4820 | + # Find potential compiler name |
| 4821 | + compiler = 'gcc' |
| 4822 | + if os.path.exists('Makefile'): |
| 4823 | + for line in open('Makefile'): |
| 4824 | + if line.startswith('CC') and '=' in line: |
| 4825 | + items = [x.strip() for x in line.split('=')] |
| 4826 | + if items[0] == 'CC': |
| 4827 | + compiler = items[1] |
| 4828 | + break |
| 4829 | + return compiler |
| 4830 | + |
| 4831 | + def make_target(self, target, expected=0): |
| 4832 | + '''Compile a target and report output''' |
| 4833 | + |
| 4834 | + compiler = self.get_makefile_compiler() |
| 4835 | + rc, output = self.shell_cmd(['make',target]) |
| 4836 | + self.assertEquals(rc, expected, 'rc(%d)!=%d:\n' % (rc, expected) + output) |
| 4837 | + self.assertTrue('%s ' % (compiler) in output, 'Expected "%s":' % (compiler) + output) |
| 4838 | + return output |
| 4839 | + |
| 4840 | + # call as return testlib.skipped() |
| 4841 | + def _skipped(self, reason=""): |
| 4842 | + '''Provide a visible way to indicate that a test was skipped''' |
| 4843 | + if reason != "": |
| 4844 | + reason = ': %s' % (reason) |
| 4845 | + self.announce("skipped%s" % (reason)) |
| 4846 | + return False |
| 4847 | + |
| 4848 | + def _testlib_shell_cmd(self,args,stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT): |
| 4849 | + argstr = "'" + "', '".join(args).strip() + "'" |
| 4850 | + rc, out = cmd(args,stdin=stdin,stdout=stdout,stderr=stderr) |
| 4851 | + report = 'Command: ' + argstr + '\nOutput:\n' + out |
| 4852 | + return rc, report, out |
| 4853 | + |
| 4854 | + def shell_cmd(self, args, stdin=None): |
| 4855 | + return cmd(args,stdin=stdin) |
| 4856 | + |
| 4857 | + def assertShellExitEquals(self, expected, args, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, msg=""): |
| 4858 | + '''Test a shell command matches a specific exit code''' |
| 4859 | + rc, report, out = self._testlib_shell_cmd(args, stdin=stdin, stdout=stdout, stderr=stderr) |
| 4860 | + result = 'Got exit code %d, expected %d\n' % (rc, expected) |
| 4861 | + self.assertEquals(expected, rc, msg + result + report) |
| 4862 | + |
| 4863 | + def assertShellExitNotEquals(self, unwanted, args, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, msg=""): |
| 4864 | + '''Test a shell command doesn't match a specific exit code''' |
| 4865 | + rc, report, out = self._testlib_shell_cmd(args, stdin=stdin, stdout=stdout, stderr=stderr) |
| 4866 | + result = 'Got (unwanted) exit code %d\n' % rc |
| 4867 | + self.assertNotEquals(unwanted, rc, msg + result + report) |
| 4868 | + |
| 4869 | + def assertShellOutputContains(self, text, args, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, msg="", invert=False): |
| 4870 | + '''Test a shell command contains a specific output''' |
| 4871 | + rc, report, out = self._testlib_shell_cmd(args, stdin=stdin, stdout=stdout, stderr=stderr) |
| 4872 | + result = 'Got exit code %d. Looking for text "%s"\n' % (rc, text) |
| 4873 | + if not invert: |
| 4874 | + self.assertTrue(text in out, msg + result + report) |
| 4875 | + else: |
| 4876 | + self.assertFalse(text in out, msg + result + report) |
| 4877 | + |
| 4878 | + def assertShellOutputEquals(self, text, args, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, msg="", invert=False, expected=None): |
| 4879 | + '''Test a shell command matches a specific output''' |
| 4880 | + rc, report, out = self._testlib_shell_cmd(args, stdin=stdin, stdout=stdout, stderr=stderr) |
| 4881 | + result = 'Got exit code %d. Looking for exact text "%s" (%s)\n' % (rc, text, " ".join(args)) |
| 4882 | + if not invert: |
| 4883 | + self.assertEquals(text, out, msg + result + report) |
| 4884 | + else: |
| 4885 | + self.assertNotEquals(text, out, msg + result + report) |
| 4886 | + if expected != None: |
| 4887 | + result = 'Got exit code %d. Expected %d (%s)\n' % (rc, expected, " ".join(args)) |
| 4888 | + self.assertEquals(rc, expected, msg + result + report) |
| 4889 | + |
| 4890 | + def _word_find(self, report, content, invert=False): |
| 4891 | + '''Check for a specific string''' |
| 4892 | + if invert: |
| 4893 | + warning = 'Found "%s"\n' % content |
| 4894 | + self.assertTrue(content not in report, warning + report) |
| 4895 | + else: |
| 4896 | + warning = 'Could not find "%s"\n' % content |
| 4897 | + self.assertTrue(content in report, warning + report) |
| 4898 | + |
| 4899 | + def _test_sysctl_value(self, path, expected, msg=None, exists=True): |
| 4900 | + sysctl = '/proc/sys/%s' % (path) |
| 4901 | + self.assertEquals(exists, os.path.exists(sysctl), sysctl) |
| 4902 | + value = None |
| 4903 | + if exists: |
| 4904 | + value = int(file(sysctl).read()) |
| 4905 | + report = "%s is not %d: %d" % (sysctl, expected, value) |
| 4906 | + if msg: |
| 4907 | + report += " (%s)" % (msg) |
| 4908 | + self.assertEquals(value, expected, report) |
| 4909 | + return value |
| 4910 | + |
| 4911 | + def set_sysctl_value(self, path, desired): |
| 4912 | + sysctl = '/proc/sys/%s' % (path) |
| 4913 | + self.assertTrue(os.path.exists(sysctl),"%s does not exist" % (sysctl)) |
| 4914 | + file(sysctl,'w').write(str(desired)) |
| 4915 | + self._test_sysctl_value(path, desired) |
| 4916 | + |
| 4917 | + def kernel_at_least(self, introduced): |
| 4918 | + return self.version_compare(self.kernel_version_ubuntu, |
| 4919 | + introduced) >= 0 |
| 4920 | + |
| 4921 | + def kernel_claims_cve_fixed(self, cve): |
| 4922 | + changelog = "/usr/share/doc/linux-image-%s/changelog.Debian.gz" % (self.kernel_version) |
| 4923 | + if os.path.exists(changelog): |
| 4924 | + for line in gzip.open(changelog): |
| 4925 | + if cve in line and not "revert" in line and not "Revert" in line: |
| 4926 | + return True |
| 4927 | + return False |
| 4928 | + |
| 4929 | +class TestGroup: |
| 4930 | + '''Create a temporary test group and remove it again in the dtor.''' |
| 4931 | + |
| 4932 | + def __init__(self, group=None, lower=False): |
| 4933 | + '''Create a new group''' |
| 4934 | + |
| 4935 | + self.group = None |
| 4936 | + if group: |
| 4937 | + if group_exists(group): |
| 4938 | + raise ValueError, 'group name already exists' |
| 4939 | + else: |
| 4940 | + while(True): |
| 4941 | + group = random_string(7,lower=lower) |
| 4942 | + if not group_exists(group): |
| 4943 | + break |
| 4944 | + |
| 4945 | + assert subprocess.call(['groupadd',group]) == 0 |
| 4946 | + self.group = group |
| 4947 | + g = grp.getgrnam(self.group) |
| 4948 | + self.gid = g[2] |
| 4949 | + |
| 4950 | + def __del__(self): |
| 4951 | + '''Remove the created group.''' |
| 4952 | + |
| 4953 | + if self.group: |
| 4954 | + rc, report = cmd(['groupdel', self.group]) |
| 4955 | + assert rc == 0 |
| 4956 | + |
| 4957 | +class TestUser: |
| 4958 | + '''Create a temporary test user and remove it again in the dtor.''' |
| 4959 | + |
| 4960 | + def __init__(self, login=None, home=True, group=None, uidmin=None, lower=False, shell=None): |
| 4961 | + '''Create a new user account with a random password. |
| 4962 | + |
| 4963 | + By default, the login name is random, too, but can be explicitly |
| 4964 | + specified with 'login'. By default, a home directory is created, this |
| 4965 | + can be suppressed with 'home=False'.''' |
| 4966 | + |
| 4967 | + self.login = None |
| 4968 | + |
| 4969 | + if os.geteuid() != 0: |
| 4970 | + raise ValueError, "You must be root to run this test" |
| 4971 | + |
| 4972 | + if login: |
| 4973 | + if login_exists(login): |
| 4974 | + raise ValueError, 'login name already exists' |
| 4975 | + else: |
| 4976 | + while(True): |
| 4977 | + login = 't' + random_string(7,lower=lower) |
| 4978 | + if not login_exists(login): |
| 4979 | + break |
| 4980 | + |
| 4981 | + self.salt = random_string(2) |
| 4982 | + self.password = random_string(8,lower=lower) |
| 4983 | + self.crypted = crypt.crypt(self.password, self.salt) |
| 4984 | + |
| 4985 | + creation = ['useradd', '-p', self.crypted] |
| 4986 | + if home: |
| 4987 | + creation += ['-m'] |
| 4988 | + if group: |
| 4989 | + creation += ['-G',group] |
| 4990 | + if uidmin: |
| 4991 | + creation += ['-K','UID_MIN=%d'%uidmin] |
| 4992 | + if shell: |
| 4993 | + creation += ['-s',shell] |
| 4994 | + creation += [login] |
| 4995 | + assert subprocess.call(creation) == 0 |
| 4996 | + # Set GECOS |
| 4997 | + assert subprocess.call(['usermod','-c','Buddy %s' % (login),login]) == 0 |
| 4998 | + |
| 4999 | + self.login = login |
| 5000 | + p = pwd.getpwnam(self.login) |

To review this:
~rafaeldtinoco/ ubuntu/ +source/ open-iscsi: lp1891374- debian_ sid
is the new pkg/debian/sid, merged by hand with new upstream (debian) 2.1.1-1 source code. Just like if it was imported by git-ubuntu. This way I could do all the git-ubuntu merge approach.
~rafaeldtinoco/ ubuntu/ +source/ open-iscsi: lp1891374- groovy
Is the merge as if it would happen in a git-ubuntu style. I'll keep this repository so when git-ubuntu imports the real 2.1.1-1, in debian [new] right now, I can rebase this in the next merge for a future new version.