phenomenaSometimes there is a very strange phenomenon, regardless of the configuration of a few CPUs, but in the Win7 system, only see 2 CPU: Configured 4CPU, in the processor to see is 4, but only use 2:
reason1. Windows 7 supports up to two CPU sockets and can have multiple core within each socket. 2, KVM default per CPU simulation of a socket, you must modify the virtual machine CPU topology to use more than one CPU. 3, about Windows64 specific reasons please refer to Microsoft Official details: http://windows.microsoft.com/zh-cn/windows7/taking-the-mystery-out-of-64-bit-windows
SolutionsModified to a socket with multiple core. The XML configuration file is: File location (the default default path is/etc/libvirt/qemu/your virtual machine name. xml) <topology sockets= ' 1 ' cores= ' 4 ' threads= ' 1 '/> problem solved.
Appendix:
The concept understanding and client analysis of the kernel-based virtual machine for KVM
As a KVM learner, if you want to refine a KVM sample-level solution, just learning to use graphical interfaces and simple configurations (see the previous article for details) is far from enough. In the above, thanks to @laowolf, let me have the motivation to complete the next in-depth "popular science." Perhaps in the writing of this article, the author does not have the energy to @laowolf mentioned several difficult issues to explore, but still need to write text to the dissemination of knowledge and experience record, then also want to try to throw a number of hot issues aimed at a discussion.
Technically, KVM is part of the cloud-virtualization category. But today we are not going to discuss the so-called cloud computing, we focus on the more in-depth KVM knowledge. For readers: KVM Virtualization enthusiasts, junior operators, computer network enthusiasts, KVM users.
1.KVM conceptual understanding based on kernel
When it comes to the kernel, most learners and enthusiasts feel that this is an obscure concept, so today I would like to briefly explain to you what KVM is based on the kernel (if not, you can point it out in the comments section). ):
To understand what is based on the kernel, it is clear that we need some background knowledge as a support.
1.1 Background Knowledge:
Operating system kernel design of the two camps: micro-core and single core. Single-core is a simpler design, refers to the entire system's kernel functions (specific kernel functions you can refer to the Linux/unix System Programming manual, this is not the focus of this article, the author does not repeat the) set in a large kernel space to achieve, in such a kernel space, Communication between cores can be achieved simply by calling a function. But there is a big drawback: once the kernel file is modified, it means recompiling the source code; The kernel, in contrast, is divided into several separate processes. Each process is called a server. Generally speaking, the server runs in its own independent address space, communication through the process of communication between the mechanism to complete. (somewhat similar to a Web site's server distributed management) so process communication means that the space switch, the overhead is relatively large.
Linux kernel design may be said to be the use of a single core + micro-kernel design. On the one hand, the Linux kernel is designed as a single kernel, though on the other hand, the Linux kernel draws on the essence of the microkernel: modular design and dynamic loading of kernel modules. In addition to core kernel functions (such as process switching, memory management), most of the internals and functions are modular, and these kernel modules exist as separate binary files, dynamically loaded during the kernel's operation, and linked into the kernel space. Modules that are not used can also be uninstalled. This design ensures kernel performance and improves the flexibility of the kernel.
If you understand the above, the KVM we want to know is one of the kernel modules. Can be assembled into the kernel when needed, and can be unloaded when it is not needed. So KVM as a kernel module of the virtual machine, its performance, speed and so we can imagine, relative to other similar type of virtual confidential higher.
1.2 about the type of virtual machine:
Type one: In layman's terms, there is no common "host" virtual machine, when the computer just started loading the virtualization module, which means that only a necessary kernel to virtualize virtual machine deployment, such virtualization technology is typically Xen.
Type two: Virtualization Technology with host hosts: KVM, and the famous VMware workstation,virtual Box. Load the virtualization module after the host is started. For example, to use KVM, you must first start the host, but also to ensure that the KVM kernel module loading.
Apparently KVM input type II virtual machine.
1.3 More about QEMU's relationship with KVM:
In short, QEMU is actually an already existing virtualization solution, but unlike KVM, Qemu is a completely software-based virtualization scenario, which means that QEMU can operate entirely on a software virtual client, and then we ask, Is this efficiency not very unreliable? The author wants to tell you: Yes. QEMU's efficiency is really low. So how is QEMU related to the KVM? In fact, we can make an analogy: Coral and clown fish. Clown fish live alone is not a high probability of survival, polyps need clown fish to help maintain the ecological circle homeostasis. So the KVM is like a coral, and QEMU is like a clown fish. QEMU can rely on the KVM-provided kernel interface to greatly improve its efficiency.
Then again, in theory, virtualization can be accomplished as long as the software virtualization technology is based on the KVM-provided kernel interface. But in fact, QEMU-KVM's mutually beneficial symbiotic relationship is very strong and efficient.
1.4 Important concepts that are recurring in this series of articles:
Hypervisor: Runs on the real physical system, manages the hardware platform, and provides the corresponding virtual hardware platform for each virtual client.
Intel Virtualization Technology: A collection of hardware technologies that enable virtual machine monitor software to improve the performance and functionality of virtualized software by choosing to utilize technologies that are based on x86 architectures and require support from Intel Virtualization technology, All we need to do is turn on the virtualization module from the BIOS (Baidu:bios turn on virtualization to solve).
So as a virtualization technology enthusiast, with a little understanding of the concept of KVM, it is clear that we need to further the implementation of KVM server building and management.
Analysis of 2.Guest and host
Before I begin, we still need to add a few notes:?
1 2 3 |
1. This paper only applies to CentOS and Rhel systems. 2. Hardware platform Intel Vt-x can be. 3.KVM version 3.5 or more, QEMU is QEMU-KVM 1.1 version. |
On the construction of the words I really have written in an article, graphic structure, and successfully visited. See the author's previous article, "Beginners can also learn the Cloud desktop virtualization."
Obviously, as a moderate user. We need to understand the elements that we need to be aware of if we want to properly manage a KVM host:
Information acquisition of 2.1 host
First of course we have to clear host concept, host is host, in this article is equipped with KVM Core centos,guest is the client, in this paper is the xp_for_test of this WinXP test machine.
Here I have a complete record of the capability XML for the KVM host. To make it easier for readers to read useful information, I'll insert an introduction between XML to help you understand the capabilities information needed for KVM.
Here for the continuity of the series, I used the XP virtual machine in my last article to list its XML, which is a spoiler for the next article, and will use the Libvirt API to list the required elements.
Libvirt is a set of scenarios for managing virtualization, including Virsh (command line) and Libvirt API two sets of interfaces
Below I post the code that uses the API to get information:
#include "stdlib.h" #include "stdio.h" Ibvirt.h   ; //libvirt Library Int main (int arg #include "libvirt/lc,char *argv[
]) { virConnectPtr conn ;
Open (NULL); // establishes the connection, char *caps; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;CONN&NBSP;=&NBSP;VIRCONNEC T parameter to NULL indicates establishing local connection if ( conn == NULL )
{to qemu : /// system \n ; ");
return 1; } caps &
nbsp; fprintf (stderr, "failed to connection = virconnectgetcapabilities (conn) //get native host's capabilities
fprintf (stdout, "capabilities is : \n%s \n", caps);
free (Caps); &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;VIRCONNECTCLOSE (conn); //closes connection with node
return 0; }
The above is a simple call to the libvirtapi of a C language file (in addition Libvirt support the binding of various languages), we will in the future articles in detail to explain the use of libvirt.
For the. c file above, we need to compile with the following command?