mdraid: Expose "consistency_policy" sysfs value

(cherry picked from commit 69546428bb14cdc8c90bbec33efcf99b6be1aa53)
This commit is contained in:
fandeyuan 2024-06-12 10:36:41 +08:00 committed by openeuler-sync-bot
parent 7acab4dc7b
commit d1dd1c6f85
2 changed files with 78 additions and 1 deletions

View File

@ -0,0 +1,72 @@
From d33d1dda277a78dcf63574c567ca24d7c3462f49 Mon Sep 17 00:00:00 2001
From: Marius Vollmer <mvollmer@redhat.com>
Date: Tue, 30 Apr 2024 14:39:13 +0300
Subject: [PATCH] mdraid: Expose "consistency_policy" sysfs value
---
data/org.freedesktop.UDisks2.xml | 12 ++++++++++++
src/udiskslinuxmdraid.c | 4 ++++
2 files changed, 16 insertions(+)
diff --git a/data/org.freedesktop.UDisks2.xml b/data/org.freedesktop.UDisks2.xml
index 53194c7..5d34901 100644
--- a/data/org.freedesktop.UDisks2.xml
+++ b/data/org.freedesktop.UDisks2.xml
@@ -3137,6 +3137,18 @@
-->
<property name="Degraded" type="u" access="read"/>
+ <!-- ConsistencyPolicy:
+ @since: 2.11.0
+ The consistency policy of the array.
+
+ If the RAID array does not support consistency policies (for
+ example RAID-0 arrays), this is empty.
+
+ This property corresponds to the
+ <literal>consistency_policy</literal> sysfs file.
+ -->
+ <property name="ConsistencyPolicy" type="s" access="read"/>
+
<!-- BitmapLocation:
The location of a write-intent bitmap (empty if the array is not running), if any.
diff --git a/src/udiskslinuxmdraid.c b/src/udiskslinuxmdraid.c
index 900cd65..46ee77e 100644
--- a/src/udiskslinuxmdraid.c
+++ b/src/udiskslinuxmdraid.c
@@ -237,6 +237,7 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid,
const gchar *name = NULL;
gchar *sync_action = NULL;
gchar *sync_completed = NULL;
+ gchar *consistency_policy = NULL;
gchar *bitmap_location = NULL;
guint degraded = 0;
guint64 chunk_size = 0;
@@ -316,6 +317,7 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid,
degraded = udisks_linux_device_read_sysfs_attr_as_int (raid_device, "md/degraded", NULL);
sync_action = udisks_linux_device_read_sysfs_attr (raid_device, "md/sync_action", NULL);
sync_completed = udisks_linux_device_read_sysfs_attr (raid_device, "md/sync_completed", NULL);
+ consistency_policy = udisks_linux_device_read_sysfs_attr (raid_device, "md/consistency_policy", NULL);
bitmap_location = udisks_linux_device_read_sysfs_attr (raid_device, "md/bitmap/location", NULL);
}
@@ -326,6 +328,7 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid,
}
udisks_mdraid_set_degraded (iface, degraded);
udisks_mdraid_set_sync_action (iface, sync_action);
+ udisks_mdraid_set_consistency_policy (iface, consistency_policy);
udisks_mdraid_set_bitmap_location (iface, bitmap_location);
udisks_mdraid_set_chunk_size (iface, chunk_size);
@@ -517,6 +520,7 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid,
bd_md_examine_data_free (raid_data);
g_free (sync_completed);
g_free (sync_action);
+ g_free (consistency_policy);
g_free (bitmap_location);
g_list_free_full (member_devices, g_object_unref);
g_clear_object (&raid_device);
--
2.33.0

View File

@ -19,12 +19,14 @@
Name: udisks2
Summary: Disk Manager
Version: 2.10.1
Release: 1
Release: 2
License: GPL-2.0+ and LGPL-2.0+
Group: System Environment/Libraries
URL: https://github.com/storaged-project/udisks
Source0: https://github.com/storaged-project/udisks/releases/download/udisks-%{version}/udisks-%{version}.tar.bz2
Patch0001: 0001-mdraid-Expose-consistency_policy-sysfs-value.patch
BuildRequires: make
BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: gobject-introspection-devel >= %{gobject_introspection_version}
@ -314,6 +316,9 @@ fi
%changelog
* Wed Jun 12 2024 Deyuan Fan <fandeyuan@kylinos.cn> - 2.10.1-2
- mdraid: Expose "consistency_policy" sysfs value
* Mon Oct 30 2023 li weigang <weigangli99@gmail.com> - 2.10.1-1
- update to version 2.10.1