launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #21828
[Merge] lp:~cjwatson/launchpad-buildd/lxd-mknod-loop into lp:launchpad-buildd
Colin Watson has proposed merging lp:~cjwatson/launchpad-buildd/lxd-mknod-loop into lp:launchpad-buildd.
Commit message:
Create loop devices in LXD containers manually using mknod rather than
as LXD-managed devices, since the latter involves bind-mounting
individual devices which confuses some livecd-rootfs scripts.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-buildd/lxd-mknod-loop/+merge/330385
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad-buildd/lxd-mknod-loop into lp:launchpad-buildd.
=== modified file 'debian/changelog'
--- debian/changelog 2017-09-07 14:53:36 +0000
+++ debian/changelog 2017-09-08 00:05:55 +0000
@@ -2,6 +2,9 @@
* Run snapd with SNAPPY_STORE_NO_CDN=1, since the buildd network isn't
allowed to talk to the CDN.
+ * Create loop devices in LXD containers manually using mknod rather than
+ as LXD-managed devices, since the latter involves bind-mounting
+ individual devices which confuses some livecd-rootfs scripts.
-- Colin Watson <cjwatson@xxxxxxxxxx> Thu, 07 Sep 2017 15:52:10 +0100
=== modified file 'lpbuildd/target/lxd.py'
--- lpbuildd/target/lxd.py 2017-09-07 14:53:36 +0000
+++ lpbuildd/target/lxd.py 2017-09-08 00:05:55 +0000
@@ -291,20 +291,7 @@
"parent": self.bridge_name,
"type": "nic",
},
- "loop-control": {
- "major": "10",
- "minor": "237",
- "path": "/dev/loop-control",
- "type": "unix-char",
- },
}
- for minor in range(8):
- devices["loop%d" % minor] = {
- "major": "7",
- "minor": str(minor),
- "path": "/dev/loop%d" % minor,
- "type": "unix-block",
- }
self.client.profiles.create(self.profile_name, config, devices)
def start(self):
@@ -360,6 +347,17 @@
raise BackendException(
"Container failed to start within %d seconds" % timeout)
+ # Create loop devices. We do this by hand rather than via the LXD
+ # profile, as the latter approach creates lots of independent mounts
+ # under /dev/, and that can cause confusion when building live
+ # filesystems.
+ self.run(
+ ["mknod", "-m", "0660", "/dev/loop-control", "c", "10", "237"])
+ for minor in range(8):
+ self.run(
+ ["mknod", "-m", "0660", "/dev/loop%d" % minor,
+ "b", "7", 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
# this for the time being because snapd isn't in the buildd chroots.
=== modified file 'lpbuildd/target/tests/test_lxd.py'
--- lpbuildd/target/tests/test_lxd.py 2017-09-07 14:53:36 +0000
+++ lpbuildd/target/tests/test_lxd.py 2017-09-08 00:05:55 +0000
@@ -145,20 +145,7 @@
"parent": "lpbuilddbr0",
"type": "nic",
},
- "loop-control": {
- "major": "10",
- "minor": "237",
- "path": "/dev/loop-control",
- "type": "unix-char",
- },
}
- for minor in range(8):
- expected_devices["loop%d" % minor] = {
- "major": "7",
- "minor": str(minor),
- "path": "/dev/loop%d" % minor,
- "type": "unix-block",
- }
client.profiles.create.assert_called_once_with(
"lpbuildd", expected_config, expected_devices)
@@ -209,39 +196,50 @@
iptables = ["sudo", "iptables", "-w"]
iptables_comment = [
"-m", "comment", "--comment", "managed by launchpad-buildd"]
+ lxc = ["lxc", "exec", "lp-xenial-amd64", "--", "linux64"]
+ expected_args = [
+ Equals(ip + ["link", "add", "dev", "lpbuilddbr0",
+ "type", "bridge"]),
+ Equals(ip + ["addr", "add", "10.10.10.1/24",
+ "dev", "lpbuilddbr0"]),
+ Equals(ip + ["link", "set", "dev", "lpbuilddbr0", "up"]),
+ Equals(["sudo", "sysctl", "-q", "-w", "net.ipv4.ip_forward=1"]),
+ Equals(
+ iptables +
+ ["-t", "mangle", "-A", "FORWARD", "-i", "lpbuilddbr0",
+ "-p", "tcp", "--tcp-flags", "SYN,RST", "SYN",
+ "-j", "TCPMSS", "--clamp-mss-to-pmtu"] +
+ iptables_comment),
+ Equals(
+ iptables +
+ ["-t", "nat", "-A", "POSTROUTING",
+ "-s", "10.10.10.1/24", "!", "-d", "10.10.10.1/24",
+ "-j", "MASQUERADE"] +
+ iptables_comment),
+ Equals(
+ ["sudo", "/usr/sbin/dnsmasq", "-s", "lpbuildd",
+ "-S", "/lpbuildd/", "-u", "buildd", "--strict-order",
+ "--bind-interfaces",
+ "--pid-file=/run/launchpad-buildd/dnsmasq.pid",
+ "--except-interface=lo", "--interface=lpbuilddbr0",
+ "--listen-address=10.10.10.1"]),
+ Equals(
+ lxc +
+ ["mknod", "-m", "0660", "/dev/loop-control",
+ "c", "10", "237"]),
+ ]
+ for minor in range(8):
+ expected_args.append(
+ Equals(
+ lxc +
+ ["mknod", "-m", "0660", "/dev/loop%d" % minor,
+ "b", "7", str(minor)]))
+ expected_args.append(
+ Equals(
+ lxc + ["mkdir", "-p", "/etc/systemd/system/snapd.service.d"]))
self.assertThat(
[proc._args["args"] for proc in processes_fixture.procs],
- MatchesListwise([
- Equals(ip + ["link", "add", "dev", "lpbuilddbr0",
- "type", "bridge"]),
- Equals(ip + ["addr", "add", "10.10.10.1/24",
- "dev", "lpbuilddbr0"]),
- Equals(ip + ["link", "set", "dev", "lpbuilddbr0", "up"]),
- Equals(
- ["sudo", "sysctl", "-q", "-w", "net.ipv4.ip_forward=1"]),
- Equals(
- iptables +
- ["-t", "mangle", "-A", "FORWARD", "-i", "lpbuilddbr0",
- "-p", "tcp", "--tcp-flags", "SYN,RST", "SYN",
- "-j", "TCPMSS", "--clamp-mss-to-pmtu"] +
- iptables_comment),
- Equals(
- iptables +
- ["-t", "nat", "-A", "POSTROUTING",
- "-s", "10.10.10.1/24", "!", "-d", "10.10.10.1/24",
- "-j", "MASQUERADE"] +
- iptables_comment),
- Equals(
- ["sudo", "/usr/sbin/dnsmasq", "-s", "lpbuildd",
- "-S", "/lpbuildd/", "-u", "buildd", "--strict-order",
- "--bind-interfaces",
- "--pid-file=/run/launchpad-buildd/dnsmasq.pid",
- "--except-interface=lo", "--interface=lpbuilddbr0",
- "--listen-address=10.10.10.1"]),
- Equals(
- ["lxc", "exec", "lp-xenial-amd64", "--", "linux64",
- "mkdir", "-p", "/etc/systemd/system/snapd.service.d"]),
- ]))
+ MatchesListwise(expected_args))
client.containers.create.assert_called_once_with({
"name": "lp-xenial-amd64",