Compare commits
No commits in common. "c8" and "imports/c10s/libblockdev-3.2.0-2.el10" have entirely different histories.
c8
...
imports/c1
60
.gitignore
vendored
60
.gitignore
vendored
@ -1 +1,59 @@
|
|||||||
SOURCES/libblockdev-2.28.tar.gz
|
/libblockdev-0.1.tar.gz
|
||||||
|
/libblockdev-0.2.tar.gz
|
||||||
|
/libblockdev-0.3.tar.gz
|
||||||
|
/libblockdev-0.4.tar.gz
|
||||||
|
/libblockdev-0.5.tar.gz
|
||||||
|
/libblockdev-0.6.tar.gz
|
||||||
|
/libblockdev-0.7.tar.gz
|
||||||
|
/libblockdev-0.8.tar.gz
|
||||||
|
/libblockdev-0.9.tar.gz
|
||||||
|
/libblockdev-0.10.tar.gz
|
||||||
|
/libblockdev-0.11.tar.gz
|
||||||
|
/libblockdev-0.12.tar.gz
|
||||||
|
/libblockdev-0.13.tar.gz
|
||||||
|
/libblockdev-1.0.tar.gz
|
||||||
|
/libblockdev-1.1.tar.gz
|
||||||
|
/libblockdev-1.2.tar.gz
|
||||||
|
/libblockdev-1.3.tar.gz
|
||||||
|
/libblockdev-1.4.tar.gz
|
||||||
|
/libblockdev-1.5.tar.gz
|
||||||
|
/libblockdev-1.6.tar.gz
|
||||||
|
/libblockdev-1.7.tar.gz
|
||||||
|
/libblockdev-1.8.tar.gz
|
||||||
|
/libblockdev-1.9.tar.gz
|
||||||
|
/libblockdev-2.1.tar.gz
|
||||||
|
/libblockdev-2.2.tar.gz
|
||||||
|
/libblockdev-2.3.tar.gz
|
||||||
|
/libblockdev-2.4.tar.gz
|
||||||
|
/libblockdev-2.5.tar.gz
|
||||||
|
/libblockdev-2.6.tar.gz
|
||||||
|
/libblockdev-2.7.tar.gz
|
||||||
|
/libblockdev-2.8.tar.gz
|
||||||
|
/libblockdev-2.9.tar.gz
|
||||||
|
/libblockdev-2.10.tar.gz
|
||||||
|
/libblockdev-2.11.tar.gz
|
||||||
|
/libblockdev-2.12.tar.gz
|
||||||
|
/libblockdev-2.13.tar.gz
|
||||||
|
/libblockdev-2.14.tar.gz
|
||||||
|
/libblockdev-2.15.tar.gz
|
||||||
|
/libblockdev-2.16.tar.gz
|
||||||
|
/libblockdev-2.17.tar.gz
|
||||||
|
/libblockdev-2.18.tar.gz
|
||||||
|
/libblockdev-2.19.tar.gz
|
||||||
|
/libblockdev-2.20.tar.gz
|
||||||
|
/libblockdev-2.21.tar.gz
|
||||||
|
/libblockdev-2.22.tar.gz
|
||||||
|
/libblockdev-2.23.tar.gz
|
||||||
|
/libblockdev-2.24.tar.gz
|
||||||
|
/libblockdev-2.25.tar.gz
|
||||||
|
/libblockdev-2.26.tar.gz
|
||||||
|
/libblockdev-2.27.tar.gz
|
||||||
|
/libblockdev-2.28.tar.gz
|
||||||
|
/libblockdev-3.0.tar.gz
|
||||||
|
/libblockdev-3.0.1.tar.gz
|
||||||
|
/libblockdev-3.0.2.tar.gz
|
||||||
|
/libblockdev-3.0.3.tar.gz
|
||||||
|
/libblockdev-3.0.4.tar.gz
|
||||||
|
/libblockdev-3.1.0.tar.gz
|
||||||
|
/smart-tests.tar.gz
|
||||||
|
/libblockdev-3.2.0.tar.gz
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
d32fce132c75d94ad9c033a636906d63027ffba5 SOURCES/libblockdev-2.28.tar.gz
|
|
||||||
56
0001-nvme_Avoid_element-type_g-i_annotations.patch
Normal file
56
0001-nvme_Avoid_element-type_g-i_annotations.patch
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
From 6cce09cff6567caf992dfe37a6e78192117ac040 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Tomas Bzatek <tbzatek@redhat.com>
|
||||||
|
Date: Wed, 6 Nov 2024 15:15:10 +0100
|
||||||
|
Subject: [PATCH] nvme: Avoid element-type g-i annotations
|
||||||
|
|
||||||
|
For some reason this is causing more harm and seems to work fine
|
||||||
|
when absent.
|
||||||
|
---
|
||||||
|
src/lib/plugin_apis/nvme.api | 4 ++--
|
||||||
|
src/plugins/nvme/nvme.h | 4 ++--
|
||||||
|
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/lib/plugin_apis/nvme.api b/src/lib/plugin_apis/nvme.api
|
||||||
|
index 2f17e0c96..604eaf9b1 100644
|
||||||
|
--- a/src/lib/plugin_apis/nvme.api
|
||||||
|
+++ b/src/lib/plugin_apis/nvme.api
|
||||||
|
@@ -364,7 +364,7 @@ GType bd_nvme_namespace_info_get_type ();
|
||||||
|
* @features: features and capabilities present for this namespace, see #BDNVMENamespaceFeature.
|
||||||
|
* @format_progress_remaining: The percentage value remaining of a format operation in progress.
|
||||||
|
* @write_protected: %TRUE if the namespace is currently write protected and all write access to the namespace shall fail.
|
||||||
|
- * @lba_formats: (array zero-terminated=1) (element-type BDNVMELBAFormat): A list of supported LBA Formats.
|
||||||
|
+ * @lba_formats: (array zero-terminated=1): A list of supported LBA Formats.
|
||||||
|
* @current_lba_format: A LBA Format currently used for the namespace. Contains zeroes in case of
|
||||||
|
* an invalid or no supported LBA Format reported.
|
||||||
|
*/
|
||||||
|
@@ -800,7 +800,7 @@ GType bd_nvme_self_test_log_get_type ();
|
||||||
|
* BDNVMESelfTestLog:
|
||||||
|
* @current_operation: Current running device self-test operation. There's no corresponding record in @entries for a device self-test operation that is in progress.
|
||||||
|
* @current_operation_completion: Percentage of the currently running device self-test operation. Only valid when @current_operation is other than #BD_NVME_SELF_TEST_ACTION_NOT_RUNNING.
|
||||||
|
- * @entries: (array zero-terminated=1) (element-type BDNVMESelfTestLogEntry): Self-test log entries for the last 20 operations, sorted from newest (first element) to oldest.
|
||||||
|
+ * @entries: (array zero-terminated=1): Self-test log entries for the last 20 operations, sorted from newest (first element) to oldest.
|
||||||
|
*/
|
||||||
|
typedef struct BDNVMESelfTestLog {
|
||||||
|
BDNVMESelfTestAction current_operation;
|
||||||
|
diff --git a/src/plugins/nvme/nvme.h b/src/plugins/nvme/nvme.h
|
||||||
|
index ba5304167..e073a6542 100644
|
||||||
|
--- a/src/plugins/nvme/nvme.h
|
||||||
|
+++ b/src/plugins/nvme/nvme.h
|
||||||
|
@@ -234,7 +234,7 @@ typedef enum {
|
||||||
|
* @features: features and capabilities present for this namespace, see #BDNVMENamespaceFeature.
|
||||||
|
* @format_progress_remaining: The percentage value remaining of a format operation in progress.
|
||||||
|
* @write_protected: %TRUE if the namespace is currently write protected and all write access to the namespace shall fail.
|
||||||
|
- * @lba_formats: (array zero-terminated=1) (element-type BDNVMELBAFormat): A list of supported LBA Formats.
|
||||||
|
+ * @lba_formats: (array zero-terminated=1): A list of supported LBA Formats.
|
||||||
|
* @current_lba_format: A LBA Format currently used for the namespace. Contains zeroes in case of
|
||||||
|
* an invalid or no supported LBA Format reported.
|
||||||
|
*/
|
||||||
|
@@ -442,7 +442,7 @@ typedef struct BDNVMESelfTestLogEntry {
|
||||||
|
* BDNVMESelfTestLog:
|
||||||
|
* @current_operation: Current running device self-test operation. There's no corresponding record in @entries for a device self-test operation that is in progress.
|
||||||
|
* @current_operation_completion: Percentage of the currently running device self-test operation. Only valid when @current_operation is other than #BD_NVME_SELF_TEST_ACTION_NOT_RUNNING.
|
||||||
|
- * @entries: (array zero-terminated=1) (element-type BDNVMESelfTestLogEntry): Self-test log entries for the last 20 operations, sorted from newest (first element) to oldest.
|
||||||
|
+ * @entries: (array zero-terminated=1): Self-test log entries for the last 20 operations, sorted from newest (first element) to oldest.
|
||||||
|
*/
|
||||||
|
typedef struct BDNVMESelfTestLog {
|
||||||
|
BDNVMESelfTestAction current_operation;
|
||||||
@ -1,59 +0,0 @@
|
|||||||
From 7a0e344d0642f76992c943158621d8ee7e5caea3 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
||||||
Date: Tue, 15 Nov 2022 13:21:25 +0100
|
|
||||||
Subject: [PATCH 1/2] crypto: Fix GError overwrite from libvolume_key
|
|
||||||
|
|
||||||
---
|
|
||||||
src/plugins/crypto.c | 7 ++++---
|
|
||||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/plugins/crypto.c b/src/plugins/crypto.c
|
|
||||||
index 35c38410..9064c8e3 100644
|
|
||||||
--- a/src/plugins/crypto.c
|
|
||||||
+++ b/src/plugins/crypto.c
|
|
||||||
@@ -2552,13 +2552,14 @@ static gboolean write_escrow_data_file (struct libvk_volume *volume, struct libv
|
|
||||||
GIOChannel *out_file = NULL;
|
|
||||||
GIOStatus status = G_IO_STATUS_ERROR;
|
|
||||||
gsize bytes_written = 0;
|
|
||||||
+ GError *l_error = NULL;
|
|
||||||
|
|
||||||
packet_data = libvk_volume_create_packet_asymmetric_with_format (volume, &packet_data_size, secret_type, cert,
|
|
||||||
- ui, LIBVK_PACKET_FORMAT_ASYMMETRIC_WRAP_SECRET_ONLY, error);
|
|
||||||
-
|
|
||||||
+ ui, LIBVK_PACKET_FORMAT_ASYMMETRIC_WRAP_SECRET_ONLY, &l_error);
|
|
||||||
if (!packet_data) {
|
|
||||||
g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_ESCROW_FAILED,
|
|
||||||
- "Failed to get escrow data");
|
|
||||||
+ "Failed to get escrow data: %s", l_error->message);
|
|
||||||
+ g_clear_error (&l_error);
|
|
||||||
libvk_volume_free (volume);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.38.1
|
|
||||||
|
|
||||||
|
|
||||||
From 25bf34c4c03e37eb3782dfccf459b9a3f795ddb3 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
||||||
Date: Wed, 16 Nov 2022 10:26:06 +0100
|
|
||||||
Subject: [PATCH 2/2] crypto: Fix double free in write_escrow_data_file
|
|
||||||
|
|
||||||
---
|
|
||||||
src/plugins/crypto.c | 1 -
|
|
||||||
1 file changed, 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/plugins/crypto.c b/src/plugins/crypto.c
|
|
||||||
index 9064c8e3..2086209e 100644
|
|
||||||
--- a/src/plugins/crypto.c
|
|
||||||
+++ b/src/plugins/crypto.c
|
|
||||||
@@ -2560,7 +2560,6 @@ static gboolean write_escrow_data_file (struct libvk_volume *volume, struct libv
|
|
||||||
g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_ESCROW_FAILED,
|
|
||||||
"Failed to get escrow data: %s", l_error->message);
|
|
||||||
g_clear_error (&l_error);
|
|
||||||
- libvk_volume_free (volume);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.38.1
|
|
||||||
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
From 6700dfded31219c99fea054aa10fd68b90bace82 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
||||||
Date: Mon, 31 Oct 2022 12:43:17 +0100
|
|
||||||
Subject: [PATCH] tests: Fix test_swapon_pagesize on systems with 64k pages
|
|
||||||
|
|
||||||
---
|
|
||||||
tests/swap_test.py | 12 ++++++++++--
|
|
||||||
1 file changed, 10 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/swap_test.py b/tests/swap_test.py
|
|
||||||
index 0a0f333d..e350f8e8 100644
|
|
||||||
--- a/tests/swap_test.py
|
|
||||||
+++ b/tests/swap_test.py
|
|
||||||
@@ -1,5 +1,6 @@
|
|
||||||
import unittest
|
|
||||||
import os
|
|
||||||
+import resource
|
|
||||||
import overrides_hack
|
|
||||||
|
|
||||||
from utils import create_sparse_tempfile, create_lio_device, delete_lio_device, fake_utils, fake_path, run_command, run, TestTags, tag_test
|
|
||||||
@@ -102,8 +103,15 @@ class SwapTestCase(SwapTest):
|
|
||||||
def test_swapon_pagesize(self):
|
|
||||||
"""Verify that activating swap with different pagesize fails"""
|
|
||||||
|
|
||||||
- # create swap with 64k pagesize
|
|
||||||
- ret, out, err = run_command("mkswap --pagesize 65536 %s" % self.loop_dev)
|
|
||||||
+ # pick some wrong page size: 8k on 64k and 64k everywhere else
|
|
||||||
+ pagesize = resource.getpagesize()
|
|
||||||
+ if pagesize == 65536:
|
|
||||||
+ wrong_pagesize = 8192
|
|
||||||
+ else:
|
|
||||||
+ wrong_pagesize = 65536
|
|
||||||
+
|
|
||||||
+ # create swap with "wrong" pagesize
|
|
||||||
+ ret, out, err = run_command("mkswap --pagesize %s %s" % (wrong_pagesize, self.loop_dev))
|
|
||||||
if ret != 0:
|
|
||||||
self.fail("Failed to prepare swap for pagesize test: %s %s" % (out, err))
|
|
||||||
|
|
||||||
--
|
|
||||||
2.39.2
|
|
||||||
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
From 9c96e621e9abb0649118d2e1731a09b1fa139579 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
||||||
Date: Wed, 19 Apr 2023 09:50:38 +0200
|
|
||||||
Subject: [PATCH] part: Fix segfault when adding a partition too big for MSDOS
|
|
||||||
|
|
||||||
Resolves: rhbz#2185564
|
|
||||||
---
|
|
||||||
src/plugins/part.c | 8 ++++++++
|
|
||||||
1 file changed, 8 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/src/plugins/part.c b/src/plugins/part.c
|
|
||||||
index 8b2285f5..28e20c28 100644
|
|
||||||
--- a/src/plugins/part.c
|
|
||||||
+++ b/src/plugins/part.c
|
|
||||||
@@ -841,6 +841,14 @@ static gboolean resize_part (PedPartition *part, PedDevice *dev, PedDisk *disk,
|
|
||||||
constr = ped_constraint_any (dev);
|
|
||||||
|
|
||||||
geom = ped_disk_get_max_partition_geometry (disk, part, constr);
|
|
||||||
+ if (!geom) {
|
|
||||||
+ set_parted_error (error, BD_PART_ERROR_FAIL);
|
|
||||||
+ g_prefix_error (error, "Failed to create geometry for partition on device '%s'", dev->path);
|
|
||||||
+ ped_constraint_destroy (constr);
|
|
||||||
+ finish_alignment_constraint (disk, orig_flag_state);
|
|
||||||
+ return FALSE;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (!ped_geometry_set_start (geom, start)) {
|
|
||||||
set_parted_error (error, BD_PART_ERROR_FAIL);
|
|
||||||
g_prefix_error (error, "Failed to set partition start on device '%s'", dev->path);
|
|
||||||
--
|
|
||||||
2.40.1
|
|
||||||
|
|
||||||
@ -1,300 +0,0 @@
|
|||||||
From ee9c3afec5ef2fe1e9fd50718cd732e267b235ed Mon Sep 17 00:00:00 2001
|
|
||||||
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
||||||
Date: Mon, 24 Apr 2023 11:57:18 +0200
|
|
||||||
Subject: [PATCH] lvm: Add a function to activate LVs in shared mode
|
|
||||||
|
|
||||||
Needed by the new blivet feature to support shared LVM setups.
|
|
||||||
---
|
|
||||||
src/lib/plugin_apis/lvm.api | 16 +++++++++
|
|
||||||
src/plugins/lvm-dbus.c | 51 ++++++++++++++++++++-------
|
|
||||||
src/plugins/lvm.c | 53 ++++++++++++++++++++++-------
|
|
||||||
src/plugins/lvm.h | 1 +
|
|
||||||
src/python/gi/overrides/BlockDev.py | 5 ++-
|
|
||||||
tests/lvm_dbus_tests.py | 18 +++++++---
|
|
||||||
tests/lvm_test.py | 18 +++++++---
|
|
||||||
7 files changed, 124 insertions(+), 38 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/lib/plugin_apis/lvm.api b/src/lib/plugin_apis/lvm.api
|
|
||||||
index dc8c1348..bac70a75 100644
|
|
||||||
--- a/src/lib/plugin_apis/lvm.api
|
|
||||||
+++ b/src/lib/plugin_apis/lvm.api
|
|
||||||
@@ -1055,6 +1055,22 @@ gboolean bd_lvm_lvresize (const gchar *vg_name, const gchar *lv_name, guint64 si
|
|
||||||
*/
|
|
||||||
gboolean bd_lvm_lvactivate (const gchar *vg_name, const gchar *lv_name, gboolean ignore_skip, const BDExtraArg **extra, GError **error);
|
|
||||||
|
|
||||||
+/**
|
|
||||||
+ * bd_lvm_lvactivate_shared:
|
|
||||||
+ * @vg_name: name of the VG containing the to-be-activated LV
|
|
||||||
+ * @lv_name: name of the to-be-activated LV
|
|
||||||
+ * @ignore_skip: whether to ignore the skip flag or not
|
|
||||||
+ * @shared: whether to activate the LV in shared mode
|
|
||||||
+ * @extra: (allow-none) (array zero-terminated=1): extra options for the LV activation
|
|
||||||
+ * (just passed to LVM as is)
|
|
||||||
+ * @error: (out): place to store error (if any)
|
|
||||||
+ *
|
|
||||||
+ * Returns: whether the @vg_name/@lv_name LV was successfully activated or not
|
|
||||||
+ *
|
|
||||||
+ * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
|
|
||||||
+ */
|
|
||||||
+gboolean bd_lvm_lvactivate_shared (const gchar *vg_name, const gchar *lv_name, gboolean ignore_skip, gboolean shared, const BDExtraArg **extra, GError **error);
|
|
||||||
+
|
|
||||||
/**
|
|
||||||
* bd_lvm_lvdeactivate:
|
|
||||||
* @vg_name: name of the VG containing the to-be-deactivated LV
|
|
||||||
diff --git a/src/plugins/lvm-dbus.c b/src/plugins/lvm-dbus.c
|
|
||||||
index b7b4480e..d8e997f9 100644
|
|
||||||
--- a/src/plugins/lvm-dbus.c
|
|
||||||
+++ b/src/plugins/lvm-dbus.c
|
|
||||||
@@ -2115,6 +2115,27 @@ gboolean bd_lvm_lvresize (const gchar *vg_name, const gchar *lv_name, guint64 si
|
|
||||||
return (*error == NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
+static gboolean _lvm_lvactivate (const gchar *vg_name, const gchar *lv_name, gboolean ignore_skip, gboolean shared, const BDExtraArg **extra, GError **error) {
|
|
||||||
+ GVariant *params = NULL;
|
|
||||||
+ GVariantBuilder builder;
|
|
||||||
+ GVariant *extra_params = NULL;
|
|
||||||
+
|
|
||||||
+ if (shared)
|
|
||||||
+ params = g_variant_new ("(t)", (guint64) 1 << 6);
|
|
||||||
+ else
|
|
||||||
+ params = g_variant_new ("(t)", (guint64) 0);
|
|
||||||
+
|
|
||||||
+ if (ignore_skip) {
|
|
||||||
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_DICTIONARY);
|
|
||||||
+ g_variant_builder_add (&builder, "{sv}", "-K", g_variant_new ("s", ""));
|
|
||||||
+ extra_params = g_variant_builder_end (&builder);
|
|
||||||
+ g_variant_builder_clear (&builder);
|
|
||||||
+ }
|
|
||||||
+ call_lv_method_sync (vg_name, lv_name, "Activate", params, extra_params, extra, TRUE, error);
|
|
||||||
+
|
|
||||||
+ return (*error == NULL);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/**
|
|
||||||
* bd_lvm_lvactivate:
|
|
||||||
* @vg_name: name of the VG containing the to-be-activated LV
|
|
||||||
@@ -2129,19 +2150,25 @@ gboolean bd_lvm_lvresize (const gchar *vg_name, const gchar *lv_name, guint64 si
|
|
||||||
* Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
|
|
||||||
*/
|
|
||||||
gboolean bd_lvm_lvactivate (const gchar *vg_name, const gchar *lv_name, gboolean ignore_skip, const BDExtraArg **extra, GError **error) {
|
|
||||||
- GVariant *params = g_variant_new ("(t)", (guint64) 0);
|
|
||||||
- GVariantBuilder builder;
|
|
||||||
- GVariant *extra_params = NULL;
|
|
||||||
-
|
|
||||||
- if (ignore_skip) {
|
|
||||||
- g_variant_builder_init (&builder, G_VARIANT_TYPE_DICTIONARY);
|
|
||||||
- g_variant_builder_add (&builder, "{sv}", "-K", g_variant_new ("s", ""));
|
|
||||||
- extra_params = g_variant_builder_end (&builder);
|
|
||||||
- g_variant_builder_clear (&builder);
|
|
||||||
- }
|
|
||||||
- call_lv_method_sync (vg_name, lv_name, "Activate", params, extra_params, extra, TRUE, error);
|
|
||||||
+ return _lvm_lvactivate (vg_name, lv_name, ignore_skip, FALSE, extra, error);
|
|
||||||
+}
|
|
||||||
|
|
||||||
- return (*error == NULL);
|
|
||||||
+/**
|
|
||||||
+ * bd_lvm_lvactivate_shared:
|
|
||||||
+ * @vg_name: name of the VG containing the to-be-activated LV
|
|
||||||
+ * @lv_name: name of the to-be-activated LV
|
|
||||||
+ * @ignore_skip: whether to ignore the skip flag or not
|
|
||||||
+ * @shared: whether to activate the LV in shared mode
|
|
||||||
+ * @extra: (allow-none) (array zero-terminated=1): extra options for the LV activation
|
|
||||||
+ * (just passed to LVM as is)
|
|
||||||
+ * @error: (out): place to store error (if any)
|
|
||||||
+ *
|
|
||||||
+ * Returns: whether the @vg_name/@lv_name LV was successfully activated or not
|
|
||||||
+ *
|
|
||||||
+ * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
|
|
||||||
+ */
|
|
||||||
+gboolean bd_lvm_lvactivate_shared (const gchar *vg_name, const gchar *lv_name, gboolean ignore_skip, gboolean shared, const BDExtraArg **extra, GError **error) {
|
|
||||||
+ return _lvm_lvactivate (vg_name, lv_name, ignore_skip, shared, extra, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
diff --git a/src/plugins/lvm.c b/src/plugins/lvm.c
|
|
||||||
index 50da656c..d7281339 100644
|
|
||||||
--- a/src/plugins/lvm.c
|
|
||||||
+++ b/src/plugins/lvm.c
|
|
||||||
@@ -1594,6 +1594,28 @@ gboolean bd_lvm_lvresize (const gchar *vg_name, const gchar *lv_name, guint64 si
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static gboolean _lvm_lvactivate (const gchar *vg_name, const gchar *lv_name, gboolean ignore_skip, gboolean shared, const BDExtraArg **extra, GError **error) {
|
|
||||||
+ const gchar *args[5] = {"lvchange", NULL, NULL, NULL, NULL};
|
|
||||||
+ guint8 next_arg = 2;
|
|
||||||
+ gboolean success = FALSE;
|
|
||||||
+
|
|
||||||
+ if (shared)
|
|
||||||
+ args[1] = "-asy";
|
|
||||||
+ else
|
|
||||||
+ args[1] = "-ay";
|
|
||||||
+
|
|
||||||
+ if (ignore_skip) {
|
|
||||||
+ args[next_arg] = "-K";
|
|
||||||
+ next_arg++;
|
|
||||||
+ }
|
|
||||||
+ args[next_arg] = g_strdup_printf ("%s/%s", vg_name, lv_name);
|
|
||||||
+
|
|
||||||
+ success = call_lvm_and_report_error (args, extra, TRUE, error);
|
|
||||||
+ g_free ((gchar *) args[next_arg]);
|
|
||||||
+
|
|
||||||
+ return success;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/**
|
|
||||||
* bd_lvm_lvactivate:
|
|
||||||
* @vg_name: name of the VG containing the to-be-activated LV
|
|
||||||
@@ -1608,20 +1630,25 @@ gboolean bd_lvm_lvresize (const gchar *vg_name, const gchar *lv_name, guint64 si
|
|
||||||
* Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
|
|
||||||
*/
|
|
||||||
gboolean bd_lvm_lvactivate (const gchar *vg_name, const gchar *lv_name, gboolean ignore_skip, const BDExtraArg **extra, GError **error) {
|
|
||||||
- const gchar *args[5] = {"lvchange", "-ay", NULL, NULL, NULL};
|
|
||||||
- guint8 next_arg = 2;
|
|
||||||
- gboolean success = FALSE;
|
|
||||||
-
|
|
||||||
- if (ignore_skip) {
|
|
||||||
- args[next_arg] = "-K";
|
|
||||||
- next_arg++;
|
|
||||||
- }
|
|
||||||
- args[next_arg] = g_strdup_printf ("%s/%s", vg_name, lv_name);
|
|
||||||
-
|
|
||||||
- success = call_lvm_and_report_error (args, extra, TRUE, error);
|
|
||||||
- g_free ((gchar *) args[next_arg]);
|
|
||||||
+ return _lvm_lvactivate (vg_name, lv_name, ignore_skip, FALSE, extra, error);
|
|
||||||
+}
|
|
||||||
|
|
||||||
- return success;
|
|
||||||
+/**
|
|
||||||
+ * bd_lvm_lvactivate_shared:
|
|
||||||
+ * @vg_name: name of the VG containing the to-be-activated LV
|
|
||||||
+ * @lv_name: name of the to-be-activated LV
|
|
||||||
+ * @ignore_skip: whether to ignore the skip flag or not
|
|
||||||
+ * @shared: whether to activate the LV in shared mode
|
|
||||||
+ * @extra: (allow-none) (array zero-terminated=1): extra options for the LV activation
|
|
||||||
+ * (just passed to LVM as is)
|
|
||||||
+ * @error: (out): place to store error (if any)
|
|
||||||
+ *
|
|
||||||
+ * Returns: whether the @vg_name/@lv_name LV was successfully activated or not
|
|
||||||
+ *
|
|
||||||
+ * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
|
|
||||||
+ */
|
|
||||||
+gboolean bd_lvm_lvactivate_shared (const gchar *vg_name, const gchar *lv_name, gboolean ignore_skip, gboolean shared, const BDExtraArg **extra, GError **error) {
|
|
||||||
+ return _lvm_lvactivate (vg_name, lv_name, ignore_skip, shared, extra, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
diff --git a/src/plugins/lvm.h b/src/plugins/lvm.h
|
|
||||||
index 2162d769..244663a4 100644
|
|
||||||
--- a/src/plugins/lvm.h
|
|
||||||
+++ b/src/plugins/lvm.h
|
|
||||||
@@ -275,6 +275,7 @@ gboolean bd_lvm_lvremove (const gchar *vg_name, const gchar *lv_name, gboolean f
|
|
||||||
gboolean bd_lvm_lvrename (const gchar *vg_name, const gchar *lv_name, const gchar *new_name, const BDExtraArg **extra, GError **error);
|
|
||||||
gboolean bd_lvm_lvresize (const gchar *vg_name, const gchar *lv_name, guint64 size, const BDExtraArg **extra, GError **error);
|
|
||||||
gboolean bd_lvm_lvactivate (const gchar *vg_name, const gchar *lv_name, gboolean ignore_skip, const BDExtraArg **extra, GError **error);
|
|
||||||
+gboolean bd_lvm_lvactivate_shared (const gchar *vg_name, const gchar *lv_name, gboolean ignore_skip, gboolean shared, const BDExtraArg **extra, GError **error);
|
|
||||||
gboolean bd_lvm_lvdeactivate (const gchar *vg_name, const gchar *lv_name, const BDExtraArg **extra, GError **error);
|
|
||||||
gboolean bd_lvm_lvsnapshotcreate (const gchar *vg_name, const gchar *origin_name, const gchar *snapshot_name, guint64 size, const BDExtraArg **extra, GError **error);
|
|
||||||
gboolean bd_lvm_lvsnapshotmerge (const gchar *vg_name, const gchar *snapshot_name, const BDExtraArg **extra, GError **error);
|
|
||||||
diff --git a/src/python/gi/overrides/BlockDev.py b/src/python/gi/overrides/BlockDev.py
|
|
||||||
index f768c8bd..c7d72f4b 100644
|
|
||||||
--- a/src/python/gi/overrides/BlockDev.py
|
|
||||||
+++ b/src/python/gi/overrides/BlockDev.py
|
|
||||||
@@ -580,11 +580,10 @@ def lvm_lvresize(vg_name, lv_name, size, extra=None, **kwargs):
|
|
||||||
return _lvm_lvresize(vg_name, lv_name, size, extra)
|
|
||||||
__all__.append("lvm_lvresize")
|
|
||||||
|
|
||||||
-_lvm_lvactivate = BlockDev.lvm_lvactivate
|
|
||||||
@override(BlockDev.lvm_lvactivate)
|
|
||||||
-def lvm_lvactivate(vg_name, lv_name, ignore_skip=False, extra=None, **kwargs):
|
|
||||||
+def lvm_lvactivate(vg_name, lv_name, ignore_skip=False, shared=False, extra=None, **kwargs):
|
|
||||||
extra = _get_extra(extra, kwargs)
|
|
||||||
- return _lvm_lvactivate(vg_name, lv_name, ignore_skip, extra)
|
|
||||||
+ return BlockDev.lvm_lvactivate_shared(vg_name, lv_name, ignore_skip, shared, extra)
|
|
||||||
__all__.append("lvm_lvactivate")
|
|
||||||
|
|
||||||
_lvm_lvdeactivate = BlockDev.lvm_lvdeactivate
|
|
||||||
diff --git a/tests/lvm_dbus_tests.py b/tests/lvm_dbus_tests.py
|
|
||||||
index 4882da88..67eaccd1 100644
|
|
||||||
--- a/tests/lvm_dbus_tests.py
|
|
||||||
+++ b/tests/lvm_dbus_tests.py
|
|
||||||
@@ -799,15 +799,15 @@ class LvmTestLVactivateDeactivate(LvmPVVGLVTestCase):
|
|
||||||
self.assertTrue(succ)
|
|
||||||
|
|
||||||
with self.assertRaises(GLib.GError):
|
|
||||||
- BlockDev.lvm_lvactivate("nonexistingVG", "testLV", True, None)
|
|
||||||
+ BlockDev.lvm_lvactivate("nonexistingVG", "testLV", True)
|
|
||||||
|
|
||||||
with self.assertRaises(GLib.GError):
|
|
||||||
- BlockDev.lvm_lvactivate("testVG", "nonexistingLV", True, None)
|
|
||||||
+ BlockDev.lvm_lvactivate("testVG", "nonexistingLV", True)
|
|
||||||
|
|
||||||
with self.assertRaises(GLib.GError):
|
|
||||||
- BlockDev.lvm_lvactivate("nonexistingVG", "nonexistingLV", True, None)
|
|
||||||
+ BlockDev.lvm_lvactivate("nonexistingVG", "nonexistingLV", True)
|
|
||||||
|
|
||||||
- succ = BlockDev.lvm_lvactivate("testVG", "testLV", True, None)
|
|
||||||
+ succ = BlockDev.lvm_lvactivate("testVG", "testLV", True)
|
|
||||||
self.assertTrue(succ)
|
|
||||||
|
|
||||||
with self.assertRaises(GLib.GError):
|
|
||||||
@@ -822,7 +822,15 @@ class LvmTestLVactivateDeactivate(LvmPVVGLVTestCase):
|
|
||||||
succ = BlockDev.lvm_lvdeactivate("testVG", "testLV", None)
|
|
||||||
self.assertTrue(succ)
|
|
||||||
|
|
||||||
- succ = BlockDev.lvm_lvactivate("testVG", "testLV", True, None)
|
|
||||||
+ succ = BlockDev.lvm_lvactivate("testVG", "testLV", True)
|
|
||||||
+ self.assertTrue(succ)
|
|
||||||
+
|
|
||||||
+ succ = BlockDev.lvm_lvdeactivate("testVG", "testLV", None)
|
|
||||||
+ self.assertTrue(succ)
|
|
||||||
+
|
|
||||||
+ # try activating in shared mode, unfortunately no way to check whether it really
|
|
||||||
+ # works or not
|
|
||||||
+ succ = BlockDev.lvm_lvactivate("testVG", "testLV", True, True)
|
|
||||||
self.assertTrue(succ)
|
|
||||||
|
|
||||||
succ = BlockDev.lvm_lvdeactivate("testVG", "testLV", None)
|
|
||||||
diff --git a/tests/lvm_test.py b/tests/lvm_test.py
|
|
||||||
index eb94c917..25e2f109 100644
|
|
||||||
--- a/tests/lvm_test.py
|
|
||||||
+++ b/tests/lvm_test.py
|
|
||||||
@@ -730,15 +730,15 @@ class LvmTestLVactivateDeactivate(LvmPVVGLVTestCase):
|
|
||||||
self.assertTrue(succ)
|
|
||||||
|
|
||||||
with self.assertRaises(GLib.GError):
|
|
||||||
- BlockDev.lvm_lvactivate("nonexistingVG", "testLV", True, None)
|
|
||||||
+ BlockDev.lvm_lvactivate("nonexistingVG", "testLV", True)
|
|
||||||
|
|
||||||
with self.assertRaises(GLib.GError):
|
|
||||||
- BlockDev.lvm_lvactivate("testVG", "nonexistingLV", True, None)
|
|
||||||
+ BlockDev.lvm_lvactivate("testVG", "nonexistingLV", True)
|
|
||||||
|
|
||||||
with self.assertRaises(GLib.GError):
|
|
||||||
- BlockDev.lvm_lvactivate("nonexistingVG", "nonexistingLV", True, None)
|
|
||||||
+ BlockDev.lvm_lvactivate("nonexistingVG", "nonexistingLV", True)
|
|
||||||
|
|
||||||
- succ = BlockDev.lvm_lvactivate("testVG", "testLV", True, None)
|
|
||||||
+ succ = BlockDev.lvm_lvactivate("testVG", "testLV", True)
|
|
||||||
self.assertTrue(succ)
|
|
||||||
|
|
||||||
with self.assertRaises(GLib.GError):
|
|
||||||
@@ -753,7 +753,15 @@ class LvmTestLVactivateDeactivate(LvmPVVGLVTestCase):
|
|
||||||
succ = BlockDev.lvm_lvdeactivate("testVG", "testLV", None)
|
|
||||||
self.assertTrue(succ)
|
|
||||||
|
|
||||||
- succ = BlockDev.lvm_lvactivate("testVG", "testLV", True, None)
|
|
||||||
+ succ = BlockDev.lvm_lvactivate("testVG", "testLV", True)
|
|
||||||
+ self.assertTrue(succ)
|
|
||||||
+
|
|
||||||
+ succ = BlockDev.lvm_lvdeactivate("testVG", "testLV", None)
|
|
||||||
+ self.assertTrue(succ)
|
|
||||||
+
|
|
||||||
+ # try activating in shared mode, unfortunately no way to check whether it really
|
|
||||||
+ # works or not
|
|
||||||
+ succ = BlockDev.lvm_lvactivate("testVG", "testLV", True, True)
|
|
||||||
self.assertTrue(succ)
|
|
||||||
|
|
||||||
succ = BlockDev.lvm_lvdeactivate("testVG", "testLV", None)
|
|
||||||
--
|
|
||||||
2.41.0
|
|
||||||
|
|
||||||
@ -1,299 +0,0 @@
|
|||||||
From 5e8429d004445c6f6e6f16cab67cf14cb4d32a65 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
||||||
Date: Tue, 18 Apr 2023 12:05:35 +0200
|
|
||||||
Subject: [PATCH] lvm: Add support for starting and stopping VG locking
|
|
||||||
|
|
||||||
---
|
|
||||||
docs/libblockdev-sections.txt | 2 ++
|
|
||||||
src/lib/plugin_apis/lvm.api | 27 +++++++++++++++++++
|
|
||||||
src/plugins/lvm-dbus.c | 49 ++++++++++++++++++++++++++++++++++-
|
|
||||||
src/plugins/lvm.c | 41 +++++++++++++++++++++++++++++
|
|
||||||
src/plugins/lvm.h | 3 +++
|
|
||||||
tests/lvm_dbus_tests.py | 33 +++++++++++++++++++++++
|
|
||||||
tests/lvm_test.py | 32 +++++++++++++++++++++++
|
|
||||||
7 files changed, 186 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/docs/libblockdev-sections.txt b/docs/libblockdev-sections.txt
|
|
||||||
index 512820c2..7377dd17 100644
|
|
||||||
--- a/docs/libblockdev-sections.txt
|
|
||||||
+++ b/docs/libblockdev-sections.txt
|
|
||||||
@@ -286,6 +286,8 @@ bd_lvm_vgactivate
|
|
||||||
bd_lvm_vgdeactivate
|
|
||||||
bd_lvm_vgextend
|
|
||||||
bd_lvm_vgreduce
|
|
||||||
+bd_lvm_vglock_start
|
|
||||||
+bd_lvm_vglock_stop
|
|
||||||
bd_lvm_vginfo
|
|
||||||
bd_lvm_vgs
|
|
||||||
bd_lvm_lvorigin
|
|
||||||
diff --git a/src/lib/plugin_apis/lvm.api b/src/lib/plugin_apis/lvm.api
|
|
||||||
index 54c47a93..14f2620a 100644
|
|
||||||
--- a/src/lib/plugin_apis/lvm.api
|
|
||||||
+++ b/src/lib/plugin_apis/lvm.api
|
|
||||||
@@ -601,6 +601,7 @@ typedef enum {
|
|
||||||
BD_LVM_TECH_CACHE_CALCS,
|
|
||||||
BD_LVM_TECH_GLOB_CONF,
|
|
||||||
BD_LVM_TECH_VDO,
|
|
||||||
+ BD_LVM_TECH_SHARED,
|
|
||||||
} BDLVMTech;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
@@ -941,6 +942,32 @@ gboolean bd_lvm_vgextend (const gchar *vg_name, const gchar *device, const BDExt
|
|
||||||
*/
|
|
||||||
gboolean bd_lvm_vgreduce (const gchar *vg_name, const gchar *device, const BDExtraArg **extra, GError **error);
|
|
||||||
|
|
||||||
+/**
|
|
||||||
+ * bd_lvm_vglock_start:
|
|
||||||
+ * @vg_name: a shared VG to start the lockspace in lvmlockd
|
|
||||||
+ * @extra: (nullable) (array zero-terminated=1): extra options for the vgchange command
|
|
||||||
+ * (just passed to LVM as is)
|
|
||||||
+ * @error: (out): place to store error (if any)
|
|
||||||
+ *
|
|
||||||
+ * Returns: whether the lock was successfully started for @vg_name or not
|
|
||||||
+ *
|
|
||||||
+ * Tech category: %BD_LVM_TECH_SHARED-%BD_LVM_TECH_MODE_MODIFY
|
|
||||||
+ */
|
|
||||||
+gboolean bd_lvm_vglock_start (const gchar *vg_name, const BDExtraArg **extra, GError **error);
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * bd_lvm_vglock_stop:
|
|
||||||
+ * @vg_name: a shared VG to stop the lockspace in lvmlockd
|
|
||||||
+ * @extra: (nullable) (array zero-terminated=1): extra options for the vgchange command
|
|
||||||
+ * (just passed to LVM as is)
|
|
||||||
+ * @error: (out): place to store error (if any)
|
|
||||||
+ *
|
|
||||||
+ * Returns: whether the lock was successfully stopped for @vg_name or not
|
|
||||||
+ *
|
|
||||||
+ * Tech category: %BD_LVM_TECH_SHARED-%BD_LVM_TECH_MODE_MODIFY
|
|
||||||
+ */
|
|
||||||
+gboolean bd_lvm_vglock_stop (const gchar *vg_name, const BDExtraArg **extra, GError **error);
|
|
||||||
+
|
|
||||||
/**
|
|
||||||
* bd_lvm_vginfo:
|
|
||||||
* @vg_name: a VG to get information about
|
|
||||||
diff --git a/src/plugins/lvm-dbus.c b/src/plugins/lvm-dbus.c
|
|
||||||
index e1f946fe..ad44dfb3 100644
|
|
||||||
--- a/src/plugins/lvm-dbus.c
|
|
||||||
+++ b/src/plugins/lvm-dbus.c
|
|
||||||
@@ -1848,10 +1848,57 @@ gboolean bd_lvm_vgreduce (const gchar *vg_name, const gchar *device, const BDExt
|
|
||||||
return ((*error) == NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
+gboolean _vglock_start_stop (const gchar *vg_name, gboolean start, const BDExtraArg **extra, GError **error) {
|
|
||||||
+ GVariantBuilder builder;
|
|
||||||
+ GVariant *params = NULL;
|
|
||||||
+
|
|
||||||
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_DICTIONARY);
|
|
||||||
+ if (start)
|
|
||||||
+ g_variant_builder_add (&builder, "{sv}", "--lockstart", g_variant_new ("s", ""));
|
|
||||||
+ else
|
|
||||||
+ g_variant_builder_add (&builder, "{sv}", "--lockstop", g_variant_new ("s", ""));
|
|
||||||
+ params = g_variant_builder_end (&builder);
|
|
||||||
+ g_variant_builder_clear (&builder);
|
|
||||||
+
|
|
||||||
+ call_lvm_obj_method_sync (vg_name, VG_INTF, "Change", NULL, params, extra, TRUE, error);
|
|
||||||
+
|
|
||||||
+ return ((*error) == NULL);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * bd_lvm_vglock_start:
|
|
||||||
+ * @vg_name: a shared VG to start the lockspace in lvmlockd
|
|
||||||
+ * @extra: (nullable) (array zero-terminated=1): extra options for the vgchange command
|
|
||||||
+ * (just passed to LVM as is)
|
|
||||||
+ * @error: (out): place to store error (if any)
|
|
||||||
+ *
|
|
||||||
+ * Returns: whether the lock was successfully started for @vg_name or not
|
|
||||||
+ *
|
|
||||||
+ * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
|
|
||||||
+ */
|
|
||||||
+gboolean bd_lvm_vglock_start (const gchar *vg_name, const BDExtraArg **extra, GError **error) {
|
|
||||||
+ return _vglock_start_stop (vg_name, TRUE, extra, error);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * bd_lvm_vglock_stop:
|
|
||||||
+ * @vg_name: a shared VG to stop the lockspace in lvmlockd
|
|
||||||
+ * @extra: (nullable) (array zero-terminated=1): extra options for the vgchange command
|
|
||||||
+ * (just passed to LVM as is)
|
|
||||||
+ * @error: (out): place to store error (if any)
|
|
||||||
+ *
|
|
||||||
+ * Returns: whether the lock was successfully stopped for @vg_name or not
|
|
||||||
+ *
|
|
||||||
+ * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
|
|
||||||
+ */
|
|
||||||
+gboolean bd_lvm_vglock_stop (const gchar *vg_name, const BDExtraArg **extra, GError **error) {
|
|
||||||
+ return _vglock_start_stop (vg_name, FALSE, extra, error);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/**
|
|
||||||
* bd_lvm_vginfo:
|
|
||||||
* @vg_name: a VG to get information about
|
|
||||||
- * @error: (out): place to store error (if any)
|
|
||||||
+ * @error: (out) (optional): place to store error (if any)
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): information about the @vg_name VG or %NULL in case
|
|
||||||
* of error (the @error) gets populated in those cases)
|
|
||||||
diff --git a/src/plugins/lvm.c b/src/plugins/lvm.c
|
|
||||||
index 8bb3ae24..1aaf6747 100644
|
|
||||||
--- a/src/plugins/lvm.c
|
|
||||||
+++ b/src/plugins/lvm.c
|
|
||||||
@@ -1316,6 +1316,47 @@ gboolean bd_lvm_vgreduce (const gchar *vg_name, const gchar *device, const BDExt
|
|
||||||
return call_lvm_and_report_error (args, extra, TRUE, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
+gboolean _vglock_start_stop (const gchar *vg_name, gboolean start, const BDExtraArg **extra, GError **error) {
|
|
||||||
+ const gchar *args[4] = {"vgchange", NULL, vg_name, NULL};
|
|
||||||
+
|
|
||||||
+ if (start)
|
|
||||||
+ args[1] = "--lockstart";
|
|
||||||
+ else
|
|
||||||
+ args[1] = "--lockstop";
|
|
||||||
+
|
|
||||||
+ return call_lvm_and_report_error (args, extra, TRUE, error);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * bd_lvm_vglock_start:
|
|
||||||
+ * @vg_name: a shared VG to start the lockspace in lvmlockd
|
|
||||||
+ * @extra: (nullable) (array zero-terminated=1): extra options for the vgchange command
|
|
||||||
+ * (just passed to LVM as is)
|
|
||||||
+ * @error: (out): place to store error (if any)
|
|
||||||
+ *
|
|
||||||
+ * Returns: whether the lock was successfully started for @vg_name or not
|
|
||||||
+ *
|
|
||||||
+ * Tech category: %BD_LVM_TECH_SHARED-%BD_LVM_TECH_MODE_MODIFY
|
|
||||||
+ */
|
|
||||||
+gboolean bd_lvm_vglock_start (const gchar *vg_name, const BDExtraArg **extra, GError **error) {
|
|
||||||
+ return _vglock_start_stop (vg_name, TRUE, extra, error);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * bd_lvm_vglock_stop:
|
|
||||||
+ * @vg_name: a shared VG to stop the lockspace in lvmlockd
|
|
||||||
+ * @extra: (nullable) (array zero-terminated=1): extra options for the vgchange command
|
|
||||||
+ * (just passed to LVM as is)
|
|
||||||
+ * @error: (out): place to store error (if any)
|
|
||||||
+ *
|
|
||||||
+ * Returns: whether the lock was successfully stopped for @vg_name or not
|
|
||||||
+ *
|
|
||||||
+ * Tech category: %BD_LVM_TECH_SHARED-%BD_LVM_TECH_MODE_MODIFY
|
|
||||||
+ */
|
|
||||||
+gboolean bd_lvm_vglock_stop (const gchar *vg_name, const BDExtraArg **extra, GError **error) {
|
|
||||||
+ return _vglock_start_stop (vg_name, FALSE, extra, error);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/**
|
|
||||||
* bd_lvm_vginfo:
|
|
||||||
* @vg_name: a VG to get information about
|
|
||||||
diff --git a/src/plugins/lvm.h b/src/plugins/lvm.h
|
|
||||||
index 244663a4..da14cc1a 100644
|
|
||||||
--- a/src/plugins/lvm.h
|
|
||||||
+++ b/src/plugins/lvm.h
|
|
||||||
@@ -216,6 +216,7 @@ typedef enum {
|
|
||||||
BD_LVM_TECH_CACHE_CALCS,
|
|
||||||
BD_LVM_TECH_GLOB_CONF,
|
|
||||||
BD_LVM_TECH_VDO,
|
|
||||||
+ BD_LVM_TECH_SHARED,
|
|
||||||
} BDLVMTech;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
@@ -266,6 +267,8 @@ gboolean bd_lvm_vgactivate (const gchar *vg_name, const BDExtraArg **extra, GErr
|
|
||||||
gboolean bd_lvm_vgdeactivate (const gchar *vg_name, const BDExtraArg **extra, GError **error);
|
|
||||||
gboolean bd_lvm_vgextend (const gchar *vg_name, const gchar *device, const BDExtraArg **extra, GError **error);
|
|
||||||
gboolean bd_lvm_vgreduce (const gchar *vg_name, const gchar *device, const BDExtraArg **extra, GError **error);
|
|
||||||
+gboolean bd_lvm_vglock_start (const gchar *vg_name, const BDExtraArg **extra, GError **error);
|
|
||||||
+gboolean bd_lvm_vglock_stop (const gchar *vg_name, const BDExtraArg **extra, GError **error);
|
|
||||||
BDLVMVGdata* bd_lvm_vginfo (const gchar *vg_name, GError **error);
|
|
||||||
BDLVMVGdata** bd_lvm_vgs (GError **error);
|
|
||||||
|
|
||||||
diff --git a/tests/lvm_dbus_tests.py b/tests/lvm_dbus_tests.py
|
|
||||||
index 862a44cf..2a92c7c1 100644
|
|
||||||
--- a/tests/lvm_dbus_tests.py
|
|
||||||
+++ b/tests/lvm_dbus_tests.py
|
|
||||||
@@ -612,6 +612,39 @@ class LvmTestVGs(LvmPVVGTestCase):
|
|
||||||
succ = BlockDev.lvm_pvremove(self.loop_dev, None)
|
|
||||||
self.assertTrue(succ)
|
|
||||||
|
|
||||||
+@unittest.skipUnless(lvm_dbus_running, "LVM DBus not running")
|
|
||||||
+class LvmTestVGLocking(LvmPVVGTestCase):
|
|
||||||
+ @tag_test(TestTags.UNSAFE)
|
|
||||||
+ def test_vglock_stop_start(self):
|
|
||||||
+ """Verify that it is possible to start and stop locking on a VG"""
|
|
||||||
+
|
|
||||||
+ # better not do anything if lvmlockd is running, shared VGs have
|
|
||||||
+ # a tendency to wreak havoc on your system if you look at them wrong
|
|
||||||
+ ret, _out, _err = run_command("systemctl is-active lvmlockd")
|
|
||||||
+ if ret == 0:
|
|
||||||
+ self.skipTest("lvmlockd is running, skipping")
|
|
||||||
+
|
|
||||||
+ _ret, out, _err = run_command("lvm config 'global/use_lvmlockd'")
|
|
||||||
+ if "use_lvmlockd=0" not in out:
|
|
||||||
+ self.skipTest("lvmlockd is enabled, skipping")
|
|
||||||
+
|
|
||||||
+ succ = BlockDev.lvm_pvcreate(self.loop_dev, 0, 0, None)
|
|
||||||
+ self.assertTrue(succ)
|
|
||||||
+
|
|
||||||
+ succ = BlockDev.lvm_pvcreate(self.loop_dev2, 0, 0, None)
|
|
||||||
+ self.assertTrue(succ)
|
|
||||||
+
|
|
||||||
+ succ = BlockDev.lvm_vgcreate("testVG", [self.loop_dev, self.loop_dev2], 0, None)
|
|
||||||
+ self.assertTrue(succ)
|
|
||||||
+
|
|
||||||
+ # this actually doesn't "test" anything, the commands will just say lvmlockd is not
|
|
||||||
+ # running and return 0, but that's good enough for us
|
|
||||||
+ succ = BlockDev.lvm_vglock_start("testVG")
|
|
||||||
+ self.assertTrue(succ)
|
|
||||||
+
|
|
||||||
+ succ = BlockDev.lvm_vglock_stop("testVG")
|
|
||||||
+ self.assertTrue(succ)
|
|
||||||
+
|
|
||||||
@unittest.skipUnless(lvm_dbus_running, "LVM DBus not running")
|
|
||||||
class LvmPVVGLVTestCase(LvmPVVGTestCase):
|
|
||||||
def _clean_up(self):
|
|
||||||
diff --git a/tests/lvm_test.py b/tests/lvm_test.py
|
|
||||||
index 96f1670d..3ab11f04 100644
|
|
||||||
--- a/tests/lvm_test.py
|
|
||||||
+++ b/tests/lvm_test.py
|
|
||||||
@@ -585,6 +585,38 @@ class LvmTestVGs(LvmPVVGTestCase):
|
|
||||||
succ = BlockDev.lvm_pvremove(self.loop_dev, None)
|
|
||||||
self.assertTrue(succ)
|
|
||||||
|
|
||||||
+class LvmTestVGLocking(LvmPVVGTestCase):
|
|
||||||
+ @tag_test(TestTags.UNSAFE)
|
|
||||||
+ def test_vglock_stop_start(self):
|
|
||||||
+ """Verify that it is possible to start and stop locking on a VG"""
|
|
||||||
+
|
|
||||||
+ # better not do anything if lvmlockd is running, shared VGs have
|
|
||||||
+ # a tendency to wreak havoc on your system if you look at them wrong
|
|
||||||
+ ret, _out, _err = run_command("systemctl is-active lvmlockd")
|
|
||||||
+ if ret == 0:
|
|
||||||
+ self.skipTest("lvmlockd is running, skipping")
|
|
||||||
+
|
|
||||||
+ _ret, out, _err = run_command("lvm config 'global/use_lvmlockd'")
|
|
||||||
+ if "use_lvmlockd=0" not in out:
|
|
||||||
+ self.skipTest("lvmlockd is enabled, skipping")
|
|
||||||
+
|
|
||||||
+ succ = BlockDev.lvm_pvcreate(self.loop_dev, 0, 0, None)
|
|
||||||
+ self.assertTrue(succ)
|
|
||||||
+
|
|
||||||
+ succ = BlockDev.lvm_pvcreate(self.loop_dev2, 0, 0, None)
|
|
||||||
+ self.assertTrue(succ)
|
|
||||||
+
|
|
||||||
+ succ = BlockDev.lvm_vgcreate("testVG", [self.loop_dev, self.loop_dev2], 0, None)
|
|
||||||
+ self.assertTrue(succ)
|
|
||||||
+
|
|
||||||
+ # this actually doesn't "test" anything, the commands will just say lvmlockd is not
|
|
||||||
+ # running and return 0, but that's good enough for us
|
|
||||||
+ succ = BlockDev.lvm_vglock_start("testVG")
|
|
||||||
+ self.assertTrue(succ)
|
|
||||||
+
|
|
||||||
+ succ = BlockDev.lvm_vglock_stop("testVG")
|
|
||||||
+ self.assertTrue(succ)
|
|
||||||
+
|
|
||||||
class LvmPVVGLVTestCase(LvmPVVGTestCase):
|
|
||||||
def _clean_up(self):
|
|
||||||
try:
|
|
||||||
--
|
|
||||||
2.41.0
|
|
||||||
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
From 2508f4842482b87d26f81afecc7d0b584d6a6fa8 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Thomas Blume <Thomas.Blume@suse.com>
|
|
||||||
Date: Fri, 16 May 2025 14:27:10 +0200
|
|
||||||
Subject: [PATCH] Don't allow suid and dev set on fs resize
|
|
||||||
|
|
||||||
Fixes: CVE-2025-6019
|
|
||||||
---
|
|
||||||
src/plugins/fs/generic.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/plugins/fs/generic.c b/src/plugins/fs/generic.c
|
|
||||||
index ca08d19a..15b55271 100644
|
|
||||||
--- a/src/plugins/fs/generic.c
|
|
||||||
+++ b/src/plugins/fs/generic.c
|
|
||||||
@@ -409,7 +409,7 @@ static gboolean xfs_resize_device (const gchar *device, guint64 new_size, const
|
|
||||||
"before resizing it.", device);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
- ret = bd_fs_mount (device, mountpoint, "xfs", NULL, NULL, error);
|
|
||||||
+ ret = bd_fs_mount (device, mountpoint, "xfs", "nosuid,nodev", NULL, error);
|
|
||||||
if (!ret) {
|
|
||||||
g_prefix_error (error, "Failed to mount '%s' before resizing it: ", device);
|
|
||||||
return FALSE;
|
|
||||||
--
|
|
||||||
2.49.0
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
6
gating.yaml
Normal file
6
gating.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
--- !Policy
|
||||||
|
product_versions:
|
||||||
|
- rhel-10
|
||||||
|
decision_context: osci_compose_gate
|
||||||
|
rules:
|
||||||
|
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
|
||||||
1092
libblockdev.spec
Normal file
1092
libblockdev.spec
Normal file
File diff suppressed because it is too large
Load Diff
1
sources
Normal file
1
sources
Normal file
@ -0,0 +1 @@
|
|||||||
|
SHA512 (libblockdev-3.2.0.tar.gz) = 02a56f566a768a4f4bc68e3e40c80a080cb5ced58675dfae7986f55aea57f887425ebab19d9c2659887d489f08ace082aca0cf97ed3d95e266fb83a236a2f66c
|
||||||
1
tests/.fmf/version
Normal file
1
tests/.fmf/version
Normal file
@ -0,0 +1 @@
|
|||||||
|
1
|
||||||
5
tests/provision.fmf
Normal file
5
tests/provision.fmf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
standard-inventory-qcow2:
|
||||||
|
qemu:
|
||||||
|
m: 3G
|
||||||
38
tests/tests.yml
Normal file
38
tests/tests.yml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
# No tests suitable for atomic environment
|
||||||
|
# No tests suitable for container environment
|
||||||
|
# Tests suitable for classic environment
|
||||||
|
- hosts: localhost
|
||||||
|
roles:
|
||||||
|
- role: standard-test-source
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
|
- role: standard-test-basic
|
||||||
|
tags:
|
||||||
|
- classic
|
||||||
|
tests:
|
||||||
|
- upstream_test_suite:
|
||||||
|
dir: source
|
||||||
|
run: python3 tests/run_tests.py --installed
|
||||||
|
|
||||||
|
required_packages:
|
||||||
|
- cryptsetup
|
||||||
|
- device-mapper-multipath
|
||||||
|
- dosfstools
|
||||||
|
- e2fsprogs
|
||||||
|
- glibc-all-langpacks
|
||||||
|
- lvm2-dbusd
|
||||||
|
- mdadm
|
||||||
|
- ndctl
|
||||||
|
- nss-tools
|
||||||
|
- nvme-cli
|
||||||
|
- nvmetcli
|
||||||
|
- python3-bytesize
|
||||||
|
- python3-dbus
|
||||||
|
- python3-packaging
|
||||||
|
- python3-yaml
|
||||||
|
- targetcli
|
||||||
|
- vdo
|
||||||
|
- volume_key
|
||||||
|
- xfsprogs
|
||||||
Loading…
Reference in New Issue
Block a user