Commit Graph

57 Commits

Author SHA1 Message Date
Joshua Boniface 6ccd19e636 Standardize fuzzy matching and use fullmatch
Solves two problems:

1. How match fuzziness was used was very inconsistent; make them all the
same, i.e. "if is_fuzzy and limit, apply .* to both sides".

2. Use re.fullmatch instead of re.match to ensure exact matching of the
regex to the value. Without fuzziness, this would sometimes cause
inconsistent behavior, for instance if a limit was non-fuzzy "vm",
expecting to match the actual "vm", but also matching "vm1" too.
2021-12-06 16:35:29 -05:00
Joshua Boniface c41664d2da Reformat code with Black code formatter
Unify the code style along PEP and Black principles using the tool.
2021-11-06 03:02:43 -04:00
Joshua Boniface 65df807b09 Add support for configurable OSD DB ratios
The default of 0.05 (5%) is likely ideal in the initial implementation,
but allow this to be set explicitly for maximum flexibility in
space-constrained or performance-critical use-cases.
2021-09-24 01:06:39 -04:00
Joshua Boniface adc8a5a3bc Add separate OSD DB device support
Adds in three parts:

1. Create an API endpoint to create OSD DB volume groups on a device.
Passed through to the node via the same command pipeline as
creating/removing OSDs, and creates a volume group with a fixed name
(osd-db).

2. Adds API support for specifying whether or not to use this DB volume
group when creating a new OSD via the "ext_db" flag. Naming and sizing
is fixed for simplicity and based on Ceph recommendations (5% of OSD
size). The Zookeeper schema tracks the block device to use during
removal.

3. Adds CLI support for the new and modified API endpoints, as well as
displaying the block device and DB block device in the OSD list.

While I debated supporting adding a DB device to an existing OSD, in
practice this ended up being a very complex operation involving stopping
the OSD and setting some options, so this is not supported; this can be
specified during OSD creation only.

Closes #142
2021-09-23 13:59:49 -04:00
Joshua Boniface e71a6c90bf Add pool size check when resizing volumes
Closes #140
2021-09-12 19:54:51 -04:00
Joshua Boniface 73e8149cb0 Remove explicit image-features from rbd cmd
This should be managed in ceph.conf with the `rbd default
features` configuration option instead, and thus can be tailored to the
underlying OS version.
2021-07-30 11:33:59 -04:00
Joshua Boniface 4a7246b8c0 Ensure RBD resize has bytes appended
If this isn't, the resize will be interpreted as a MB value and result
in an absurdly big volume instead. This is the same consistency
validation that occurs on add.
2021-07-30 11:25:13 -04:00
Joshua Boniface c49351469b Revert "Ensure consistent sizing of volumes"
This reverts commit dc03e95bbf.
2021-07-29 15:30:00 -04:00
Joshua Boniface dc03e95bbf Ensure consistent sizing of volumes
Convert from human to bytes, then to megabytes and always pass this to
the RBD command. This ensures consistency regardless of what is actually
passed by the user.
2021-07-29 15:14:25 -04:00
Joshua Boniface 43009486ae Move Ceph pool/volume list assembly to thread pool
Same reasons as the VM list, though less impactful.
2021-07-01 17:33:13 -04:00
Joshua Boniface 20c773413c Fix bug in snapshot rename 2021-06-14 00:55:26 -04:00
Joshua Boniface 3013973975 Fix bad schema names 2021-06-13 20:32:41 -04:00
Joshua Boniface 6d00ec07b5 Convert ceph.py to new ZK schema handler 2021-06-12 17:09:29 -04:00
Joshua Boniface 33a54cf7f2 Move configuration keys to /config tree 2021-06-01 10:48:55 -04:00
Joshua Boniface 688d1a6ae2 Rework ceph library for new zkhandler 2021-05-29 20:29:51 -04:00
Joshua Boniface 0bf276fd51 Update copyright year in headers 2021-03-25 17:01:55 -04:00
Joshua Boniface f4ec161aa2 Update file copyright header.
Remove the option to select a later version of the GPL.
2021-03-25 16:58:02 -04:00
Joshua Boniface 8c4c1aba38 Revert "Add object-map to default RBD volume features"
This reverts commit 00e9cca6f0.

This causes RBD mapping to fail on Debian 10. Reverting but keeping in
history for future reference.
2021-02-28 01:57:30 -05:00
Joshua Boniface 00e9cca6f0 Add object-map to default RBD volume features
This allows for much quicker image deletes especially for empty images.
2021-02-17 13:57:28 -05:00
Joshua Boniface ab05e0f3db Add B suffix back to bare bytes values 2021-02-17 11:37:36 -05:00
Joshua Boniface 9291ce6ffc Correct output of fromhuman and add size compare
Ensures that the bytes_tohuman returns an integer to avoid the hacky
workaround of stripping off the B.

Adds a verification on the size of a new volume, that it is not larger
than the free space of the pool to prevent errors/excessively-large
volumes from being created.

Closes #120
2021-02-17 11:27:26 -05:00
Joshua Boniface 0e4bece441 Add missing inc/dec of snapshot_count 2021-02-14 17:02:49 -05:00
Joshua Boniface b33c0ab0e2 Final final fix to snapshot ordering 2021-02-14 16:48:42 -05:00
Joshua Boniface 150c61d226 Actually fix sorting issue 2021-02-14 16:41:59 -05:00
Joshua Boniface 26b0a8b5c1 Fix sorting bug with snapshot list 2021-02-14 16:34:43 -05:00
Joshua Boniface 593810e53e Add volume_count to pool API data 2020-12-01 03:40:41 -05:00
Joshua Boniface 0bf130077c Lint: W605 invalid escape sequence '<char>'
The previous attempt to correct these with character classes failed.
Instead, use the proper `r'blah'` regex formatting.
2020-11-07 17:41:09 -05:00
Joshua Boniface 3ed97d209f Revert "Lint: W605 invalid escape sequence '\^'"
This reverts commit 639937f9c2.
2020-11-07 17:39:34 -05:00
Joshua Boniface f33398458e Revert "Lint: W605 invalid escape sequence '\$'"
This reverts commit 76b1cafdcc.
2020-11-07 17:38:03 -05:00
Joshua Boniface 78eedf0d2e Remove more dead code 2020-11-07 15:20:36 -05:00
Joshua Boniface 9dd2a24ce9 Lint: E226 missing whitespace around arithmetic operator 2020-11-07 14:50:57 -05:00
Joshua Boniface 260b39ebf2 Lint: E302 expected 2 blank lines, found X 2020-11-07 14:45:24 -05:00
Joshua Boniface 449f766a2c Lint: F821 undefined name 'zk_conn'
Actually removes these entire sections of dead code; the daemon-common
library does no formatting at all since it is no longer used by the CLI.
2020-11-07 13:45:26 -05:00
Joshua Boniface 145b1531a4 Lint: F821 undefined name 'name' 2020-11-07 13:38:16 -05:00
Joshua Boniface a4823bbb9c Lint: F821 undefined name 'volume' 2020-11-07 13:37:55 -05:00
Joshua Boniface 516e36686c Lint: F821 undefined name 'name' 2020-11-07 13:37:24 -05:00
Joshua Boniface dc1269ffc2 Lint: F821 undefined name 'new_name' 2020-11-07 13:36:56 -05:00
Joshua Boniface 146c969ef7 Lint: F821 undefined name 'logger' 2020-11-07 13:36:28 -05:00
Joshua Boniface 961ebb4c01 Lint: E305 expected 2 blank lines after class or function definition, found X 2020-11-07 13:17:49 -05:00
Joshua Boniface d2490419c5 Lint: E202 whitespace before ']' 2020-11-07 13:02:54 -05:00
Joshua Boniface b7daa8e1f6 E201 whitespace after '[' 2020-11-07 12:39:59 -05:00
Joshua Boniface 6ab261f4cb Lint: E251 unexpected spaces around keyword / parameter equals 2020-11-07 12:11:53 -05:00
Joshua Boniface 2d8f684fc8 Lint: E722 do not use bare 'except' (2) 2020-11-06 19:24:10 -05:00
Joshua Boniface ebf254f62d Lint: W293 blank line contains whitespace 2020-11-06 19:11:07 -05:00
Joshua Boniface 76b1cafdcc Lint: W605 invalid escape sequence '\$' 2020-11-06 19:01:22 -05:00
Joshua Boniface 639937f9c2 Lint: W605 invalid escape sequence '\^' 2020-11-06 18:59:30 -05:00
Joshua Boniface 5b5b7d2276 Improve the conditional so it will always work 2020-08-11 23:08:40 -04:00
Joshua Boniface 0468eeb531 Support live resizing of running disk volumes
This wasn't happening automatically, nor does it happen with qemu-img
commands, so we have to manually trigger a libvirt blockResize against
the volume. This setup is a little roundabout but seems to work fine.
2020-08-11 21:46:12 -04:00
Joshua Boniface 654a3cb7fa Improve debug output and use ceph df util data 2020-06-06 22:52:49 -04:00
Joshua Boniface fba39cb739 Fix broken sorting for pools and volumes 2020-06-06 21:28:54 -04:00