Display IP address with OpenNebula ‘onevm list’ command

This feature is supported out of the box starting OpenNebula 4.14, You simply need add the :IP column to the :default: group in /etc/one/cli/onevm.yaml file

Follow the below simple guide to display VM IP address using ‘onevm list‘ command – similar to SunStone.

  1. Open the /usr/lib/one/ruby/cli/one_helper/onevm_helper.rb and look for line 142 or section start with “def format_pool“.
  2. Add the following lines after column “Name”.
    column :IP, "IP address of the Virtual Machine", :size=>15 do |d|
    d["TEMPLATE"]["NIC"]["IP"]
    end
  3. Add the new column “IP” as default column at line 215.
    default :ID, :USER, :GROUP, :NAME, :IP, :STAT, :UCPU, :UMEM, :HOST, :TIME

  1. Open /etc/one/cli/onevm.yaml and the following lines after column “Name”.
    :IP:
    :desc: IP address of the Virtual Machine
    :size: 15
    :left: true
  2. Add the new column “IP” as default column in /etc/one/cli/onevm.yaml file.
    :default:
    - :ID
    - :USER
    - :GROUP
    - :NAME
    - :IP
    - :STAT
    - :UCPU
    - :UMEM
    - :HOST
    - :TIME

NOTE: The changes will not work if there is VM(s) with 2 IP addresses. Hope the developer able to assist on this.