Version 7 (modified by fabaff, 13 years ago) (diff) |
---|
Bcfg2FS
The Bcfg2 Filesystem (Bcfg2FS) is the attempt to use a Fuse filesystem to browse the XML files of the bundles, the groups, and the clients.
bcfg2-admin bundle list-xml and bcfg2-admin bundle show only provide a simple and limited interface to the content of XML bundle files. As mentioned in ticket #638 the usage of a Fuse filesystem may be more intuitive than bcfg2-admin/bcfg2-info for some cases.
This page is the place for the documentation of the Bcfg2FS development. Maybe this page will become a tutorial as well.
Requirements
- fuse-python
- a mount point (e.g. in /tmp)
Design
The start will be with the bundles (perhaps the new part can be called bcfg2-admin bundle browse). Bundles are a bit different than the other XML files like client.xml or group.xml because every bundle has its own XML file.
All bundles are store in the /var/lib/bcfg2/Bundler/ directory.
- XML files : /var/lib/bcfg2/Bundler/*.xml
- gensh files: /var/lib/bcfg2/Bundler/*.genshi
A simple bundle file can look like this :
<Bundle name='motd' version='2.0'> <ConfigFile name='/etc/motd' /> </Bundle>
There are other configuration entries? available.
The idea is to put all data out of the XML files in a dictionary. This should give us enough flexibility to build the directory tree.
bundles = { 'Bundle name' : {'ConfigFile' : ('/path/to/file'), '/path/to/file'), 'Package' : ('bundle package 1', 'bundle package 2')}, 'Bundle name' : {'Service' : ('serviced'), 'Package' : ('bundle package''), 'Action' : ('action1', 'action2')} }
A possible structure for the directory tree could look like the example below.
|-- Bundle 1 | |-- ConfigFile | | `-- config file 1 | |-- Service | | `-- service 1 | `-- Package | |-- package 1 | `-- package 2 |-- Bundle 2 `-- ...
Implementation
Basically a FUSE file system needs of have three functions.
- init - Starts the file system and grabs the file in the Bundler/ directory
- getattr - Passes back the attributes of a file (at the moment not needed)
- readdir - Is needed to use ls
Usage
You need to make a directory with mkdir [mountpoint] first.
$ python bcfg2fs.py [mountpoint]
Now you can change to the FUSE file system.
$ cd [mountpoint]
Use ls to browse the directory.
$ ls
When you are done, unmount the FUSE directory.
fusemount -u [mountpoint]
Source
The source of Bcfg2FS is available in its own git repository. When Bcfg2FS is ready, everything will be integrated in the source of Bcfg2 and be available through the official Bcfg2 Subversion repository.
git clone git://gitorious.org/bcfg2-fuse/bcfg2-fuse.git
Status
- 2010-06-14 - The first step is done. The creation of a directory structure of available bundles is working.
- 2010-06-22 - Source is online.
ToDo
Make the source available-> http://gitorious.org/bcfg2-fuse- Implement all parts of bcfg2-admin
- Start with documentation
More information
- Filesystem in Userspace
- Wikipedia article about Fuse
- FUSE Python tutorial
- Simple Filesystem Howto
Don't except a miracle in the next weeks. This is my (Fabian Affolter) spare time project. If you have any questions, further ideas, comments, or want to help, please use the Bcfg2 mailing list or the #bcfg2 channel on chat.freenode.net.