Skip to content

Commit

Permalink
CA-142238: Fix parsing lvmohba probe xml
Browse files Browse the repository at this point in the history
With xs64bit, sr-probe has attributes like supported_speeds
which have comma separated values that break the exising parser.

This patch ensures that we don't break the required xml even if the
exception contains additional tags with comma separated values.

Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>

GitHub: closes #23 on xenserver/xencert
  • Loading branch information
siddharthv committed Sep 9, 2014
1 parent 26d0538 commit f3b895b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions XenCert/StorageHandlerUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,10 @@ def GetListPortalScsiIdForIqn(session, server, targetIqn, chapUser = None, chapP
XenCertPrint("GetListPortalScsiIdForIqn - returning PortalList: %s." % listPortal)
XenCertPrint("GetListPortalScsiIdForIqn - returning SCSIIdList: %s." % listSCSIId)
return (listPortal, listSCSIId)


def extract_xml_from_exception(e):
return ','.join(str(e).split(',')[3:])

# The returned structure are a list of portals, and a list of SCSIIds for the specified IQN.
def GetHBAInformation(session):
try:
Expand All @@ -361,7 +364,7 @@ def GetHBAInformation(session):
try:
# the target may not return any IQNs
# so prepare for it
xmlstr = str(e).split(',')[3]
xmlstr = extract_xml_from_exception(e)
xmlstr = xmlstr.lstrip()
xmlstr = xmlstr.lstrip('\'')
xmlstr = xmlstr.rstrip()
Expand Down

0 comments on commit f3b895b

Please # to comment.