[PATCH 2/2] Adapt to blivet's libblockdev-related changes

Vratislav Podzimek vpodzime at redhat.com
Tue Feb 10 08:21:22 UTC 2015


On Mon, 2015-02-02 at 09:42 -0500, Anne Mulhern wrote:
> 
> 
> 
> ----- Original Message -----
> > From: "Vratislav Podzimek" <vpodzime at redhat.com>
> > To: anaconda-patches at lists.fedorahosted.org
> > Sent: Sunday, February 1, 2015 7:21:16 PM
> > Subject: [PATCH 2/2] Adapt to blivet's libblockdev-related changes
> > 
> > The getPossiblePhysicalExtents() function is no longer provided by blivet's
> > devicelibs/lvm.py module and we should now use libblockdev.
> > 
> > Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> > ---
> >  anaconda.spec.in        |  3 +++
> >  pyanaconda/kickstart.py | 12 +++++++++++-
> >  2 files changed, 14 insertions(+), 1 deletion(-)
> > 
> > diff --git a/anaconda.spec.in b/anaconda.spec.in
> > index dc627e2..483fb37 100644
> > --- a/anaconda.spec.in
> > +++ b/anaconda.spec.in
> > @@ -42,6 +42,7 @@ Source0: %{name}-%{version}.tar.bz2
> >  %define libxklavierver 5.4
> >  %define libtimezonemapver 0.4.1-2
> >  %define helpver 22.1-1
> > +%define libblockdevver 0.5
> >  
> >  BuildRequires: audit-libs-devel
> >  BuildRequires: gettext >= %{gettextver}
> > @@ -139,6 +140,8 @@ Requires: iscsi-initiator-utils >= %{iscsiver}
> >  Requires: hfsplus-tools
> >  %endif
> >  %endif
> > +Requires: libblockdev >= %{libblockdevver}
> > +Requires: libblockdev-plugins-all >= %{libblockdevver}
> >  
> >  Requires: python-coverage
> >  
> > diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
> > index dda3552..86f7fcb 100644
> > --- a/pyanaconda/kickstart.py
> > +++ b/pyanaconda/kickstart.py
> > @@ -21,7 +21,7 @@
> >  from pyanaconda.errors import ScriptError, errorHandler
> >  from blivet.deviceaction import ActionCreateFormat, ActionDestroyFormat,
> >  ActionResizeDevice, ActionResizeFormat
> >  from blivet.devices import LUKSDevice
> > -from blivet.devicelibs.lvm import getPossiblePhysicalExtents, LVM_PE_SIZE,
> > KNOWN_THPOOL_PROFILES
> > +from blivet.devicelibs.lvm import LVM_PE_SIZE, KNOWN_THPOOL_PROFILES
> >  from blivet.devicelibs.crypto import MIN_CREATE_ENTROPY
> >  from blivet.formats import getFormat
> >  from blivet.partitioning import doPartitioning
> > @@ -77,6 +77,16 @@ storage_log = logging.getLogger("blivet")
> >  stdoutLog = logging.getLogger("anaconda.stdout")
> >  from pyanaconda.anaconda_log import logger, logLevelMap, setHandlersLevel,
> >  DEFAULT_LEVEL
> >  
> > +program_log = logging.getLogger("program")
> > +
> > +# XXX: respect the level? Need to translate between C and Python log levels.
> > +log_bd_message = lambda level, msg: program_log.info(msg)
> > +
> > +from gi.repository import BlockDev
> > +if not BlockDev.is_initialized():
> > +    # for now, we want all the plugins to be available (i.e. init() to
> > return True)
> > +    assert BlockDev.init(force_plugins=None, log_func=log_bd_message)
> > +
> >  class AnacondaKSScript(KSScript):
> >      """ Execute a kickstart script
> >  
> > --
> > 2.1.0
> > 
> > _______________________________________________
> > anaconda-patches mailing list
> > anaconda-patches at lists.fedorahosted.org
> > https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> > 
I see my reply I sent a week ago never made it to the mailing list, so
here it is:

> Is there any way to remove anaconda's direct dependence on libblockdev?
> 
> I was hoping it could all be indirect, through blivet.
I agree it would be nice if anaconda had no dependence on libblockdev.
The only solution that comes to my mind is to have
getPossiblePhysicalExtents() (or similar) as a static method of e.g. the
LVMVolumeGroupDevice class. Does that sound good?

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list