ó ±2öYc@s‘ddlZddlZddlTddlZddljZddlmZddl Z ddl Z ej j ƒZ dejfd„ƒYZdS(iÿÿÿÿN(t*(tcommandstSCSIHostPlugincBsÂeZdZd„Zd„Zd„Zed„ƒZd„Zd„Z d„Z d„Z d „Z ed „ƒZ d „Zd „Zd „Zeddeƒd„ƒZedƒed„ƒZRS(s, Plugin for tuning options of SCSI hosts. cOs,t|j|ƒj||Žtƒ|_dS(N(tsupert __class__t__init__Rt_cmd(tselftargstkwargs((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyRscCsgt|_tƒ|_x?|jjdƒD]+}|j|ƒr(|jj|jƒq(q(Wtƒ|_ dS(Ntscsi( tTruet_devices_supportedtsett _free_devicest_hardware_inventoryt get_devicest_device_is_supportedtaddtsys_namet_assigned_devices(Rtdevice((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyt _init_devicess   cst‡fd†|ƒS(Ncsˆjjd|ƒS(NR (Rt get_device(tx(R(sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyt s(tmap(Rtdevices((RsB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyt_get_device_objectsscCs |jdkS(Nt scsi_host(t device_type(tclsR((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyR"scCs|jj|d|jƒdS(NR (Rt subscribet_hardware_events_callback(R((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyt_hardware_events_init&scCs|jj|ƒdS(N(Rt unsubscribe(R((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyt_hardware_events_cleanup)scCs2|j|ƒr.t|j|ƒj||ƒndS(N(RRRR!(RteventR((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyR!,scCs t|j|ƒj||ƒdS(N(RRt_added_device_apply_tuning(Rtinstancet device_name((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyR&0scCs t|j|ƒj||ƒdS(N(RRt_removed_device_unapply_tuning(RR'R(((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyR)3scCs idd6S(Ntalpm(tNone(R((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyt_get_config_options6scCst|_t|_dS(N(R t_has_static_tuningtFalset_has_dynamic_tuning(RR'((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyt_instance_init<s cCsdS(N((RR'((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyt_instance_cleanup@scCstjjdt|ƒdƒS(Ns/sys/class/scsi_host/tlink_power_management_policy(tostpathtjointstr(RR((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyt_get_alpm_policy_fileCsR*t per_devicecCsu|dkrdS|j|ƒ}|sqtjj|ƒrM|jj||ƒqqtjd|t |ƒfƒdSn|S(NsBALPM control file ('%s') not found, skipping ALPM setting for '%s'( R+R7R3R4texistsRt write_to_filetlogtinfoR6(RtpolicyRtsimt policy_file((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyt _set_alpmFs cCsA|j|ƒ}|jj|dtƒjƒ}|dkr=|SdS(Ntno_errort(R7Rt read_fileR tstripR+(RRtignore_missingR?R=((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyt _get_alpmSs(t__name__t __module__t__doc__RRRt classmethodRR"R$R!R&R)R,R0R1R7t command_setR R@t command_getR.RF(((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyR s"           (terrnothotplugt decoratorst tuned.logsttunedt tuned.conststconststtuned.utils.commandsRR3tretlogstgetR;tPluginR(((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyts