From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6523072403514327040 X-Received: by 10.28.178.80 with SMTP id b77mr2091136wmf.5.1519033718823; Mon, 19 Feb 2018 01:48:38 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 10.28.116.12 with SMTP id p12ls1333731wmc.2.gmail; Mon, 19 Feb 2018 01:48:38 -0800 (PST) X-Google-Smtp-Source: AH8x226uEpgA5pOLn2KvM2q3zqAJskC1/+YF3MHaVJUMvaDrNCrspdhSeR5irt0Q0crUX8RnTKqM X-Received: by 10.28.150.216 with SMTP id y207mr2210740wmd.21.1519033718265; Mon, 19 Feb 2018 01:48:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519033718; cv=none; d=google.com; s=arc-20160816; b=ebHVBLUCyECR9txiOaVhTyP6bw4jWmJsvrRtn6A7t6TURNTuOyEhTbgngwOvY2g43L l01FcZRJMa1boUOa42NrMiWIyj3yYtZyR9/n0GHGAJMWqEUv1iq6VE6IyzY+1LEFpizg 05FV4uzZUszg6UJTB4p0vnPkVc/dOunngRu+v/OUwxcCT+Kj2LN+NXmj4uwvBiT1QK9X xDht0jFVnFP74xY9uxqA3HjGGYEvitRryzBIk1jLkELTEcEadhNWruwV3RJIsOq3l3Dm n6mkJHLEU3ybP7+VZs4Bx8nbUVRA60M3vYlsU3zMLjyCt9hMVT9OtsBWgi61elS0gv9C 6IaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject :arc-authentication-results; bh=+Kztjq6/FbY+5C1e6uK4n14+fFBKcHDDWjDgzhbPJn4=; b=UEGwpD3GYajlqPMnIwr8gKAWPhc+ZsxWu8+QfkwPAjzj300vRUNYBhizaXom1nhzjD f9fgLlPuZ1rmDGItTfibyLMYeF6ycv4JEhPwSdKyFMOs3PuztxmEAw6K4pkFOLO7UQj4 nOxM4MUNhkDPaCw5lAOal7VPlPVM2TZDzbemvo5kflqfQH40TO8ZeNqd68l/8ZFh32cc nG1rjziHoJzEuyoXCt7cm/oE0Z5noqoVjPIuWj9pC51Yds0rjEm6TwLef/P2CDIKpWLZ pyha85uBnGfp8Q6LPEVO24QGlTTCkwRXr77upBfj0J/WDYi/pSsygg7pki5tfqSRLVHH NATw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Return-Path: Received: from thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id 200si557040wml.2.2018.02.19.01.48.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Feb 2018 01:48:38 -0800 (PST) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.2 as permitted sender) client-ip=192.35.17.2; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.11]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id w1J9mbLK023155 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Feb 2018 10:48:38 +0100 Received: from [139.25.68.37] (md1q0hnc.ad001.siemens.net [139.25.68.37] (may be forged)) by mail2.siemens.de (8.15.2/8.15.2) with ESMTP id w1J9mbOF001962; Mon, 19 Feb 2018 10:48:37 +0100 Subject: Re: [PATCH 2/8] isar-events: Wait for failing umounts To: Alexander Smirnov , isar-users References: <3db8db617fb01db824b962b979de745fa0f4bc9a.1518771143.git.jan.kiszka@siemens.com> From: Jan Kiszka Message-ID: <70af17d0-be54-60c6-a11f-0a5047abea33@siemens.com> Date: Mon, 19 Feb 2018 10:48:36 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-TUID: A4fuwptde113 On 2018-02-19 10:45, Alexander Smirnov wrote: > On 02/16/2018 11:52 AM, Jan Kiszka wrote: >> From: Jan Kiszka >> >> The BuildCompleted event may come prior to all running build processes >> being terminated. In that case, some mount might be busy, and we will >> leave them dangling behind. Wait in that case. > > How long we should wait? Until it's done. > For example there was a bug with apt-get which > results as hanging of 'http' process. So in this case Isar never returns > to command prompt until second ^C pressed. In that case, you need to run around killing processes anyway. Jan > > Alex > >> >> Signed-off-by: Jan Kiszka >> --- >>   meta/classes/isar-events.bbclass | 28 +++++++++++++++++++--------- >>   1 file changed, 19 insertions(+), 9 deletions(-) >> >> diff --git a/meta/classes/isar-events.bbclass >> b/meta/classes/isar-events.bbclass >> index 4b5e97e..68208f1 100644 >> --- a/meta/classes/isar-events.bbclass >> +++ b/meta/classes/isar-events.bbclass >> @@ -2,11 +2,26 @@ >>   # >>   # This software is a part of ISAR. >>   # Copyright (C) 2015-2017 ilbers GmbH >> +# Copyright (c) Siemens AG, 2018 >>     addhandler isar_handler >>     python isar_handler () { >>       import subprocess >> +    import time >> + >> +    def umount_all(basepath): >> +        # '/proc/mounts' contains all the active mounts, so knowing >> basepath >> +        # we can get the list of mounts for the specific multiconfig and >> +        # clean them. >> +        with open('/proc/mounts', 'rU') as f: >> +            for line in f: >> +                if basepath in line: >> +                    if subprocess.call('sudo umount ' + line.split()[1], >> +                                       stdout=devnull, stderr=devnull, >> +                                       shell=True) != 0: >> +                        return False >> +        return True >>         devnull = open(os.devnull, 'w') >>   @@ -16,15 +31,10 @@ python isar_handler () { >>           arch = d.getVar('DISTRO_ARCH', True) >>             if tmpdir and distro and arch: >> -            w = tmpdir + '/work/' + distro + '-' + arch >> - >> -            # '/proc/mounts' contains all the active mounts, so >> knowing 'w' we >> -            # could get the list of mounts for the specific >> multiconfig and >> -            # clean them. >> -            with open('/proc/mounts', 'rU') as f: >> -                for line in f: >> -                    if w in line: >> -                        subprocess.call('sudo umount -f ' + >> line.split()[1], stdout=devnull, stderr=devnull, shell=True) >> +            basepath = tmpdir + '/work/' + distro + '-' + arch >> + >> +            while not umount_all(basepath): >> +                time.sleep(1) >>         devnull.close() >>   } >> > -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux