-
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: Remount filesystems after resizing them #19418
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -767,7 +767,31 @@ export function find_children_for_mount_point(client, mount_point, self) { | |
return children; | ||
} | ||
|
||
export function get_active_usage(client, path, top_action, child_action) { | ||
export function get_fstab_config_with_client(client, block, also_child_config) { | ||
let config = block.Configuration.find(c => c[0] == "fstab"); | ||
|
||
if (!config && also_child_config && client.blocks_crypto[block.path]) | ||
config = client.blocks_crypto[block.path]?.ChildConfiguration.find(c => c[0] == "fstab"); | ||
|
||
if (config && decode_filename(config[1].type.v) != "swap") { | ||
const mnt_opts = get_block_mntopts(config[1]).split(","); | ||
let dir = decode_filename(config[1].dir.v); | ||
let opts = mnt_opts | ||
.filter(function (s) { return s.indexOf("x-parent") !== 0 }) | ||
.join(","); | ||
const parents = mnt_opts | ||
.filter(function (s) { return s.indexOf("x-parent") === 0 }) | ||
.join(","); | ||
if (dir[0] != "/") | ||
dir = "/" + dir; | ||
if (opts == "defaults") | ||
opts = ""; | ||
return [config, dir, opts, parents]; | ||
} else | ||
return []; | ||
} | ||
|
||
export function get_active_usage(client, path, top_action, child_action, is_temporary) { | ||
function get_usage(usage, path, level) { | ||
const block = client.blocks[path]; | ||
const fsys = client.blocks_fsys[path]; | ||
|
@@ -791,6 +815,9 @@ export function get_active_usage(client, path, top_action, child_action) { | |
} | ||
|
||
function enter_unmount(block, location, is_top) { | ||
const [, mount_point] = get_fstab_config_with_client(client, block); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seeing that |
||
const has_fstab_entry = is_temporary && location == mount_point; | ||
|
||
for (const u of usage) { | ||
if (u.usage == 'mounted' && u.location == location) { | ||
if (is_top) { | ||
|
@@ -805,8 +832,9 @@ export function get_active_usage(client, path, top_action, child_action) { | |
block, | ||
usage: 'mounted', | ||
location, | ||
set_noauto: !is_top, | ||
actions: is_top ? get_actions(_("unmount")) : [_("unmount")], | ||
has_fstab_entry, | ||
set_noauto: !is_top && !is_temporary, | ||
actions: (is_top ? get_actions(_("unmount")) : [_("unmount")]).concat(has_fstab_entry ? [_("mount")] : []), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This added line is not executed by any test. Details |
||
blocking: false | ||
}); | ||
} | ||
|
@@ -967,6 +995,15 @@ export function teardown_active_usage(client, usage) { | |
)); | ||
} | ||
|
||
export async function undo_temporary_teardown(client, usage) { | ||
for (let i = usage.length - 1; i >= 0; i--) { | ||
const u = usage[i]; | ||
if (u.usage == "mounted" && u.has_fstab_entry) { | ||
await client.mount_at(u.block, u.location); | ||
} | ||
} | ||
} | ||
|
||
// TODO - generalize this to arbitrary number of arguments (when needed) | ||
export function fmt_to_array(fmt, arg) { | ||
const index = fmt.indexOf("$0"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,9 +78,6 @@ class TestStorageResize(storagelib.StorageCase): | |
self.dialog_apply() | ||
self.dialog_wait_close() | ||
self.content_tab_wait_in_info(1, 1, "Size", "398 MB") | ||
if grow_needs_unmount: | ||
self.content_row_action(fsys_row, "Mount") | ||
self.confirm() | ||
with b.wait_timeout(30): | ||
self.wait_mounted(fsys_row, fsys_tab) | ||
size = int(m.execute("df -k --output=size /run/foo | tail -1").strip()) | ||
|
@@ -100,10 +97,7 @@ class TestStorageResize(storagelib.StorageCase): | |
self.dialog_apply() | ||
self.dialog_wait_close() | ||
self.content_tab_wait_in_info(1, 1, "Size", "201 MB") | ||
if shrink_needs_unmount: | ||
self.content_row_action(fsys_row, "Mount") | ||
self.confirm() | ||
self.wait_mounted(fsys_row, fsys_tab) | ||
self.wait_mounted(fsys_row, fsys_tab) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally we verify that the mount options are the same? |
||
size = int(m.execute("df -k --output=size /run/foo | tail -1").strip()) | ||
self.assertLess(size, 300000) | ||
else: | ||
|
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