[master/rhel7-branch] On the way to checking and forcing minimum entropy

Vratislav Podzimek vpodzime at redhat.com
Wed Aug 27 14:16:55 UTC 2014


These two patches (anaconda and blivet) implement something I've proposed more
than a year ago as part of my school project for requiring minimum entropy when
creating new LUKS. The other part of the patchset that implements the actual
entropy checking and forcing is on the way, but I'd like to make the entropy
limit set outside of blivet (i.e. in anaconda) which I think is the rigth way to
go, but in the same time it complicates the patch quite a lot. I'm sending these
two patches in advance so that we can agree on the way how to implement this.

In contrast to the very first version of the patch for using callbacks in blivet
instead of forcing it to import and use our progress reporting code these
patches try to make the callbacks framework much more robust. With the main
focus on the callbacks being "extensible" -- i.e. new data can be passed to
existing callbacks and new callbacks can be added without breaking the old code.

Namedtuples are great for passing data to callbacks because we can add some more
fields to them without breaking callbacks using just the old fields. The
namedtuple holding the callbacks and a function to instantiate it may be a bit
controversial, but let me explain the points behind this implementation:

1) as in case of callbacks' data it is easy to add new callbacks
2) the object holding the references to callbacks is opaque and read-only so if
we decide to change its implementation (dict, class,...) we wouldn't have to
care about any code relying on the old implementation
3) adding new callbacks is not an issue because with the function because there
are default values for non-specified callbacks (namedtuple requires all fileds
to be specified)

Another solution would be a simple CallbacksRegister class with the default
parameter values in __init__ which would store the parameters values (callbacks)
as instance attributes, but these would be read-write and the by providing the
class as a public API we would be forced to keep the implemenation as a class.
Attempts to make it more restricted would lead to something definitely more
complicated than a private namedtuple and a "factory function".

Vratislav Podzimek (1):
  Give blivet callbacks for reporting partitioning progress

 pyanaconda/install.py  | 24 ++++++++++++++++--------
 pyanaconda/progress.py | 15 ++++++++++++++-
 2 files changed, 30 insertions(+), 9 deletions(-)

-- 
1.9.3



More information about the anaconda-patches mailing list