Ejemplo n.º 1
0
    def tearDown(self):

        # disabling auto-delete
        g.log.info("Disabling auto-delete")
        cmd = "gluster snapshot config auto-delete disable"
        ret, _, _ = g.run(self.mnode, cmd)
        if ret != 0:
            raise ExecutionError("Failed to disable auto-delete snapshot"
                                 "config option")
        g.log.info("Snapshot auto-delete Successfully disabled")

        # deleting created snapshots
        g.log.info("Deleting all created snapshots")
        ret, _, _ = snap_delete_all(self.mnode)
        if ret != 0:
            raise ExecutionError("Failed to delete snapshot of volume"
                                 "%s" % self.volname)
        g.log.info("Successfully deleted snapshots of"
                   "volume %s", self.volname)

        # setting back default max-soft-limit to 90%
        g.log.info("Setting max-soft-limit to default")
        cmd = {'snap-max-soft-limit': '90'}
        ret, _, _ = set_snap_config(self.mnode, cmd)
        if ret != 0:
            raise ExecutionError("Failed to set snap-max-soft-limit"
                                 "config option")
        g.log.info("snap-max-soft-limit config option Successfully set")

        # Unmount and cleanup-volume
        g.log.info("Starting to Unmount and cleanup-volume")
        ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
        if not ret:
            raise ExecutionError("Failed to Unmount and Cleanup Volume")
        g.log.info("Successful in Unmount Volume and Cleanup Volume")
Ejemplo n.º 2
0
    def tearDown(self):
        """
        Delete all snapshots and disable uss
        Cleanup and umount volume
        """
        # Deleting all snapshot
        ret, _, _ = snap_delete_all(self.mnode)
        if ret:
            raise ExecutionError("Snapshot Delete Failed")
        g.log.info("Successfully deleted all snapshots")

        # Disable uss for volume
        ret, _, _ = disable_uss(self.mnode, self.volname)
        if ret:
            raise ExecutionError("Failed to disable uss")
        g.log.info("Successfully disabled uss for volume" "%s", self.volname)

        # Cleanup and umount volume
        ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
        if not ret:
            raise ExecutionError("Failed to umount the vol & cleanup Volume")
        g.log.info("Successful in umounting the volume and Cleanup")

        # Calling GlusterBaseClass teardown
        self.get_super_method(self, 'tearDown')()
    def tearDown(self):
        """
        tearDown for every test
        """
        ret, _, _ = snap_delete_all(self.mnode)
        if ret != 0:
            raise ExecutionError("Snapshot Delete Failed")
        ret, _, _ = set_snap_config(self.mnode, self.option_disable)
        if ret != 0:
            raise ExecutionError("Failed to execute set_snap_config")
        ret = get_snap_config(self.mnode, self.volname)
        if ret is None:
            raise ExecutionError("Failed to execute get_snap_config")
        if 'disable' not in ret['systemConfig']['activateOnCreate']:
            raise ExecutionError("Failed to disable activate-on-create")
        g.log.info("set_snap_config Success to disable "
                   "activate-on-create")

        # Cleanup-volume
        ret = self.cleanup_volume()
        if not ret:
            raise ExecutionError("Failed to Cleanup Volume")
        g.log.info("Successful in Cleanup Volume")

        # Calling GlusterBaseClass tearDown
        self.get_super_method(self, 'tearDown')()
Ejemplo n.º 4
0
    def tearDown(self):
        """
        tearDown for every test
        """

        g.log.info("Deleting all snapshots created")
        ret, _, _ = snap_delete_all(self.mnode)
        if ret != 0:
            raise ExecutionError("Snapshot Delete Failed")
        g.log.info("Successfully deleted all snapshots")

        # disable uss for volume
        g.log.info("Disabling uss for volume")
        ret, _, _ = disable_uss(self.mnode, self.volname)
        if ret != 0:
            raise ExecutionError("Failed to disable uss")
        g.log.info("Successfully disabled uss for volume" "%s", self.volname)

        # Unmount and cleanup-volume
        ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
        if not ret:
            raise ExecutionError("Failed to Unmount and Cleanup Volume")
        g.log.info("Successful in Unmount Volume and Cleanup Volume")

        # Calling GlusterBaseClass tearDown
        self.get_super_method(self, 'tearDown')()
