* < 0, error code on failre
*/
static int llapi_stripe_param_verify(const struct llapi_stripe_param *param,
- const char **pool_name)
+ const char **pool_name, char *fsname)
{
int count;
static int page_size;
"Invalid Poolname '%s'", *pool_name);
goto out;
}
+
+ /* Make sure the pool exists */
+ rc = llapi_search_ost(fsname, *pool_name, NULL);
+ if (rc < 0) {
+ llapi_error(LLAPI_MSG_ERROR, rc,
+ "pool '%s fsname %s' does not exist",
+ *pool_name, fsname);
+ rc = -EINVAL;
+ goto out;
+ }
}
out:
int llapi_file_open_param(const char *name, int flags, mode_t mode,
const struct llapi_stripe_param *param)
{
+ char fsname[MAX_OBD_NAME + 1] = { 0 };
struct lov_user_md *lum = NULL;
const char *pool_name = param->lsp_pool;
size_t lum_size;
int fd, rc;
+ /* Make sure we are on a Lustre file system */
+ rc = llapi_search_fsname(name, fsname);
+ if (rc) {
+ llapi_error(LLAPI_MSG_ERROR, rc,
+ "'%s' is not on a Lustre filesystem", name);
+ return rc;
+ }
+
/* Check if the stripe pattern is sane. */
- rc = llapi_stripe_param_verify(param, &pool_name);
- if (rc != 0)
+ rc = llapi_stripe_param_verify(param, &pool_name, fsname);
+ if (rc < 0)
return rc;
if (param->lsp_is_specific)