From 9c35f0279209ce233a7562f2d9310ded1e0edba5 Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Wed, 24 Apr 2019 23:25:19 +0100 Subject: [PATCH] Bind mount /run into chroot when installing grub grub-mkconfig runs a lvs command that attempts to access /run/lvm once for each block device, currently it times out after 10 seconds for each device and moves on. Multiple 10 second delays become a problem (causing IPA API timeouts) when multiple block devices are present. Bind mounting in /run avoids the delay and the timeouts. Task: 30616 Story: 2005507 Change-Id: Iae8b7808a35bff121f64971aadd4bd36b5f5bb71 --- ironic_python_agent/extensions/image.py | 2 +- .../tests/unit/extensions/test_image.py | 16 ++++++++++++++++ .../notes/bindmount-run-4c6a31d3ee4e0ed6.yaml | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/bindmount-run-4c6a31d3ee4e0ed6.yaml diff --git a/ironic_python_agent/extensions/image.py b/ironic_python_agent/extensions/image.py index e5b1b1aaa..5b24e3a44 100644 --- a/ironic_python_agent/extensions/image.py +++ b/ironic_python_agent/extensions/image.py @@ -30,7 +30,7 @@ from ironic_python_agent import utils LOG = log.getLogger(__name__) -BIND_MOUNTS = ('/dev', '/proc') +BIND_MOUNTS = ('/dev', '/proc', '/run') def _get_partition(device, uuid): diff --git a/ironic_python_agent/tests/unit/extensions/test_image.py b/ironic_python_agent/tests/unit/extensions/test_image.py index 74942fa4c..4edfa783f 100644 --- a/ironic_python_agent/tests/unit/extensions/test_image.py +++ b/ironic_python_agent/tests/unit/extensions/test_image.py @@ -104,6 +104,8 @@ class TestImageExtension(base.IronicAgentTest): self.fake_dir + '/dev'), mock.call('mount', '-o', 'bind', '/proc', self.fake_dir + '/proc'), + mock.call('mount', '-o', 'bind', '/run', + self.fake_dir + '/run'), mock.call('mount', '-t', 'sysfs', 'none', self.fake_dir + '/sys'), mock.call(('chroot %s /bin/sh -c ' @@ -119,6 +121,8 @@ class TestImageExtension(base.IronicAgentTest): attempts=3, delay_on_retry=True), mock.call('umount', self.fake_dir + '/proc', attempts=3, delay_on_retry=True), + mock.call('umount', self.fake_dir + '/run', + attempts=3, delay_on_retry=True), mock.call('umount', self.fake_dir + '/sys', attempts=3, delay_on_retry=True), mock.call('umount', self.fake_dir, attempts=3, @@ -143,6 +147,8 @@ class TestImageExtension(base.IronicAgentTest): self.fake_dir + '/dev'), mock.call('mount', '-o', 'bind', '/proc', self.fake_dir + '/proc'), + mock.call('mount', '-o', 'bind', '/run', + self.fake_dir + '/run'), mock.call('mount', '-t', 'sysfs', 'none', self.fake_dir + '/sys'), mock.call(('chroot %s /bin/sh -c ' @@ -159,6 +165,8 @@ class TestImageExtension(base.IronicAgentTest): attempts=3, delay_on_retry=True), mock.call('umount', self.fake_dir + '/proc', attempts=3, delay_on_retry=True), + mock.call('umount', self.fake_dir + '/run', + attempts=3, delay_on_retry=True), mock.call('umount', self.fake_dir + '/sys', attempts=3, delay_on_retry=True), mock.call('umount', self.fake_dir, attempts=3, @@ -189,6 +197,8 @@ class TestImageExtension(base.IronicAgentTest): self.fake_dir + '/dev'), mock.call('mount', '-o', 'bind', '/proc', self.fake_dir + '/proc'), + mock.call('mount', '-o', 'bind', '/run', + self.fake_dir + '/run'), mock.call('mount', '-t', 'sysfs', 'none', self.fake_dir + '/sys'), mock.call('mount', self.fake_efi_system_part, @@ -212,6 +222,8 @@ class TestImageExtension(base.IronicAgentTest): attempts=3, delay_on_retry=True), mock.call('umount', self.fake_dir + '/proc', attempts=3, delay_on_retry=True), + mock.call('umount', self.fake_dir + '/run', + attempts=3, delay_on_retry=True), mock.call('umount', self.fake_dir + '/sys', attempts=3, delay_on_retry=True), mock.call('umount', self.fake_dir, attempts=3, @@ -249,6 +261,8 @@ class TestImageExtension(base.IronicAgentTest): self.fake_dir + '/dev'), mock.call('mount', '-o', 'bind', '/proc', self.fake_dir + '/proc'), + mock.call('mount', '-o', 'bind', '/run', + self.fake_dir + '/run'), mock.call('mount', '-t', 'sysfs', 'none', self.fake_dir + '/sys'), mock.call('mount', self.fake_efi_system_part, @@ -294,6 +308,8 @@ class TestImageExtension(base.IronicAgentTest): attempts=3, delay_on_retry=True), mock.call('umount', self.fake_dir + '/proc', attempts=3, delay_on_retry=True), + mock.call('umount', self.fake_dir + '/run', + attempts=3, delay_on_retry=True), mock.call('umount', self.fake_dir + '/sys', attempts=3, delay_on_retry=True), mock.call('umount', self.fake_dir, attempts=3, diff --git a/releasenotes/notes/bindmount-run-4c6a31d3ee4e0ed6.yaml b/releasenotes/notes/bindmount-run-4c6a31d3ee4e0ed6.yaml new file mode 100644 index 000000000..bdeb00dba --- /dev/null +++ b/releasenotes/notes/bindmount-run-4c6a31d3ee4e0ed6.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + Mounts /run into chroot when installing grub to prevent timeouts.