Guest User

diff LVHDoISCSISR.py (xcp-ng-8.0 vs XS-7.1)

a guest
Aug 24th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.76 KB | None | 0 0
  1. [15:02 xen1 ~]# diff /opt/xensource/sm/LVHDoISCSISR.py /mnt/backup-xs-7.1/opt/xensource/sm/LVHDoISCSISR.py
  2. 21,23c21,23
  3. < import SR, LVHDSR, BaseISCSI, SRCommand, util, scsiutil, lvutil
  4. < import time
  5. < import os, sys
  6. ---
  7. > import SR, VDI, LVHDSR, BaseISCSI, SRCommand, util, scsiutil, lvutil
  8. > import statvfs, time
  9. > import os, socket, sys, re
  10. 27a28
  11. > import mpp_luncheck
  12. 35,36c36
  13. <                 "VDI_UPDATE", "VDI_MIRROR", "VDI_CONFIG_CBT",
  14. <                 "VDI_ACTIVATE", "VDI_DEACTIVATE"]
  15. ---
  16. >                 "VDI_UPDATE", "VDI_MIRROR"]
  17. 90d89
  18. <             saved_exc = None
  19. 158c157
  20. <                 except Exception as exc:
  21. ---
  22. >                 except:
  23. 160,169c159
  24. <                     saved_exc = exc
  25. <             try:
  26. <                 self.iscsi = self.iscsiSRs[0]
  27. <             except IndexError as exc:
  28. <                 if isinstance(saved_exc, SR.SROSError):
  29. <                     raise saved_exc # pylint: disable-msg=E0702
  30. <                 elif isinstance(saved_exc, Exception):
  31. <                     raise xs_errors.XenError('SMGeneral', str(saved_exc))
  32. <                 else:
  33. <                     raise xs_errors.XenError('SMGeneral', str(exc))
  34. ---
  35. >             self.iscsi = self.iscsiSRs[0]
  36. 398a389,393
  37. >                 mpp_lun = False
  38. >                 if (mpp_luncheck.is_RdacLun(scsi_id)):
  39. >                     mpp_lun = True
  40. >                     link=glob.glob('/dev/disk/by-scsibus/%s-*' % scsi_id)
  41. >                     mpp_adapter = link[0].split('/')[-1].split('-')[-1].split(':')[0]
  42. 403a399,400
  43. >                     if mpp_lun:
  44. >                         sgdevs.extend(filter(lambda r: r[1]==mpp_adapter, luns))
  45. 520,528d516
  46. <     def scan(self, sr_uuid):
  47. <         if self.mpath == "true":
  48. <             for i in self.iscsiSRs:
  49. <                 try:
  50. <                     i.attach(sr_uuid)
  51. <                 except SR.SROSError:
  52. <                     util.SMlog("Connection failed for target %s, continuing.." %i.target)
  53. <         LVHDSR.LVHDSR.scan(self, sr_uuid)
  54. <
  55. 536a525
  56. >             mpp_lun = False
  57. 538c527,531
  58. <                 maps = mpath_cli.list_maps()
  59. ---
  60. >                 if (mpp_luncheck.is_RdacLun(self.dconf['SCSIid'])):
  61. >                     mpp_lun = True
  62. >                     link=glob.glob('/dev/disk/mpInuse/%s-*' % self.dconf['SCSIid'])
  63. >                 else:
  64. >                     maps = mpath_cli.list_maps()
  65. 542,543c535,540
  66. <             if self.dconf['SCSIid'] in maps:
  67. <                 raise xs_errors.XenError('SRInUse')
  68. ---
  69. >             if (mpp_lun):
  70. >                 if (len(link)):
  71. >                     raise xs_errors.XenError('SRInUse')
  72. >             else:
  73. >                 if self.dconf['SCSIid'] in maps:
  74. >                     raise xs_errors.XenError('SRInUse')
Advertisement
Add Comment
Please, Sign In to add comment