A cloud machine instead of a laptop

Video 016 of 140 in Virtualization Foundations, in the unit “Setting up your lab machine”. 3:24, with English and Hindi audio.

Some learners do not have a laptop that suits the lab. A rented cloud machine can be the lab host instead, if it allows nested virtualization. Nesting means a hypervisor runs inside a virtual machine. This article explains what that adds to the stack, what it costs in speed and money, how to choose a machine, and how to check that nesting is on.

What you will learn

What nested virtualization adds to the stack

A hypervisor is the program that runs virtual machines. Normally it runs directly on real hardware. Nested virtualization means a hypervisor runs inside a virtual machine, and that virtual machine itself runs on the cloud's hardware.

That is one layer more than a laptop. Each layer adds a little work, so the practice machines run more slowly.

How to choose a cloud machine for the lab

Note: You pay for every hour the cloud machine runs. Stop it when you finish a session, so that it does not charge you while idle.

How to check that nesting is on

Start inside the cloud machine. The first command shows whether the processor's virtualization help is visible to this machine. Inside a cloud virtual machine, you should see VT-x or AMD-V.

Check that the virtualization help is visible
lscpu | grep Virtualization

If the help is missing here, the provider has not passed it through. No setting inside Ubuntu can fix that. If the help is visible, check that the KVM device file exists. It appears only when KVM can run on this machine.

Check that the KVM device file exists
ls /dev/kvm

Last, read the nested setting of the Intel KVM module. The answer Y means nesting is on. On an AMD machine, read the file for the kvm_amd module instead.

Read the nested setting of the Intel KVM module
cat /sys/module/kvm_intel/parameters/nested

Note: If nesting is off, change the machine's setting in the provider's console, then start the machine again.

A laptop or a cloud machine: how to decide

A cloud machine still works when no suitable laptop exists. Choose it for that reason, and accept the slower speed.

Check that nesting is on

Run these three commands inside the cloud machine, not on your own computer. Each one checks a different layer of the nested stack.

  1. Check that the virtualization help is visible inside the cloud machine. If nothing shows, the provider has not passed it through.

    lscpu | grep Virtualization

    What you should see: You should see VT-x or AMD-V. No line means the provider has not passed the help through.

  2. Check that the KVM device file exists, which shows that KVM can start on this machine.

    ls /dev/kvm

    What you should see: The device file appears. It is missing when KVM cannot run on this machine.

  3. Read the nested setting of the Intel KVM module. On an AMD machine, read the kvm_amd file instead.

    cat /sys/module/kvm_intel/parameters/nested

    What you should see: The answer Y means nesting is on. Any other answer means you must change the setting in the provider's console.

Terms

Nested virtualization
Running a hypervisor inside a virtual machine, so that virtual machines can run inside it.
Hypervisor
The program that runs virtual machines and shares a computer among them.
SSH key
A pair of files that lets you log in to a machine securely, without typing a password.

Check yourself

What does nested virtualization add to the stack?

One more layer: a hypervisor runs inside a virtual machine, which itself runs on the provider's physical server.

What does a Y from the nested setting mean?

Nested virtualization is switched on, so a hypervisor can run inside this cloud machine.

Why should you stop a rented cloud machine when you finish?

The machine charges for every hour it runs, so stopping it saves money while you are not using it.

Previous: Saving and restoring your lab's state. Next: What a CPU does, step by step.