Practical workshop for Config::Model
-------------------------------------------
Objevtive of this workshop:
- improve fstab model (MyFstab class) to support ext4
- open file fstab/MyFstab.pl with favorite text editor
This file contains a Perl data structure which describes
the MyFstab configuration class. Note that no backend are
specified. Read and write are handled in test script (old demo)
- open model graphical editor
$ config-model-edit -model MyFstab
- Open class Fs -> element -> fs -> type
cargo -> config_class_name
What do these parameters (type and cargo) mean?
Which class is to be explored next to better understand the structure
of /etc/fstab configuration?
- explore next class (MyFstab::FsLine)
MyFstab::FsLine -> element -> fs_vfstype -> type
value_type
choice
What are there choices ?
How are these choices connected with fstab(5) man page ?
- In MyFstab::FsLine, what is the element representing the mount options ?
- explore this element:
note the type: what does this mean ?
open follow item: f1 is a variable name. The value of this variable
is extracted from the tree using the path shown.
open rules:
* formula ($f1 eq 'ext3') is a test condition related to ext3
* When this condition is satisfied, the parameters associated with
this formula are applied. Look for applied parameter
- create new MyFstab::Ext4FsOpt
open class mentioned by the rule above with edit (or right-click)
select ext3 class
click on keep
replace 3 by 4
click copy
- open ext4 class -> element
- open mkfs.ext4 man page
* Note that ext4 features all ext3 and ext2 options
* look for 'extended_options' in this man page.
These are 3 integer and 2 booleans parameters
- Arrange Ext4 to offer all ext3 options
open MyFstab::Ext4Options -> include
set include to MyFstab::Ext3FsOpt
- create these elements:
* open/edit Ext4options->element
select journalling-mode click 'remove selected'
type 'stride' in entry click add, repeat for other elements
* open/edit stride
In type drop-down box, select 'leaf'
in value_type box, select integer
cut'n'paste description from man page, paste on 'description' item in tree,
in right part of window, click edit , cleanup, store (in tree)
* open/edit Ext4options->element
select stride
enter stripe-width -> copy
open/edit stripe-width -> description, click delete
cut'n'paste man page in value field, cleanup, store
- Now it's time to offer the relevant choice
open/edit class MyFstab::Fsline element fs_fstype choice
enter 'ext4' in entry beside 'push item'. click 'push item'
- And enter the relevant rules in fs_mntopts
open/edit class MyFstab::Fsline element fs_mntopts rules
select copy ext3 entry in ext4
(if modif does not show up (bug) -> close and open tree)
- In menu bar, click Model-> test
open fs -> empty, which is normal -> no fstab file is read
if problem with Model->test,
run 'config-edit -model MyFstab -model_dir lib/Config/Model/models'
- add a new file system to test ext4
* add a new label (suggests mount point): home
* open label
* set fs_spec to /dev/sda1
* set fs_file to /home
* fs_vfstype to ext4
Note the new available mount options, including the stripe parameter
(for ext4) and journalling_mode (ext3)
Remember: it's a demo, there's no code to write back fstab.. yet