Ejemplo n.º 5
0
    def tearDown(self):
        # Calling GlusterBaseClass tearDown
        GlusterBaseClass.tearDown.im_func(self)

        # disabling auto-delete
        cmd = "gluster snapshot config auto-delete disable"
        ret = g.run(self.mnode, cmd)
        self.assertTrue(ret, ("Failed to disable auto-delete snapshot"
                              "config option"))
        g.log.info("Snapshot auto-delete Successfully disabled")

        # deleting created snapshots
        ret = snap_delete_all(self.mnode)
        self.assertTrue(ret, ("Failed to delete snapshot of volume"
                              "%s" % self.volname))
        g.log.info("Successfully deleted snapshots of volume %s" %
                   self.volname)

        # setting back default max-soft-limit to 90%
        option = {'snap-max-soft-limit': '90'}
        ret = set_snap_config(self.mnode, option)
        self.assertTrue(ret, ("Failed to set snap-max-soft-limit"
                              "config option"))
        g.log.info("snap-max-soft-limit config option Successfully set")

        # cleanup-volume
        ret = self.cleanup_volume()
        if not ret:
            raise ExecutionError("Failed to Cleanup Volume")
        g.log.info("Cleanup volume %s Completed Successfully" % self.volname)
Ejemplo n.º 6
0
 def tearDown(self):
     """
     tearDown
     """
     ret, _, _ = snap_delete_all(self.mnode)
     if not ret:
         raise ExecutionError("Snapshot delete failed.")
     self.get_super_method(self, 'tearDown')()
 def tearDown(self):
     """
     tearDown
     """
     ret, _, _ = snap_delete_all(self.mnode)
     if not ret:
         raise ExecutionError("Failed to delete all snaps")
     GlusterBaseClass.tearDown.im_func(self)
Ejemplo n.º 8
0
 def tearDown(self):
     """
     tearDown for every test
     """
     ret, _, _ = snap_delete_all(self.mnode)
     if ret != 0:
         raise ExecutionError("Snapshot Delete Failed")
     g.log.info("Successfully deleted all snapshots")
     # Calling GlusterBaseClass tearDown
     GlusterBaseClass.tearDown.im_func(self)
Ejemplo n.º 9
0
 def tearDown(self):
     """
     tearDown for every test
     """
     ret, _, _ = snap_delete_all(self.mnode)
     if ret != 0:
         raise ExecutionError("Snapshot Delete Failed")
     g.log.info("Successfully deleted all snapshots")
     # Calling GlusterBaseClass tearDown
     self.get_super_method(self, 'tearDown')()
