-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
storage: Grow Stratis blockdevs #19079
Conversation
a02880a
to
4d66d1a
Compare
1232dad
to
5b4a3bf
Compare
a958246
to
ace1a34
Compare
ace1a34
to
0b7a383
Compare
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! |
0b7a383
to
a429377
Compare
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) { |
There was a problem hiding this comment.
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.
pkg/storaged/lvol-tabs.jsx
Outdated
} else if (size - crypto_overhead < Number(stratis_bdev.TotalPhysicalSize)) | ||
return Promise.reject(_("Stratis blockdevs can not be made smaller")); |
There was a problem hiding this comment.
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] || []; |
There was a problem hiding this comment.
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] || []; |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
a429377
to
b1db542
Compare
@@ -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] || []; |
There was a problem hiding this comment.
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?
b1db542
to
f05215f
Compare
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 |
f05215f
to
b242f4c
Compare
There was a problem hiding this 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!
@@ -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) { |
There was a problem hiding this comment.
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" }); |
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
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.
b242f4c
to
fda8c7c
Compare
oh uh, new bug found? same error on rhel 9, so not just a glitch. |
unrelated flake, probably due to the sync package loading that @allisonkarlitskaya and I want to address ASAP. |
There was a problem hiding this 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.
fda8c7c
to
2df3b91
Compare
@@ -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) { |
There was a problem hiding this comment.
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")); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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] || []; |
There was a problem hiding this comment.
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] || []; |
There was a problem hiding this comment.
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
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.