Page -> Vnx-console-mgmt Views :  Page  Discussion  View source  History 

From VNX

VNX console management

Each virtual machine started in a VNX scenario has one or more consoles associated. VNX allows to control the behaviour of these consoles, defining, for example, if they are shown when the scenario starts and the position and desktop where they are shown.

The consoles available depend on the type of virtual machine:

  • libvirt:
    • con0: the graphical console
    • con1: the textual console
  • LXC:
  • Dynamips:
    • con1: the main console
    • con2: aux console (only available for C7200 routers)
  • Olive:
    • con1: the textual console

VNX allows to specify in the main scenario file whether the consoles are started or not when the whole scenario or specific VMs (using -M option) are started.

Default values for all virtual machines can be specified in <global> section. For example:

	    <console id="0" display="yes"/>
	    <console id="1" display="no"/>

specifies that by default that only consoles con0 are shown at scenario startup.

Default values specified in <global> section can be superseded for a specifid VM inside the <vm> tag. For example:

<vm name="h1" type="libvirt" subtype="kvm" os="linux">
    <console id="0" display="no"/>
    <console id="1" display="yes"/>

specifies that for h1 VM con1 wll be shown and not con0.

Console related command line modes and options

Two modes are define in VNX to manage virtual machine consoles:

  • "--console", to manually open virtual machines consoles, independently of how they are configured in main scenario file;
  • "--console-info", to show information about consoles.

Both modes can be combined with the -M option to specify the comma separated list of virtual machines the command will apply to.

Besides, --console option can be optionally followed by a comma separated list of console names (eg. "--console con0,con1"). In this case, the consoles specified are started independently of how they are configured in the main scenario file.

For example:

  • Show information about the consoles of an scenario:
  • sudo vnx -f scenario.xml --console-info
     Scenario "tutorial_ubuntu" started
     VM_NAME     | TYPE                | CONSOLE ACCESS COMMAND
     h1          | libvirt-kvm-linux   | con0:  'virt-viewer -c qemu:///system h1' or 'vncviewer :0'
                 |                     | con1:  'virsh -c qemu:///system console h1' or 'screen /dev/pts/0'
     h2          | libvirt-kvm-linux   | con0:  'virt-viewer -c qemu:///system h2' or 'vncviewer :6'
                 |                     | con1:  'virsh -c qemu:///system console h2' or 'screen /dev/pts/12'
  • Open all the consoles enabled in an scenario:
  • sudo vnx -f scenario.xml --console

    only the consoles with the 'display' attribute set to 'yes' are opened.

  • Open the first console of every virtual machine of an scenario:
  • sudo vnx -f scenario.xml -v --console con1

    When specifing the console name after the "--console" option, the consoles are opened independently of the value of the 'display' attribute.

  • Open the first console of a specific virtual machine of an scenario:
  • sudo vnx -f scenario.xml -v --console con1 -M h1

Finally, it is also possible to supersed the console configuration and start a scenario without showing any console using the "-n|--no-console" option. For example:

vnx -f tutorial_lxc_ubuntu.xml -v -t --no-console

Console windows configuration file

VNX allows to specify the position, desktop and other config parameters of the console windows of each virtual machine. The parameters are specified in a separate file with .cvnx extension.

The name of the console windows configuration file can be specified with the <vnx_cfg> tag. For example:


will instruct VNX to read config parameters from a tutorial_lxc_ubuntu.cvnx file located in the same directory than the scenario file (absolute filenames can also be specified).

If <vnx_cfg> tag is not included, VNX looks for a file with the same name as the scenario file but with .cvnx extension. If that file is not found, the postition of console windows will be controlled by the window manager.

The format of the config file is very simple and can be seen in the examples below. It allows to specify default values for each console id using the <default> tag and to specify specific values for each virtual machine console using the <vm> tag.

If the id attribute is not specified in <default> or <vm> tags, the values specified will apply to any console. If included they will only apply for the console with that id.

VNX controls console windows using the Linux wmctrl command.

Example 1

In this example, we define that by default consoles con0 (graphical consoles in KVM) are sent to desktop 0, shown in (0,0) position, with a size of 600x400, and not shown on_top of other windows. Consoles con1 (text consoles in KVM) are shown with the same position and size but on_top of other windows and in desktop 1.

We also define different values for virtual machine vm1

<default id="0" win="0,0,600,400" desktop="0" ontop="no"/>
<default id="1" win="0,0,600,400" desktop="1" ontop="yes"/>
<vm name="vm1" id="0" win="200,0,600,400" desktop="1" ontop="yes"/>
<vm name="vm1" id="1" win="200,200,600,400" desktop="0" ontop="no"/>

Example 2

In this example we fix defaul values for all consoles (id not specified). We also define values for all consoles of vm1 virtual machine.

<default win="0,0,600,400" desktop="0" ontop="no"/>
<vm name="vm1" win="200,0,600,400" desktop="1" ontop="yes"/>

Example 3

tutorial_lxc_ubuntu.cvnx file used in LXC tutorial:

<default win="0,0,600,400" ontop="no"/>
<vm name="h1" win="0,0,600,400" ontop="yes"/>
<vm name="h2" win="0,400,600,400"/>
<vm name="h3" win="1200,0,600,400"/>
<vm name="h4" win="1200,400,600,400" ontop="yes"/>
<vm name="r1" win="400,200,600,400"/>
<vm name="r2" win="800,200,600,400"/>

Opening consoles manually

It is also possible to start the consoles of virtual machines manually using the commands provided by each hypervisor.

For example, for libvirt virtual machines, you can use libvirt "virsh list" commands to get the names and identifiers of each virtual machine:

# sudo virsh list
 Id Nombre               Estado
 31 ubuntu-gui           running

And start the consoles manually using "virt-viewer" command for the graphical consoles and "virsh console" for the textual ones.

For example:

# virt-viewer 31 &                       # To open the graphical console
# xterm -e "sudo virsh console 31" &     # To open the text console

Beware that only one textual console can be used at a time. If you open a second one, you will experiment a strange behaviour as both consoles will compete for the pts terminal. On the contrary, you can open several graphical console simultaneously.

For LXC virtual machines, yo can use the lxc-console command. For example:

lxc-console -n h1

You can consult the command used by VNX to start the consoles by looking at the output of "--console-info" VNX mode described above.

Personal tools