Status
- gvinum 'rename' -- support for renaming drives, volumes, plexes, and subdisks, including recursive renaming when applicable: finished
- gvinum 'move' -- support for moving subdisks: finished
- man page -- documents supported verbs, usage; finished
- example configuration files -- finished
- miscellany -- gvinum 'help' now lists only supported verbs
- handbook section -- in progress, extra to project scope; ETA uncertain
release at http://www.ualberta.ca/~cdjones/geom_vinum_move_rename.tgz, instructions included
Proposal
Gvinum 'move', 'rename'
With the releases of FreeBSD 5.3 and 5.4, FreeBSD has been moving away from "old-style" vinum towards GEOM-enabled gvinum for logical volume management. While gvinum is a mostly feature-complete replacement for vinum, it does not implement the 'move' or 'rename' verbs which are rather useful when reorganizing one's volume layout, the alternative being a tedious process of deleting and recreating subdisks, plexes, or volumes. Additionally, gvinum is nearly completely undocumented, which contributes to the perception of gvinum as an unfinished project. I propose to implement 'move' and 'rename', and to contribute documentation including at least a manual page and example configuration files, and (if time permits) an updated version of the FreeBSD Handbook sections on vinum.
I expect to take about one to two weeks (budgeting 10 to 15 hours per week) to understand the internals of gvinum and the vinum GEOM class, following which I expect implementing 'move' and 'rename' to be relatively straightforward --- probably a matter of another week or two. At this point, documenting gvinum can start and run in parallel with releasing the updated source code for testing by other users and fixing reported bugs. I expect to have completed the code, man page, and configuration files by approximately August 15th.
Preliminary Timeline
- Come up to speed on Perforce (by 9 July, in progress)
- Annotate and understand gvinum source (by 9 July, in progress)
- Preliminary plan (indicating what calls will be necessary, etc.) for implementing 'move', 'rename' (by 12 July)
- Commentary by {le, phk} and revised plan (by 16 July)
- gvinum 'move', 'rename' stubs in place and taking arguments (by 19 July)
- outline of new handbook section (by 23 July, start with current s. 17 ?)
- gvinum 'move', 'rename' implemented and working on test machine (by 30 July)
- gvinum(8) man page draft (by 30 July, start with vinum(8) ?)
- Commentary by {le, phk} on 'move', 'rename' code and man page draft (by 3 August)
- gvinum 'move', 'rename' code revisions as needed (by 6 August)
- gvinum 'move', 'rename' code available for testing by guinea pigs (by 8 August)
- gvinum(8) man page and example config files complete (by 8 August)
- gvinum handbook section draft complete (by 13 August)
- gvinum handbook section 2nd draft complete (by 20 August)
- gvinum 'move', 'rename' code revisions based on guinea pig comments / bugs (by 22 August)
- gvinum handbook section complete (by 25 August)
Technical Plan
Userland
* Add 'gvinum_rename', 'gvinum_move' functions to sbin/gvinum/gvinum.c
- Add hooks in 'parseline' to call _rename, _move
- Add NOPs for _rename, _move
- _move
- (NOTE: arguments really should be 'src ... dst' for /bin/mv
- compatibility)
- Identify -f flag, drive, object(s) from argv
- Do sanity checks (is object already on drive?) [kernel-side]
- Check whether there's free space [kernel-side]
- Instantiate a new object on target drive [kernel-side]
- Copy, verify, remove original object [kernel-side]
- (* --- extension to vinum; vinum destroyed old subdisk data)
- (NOTE: arguments really should be 'src ... dst' for /bin/mv
req = gctl_get_handle(); gctl_ro_param(req, "class", -1, "VINUM"); gctl_ro_param(req, "verb", -1, "move"); gctl_ro_param(req, "cmd", -1, "move" | "mv"); gctl_ro_param(req, "argc", sizeof(int), &argc); gctl_ro_param(req, "flags", sizeof(int), &flags); gctl_ro_param(req, "argvX", ...); gctl_ro_param(req, "destination", -1, drive name); gctl_ro_param(req, "objectX", -1, objectX name); ... gctl_issue(req); ... error handling gctl_free(req); return;
- _rename
- Identify -r flag, object, new name from argv
- Rename object (call 'move' verb)
- Recurse over descendants if applicable
req = gctl_get_handle(); gctl_ro_param(req, "class", -1, "VINUM"); gctl_ro_param(req, "verb", -1, "rename"); gctl_ro_param(req, "cmd", -1, "rename"); gctl_ro_param(req, "argc", sizeof(int), &argc); gctl_ro_param(req, "flags", sizeof(int), &flags); gctl_ro_param(req, "argvX", ... argvX ...); gctl_ro_param(req, "object", -1, argv[..]); gctl_ro_param(req, "newname", -1, argv[..]); gctl_issue(req); ... error handling gctl_free(req); return;
Kernel
* Add hooks for 'rename', 'move' verbs in
- sys/geom/vinum/geom_vinum.c:gv_config
* Add 'rename' verb to VINUM GEOM class
- use 'object' and 'newname' as verb arguments
- int gv_rename(struct g_geom *, struct gctl_req *)
- Find object (drive, vol, plex, sd) [gv_object_type]
- Get {drive, volume, plex, sd} struct pointer
Change name by twiddling ->name
- Fix up references in other structures
for gv_drive: FOREACH subdisks, fix ->drive
for gv_plex: FOREACH subsdisks, fix ->plex
- Commit config to disk
* Add 'move' verb to VINUM GEOM class
- use 'target', 'objectX' as verb arguments
- int gv_move(struct g_geom *, struct gctl_req *)
- Find target, verify that it's a drive
- Find object(s)
- If drive, get list of drive's subdisks
- If plex, get list of plex's subdisks
- Check that sd(s) don't already belong to target drive
- gv_sd_to_drive
- How to copy data from old sd(s) to new? gv_sync maybe?
- Fix up references?
- Commit config to disk