ACK/Cmnt: [ACT][PATCH] UBUNTU: SAUCE: ubuntu_lxc: destroy leftover container before tests

Krzysztof Kozlowski krzysztof.kozlowski at canonical.com
Mon Jul 12 15:37:01 UTC 2021


On 12/07/2021 12:59, Kleber Sacilotto de Souza wrote:
> BugLink: https://bugs.launchpad.net/bugs/1788574
> 
> Commits 1a50e77ca803 ("UBUNTU: SAUCE: ubuntu_lxc: remove the reboot
> container after test") and 298cd01e ("UBUNTU: SAUCE: ubuntu_lxc: destroy
> the leftover container before exit") fixed the issue with the leftover
> "reboot" contained on the 'exercise' script. However, this script is run
> only for series older than artful. For newer series, the testcase is run
> from the source package via 'autopkgtest'. Fix it by destroying the
> container before running any test.
> 
> Signed-off-by: Kleber Sacilotto de Souza <kleber.souza at canonical.com>
> ---
>  ubuntu_lxc/ubuntu_lxc.py | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/ubuntu_lxc/ubuntu_lxc.py b/ubuntu_lxc/ubuntu_lxc.py
> index e201b0d4..cc8466ba 100644
> --- a/ubuntu_lxc/ubuntu_lxc.py
> +++ b/ubuntu_lxc/ubuntu_lxc.py
> @@ -44,6 +44,12 @@ class ubuntu_lxc(test.test):
>      def run_once(self, test_name):
>          if test_name == 'setup':
>              return
> +
> +        # Destroy the "reboot" container which might have been left
> +        # behind (LP#1788574)
> +        cmd = 'lxc-destroy reboot'
> +        utils.system(cmd, ignore_status=True)
> +
>          if self.series in ['precise', 'trusty', 'xenial', 'artful']:
>              cmd = '/bin/sh %s/exercise' % self.bindir
>          else:
> 

Maybe it should be rather at the end of test in try-finally block to
leave the machine/container in a clean state? But I don't have any
strong preference or arguments, so:

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski at canonical.com>


Best regards,
Krzysztof



More information about the kernel-team mailing list