def test_distribution_hash_value(self): """Test case tests DHT of files and directories based on hash value """ # pylint: disable=too-many-locals for client_index, mount_obj in enumerate(self.mounts): client_host = mount_obj.client_system mountpoint = mount_obj.mountpoint # Create directory for initial data g.log.debug("Creating temporary folder on client's machine %s:%s", client_host, self.temp_folder) if not mkdir(client_host, self.temp_folder): g.log.error("Failed create temporary directory " "on client machine %s:%s", client_host, self.temp_folder) raise ExecutionError("Failed create temporary directory " "on client machine %s:%s" % (client_host, self.temp_folder)) g.log.info('Created temporary directory on client machine %s:%s', client_host, self.temp_folder) # Prepare a set of data files = ["{prefix}{file_name}_{client_index}". format(file_name=file_name, client_index=client_index, prefix='' if randint(1, 6) % 2 else choice('ABCD') + '/') for file_name in map(chr, range(97, 123))] ret = self.create_files(client_host, self.temp_folder, files, "Lorem Ipsum is simply dummy text of the " "printing and typesetting industry.") self.assertTrue(ret, "Failed creating a set of files and dirs " "on %s:%s" % (client_host, self.temp_folder)) g.log.info('Created data set on client machine on folder %s:%s', client_host, self.temp_folder) # Copy prepared data to mount point cmd = ('cp -vr {source}/* {destination}'.format( source=self.temp_folder, destination=mountpoint)) ret, _, _ = g.run(client_host, cmd) self.assertEqual(ret, 0, "Copy data to mount point %s:%s Failed") g.log.info('Copied prepared data to mount point %s:%s', client_host, mountpoint) # Verify that hash layout values are set on each # bricks for the dir g.log.debug("Verifying DHT layout") ret = validate_files_in_dir(client_host, mountpoint, test_type=TEST_LAYOUT_IS_COMPLETE) self.assertTrue(ret, "TEST_LAYOUT_IS_COMPLETE: FAILED") g.log.info("TEST_LAYOUT_IS_COMPLETE: PASS on %s:%s ", client_host, mountpoint) g.log.debug("Verifying files and directories") ret = validate_files_in_dir(client_host, mountpoint, test_type=FILE_ON_HASHED_BRICKS, file_type=FILETYPE_DIRS) self.assertTrue(ret, "TEST_FILE_EXISTS_ON_HASHED_BRICKS: FAILED") g.log.info("TEST_FILE_EXISTS_ON_HASHED_BRICKS: PASS") # Verify "trusted.gfid" extended attribute of the # directory/file on all the bricks gfids = dict() g.log.debug("Check if trusted.gfid is presented on the bricks") for brick_item in get_all_bricks(self.mnode, self.volname): brick_host, brick_dir = brick_item.split(':') for target_destination in files: if not file_exists(brick_host, '{brick_dir}/{dest}'. format(brick_dir=brick_dir, dest=target_destination)): continue ret = get_fattr(brick_host, '%s/%s' % (brick_dir, target_destination), 'trusted.gfid') self.assertIsNotNone(ret, "trusted.gfid is not presented " "on %s/%s" % (brick_dir, target_destination)) g.log.info("Verified trusted.gfid on brick %s:%s", brick_item, target_destination) gfids.setdefault(target_destination, []).append(ret) g.log.debug('Check if trusted.gfid is same on all the bricks') self.assertTrue(all([False if len(set(gfids[k])) > 1 else True for k in gfids]), "trusted.gfid should be same on all the bricks") g.log.info('trusted.gfid is same on all the bricks') # Verify that mount point shows pathinfo xattr. g.log.debug("Check if pathinfo is presented on mount point " "%s:%s", client_host, mountpoint) ret = get_fattr(client_host, mountpoint, 'trusted.glusterfs.pathinfo') self.assertIsNotNone(ret, "pathinfo is not presented on mount " "point %s:%s" % (client_host, mountpoint)) g.log.info('trusted.glusterfs.pathinfo is presented on mount' ' point %s:%s', client_host, mountpoint) # Mount point should not display xattr: # trusted.gfid and trusted.glusterfs.dht g.log.debug("Check if trusted.gfid and trusted.glusterfs.dht are " "not presented on mount point %s:%s", client_host, mountpoint) attributes = get_fattr_list(client_host, mountpoint) self.assertFalse('trusted.gfid' in attributes, "Expected: Mount point shouldn't display xattr:" "{xattr}. Actual: xattrs {xattr} is " "presented on mount point". format(xattr='trusted.gfid')) self.assertFalse('trusted.glusterfs.dht' in attributes, "Expected: Mount point shouldn't display xattr:" "{xattr}. Actual: xattrs {xattr} is " "presented on mount point". format(xattr='trusted.glusterfs.dht')) g.log.info("trusted.gfid and trusted.glusterfs.dht are not " "presented on mount point %s:%s", client_host, mountpoint) g.log.info('Files and dirs are stored on bricks based on hash value')
def test_shrinking_volume_when_io_in_progress(self): """Test shrinking volume (Decrease distribute count) using existing servers bricks when IO is in progress. Description: - remove brick (start, status, commit) - validate IO """ # Log Volume Info and Status before shrinking the volume. ret = log_volume_info_and_status(self.mnode, self.volname) self.assertTrue(ret, ("Logging volume info and status failed on " "volume %s", self.volname)) g.log.info("Successful in logging volume info and status of volume %s", self.volname) # Temporary code: # Additional checks to gather infomartion from all # servers for Bug 1810901 and setting log level to debug. if self.volume_type == 'distributed-dispersed': for brick_path in get_all_bricks(self.mnode, self.volname): node, path = brick_path.split(':') ret, out, _ = g.run(node, 'find {}/'.format(path)) g.log.info(out) for filedir in out.split('\n'): ret, out, _ = g.run(node, 'ls -l {}'.format(filedir)) g.log.info("Return value for ls -l command: %s", ret) g.log.info(out) ret = get_fattr_list(node, filedir, encode_hex=True) g.log.info(ret) # Shrinking volume by removing bricks from volume when IO in progress ret = shrink_volume(self.mnode, self.volname) # Temporary code: # Additional checks to gather infomartion from all # servers for Bug 1810901. if not ret and self.volume_type == 'distributed-dispersed': for brick_path in get_all_bricks(self.mnode, self.volname): node, path = brick_path.split(':') ret, out, _ = g.run(node, 'find {}/'.format(path)) g.log.info(out) for filedir in out.split('\n'): ret, out, _ = g.run(node, 'ls -l {}'.format(filedir)) g.log.info("Return value for ls -l command: %s", ret) g.log.info(out) ret = get_fattr_list(node, filedir, encode_hex=True) g.log.info(ret) self.assertTrue(ret, ("Failed to shrink the volume when IO in " "progress on volume %s", self.volname)) g.log.info( "Shrinking volume when IO in progress is successful on " "volume %s", self.volname) # Wait for volume processes to be online ret = wait_for_volume_process_to_be_online(self.mnode, self.volname) self.assertTrue(ret, ("Failed to wait for volume %s processes to " "be online", self.volname)) # Log Volume Info and Status after shrinking the volume ret = log_volume_info_and_status(self.mnode, self.volname) self.assertTrue(ret, ("Logging volume info and status failed on " "volume %s", self.volname)) g.log.info("Successful in logging volume info and status of volume %s", self.volname) # Verify volume's all process are online ret = verify_all_process_of_volume_are_online(self.mnode, self.volname) self.assertTrue( ret, ("Volume %s : All process are not online", self.volname)) # Validate IO ret = validate_io_procs(self.all_mounts_procs, self.mounts) self.io_validation_complete = True self.assertTrue(ret, "IO failed on some of the clients") # List all files and dirs created ret = list_all_files_and_dirs_mounts(self.mounts) self.assertTrue(ret, "Failed to list all files and dirs")
def test_detach_node_used_to_mount(self): # pylint: disable=too-many-statements """ Test case: 1.Create a 1X3 volume with only 3 nodes from the cluster. 2.Mount volume on client node using the ip of the fourth node. 3.Write IOs to the volume. 4.Detach node N4 from cluster. 5.Create a new directory on the mount point. 6.Create a few files using the same command used in step 3. 7.Add three more bricks to make the volume 2x3 using add-brick command. 8.Do a gluster volume rebalance on the volume. 9.Create more files from the client on the mount point. 10.Check for files on bricks from both replica sets. 11.Create a new directory from the client on the mount point. 12.Check for directory in both replica sets. """ # Create and start a volume ret = setup_volume(self.mnode, self.all_servers_info, self.volume) self.assertTrue(ret, "Failed to create and start volume") g.log.info("Volume %s created successfully", self.volname) # Mounting the volume. ret, _, _ = mount_volume(self.volname, mtype=self.mount_type, mpoint=self.mounts[0].mountpoint, mserver=self.servers[4], mclient=self.mounts[0].client_system) self.assertEqual(ret, 0, ("Volume %s is not mounted") % self.volname) g.log.info("Volume mounted successfully using %s", self.servers[4]) # Creating 100 files. command = ('for number in `seq 1 100`;do touch ' + self.mounts[0].mountpoint + '/file$number; done') ret, _, _ = g.run(self.mounts[0].client_system, command) self.assertEqual(ret, 0, "File creation failed.") g.log.info("Files create on mount point.") # Detach N4 from the list. ret, _, _ = peer_detach(self.mnode, self.servers[4]) self.assertEqual(ret, 0, "Failed to detach %s" % self.servers[4]) g.log.info("Peer detach successful %s", self.servers[4]) # Creating a dir. ret = mkdir(self.mounts[0].client_system, self.mounts[0].mountpoint + "/dir1", parents=True) self.assertTrue(ret, ("Failed to create directory dir1.")) g.log.info("Directory dir1 created successfully.") # Creating 100 files. command = ('for number in `seq 101 200`;do touch ' + self.mounts[0].mountpoint + '/file$number; done') ret, _, _ = g.run(self.mounts[0].client_system, command) self.assertEqual(ret, 0, "File creation failed.") g.log.info("Files create on mount point.") # Forming brick list brick_list = form_bricks_list_to_add_brick(self.mnode, self.volname, self.servers, self.all_servers_info) # Adding bricks ret, _, _ = add_brick(self.mnode, self.volname, brick_list) self.assertEqual(ret, 0, "Failed to add brick to the volume %s" % self.volname) g.log.info("Brick added successfully to the volume %s", self.volname) # Start rebalance for volume. g.log.info("Starting rebalance on the volume") ret, _, _ = rebalance_start(self.mnode, self.volname) self.assertEqual(ret, 0, ("Failed to start rebalance " "on the volume %s", self.volname)) g.log.info("Successfully started rebalance on the volume %s", self.volname) # Creating 100 files. command = ('for number in `seq 201 300`;do touch ' + self.mounts[0].mountpoint + '/file$number; done') ret, _, _ = g.run(self.mounts[0].client_system, command) self.assertEqual(ret, 0, "File creation failed.") g.log.info("Files create on mount point.") # Check for files on bricks. attempts = 10 while attempts: number = str(randint(1, 300)) for brick in brick_list: brick_server, brick_dir = brick.split(':') file_name = brick_dir + "/file" + number if file_exists(brick_server, file_name): g.log.info("Check xattr" " on host %s for file %s", brick_server, file_name) ret = get_fattr_list(brick_server, file_name) self.assertTrue(ret, ("Failed to get xattr for %s" % file_name)) g.log.info("Got xattr for %s successfully", file_name) attempts -= 1 # Creating a dir. ret = mkdir(self.mounts[0].client_system, self.mounts[0].mountpoint + "/dir2") if not ret: attempts = 5 while attempts: ret = mkdir(self.mounts[0].client_system, self.mounts[0].mountpoint + "/dir2") if ret: break attempts -= 1 self.assertTrue(ret, ("Failed to create directory dir2.")) g.log.info("Directory dir2 created successfully.") # Check for directory in both replica sets. for brick in brick_list: brick_server, brick_dir = brick.split(':') folder_name = brick_dir + "/dir2" if file_exists(brick_server, folder_name): g.log.info( "Check trusted.glusterfs.dht" " on host %s for directory %s", brick_server, folder_name) ret = get_fattr(brick_server, folder_name, 'trusted.glusterfs.dht') self.assertTrue(ret, ("Failed to get trusted.glusterfs.dht" " xattr for %s" % folder_name)) g.log.info( "Get trusted.glusterfs.dht xattr" " for %s successfully", folder_name)
def test_create_directory(self): g.log.info("creating multiple,multilevel directories") m_point = self.mounts[0].mountpoint command = 'mkdir -p ' + m_point + '/root_dir/test_dir{1..3}' ret, _, _ = g.run(self.mounts[0].client_system, command) self.assertEqual( ret, 0, "directory creation failed on %s" % self.mounts[0].mountpoint) command = 'ls ' + m_point + '/root_dir' ret, out, _ = g.run(self.mounts[0].client_system, command) self.assertEqual(ret, 0, "ls failed on parent directory:root_dir") g.log.info("ls on parent directory: successful") g.log.info("creating files at different directory levels inside %s", self.mounts[0].mountpoint) command = 'touch ' + m_point + \ '/root_dir/test_file{1..5} ' + m_point + \ '/root_dir/test_dir{1..3}/test_file{1..5}' ret, _, _ = g.run(self.mounts[0].client_system, command) self.assertEqual(ret, 0, "File creation: failed") command = 'ls ' + m_point + '/root_dir' ret, out, _ = g.run(self.mounts[0].client_system, command) self.assertEqual(ret, 0, "can't list the created directories") list_of_files_and_dirs = out.split('\n') flag = True for x_count in range(3): dir_name = 'test_dir%d' % (x_count + 1) if dir_name not in list_of_files_and_dirs: flag = False for x_count in range(5): file_name = 'test_file%d' % (x_count + 1) if file_name not in list_of_files_and_dirs: flag = False self.assertTrue( flag, "ls command didn't list all the " "directories and files") g.log.info("creation of files at multiple levels successful") g.log.info("creating a list of all directories") command = 'cd ' + m_point + ';find root_dir -type d -print' ret, out, _ = g.run(self.mounts[0].client_system, command) self.assertEqual(ret, 0, "creation of directory list failed") list_of_all_dirs = out.split('\n') del list_of_all_dirs[-1] g.log.info("verifying that all the directories are present on " "every brick and the layout ranges are correct") flag = validate_files_in_dir(self.clients[0], m_point + '/root_dir', test_type=k.TEST_LAYOUT_IS_COMPLETE) self.assertTrue(flag, "Layout has some holes or overlaps") g.log.info("Layout is completely set") g.log.info("Checking if gfid xattr of directories is displayed and" "is same on all the bricks on the server node") brick_list = get_all_bricks(self.mnode, self.volname) for direc in list_of_all_dirs: list_of_gfid = [] for brick in brick_list: # the partition function returns a tuple having 3 elements. # the host address, the character passed i.e. ':' # , and the brick path brick_tuple = brick.partition(':') brick_path = brick_tuple[2] gfid = get_fattr(brick_tuple[0], brick_path + '/' + direc, 'trusted.gfid') list_of_gfid.append(gfid) flag = True for x_count in range(len(list_of_gfid) - 1): if list_of_gfid[x_count] != list_of_gfid[x_count + 1]: flag = False self.assertTrue(flag, ("the gfid for the directory %s is not " "same on all the bricks", direc)) g.log.info("the gfid for each directory is the same on all the " "bricks") g.log.info("Verify that for all directories mount point " "should not display xattr") for direc in list_of_all_dirs: list_of_xattrs = get_fattr_list( self.mounts[0].client_system, self.mounts[0].mountpoint + '/' + direc) if 'security.selinux' in list_of_xattrs: del list_of_xattrs['security.selinux'] self.assertFalse( list_of_xattrs, "one or more xattr being " "displayed on mount point") g.log.info("Verified : mount point not displaying important " "xattrs") g.log.info("Verifying that for all directories only mount point " "shows pathinfo xattr") for direc in list_of_all_dirs: fattr = get_fattr(self.mounts[0].client_system, self.mounts[0].mountpoint + '/' + direc, 'trusted.glusterfs.pathinfo') self.assertTrue(fattr, ("pathinfo not displayed for the " "directory %s on mount point", direc)) brick_list = get_all_bricks(self.mnode, self.volname) for direc in list_of_all_dirs: for brick in brick_list: host = brick.partition(':')[0] brick_path = brick.partition(':')[2] fattr = get_fattr(host, brick_path + '/' + direc, 'trusted.glusterfs.pathinfo') self.assertIsNone(fattr, "subvolume displaying pathinfo") g.log.info("Verified: only mount point showing pathinfo " "for all the directories")
def test_directory_custom_extended_attr(self): """Test - set custom xattr to directory and link to directory """ # pylint: disable = too-many-statements dir_prefix = '{root}/folder_{client_index}' for mount_index, mount_point in enumerate(self.mounts): folder_name = dir_prefix.format(root=mount_point.mountpoint, client_index=mount_index) # Create a directory from mount point g.log.info('Creating directory : %s:%s', mount_point.mountpoint, folder_name) ret = mkdir(mount_point.client_system, folder_name) self.assertTrue( ret, 'Failed to create directory %s on mount point %s' % (folder_name, mount_point.mountpoint)) ret = file_exists(mount_point.client_system, folder_name) self.assertTrue( ret, 'Created Directory %s does not exists on mount ' 'point %s' % (folder_name, mount_point.mountpoint)) g.log.info('Created directory %s:%s', mount_point.mountpoint, folder_name) # Verify that hash layout values are set on each # bricks for the dir g.log.debug("Verifying hash layout values") ret = validate_files_in_dir(mount_point.client_system, mount_point.mountpoint, test_type=FILE_ON_HASHED_BRICKS, file_type=FILETYPE_DIR) self.assertTrue( ret, "Expected - Directory is stored " "on hashed bricks") g.log.info("Hash layout values are set on each bricks") # Verify that mount point should not display # xattr : trusted.gfid and dht g.log.debug("Loading extra attributes") ret = get_fattr_list(mount_point.client_system, folder_name) self.assertTrue( 'trusted.gfid' not in ret, "Extended attribute trusted.gfid is presented on " "mount point %s and folder %s" % (mount_point.mountpoint, folder_name)) self.assertTrue( 'trusted.glusterfs.dht' not in ret, "Extended attribute trusted.glusterfs.dht is " "presented on mount point %s and folder %s" % (mount_point.mountpoint, folder_name)) g.log.info( 'Extended attributes trusted.gfid and ' 'trusted.glusterfs.dht does not exists on ' 'mount point %s:%s ', mount_point.mountpoint, folder_name) # Verify that mount point shows pathinfo xattr g.log.debug("Check for xattr trusted.glusterfs.pathinfo on %s:%s", mount_point, folder_name) ret = get_fattr(mount_point.client_system, mount_point.mountpoint, 'trusted.glusterfs.pathinfo', encode="text") self.assertIsNotNone( ret, "trusted.glusterfs.pathinfo is not " "presented on %s:%s" % (mount_point.mountpoint, folder_name)) g.log.info( 'pathinfo xattr is displayed on mount point %s and ' 'dir %s', mount_point.mountpoint, folder_name) # Create a custom xattr for dir g.log.info("Set attribute user.foo to %s", folder_name) ret = set_fattr(mount_point.client_system, folder_name, 'user.foo', 'bar2') self.assertTrue( ret, "Setup custom attribute on %s:%s failed" % (mount_point.client_system, folder_name)) g.log.info('Set custom attribute is set on %s:%s', mount_point.client_system, folder_name) # Verify that custom xattr for directory is displayed # on mount point and bricks g.log.debug('Check xarttr user.foo on %s:%s', mount_point.client_system, folder_name) ret = get_fattr(mount_point.client_system, folder_name, 'user.foo', encode="text") self.assertEqual( ret, 'bar2', "Xattr attribute user.foo is not presented on " "mount point %s and directory %s" % (mount_point.client_system, folder_name)) g.log.info( 'Custom xattr user.foo is presented on mount point' ' %s:%s ', mount_point.client_system, folder_name) for brick in get_all_bricks(self.mnode, self.volname): brick_server, brick_dir = brick.split(':') brick_path = dir_prefix.format(root=brick_dir, client_index=mount_index) ret = get_fattr(brick_server, brick_path, 'user.foo', encode="text") g.log.debug('Check custom xattr for directory on brick %s:%s', brick_server, brick_path) self.assertEqual( 'bar2', ret, "Expected: user.foo should be on brick %s\n" "Actual: Value of attribute foo.bar %s" % (brick_path, ret)) g.log.info('Custom xattr is presented on brick %s', brick_path) # Delete custom attribute ret = delete_fattr(mount_point.client_system, folder_name, 'user.foo') self.assertTrue(ret, "Failed to delete custom attribute") g.log.info('Removed custom attribute from directory %s:%s', mount_point.client_system, folder_name) # Verify that custom xattr is not displayed after delete # on mount point and on the bricks g.log.debug('Looking if custom extra attribute user.foo is ' 'presented on mount or on bricks after deletion') self.assertIsNone( get_fattr(mount_point.client_system, folder_name, 'user.foo', encode="text"), "Xattr user.foo is presented on mount point" " %s:%s after deletion" % (mount_point.mountpoint, folder_name)) g.log.info( "Xattr user.foo is not presented after deletion" " on mount point %s:%s", mount_point.mountpoint, folder_name) for brick in get_all_bricks(self.mnode, self.volname): brick_server, brick_dir = brick.split(':') brick_path = dir_prefix.format(root=brick_dir, client_index=mount_index) self.assertIsNone( get_fattr(brick_server, brick_path, 'user.foo'), "Deleted xattr user.foo is presented on " "brick %s:%s" % (brick, brick_path)) g.log.info( 'Custom attribute is not presented after delete ' 'from directory on brick %s:%s', brick, brick_path) # Repeat all of the steps for link of created directory for mount_index, mount_point in enumerate(self.mounts): linked_folder_name = dir_prefix.format(root=mount_point.mountpoint, client_index="%s_linked" % mount_index) folder_name = dir_prefix.format(root=mount_point.mountpoint, client_index=mount_index) # Create link to created dir command = 'ln -s {src} {dst}'.format(dst=linked_folder_name, src=folder_name) ret, _, _ = g.run(mount_point.client_system, command) self.assertEqual( 0, ret, 'Failed to create link %s to directory %s' % (linked_folder_name, folder_name)) self.assertTrue( file_exists(mount_point.client_system, linked_folder_name), 'Link does not exists on %s:%s' % (mount_point.client_system, linked_folder_name)) g.log.info('Create link %s to directory %s', linked_folder_name, folder_name) # Verify that hash layout values are set on each # bricks for the link to dir g.log.debug("Verifying hash layout values") ret = validate_files_in_dir(mount_point.client_system, mount_point.mountpoint, test_type=FILE_ON_HASHED_BRICKS, file_type=FILETYPE_LINK) self.assertTrue( ret, "Expected - Link to directory is stored " "on hashed bricks") g.log.info("Hash layout values are set on each bricks") # Verify that mount point should not display xattr : # trusted.gfid and dht g.log.debug("Loading extra attributes") ret = get_fattr_list(mount_point.client_system, linked_folder_name) self.assertTrue( 'trusted.gfid' not in ret, "Extended attribute trudted.gfid is presented on " "mount point %s and folder %s" % (mount_point.mountpoint, linked_folder_name)) self.assertTrue( 'trusted.glusterfs.dht' not in ret, "Extended attribute trusted.glusterfs.dht is " "presented on mount point %s and folder %s" % (mount_point.mountpoint, linked_folder_name)) g.log.info( 'Extended attributes trusted.gfid and ' 'trusted.glusterfs.dht does not exists on ' 'mount point %s:%s ', mount_point.mountpoint, linked_folder_name) # Verify that mount point shows pathinfo xattr g.log.debug("Check if pathinfo is presented on %s:%s", mount_point.client_system, linked_folder_name) self.assertIsNotNone( get_fattr(mount_point.client_system, mount_point.mountpoint, 'trusted.glusterfs.pathinfo'), "pathinfo is not displayed on mountpoint " "%s:%s" % (mount_point.client_system, linked_folder_name)) g.log.info('pathinfo value is displayed on mount point %s:%s', mount_point.client_system, linked_folder_name) # Set custom Attribute to link g.log.debug("Set custom xattribute user.foo to %s:%s", mount_point.client_system, linked_folder_name) self.assertTrue( set_fattr(mount_point.client_system, linked_folder_name, 'user.foo', 'bar2')) g.log.info('Successful in set custom attribute to %s:%s', mount_point.client_system, linked_folder_name) # Verify that custom xattr for directory is displayed # on mount point and bricks g.log.debug('Check mountpoint and bricks for custom xattribute') self.assertEqual( 'bar2', get_fattr(mount_point.client_system, linked_folder_name, 'user.foo', encode="text"), 'Custom xattribute is not presented on ' 'mount point %s:%s' % (mount_point.client_system, linked_folder_name)) g.log.info("Custom xattribute is presented on mount point %s:%s", mount_point.client_system, linked_folder_name) for brick in get_all_bricks(self.mnode, self.volname): brick_server, brick_dir = brick.split(':') brick_path = dir_prefix. \ format(root=brick_dir, client_index="%s_linked" % mount_index) cmd = '[ -f %s ] && echo "yes" || echo "no"' % brick_path # Check if link exists _, ret, _ = g.run(brick_server, cmd) if 'no' in ret: g.log.info("Link %s:%s does not exists", brick_server, brick_path) continue self.assertEqual( get_fattr(brick_server, brick_path, 'user.foo', encode="text"), 'bar2', "Actual: custom attribute not " "found on brick %s:%s" % (brick_server, brick_path)) g.log.info('Custom xattr for link found on brick %s:%s', brick, brick_path) # Delete custom attribute g.log.debug('Removing customer attribute on mount point %s:%s', mount_point.client_system, linked_folder_name) self.assertTrue( delete_fattr(mount_point.client_system, linked_folder_name, 'user.foo'), 'Fail on delete xattr user.foo') g.log.info('Deleted custom xattr from link %s:%s', mount_point.client_system, linked_folder_name) # Verify that custom xattr is not displayed after delete # on mount point and on the bricks g.log.debug( "Check if custom xattr is presented on %s:%s " "after deletion", mount_point.client_system, linked_folder_name) self.assertIsNone( get_fattr(mount_point.client_system, linked_folder_name, 'user.foo', encode="text"), "Expected: xattr user.foo to be not presented on" " %s:%s" % (mount_point.client_system, linked_folder_name)) g.log.info("Custom xattr user.foo is not presented on %s:%s", mount_point.client_system, linked_folder_name) for brick in get_all_bricks(self.mnode, self.volname): brick_server, brick_dir = brick.split(':') brick_path = dir_prefix. \ format(root=brick_dir, client_index="%s_linked" % mount_index) cmd = '[ -f %s ] && echo "yes" || echo "no"' % brick_path # Check if link exists _, ret, _ = g.run(brick_server, cmd) if 'no' in ret: g.log.info("Link %s:%s does not exists", brick_server, brick_path) continue self.assertIsNone( get_fattr(brick_server, brick_path, 'user.foo', encode="text"), "Extended custom attribute is presented on " "%s:%s after deletion" % (brick_server, brick_path)) g.log.info( 'Custom attribute is not presented after delete ' 'from link on brick %s:%s', brick_server, brick_path) g.log.info('Directory - custom extended attribute validation getfattr,' ' setfattr is successful')