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