Re: [PATCH 6/8] Add dracutSetupData() method to DASDDevice (#526354).

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

 



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

On Sat, 10 Oct 2009, Steffen Maier wrote:

On 10/10/2009 12:27 AM, David Cantrell wrote:
Return kernel parameter information for the DASD.
---
 storage/devices.py |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index a37834f..ad936ea 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -3159,6 +3159,26 @@ class DASDDevice(DiskDevice):
         self.failfast = kwargs.get('failfast')
         DiskDevice.__init__(self, *args, **kwargs)

+    def dracutSetupData(self):
+        arg = {'option': 'dasd', 'combine': True, 'delimiter': ','}
+        subargs = []
+
+        if self.readonly:
+            subargs.append("ro")

Ah, there you have one more translation.

+        if self.diag:
+            subargs.append("diag")
+        if self.erplog:
+            subargs.append("erplog")
+        if self.failfast:
+            subargs.append("failfast")

Can we store those attributes in a dict in the DASDDevice object?
Using a consistent key naming scheme, we wouldn't need any translation
here and could just generate the subargs with a loop/map-function
without having to explicitly name all possible attributes and having to
possibly extend the code here in the future when other attributes were
added.

Sure, not at all opposed to that.

Maybe we could even return the internal dict directly without any
conversion whatsoever.

The reason I set up self.diag, self.erplog, and so on was so those values
could be properties on the DASDDevice, so when we do a UI element, we've got
easy access to those flags.  It's not impossible with a dict, but the above
just came to mind first.

You'll also notice how I'm combining the flags that can be in (), which
according to the DASD documentation you sent me would be of the form:

    dasd=x.y.z[(opt:)],xx.yy.zz[(opt:)],...

But if we get rid of working with the dasd= parameter, then we'll make things
a lot easier for ourselves.

+
+        if subargs == []:
+            arg['value'] = "%s" % (self.busid,)
+        else:
+            arg['value'] = "%s(%s)" % (self.busid, ":".join(subargs),)
+
+        return [arg]
+

 class NFSDevice(StorageDevice, NetworkStorageDevice):
     """ An NFS device """


- -- David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

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

iEYEARECAAYFAkrP2d8ACgkQ5hsjjIy1Vkk/GACgkaSsWIZyOxSFDbnC7MRvzjAp
mnEAn2ZhuPOwhm3BCaNIQI2KXXjBrqiP
=RamD
-----END PGP SIGNATURE-----

_______________________________________________
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