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