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

Re: [PATCH 5/7] Modify StorageDevice.fstabSpec() to use by-path for DASD (#526364).



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 8 Oct 2009, Hans de Goede wrote:

sorry, but NACK,

This sort of device specific handling should not be done in the
generic StorageDevice class, instead
devicetree.py: addUdevDiskDevice()
Should be teached to recognize DASD disks and add them with a type
of DASDDevice, and DASDDevice should override fstabSpec().


That was my original approach (which also explains the udev patches after this
one), but DASDDevice extends DiskDevice.  Where I need to override fstabSpec
for DASD is in PartitionDevice.  So I created a DASDPartitionDevice and did
things that way, which looked pretty ugly to me, so I ended up doing this
instead.

DASDDevice is for /dev/dasda, /dev/dasdb, and so on.  The partitions such as
/dev/dasda1 or /dev/dasdb1 become PartitionDevice objects.

I guess I'll go create the DASDPartitionDevice class anyway so I can override
fstabSpec there.

On 10/08/2009 09:28 AM, David Cantrell wrote:
If the partition is on a DASD disk, write out the /dev/disk/by-path/...
value to the /etc/fstab file rather than a UUID= line.
---
  storage/devices.py |   17 ++++++++++++++---
  1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index 9d257e2..6cd7b5a 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -556,9 +556,20 @@ class StorageDevice(Device):

      @property
      def fstabSpec(self):
-        spec = self.path
-        if self.format and self.format.uuid:
-            spec = "UUID=%s" % self.format.uuid
+        spec = None
+
+        try:
+            if self.format:
+ if self.disk and self.disk.format.partedDisk.type == 'dasd':
+                    spec = deviceNameToDiskByPath(self.path)
+                elif self.format.uuid:
+                    spec = "UUID=%s" % self.format.uuid
+        except AttributeError as msg:
+            log.error("fstabSpec called for %s: %s" % (self.path, msg,))
+
+        if not spec:
+            spec = self.path
+
          return spec

      def resize(self, intf=None):

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


- -- David Cantrell <dcantrell redhat com>
Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkrNoPEACgkQ5hsjjIy1VknyiACgzRNEwxvAQJMseo/NveZm4l5p
UhYAniUHCs4vubqqsgfkouVjMEczKVVl
=hb47
-----END PGP SIGNATURE-----


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