Using Virtual Machine Manager to manage VMS

Source: Internet
Author: User
Tags cpu usage ovirt

Reprinted from https://www.ibm.com/developerworks/cn/cloud/library/cl-managingvms/

Although server management has been a problem in the past, virtualization management simplifies some issues and amplifies others. The era of a single operating system on a server is over and replaced by multiple operating systems located in separate virtual machine (VM) containers. This property, known as virtual machine density , is useful because fewer server hardware is required as more and more virtual machines consume fewer servers. This leads to less hardware, lower power consumption, but adds management complexity.

Fortunately, there are solutions to mitigate the problems with server virtualization, which is led by Open source solutions. One of the solutions developed by Red Hat is called virtual machine Manager, which significantly simplifies the ability to manage virtual machines (running on critical open source hypervisors) while providing these VMS with the capability to measure their performance and monitor resource utilization.

Hypervisor and Virtual machine management

Virtualization presents new challenges for managing virtual machines, their resources, and the underlying resources of physical hosts. Multiple operating systems now share the resources of a physical host as virtual machines, and there is no longer a one-to-many mapping between the operating system and the physical host. Each virtual machine uses a container and other metadata to represent the container that holds one or more virtual disks that describe the configuration and constraints of the virtual machine. Each virtual machine shares the resources of the physical host, and the host needs not only the configuration, but also the utilization of these resources (to ensure that the virtual machines have the right density and the best use of the host, neither overloading the available resources nor wasting them).

Virt-manager Ways to manage virtualization

Virtual Machine Manager ( virt-manager ) is a lightweight application suite in the form of a command line or graphical user interface (GUI) for managing virtual machines. In addition to providing management capabilities for virtual machines, a virt-manager full graphical console for Guest VMs is provided through an embedded virtual Network Computing (VNC) client viewer.

As an application suite, it virt-manager includes a common set of virtualization management tools. These tools are listed in table 1, including virtual office building, cloning, image authoring, and viewing. The virsh utility is not virt-manager part of a package, but it is of great value in itself.

Table 1. Virtualized management applications (including command-line tools)
Application Description
virt-manager Virtual Machine Desktop management tools
virt-install Virtual Machine Provisioning Tools
virt-clone Virtual Machine Image cloning tool
virt-image Constructing a virtual machine from an XML descriptor
virt-viewer Virtual Machine Graphics Console
virsh virshInteractive terminal for Guest domain

virt-managerUse libvirt the virtualization library to manage the available hypervisor. libvirtexposes an application programming interface (API) that integrates with a large number of open-source hypervisors for control and monitoring. libvirtprovides a daemon named to libvirtd Help implement control and monitoring (as shown in a simple stack below).

Figure 1. A simple representation of the Virt-manager stack containing QEMU

Virtual Machine Manager is developed by Red Hat using the Python language to control the life cycle of virtual machines, including provisioning, virtual network management, statistical data collection and reporting, and providing simple graphical access to the virtual machine itself.

Installing Virt-manager

To install a virt-manager package, you can use the Package Manager for your specific release. For Ubuntu, use apt :

1 $ sudo apt-get install virt-manager

aptThe command installs an virt-manager application suite that uses approximately 22MB of disk space. As part of the installation, the libvirt daemon should be running. To verify, use the following command:

1 $ ps ax | grep libvirtd

The command should show libvirtd that the process is running and use the -d option to tell it libvirtd to run as a daemon. Recall that libvirtd this daemon, which allows you to virt-manager connect to hypervisors from your application and connect them to the virtual machines they host.

To verify that the virt-manager package is installed, and to understand virt-manager the location of the file, use the which command:

1 $ which virt-manager

virt-managerThe location is also the home directory for other applications ( virt-install , etc.) in the suite virt-image .

As a final step, use QEMU as the hypervisor, because QEMU can run on any hardware. As an emulator, QEMU runs a bit slower, but does not require a virtualized extension of new hardware.

1 $ sudo apt-get install qemu

Now use to virt-manager create two virtual machines and monitor them.

Create and manage virtual machines using Virt-manager

