}
run_test 27K "basic ops on dir with foreign LMV"
+test_27L() {
+ remote_mds_nodsh && skip "remote MDS with nodsh"
+
+ local POOL=${POOL:-$TESTNAME}
+
+ if ! combined_mgs_mds ; then
+ mount_mgs_client
+ trap umount_mgs_client EXIT
+ fi
+
+ pool_add $POOL || error "pool_add failed"
+
+ lfs pool_list $MOUNT | grep -Fx "${FSNAME}.${POOL}" ||
+ error "pool_list does not contain ${FSNAME}.${POOL}:" \
+ "$(lfs pool_list $MOUNT | grep -F "${POOL}")"
+}
+run_test 27L "lfs pool_list gives correct pool name"
+
# createtest also checks that device nodes are created and
# then visible correctly (#2091)
test_28() { # bug 2091
int llapi_get_poollist(const char *name, char **poollist, int list_size,
char *buffer, int buffer_size)
{
- char rname[PATH_MAX];
glob_t pathname;
char *fsname;
- char *ptr;
- DIR *dir;
+ char *ptr;
+ DIR *dir;
struct dirent *pool;
- int rc = 0;
- unsigned int nb_entries = 0;
- unsigned int used = 0;
- unsigned int i;
+ int rc = 0;
+ unsigned int nb_entries = 0;
+ unsigned int used = 0;
+ unsigned int i;
/* initialize output array */
- for (i = 0; i < list_size; i++)
- poollist[i] = NULL;
-
- /* is name a pathname ? */
- ptr = strchr(name, '/');
- if (ptr != NULL) {
- /* only absolute pathname is supported */
- if (*name != '/')
- return -EINVAL;
+ for (i = 0; i < list_size; i++)
+ poollist[i] = NULL;
- if (!realpath(name, rname)) {
- rc = -errno;
- llapi_error(LLAPI_MSG_ERROR, rc, "invalid path '%s'",
- name);
- return rc;
- }
+ /* is name a pathname ? */
+ ptr = strchr(name, '/');
+ if (ptr != NULL) {
+ char fsname_buf[MAXNAMLEN];
- fsname = strdup(rname);
+ /* We will need fsname for printing later */
+ rc = llapi_getname(name, fsname_buf, sizeof(fsname_buf));
+ if (rc)
+ return rc;
+
+ ptr = strrchr(fsname_buf, '-');
+ if (ptr)
+ *ptr = '\0';
+
+ fsname = strdup(fsname_buf);
if (!fsname)
return -ENOMEM;
-
- rc = poolpath(&pathname, NULL, rname);
} else {
/* name is FSNAME */
fsname = strdup(name);
if (!fsname)
return -ENOMEM;
- rc = poolpath(&pathname, fsname, NULL);
}
+
+ rc = poolpath(&pathname, fsname, NULL);
if (rc != 0) {
llapi_error(LLAPI_MSG_ERROR, rc,
"Lustre filesystem '%s' not found", name);