[PATCH 2/2] Don't copy _raidSet, but merely pass around a reference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



block.dmraid.RaidSet keeps track of the state of the devicemaps and will
try to add / remove maps when activating / deactivating the set depending
on its internal state, shallow copying it copies this state, creating
2 copies of it, which can result in trying to bring the set up or down
twice, which causes a backtrace.
---
 storage/devices.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index 4fb1158..8d23b86 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -237,9 +237,12 @@ class Device(object):
         """
         new = self.__class__.__new__(self.__class__)
         memo[id(self)] = new
-        shallow_copy_attrs = ('_partedDevice', '_partedPartition', '_raidSet')
+        dont_copy_attrs = ('_raidSet',)
+        shallow_copy_attrs = ('_partedDevice', '_partedPartition')
         for (attr, value) in self.__dict__.items():
-            if attr in shallow_copy_attrs:
+            if attr in dont_copy_attrs:
+                setattr(new, attr, value)
+            elif attr in shallow_copy_attrs:
                 setattr(new, attr, copy.copy(value))
             else:
                 setattr(new, attr, copy.deepcopy(value, memo))
-- 
1.6.5.rc2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux