[blivet:master 14/16] Change all 'format' keyword args to 'fmt' in Device constructors

mulhern amulhern at redhat.com
Thu May 1 13:08:51 UTC 2014


Change all calls appropriately and also change any invoking methods
that use same keyword args.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/__init__.py         |  62 ++++++++------------
 blivet/devicefactory.py    |   8 +--
 blivet/devices.py          | 140 ++++++++++++++++++++++-----------------------
 blivet/devicetree.py       |   4 +-
 blivet/partitioning.py     |   4 +-
 tests/devices_test.py      |  18 +++---
 tests/sanity_check_test.py |   4 +-
 7 files changed, 112 insertions(+), 128 deletions(-)

diff --git a/blivet/__init__.py b/blivet/__init__.py
index fe2a153..9f94300 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -955,7 +955,7 @@ class Blivet(object):
             :class:`~.devices.PartitionDevice` constructor.
         """
         if kwargs.has_key("fmt_type"):
-            kwargs["format"] = getFormat(kwargs.pop("fmt_type"),
+            kwargs["fmt"] = getFormat(kwargs.pop("fmt_type"),
                                          mountpoint=kwargs.pop("mountpoint",
                                                                None),
                                          **kwargs.pop("fmt_args", {}))
@@ -966,7 +966,7 @@ class Blivet(object):
             name = "req%d" % self.nextID
 
         if "weight" not in kwargs:
-            fmt = kwargs.get("format")
+            fmt = kwargs.get("fmt")
             if fmt:
                 mountpoint = getattr(fmt, "mountpoint", None)
 
@@ -995,7 +995,7 @@ class Blivet(object):
             format type, mountpoint, hostname, and/or product name.
         """
         if kwargs.has_key("fmt_type"):
-            kwargs["format"] = getFormat(kwargs.pop("fmt_type"),
+            kwargs["fmt"] = getFormat(kwargs.pop("fmt_type"),
                                          mountpoint=kwargs.pop("mountpoint",
                                                                None),
                                          **kwargs.pop("fmt_args", {}))
@@ -1008,8 +1008,8 @@ class Blivet(object):
                                 safe_name, name)
                 name = safe_name
         else:
-            swap = getattr(kwargs.get("format"), "type", None) == "swap"
-            mountpoint = getattr(kwargs.get("format"), "mountpoint", None)
+            swap = getattr(kwargs.get("fmt"), "type", None) == "swap"
+            mountpoint = getattr(kwargs.get("fmt"), "mountpoint", None)
             name = self.suggestDeviceName(prefix=shortProductName,
                                           swap=swap,
                                           mountpoint=mountpoint)
@@ -1088,7 +1088,7 @@ class Blivet(object):
 
         mountpoint = kwargs.pop("mountpoint", None)
         if kwargs.has_key("fmt_type"):
-            kwargs["format"] = getFormat(kwargs.pop("fmt_type"),
+            kwargs["fmt"] = getFormat(kwargs.pop("fmt_type"),
                                          mountpoint=mountpoint,
                                          **kwargs.pop("fmt_args", {}))
 
@@ -1104,7 +1104,7 @@ class Blivet(object):
                                 new_name, name)
                 name = new_name
         else:
-            if kwargs.get("format") and kwargs["format"].type == "swap":
+            if kwargs.get("fmt") and kwargs["fmt"].type == "swap":
                 swap = True
             else:
                 swap = False
@@ -2354,70 +2354,54 @@ class FSSet(object):
     @property
     def sysfs(self):
         if not self._sysfs:
-            self._sysfs = NoDevice(format=getFormat("sysfs",
-                                                    device="sysfs",
-                                                    mountpoint="/sys"))
+            self._sysfs = NoDevice(fmt=getFormat("sysfs", device="sysfs", mountpoint="/sys"))
         return self._sysfs
 
     @property
     def dev(self):
         if not self._dev:
-            self._dev = DirectoryDevice("/dev", format=getFormat("bind",
-                                                                 device="/dev",
-                                                                 mountpoint="/dev",
-                                                                 exists=True),
-                                        exists=True)
+            self._dev = DirectoryDevice("/dev",
+               fmt=getFormat("bind", device="/dev", mountpoint="/dev", exists=True),
+               exists=True)
 
         return self._dev
 
     @property
     def devpts(self):
         if not self._devpts:
-            self._devpts = NoDevice(format=getFormat("devpts",
-                                                     device="devpts",
-                                                     mountpoint="/dev/pts"))
+            self._devpts = NoDevice(fmt=getFormat("devpts", device="devpts", mountpoint="/dev/pts"))
         return self._devpts
 
     @property
     def proc(self):
         if not self._proc:
