[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] qemu: match vcpu topology to maximum vcpu numbers.

On 05/29/2013 04:20 AM, Eric Blake wrote:
On 05/28/2013 03:59 AM, Guannan Ren wrote:
For qemu, if the -smp N or the value of maxcpus is given, it define
the number of vcpu of guest whenever the vcpu topology is defined or
not. But if the -smp N and maxcpus are missing, the topology can
compute and define vcpus for guest automatically by math:

vcpu number = sockets*cores*threads

For libvirt, as <vcpu> is always mandatory, so we can ask topology
to match maximum vcpu numbers.
  src/conf/domain_conf.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a9656af..ffdc6da 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11815,10 +11815,10 @@ virDomainDefParseXML(xmlDocPtr xml,
              goto error;
if (def->cpu->sockets &&
-            def->maxvcpus >
+            def->maxvcpus !=
              def->cpu->sockets * def->cpu->cores * def->cpu->threads) {
              virReportError(VIR_ERR_XML_DETAIL, "%s",
-                           _("Maximum CPUs greater than topology limit"));
+                           _("Topology limit does not match maximum CPUs"));
Is this going to reject XML that was previously accepted?  Is there a
bugzilla showing what happens if this patch is not incorporated?  I'm
worried about introducing an unintentional regression if we include this
in 1.0.6 without more justification.

Yes, it make the cpu topology limit setting more strict.
Alternatively, we can add more comments for <topology> to make it clear that
<vcpu> decide the number of vcpus,  the  sockets*cores*threads had better
be equal to vcpu numbers.

The bz:https://bugzilla.redhat.com/show_bug.cgi?id=880017

Description of problem:
libvirt should check if vcpu topology is right. If the wrong vcpu topology is given in xml , the wrong arguments also be passed to qemu-kvm.

vcpu number = sockets*cores*threads

Steps to Reproduce:
1.# virsh start vm
Domain vm started

2.# virsh dumpxml vm
<domain type='kvm' id='104'>
  <vcpu placement='static'>4</vcpu>
    <topology sockets='1' cores='4' threads='2'/>

3.# ps -ef|grep qemu-kvm
qemu     21296     1 14 16:41 ?        00:00:17 /usr/libexec/qemu-kvm -name vm -S -M rhel6.4.0 -enable-kvm -m 1024 -smp 4,sockets=1,cores=4,threads=2

Actual results:
Wrong vcpu topology can be given in xml and passed to qemu-kvm

Expected results:
libvirt should check if vcpu topology is right.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]