From 334d9c66b7cc86b525eb1df238392e83059d5ec4 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Fri, 7 Jun 2024 12:34:31 +0200 Subject: [PATCH] btrfs: show the origin of the snapshot in subvolume details --- pkg/storaged/btrfs/subvolume.jsx | 24 ++++++++++++++++++++++-- test/verify/check-storage-btrfs | 9 +++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/pkg/storaged/btrfs/subvolume.jsx b/pkg/storaged/btrfs/subvolume.jsx index 2dfdfa8bc82..affb6c8840a 100644 --- a/pkg/storaged/btrfs/subvolume.jsx +++ b/pkg/storaged/btrfs/subvolume.jsx @@ -20,6 +20,7 @@ import cockpit from "cockpit"; import React from "react"; +import { Button } from "@patternfly/react-core/dist/esm/components/Button/index.js"; import { Card, CardBody, CardHeader, CardTitle } from "@patternfly/react-core/dist/esm/components/Card/index.js"; import { DescriptionList } from "@patternfly/react-core/dist/esm/components/DescriptionList/index.js"; @@ -384,6 +385,16 @@ function make_btrfs_subvolume_page(parent, volume, subvol, path_prefix, subvols) return str; } + let snapshot_origin = null; + if (subvol.id !== 5 && subvol.parent_uuid !== null) { + for (const sv of subvols) { + if (sv.uuid === subvol.parent_uuid) { + snapshot_origin = sv; + break; + } + } + } + const card = new_card({ title: _("btrfs subvolume"), next: null, @@ -393,7 +404,7 @@ function make_btrfs_subvolume_page(parent, volume, subvol, path_prefix, subvols) location: mp_text, component: BtrfsSubvolumeCard, has_warning: !!mismount_warning, - props: { subvol, mount_point, mismount_warning, block, fstab_config, forced_options }, + props: { volume, subvol, snapshot_origin, mount_point, mismount_warning, block, fstab_config, forced_options }, actions, }); @@ -412,8 +423,9 @@ function make_btrfs_subvolume_page(parent, volume, subvol, path_prefix, subvols) } } -const BtrfsSubvolumeCard = ({ card, subvol, mismount_warning, block, fstab_config, forced_options }) => { +const BtrfsSubvolumeCard = ({ card, volume, subvol, snapshot_origin, mismount_warning, block, fstab_config, forced_options }) => { const crossrefs = get_crossrefs(subvol.uuid); + return ( + {snapshot_origin !== null && + + + + }