-            self._proc = NoDevice(format=getFormat("proc",
-                                                   device="proc",
-                                                   mountpoint="/proc"))
+            self._proc = NoDevice(fmt=getFormat("proc", device="proc", mountpoint="/proc"))
         return self._proc
 
     @property
     def devshm(self):
         if not self._devshm:
-            self._devshm = NoDevice(format=getFormat("tmpfs",
-                                                     device="tmpfs",
-                                                     mountpoint="/dev/shm"))
+            self._devshm = NoDevice(fmt=getFormat("tmpfs", device="tmpfs", mountpoint="/dev/shm"))
         return self._devshm
 
     @property
     def usb(self):
         if not self._usb:
-            self._usb = NoDevice(format=getFormat("usbfs",
-                                                  device="usbfs",
-                                                  mountpoint="/proc/bus/usb"))
+            self._usb = NoDevice(fmt=getFormat("usbfs", device="usbfs", mountpoint="/proc/bus/usb"))
         return self._usb
 
     @property
     def selinux(self):
         if not self._selinux:
-            self._selinux = NoDevice(format=getFormat("selinuxfs",
-                                                      device="selinuxfs",
-                                                      mountpoint="/sys/fs/selinux"))
+            self._selinux = NoDevice(fmt=getFormat("selinuxfs", device="selinuxfs", mountpoint="/sys/fs/selinux"))
         return self._selinux
 
     @property
     def run(self):
         if not self._run:
-            self._run = DirectoryDevice("/run", format=getFormat("bind",
-                                                                 device="/run",
-                                                                 mountpoint="/run",
-                                                                 exists=True),
-                                        exists=True)
+            self._run = DirectoryDevice("/run",
+               fmt=getFormat("bind", device="/run", mountpoint="/run", exists=True),
+               exists=True)
 
         return self._run
 
@@ -2463,14 +2447,14 @@ class FSSet(object):
         elif ":" in devspec and fstype.startswith("nfs"):
             # NFS -- preserve but otherwise ignore
             device = NFSDevice(devspec,
-                               format=getFormat(fstype,
+                               fmt=getFormat(fstype,
                                                 exists=True,
                                                 device=devspec))
         elif devspec.startswith("/") and fstype == "swap":
             # swap file
             device = FileDevice(devspec,
                                 parents=get_containing_device(devspec, self.devicetree),
-                                format=getFormat(fstype,
+                                fmt=getFormat(fstype,
                                                  device=devspec,
                                                  exists=True),
                                 exists=True)
@@ -2498,7 +2482,7 @@ class FSSet(object):
             fmt_class = get_device_format_class("nodev")
             if devspec == "none" or \
                (fmt_class and isinstance(fmt, fmt_class)):
-                device = NoDevice(format=fmt)
+                device = NoDevice(fmt=fmt)
 
         if device is None:
             log.error("failed to resolve %s (%s) from fstab", devspec,
@@ -2740,7 +2724,7 @@ class FSSet(object):
         dev = FileDevice(filename,
                          size=size,
                          parents=[device],
-                         format=getFormat("swap", device=filename))
+                         fmt=getFormat("swap", device=filename))
         dev.create()
         dev.setup()
         dev.format.create()
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py
index 07ae97d..30b8efb 100644
--- a/blivet/devicefactory.py
+++ b/blivet/devicefactory.py
@@ -582,7 +582,7 @@ class DeviceFactory(object):
                             mountpoint=self.mountpoint,
                             **fmt_args)
             luks_device = LUKSDevice("luks-" + device.name,
-                                     parents=[device], format=fmt)
+                                     parents=[device], fmt=fmt)
             self.storage.createDevice(luks_device)
             ret = luks_device
 
@@ -660,7 +660,7 @@ class DeviceFactory(object):
             leaf_format = self.device.format
             self.storage.formatDevice(self.device, getFormat("luks"))
             luks_device = LUKSDevice("luks-%s" % self.device.name,
-                                     format=leaf_format,
+                                     fmt=leaf_format,
                                      parents=self.device)
             self.storage.createDevice(luks_device)
             self.device = luks_device
@@ -1004,7 +1004,7 @@ class PartitionSetFactory(PartitionFactory):
                 self.storage.formatDevice(member, getFormat("luks"))
                 luks_member = LUKSDevice("luks-%s" % member.name,
                                     parents=[member],
-                                    format=getFormat(self.fstype))
+                                    fmt=getFormat(self.fstype))
                 self.storage.createDevice(luks_member)
                 members.append(luks_member)
                 if container:
@@ -1047,7 +1047,7 @@ class PartitionSetFactory(PartitionFactory):
             if self.encrypted:
                 fmt = getFormat(self.fstype)
                 member = LUKSDevice("luks-%s" % member.name,
-                                    parents=[member], format=fmt)
+                                    parents=[member], fmt=fmt)
                 self.storage.createDevice(member)
 
             members.append(member)
