解决 CPU topology doesn't match maximum vcpu count


[root@nova08 6447f1bf-db9a-4a97-b281-22c329836018]# virsh define xml
error: Failed to define domain from xml
error: unsupported configuration: CPU topology doesn't match maximum vcpu count


提示CPU topology doesn't match maximum vcpu count , 很奇怪啊,为什么会报这种错,于是去翻代码,根本没有段代码,很奇怪了.

于是google了下, 发现如下代码:



> > +    /* qemu as of 2.5.0 rejects SMP topologies that don't match the cpu count */
> > +    if (def->cpu && def->cpu->sockets) {
> > +        topologycpus = def->cpu->sockets * def->cpu->cores * def->cpu->threads;
> > +        if (topologycpus != virDomainDefGetVcpusMax(def)) {
> > +            /* presence of query-hotpluggable-cpus should be a good enough witness */
> > +            if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS)) {
> > +                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> > +                               _("CPU topology doesn't match maximum vcpu count"));
> > +                goto cleanup;
> > +            }


从代码可以看出来是topologycpus = def->cpu->sockets * def->cpu->cores * def->cpu->threads;       总的cpu不等于 max cpu。

于是通过代码文件,找到我当前 qemu2.0.0的代码,发现我的代码是这样的:

if (def->cpu->sockets &&
            virDomainDefGetVcpusMax(def) >
            def->cpu->sockets * def->cpu->cores * def->cpu->threads) {
            virReportError(VIR_ERR_XML_DETAIL, "%s",
                           _("Maximum CPUs greater than topology limit"));
            goto error;
        }


这两个代码一样,但是报错的日志不一样。


于是马上 virsh version 查看版本:

[root@nova08 6447f1bf-db9a-4a97-b281-22c329836018]# virsh version
Compiled against library: libvirt 2.0.0
Using library: libvirt 2.0.0
Using API: QEMU 2.0.0
Running hypervisor: QEMU 2.6.0


libvirt是2.0.0的版本。  


这就郁闷了,我本地代码库的tag也是 2.0.0啊。  奇怪了,哪位知道求告诉下原因。


从以上代码可以看出,如果要使用maxcpu就不能有 cpu-sockets的配置,就是不能有:

<cpu>
    <topology sockets='2' cores='1' threads='1'/>      不能有这一行
  </cpu>


于是去掉 topology sockets,这一行,及解决问题。





  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值