From 29141cb0580c190122c9db448f1433d10f657bd4 Mon Sep 17 00:00:00 2001
From: David Lehman <dlehman@redhat.com>
Date: Tue, 5 Aug 2014 12:39:56 -0500
Subject: [PATCH 15/18] Stop generating change uevents from blivet.

The various tools making the actual changes should be generating them.
---
 blivet/devices/storage.py  | 17 -----------------
 blivet/formats/__init__.py | 27 ---------------------------
 blivet/formats/fs.py       |  4 ----
 blivet/formats/luks.py     |  2 --
 blivet/formats/lvmpv.py    |  2 --
 blivet/formats/swap.py     |  1 -
 6 files changed, 53 deletions(-)

diff --git a/blivet/devices/storage.py b/blivet/devices/storage.py
index c05fbb6..71f9683 100644
--- a/blivet/devices/storage.py
+++ b/blivet/devices/storage.py
@@ -315,23 +315,6 @@ class StorageDevice(Device):
                 (self.format.type is None or self.format.resizable or
                  not self.format.exists))
 
-    def notifyKernel(self):
-        """ Send a 'change' uevent to the kernel for this device. """
-        log_method_call(self, self.name, status=self.status)
-        if not self.exists:
-            log.debug("not sending change uevent for non-existent device")
-            return
-
-        if not self.status:
-            log.debug("not sending change uevent for inactive device")
-            return
-
-        path = os.path.normpath(self.sysfsPath)
-        try:
-            util.notify_kernel(path, action="change")
-        except (ValueError, IOError) as e:
-            log.warning("failed to notify kernel of change: %s", e)
-
     @property
     def fstabSpec(self):
         spec = self.path
diff --git a/blivet/formats/__init__.py b/blivet/formats/__init__.py
index 46b7825..06234b9 100644
--- a/blivet/formats/__init__.py
+++ b/blivet/formats/__init__.py
@@ -326,33 +326,6 @@ class DeviceFormat(ObjectID):
     def type(self):
         return self._type
 
-    def notifyKernel(self):
-        log_method_call(self, device=self.device,
-                        type=self.type)
-        if not self.device:
-            return
-
-        if self.device.startswith("/dev/mapper/"):
-            try:
-                name = dm_node_from_name(os.path.basename(self.device))
-            except DMError:
-                log.warning("failed to get dm node for %s", self.device)
-                return
-        elif self.device.startswith("/dev/md/"):
-            try:
-                name = md_node_from_name(os.path.basename(self.device))
-            except MDRaidError:
-                log.warning("failed to get md node for %s", self.device)
-                return
-        else:
-            name = self.device
-
-        path = get_sysfs_path_by_name(name)
-        try:
-            notify_kernel(path, action="change")
-        except (ValueError, IOError) as e:
-            log.warning("failed to notify kernel of change: %s", e)
-
     def create(self, **kwargs):
         """ Write the formatting to the specified block device.
 
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 69ead04..7de3c90 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -422,7 +422,6 @@ class FS(DeviceFormat):
             raise FormatCreateError("format failed: %s" % ret, self.device)
 
         self.exists = True
-        self.notifyKernel()
 
         if self.label is not None and self.relabels():
             try:
@@ -519,7 +518,6 @@ class FS(DeviceFormat):
 
         # XXX must be a smarter way to do this
         self._size = self.targetSize
-        self.notifyKernel()
 
     def _getCheckArgs(self):
         argv = []
@@ -745,8 +743,6 @@ class FS(DeviceFormat):
         if rc:
             raise FSError("label failed")
 
-        self.notifyKernel()
-
     @property
     def mkfsProg(self):
         """ Program used to create filesystems of this type. """
diff --git a/blivet/formats/luks.py b/blivet/formats/luks.py
index 03af88f..f7442c7 100644
--- a/blivet/formats/luks.py
+++ b/blivet/formats/luks.py
@@ -238,8 +238,6 @@ class LUKS(DeviceFormat):
             if flags.installer_mode:
                 self.mapName = "luks-%s" % self.uuid
 
-            self.notifyKernel()
-
     def destroy(self, **kwargs):
         """ Remove the formatting from the associated block device.
 
diff --git a/blivet/formats/lvmpv.py b/blivet/formats/lvmpv.py
index efda438..8b85cdf 100644
--- a/blivet/formats/lvmpv.py
+++ b/blivet/formats/lvmpv.py
@@ -125,7 +125,6 @@ class LVMPhysicalVolume(DeviceFormat):
             lvm.pvscan(self.device)
 
         self.exists = True
-        self.notifyKernel()
 
     def destroy(self, **kwargs):
         """ Remove the formatting from the associated block device.
@@ -150,7 +149,6 @@ class LVMPhysicalVolume(DeviceFormat):
             lvm.pvscan(self.device)
 
         self.exists = False
-        self.notifyKernel()
 
     @property
     def status(self):
diff --git a/blivet/formats/swap.py b/blivet/formats/swap.py
index bb3eaff..2d96e34 100644
--- a/blivet/formats/swap.py
+++ b/blivet/formats/swap.py
@@ -195,7 +195,6 @@ class SwapSpace(DeviceFormat):
             raise
         else:
             self.exists = True
-            self.notifyKernel()
 
 register_device_format(SwapSpace)
 
-- 
1.9.3