diff --git a/blivet/devices.py b/blivet/devices.py
index 6778546..7abf6c8 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -497,7 +497,7 @@ class StorageDevice(Device):
     _partitionable = False
     _isDisk = False
 
-    def __init__(self, name, format=None, uuid=None,
+    def __init__(self, name, fmt=None, uuid=None,
                  size=None, major=None, minor=None,
                  sysfsPath='', parents=None, exists=False, serial=None,
                  vendor="", model="", bus=""):
@@ -510,8 +510,8 @@ class StorageDevice(Device):
             :type size: :class:`~.size.Size`
             :keyword parents: a list of parent devices
             :type parents: list of :class:`StorageDevice`
-            :keyword format: this device's formatting
-            :type format: :class:`~.formats.DeviceFormat` or a subclass of it
+            :keyword fmt: this device's formatting
+            :type fmt: :class:`~.formats.DeviceFormat` or a subclass of it
             :keyword uuid: universally unique identifier (device -- not fs)
             :type uuid: str
             :keyword sysfsPath: sysfs device path
@@ -551,7 +551,7 @@ class StorageDevice(Device):
         self.protected = False
         self.controllable = not flags.testing
 
-        self.format = format
+        self.format = fmt
         self.originalFormat = copy.copy(self.format)
         self.fstabComment = ""
         self._targetSize = self._size
@@ -1094,7 +1094,7 @@ class DiskDevice(StorageDevice):
     _partitionable = True
     _isDisk = True
 
-    def __init__(self, name, format=None,
+    def __init__(self, name, fmt=None,
                  size=None, major=None, minor=None, sysfsPath='',
                  parents=None, serial=None, vendor="", model="", bus="",
                  exists=True):
@@ -1105,8 +1105,8 @@ class DiskDevice(StorageDevice):
             :type size: :class:`~.size.Size`
             :keyword parents: a list of parent devices
             :type parents: list of :class:`StorageDevice`
-            :keyword format: this device's formatting
-            :type format: :class:`~.formats.DeviceFormat` or a subclass of it
+            :keyword fmt: this device's formatting
+            :type fmt: :class:`~.formats.DeviceFormat` or a subclass of it
             :keyword uuid: universally unique identifier (device -- not fs)
             :type uuid: str
             :keyword sysfsPath: sysfs device path
@@ -1124,7 +1124,7 @@ class DiskDevice(StorageDevice):
 
             DiskDevices always exist.
         """
-        StorageDevice.__init__(self, name, format=format, size=size,
+        StorageDevice.__init__(self, name, fmt=fmt, size=size,
                                major=major, minor=minor, exists=exists,
                                sysfsPath=sysfsPath, parents=parents,
                                serial=serial, model=model,
@@ -1181,7 +1181,7 @@ class PartitionDevice(StorageDevice):
     _resizable = True
     defaultSize = Size(spec="500MiB")
 
-    def __init__(self, name, format=None,
+    def __init__(self, name, fmt=None,
                  size=None, grow=False, maxsize=None, start=None, end=None,
                  major=None, minor=None, bootable=None,
                  sysfsPath='', parents=None, exists=False,
@@ -1195,8 +1195,8 @@ class PartitionDevice(StorageDevice):
             :type size: :class::class:`~.size.Size`
             :keyword parents: a list of parent devices
             :type parents: list of :class:`StorageDevice`
-            :keyword format: this device's formatting
-            :type format: :class:`~.formats.DeviceFormat` or a subclass of it
+            :keyword fmt: this device's formatting
+            :type fmt: :class:`~.formats.DeviceFormat` or a subclass of it
 
             For existing partitions only:
 
@@ -1245,7 +1245,7 @@ class PartitionDevice(StorageDevice):
 
         self._bootable = False
 
-        StorageDevice.__init__(self, name, format=format, size=size,
+        StorageDevice.__init__(self, name, fmt=fmt, size=size,
                                major=major, minor=minor, exists=exists,
                                sysfsPath=sysfsPath, parents=parents)
 
@@ -1874,7 +1874,7 @@ class DMDevice(StorageDevice):
     _type = "dm"
     _devDir = "/dev/mapper"
 
-    def __init__(self, name, format=None, size=None, dmUuid=None, uuid=None,
+    def __init__(self, name, fmt=None, size=None, dmUuid=None, uuid=None,
                  target=None, exists=False, parents=None, sysfsPath=''):
         """
             :param name: the device name (generally a device node's basename)
@@ -1885,8 +1885,8 @@ class DMDevice(StorageDevice):
             :type size: :class:`~.size.Size`
             :keyword parents: a list of parent devices
             :type parents: list of :class:`StorageDevice`
-            :keyword format: this device's formatting
-            :type format: :class:`~.formats.DeviceFormat` or a subclass of it
+            :keyword fmt: this device's formatting
+            :type fmt: :class:`~.formats.DeviceFormat` or a subclass of it
             :keyword sysfsPath: sysfs device path
             :type sysfsPath: str
             :keyword dmUuid: device-mapper UUID (see note below)
@@ -1901,7 +1901,7 @@ class DMDevice(StorageDevice):
                 map name in many cases. The uuid, however, is a persistent UUID
                 stored in device metadata on disk.
         """
-        StorageDevice.__init__(self, name, format=format, size=size,
+        StorageDevice.__init__(self, name, fmt=fmt, size=size,
                                exists=exists, uuid=uuid,
                                parents=parents, sysfsPath=sysfsPath)
         self.target = target
@@ -1996,7 +1996,7 @@ class DMLinearDevice(DMDevice):
     _partitionable = True
     _isDisk = True
 
-    def __init__(self, name, format=None, size=None, dmUuid=None,
+    def __init__(self, name, fmt=None, size=None, dmUuid=None,
                  exists=False, parents=None, sysfsPath=''):
         """
             :param name: the device name (generally a device node's basename)
@@ -2007,8 +2007,8 @@ class DMLinearDevice(DMDevice):
             :type size: :class:`~.size.Size`
             :keyword parents: a list of parent devices
             :type parents: list of :class:`StorageDevice`
-            :keyword format: this device's formatting
-            :type format: :class:`~.formats.DeviceFormat` or a subclass of it
+            :keyword fmt: this device's formatting
+            :type fmt: :class:`~.formats.DeviceFormat` or a subclass of it
             :keyword sysfsPath: sysfs device path
             :type sysfsPath: str
             :keyword dmUuid: device-mapper UUID
@@ -2017,7 +2017,7 @@ class DMLinearDevice(DMDevice):
         if not parents:
             raise ValueError("DMLinearDevice requires a backing block device")
 
-        DMDevice.__init__(self, name, format=format, size=size,
+        DMDevice.__init__(self, name, fmt=fmt, size=size,
                           parents=parents, sysfsPath=sysfsPath,
                           exists=exists, target="linear", dmUuid=dmUuid)
 
@@ -2061,7 +2061,7 @@ class DMCryptDevice(DMDevice):
     """ A dm-crypt device """
     _type = "dm-crypt"
 
-    def __init__(self, name, format=None, size=None, uuid=None,
+    def __init__(self, name, fmt=None, size=None, uuid=None,
                  exists=False, sysfsPath='', parents=None):
         """
             :param name: the device name (generally a device node's basename)
@@ -2072,12 +2072,12 @@ class DMCryptDevice(DMDevice):
             :type size: :class:`~.size.Size`
             :keyword parents: a list of parent devices
             :type parents: list of :class:`StorageDevice`
-            :keyword format: this device's formatting
-            :type format: :class:`~.formats.DeviceFormat` or a subclass of it
+            :keyword fmt: this device's formatting
+            :type fmt: :class:`~.formats.DeviceFormat` or a subclass of it
             :keyword sysfsPath: sysfs device path
             :type sysfsPath: str
         """
-        DMDevice.__init__(self, name, format=format, size=size,
+        DMDevice.__init__(self, name, fmt=fmt, size=size,
                           parents=parents, sysfsPath=sysfsPath,
                           exists=exists, target="crypt")
 
@@ -2086,7 +2086,7 @@ class LUKSDevice(DMCryptDevice):
     _type = "luks/dm-crypt"
     _packages = ["cryptsetup"]
 
-    def __init__(self, name, format=None, size=None, uuid=None,
+    def __init__(self, name, fmt=None, size=None, uuid=None,
                  exists=False, sysfsPath='', parents=None):
         """
             :param name: the device name (generally a device node's basename)
@@ -2097,14 +2097,14 @@ class LUKSDevice(DMCryptDevice):
             :type size: :class:`~.size.Size`
             :keyword parents: a list of parent devices
             :type parents: list of :class:`StorageDevice`
-            :keyword format: this device's formatting
-            :type format: :class:`~.formats.DeviceFormat` or a subclass of it
+            :keyword fmt: this device's formatting
+            :type fmt: :class:`~.formats.DeviceFormat` or a subclass of it
             :keyword sysfsPath: sysfs device path
             :type sysfsPath: str
             :keyword uuid: the device UUID
             :type uuid: str
         """
-        DMCryptDevice.__init__(self, name, format=format, size=size,
+        DMCryptDevice.__init__(self, name, fmt=fmt, size=size,
                                parents=parents, sysfsPath=sysfsPath,
                                uuid=None, exists=exists)
 
@@ -2647,7 +2647,7 @@ class LVMLogicalVolumeDevice(DMDevice):
 
     def __init__(self, name, parents=None, size=None, uuid=None,
                  copies=1, logSize=0, snapshotSpace=0, segType=None,
-                 format=None, exists=False, sysfsPath='',
+                 fmt=None, exists=False, sysfsPath='',
                  grow=None, maxsize=None, percent=None,
                  singlePV=False):
         """
@@ -2659,8 +2659,8 @@ class LVMLogicalVolumeDevice(DMDevice):
             :type size: :class:`~.size.Size`
             :keyword parents: a list of parent devices
             :type parents: list of :class:`StorageDevice`
-            :keyword format: this device's formatting
-            :type format: :class:`~.formats.DeviceFormat` or a subclass of it
+            :keyword fmt: this device's formatting
+            :type fmt: :class:`~.formats.DeviceFormat` or a subclass of it
             :keyword sysfsPath: sysfs device path
             :type sysfsPath: str
             :keyword uuid: the device UUID
@@ -2697,7 +2697,7 @@ class LVMLogicalVolumeDevice(DMDevice):
                     raise ValueError("constructor requires a LVMVolumeGroupDevice instance")
             elif not isinstance(parents, LVMVolumeGroupDevice):
                 raise ValueError("constructor requires a LVMVolumeGroupDevice instance")
-        DMDevice.__init__(self, name, size=size, format=format,
+        DMDevice.__init__(self, name, size=size, fmt=fmt,
                           sysfsPath=sysfsPath, parents=parents,
                           exists=exists)
 
@@ -2981,7 +2981,7 @@ class LVMThinPoolDevice(LVMLogicalVolumeDevice):
     _resizable = False
 
     def __init__(self, name, parents=None, size=None, uuid=None,
-                 format=None, exists=False, sysfsPath='',
+                 fmt=None, exists=False, sysfsPath='',
                  grow=None, maxsize=None, percent=None,
                  metadatasize=None, chunksize=None, segType=None):
         """
@@ -2993,8 +2993,8 @@ class LVMThinPoolDevice(LVMLogicalVolumeDevice):
             :type size: :class:`~.size.Size`
             :keyword parents: a list of parent devices
             :type parents: list of :class:`StorageDevice`
-            :keyword format: this device's formatting
-            :type format: :class:`~.formats.DeviceFormat` or a subclass of it
+            :keyword fmt: this device's formatting
+            :type fmt: :class:`~.formats.DeviceFormat` or a subclass of it
             :keyword sysfsPath: sysfs device path
             :type sysfsPath: str
             :keyword uuid: the device UUID
@@ -3025,7 +3025,7 @@ class LVMThinPoolDevice(LVMLogicalVolumeDevice):
 
         super(LVMThinPoolDevice, self).__init__(name, parents=parents,
                                                 size=size, uuid=uuid,
-                                                format=format, exists=exists,
+                                                fmt=fmt, exists=exists,
                                                 sysfsPath=sysfsPath, grow=grow,
                                                 maxsize=maxsize,
                                                 percent=percent,
@@ -3147,7 +3147,7 @@ class MDRaidArrayDevice(ContainerDevice):
 
     def __init__(self, name, level=None, major=None, minor=None, size=None,
                  memberDevices=None, totalDevices=None,
-                 uuid=None, format=None, exists=False, metadataVersion=None,
+                 uuid=None, fmt=None, exists=False, metadataVersion=None,
                  parents=None, sysfsPath=''):
         """
             :param name: the device name (generally a device node's basename)
@@ -3158,8 +3158,8 @@ class MDRaidArrayDevice(ContainerDevice):
             :type size: :class:`~.size.Size`
             :keyword parents: a list of parent devices
             :type parents: list of :class:`StorageDevice`
-            :keyword format: this device's formatting
-            :type format: :class:`~.formats.DeviceFormat` or a subclass of it
+            :keyword fmt: this device's formatting
+            :type fmt: :class:`~.formats.DeviceFormat` or a subclass of it
             :keyword sysfsPath: sysfs device path
             :type sysfsPath: str
             :keyword uuid: the device UUID
@@ -3181,7 +3181,7 @@ class MDRaidArrayDevice(ContainerDevice):
         self._memberDevices = 0     # the number of active (non-spare) members
         self._totalDevices = 0      # the total number of members
 
-        super(MDRaidArrayDevice, self).__init__(name, format=format, uuid=uuid,
+        super(MDRaidArrayDevice, self).__init__(name, fmt=fmt, uuid=uuid,
                                                 exists=exists, size=size,
                                                 parents=parents,
                                                 sysfsPath=sysfsPath)
@@ -3684,7 +3684,7 @@ class DMRaidArrayDevice(DMDevice, ContainerDevice):
     _formatClassName = property(lambda s: "dmraidmember")
     _formatUUIDAttr = property(lambda s: None)
 
-    def __init__(self, name, raidSet=None, format=None,
+    def __init__(self, name, raidSet=None, fmt=None,
                  size=None, parents=None, sysfsPath=''):
         """
             :param name: the device name (generally a device node's basename)
@@ -3693,8 +3693,8 @@ class DMRaidArrayDevice(DMDevice, ContainerDevice):
             :type size: :class:`~.size.Size`
             :keyword parents: a list of parent devices
             :type parents: list of :class:`StorageDevice`
-            :keyword format: this device's formatting
-            :type format: :class:`~.formats.DeviceFormat` or a subclass of it
+            :keyword fmt: this device's formatting
+            :type fmt: :class:`~.formats.DeviceFormat` or a subclass of it
             :keyword sysfsPath: sysfs device path
             :type sysfsPath: str
             :keyword raidSet: the RaidSet object from block
@@ -3703,7 +3703,7 @@ class DMRaidArrayDevice(DMDevice, ContainerDevice):
             DMRaidArrayDevices always exist. Blivet cannot create or destroy
             them.
         """
-        super(DMRaidArrayDevice, self).__init__(name, format=format, size=size,
+        super(DMRaidArrayDevice, self).__init__(name, fmt=fmt, size=size,
                                                 parents=parents, exists=True,
                                                 sysfsPath=sysfsPath)
 
@@ -3775,7 +3775,7 @@ class MultipathDevice(DMDevice):
     _partitionable = True
     _isDisk = True
 
-    def __init__(self, name, format=None, size=None, serial=None,
+    def __init__(self, name, fmt=None, size=None, serial=None,
                  parents=None, sysfsPath=''):
         """
             :param name: the device name (generally a device node's basename)
@@ -3784,8 +3784,8 @@ class MultipathDevice(DMDevice):
             :type size: :class:`~.size.Size`
             :keyword parents: a list of parent devices
             :type parents: list of :class:`StorageDevice`
-            :keyword format: this device's formatting
-            :type format: :class:`~.formats.DeviceFormat` or a subclass of it
+            :keyword fmt: this device's formatting
+            :type fmt: :class:`~.formats.DeviceFormat` or a subclass of it
             :keyword sysfsPath: sysfs device path
             :type sysfsPath: str
             :keyword serial: the device's serial number
@@ -3795,7 +3795,7 @@ class MultipathDevice(DMDevice):
             them.
         """
 
-        DMDevice.__init__(self, name, format=format, size=size,
+        DMDevice.__init__(self, name, fmt=fmt, size=size,
                           parents=parents, sysfsPath=sysfsPath,
                           exists=True)
 
@@ -3884,17 +3884,17 @@ class NoDevice(StorageDevice):
     """ A nodev device for nodev filesystems like tmpfs. """
     _type = "nodev"
 
-    def __init__(self, format=None):
+    def __init__(self, fmt=None):
         """
-            :keyword format: the device's formatting
-            :type format: :class:`~.formats.DeviceFormat` or a subclass of it
+            :keyword fmt: the device's formatting
+            :type fmt: :class:`~.formats.DeviceFormat` or a subclass of it
         """
-        if format:
-            name = format.device
+        if fmt:
+            name = fmt.device
         else:
             name = "none"
 
-        StorageDevice.__init__(self, name, format=format, exists=True)
+        StorageDevice.__init__(self, name, fmt=fmt, exists=True)
 
     @property
     def path(self):
@@ -3930,8 +3930,8 @@ class TmpFSDevice(NoDevice):
 
     def __init__(self, *args, **kwargs):
         """Create a tmpfs device"""
-        format = kwargs.get('format')
-        NoDevice.__init__(self, format)
+        fmt = kwargs.get('fmt')
+        NoDevice.__init__(self, fmt)
         # the tmpfs device does not exist until mounted
         self.exists = False
         self._size = kwargs["size"]
@@ -3965,7 +3965,7 @@ class FileDevice(StorageDevice):
     _type = "file"
     _devDir = ""
 
-    def __init__(self, path, format=None, size=None,
+    def __init__(self, path, fmt=None, size=None,
                  exists=False, parents=None):
         """
             :param path: full path to the file
@@ -3976,13 +3976,13 @@ class FileDevice(StorageDevice):
             :type size: :class:`~.size.Size`
             :keyword parents: a list of parent devices
             :type parents: list of :class:`StorageDevice`
-            :keyword format: this device's formatting
-            :type format: :class:`~.formats.DeviceFormat` or a subclass of it
+            :keyword fmt: this device's formatting
+            :type fmt: :class:`~.formats.DeviceFormat` or a subclass of it
         """
         if not os.path.isabs(path):
             raise ValueError("FileDevice requires an absolute path")
 
-        StorageDevice.__init__(self, path, format=format, size=size,
+        StorageDevice.__init__(self, path, fmt=fmt, size=size,
                                exists=exists, parents=parents)
 
     @property
@@ -4072,7 +4072,7 @@ class LoopDevice(StorageDevice):
     """ A loop device. """
     _type = "loop"
 
-    def __init__(self, name=None, format=None, size=None, sysfsPath=None,
+    def __init__(self, name=None, fmt=None, size=None, sysfsPath=None,
                  exists=False, parents=None):
         """
             :param name: the device name (generally a device node's basename)
@@ -4083,8 +4083,8 @@ class LoopDevice(StorageDevice):
             :type size: :class:`~.size.Size`
             :keyword parents: a list of parent devices
             :type parents: list of :class:`StorageDevice`
-            :keyword format: this device's formatting
-            :type format: :class:`~.formats.DeviceFormat` or a subclass of it
+            :keyword fmt: this device's formatting
+            :type fmt: :class:`~.formats.DeviceFormat` or a subclass of it
 
             Loop devices always exist.
         """
@@ -4095,7 +4095,7 @@ class LoopDevice(StorageDevice):
             # set up a temporary name until we've activated the loop device
             name = "tmploop%d" % self.id
 
-        StorageDevice.__init__(self, name, format=format, size=size,
+        StorageDevice.__init__(self, name, fmt=fmt, size=size,
                                exists=True, parents=parents)
 
     def updateName(self):
@@ -4300,9 +4300,9 @@ class OpticalDevice(StorageDevice):
     _type = "cdrom"
 
     def __init__(self, name, major=None, minor=None, exists=False,
-                 format=None, parents=None, sysfsPath='', vendor="",
+                 fmt=None, parents=None, sysfsPath='', vendor="",
                  model=""):
-        StorageDevice.__init__(self, name, format=format,
+        StorageDevice.__init__(self, name, fmt=fmt,
                                major=major, minor=minor, exists=True,
                                parents=parents, sysfsPath=sysfsPath,
                                vendor=vendor, model=model)
@@ -4470,17 +4470,17 @@ class NFSDevice(StorageDevice, NetworkStorageDevice):
     _type = "nfs"
     _packages = ["dracut-network"]
 
-    def __init__(self, device, format=None, parents=None):
+    def __init__(self, device, fmt=None, parents=None):
         """
             :param device: the device name (generally a device node's basename)
             :type device: str
             :keyword parents: a list of parent devices
             :type parents: list of :class:`StorageDevice`
-            :keyword format: this device's formatting
-            :type format: :class:`~.formats.DeviceFormat` or a subclass of it
+            :keyword fmt: this device's formatting
+            :type fmt: :class:`~.formats.DeviceFormat` or a subclass of it
         """
         # we could make host/ip, path, &c but will anything use it?
-        StorageDevice.__init__(self, device, format=format, parents=parents)
+        StorageDevice.__init__(self, device, fmt=fmt, parents=parents)
         NetworkStorageDevice.__init__(self, device.split(":")[0])
 
     @property
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 7f6ceef..142a8df 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -1688,7 +1688,7 @@ class DeviceTree(object):
                                 mountopts="subvol=%s" % vol_path)
                 subvol = BTRFSSubVolumeDevice(vol_path,
                                               vol_id=vol_id,
-                                              format=fmt,
+                                              fmt=fmt,
                                               parents=[parent],
                                               exists=True)
                 self._addDevice(subvol)
@@ -2629,7 +2629,7 @@ class DeviceTree(object):
 
                 # NoDevice also needs some special works since they don't have
                 # per-instance names in the kernel.
-                device = NoDevice(format=fmt)
+                device = NoDevice(fmt=fmt)
                 n = len([d for d in self.devices if d.format.type == fstype])
                 device._name += ".%d" % n
                 self._addDevice(device)
diff --git a/blivet/partitioning.py b/blivet/partitioning.py
index c6bb13f..78956bc 100644
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -217,7 +217,7 @@ def _schedulePartitions(storage, disks):
                                  device=dev.path,
                                  mountpoint=request.mountpoint)
             luks_dev = LUKSDevice("luks-%s" % dev.name,
-                                  format=luks_fmt,
+                                  fmt=luks_fmt,
                                   size=dev.size,
                                   parents=dev)
             storage.createDevice(luks_dev)
@@ -259,7 +259,7 @@ def _scheduleVolumes(storage, devs):
         pvs = []
         for dev in devs:
             pv = LUKSDevice("luks-%s" % dev.name,
-                            format=getFormat(format_name, device=dev.path),
+                            fmt=getFormat(format_name, device=dev.path),
                             size=dev.size,
                             parents=dev)
             pvs.append(pv)
diff --git a/tests/devices_test.py b/tests/devices_test.py
index 02e3d72..ffeb78a 100644
--- a/tests/devices_test.py
+++ b/tests/devices_test.py
@@ -110,9 +110,9 @@ class MDRaidArrayDeviceTestCase(DeviceStateTestCase):
            memberDevices=2,
            parents=[
               MDRaidArrayDevice("parent", level="container",
-                                format=getFormat("mdmember")),
+                                fmt=getFormat("mdmember")),
               MDRaidArrayDevice("other", level=0,
-                                format=getFormat("mdmember"))],
+                                fmt=getFormat("mdmember"))],
            totalDevices=2)
 
         self.dev10 = MDRaidArrayDevice(
@@ -126,9 +126,9 @@ class MDRaidArrayDeviceTestCase(DeviceStateTestCase):
            memberDevices=2,
            parents=[
               MDRaidArrayDevice("parent", level="container",
-                                format=getFormat("mdmember")),
+                                fmt=getFormat("mdmember")),
               MDRaidArrayDevice("other", level="raid0",
-                                format=getFormat("mdmember"))],
+                                fmt=getFormat("mdmember"))],
            size=Size(spec="32 MiB"),
            totalDevices=2)
 
@@ -397,7 +397,7 @@ class MDRaidArrayDeviceTestCase(DeviceStateTestCase):
                                 MDRaidArrayDevice,
                                 "dev",
                                 parents=[StorageDevice("parent",
-                                                format=getFormat("mdmember"))])
+                                                fmt=getFormat("mdmember"))])
 
         self.assertRaisesRegexp(DeviceError,
                                 "set requires at least 2 members",
@@ -405,7 +405,7 @@ class MDRaidArrayDeviceTestCase(DeviceStateTestCase):
                                 "dev",
                                 level="raid0",
                                 parents=[StorageDevice("parent",
-                                                format=getFormat("mdmember"))])
+                                                fmt=getFormat("mdmember"))])
 
         self.assertRaisesRegexp(MDRaidError,
                                 "invalid RAID level descriptor junk",
@@ -463,12 +463,12 @@ class BTRFSDeviceTestCase(DeviceStateTestCase):
 
         self.dev1 = BTRFSVolumeDevice("dev1",
            parents=[OpticalDevice("deva",
-              format=blivet.formats.getFormat("btrfs"))])
+              fmt=blivet.formats.getFormat("btrfs"))])
 
         self.dev2 = BTRFSSubVolumeDevice("dev2", parents=[self.dev1])
 
         dev = StorageDevice("deva",
-           format=blivet.formats.getFormat("btrfs"),
+           fmt=blivet.formats.getFormat("btrfs"),
            size=Size(spec="32 MiB"))
         self.dev3 = BTRFSVolumeDevice("dev3",
            parents=[dev])
@@ -501,7 +501,7 @@ class BTRFSDeviceTestCase(DeviceStateTestCase):
            "dev", parents=[OpticalDevice("deva")])
 
         parents=[OpticalDevice("deva",
-           format=blivet.formats.getFormat("btrfs"))]
+           fmt=blivet.formats.getFormat("btrfs"))]
         self.assertRaisesRegexp(DeviceError,
            "btrfs subvolume.*must be a BTRFSDevice",
            BTRFSSubVolumeDevice,
diff --git a/tests/sanity_check_test.py b/tests/sanity_check_test.py
index 5078c68..b6a2c5d 100644
--- a/tests/sanity_check_test.py
+++ b/tests/sanity_check_test.py
@@ -34,7 +34,7 @@ class LUKSKeyTestCase(unittest.TestCase):
         errors = []
         b = blivet.Blivet()
         b.createDevice(devices.LUKSDevice("name",
-           format=formats.luks.LUKS(),
+           fmt=formats.luks.LUKS(),
            parents=[]))
         errors += b._verifyLUKSDevicesHaveKey()
         self.assertNotEqual(errors, [])
@@ -43,7 +43,7 @@ class LUKSKeyTestCase(unittest.TestCase):
         errors = []
         b = blivet.Blivet()
         b.createDevice(devices.LUKSDevice("name",
-           format=formats.luks.LUKS(passphrase="open"),
+           fmt=formats.luks.LUKS(passphrase="open"),
            parents=[]))
         errors += b._verifyLUKSDevicesHaveKey()
         self.assertEqual(errors, [])
-- 
1.8.3.1



More information about the anaconda-patches mailing list