Nir Soffer has posted comments on this change. Change subject: hba: Rescan using SCSI layer ......................................................................
Patch Set 5: (7 comments) http://gerrit.ovirt.org/#/c/34245/5//COMMIT_MSG Commit Message: Line 22: This patch restores the missing scsi scan for fc_hosts, enabling discovery of Line 23: new FC LUNs in the multiapth rescan flow. Line 24: Line 25: Since scsi scan is a blocking operation, we perform the scan using external Line 26: command line tool, ensuring that vdsm cannot get stuck. This tool can be also > vdsm cannot get stuck; but can scanning of one host block others? If you do the scanning in vdsm, a thread can get stuck, and then you cannot restart stop (or kill) vdsm until the thread is finished. If you scan one fc_host after another, one scan operation get stuck, the rest of the fc_hosts will not be scanned until the stuck scan is finished. Line 27: useful outside of vdsm. Line 28: Line 29: In the fc-scan tool, we perform the scan in parallel, so blocking on Line 30: unresponsive fc_host will not prevent discovery of new devices on other http://gerrit.ovirt.org/#/c/34245/5/lib/vdsm/constants.py.in File lib/vdsm/constants.py.in: Line 163: Line 164: EXT_VDSM_TOOL = os.path.join('@BINDIR@', 'vdsm-tool') Line 165: Line 166: EXT_CURL_IMG_WRAP = '@LIBEXECDIR@/curl-img-wrap' Line 167: EXT_FC_SCAN = '@LIBEXECDIR@/fc-scan' > Please use CommandPath or just the explicit path to your libexec. This cons Ok, will use CommandPath http://gerrit.ovirt.org/#/c/34245/5/vdsm/storage/fc-scan File vdsm/storage/fc-scan: Line 63: def run(self): Line 64: try: Line 65: path = "/sys/class/scsi_host/%s/scan" % self.host Line 66: log.debug("Scanning %s", path) Line 67: start = time.time() > use the monotnic system timer (os.times()[4]) Why do we need monotonic timer for debugging? It is unlikely that the system time may change in the middle of a scan. This operation typically takes few milliseconds, and the resolution of os.times()[4] is only 10 milliseconds, so I don't see the benefit here. Line 68: fd = os.open(path, os.O_WRONLY) Line 69: try: Line 70: os.write(fd, "- - -") Line 71: finally: Line 66: log.debug("Scanning %s", path) Line 67: start = time.time() Line 68: fd = os.open(path, os.O_WRONLY) Line 69: try: Line 70: os.write(fd, "- - -") > We still need to support Python 2.6 (on el6). os.write releases the GIL also on python 2.6. In the worst case, one thread can get stuck and fc-scan will get into d state. vdsm will log a timeout after 30 seconds and continue. Line 71: finally: Line 72: os.close(fd) Line 73: self.succeeded = True Line 74: elapsed = time.time() - start Line 81: Line 82: def main(args): Line 83: if '-h' in args: Line 84: print __doc__ Line 85: sys.exit(0) > I much rather having main() return a value that you ok Line 86: Line 87: logging.basicConfig( Line 88: level=logging.DEBUG if '-v' in args else logging.INFO, Line 89: format="%(name)s: %(message)s") Line 87: logging.basicConfig( Line 88: level=logging.DEBUG if '-v' in args else logging.INFO, Line 89: format="%(name)s: %(message)s") Line 90: Line 91: if os.geteuid() != 0: > Don't check for that. We'll just get let it return permission denied. Assum ok Line 92: log.error("Must run as root") Line 93: sys.exit(2) Line 94: Line 95: hosts = [os.path.basename(path) Line 100: sys.exit(0) Line 101: Line 102: scans = [] Line 103: Line 104: for host in hosts: > have you considered using storage.misc.tmap()? there's a wide overlap with no, I don't want to add another dependency for such trivial code. Line 105: s = Scan(host) Line 106: s.start() Line 107: scans.append(s) Line 108: -- To view, visit http://gerrit.ovirt.org/34245 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7deb3047f1b75c4c65d59602b908835515290993 Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <[email protected]> Gerrit-Reviewer: Adam Litke <[email protected]> Gerrit-Reviewer: Allon Mureinik <[email protected]> Gerrit-Reviewer: Dan Kenigsberg <[email protected]> Gerrit-Reviewer: Federico Simoncelli <[email protected]> Gerrit-Reviewer: Nir Soffer <[email protected]> Gerrit-Reviewer: Saggi Mizrahi <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
