@ -49,35 +49,61 @@ class FcWwnInitiatorFactCollector(BaseFactCollector):
TBD ( not implemented ) : on solaris 9 use ` prtconf - pv `
TBD ( not implemented ) : on solaris 9 use ` prtconf - pv `
"""
"""
cmd = module . get_bin_path ( ' fcinfo ' )
cmd = module . get_bin_path ( ' fcinfo ' )
cmd = cmd + " hba-port "
if cmd :
rc , fcinfo_out , err = module . run_command ( cmd )
cmd = cmd + " hba-port "
"""
rc , fcinfo_out , err = module . run_command ( cmd )
# fcinfo hba-port | grep "Port WWN"
"""
HBA Port WWN : 10000090 fa1658de
# fcinfo hba-port | grep "Port WWN"
"""
HBA Port WWN : 10000090 fa1658de
if fcinfo_out :
"""
for line in fcinfo_out . splitlines ( ) :
if rc == 0 and fcinfo_out :
if ' Port WWN ' in line :
for line in fcinfo_out . splitlines ( ) :
data = line . split ( ' ' )
if ' Port WWN ' in line :
fc_facts [ ' fibre_channel_wwn ' ] . append ( data [ - 1 ] . rstrip ( ) )
data = line . split ( ' ' )
fc_facts [ ' fibre_channel_wwn ' ] . append ( data [ - 1 ] . rstrip ( ) )
elif sys . platform . startswith ( ' aix ' ) :
elif sys . platform . startswith ( ' aix ' ) :
# get list of available fibre-channel devices (fcs)
cmd = module . get_bin_path ( ' lsdev ' )
cmd = module . get_bin_path ( ' lsdev ' )
cmd = cmd + " -Cc adapter -l fcs* "
lscfg_cmd = module . get_bin_path ( ' lscfg ' )
rc , lsdev_out , err = module . run_command ( cmd )
if cmd and lscfg_cmd :
if lsdev_out :
# get list of available fibre-channel devices (fcs)
lscfg_cmd = module . get_bin_path ( ' lscfg ' )
cmd = cmd + " -Cc adapter -l fcs* "
for line in lsdev_out . splitlines ( ) :
rc , lsdev_out , err = module . run_command ( cmd )
# if device is available (not in defined state), get its WWN
if rc == 0 and lsdev_out :
if ' Available ' in line :
for line in lsdev_out . splitlines ( ) :
data = line . split ( ' ' )
# if device is available (not in defined state), get its WWN
cmd = lscfg_cmd + " -vl %s " % data [ 0 ]
if ' Available ' in line :
rc , lscfg_out , err = module . run_command ( cmd )
data = line . split ( ' ' )
# example output
cmd = lscfg_cmd + " -vl %s " % data [ 0 ]
# lscfg -vpl fcs3 | grep "Network Address"
rc , lscfg_out , err = module . run_command ( cmd )
# Network Address.............10000090FA551509
# example output
for line in lscfg_out . splitlines ( ) :
# lscfg -vpl fcs3 | grep "Network Address"
if ' Network Address ' in line :
# Network Address.............10000090FA551509
data = line . split ( ' . ' )
if rc == 0 and lscfg_out :
fc_facts [ ' fibre_channel_wwn ' ] . append ( data [ - 1 ] . rstrip ( ) )
for line in lscfg_out . splitlines ( ) :
if ' Network Address ' in line :
data = line . split ( ' . ' )
fc_facts [ ' fibre_channel_wwn ' ] . append ( data [ - 1 ] . rstrip ( ) )
elif sys . platform . startswith ( ' hp-ux ' ) :
cmd = module . get_bin_path ( ' ioscan ' )
fcmsu_cmd = module . get_bin_path ( ' fcmsutil ' , opt_dirs = [ ' /opt/fcms/bin ' ] )
# go ahead if we have both commands available
if cmd and fcmsu_cmd :
# ioscan / get list of available fibre-channel devices (fcd)
cmd = cmd + " -fnC FC "
rc , ioscan_out , err = module . run_command ( cmd )
if rc == 0 and ioscan_out :
for line in ioscan_out . splitlines ( ) :
line = line . strip ( )
if ' /dev/fcd ' in line :
dev = line . split ( ' ' )
# get device information
cmd = fcmsu_cmd + " %s " % dev [ 0 ]
rc , fcmsutil_out , err = module . run_command ( cmd )
# lookup the following line
# N_Port Port World Wide Name = 0x50060b00006975ec
if rc == 0 and fcmsutil_out :
for line in fcmsutil_out . splitlines ( ) :
if ' N_Port Port World Wide Name ' in line :
data = line . split ( ' = ' )
fc_facts [ ' fibre_channel_wwn ' ] . append ( data [ - 1 ] . strip ( ) )
return fc_facts
return fc_facts