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 > Redhat > Fedora User

 
 
LinkBack Thread Tools
 
Old 07-27-2011, 08:24 AM
Ales Kozumplik
 
Default edd: fix syntax in situation when two edd directories point to the same device.

Adds a unit test for this case.

Resolves: rhbz#725777
---
storage/devicelibs/edd.py | 2 +-
tests/storage/devicelibs/edd_test.py | 31 +++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/storage/devicelibs/edd.py b/storage/devicelibs/edd.py
index 86abca4..d494ec2 100644
--- a/storage/devicelibs/edd.py
+++ b/storage/devicelibs/edd.py
@@ -218,7 +218,7 @@ def get_edd_dict(devices):
old_edd_number = edd_dict.get(name)
if old_edd_number:
log.info("edd: both edd entries 0x%x and 0x%x seem to map to %s" %
- old_edd_number, edd_number, name)
+ (old_edd_number, edd_number, name))
# this means all the other data can be confused and useless
return {}
edd_dict[name] = edd_number
diff --git a/tests/storage/devicelibs/edd_test.py b/tests/storage/devicelibs/edd_test.py
index 00a91b4..60b1e43 100644
--- a/tests/storage/devicelibs/edd_test.py
+++ b/tests/storage/devicelibs/edd_test.py
@@ -102,6 +102,21 @@ class EddTestCase(mock.TestCase):
{'sda' : 0x80,
'vda' : 0x81})

+ def test_get_edd_dict_3(self):
+ """ Test scenario when the 0x80 and 0x81 edd directories contain the
+ same data and give no way to distinguish among the two devices.
+ """
+ from storage.devicelibs import edd
+ edd.log = mock.Mock()
+ edd.collect_mbrs = mock.Mock(return_value = {
+ 'sda' : '0x000ccb01',
+ 'vda' : '0x0006aef1'})
+ fs = EddTestFS(edd).sda_sdb_same()
+ self.assertEqual(edd.get_edd_dict([]),
+ {})
+ self.assertIn((('edd: both edd entries 0x80 and 0x81 seem to map to sda',), {}),
+ edd.log.info.call_args_list)
+
class EddTestFS(object):
def __init__(self, target_module):
self.fs = mock.DiskIO()
@@ -161,3 +176,19 @@ class EddTestFS(object):
self.fs["/sys/firmware/edd/int13_dev81/sectors"] = "4194304
"

return self.fs
+
+ def sda_sdb_same(self):
+ self.fs["/sys/firmware/edd/int13_dev80"] = self.fs.Dir()
+ self.fs["/sys/firmware/edd/int13_dev80/host_bus"] = "PCI 00:01.1 channel: 0
"
+ self.fs["/sys/firmware/edd/int13_dev80/interface"] = "ATA device: 0
"
+ self.fs["/sys/firmware/edd/int13_dev80/mbr_signature"] = "0x000ccb01"
+ self.fs["/sys/firmware/edd/int13_dev80/sectors"] = "2097152
"
+
+ self.fs["/sys/firmware/edd/int13_dev81"] = self.fs.Dir()
+ self.fs["/sys/firmware/edd/int13_dev81/host_bus"] = "PCI 00:01.1 channel: 0
"
+ self.fs["/sys/firmware/edd/int13_dev81/interface"] = "ATA device: 0
"
+ self.fs["/sys/firmware/edd/int13_dev81/mbr_signature"] = "0x0006aef1"
+ self.fs["/sys/firmware/edd/int13_dev81/sectors"] = "2097152
"
+
+ self.fs["/sys/devices/pci0000:00/0000:00:01.1/host0/target0:0:0/0:0:0:0/block"] = self.fs.Dir()
+ self.fs["/sys/devices/pci0000:00/0000:00:01.1/host0/target0:0:0/0:0:0:0/block/sda"] = self.fs.Dir()
--
1.7.6

_______________________________________________
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 03:30 AM.

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