diff options
author | Vitalii Koriakov <vkoriako@redhat.com> | 2019-01-23 13:14:30 +0200 |
---|---|---|
committer | Vijay Avuthu <vavuthu@redhat.com> | 2019-01-24 06:03:41 +0000 |
commit | 30b0188d57d28fe4f4ecc611759807856cafbfac (patch) | |
tree | 148fc3208f1c15ee4e681bcd2b994e7b0e2d14d4 /glustolibs-io/glustolibs/io/utils.py | |
parent | d2bd1a53eee4e4258c0f7d802da394628e4bc088 (diff) |
New method for checking not connected mount point
Change-Id: Idd492c3e806881ddc030023ecab30e4a8333467c
Signed-off-by: Vitalii Koriakov <vkoriako@redhat.com>
Diffstat (limited to 'glustolibs-io/glustolibs/io/utils.py')
-rwxr-xr-x | glustolibs-io/glustolibs/io/utils.py | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/glustolibs-io/glustolibs/io/utils.py b/glustolibs-io/glustolibs/io/utils.py index 8584e2aac..b6325faa1 100755 --- a/glustolibs-io/glustolibs/io/utils.py +++ b/glustolibs-io/glustolibs/io/utils.py @@ -634,6 +634,70 @@ def is_io_procs_fail_with_rofs(self, all_mounts_procs, mounts): return ret, io_results +def is_io_procs_fail_with_error(self, all_mounts_procs, mounts, mount_type): + """ + Checks whether IO failed with connection error + + Args: + all_mounts_procs (list): List of open connection descriptor as + returned by g.run_async method. + mounts (list): List of all GlusterMount objs on which process were + started. + mount_type (str): Type of mount + + Returns: + tuple : Tuple containing two elements (ret, io_results). + The first element 'ret' is of type 'bool', True if + IO failed with connection error on all mount procs. False otherwise. + + The second element 'io_results' is of type dictonary and it + contains the proc and corresponding result for IO. If IO failed with + connection error, then proc value contains True else False. + """ + if isinstance(all_mounts_procs, subprocess.Popen): + all_mounts_procs = [all_mounts_procs] + + if isinstance(mounts, GlusterMount): + mounts = [mounts] + + io_results = {} + for i, proc in enumerate(all_mounts_procs): + g.log.info("Validating IO on %s:%s", self.mounts[i].client_system, + self.mounts[i].mountpoint) + ret, out, err = proc.async_communicate() + if ret != 0: + g.log.info("EXPECTED : IO Failed on %s:%s", + self.mounts[i].client_system, + self.mounts[i].mountpoint) + if mount_type == "glusterfs": + if ("Transport endpoint is not connected" in err or + "Transport endpoint is not connected" in out): + g.log.info("EXPECTED : Transport endpoint is not connected" + " in output") + io_results[proc] = True + else: + g.log.error( + "Transport endpoint is not connected error " + "not found in output") + io_results[proc] = False + if mount_type == "nfs": + if ("Input/output error" in err or + "Input/output error" in out): + g.log.info("EXPECTED : Input/output error in output") + io_results[proc] = True + else: + g.log.error( + "Input/output error error not found in output") + io_results[proc] = False + else: + g.log.error("IO Successful on not connected mountpoint %s:%s", + self.mounts[i].client_system, + self.mounts[i].mountpoint) + ret = all(io_results.values()) + + return ret, io_results + + def compare_dir_structure_mount_with_brick(mnthost, mntloc, brick_list, type): """ Compare directory structure from mount point with brick path along with stat parameter |