Fix autopart run with the new pyparted.
---
partRequests.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/partRequests.py b/partRequests.py
index e9b86c9..d4b41ce 100644
--- a/partRequests.py
+++ b/partRequests.py
@@ -522,11 +522,11 @@ class PartitionSpec(RequestSpec):
for drive in self.drive:
part = diskset.disks[drive].getPartitionByPath("/dev/%s" % self.device)
- if not part:
- # XXX kickstart might still call this before allocating the partitions
- raise RuntimeError, "Checking the size of a partition which hasn't been allocated yet"
+ if part:
+ size += part.getSize(unit="MB")
> Fix autopart run with the new pyparted.
> ---
> partRequests.py | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/partRequests.py b/partRequests.py
> index e9b86c9..d4b41ce 100644
> --- a/partRequests.py
> +++ b/partRequests.py
> @@ -522,11 +522,11 @@ class PartitionSpec(RequestSpec):
> for drive in self.drive:
> part = diskset.disks[drive].getPartitionByPath("/dev/%s"
> % self.device)
>
> - if not part:
> - # XXX kickstart might still call this before
> allocating the partitions
> - raise RuntimeError, "Checking the size of a partition
> which hasn't been allocated yet"
> + if part:
> + size += part.getSize(unit="MB")
>
> - size += part.getSize(unit="MB")
> + if size == 0:
> + return self.requestSize
>
> return size
>
> --
> 1.6.1.3
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-12-2009, 07:16 PM
David Cantrell
Fix PartitionSpec.getActualSize()
Not following the question. self.drive is a list of drives, so iterate
over that and try to get a parted.Partition for the device on that
drive. Add in the size of that partition. Failing all that, return
requestSize.
The reason I'm iterating over request.drive is because it can be a list
and in my mind, that's valid for things like RAID. But all of this code
is likely to vanish soon anyway. Just what we have now.
Martin Sivak wrote:
The code looks ok, but i wonder why to use if not drive: ... if drive: ... instead of the plain and simple if drive: .. else: ...
Fix autopart run with the new pyparted.
---
partRequests.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/partRequests.py b/partRequests.py
index e9b86c9..d4b41ce 100644
--- a/partRequests.py
+++ b/partRequests.py
@@ -522,11 +522,11 @@ class PartitionSpec(RequestSpec):
for drive in self.drive:
part = diskset.disks[drive].getPartitionByPath("/dev/%s"
% self.device)
- if not part:
- # XXX kickstart might still call this before
allocating the partitions
- raise RuntimeError, "Checking the size of a partition
which hasn't been allocated yet"
+ if part:
+ size += part.getSize(unit="MB")
- size += part.getSize(unit="MB")
+ if size == 0:
+ return self.requestSize
return size
--
1.6.1.3
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
_______________________________________________
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
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-13-2009, 08:51 AM
Martin Sivak
Fix PartitionSpec.getActualSize()
Yep the iteration is ok but the part:
>if not part:
> raise RuntimeError, "Checking the size of a .. "
>if part:
> size += part.getSize(unit="MB")
why not use If: .. else: ..
It is just cosmetic, so no big deal.. the patch itself looks ok
> Not following the question. self.drive is a list of drives, so
> iterate
> over that and try to get a parted.Partition for the device on that
> drive. Add in the size of that partition. Failing all that, return
> requestSize.
>
> The reason I'm iterating over request.drive is because it can be a
> list
> and in my mind, that's valid for things like RAID. But all of this
> code
> is likely to vanish soon anyway. Just what we have now.
>
> Martin Sivak wrote:
> > The code looks ok, but i wonder why to use if not drive: ... if
> drive: ... instead of the plain and simple if drive: .. else: ...
> >
> > Martin
> >
> > ----- "David Cantrell" <dcantrell@redhat.com> wrote:
> >
> >> Fix autopart run with the new pyparted.
> >> ---
> >> partRequests.py | 8 ++++----
> >> 1 files changed, 4 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/partRequests.py b/partRequests.py
> >> index e9b86c9..d4b41ce 100644
> >> --- a/partRequests.py
> >> +++ b/partRequests.py
> >> @@ -522,11 +522,11 @@ class PartitionSpec(RequestSpec):
> >> for drive in self.drive:
> >> part =
> diskset.disks[drive].getPartitionByPath("/dev/%s"
> >> % self.device)
> >>
> >> - if not part:
> >> - # XXX kickstart might still call this before
> >> allocating the partitions
> >> - raise RuntimeError, "Checking the size of a
> partition
> >> which hasn't been allocated yet"
> >> + if part:
> >> + size += part.getSize(unit="MB")
> >>
> >> - size += part.getSize(unit="MB")
> >> + if size == 0:
> >> + return self.requestSize
> >>
> >> return size
> >>
> >> --
> >> 1.6.1.3
> >>
> >> _______________________________________________
> >> Anaconda-devel-list mailing list
> >> Anaconda-devel-list@redhat.com
> >> https://www.redhat.com/mailman/listinfo/anaconda-devel-list
> >
> > _______________________________________________
> > 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
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
02-16-2009, 10:16 PM
David Cantrell
Fix PartitionSpec.getActualSize()
Martin Sivak wrote:
Yep the iteration is ok but the part:
if not part:
raise RuntimeError, "Checking the size of a .. "
if part:
size += part.getSize(unit="MB")
why not use If: .. else: ..
It is just cosmetic, so no big deal.. the patch itself looks ok
The 'if not part' block is gone in the patch. The only thing that
happens in the loop is each part is obtained and if it exists, getSize()
is called and the size is added in to the size variable.
Not following the question. self.drive is a list of drives, so
iterate
over that and try to get a parted.Partition for the device on that
drive. Add in the size of that partition. Failing all that, return
requestSize.
The reason I'm iterating over request.drive is because it can be a
list
and in my mind, that's valid for things like RAID. But all of this
code
is likely to vanish soon anyway. Just what we have now.
Martin Sivak wrote:
The code looks ok, but i wonder why to use if not drive: ... if
drive: ... instead of the plain and simple if drive: .. else: ...
Fix autopart run with the new pyparted.
---
partRequests.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/partRequests.py b/partRequests.py
index e9b86c9..d4b41ce 100644
--- a/partRequests.py
+++ b/partRequests.py
@@ -522,11 +522,11 @@ class PartitionSpec(RequestSpec):
for drive in self.drive:
part =
diskset.disks[drive].getPartitionByPath("/dev/%s"
% self.device)
- if not part:
- # XXX kickstart might still call this before
allocating the partitions
- raise RuntimeError, "Checking the size of a
partition
which hasn't been allocated yet"
+ if part:
+ size += part.getSize(unit="MB")
- size += part.getSize(unit="MB")
+ if size == 0:
+ return self.requestSize
return size
--
1.6.1.3
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
_______________________________________________
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
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
_______________________________________________
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
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list