ó æ ”\c@s•ddlZddlmZddlTddlZddljZddlm Z ddl Z ddl Z ej j ƒZdejfd„ƒYZdS(iÿÿÿÿNi(thotplug(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)tt|ƒj||Žtƒ|_dS(N(tsuperRt__init__Rt_cmd(tselftargstkwargs((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyRscCsztt|ƒjƒt|_tƒ|_x?|jjdƒD]+}|j |ƒr;|jj |j ƒq;q;Wtƒ|_ dS(Ntscsi( RRt _init_devicestTruet_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.pyR s  cCs&g|D]}|jjd|ƒ^qS(NR (Rt get_device(Rtdevicestx((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyt_get_device_objects scCs |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*scCs/|j|ƒr+tt|ƒj||ƒndS(N(RRRR(RteventR((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyR-scCstt|ƒj||ƒdS(N(RRt_added_device_apply_tuning(Rtinstancet device_name((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyR$1scCstt|ƒj||ƒdS(N(RRt_removed_device_unapply_tuning(RR%R&((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyR'4scCs idd6S(Ntalpm(tNone(R((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyt_get_config_options7scCst|_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_cleanupAscCstjjdt|ƒ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_fileDsR(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)R5R1R2texistsRt write_to_filetlogtinfoR4(RtpolicyRtsimt policy_file((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyt _set_alpmGs cCsA|j|ƒ}|jj|dtƒjƒ}|dkr=|SdS(Ntno_errort(R5Rt read_fileR tstripR)(RRtignore_missingR=R;((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyt _get_alpmTs(t__name__t __module__t__doc__RR Rt classmethodRR R"RR$R'R*R.R/R5t command_setR R>t command_getR,RD(((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyR s"           (terrnoR@Rt decoratorst tuned.logsttunedt tuned.conststconststtuned.utils.commandsRR1tretlogstgetR9tPluginR(((sB/usr/lib/python2.7/site-packages/tuned/plugins/plugin_scsi_host.pyts