관리-도구
편집 파일: plugin_irqbalance.cpython-36.opt-1.pyc
3 �<�e� � @ sd d dl mZ d dlmZ ddlmZ ddlZddlZddlZddl Z ej j� ZG dd� dej �ZdS )� )�base)�command_custom� )�constsNc s� e Zd ZdZ� fdd�Zdd� Zdd� Zedd � �Zd d� Z dd � Z dd� Zdd� Zdd� Z dd� Zdd� Zeddd�dd� �Z� ZS )�IrqbalancePlugina� `irqbalance`:: Plug-in for irqbalance settings management. The plug-in configures CPUs which should be skipped when rebalancing IRQs in `/etc/sysconfig/irqbalance`. It then restarts irqbalance if and only if it was previously running. + The banned/skipped CPUs are specified as a CPU list via the [option]`banned_cpus` option. + .Skip CPUs 2,4 and 9-13 when rebalancing IRQs ==== ---- [irqbalance] banned_cpus=2,4,9-13 ---- ==== c s t t| �j||� tj� | _d S )N)�superr �__init__�perfZcpu_map�_cpus)�self�args�kwargs)� __class__� �'/usr/lib/python3.6/plugin_irqbalance.pyr s zIrqbalancePlugin.__init__c C s d|_ d|_d S )NFT)Z_has_dynamic_tuningZ_has_static_tuning)r �instancer r r �_instance_init$ s zIrqbalancePlugin._instance_initc C s d S )Nr )r r r r r �_instance_cleanup( s z"IrqbalancePlugin._instance_cleanupc C s dd iS )N�banned_cpusr )�clsr r r �_get_config_options+ s z$IrqbalancePlugin._get_config_optionsc C sl y t tjd�� }|j� S Q R X W nF tk rf } z*|jtjkrJtjd� ntj d| � d S d }~X nX d S )N�rz>irqbalance sysconfig file is missing. Is irqbalance installed?z,Failed to read irqbalance sysconfig file: %s) �openr �IRQBALANCE_SYSCONFIG_FILE�read�IOError�errno�ENOENT�log�warn�error)r �f�er r r �_read_irqbalance_sysconfig1 s z+IrqbalancePlugin._read_irqbalance_sysconfigc C sZ y&t tjd��}|j|� W d Q R X dS tk rT } ztjd| � dS d }~X nX d S )N�wTz-Failed to write irqbalance sysconfig file: %sF)r r r �writer r r )r �contentr! r"