Difference between revisions of "Vnx-console-mgmt"
Line 45: | Line 45: | ||
specifies that for ''h1'' VM ''con1'' wll be shown and not ''con0''. | specifies that for ''h1'' VM ''con1'' wll be shown and not ''con0''. | ||
− | + | == Console related command line modes and options == | |
− | |||
− | |||
− | == | ||
Two commands are provided in VNX to manage virtual machine consoles: | Two commands are provided in VNX to manage virtual machine consoles: | ||
Line 94: | Line 91: | ||
sudo vnx -f scenario.xml -v --console con1 -M h1 | sudo vnx -f scenario.xml -v --console con1 -M h1 | ||
</ul> | </ul> | ||
+ | |||
+ | 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 | ||
+ | |||
== Opening Consoles Manually == | == Opening Consoles Manually == |
Revision as of 01:33, 28 August 2014
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:
<global> ... <vm_defaults> <console id="0" display="yes"/> <console id="1" display="no"/> </vm_defaults> ... </global>
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"/> ... </vm>
specifies that for h1 VM con1 wll be shown and not con0.
Contents
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' -----------------------------------------------------------------------------------------
sudo vnx -f scenario.xml -v --console
only the consoles with the 'display' attribute set to 'yes' are opened.
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.
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
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 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:
<vnx_cfg>tutorial_lxc_ubuntu.cvnx</vnx_cfg>
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
<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="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"/> </vnx_cfg>
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.
<vnx_cfg> <default win="0,0,600,400" desktop="0" ontop="no"/> <vm name="vm1" win="200,0,600,400" desktop="1" ontop="yes"/> </vnx_cfg>