QEUMKVM, QEMU start or stop virtual machine from command line (CLI) 

KVM or Kernel Based Virtual Machine is a popular virtualization technology. It allows you to run virtual guest machines over a host machine.

To start or stop virtual machines created on head-less servers you have to use the CLI or command line interface. There are more than one option, but we will see just one.

We will use virsh, which is based on libvirt.

First check which virtual machines are available:

[root@amitmaheshwari.in ] # virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     Rhel-7.1                     shut off
 -     Rhel-7.2                     shut off
 -     Rhel-7.3                     shut off
 -     Rhel-7.4                     shut off

Now, Let say I want to start "Rhel-7.4" virtual machine

[root@amitmaheshwari.in ] # virsh start Rhel-7.4

The output is:

Domain Rhel-7.4 started

Now, we can re-check status of virtual machines

[root@amitmaheshwari.in ] # virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     Rhel-7.1                     running
 -     Rhel-7.2                     shut off
 -     Rhel-7.3                     shut off
 -     Rhel-7.4                     shut off

To shut it down, just enter.

[root@amitmaheshwari.in ] # virsh shutdown Rhel-7.4

 
Top
Maintained By Amit Maheshwari