mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-13 11:15:08 +00:00
configure.in, src/qemu_driver.h, src/qemu_driver.c: KVM
can determine max VCPUs at runtime (Guido Günther).
This commit is contained in:
parent
bf26cd8ecb
commit
04e9e1b2a6
@ -1,3 +1,8 @@
|
|||||||
|
Wed Sep 17 15:03:00 BST 2008 Richard W.M. Jones <rjones@redhat.com>
|
||||||
|
|
||||||
|
* configure.in, src/qemu_driver.h, src/qemu_driver.c: KVM
|
||||||
|
can determine max VCPUs at runtime (Guido Günther).
|
||||||
|
|
||||||
Tue Sep 16 12:43:00 EST 2008 Cole Robinson <crobinso@redhat.com>
|
Tue Sep 16 12:43:00 EST 2008 Cole Robinson <crobinso@redhat.com>
|
||||||
|
|
||||||
* src/storack_backend_disk.c: Implement disk volume delete
|
* src/storack_backend_disk.c: Implement disk volume delete
|
||||||
|
@ -316,6 +316,11 @@ if test "$with_qemu" = "yes" -o "$with_lxc" = "yes" ; then
|
|||||||
AC_MSG_ERROR([You must install kernel-headers in order to compile libvirt]))
|
AC_MSG_ERROR([You must install kernel-headers in order to compile libvirt]))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl
|
||||||
|
dnl check for kvm headers
|
||||||
|
dnl
|
||||||
|
AC_CHECK_HEADERS([linux/kvm.h])
|
||||||
|
|
||||||
dnl Need to test if pkg-config exists
|
dnl Need to test if pkg-config exists
|
||||||
PKG_PROG_PKG_CONFIG
|
PKG_PROG_PKG_CONFIG
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
#if HAVE_NUMACTL
|
#if HAVE_NUMACTL
|
||||||
#include <numa.h>
|
#include <numa.h>
|
||||||
@ -1804,6 +1805,27 @@ static const char *qemudGetType(virConnectPtr conn ATTRIBUTE_UNUSED) {
|
|||||||
return "QEMU";
|
return "QEMU";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int kvmGetMaxVCPUs(void) {
|
||||||
|
int maxvcpus = 1;
|
||||||
|
|
||||||
|
int r, fd;
|
||||||
|
|
||||||
|
fd = open(KVM_DEVICE, O_RDONLY);
|
||||||
|
if (fd < 0) {
|
||||||
|
qemudLog(QEMUD_WARN, _("Unable to open " KVM_DEVICE ": %s\n"), strerror(errno));
|
||||||
|
return maxvcpus;
|
||||||
|
}
|
||||||
|
|
||||||
|
r = ioctl(fd, KVM_CHECK_EXTENSION, KVM_CAP_NR_VCPUS);
|
||||||
|
if (r > 0)
|
||||||
|
maxvcpus = r;
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
return maxvcpus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int qemudGetMaxVCPUs(virConnectPtr conn, const char *type) {
|
static int qemudGetMaxVCPUs(virConnectPtr conn, const char *type) {
|
||||||
if (!type)
|
if (!type)
|
||||||
return 16;
|
return 16;
|
||||||
@ -1814,7 +1836,7 @@ static int qemudGetMaxVCPUs(virConnectPtr conn, const char *type) {
|
|||||||
/* XXX future KVM will support SMP. Need to probe
|
/* XXX future KVM will support SMP. Need to probe
|
||||||
kernel to figure out KVM module version i guess */
|
kernel to figure out KVM module version i guess */
|
||||||
if (STRCASEEQ(type, "kvm"))
|
if (STRCASEEQ(type, "kvm"))
|
||||||
return 1;
|
return kvmGetMaxVCPUs();
|
||||||
|
|
||||||
if (STRCASEEQ(type, "kqemu"))
|
if (STRCASEEQ(type, "kqemu"))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -29,6 +29,24 @@
|
|||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
|
#if HAVE_LINUX_KVM_H
|
||||||
|
#include <linux/kvm.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* device for kvm ioctls */
|
||||||
|
#define KVM_DEVICE "/dev/kvm"
|
||||||
|
|
||||||
|
/* add definitions missing in older linux/kvm.h */
|
||||||
|
#ifndef KVMIO
|
||||||
|
# define KVMIO 0xAE
|
||||||
|
#endif
|
||||||
|
#ifndef KVM_CHECK_EXTENSION
|
||||||
|
# define KVM_CHECK_EXTENSION _IO(KVMIO, 0x03)
|
||||||
|
#endif
|
||||||
|
#ifndef KVM_CAP_NR_VCPUS
|
||||||
|
# define KVM_CAP_NR_VCPUS 9 /* returns max vcpus per vm */
|
||||||
|
#endif
|
||||||
|
|
||||||
int qemudRegister(void);
|
int qemudRegister(void);
|
||||||
|
|
||||||
#endif /* QEMUD_DRIVER_H */
|
#endif /* QEMUD_DRIVER_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user