20
20
import xml .dom .minidom
21
21
import xs_errors
22
22
import glob
23
- import fcoelib
24
23
25
24
DEVPATH = '/dev/disk/by-id'
26
25
DMDEVPATH = '/dev/mapper'
@@ -50,39 +49,17 @@ def adapters(filterstr="any"):
50
49
dict = {}
51
50
devs = {}
52
51
adt = {}
53
- fcoe_eth_info = {}
54
- fcoe_port_info = []
55
-
56
- fcoe_port_info = fcoelib .parse_fcoe_port_name_info ()
57
- if filterstr == "fcoe" :
58
- fcoe_eth_info = fcoelib .parse_fcoe_eth_info ()
59
-
60
52
for a in os .listdir (SYSFS_PATH1 ):
61
53
proc = match_hbadevs (a , filterstr )
62
54
if not proc :
63
55
continue
64
56
65
- #Special casing for fcoe
66
57
port_name_path = os .path .join (SYSFS_PATH1 , a , 'device' , \
67
58
'fc_host' , a , 'port_name' )
68
59
port_name_path_exists = os .path .exists (port_name_path )
69
60
util .SMlog ("Port name path exists %s" % port_name_path_exists )
70
- if filterstr == "fcoe" and not port_name_path_exists :
71
- continue
72
61
if port_name_path_exists :
73
62
port_name = _get_port_name (port_name_path )
74
- #If we are probing for fcoe luns/ adapters and if the port name
75
- #in /sys/class/scsi_host/a/device/fc_host/a/port_name does not match
76
- #one in the output of 'fcoeadm -i', then we shouldn't display that
77
- #lun/adapter.
78
- #On the other hand, if we are probing for hba luns, and if the
79
- #port name in /sys/class/scsi_host/a/device/fc_host/a/port_name
80
- #matches one in the output of 'fcoeadm -i', then we shouldn't
81
- #display that lun/adapter, because that would have been discovered
82
- #via the FCoE protocol.
83
- if (filterstr == "fcoe" and port_name not in fcoe_port_info ) or \
84
- (filterstr != "fcoe" and port_name in fcoe_port_info ):
85
- continue
86
63
87
64
adt [a ] = proc
88
65
id = a .replace ("host" , "" )
@@ -96,7 +73,6 @@ def adapters(filterstr="any"):
96
73
for p in [os .path .join (SYSFS_PATH1 , a , "device" , "session*" ), os .path .join (SYSFS_PATH1 , a , "device" ), \
97
74
os .path .join (SYSFS_PATH2 , "%s:*" % id )]:
98
75
paths += glob .glob (p )
99
-
100
76
if not len (paths ):
101
77
continue
102
78
for path in paths :
@@ -124,12 +100,8 @@ def adapters(filterstr="any"):
124
100
for lun in os .listdir (sysfs ):
125
101
if not match_LUNs (lun , tgt ):
126
102
continue
127
- #Special casing for fcoe, populating eth information
128
- eth = ""
129
- if i in fcoe_eth_info .keys ():
130
- eth = fcoe_eth_info [i ]
131
- dir = os .path .join (sysfs , lun , "device" )
132
- (dev , entry ) = _extract_dev (dir , proc , id , lun , eth )
103
+ dir = os .path .join (sysfs ,lun ,"device" )
104
+ (dev , entry ) = _extract_dev (dir , proc , id , lun )
133
105
update_devs_dict (devs , dev , entry )
134
106
135
107
# for new mptsas sysfs entries, check for phy* node
@@ -218,9 +190,8 @@ def _parseHostId(str):
218
190
def match_hbadevs (s , filterstr ):
219
191
driver_name = _get_driver_name (s )
220
192
if match_host (s ) and not match_blacklist (driver_name ) \
221
- and (filterstr == "any" or filterstr == "fcoe" or \
222
- match_filterstr (filterstr , driver_name )):
223
- return driver_name
193
+ and ( filterstr == "any" or match_filterstr (filterstr , driver_name ) ):
194
+ return driver_name
224
195
else :
225
196
return ""
226
197
@@ -275,15 +246,13 @@ def _get_block_device_name_with_kernel_3x(device_dir):
275
246
else :
276
247
return INVALID_DEVICE_NAME
277
248
278
-
279
- def _extract_dev (device_dir , procname , host , target , eths = "" ):
249
+ def _extract_dev (device_dir , procname , host , target ):
280
250
"""Returns device name and creates dictionary entry for it"""
281
251
dev = _extract_dev_name (device_dir )
282
252
entry = {}
283
253
entry ['procname' ] = procname
284
254
entry ['host' ] = host
285
255
entry ['target' ] = target
286
- entry ['eth' ] = eths
287
256
return (dev , entry )
288
257
289
258
@@ -349,8 +318,6 @@ def scan(srobj):
349
318
obj .id = ids [3 ]
350
319
obj .lun = ids [4 ]
351
320
obj .hba = hba ['procname' ]
352
- if 'eth' in hba and hba ['eth' ]:
353
- obj .eth = hba ['eth' ]
354
321
obj .numpaths = 1
355
322
if obj .SCSIid in vdis :
356
323
vdis [obj .SCSIid ].numpaths += 1
@@ -363,12 +330,10 @@ def scan(srobj):
363
330
d = dom .createElement ("BlockDevice" )
364
331
e .appendChild (d )
365
332
366
- for attr in ['path' , 'numpaths' , 'SCSIid' , 'vendor' , 'serial' , 'size' , 'adapter' , 'channel' , 'id' , 'lun' , 'hba' , 'eth' ]:
333
+ for attr in ['path' , 'numpaths' , 'SCSIid' , 'vendor' , 'serial' , 'size' , 'adapter' , 'channel' , 'id' , 'lun' , 'hba' ]:
367
334
try :
368
335
aval = getattr (obj , attr )
369
336
except AttributeError :
370
- if attr in ['eth' ]:
371
- continue
372
337
raise xs_errors .XenError ('InvalidArg' ,
373
338
opterr = 'Missing required field [%s]' % attr )
374
339
entry = dom .createElement (attr )
0 commit comments