Ejemplo n.º 10
0
    def test_snap_delete_snap_volume(self):
        """
        Steps:
        1. create a volume and mount it
        2. create 9 snapshots of volume
        3. delete snapshot with snapname
        4. delete other snapshots with volume name
        5. create one more snapshot
        6. delete created snapshot with snap delete command
        """

        # Creating snapshot
        g.log.info("Starting to Create snapshot")
        for snap_count in range(0, 9):
            self.snap = "snap%s" % snap_count
            ret, _, _ = snap_create(self.mnode, self.volname, self.snap)
            self.assertEqual(ret, 0,
                             ("Failed to create snapshot %s "
                              "for volume %s" % (self.snap, self.volname)))
            g.log.info("Snapshot %s created successfully"
                       " for volume %s", self.snap, self.volname)

        # deleting snapshot with snap name
        g.log.info("Starting to delete snapshot with snap name")
        for snap_count in range(0, 3):
            self.snap = "snap%s" % snap_count
            ret, _, _ = snap_delete(self.mnode, self.snap)
            self.assertEqual(ret, 0,
                             ("Failed to delete snapshot snap%s" % snap_count))
            g.log.info("Snapshot snap%s deleted " "successfully", snap_count)

        # delete all snapshot of volume
        g.log.info("Starting to delete snapshot with volume name")
        ret, _, _ = snap_delete_by_volumename(self.mnode, self.volname)
        self.assertEqual(ret, 0,
                         ("Failed to delete snapshot snap%s" % snap_count))
        g.log.info("Snapshot deleted successfully for volume "
                   "%s", self.volname)

        # create a new snapshot
        g.log.info("Creating a new snapshot")
        self.snap1 = "snapy"
        ret, _, _ = snap_create(self.mnode, self.volname, self.snap1)
        self.assertEqual(ret, 0, ("Failed to create snapshot %s for volume "
                                  "%s" % (self.snap1, self.volname)))
        g.log.info("Snapshot %s created successfully"
                   " for volume %s", self.snap1, self.volname)

        # delete all snapshot created
        g.log.info("Deleting all snapshots created")
        ret, _, _ = snap_delete_all(self.mnode)
        self.assertEqual(ret, 0, "Failed to delete snapshots")
        g.log.info("All Snapshots deleted successfully")
Ejemplo n.º 11
0
    def tearDown(self):
        # deleting created snapshots
        ret, _, _ = snap_delete_all(self.mnode)
        if ret != 0:
            raise ExecutionError("Failed to delete snapshot of volume"
                                 "%s" % self.volname)
        g.log.info("Successfully deleted snapshots of volume %s", self.volname)

        # Unmount and volume cleanup
        g.log.info("Starting to Unmount and cleanup volume")
        ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
        if not ret:
            raise ExecutionError("Failed to Unmount and Clean Volume")
        g.log.info("Successful in Unmount and Clean Volume")
    def tearDown(self):
        # Calling GlusterBaseClass teardown
        self.get_super_method(self, 'tearDown')()

        # delete created snapshots
        g.log.info("starting to delete all created snapshots")
        ret, _, _ = snap_delete_all(self.mnode)
        self.assertEqual(ret, 0, "Failed to delete all snapshots")
        g.log.info("Successfully deleted all snapshots")

        # Disable Activate on create
        option = {'activate-on-create': 'disable'}
        ret, _, _ = set_snap_config(self.mnode, option)
        if ret != 0:
            raise ExecutionError("Failed to set activateOnCreate"
                                 "config option")
        g.log.info("ActivateOnCreate config option Successfully set")

        # umount clone volume
        g.log.info("Unmounting clone volume")
        ret, _, _ = umount_volume(self.clients[0], self.mpoint1)
        if ret != 0:
            raise ExecutionError("Failed to unmount clone "
                                 "volume %s" % self.clone1)
        g.log.info("Successfully unmounted clone volume %s", self.clone1)

        ret, _, _ = umount_volume(self.clients[0], self.mpoint2)
        if ret != 0:
            raise ExecutionError("Failed to unmount clone "
                                 "volume %s" % self.clone2)
        g.log.info("Successfully unmounted clone volume %s", self.clone2)

        # cleanup volume
        g.log.info("starting to cleanup volume")
        ret1 = cleanup_volume(self.mnode, self.clone1)
        ret2 = cleanup_volume(self.mnode, self.clone2)
        if not ret1:
            raise ExecutionError("Failed to cleanup %s clone "
                                 "volume" % self.clone1)
        if not ret2:
            raise ExecutionError("Failed to cleanup %s clone "
                                 "volume" % self.clone2)
        g.log.info("Successfully cleanedup cloned volumes")

        # Unmount and cleanup-volume
        g.log.info("Starting to Unmount and cleanup-volume")
        ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
        if not ret:
            raise ExecutionError("Failed to Unmount and Cleanup Volume")
        g.log.info("Successful in Unmount Volume and Cleanup Volume")
