Project

General

Profile

Bug #42794

mgr/dashboard: align front-end and back-end validation with core Ceph types

Added by Ernesto Puerta about 1 year ago. Updated about 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
dashboard/general
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature:

Description

Currently we have validation in the front-end that it's stricter than core Ceph one.

As an example: for pool names we only allow [.A-Za-z0-9_/-] chars, that is, ASCII alphanum + some special chars (_/-). However, the type for Pool names in core Ceph is CephPoolname which turns out to be a Python str, essentially any utf-8 char:

$ ceph osd pool create 'hello world'
pool 'hello world' created

$ ceph osd pool create 'ñûôç'
pool 'ñûôç' created
That could happen also to other data types (RBD image names, snapshots, RGW users, etc.). In order to align this, there are different approaches available:
  • Manually creating Angular Custom Validators in the front-end aligned with the core Ceph types (src/pybind/ceph_argparse.py): CdValidators.cephPoolname.
  • Driving validation from the back-end. Being Python too, it might consume ceph_argparse.py types and automatically perform validation against actual core supported types. However, back-end driven validation (while necessary) results in a less responsive front-end behavior, even if that happens asynchronously in the background (data needs to go a round-trip).
  • The ultimate approach could be extract Ceph data types from ceph_argparse.py and use a cross-language data typing/model specification framework, like Json-schema. Json-schema validators are implemented for a lot of programmming languages (JS, Python, C++, Go...).
{
  "$id": "https://ceph.com/schemas/master/poolname.schema.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "CephPoolname",
  "type": "string",
  "pattern": "/...<whatever>.../" 
}

History

#1 Updated by Lenz Grimmer about 1 year ago

  • Tags set to refactoring

Also available in: Atom PDF