From 32db5f9e2dad354f56418feeb15808f2739612f8 Mon Sep 17 00:00:00 2001 From: srivickynesh Date: Thu, 7 Jun 2018 16:43:43 +0530 Subject: [Test] Start/Stop of snapd deamon on the cloned volume Test Cases in this module tests the USS functionality of snapshots snapd on cloned volume and validated snapshots are present inside .snaps directory by terminating snapd on one by one nodes and validating .snaps directory is still accessible. Change-Id: I98d48268e7c5c5952a7f0f544960203d8634b7ac Signed-off-by: Sri Vignesh --- glustolibs-gluster/glustolibs/gluster/snap_ops.py | 28 ++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'glustolibs-gluster') diff --git a/glustolibs-gluster/glustolibs/gluster/snap_ops.py b/glustolibs-gluster/glustolibs/gluster/snap_ops.py index 1e792ada7..0fba7771b 100644 --- a/glustolibs-gluster/glustolibs/gluster/snap_ops.py +++ b/glustolibs-gluster/glustolibs/gluster/snap_ops.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (C) 2015-2016 Red Hat, Inc. +# Copyright (C) 2015-2020 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -859,3 +859,29 @@ def snap_deactivate(mnode, snapname): cmd = "gluster snapshot deactivate %s --mode=script" % snapname return g.run(mnode, cmd) + + +def terminate_snapd_on_node(mnode): + """Terminate snapd on the specified node + + Args: + mnode(str):node on which commands has to be executed + + Returns: + tuple: Tuple containing three elements (ret, out, err). + The first element 'ret' is of type 'int' and is the return value + of command execution. + + The second element 'out' is of type 'str' and is the stdout value + of the command execution. + + The third element 'err' is of type 'str' and is the stderr value + of the command execution. + """ + cmd = "ps aux| grep -m1 snapd | awk '{print $2}'" + _, out, _ = g.run(mnode, cmd) + if out is None: + g.log.error("Failed to get the snapd PID using command %s", cmd) + return None + cmd = "kill -9 %s" % out + return g.run(mnode, cmd) -- cgit