summaryrefslogtreecommitdiffstats
path: root/tests/functional/snapshot/test_snap_delete_original_volume.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/snapshot/test_snap_delete_original_volume.py')
-rw-r--r--tests/functional/snapshot/test_snap_delete_original_volume.py62
1 files changed, 33 insertions, 29 deletions
diff --git a/tests/functional/snapshot/test_snap_delete_original_volume.py b/tests/functional/snapshot/test_snap_delete_original_volume.py
index 1bf62fd87..249dab4fa 100644
--- a/tests/functional/snapshot/test_snap_delete_original_volume.py
+++ b/tests/functional/snapshot/test_snap_delete_original_volume.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2018 Red Hat, Inc. <http://www.redhat.com>
+# Copyright (C) 2017-2020 Red Hat, Inc. <http://www.redhat.com>
#
# 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
@@ -23,19 +23,22 @@ and delete snapshot and original volume.
Validate cloned volume is not affected.
"""
+from time import sleep
+
from glusto.core import Glusto as g
+
from glustolibs.gluster.exceptions import ExecutionError
from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on
from glustolibs.gluster.volume_libs import cleanup_volume
from glustolibs.gluster.volume_ops import (get_volume_info, volume_status,
volume_list, volume_start)
from glustolibs.io.utils import validate_io_procs
-from glustolibs.gluster.mount_ops import umount_volume
from glustolibs.gluster.snap_ops import (snap_create,
snap_list,
snap_activate,
snap_clone)
from glustolibs.misc.misc_libs import upload_scripts
+from glustolibs.gluster.mount_ops import umount_volume
@runs_on([['replicated', 'distributed-replicated', 'dispersed',
@@ -45,7 +48,7 @@ class SnapshotSelfheal(GlusterBaseClass):
@classmethod
def setUpClass(cls):
- GlusterBaseClass.setUpClass.im_func(cls)
+ cls.get_super_method(cls, 'setUpClass')()
cls.clone = "clone1"
cls.mpoint = "/mnt/clone1"
@@ -53,11 +56,9 @@ class SnapshotSelfheal(GlusterBaseClass):
# Uploading file_dir script in all client direcotries
g.log.info("Upload io scripts to clients %s for running IO on "
"mounts", cls.clients)
- script_local_path = ("/usr/share/glustolibs/io/scripts/"
- "file_dir_ops.py")
cls.script_upload_path = ("/usr/share/glustolibs/io/scripts/"
"file_dir_ops.py")
- ret = upload_scripts(cls.clients, script_local_path)
+ ret = upload_scripts(cls.clients, cls.script_upload_path)
if not ret:
raise ExecutionError("Failed to upload IO scripts to clients")
g.log.info("Successfully uploaded IO scripts to clients ")
@@ -82,23 +83,23 @@ class SnapshotSelfheal(GlusterBaseClass):
"""
# Perform I/O
- g.log.info("Starting to Perform I/O")
all_mounts_procs = []
- for mount_obj in self.mounts:
- g.log.info("Generating data for %s:"
- "%s", mount_obj.client_system, mount_obj.mountpoint)
- # Create files
- g.log.info('Creating files...')
- command = ("python %s create_files -f 100 --fixed-file-size 1k %s"
- % (self.script_upload_path, mount_obj.mountpoint))
- proc = g.run_async(mount_obj.client_system, command,
- user=mount_obj.user)
- all_mounts_procs.append(proc)
+ g.log.info("Generating data for %s:"
+ "%s", self.mounts[0].client_system,
+ self.mounts[0].mountpoint)
+ # Create files
+ g.log.info('Creating files...')
+ command = ("/usr/bin/env python %s create_files -f 100 "
+ "--fixed-file-size 1k %s" % (self.script_upload_path,
+ self.mounts[0].mountpoint))
+ proc = g.run_async(self.mounts[0].client_system, command,
+ user=self.mounts[0].user)
+ all_mounts_procs.append(proc)
self.io_validation_complete = False
# Validate IO
self.assertTrue(
- validate_io_procs(all_mounts_procs, self.mounts),
+ validate_io_procs(all_mounts_procs, self.mounts[0]),
"IO failed on some of the clients"
)
self.io_validation_complete = True
@@ -138,6 +139,9 @@ class SnapshotSelfheal(GlusterBaseClass):
g.log.info("Clone Volume %s created successfully from snapshot "
"%s", self.clone, self.snap)
+ # After cloning a volume wait for 5 second to start the volume
+ sleep(5)
+
# Validate clone volumes are started:
g.log.info("starting to Validate clone volumes are started")
ret, _, _ = volume_start(self.mnode, self.clone)
@@ -145,6 +149,16 @@ class SnapshotSelfheal(GlusterBaseClass):
"%s" % self.clone))
g.log.info("Volume %s started successfully", self.clone)
+ for mount_obj in self.mounts:
+ # Unmount Volume
+ g.log.info("Starting to Unmount Volume %s", self.volname)
+ ret = umount_volume(mount_obj.client_system,
+ mount_obj.mountpoint,
+ mtype=self.mount_type)
+ self.assertTrue(ret,
+ ("Failed to Unmount Volume %s" % self.volname))
+ g.log.info("Successfully Unmounted Volume %s", self.volname)
+
# Delete original volume
g.log.info("deleting original volume")
ret = cleanup_volume(self.mnode, self.volname)
@@ -187,7 +201,7 @@ class SnapshotSelfheal(GlusterBaseClass):
def tearDown(self):
# Calling GlusterBaseClass teardown
- GlusterBaseClass.tearDown.im_func(self)
+ self.get_super_method(self, 'tearDown')()
# Cleanup cloned volume
g.log.info("Starting to delete cloned volume")
@@ -195,13 +209,3 @@ class SnapshotSelfheal(GlusterBaseClass):
if not ret:
raise ExecutionError("Failed to delete the cloned volume")
g.log.info("Successful in deleting Cloned volume")
-
- # Unmount Volume
- g.log.info("Starting to Unmount Volume")
- for mount_obj in self.mounts:
- ret = umount_volume(mount_obj.client_system, self.mpoint,
- self.mount_type)
- if not ret:
- raise ExecutionError("Failed to umount the vol "
- "& cleanup Volume")
- g.log.info("Successful in umounting the volume and Cleanup")