Re: [PATCH 4/6] Make PartitionDevice have its own teardown()

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

 



On Wed, 2010-01-20 at 19:03 -0500, Peter Jones wrote:
> This makes PartitionDevice.teardown() remove device-mapper tables when
> appropriate, so devices using them don't have to clean up the partition
> and all the conditional testing that comes with that.

Ack.

> ---
>  storage/devices.py |   19 +++++++++++++++++++
>  1 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/storage/devices.py b/storage/devices.py
> index 3bb0991..237fc75 100644
> --- a/storage/devices.py
> +++ b/storage/devices.py
> @@ -1314,6 +1314,25 @@ class PartitionDevice(StorageDevice):
>  
>          self.exists = False
>  
> +    def teardown(self, recursive=None):
> +        """ Close, or tear down, a device. """
> +        log_method_call(self, self.name, status=self.status)
> +        if not self.exists and not recursive:
> +            raise DeviceError("device has not been created", self.name)
> +
> +        if self.status:
> +            if self.format.exists:
> +                self.format.teardown()
> +            devmap = block.getMap(major=self.major, minor=self.minor)
> +            if devmap:
> +                try:
> +                    block.removeDeviceMap(devmap)
> +                except Exception as e:
> +                    raise PartitioningError("failed to tear down device-mapper partition %s: %s" % (self.name, e))
> +
> +            udev_settle()
> +        StorageDevice.teardown(self, recursive=recursive)
> +
>      def _getSize(self):
>          """ Get the device's size. """
>          size = self._size


_______________________________________________
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