launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #24138
[Merge] lp:~mwhudson/launchpad-buildd/lp-1852518-again into lp:launchpad-buildd
Michael Hudson-Doyle has proposed merging lp:~mwhudson/launchpad-buildd/lp-1852518-again into lp:launchpad-buildd.
Commit message:
Do not make assumptions about what device major number the device mapper is using. (LP: #1852518)
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1852518 in launchpad-buildd: "livecd-rootfs focal hangs during kpartx (ubuntu-cpc project)"
https://bugs.launchpad.net/launchpad-buildd/+bug/1852518
For more details, see:
https://code.launchpad.net/~mwhudson/launchpad-buildd/lp-1852518-again/+merge/375987
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~mwhudson/launchpad-buildd/lp-1852518-again into lp:launchpad-buildd.
=== modified file 'debian/changelog'
--- debian/changelog 2019-11-22 11:15:29 +0000
+++ debian/changelog 2019-11-26 00:10:48 +0000
@@ -1,3 +1,10 @@
+launchpad-buildd (182) UNRELEASED; urgency=medium
+
+ * Do not make assumptions about what device major number the device mapper
+ is using. (LP: #1852518)
+
+ -- Michael Hudson-Doyle <michael.hudson@xxxxxxxxxx> Tue, 26 Nov 2019 13:07:24 +1300
+
launchpad-buildd (181) xenial; urgency=medium
[ Robert C Jennings ]
=== modified file 'debian/control'
--- debian/control 2019-01-28 15:12:54 +0000
+++ debian/control 2019-11-26 00:10:48 +0000
@@ -38,6 +38,7 @@
bzip2,
debootstrap,
dpkg-dev,
+ dmsetup,
file,
lsb-release,
lsof,
=== modified file 'lpbuildd/target/lxd.py'
--- lpbuildd/target/lxd.py 2019-11-21 18:26:06 +0000
+++ lpbuildd/target/lxd.py 2019-11-26 00:10:48 +0000
@@ -35,6 +35,23 @@
LXD_RUNNING = 103
+def get_device_mapper_major():
+ """Return the major device number used by the devicemapper on this system.
+
+ This is not consistent across kernel versions, sadly.
+ """
+ created = False
+ if not os.path.exists("/dev/dm-0"):
+ created = True
+ subprocess.check_call(
+ ["dmsetup", "create", "tmpdevice", "--notable"])
+ major = os.major(os.stat("/dev/dm-0").st_rdev)
+ if created:
+ subprocess.check_call(
+ ["dmsetup", "remove", "tmpdevice"])
+ return major
+
+
fallback_hosts = dedent("""\
127.0.0.1\tlocalhost
::1\tlocalhost ip6-localhost ip6-loopback
@@ -448,10 +465,11 @@
# Create dm-# devices. On focal kpartx looks for dm devices and hangs
# in their absence.
+ major = get_device_mapper_major()
for minor in range(8):
self.run(
["mknod", "-m", "0660", "/dev/dm-%d" % minor,
- "b", "251", str(minor)])
+ "b", str(major), str(minor)])
# XXX cjwatson 2017-09-07: With LXD < 2.2 we can't create the
# directory until the container has started. We can get away with