FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 05-19-2010, 11:57 AM
Hans de Goede
 
Default Store immutable info into the device for easier access

Related: rhbz#593642
---
storage/__init__.py | 5 ++---
storage/devices.py | 1 +
storage/devicetree.py | 9 ++++-----
3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/storage/__init__.py b/storage/__init__.py
index abe5e0f..38bce75 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -692,9 +692,8 @@ class Storage(object):
msg += "%s: %s" % (dev, reasons[dev])
return msg

- for i in self.devicetree.immutableDevices:
- if i[0] == device.name:
- return i[1]
+ if device.immutable:
+ return device.immutable

return False

diff --git a/storage/devices.py b/storage/devices.py
index d6c8066..93b90ec 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -461,6 +461,7 @@ class StorageDevice(Device):
self.bus = bus

self.protected = False
+ self.immutable = None

self.format = format
self.originalFormat = self.format
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 39f1dcc..61f1643 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -186,7 +186,6 @@ class DeviceTree(object):
self._ignoredDisks = []
for disk in ignored:
self.addIgnoredDisk(disk)
- self.immutableDevices = []
lvm.lvm_cc_resetFilter()

def addIgnoredDisk(self, disk):
@@ -1886,8 +1885,8 @@ class DeviceTree(object):
lvm.blacklistVG(device.name)
for parent in device.parents:
if parent.type == "partition":
- self.immutableDevices.append([parent.name,
- _("This partition is part of an inconsistent LVM Volume Group.")])
+ parent.immutable =
+ _("This partition is part of an inconsistent LVM Volume Group.")
else:
self._removeDevice(parent, moddisk=False)
self.addIgnoredDisk(parent.name)
@@ -1934,8 +1933,8 @@ class DeviceTree(object):
# ignore all the pvs
for parent in device.vg.parents:
if parent.type == "partition":
- self.immutableDevices.append([parent.name,
- _("This partition is part of an inconsistent LVM Volume Group.")])
+ parent.immutable =
+ _("This partition is part of an inconsistent LVM Volume Group.")
else:
self._removeDevice(parent, moddisk=False)
self.addIgnoredDisk(parent.name)
--
1.7.0.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 05-19-2010, 02:13 PM
Ales Kozumplik
 
Default Store immutable info into the device for easier access

On 05/19/2010 01:57 PM, Hans de Goede wrote:


+ if device.immutable:
+ return device.immutable

return False


In theory, you could just do:

return device.immutable

no?


Ales

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 05-19-2010, 02:22 PM
Hans de Goede
 
Default Store immutable info into the device for easier access

Hi,

On 05/19/2010 04:13 PM, Ales Kozumplik wrote:

On 05/19/2010 01:57 PM, Hans de Goede wrote:


+ if device.immutable:
+ return device.immutable

return False


In theory, you could just do:

return device.immutable



Well that would return None and thus not always make the
function return a boolean. I know dlehman wants functions like
this one to always return a boolean, so ...

Regards,

Hans

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 05-19-2010, 03:28 PM
David Lehman
 
Default Store immutable info into the device for easier access

On Wed, 2010-05-19 at 16:22 +0200, Hans de Goede wrote:
> Hi,
>
> On 05/19/2010 04:13 PM, Ales Kozumplik wrote:
> > On 05/19/2010 01:57 PM, Hans de Goede wrote:
> >
> >> + if device.immutable:
> >> + return device.immutable
> >>
> >> return False
> >
> > In theory, you could just do:
> >
> > return device.immutable
> >
>
> Well that would return None and thus not always make the
> function return a boolean. I know dlehman wants functions like
> this one to always return a boolean, so ...

The funny part is that you're returning a string if device.immutable is
set.

Dave

>
> Regards,
>
> Hans
>
> _______________________________________________
> 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
 
Old 05-19-2010, 03:38 PM
Hans de Goede
 
Default Store immutable info into the device for easier access

Hi,

On 05/19/2010 05:28 PM, David Lehman wrote:

On Wed, 2010-05-19 at 16:22 +0200, Hans de Goede wrote:

Hi,

On 05/19/2010 04:13 PM, Ales Kozumplik wrote:

On 05/19/2010 01:57 PM, Hans de Goede wrote:


+ if device.immutable:
+ return device.immutable

return False


In theory, you could just do:

return device.immutable



Well that would return None and thus not always make the
function return a boolean. I know dlehman wants functions like
this one to always return a boolean, so ...


The funny part is that you're returning a string if device.immutable is
set.



Ah good point, that is unchanged from previous behavior, but indeed not
pretty. I guess Ales' point of just returning
device.immutable at the end of the function then is valid, that
would make the function return None or a string which seems
more sensible then returning False or a string.

Regards,

Hans

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 05-20-2010, 06:09 AM
Ales Kozumplik
 
Default Store immutable info into the device for easier access

On 05/19/2010 05:38 PM, Hans de Goede wrote:

Hi,

On 05/19/2010 05:28 PM, David Lehman wrote:

On Wed, 2010-05-19 at 16:22 +0200, Hans de Goede wrote:

Hi,

On 05/19/2010 04:13 PM, Ales Kozumplik wrote:

On 05/19/2010 01:57 PM, Hans de Goede wrote:


+ if device.immutable:
+ return device.immutable

return False


In theory, you could just do:

return device.immutable



Well that would return None and thus not always make the
function return a boolean. I know dlehman wants functions like
this one to always return a boolean, so ...


The funny part is that you're returning a string if device.immutable is
set.



Ah good point, that is unchanged from previous behavior, but indeed not
pretty. I guess Ales' point of just returning
device.immutable at the end of the function then is valid, that
would make the function return None or a string which seems
more sensible then returning False or a string.



Or just init the string to ', that evaluates to False in python too and
the function would always return string then.


Ales

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 07:32 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org