Difference between revisions of "Vnx-console-mgmt"

From VNX
Jump to: navigation, search
Line 107: Line 107:
 
== Console windows configuration file ==
 
== Console windows configuration file ==
  
VNX allows to specify the position and desktop where
+
VNX allows to specify the position, desktop and other config parameters of the console windows of each virtual machine. The parameters are specified if a different file with .cvnx extension.
  
 
The name of the console windows configuration file can be specified with the <vnx_cfg> tag. For example:
 
The name of the console windows configuration file can be specified with the <vnx_cfg> tag. For example:
Line 114: Line 114:
 
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 <vnx_cfg> tag is not included, VNX looks for a file with the same name as the scenario file but with .cvnx extension.
  
 +
The format of the file 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.
 +
 +
VNX controls console windows using the Linux '''wmctrl''' command. 
  
  

Revision as of 00:45, 28 August 2014

VNX Console Management

To be completed soon...

VNX Console Definition

Consoles available depending on type of virtual machine:

  • libvirt virtual machines:
    • con0: the graphical console
    • con1: the textual console
  • Dynamips:
    • con1: the main console
    • con2: aux console (only available for C7200 routers)
  • Olive:
    • con1: the textual console
  <global>

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

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

<vm name="h2" type="libvirt" subtype="kvm" os="linux">

</vm>

VNX Console Commands

Two commands are provided in VNX to manage virtual machine consoles:

  • "--console", to open the consoles;
  • "--console-info" to show information about them.

--console option can be optionally followed by a comma separated list of of console names (eg. "--console con0,con1"). Besides, the -M option can be used to specify a virtual machine or a list of virtual machines the command applies to.

For example:

  • Show information about the consoles of an scenario:
  • sudo vnx -f scenario.xml -v --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'
    -----------------------------------------------------------------------------------------
     r1          | libvirt-kvm-linux   | con0:  'virt-viewer -c qemu:///system r1' or 'vncviewer :7'
                 |                     | con1:  'virsh -c qemu:///system console r1' or 'screen /dev/pts/13'
    -----------------------------------------------------------------------------------------
     r2          | libvirt-kvm-linux   | con0:  'virt-viewer -c qemu:///system r2' or 'vncviewer :8'
                 |                     | con1:  'virsh -c qemu:///system console r2' or 'screen /dev/pts/14'
    -----------------------------------------------------------------------------------------
     h3          | libvirt-kvm-linux   | con0:  'virt-viewer -c qemu:///system h3' or 'vncviewer :9'
                 |                     | con1:  'virsh -c qemu:///system console h3' or 'screen /dev/pts/22'
    -----------------------------------------------------------------------------------------
     h4          | libvirt-kvm-linux   | con0:  'virt-viewer -c qemu:///system h4' or 'vncviewer :10'
                 |                     | con1:  'virsh -c qemu:///system console h4' or 'screen /dev/pts/23'
    -----------------------------------------------------------------------------------------
    
  • Open all the consoles enabled in an scenario:
  • sudo vnx -f scenario.xml -v --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
    

Opening Consoles Manually

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.

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 if a different file with .cvnx extension.

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

<vnx_cfg>tutorial_lxc_ubuntu.cvnx</vnx_cfg>

If <vnx_cfg> tag is not included, VNX looks for a file with the same name as the scenario file but with .cvnx extension.

The format of the file 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.

VNX controls console windows using the Linux wmctrl command.


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