File: //usr/share/netplan/netplan/cli/commands/__pycache__/sriov_rebind.cpython-38.pyc
U
��~f� � @ sH d Z ddlZddlm mZ ddlmZmZmZ G dd� dej �Z
dS )z"netplan SR-IOV rebind command line� N)� PCIDevice�bind_vfs�_get_pci_slot_namec s, e Zd Z� fdd�Zdd� Zdd� Z� ZS )�NetplanSriovRebindc s t � jdddd� d S )NZrebindzKRebind SR-IOV virtual functions of given physical functions to their driverT)�
command_id�description�leaf)�super�__init__��self�� __class__� �7/usr/share/netplan/netplan/cli/commands/sriov_rebind.pyr
s �zNetplanSriovRebind.__init__c C s2 | j jdtdg dd� | j| _| �� | �� d S )N�netdevs�*z*Space separated list of PF interface names)�type�nargs�default�help)�parser�add_argument�str�command_rebind�func�
parse_args�run_commandr r r r �run! s �zNetplanSriovRebind.runc C s\ | j D ]P}t|�}t|�}|js2t�d�|�� qt|j|j �}t�
d�|t|��� qdS )zeBind virtual functions of SR-IOV devices to their corresponding driver after eswitch mode was changedz1{} does not seem to be a SR-IOV physical functionz{}: bound {} VFsN)r r r �is_pf�logging�warning�formatr �vfs�driver�info�len)r �iface�pci_addr�pcidev� bound_vfsr r r r ) s
z!NetplanSriovRebind.command_rebind)�__name__�
__module__�__qualname__r
r r �
__classcell__r r r
r r s r )�__doc__r �netplan.cli.utils�cli�utils�netplan.cli.sriovr r r �NetplanCommandr r r r r �<module> s