[rhel7-branch][PATCH] Convert LVM_PE_SIZE to KiB (#1163081)

Vratislav Podzimek vpodzime at redhat.com
Fri Nov 14 07:03:27 UTC 2014


On Thu, 2014-11-13 at 11:50 -0500, Anne Mulhern wrote:
> 
> 
> 
> ----- Original Message -----
> > From: "Vratislav Podzimek" <vpodzime at redhat.com>
> > To: "anaconda patch review" <anaconda-patches at lists.fedorahosted.org>
> > Sent: Thursday, November 13, 2014 10:25:05 AM
> > Subject: Re: [rhel7-branch][PATCH] Convert LVM_PE_SIZE to KiB (#1163081)
> > 
> > On Thu, 2014-11-13 at 07:25 -0500, Anne Mulhern wrote:
> > > 
> > > 
> > > 
> > > ----- Original Message -----
> > > > From: "Vratislav Podzimek" <vpodzime at redhat.com>
> > > > To: anaconda-patches at lists.fedorahosted.org
> > > > Sent: Thursday, November 13, 2014 3:46:56 AM
> > > > Subject: [rhel7-branch][PATCH] Convert LVM_PE_SIZE to KiB (#1163081)
> > > > 
> > > > It is a Size instance not a plain number of MiB now.
> > > > 
> > > > Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> > > > ---
> > > >  pyanaconda/kickstart.py | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > 
> > > > diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
> > > > index 379a573..4122c02 100644
> > > > --- a/pyanaconda/kickstart.py
> > > > +++ b/pyanaconda/kickstart.py
> > > > @@ -1592,7 +1592,7 @@ class
> > > > VolGroupData(commands.volgroup.RHEL7_VolGroupData):
> > > >  
> > > >          if self.pesize == 0:
> > > >              # default PE size requested -- we use blivet's default in
> > > >              KiB
> > > > -            self.pesize = LVM_PE_SIZE * 1024
> > > > +            self.pesize = LVM_PE_SIZE.convertTo("KiB")
> > > >  
> > > >          pesize = Size("%d KiB" % self.pesize)
> > > >          if pesize not in getPossiblePhysicalExtents():
> > > > --
> > > > 1.9.3
> > > > 
> > > > _______________________________________________
> > > > anaconda-patches mailing list
> > > > anaconda-patches at lists.fedorahosted.org
> > > > https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> > > > 
> > > 
> > > This will work because it doesn't cause the bug fixed in master
> > > blivet commit a3998ea687a96d7f6ca7a019ecae87dcc7b5d0fe to manifest
> > > (because LVM_PE_SIZE current value of 4 MiB is multiple of 1024).
> > I'm sorry, but I don't get this. LVM_PE_SIZE.convertTo("KiB") returns a
> > Decimal which is then converted back into a Size instance. How does that
> > relate to Size arithmetic resulting in Decimal instances and multiples
> > of 1024?
> > 
> > Thanks for the ACK!
> > 
> > --
> > Vratislav Podzimek
> > 
> > Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
> > 
> > _______________________________________________
> > anaconda-patches mailing list
> > anaconda-patches at lists.fedorahosted.org
> > https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> > 
> 
> Before bug fix Size(1536).convertTo("KiB") would get expression
> 
> Decimal(Size(1536) / Decimal(1024))
> 
> or, substituting Size.__div__ for /
> 
> Decimal(Size(Decimal.__div__(Size(1536), Decimal(1024))))
> 
> with that weird cast to Size in the middle.
> 
> This evaluates to
> 
> Decimal(Size(Decimal("1.5"))
> 
> Size constructor truncates 1.5 to 1 giving
> 
> Decimal(Size(1))
> 
> and so Size(1536).convertTo("KiB") is 1 which is wrong.
Interesting, thanks for the explanation.

> 
> But I don't expect LVM_PE_SIZE would ever not be a multiple of 1024,
> because if it was it would be an illegal PE size.
True, that would be really weird.

-- 
Vratislav Podzimek

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



More information about the anaconda-patches mailing list