2525from xml .dom import minidom
2626import StorageHandlerUtil
2727from XenCertLog import Print , PrintOnSameLine , XenCertPrint
28- from XenCertCommon import displayOperationStatus , getConfigWithHiddenPassword
28+ from XenCertCommon import displayOperationStatus , getConfigWithHiddenPassword , hidePathInfoPassword
2929import scsiutil
3030import iscsilib
3131import util
@@ -665,7 +665,8 @@ def BlockUnblockPaths(self, blockOrUnblock, script, noOfPaths, passthrough):
665665
666666 (rc , stdout , stderr ) = util .doexec (cmd ,'' )
667667
668- XenCertPrint ("The path block/unblock utility returned rc: %s stdout: '%s', stderr: '%s'" % (rc , stdout , stderr ))
668+ stdoutPrint = hidePathInfoPassword (stdout ) if self .storage_conf ['storage_type' ] == 'hba' else stdout
669+ XenCertPrint ("The path block/unblock utility returned rc: %s stdout: '%s', stderr: '%s'" % (rc , stdoutPrint , stderr ))
669670 if rc != 0 :
670671 raise Exception (" - The path block/unblock utility returned an error: %s." % stderr )
671672 return stdout
@@ -2579,7 +2580,7 @@ def RandomlyFailPaths(self):
25792580 XenCertPrint ("No of paths which should fail is %s out of total %s" % \
25802581 (self .noOfPaths , self .noOfTotalPaths ))
25812582 self .blockedpathinfo = scriptReturn .split ('::' )[0 ]
2582- PrintOnSameLine (" -> Blocking paths (%s)\n " % self .blockedpathinfo )
2583+ PrintOnSameLine (" -> Blocking paths (%s)\n " % hidePathInfoPassword ( self .blockedpathinfo ) )
25832584 return True
25842585 except Exception , e :
25852586 raise e
@@ -3395,6 +3396,9 @@ def __init__(self, base_handler):
33953396 if self .device_config ['provider' ] == 'iscsi' :
33963397 self .device_config ['target' ] = storage_conf ['target' ]
33973398 self .device_config ['targetIQN' ] = storage_conf ['targetIQN' ]
3399+ if storage_conf ['chapuser' ] is not None and storage_conf ['chappasswd' ] is not None :
3400+ self .device_config ['chapuser' ] = storage_conf ['chapuser' ]
3401+ self .device_config ['chappassword' ] = storage_conf ['chappasswd' ]
33983402
33993403 super (StorageHandlerGFS2 , self ).__init__ (storage_conf )
34003404
@@ -3413,15 +3417,19 @@ def Create(self):
34133417
34143418 device_config = copy .deepcopy (self .device_config )
34153419
3420+ if 'targetIQN' in device_config and len (device_config ['targetIQN' ].split (',' )) > 1 :
3421+ device_config ['targetIQN' ] = '*'
3422+
34163423 Print (" Creating the SR." )
34173424 # try to create an SR with one of the LUNs mapped, if all fails
34183425 # throw an exception
34193426 for scsiId in listSCSIId :
34203427 try :
34213428 device_config ['SCSIid' ] = scsiId
3429+ device_config_tmp = getConfigWithHiddenPassword (device_config , self .storage_conf ['storage_type' ])
34223430 XenCertPrint ("The SR create parameters are {}, {}" .format (
34233431 util .get_localhost_uuid (self .session ),
3424- device_config ))
3432+ device_config_tmp ))
34253433
34263434 sr_ref = self .session .xenapi .SR .create (
34273435 util .get_localhost_uuid (self .session ),
@@ -3437,7 +3445,7 @@ def Create(self):
34373445
34383446 XenCertPrint (
34393447 "Created the SR {} using device_config {}" .format (
3440- sr_ref , device_config ))
3448+ sr_ref , device_config_tmp ))
34413449 displayOperationStatus (True )
34423450 break
34433451
0 commit comments