Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Fedora Development (http://www.linux-archive.org/fedora-development/)
-   -   sda is less then vda in compareDisks() (http://www.linux-archive.org/fedora-development/466324-sda-less-then-vda-comparedisks.html)

Ales Kozumplik 12-16-2010 07:59 AM

sda is less then vda in compareDisks()
 
Related: rhbz#621175
---
storage/__init__.py | 31 +++++++++++++------------------
1 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/storage/__init__.py b/storage/__init__.py
index 09dab1f..03c8f07 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -1180,6 +1180,17 @@ class Storage(object):
return self.fsset.rootDevice

def compareDisks(self, first, second):
+ def name_to_prio(name):
+ # the order is: hd < sd < vd or xvd < something else
+ if name.startswith("hd"):
+ return -1
+ elif name.startswith("sd"):
+ return 0
+ elif (name.startswith("vd") or name.startswith("xvd")):
+ return 1
+ else:
+ return 2
+
# if exactly one of the devices has a pcidev, prefer it
if bool(self.eddDict[first].pcidev) ^ bool(self.eddDict[second].pcidev):
if self.eddDict[first].pcidev:
@@ -1202,24 +1213,8 @@ class Storage(object):
if self.eddDict[second].biosdev:
return 1

- if first.startswith("hd"):
- type1 = 0
- elif first.startswith("sd"):
- type1 = 1
- elif (first.startswith("vd") or first.startswith("xvd")):
- type1 = -1
- else:
- type1 = 2
-
- if second.startswith("hd"):
- type2 = 0
- elif second.startswith("sd"):
- type2 = 1
- elif (second.startswith("vd") or second.startswith("xvd")):
- type2 = -1
- else:
- type2 = 2
-
+ type1 = name_to_prio(first)
+ type2 = name_to_prio(second)
if (type1 < type2):
return -1
elif (type1 > type2):
--
1.7.3.3

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


All times are GMT. The time now is 01:35 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.