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: Don't warn about missing bitmap when MDRAID has a journal #20404

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion pkg/storaged/mdraid/mdraid.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,19 @@ function add_disk(mdraid) {
}

function missing_bitmap(mdraid) {
let policy;
if (mdraid.ConsistencyPolicy)
policy = mdraid.ConsistencyPolicy;
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.

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 expected.

else if (mdraid.ActiveDevices.some(a => a[2].indexOf("journal") >= 0))
policy = "journal";
else if (mdraid.BitmapLocation && decode_filename(mdraid.BitmapLocation) != "none")
policy = "bitmap";
else
policy = "resync";

return (mdraid.Level != "raid0" &&
client.mdraids_members[mdraid.path].some(m => m.Size > 100 * 1024 * 1024 * 1024) &&
mdraid.BitmapLocation && decode_filename(mdraid.BitmapLocation) == "none");
policy == "resync");
}

export function make_mdraid_page(parent, mdraid) {
Expand Down
35 changes: 32 additions & 3 deletions test/verify/check-storage-mdraid
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,16 @@ class TestStorageMdRaid(storagelib.StorageCase):

self.login_and_go("/storage")

# Make two huge block devices, so that we can make a array
# Make three huge block devices, so that we can make an array
# that is beyond the threshold where Cockpit and mdadm start
# to worry about bitmaps. The backing files are sparse, so
# this is okay as long nobody actually writes a lot to these
# devices.
# this is okay as long as nobody actually writes a lot to
# these devices. (The fourth is used for a journal.)

dev1 = self.add_loopback_disk(110000)
dev2 = self.add_loopback_disk(110000)
dev3 = self.add_loopback_disk(110000)
dev4 = self.add_loopback_disk(100)

# We need to use "--assume-clean" so that mdraid doesn't try
# to write 110GB to one of the devices during synchronization.
Expand All @@ -349,15 +351,42 @@ class TestStorageMdRaid(storagelib.StorageCase):
self.wait_states({dev1: "In sync",
dev2: "In sync"})

# There should be a bitmap, and cockpit should not complain

self.assertIn("Consistency Policy : bitmap", m.execute("mdadm --misc -D /dev/md/md0"))
b.wait_not_present('.pf-v5-c-alert:contains("This MDRAID device has no write-intent bitmap")')

# Remove the bitmap, Cockpit should complain and let us put it back.

m.execute("mdadm --grow --bitmap=none /dev/md/md0; udevadm trigger /dev/md/md0")
self.assertNotIn("bitmap", m.execute("mdadm --misc -D /dev/md/md0"))

b.wait_visible('.pf-v5-c-alert:contains("This MDRAID device has no write-intent bitmap")')
b.click('button:contains("Add a bitmap")')
b.wait_not_present('.pf-v5-c-alert:contains("This MDRAID device has no write-intent bitmap")')
self.assertIn("Consistency Policy : bitmap", m.execute("mdadm --misc -D /dev/md/md0"))

# Delete the device and create a new one with a journal

self.click_card_dropdown("MDRAID device", "Delete")
self.confirm()
b.wait_visible(self.card("Storage"))
b.wait_not_present(self.card_row("Storage", name="/dev/md/raid0"))

m.execute(f"mdadm --create md1 --level=5 --assume-clean --run --raid-devices=3 {dev1} {dev2} {dev3} --write-journal {dev4}")
m.execute("udevadm trigger")

self.click_card_row("Storage", name="/dev/md/md1")

self.wait_states({dev1: "In sync",
dev2: "In sync",
dev3: "In sync",
dev4: "Unknown (journal)"})

# There should be no bitmap, and cockpit should not complain

self.assertNotIn("bitmap", m.execute("mdadm --misc -D /dev/md/md1"))
b.wait_not_present('.pf-v5-c-alert:contains("This MDRAID device has no write-intent bitmap")')


if __name__ == '__main__':
Expand Down