mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu: check the kvm host cpu max limits in virConnectGetDomainCapabilities
The qemu limit and host limit both should be considered for the domain vcpu max limits. Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
This commit is contained in:
parent
c6910bd4c7
commit
8dbb347816
@ -38,6 +38,7 @@
|
||||
#include "virbitmap.h"
|
||||
#include "virnodesuspend.h"
|
||||
#include "virnuma.h"
|
||||
#include "virhostcpu.h"
|
||||
#include "qemu_monitor.h"
|
||||
#include "virstring.h"
|
||||
#include "qemu_hostdev.h"
|
||||
@ -4336,16 +4337,22 @@ int
|
||||
virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
virFirmwarePtr *firmwares,
|
||||
size_t nfirmwares)
|
||||
size_t nfirmwares,
|
||||
virDomainVirtType virttype)
|
||||
{
|
||||
virDomainCapsOSPtr os = &domCaps->os;
|
||||
virDomainCapsDeviceDiskPtr disk = &domCaps->disk;
|
||||
virDomainCapsDeviceHostdevPtr hostdev = &domCaps->hostdev;
|
||||
virDomainCapsDeviceGraphicsPtr graphics = &domCaps->graphics;
|
||||
virDomainCapsDeviceVideoPtr video = &domCaps->video;
|
||||
int maxvcpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, domCaps->machine);
|
||||
|
||||
domCaps->maxvcpus = maxvcpus;
|
||||
domCaps->maxvcpus = virQEMUCapsGetMachineMaxCpus(qemuCaps,
|
||||
domCaps->machine);
|
||||
if (virttype == VIR_DOMAIN_VIRT_KVM) {
|
||||
int hostmaxvcpus = virHostCPUGetKVMMaxVCPUs();
|
||||
if (hostmaxvcpus >= 0)
|
||||
domCaps->maxvcpus = MIN(domCaps->maxvcpus, hostmaxvcpus);
|
||||
}
|
||||
|
||||
if (virQEMUCapsFillDomainOSCaps(os, firmwares, nfirmwares) < 0 ||
|
||||
virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps,
|
||||
|
@ -492,6 +492,7 @@ int virQEMUCapsInitGuestFromBinary(virCapsPtr caps,
|
||||
int virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
virFirmwarePtr *firmwares,
|
||||
size_t nfirmwares);
|
||||
size_t nfirmwares,
|
||||
virDomainVirtType virttype);
|
||||
|
||||
#endif /* __QEMU_CAPABILITIES_H__*/
|
||||
|
@ -18475,7 +18475,7 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
|
||||
goto cleanup;
|
||||
|
||||
if (virQEMUCapsFillDomainCaps(domCaps, qemuCaps,
|
||||
cfg->firmwares, cfg->nfirmwares) < 0)
|
||||
cfg->firmwares, cfg->nfirmwares, virttype) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = virDomainCapsFormat(domCaps);
|
||||
|
@ -129,7 +129,8 @@ fillQemuCaps(virDomainCapsPtr domCaps,
|
||||
|
||||
if (virQEMUCapsFillDomainCaps(domCaps, qemuCaps,
|
||||
cfg->firmwares,
|
||||
cfg->nfirmwares) < 0)
|
||||
cfg->nfirmwares,
|
||||
VIR_DOMAIN_VIRT_QEMU) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* The function above tries to query host's KVM & VFIO capabilities by
|
||||
|
Loading…
Reference in New Issue
Block a user