Commit Graph

12 Commits

Author SHA1 Message Date
Daniel Golle 3959a9b22c
uvol: unbreak if LVM is installed but unused
Fix and simplify console output, make sure uvol doesn't break in case
of LVM being installed but not used.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-04-13 18:01:49 +01:00
Daniel Golle 31f02d5c1e
uvol: yet another small compatibility hack
Shift ARGV until actual parameters start to compensate for older
versions of ucode passing the complete cmdline.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-04-04 11:58:37 +01:00
Daniel Golle 74caff0d59
uvol: fixes and adapt to in-tree ucode
Don't use features which are not yet present in the version of ucode
currently shipped with OpenWrt (such as `fs.access()` or assuming raw
mode by default).
Fix syntax error in main executable.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-04-04 11:29:12 +01:00
Daniel Golle 22d202e3a5
uvol: unbreak build and adapt to updated ucode
* Fix build which was broken by a wrong path in the Makefile.

Adapt to ucode commit 4618807 ("main: rework CLI frontend"):
 * ucode now no longer needs the {% %} around each code file, remove
   that and safe one level of indentation.
 * ARGV now no longer includes ucode executable and script itself

Fixes: 6350c7bc6 ("uvol: replace with re-write in ucode")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-03-31 22:28:27 +01:00
Daniel Golle 6350c7bc63
uvol: replace with re-write in ucode
Replace previous Shell draft-quality implementation of uvol with a
rewrite in ucode[1].
While the new code is slightly larger, it performs much better (as
we no longer fork() for parsing strings like in Shell with grep, sed
and friends).

Before:
  time uvol list -j
  [ ... ]
  real	0m 0.82s
  user	0m 0.13s
  sys	0m 0.10s

After:
  time uvol list -j
  [ ... ]
  real	0m 0.47s
  user	0m 0.05s
  sys	0m 0.05s

[1]: https://github.com/jow-/ucode
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-03-31 18:45:22 +01:00
Daniel Golle 194e7f0286
uvol: fix units with lvm backend
Free and total bytes are now properly returned as bytes by LVM2 as
requested. No longer multiply values.
Fix parameter order of 'create' command in usage output while at it.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-07-06 05:27:13 +01:00
Daniel Golle c7d1704feb uvol: try to be more shellcheck compliant, fix LVM vol-up
* quotes around all variables
 * always use 'read -r' instead of 'read'
 * some more minor shellcheck fixes
 * reorder LVM ops for 'up' call to allow it to succeed

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-06-13 22:14:20 +01:00
Daniel Golle 816c41b6fc
uvol: fix emmitting ubus event when removing UBI volume
In case a volume which is down is removed, no ubus event needs to be
fired. Don't try.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-26 19:21:50 +01:00
Daniel Golle fc01307d7a
uvol: emmit ubus events and bring up volumes on boot
Emmit ubus events when volumes come up/down.
Make sure volume state is always well defined by introducing
additional state 'write-prepare' (wp) during mkfs.
Add init scripts to bring up volumes at boot.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-18 00:41:35 +01:00
Daniel Golle 3d4d75c519
uvol: make volume creation atomic
Make sure filesystem is ready when volume becomes available.
Use 'write-once' as initial state for read-only volumes, only allow
writing to volumes in that state and transision to 'read-only' once
write has completed.
Also fix a typo which prevented 'list' command from working with LVM.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-15 02:55:10 +01:00
Daniel Golle a4b034cf68
uvol: some improvements
* use lvm --reportformat json
 * add 'list' and 'align' commands
 * add help output

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-11 01:42:58 +01:00
Daniel Golle 312594f869
uvol: add new package
uvol is a wrapper-script which allows automated handling of storage
volumes. uvol currently comes with backend support for LVM2 and UBI,
covering practically all options for storage large enough to be
managed (NAND, SPI-NAND, eMMC, SATA, NVME, virtio-blk, ...).

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-10 12:02:23 +01:00