CloudMIP | a France-Grilles OpenStack platform

France-Grilles | Université Toulouse 3

CloudMIP | a France-Grilles OpenStack platform

France-Grilles | Université Toulouse 3

User Tools

VM console access

This is an [Advanced Topic] intended to people with a good understanding about VMs.

In the following, we'll show you how to gain access to a running VM through its tty line (i.e serial link —COM1). This is especially usefull in the hunt for bogus network setup which prevent you from accessing your VM through a SSH or telnet session.

[for those that can't wait] –> VM serial console access

First of all, one point to note is that all VM images provided by the oneadmin group come with serial link support enabled.
This means that we added the kernel parameter console=ttyS0 during VM install and it is now inherited.

Next and most important point for end-users is the resources declaration file (i.e ONE template file).
In the template file below, we have added a RAW XML section defining the serial port resource:
NAME    = SL65
  IMAGE_UNAME = "admin" ]
  NETWORK_UNAME="admin" ]
  MACHINE="rhel6.5.0" ]
# Contextualization
# Console (don't forget to pass the option 'console=ttyS0' to the kernel args)
RAW = [
        type = "kvm",
        data = "<devices>
                        <serial type='pty'>
                                <source path='/dev/pts/1'/>
                                <target port='0'/>
                                <alias name='serial0'/>
                        <console type='pty' tty='/dev/pts/1'>
                                <source path='/dev/pts/1'/>
                                <target type='serial' port='0'/>
                                <alias name='serial0'/>

The XML declared RAW section is added as-is to the generated XML file sent to qemu on the various nodes intended to host a VM.
Without this serial port definition, it won't be possible to access a VM without a NIC.

Becarful: OpenNebula / Sunstone bogus cloning function strips off the serial console definition within the XML RAW section. This means that when you clone a template, it will skip the serial port definition!

VM Serial console

Now that you've just launched a new VM, you'd like now to see its kernel booting sequence.
This action involves the following steps:

  • connect to the node where the VM has been deployed,
  • connect to the VM“s console through the virsh command.

Considering the following use case:

<user>@cloudmip[~] onevm list
francois@cloudmip[~] onevm list
    ID USER     GROUP    NAME            STAT UCPU    UMEM HOST             TIME
   104 francois users    SL65-104        runn   99      2G wn1          0d 00h00

Thus, we'll connect to the node named wn1 and ask for the virsh list of deployed VMs:

francois@cloudmip[~] ssh wn1
Warning: Permanently added 'wn1,' (RSA) to the list of known hosts.
Last login: Tue May  6 23:39:48 2014 from
francois@wn1[~] virsh list
 Id    Name                           State
 28    one-104                        running

We now have identified the VMID = 28 as our VM, and we'll ask for console to virsh:

francois@wn1[~] virsh console 28
Connected to domain one-104
Escape character is ^]

Scientific Linux release 6.5 (Carbon)
Kernel 2.6.32-431.11.2.el6.x86_64 on an x86_64 login:

You're then pretty much like the same as being in front of the console of a real node.

[Note]: to espace from the virsh console, press the sequence CTRL + AltGr + ]