Ejemplo n.º 13
0
    def tearDown(self):

        # Deleting all snapshot
        g.log.info("Deleting all snapshots created")
        ret, _, _ = snap_delete_all(self.mnode)
        if ret != 0:
            raise ExecutionError("Snapshot Delete Failed")
        g.log.info("Successfully deleted all snapshots")

        # Unmount and cleanup original volume
        g.log.info("Starting to Unmount and Cleanup Volume")
        ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
        if not ret:
            raise ExecutionError("Failed to umount and cleanup Volume")
        g.log.info("Successful in umounting the volume and Cleanup")
    def tearDown(self):

        self.get_super_method(self, 'tearDown')()

        # Delete snapshots created in the test case
        ret, _, _ = snap_delete_all(self.mnode)
        if ret:
            raise ExecutionError("Failed to delete the snapshots")
        g.log.info("Successfully deleted all snapshots")

        # Unmount and cleanup volume
        ret = self.cleanup_volume()
        if not ret:
            raise ExecutionError("Failed to cleanup Volume")
        g.log.info("Successful in Cleanup volume")
Ejemplo n.º 15
0
    def tearDown(self):
        """
        tearDown
        """
        ret, _, _ = snap_delete_all(self.mnode)
        if not ret:
            raise ExecutionError("Failed to delete all snaps")
        GlusterBaseClass.tearDown.im_func(self)

        # Clean up the volume & mount
        g.log.info("Starting volume and  mount cleanup")
        ret = self.unmount_volume_and_cleanup_volume(self.mounts)
        if not ret:
            raise ExecutionError("Failed to cleanup volume and mount")
        g.log.info("Cleanup successful for the volume and mount")
    def tearDown(self):
        """
        tearDown
        """
        ret, _, _ = snap_delete_all(self.mnode)
        if not ret:
            raise ExecutionError("Failed to delete all snaps")
        self.get_super_method(self, 'tearDown')()

        # Clean up the volume & mount
        g.log.info("Starting volume and  mount cleanup")
        ret = self.unmount_volume_and_cleanup_volume(self.mounts)
        if not ret:
            raise ExecutionError("Failed to cleanup volume and mount")
        g.log.info("Cleanup successful for the volume and mount")
Ejemplo n.º 17
0
    def tearDown(self):
        """
        tearDown
        """
        ret, _, _ = snap_delete_all(self.mnode)
        if ret:
            raise ExecutionError("Snapshot delete failed.")

        # Unmount and cleanup-volume
        ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
        if not ret:
            raise ExecutionError("Failed to Unmount and Cleanup Volume")
        g.log.info("Successful in Unmount Volume and Cleanup Volume")

        self.get_super_method(self, 'tearDown')()
Ejemplo n.º 18
0
    def tearDown(self):
        # Calling GlusterBaseClass tearDown
        self.get_super_method(self, 'tearDown')()

        # deleting created snapshots
        g.log.info("Deleting all snapshots")
        ret, _, _ = snap_delete_all(self.mnode)
        self.assertEqual(ret, 0, ("Failed to delete snapshot of volume"
                                  "%s" % self.volname))
        g.log.info("Successfully deleted snapshots of volume %s", self.volname)

        # Unmount Volume
        g.log.info("Starting to Unmount Volume")
        ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
        if not ret:
            raise ExecutionError("Failed to umount the vol & cleanup Volume")
        g.log.info("Successful in umounting the volume and Cleanup")
    def tearDown(self):
        """
        tearDown for every test
        """
        ret, _, _ = snap_delete_all(self.mnode)
        self.assertEqual(ret, 0, "Snapshot Delete Failed")
        ret, _, _ = set_snap_config(self.mnode, self.option_disable)
        self.assertEqual(ret, 0, "Failed to execute set_snap_config")
        ret = get_snap_config(self.mnode, self.volname)
        if ret is None:
            raise ExecutionError("Failed to execute get_snap_config")
        if 'disable' not in ret['systemConfig']['activateOnCreate']:
            raise ExecutionError("Failed to disable activate-on-create")
        g.log.info("set_snap_config Success to disable " "activate-on-create")

        # Calling GlusterBaseClass tearDown
        GlusterBaseClass.tearDown.im_func(self)
