Giter Site home page Giter Site logo

hellt / brvirt Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 4.0 4 KB

brvirt displays bridges and enclosed interfaces along with corresponding KVM Virtual Machines names and virsh domain ids.

Home Page: http://noshut.ru/2016/12/brvirt-when-brctl-meets-virsh/

License: MIT License

Python 100.00%

brvirt's Introduction

About brvirt

brvirt displays bridges and enclosed interfaces along with corresponding KVM Virtual Machines names and virsh domain ids.

It answers one simple question: How to determine which virtual interface belongs to which virtual machine and what bridge it is in?"

brvirt_demo

Requirements

The script is compatible with python2.7 and python3+.

  • brvirt uses virsh tool to list VM properties and virtual network interfaces. To install virsh use:
 # on Debian-based distros:
sudo apt-get install libvirt-bin

 # on RHEL based:
sudo yum install libvirt
  • Apart from virsh, the script relies on tabulate python package to render console tables:
TABULATE_INSTALL=lib-only pip install tabulate

Usage

As simple as python brvirt.py will produce the following output which combines brctl and virsh domiflist commands output:

(brvirt) [root@leo ~]# python brvirt.py
+----------+---------------+-----------+-------------+--------------------+
| Bridge   | Interface     | VM name   | Domain ID   | Int. MAC address   |
|----------+---------------+-----------+-------------+--------------------|
| br0      | eno1          |           |             | 28:80:23:90:ea:28  |
|          | vnet0         | cobbler   | 8           | 52:54:00:5a:a9:2c  |
|          | vnet4         | nuage-dns | 4           | 52:54:00:db:45:92  |
| br1      | eno2          |           |             | 28:80:23:90:ea:29  |
|          | vnet1         | cobbler   | 8           | 52:54:00:9b:c2:dc  |
| br999    | eno2.999@eno2 |           |             | 28:80:23:90:ea:29  |
+----------+---------------+-----------+-------------+--------------------+

brvirt's People

Contributors

hellt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.