【发布时间】:2016-12-15 17:55:08
【问题描述】:
我正在使用 (KVM Qemu//system) 作为管理程序和 Libvirt 来连接它,所以我想知道是否有向在线虚拟机添加更多 CPU 资源并使其在不重新启动的情况下工作?
我可以添加更多 CPU,但虚拟机应该重新启动,然后我才能看到它工作,所以我正在寻找一种方法让它在不重新启动的情况下工作。
现在使用的是下面的代码
from __future__ import print_function
import sys
import libvirt
domName = 'Fedora22-x86_64-1'
conn = libvirt.open('qemu:///system')
if conn == None:
print('Failed to open connection to qemu:///system', file=sys.stderr)
exit(1)
dom = conn.lookupName(domName)
if dom == None:
print('Failed to find the domain '+domName, file=sys.stderr)
exit(1)
dom.setVcpus(4)
conn.close()
exit(0)
【问题讨论】: