Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage: Grow Stratis blockdevs #19079

Merged

Conversation

mvollmer
Copy link
Member

@mvollmer mvollmer commented Jul 6, 2023

Demo: https://youtu.be/IvwnqFjhMXw


Storage: Support for growing block devices of a Stratis pool

Cockpit can now grow logical volumes that are used as block devices in a Stratis pool. Also, if a Stratis block device grows for any reason, Cockpit will notify you about this and can extend the pool to use all of it.

image

@mvollmer mvollmer force-pushed the storage-stratis-grow-blockdevs branch from a02880a to 4d66d1a Compare July 6, 2023 13:35
@mvollmer mvollmer added the no-test For doc/workflow changes, or experiments which don't need a full CI run, label Jul 7, 2023
@mvollmer mvollmer force-pushed the storage-stratis-grow-blockdevs branch 2 times, most recently from 1232dad to 5b4a3bf Compare July 7, 2023 12:07
@mvollmer mvollmer force-pushed the storage-stratis-grow-blockdevs branch 2 times, most recently from a958246 to ace1a34 Compare August 11, 2023 11:59
@mvollmer mvollmer removed the no-test For doc/workflow changes, or experiments which don't need a full CI run, label Aug 11, 2023
@mvollmer mvollmer marked this pull request as ready for review August 11, 2023 11:59
@mvollmer mvollmer force-pushed the storage-stratis-grow-blockdevs branch from ace1a34 to 0b7a383 Compare August 11, 2023 12:08
@martinpitt
Copy link
Member

Tests still need work. The coverage complaints above also point out some test gaps. Moving to draft for now to clean up the PR review list. Thanks!

@martinpitt martinpitt marked this pull request as draft August 23, 2023 03:03
@mvollmer mvollmer force-pushed the storage-stratis-grow-blockdevs branch from 0b7a383 to a429377 Compare August 23, 2023 09:05
@mvollmer
Copy link
Member Author

Tests still need work. The coverage complaints above also point out some test gaps.

What do you have in mind concretely?

@@ -110,6 +114,14 @@ function lvol_and_fsys_resize(client, lvol, size, offline, passphrase) {
return Promise.reject(_("VDO backing devices can not be made smaller"));
else
return Promise.resolve();
} else if (stratis_bdev) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage of if statements is weird. The lines after the if (the consequent) are executed, so I don't know how the if itself is not executed. We might want filter them all out, like we do with else lines.

Comment on lines 121 to 123
} else if (size - crypto_overhead < Number(stratis_bdev.TotalPhysicalSize))
return Promise.reject(_("Stratis blockdevs can not be made smaller"));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a safe-guard and is not normally triggerable from the UI.

return;

for (const p in client.stratis_pools) {
const blockdevs = client.stratis_pool_blockdevs[p] || [];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The safety fallback || [] is not executed, but that doesn't normally trigger.

@@ -185,9 +197,28 @@ export const StratisPoolDetails = ({ client, pool }) => {
pool.ClevisInfo[0] && // pool has consistent clevis config
(!pool.ClevisInfo[1][0] || pool.ClevisInfo[1][1][0] == "tang")); // not bound or bound to "tang"
const tang_url = can_tang && pool.ClevisInfo[1][0] ? JSON.parse(pool.ClevisInfo[1][1][1]).url : null;
const blockdevs = client.stratis_pool_blockdevs[pool.path] || [];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

safety fallback

@@ -185,6 +197,13 @@ function get_resize_info(client, block, to_fit) {
grow_excuse = cockpit.format(_("$0 filesystems can not be made larger."),
block.IdType);
}
} else if (client.blocks_stratis_blockdev[block.path] && client.features.stratis_grow_blockdevs) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if wonkiness

@@ -331,6 +350,10 @@ function lvol_shrink(client, lvol, info, to_fit) {
if (vdo)
shrink_size = vdo.physical_size + crypto_overhead;

const stratis_bdev = client.blocks_stratis_blockdev[content_path];
if (stratis_bdev)
shrink_size = Number(stratis_bdev.TotalPhysicalSize) + crypto_overhead;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could try to get this.

@mvollmer mvollmer force-pushed the storage-stratis-grow-blockdevs branch from a429377 to b1db542 Compare August 23, 2023 10:37
@@ -185,10 +197,29 @@ export const StratisPoolDetails = ({ client, pool }) => {
pool.ClevisInfo[0] && // pool has consistent clevis config
(!pool.ClevisInfo[1][0] || pool.ClevisInfo[1][1][0] == "tang")); // not bound or bound to "tang"
const tang_url = can_tang && pool.ClevisInfo[1][0] ? JSON.parse(pool.ClevisInfo[1][1][1]).url : null;
const blockdevs = client.stratis_pool_blockdevs[pool.path] || [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For such belt-and-suspenders code paths you could add a // not-covered: OS error or something similar?

@mvollmer
Copy link
Member Author

For such belt-and-suspenders code paths you could add a // not-covered: OS error or something similar?

TBH, I'd rather ignore the complaints here than annotate the code... The machinery will shut up about this until we change the line again, and I'd say we actually want it to shout at us when we change the line, instead remaining silent because of a annotation that might be incorrect now. shrug

@mvollmer mvollmer added the blocked Don't land until something else happens first (see task list) label Aug 23, 2023
@mvollmer mvollmer removed the blocked Don't land until something else happens first (see task list) label Aug 24, 2023
@mvollmer mvollmer force-pushed the storage-stratis-grow-blockdevs branch from f05215f to b242f4c Compare August 24, 2023 11:40
@mvollmer mvollmer marked this pull request as ready for review August 24, 2023 11:40
Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'm almost happy with this. Nice demo video, too!

pkg/storaged/lvol-tabs.jsx Outdated Show resolved Hide resolved
@@ -185,6 +197,13 @@ function get_resize_info(client, block, to_fit) {
grow_excuse = cockpit.format(_("$0 filesystems can not be made larger."),
block.IdType);
}
} else if (client.blocks_stratis_blockdev[block.path] && client.features.stratis_grow_blockdevs) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do understand this one -- on Fedora 38, the stratis_grow_blockdevs flag is always True, so it complains about not exercising the "false" path?

for (const p in client.stratis_pools) {
const blockdevs = client.stratis_pool_blockdevs[p] || [];
if (blockdevs.some(bd => bd.NewPhysicalSize[0] && Number(bd.NewPhysicalSize[1]) > Number(bd.TotalPhysicalSize)))
enter_warning(p, { warning: "unused-blockdevs" });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's that magic string? It's not in main, and it doesn't appear anywhere else in this patch. Do you perhaps mean "unused-space"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exact string doesn't matter, this is just to get a warning triangle next to the pool in the "Devices" panel on the Overview.

test/verify/check-storage-stratis Show resolved Hide resolved
test/verify/check-storage-stratis Show resolved Hide resolved
test/verify/check-storage-stratis Show resolved Hide resolved
test/verify/check-storage-stratis Show resolved Hide resolved
@mvollmer mvollmer force-pushed the storage-stratis-grow-blockdevs branch from b242f4c to fda8c7c Compare August 25, 2023 08:20
@martinpitt
Copy link
Member

martinpitt commented Aug 25, 2023

oh uh, new bug found?

same error on rhel 9, so not just a glitch.

@martinpitt
Copy link
Member

unrelated flake, probably due to the sync package loading that @allisonkarlitskaya and I want to address ASAP.

martinpitt
martinpitt previously approved these changes Aug 25, 2023
Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'll let you land this, especially wrt. coordination with #19238 . I suggest to land that other one first, unless you are sure they won't conflict.

Just like we already did for filesystems and VDO.
The dialogs do this already, so let the buttons and menu items do it
as well.  This helps with naughty patterns.
@@ -110,6 +114,15 @@ function lvol_and_fsys_resize(client, lvol, size, offline, passphrase) {
return Promise.reject(_("VDO backing devices can not be made smaller"));
else
return Promise.resolve();
} else if (stratis_bdev) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added line is not executed by any test. Details

const pool = client.stratis_pools[stratis_bdev.Pool];
return pool.GrowPhysicalDevice(stratis_bdev.Uuid).then(std_reply);
} else if (delta < 0)
return Promise.reject(_("Stratis blockdevs can not be made smaller"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added line is not executed by any test. Details

@@ -185,6 +198,13 @@
grow_excuse = cockpit.format(_("$0 filesystems can not be made larger."),
block.IdType);
}
} else if (client.blocks_stratis_blockdev[block.path] && client.features.stratis_grow_blockdevs) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added line is not executed by any test. Details

return;

for (const p in client.stratis_pools) {
const blockdevs = client.stratis_pool_blockdevs[p] || [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added line is not executed by any test. Details

@@ -621,9 +633,28 @@
pool.ClevisInfo[0] && // pool has consistent clevis config
(!pool.ClevisInfo[1][0] || pool.ClevisInfo[1][1][0] == "tang")); // not bound or bound to "tang"
const tang_url = can_tang && pool.ClevisInfo[1][0] ? JSON.parse(pool.ClevisInfo[1][1][1]).url : null;
const blockdevs = client.stratis_pool_blockdevs[pool.path] || [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added line is not executed by any test. Details

@mvollmer mvollmer merged commit 93f6974 into cockpit-project:main Aug 25, 2023
92 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants