2.2. Starting the Virtual Machine

2.2.1. Starting a Virtual Machine

Starting Virtual Machines

  1. Click ComputeVirtual Machines and select a virtual machine with a status of Down.
  2. Click Run.

The Status of the virtual machine changes to Up, and the operating system installation begins. Open a console to the virtual machine if one does not open automatically.

Note

A virtual machine will not start on a host that the CPU is overloaded on. By default, a host’s CPU is considered overloaded if it has a load of more than 80% for 5 minutes but these values can be changed using scheduling policies. See Scheduling Policies in the Administration Guide for more information.

2.2.2. Opening a Console to a Virtual Machine

Use Remote Viewer to connect to a virtual machine.

Connecting to Virtual Machines

  1. Install Remote Viewer if it is not already installed. See Section 1.4.1, “Installing Console Components”.
  2. Click ComputeVirtual Machines and select a virtual machine.
  3. Click Console. A console.vv file will be downloaded.
  4. Click the file and a console window will automatically open for the virtual machine.
Note

You can configure the system to automatically connect to a virtual machine. See Section 2.2.4, “Automatically Connecting to a Virtual Machine”.

2.2.3. Opening a Serial Console to a Virtual Machine

You can access a virtual machine’s serial console from the command line instead of opening a console from the Administration Portal or the VM Portal. The serial console is emulated through VirtIO channels, using SSH and key pairs. The Manager acts as a proxy for the connection, provides information about virtual machine placement, and stores the authentication keys. You can add public keys for each user from either the Administration Portal or the VM Portal. You can access serial consoles for only those virtual machines for which you have appropriate permissions.

Important

To access the serial console of a virtual machine, the user must have UserVmManager, SuperUser, or UserInstanceManager permission on that virtual machine. These permissions must be explicitly defined for each user. It is not enough to assign these permissions to Everyone.

The serial console is accessed through TCP port 2222 on the Manager. This port is opened during engine-setup on new installations. To change the port, see ovirt-vmconsole/README.

Using a serial console requires configuring the firewall rules. For more information, see: * Rule "M3" in the Red Hat Virtualization Manager Firewall Requirements * Rule "H2" in the Host Firewall Requirements

The serial console relies on the ovirt-vmconsole package and the ovirt-vmconsole-proxy on the Manager, and the ovirt-vmconsole package and the ovirt-vmconsole-host package on the virtualization hosts. These packages are installed by default on new installations. To install the packages on existing installations, reinstall the host. See Reinstalling Hosts in the Administration Guide.

Enabling a Virtual Machine’s Serial Console

  1. On the virtual machine whose serial console you are accessing, add the following lines to /etc/default/grub:

    GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"
    GRUB_TERMINAL="console serial"
    GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
    Note

    GRUB_CMDLINE_LINUX_DEFAULT applies this configuration only to the default menu entry. Use GRUB_CMDLINE_LINUX to apply the configuration to all the menu entries.

    If these lines already exist in /etc/default/grub, update them. Do not duplicate them.

  2. Rebuild /boot/grub2/grub.cfg:

    • BIOS-based machines:

      # grub2-mkconfig -o /boot/grub2/grub.cfg
    • UEFI-based machines:

      # grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

      See GRUB 2 over a Serial Console in the Red Hat Enterprise Linux 7 System Administrator’s Guide for details.

  3. On the client machine from which you are accessing the virtual machine serial console, generate an SSH key pair. The Manager supports standard SSH key types, for example, an RSA key:

    # ssh-keygen -t rsa -b 2048 -C "user@domain" -f .ssh/serialconsolekey

    This command generates a public key and a private key.

  4. In the Administration Portal or the VM Portal, click the name of the signed-in user on the header bar and click Options. This opens the Edit Options window.
  5. In the User’s Public Key text field, paste the public key of the client machine that will be used to access the serial console.
  6. Click ComputeVirtual Machines and select a virtual machine.
  7. Click Edit.
  8. In the Console tab of the Edit Virtual Machine window, select the Enable VirtIO serial console check box.

Connecting to a Virtual Machine’s Serial Console

On the client machine, connect to the virtual machine’s serial console:

  • If a single virtual machine is available, this command connects the user to that virtual machine:

    # ssh -t -p 2222 ovirt-vmconsole@Manager_FQDN -i .ssh/serialconsolekey
    Red Hat Enterprise Linux Server release 6.7 (Santiago)
    Kernel 2.6.32-573.3.1.el6.x86_64 on an x86_64
    USER login:
  • If more than one virtual machine is available, this command lists the available virtual machines and their IDs:

    # ssh -t -p 2222 ovirt-vmconsole@Manager_FQDN -i .ssh/serialconsolekey list
    1. vm1 [vmid1]
    2. vm2 [vmid2]
    3. vm3 [vmid3]
    > 2
    Red Hat Enterprise Linux Server release 6.7 (Santiago)
    Kernel 2.6.32-573.3.1.el6.x86_64 on an x86_64
    USER login:

    Enter the number of the machine to which you want to connect, and press Enter.

  • Alternatively, connect directly to a virtual machine using its unique identifier or its name:

    # ssh -t -p 2222 ovirt-vmconsole@Manager_FQDN connect --vm-id vmid1
    # ssh -t -p 2222 ovirt-vmconsole@Manager_FQDN connect --vm-name vm1

Disconnecting from a Virtual Machine’s Serial Console

Press any key followed by ~ . to close a serial console session.

If the serial console session is disconnected abnormally, a TCP timeout occurs. You will be unable to reconnect to the virtual machine’s serial console until the timeout period expires.

2.2.4. Automatically Connecting to a Virtual Machine

Once you have logged in, you can automatically connect to a single running virtual machine. This can be configured in the VM Portal.

Automatically Connecting to a Virtual Machine

  1. In the Virtual Machines page, click the name of the virtual machine to go to the details view.
  2. Click the pencil icon beside Console and set Connect automatically to ON.

The next time you log into the VM Portal, if you have only one running virtual machine, you will automatically connect to that machine.