def asi_context(self): import os from infi.asi.unix import OSFile from infi.asi import create_platform_command_executer handle = OSFile(os.open(self.get_scsi_access_path(), os.O_RDWR)) executer = create_platform_command_executer(handle, timeout=SG_TIMEOUT_IN_MS) try: yield executer finally: handle.close()
def asi_context(access_path): import os from infi.asi.unix import OSFile from infi.asi.linux import LinuxIoctlCommandExecuter handle = OSFile(os.open(access_path, os.O_RDWR)) executer = LinuxIoctlCommandExecuter(handle) try: yield executer finally: handle.close()
def asi_context(self): import os from infi.asi.unix import OSFile from infi.asi import create_platform_command_executer from .scsi import SG_TIMEOUT_IN_MS handle = OSFile(os.open(os.path.join("/dev", self.sysfs_device.get_scsi_generic_device_name()), os.O_RDWR)) executer = create_platform_command_executer(handle, timeout=SG_TIMEOUT_IN_MS) try: yield executer finally: handle.close()
def asi_context(self): import os from infi.asi.unix import OSFile from infi.asi.linux import LinuxIoctlCommandExecuter handle = OSFile(os.open(self.get_block_access_path(), os.O_RDWR)) executer = LinuxIoctlCommandExecuter(handle) executer.call = gevent_wrapper.defer(executer.call) try: yield executer finally: handle.close()