From 236867f3a4fa6c0cbbba30e3a10163408d458d9f Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Tue, 8 Aug 2023 12:30:01 +0300 Subject: [PATCH 1/2] test: Use sparse files to back loopback devices Then we can make them very big, as long as we don't write to them too much. --- test/common/storagelib.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/common/storagelib.py b/test/common/storagelib.py index 7741c38836b..5f3810c9dc6 100644 --- a/test/common/storagelib.py +++ b/test/common/storagelib.py @@ -66,17 +66,22 @@ def add_loopback_disk(self, size=50, name=None): The disk gets removed automatically when the test ends. This is safe for @nondestructive tests. - Unlike add_ram_disk(), this can be called multiple times, and is less size constrained. - However, loopback devices look quite special to the OS, so they are not a very good - simulation of a "real" disk. + Unlike add_ram_disk(), this can be called multiple times, and + is less size constrained. The backing file starts out sparse, + so this can be used to create massive block devices, as long + as you are careful to not actually use much of it. + + However, loopback devices look quite special to the OS, so + they are not a very good simulation of a "real" disk. Return the device name. + """ # HACK: https://bugzilla.redhat.com/show_bug.cgi?id=1969408 # It would be nicer to remove $F immediately after the call to # losetup, but that will break some versions of lvm2. dev = self.machine.execute("F=$(mktemp /var/tmp/loop.XXXX); " - "dd if=/dev/zero of=$F bs=1000000 count=%s; " + "truncate --size=%sMB $F; " "losetup --show %s $F" % (size, name if name else "--find")).strip() # If this device had partions in its last incarnation on this # machine, they might come back for unknown reasons, in a From e162d2fb9fceca4d5e216d259e907ecb541a2a5f Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Thu, 6 Jul 2023 16:28:27 +0300 Subject: [PATCH 2/2] storage: Tell people that big mdraids really should have a bitmap --- pkg/storaged/mdraid-details.jsx | 42 +++++++++++++++----------------- test/verify/check-storage-mdraid | 38 +++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 22 deletions(-) diff --git a/pkg/storaged/mdraid-details.jsx b/pkg/storaged/mdraid-details.jsx index 217ebee882f..f0365e4009d 100644 --- a/pkg/storaged/mdraid-details.jsx +++ b/pkg/storaged/mdraid-details.jsx @@ -27,7 +27,7 @@ import * as utils from "./utils.js"; import { StdDetailsLayout } from "./details.jsx"; import { SidePanel } from "./side-panel.jsx"; import { Block } from "./content-views.jsx"; -import { StorageButton, StorageOnOff } from "./storage-controls.jsx"; +import { StorageButton } from "./storage-controls.jsx"; import { dialog_open, SelectSpaces, BlockingMessage, TeardownMessage, init_active_usage_processes @@ -180,23 +180,6 @@ export class MDRaidDetails extends React.Component { if (mdraid.ChunkSize > 0) level += ", " + cockpit.format(_("$0 chunk size"), utils.fmt_size(mdraid.ChunkSize)); - function toggle_bitmap(val) { - return mdraid.SetBitmapLocation(utils.encode_filename(val ? 'internal' : 'none'), {}); - } - - let bitmap = null; - if (mdraid.BitmapLocation) { - const value = utils.decode_filename(mdraid.BitmapLocation) != "none"; - bitmap = ( - - {_("storage", "Bitmap")} - - - - - ); - } - let degraded_message = null; if (mdraid.Degraded > 0) { const text = cockpit.format( @@ -208,6 +191,24 @@ export class MDRaidDetails extends React.Component { ); } + function fix_bitmap() { + return mdraid.SetBitmapLocation(utils.encode_filename("internal"), { }); + } + + let bitmap_message = null; + if (mdraid.Level != "raid0" && + client.mdraids_members[mdraid.path].some(m => m.Size > 100 * 1024 * 1024 * 1024) && + mdraid.BitmapLocation && utils.decode_filename(mdraid.BitmapLocation) == "none") { + bitmap_message = ( + +
+ {_("Add a bitmap")} +
+
+ ); + } + /* Older versions of Udisks/storaged don't have a Running property */ let running = mdraid.Running; if (running === undefined) @@ -338,9 +339,6 @@ export class MDRaidDetails extends React.Component { {_("storage", "RAID level")} { level } - - { bitmap } - {_("storage", "State")} { running ? _("Running") : _("Not running") } @@ -355,7 +353,7 @@ export class MDRaidDetails extends React.Component { const content = ; return