The steps in this section create two virtual machines.

  1. Install a Linux®-based operating system, SliTaz, which is a community-developed Linux operating system release. The system is also lightweight and has the advantage of running QEMU and simulating the hardware environment. You can download this virtual machine using the following command:
    1 $ wget http://mirror.slitaz.org/iso/4.0/slitaz-4.0.iso
  2. To start the virtual machine creation process, sudo start with the root user virt-manager :
    1 $ sudo virt-manager

    Opens virt-manager a window through which you can connect to the local QEMU hypervisor (by right-clicking localhost and clicking Connect). If more hypervisors are available, they should be listed here and connected through the libvirt API.

    Figure 2. Virtual Machine Manager window
  3. When you connect to the local QEMU hypervisor, click the Create virtual machine icon, which launches the VM construction Wizard.
  4. Name this virtual machine slitaz1 and initiate your operating system installation from a local ISO (downloaded above). Figure 3. Create a virtual machine
  5. After you click Forward, define the installation file for your virtual machine and select a type for the operating system. In this example, specify your ISO file, select Linux from the list of operating system types, and then choose Ubuntu 10.04 LTS (Lucid Linux) from the version list. Figure 4. Defining installation media
  6. Defines the execution environment for a virtual machine. Allocate 1GB of memory and a single CPU for this virtual machine. These choices require some skill because the memory size should fit your virtual machine (1GB is a bit overqualified for this particular instance). The CPU can help (and sometimes damage) the operating system. If the operating system effectively leverages multiple cores, these cores can be distributed to virtual machines. Figure 5. Defining the execution Environment
  7. Defines the storage environment for the virtual machine. In this example, the request is virt-manager made to create your virtual disk (rather than your own), and it is dynamically resized (up to 1 GB). Note that this disk option may affect installation and execution speed. If you specify a disk as dynamic, it starts with a smaller host file and then expands as the virtual machine uses it. This dynamic process requires relatively little time to manage. The alternate selection is raw, which is a full-size disk image with the host operating system (hypervisor). The cost here is that more host disk space is required, but the virtual machine should run faster because there is no need to dynamically adjust the process. Figure 6. Defining the storage environment
  8. As a final step, virt-manager it provides summary information about the virtual machine so far, allowing you to define networking options (choose default: Network address translation [NAT]). Note that it also provides additional options and information, such as the physical location of the virtual disk. You can also define the type of underlying processor you want. In this example, select AMD i686 as the schema, but you can also select X86-64. Figure 7. Final check of the virtual machine
  9. When you click Finish, the process of starting the virtual machine starts. It first directs a CD-ROM (where you provide the installation image), which allows the virtual machine to install the Linux. When the installation is complete, restart (this will automatically disconnect the CD-ROM) and you will get a functioning virtual machine. Note that this window only provides a view of the virtual machine and allows you to interact with it. You can close this window, but the virtual opportunity continues to run in the background (and you can virt-manager see it in the root window). Figure 8. Running a lightweight SliTaz Linux distribution virtual machine
  10. To create a new virtual machine, simply clone your existing, installed virtual machine. Specify that you want to clone the virtual machine to virt-manager , and then clone the entire disk (so that they are not shared). Note that you can adjust some of the details of the cloned virtual machine, such as the network configuration. Figure 9. Cloning a virtual machine in Virt-manager
  11. When you click Clone, a new virtual machine is created based on the first virtual machine, and the virtual machine can run concurrently in its own QEMU environment. Cloning a virtual machine is a good way to capture a snapshot of the operating system and application environment in a timely fashion, or to create a local virtualization cluster for a given application (such as Apache Hadoop) for the machine. In Figure 10, you can see that two virtual machines are executing, and you can virt-manager see their CPU usage in the root window. Figure 10. Cloned virtual machines run concurrently through Virt-manager

This example illustrates a simple way to create, configure, and execute a virtual machine without needing to know more about the underlying hypervisor and the many options it exposes (such as for storage and network management). Although this example uses the impersonation provided by QEMU, the Linux kernel virtual machine (KVM) hypervisor can be used to obtain near-bare-metal performance (using hardware support such as intel®virtual technology [VT]). In addition to cloning virtual machines, this feature allows you to virt-manager create, pause, and restart virtual machines through your application.

Support Tools

Although virt-manager one of the libvirt top users of the virtualization API, there is an increasingly large tool ecosystem that uses this interface for virtualization management. The virt-manager package provides a convenient GUI to create and manage virtual machines on multiple hypervisors and hosts. If you prefer the command line, many tools provide you with the ability and control that only the command line can provide.

virt-installTools provide the ability to provision new virtual machines. virt-managerprovides a small number of configuration options for virtual machine creation, and virt-install provides rich configuration options, including installation methods, storage configuration, network configuration, graphics configuration, virtualization options, and a large list of virtualization device options.

virt-imageTools are similar to virt-install tools, but they enable you to define the details of the virtual machine creation process in XML. The XML descriptor file specifies the generic metadata for the virtual machine, the domain properties (CPU, memory, and so on), and the storage configuration.

virt-cloneTool provides a way to clone an existing virtual machine image. Referring to cloning , I mean copying an existing virtual machine that has updated parameters to ensure that the new virtual machine is unique to avoid collisions (such as MAC address collisions).

virt-viewerTool provides a graphical console for a given virtual machine using the VNC protocol. virt-viewercan be attached to a virtual machine running on a local host or a remote host.

Finally, the most powerful tool for managing the Guest domain is the virtualized shell, or called virsh . virshcan be used to list, start, and stop virtual machines, as well as to create virtual machines. In short, you can use virsh cross-hypervisor execution to fully manage exposing virtualization features that are not available in other tools.

Other Virtualization Management Solutions

Although the virt-manager tools associated with it provide a useful environment for managing virtual machines in a desktop environment, in some cases you might prefer a richer platform virtualization solution. Red Hat also provides a solution that is similar to the one oVirt virt-manager used libvirt to manage virtual machines and back-end hypervisors. oVirtthe solution supports multiple back-end hypervisors and even manages enterprise-class storage protocols such as Fibre Channel, ISCSI, and Network File System (NFS). The oVirt solution also exposes some enterprise-class features, such as high availability and live migration in a homogeneous infrastructure.

More information

virt-manageris not simply another tool: it is moving toward an open cloud with open APIs and open cloud stacks (desktops, servers, data centers). virt-managerand related tools provide a simple and powerful environment for managing virtualization on the desktop. Whether you like the power of the command line and scripting, or prefer the simplicity of the GUI, virt-manager and its related tools are provided for you.

Using Virtual Machine Manager to manage VMS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.