Ejemplo n.º 20
0
    def tearDown(self):
        """
        tearDown
        """
        self.get_super_method(self, 'tearDown')()

        # Delete all snapshots
        ret, _, _ = snap_delete_all(self.mnode)
        if ret:
            raise ExecutionError("Failed to delete all snapshots")
        g.log.info("Successfully deleted all snapshots")

        # Unmount and cleanup volume
        ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
        if not ret:
            raise ExecutionError("Failed to cleanup volume and mount")
        g.log.info("Cleanup successful for the volume and mount")
    def tearDown(self):
        """
        tearDown for every test
        """

        g.log.info("Deleting all snapshots created")
        ret, _, _ = snap_delete_all(self.mnode)
        if ret != 0:
            raise ExecutionError("Snapshot Delete Failed")
        g.log.info("Successfully deleted all snapshots")

        # disable uss for volume
        g.log.info("Disabling uss for volume")
        ret, _, _ = disable_uss(self.mnode, self.volname)
        if ret != 0:
            raise ExecutionError("Failed to disable uss")
        g.log.info("Successfully disabled uss for volume" "%s", self.volname)

        # Calling GlusterBaseClass tearDown
        GlusterBaseClass.tearDown.im_func(self)
Ejemplo n.º 22
0
    def test_snap_delete_multiple(self):
        # pylint: disable=too-many-statements
        """
        Steps:

        1. create and mount volume
        2. Create 20 snapshots
        3. Clone one of the snapshot
        4. mount the clone volume
        5. Perform I/O on mounts
        6. Create 10 more snapshots
        7. create Clone volume from latest snapshot
           and Mount it
        8. Perform I/O
        9. Create 10 more snapshot
        10. Validate total number of
            snapshots created.
        11. Delete all created snapshots.

        """

        # Perform I/O
        def io_operation():
            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)
            self.io_validation_complete = False

            # Validate IO
            g.log.info("Wait for IO to complete and validate IO ...")
            ret = validate_io_procs(all_mounts_procs, self.mounts)
            self.assertTrue(ret, "IO failed on some of the clients")
            self.io_validation_complete = True
            g.log.info("IO is successful on all mounts")
            return 0

        # Enable Activate on create
        g.log.info("Enabling activate-on-create")
        option = {'activate-on-create': 'enable'}
        ret, _, _ = set_snap_config(self.mnode, option)
        self.assertEqual(ret, 0, ("Failed to set activateOnCreate"
                                  "config option"))
        g.log.info("Activate-on-Create config option Successfully set")

        def create_snap(value, volname, snap, clone, counter):
            # Creating snapshots
            g.log.info("Starting to Create snapshot")
            for snap_count in value:
                ret, _, _ = snap_create(self.mnode, volname,
                                        "snap%s" % snap_count)
                self.assertEqual(ret, 0, ("Failed to create "
                                          "snapshot for volume %s" % volname))
                g.log.info(
                    "Snapshot snap%s created successfully"
                    " for volume %s", snap_count, volname)

            # Validate snapshot list
            g.log.info("Starting to list all snapshots")
            ret, out, _ = snap_list(self.mnode)
            self.assertEqual(
                ret, 0, ("Failed to list snapshot of volume %s" % volname))
            v_list = out.strip().split('\n')
            self.assertEqual(len(v_list), counter, "Failed to validate "
                             "all snapshots")
            g.log.info(
                "Snapshot listed and  Validated for volume %s"
                " successfully", volname)
            if counter == 40:
                return 0

            # Creating a Clone of snapshot:
            g.log.info("Starting to Clone Snapshot")
            ret, _, _ = snap_clone(self.mnode, snap, clone)
            self.assertEqual(ret, 0, "Failed to clone %s" % clone)
            g.log.info("Clone volume %s created successfully", clone)

            # Start cloned volumes
            g.log.info("starting to Validate clone volumes are started")
            ret, _, _ = volume_start(self.mnode, clone)
            self.assertEqual(ret, 0, "Failed to start %s" % clone)
            g.log.info("%s started successfully", clone)

            # log Cloned Volume information
            g.log.info("Logging Volume info and Volume status")
            ret = log_volume_info_and_status(self.mnode, clone)
            self.assertTrue("Failed to Log Info and Status of Volume %s" %
                            clone)
            g.log.info("Successfully Logged Info and Status")
            return counter + 10

        def mount_clone_and_io(clone, mpoint):
            # define mounts
            self.mount_points = []
            self.mounts_dict_list = []
            for client in self.all_clients_info:
                mount = {
                    'protocol': self.mount_type,
                    'server': self.mnode,
                    'volname': clone,
                    'client': self.all_clients_info[client],
                    'mountpoint': (os.path.join("%s" % mpoint)),
                    'options': ''
                }
                self.mounts_dict_list.append(mount)
            self.mounts1 = create_mount_objs(self.mounts_dict_list)
            g.log.info("Successfully made entry in self.mounts")
            # Mounting a volume
            g.log.info("Starting to mount volume")
            ret = mount_volume(clone, self.mount_type, mpoint, self.mnode,
                               self.clients[0])
            self.assertTrue(ret, "Volume mount failed for clone1")
            g.log.info("%s mounted Successfully", clone)

            # Checking volume mounted or not
            ret = is_mounted(clone, mpoint, self.mnode, self.clients[0],
                             self.mount_type)
            self.assertTrue(ret,
                            "Volume not mounted on mount point: %s" % mpoint)
            g.log.info("Volume %s mounted on %s", clone, mpoint)
            return 0

        value1 = range(0, 20)
        value2 = range(20, 30)
        value3 = range(30, 40)
        ret1 = create_snap(value1,
                           self.volname,
                           self.snap1,
                           self.clone1,
                           counter=20)
        self.assertEqual(ret1, 30, "Failed")
        ret2 = mount_clone_and_io(self.clone1, self.mpoint1)
        self.assertEqual(ret2, 0, "Failed to mount volume")
        ret = io_operation()
        self.assertEqual(ret, 0, "Failed to perform io")
        ret3 = create_snap(value2, self.clone1, self.snap2, self.clone2, ret1)
        self.assertEqual(ret3, 40, "Failed")
        ret4 = mount_clone_and_io(self.clone2, self.mpoint2)
        self.assertEqual(ret4, 0, "Failed to mount volume")
        ret = io_operation()
        self.assertEqual(ret, 0, "Failed to perform io")
        ret1 = create_snap(value3, self.clone2, self.snap2, self.clone2, ret3)
        self.assertEqual(ret1, 0, "Failed to create snapshots")

        # delete created snapshots
        g.log.info("starting to delete all created snapshots")
        ret, _, _ = snap_delete_all(self.mnode)
        self.assertEqual(ret, 0, "Failed to delete all snapshots")
        g.log.info("Successfully deleted all snapshots")
    def test_validate_snaps_create(self):
        # Creating snapshot using gluster snapshot create <snap1> <vol-name>
        cmd_str = "gluster snapshot create %s %s" % ("snap1", self.volname)
        ret = g.run(self.mnode, cmd_str)
        self.assertTrue(ret,
                        ("Failed to create snapshot for %s" % self.volname))
        g.log.info("Snapshot snap1 created successfully for volume  %s" %
                   (self.volname))
        """ Create snapshot of volume using
           -- gluster snapshot create <snap2> <vol-name(s)> [description
          <description with words and quotes>]
        """
        desc = 'description this is a snap with "snap2" name and description'
        cmd_str = ("gluster snapshot create %s %s %s" %
                   ("snap2", self.volname, desc))
        ret = g.run(self.mnode, cmd_str)
        self.assertTrue(ret,
                        ("Failed to create snapshot for %s" % self.volname))
        g.log.info("Snapshot snap2 created successfully for volume  %s" %
                   (self.volname))

        # Create one more snapshot of volume using force
        cmd_str = ("gluster snapshot create %s %s %s" %
                   ("snap3", self.volname, "force"))
        ret = g.run(self.mnode, cmd_str)
        self.assertTrue(ret,
                        ("Failed to create snapshot for %s" % self.volname))
        g.log.info("Snapshot snap3 created successfully for volume  %s" %
                   (self.volname))

        # Create one more snapshot of volume using no-timestamp option
        cmd_str = ("gluster snapshot create %s %s %s" %
                   ("snap4", self.volname, "no-timestamp"))
        ret = g.run(self.mnode, cmd_str)
        self.assertTrue(ret,
                        ("Failed to create snapshot for %s" % self.volname))
        g.log.info("Snapshot snap4 created successfully for volume  %s" %
                   (self.volname))

        # Delete all snaps
        ret, _, _ = snap_delete_all(self.mnode)
        self.assertEqual(ret, 0, "Snapshot delete failed.")
        g.log.info("Successfully deleted all snaps")

        # Start IO on all mounts.
        all_mounts_procs = []
        count = 1
        for mount_obj in self.mounts:
            g.log.info("Starting IO on %s:%s", mount_obj.client_system,
                       mount_obj.mountpoint)
            cmd = ("python %s create_deep_dirs_with_files "
                   "--dirname-start-num %d "
                   "--dir-depth 2 "
                   "--dir-length 10 "
                   "--max-num-of-dirs 5 "
                   "--num-of-files 5 %s" %
                   (self.script_upload_path, count, mount_obj.mountpoint))
            proc = g.run_async(mount_obj.client_system,
                               cmd,
                               user=mount_obj.user)
            all_mounts_procs.append(proc)
            count = count + 10

        # Create 5 snaps while IO is in progress
        for i in range(0, 5):
            cmd_str = "gluster snapshot create %s %s %s" % (
                "snapy%s" % i, self.volname, "no-timestamp")
            ret = g.run(self.mnode, cmd_str)
            self.assertTrue(
                ret, ("Failed to create snapshot for %s" % self.volname))
            g.log.info("Snapshot %s created successfully for volume  %s" %
                       ("snapy%s" % i, self.volname))

        # Validate IO
        g.log.info("Validating IO's")
        ret = validate_io_procs(all_mounts_procs, self.mounts)
        self.assertTrue(ret, "IO failed on some of the clients")
        g.log.info("Successfully validated all io's")

        # Get stat of all the files/dirs created.
        g.log.info("Get stat of all the files/dirs created.")
        ret = get_mounts_stat(self.mounts)
        self.assertTrue(ret, "Stat failed on some of the clients")
        g.log.info("Successfully got stat of all files/dirs created")

        # Check for no of snaps using snap_list it should be 5 now
        snap_list = get_snap_list(self.mnode)
        self.assertEqual(
            5, len(snap_list), "No of snaps not consistent "
            "for volume %s" % self.volname)
        g.log.info("Successfully validated number of snaps.")

        # Validate all snaps created during IO
        for i in range(0, 5):
            self.assertIn("snapy%s" % i, snap_list, "%s snap not "
                          "found " % ("snapy%s" % i))
        g.log.info("Sucessfully validated names of snap")