5fed29
From 6a62a81d326a1121a2768735e52a8e1c5e5d6f0d Mon Sep 17 00:00:00 2001
5fed29
From: Vojtech Trefny <vtrefny@redhat.com>
5fed29
Date: Wed, 24 Jun 2020 14:43:47 +0200
5fed29
Subject: [PATCH] Add extra sleep after pvremove call
5fed29
5fed29
To give enough time for the async pvscan to finish scanning the
5fed29
partition before removing it.
5fed29
5fed29
Resolves: rhbz#1640601
5fed29
---
5fed29
 blivet/formats/lvmpv.py | 4 ++++
5fed29
 1 file changed, 4 insertions(+)
5fed29
5fed29
diff --git a/blivet/formats/lvmpv.py b/blivet/formats/lvmpv.py
5fed29
index e4182adb..9f53ec6b 100644
5fed29
--- a/blivet/formats/lvmpv.py
5fed29
+++ b/blivet/formats/lvmpv.py
5fed29
@@ -26,6 +26,7 @@ gi.require_version("BlockDev", "2.0")
5fed29
 from gi.repository import BlockDev as blockdev
5fed29
 
5fed29
 import os
5fed29
+import time
5fed29
 
5fed29
 from ..storage_log import log_method_call
5fed29
 from parted import PARTITION_LVM
5fed29
@@ -137,6 +138,9 @@ class LVMPhysicalVolume(DeviceFormat):
5fed29
             DeviceFormat._destroy(self, **kwargs)
5fed29
         finally:
5fed29
             udev.settle()
5fed29
+            # LVM now has async pvscan jobs so udev.settle doesn't help and if we try to remove
5fed29
+            # the partition immediately after the pvremove we get an error
5fed29
+            time.sleep(5)
5fed29
 
5fed29
     @property
5fed29
     def destroyable(self):
5fed29
-- 
5fed29
2.25.4
5fed29