From 884e0676ce7109b6db37aaef3e8f954ce5d20393 Mon Sep 17 00:00:00 2001
From: David Lehman <dlehman@redhat.com>
Date: Fri, 7 Mar 2014 16:45:15 -0600
Subject: [PATCH 3/6] Adapt callers to new method names for add/remove member
 device.

---
 blivet/devicefactory.py | 26 +++++++++++++-------------
 blivet/devicetree.py    | 10 +++++-----
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py
index d1e4779..9d752bf 100644
--- a/blivet/devicefactory.py
+++ b/blivet/devicefactory.py
@@ -482,11 +482,11 @@ class DeviceFactory(object):
         log.debug("old member set: %s" % [d.name for d in self.container.parents])
         for member in self.container.parents[:]:
             if member not in members:
-                self.container.removeMember(member)
+                self.container._removeMember(member)
 
         for member in members:
             if member not in self.container.parents:
-                self.container.addMember(member)
+                self.container._addMember(member)
 
     def _set_container_raid_level(self):
         pass
@@ -650,15 +650,15 @@ class DeviceFactory(object):
             raw_device = self.raw_device
             leaf_format = self.device.format
             if parent_container:
-                parent_container.removeMember(self.device)
+                parent_container._removeMember(self.device)
             self.storage.destroyDevice(self.device)
             self.storage.formatDevice(self.raw_device, leaf_format)
             self.device = raw_device
             if parent_container:
-                parent_container.addMember(self.device)
+                parent_container._addMember(self.device)
         elif self.encrypted and not isinstance(self.device, LUKSDevice):
             if parent_container:
-                parent_container.removeMember(self.device)
+                parent_container._removeMember(self.device)
             leaf_format = self.device.format
             self.storage.formatDevice(self.device, getFormat("luks"))
             luks_device = LUKSDevice("luks-%s" % self.device.name,
@@ -667,7 +667,7 @@ class DeviceFactory(object):
             self.storage.createDevice(luks_device)
             self.device = luks_device
             if parent_container:
-                parent_container.addMember(self.device)
+                parent_container._addMember(self.device)
 
     def _set_name(self):
         if not self.device_name:
@@ -971,7 +971,7 @@ class PartitionSetFactory(PartitionFactory):
         for member in members[:]:
             if any([d in remove_disks for d in member.disks]):
                 if container:
-                    container.removeMember(member)
+                    container._removeMember(member)
 
                 if isinstance(member, LUKSDevice):
                     self.storage.destroyDevice(member)
@@ -989,7 +989,7 @@ class PartitionSetFactory(PartitionFactory):
             member_encrypted = isinstance(member, LUKSDevice)
             if member_encrypted and not self.encrypted:
                 if container:
-                    container.removeMember(member)
+                    container._removeMember(member)
 
                 self.storage.destroyDevice(member)
                 members.remove(member)
@@ -997,14 +997,14 @@ class PartitionSetFactory(PartitionFactory):
                                           getFormat(self.fstype))
                 members.append(member.slave)
                 if container:
-                    container.addMember(member.slave)
+                    container._addMember(member.slave)
 
                 continue
 
             if not member_encrypted and self.encrypted:
                 members.remove(member)
                 if container:
-                    container.removeMember(member)
+                    container._removeMember(member)
 
                 self.storage.formatDevice(member, getFormat("luks"))
                 luks_member = LUKSDevice("luks-%s" % member.name,
@@ -1013,7 +1013,7 @@ class PartitionSetFactory(PartitionFactory):
                 self.storage.createDevice(luks_member)
                 members.append(luks_member)
                 if container:
-                    container.addMember(luks_member)
+                    container._addMember(luks_member)
 
                 continue
 
@@ -1058,7 +1058,7 @@ class PartitionSetFactory(PartitionFactory):
             members.append(member)
             new_members.append(member)
             if container:
-                container.addMember(member)
+                container._addMember(member)
 
         ##
         ## Determine target container size.
@@ -1272,7 +1272,7 @@ class LVMFactory(DeviceFactory):
 
                 if ((self.container_raid_level and use_dev.type != "mdarray") or
                     (not self.container_raid_level and use_dev.type == "mdarray")):
-                    self.container.removeMember(member)
+                    self.container._removeMember(member)
                     self.storage.destroyDevice(member)
                     if member != use_dev:
                         self.storage.destroyDevice(use_dev)
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index c166e3d..18516ec 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -1474,7 +1474,7 @@ class DeviceTree(object):
 
         vg_device = self.getDeviceByUuid(vg_uuid, incomplete=True)
         if vg_device:
-            vg_device._addDevice(device)
+            vg_device._addMember(device)
         else:
             try:
                 vg_size = udev_device_get_vg_size(info)
@@ -1539,7 +1539,7 @@ class DeviceTree(object):
 
         md_array = self.getDeviceByUuid(device.format.mdUuid, incomplete=True)
         if device.format.mdUuid and md_array:
-            md_array._addDevice(device)
+            md_array._addMember(device)
         else:
             # create the array with just this one member
             try:
@@ -1614,7 +1614,7 @@ class DeviceTree(object):
                 return
 
             md_array.updateSysfsPath()
-            md_array._addDevice(device)
+            md_array._addMember(device)
             self._addDevice(md_array)
 
     def handleUdevDMRaidMemberFormat(self, info, device):
@@ -1645,7 +1645,7 @@ class DeviceTree(object):
             dm_array = self.getDeviceByName(rs.name, incomplete=True)
             if dm_array is not None:
                 # We add the new device.
-                dm_array._addDevice(device)
+                dm_array._addMember(device)
             else:
                 # Activate the Raid set.
                 rs.activate(mknod=True)
@@ -1687,7 +1687,7 @@ class DeviceTree(object):
 
         if btrfs_dev:
             log.info("found btrfs volume %s" % btrfs_dev.name)
-            btrfs_dev._addDevice(device)
+            btrfs_dev._addMember(device)
         else:
             label = udev_device_get_label(info)
             log.info("creating btrfs volume btrfs.%s" % label)
-- 
1.8.5.3

