[libvirt] [PATCH] list: fix typo in virsh patch
by Eric Blake
A last minute rename in an earlier patch to virsh.h was not properly
reflected when rebasing virsh-pool.c.
* tools/virsh-pool.c (vshStoragePoolListCollect): Use VSH_MATCH,
not MATCH.
---
Pushing under the build-breaker rule.
tools/virsh-pool.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index 365d035..15d1883 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -642,15 +642,15 @@ fallback:
vshResetLibvirtError();
/* There is no way to get the pool type */
- if (MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_POOL_TYPE)) {
+ if (VSH_MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_POOL_TYPE)) {
vshError(ctl, "%s", _("Filtering using --type is not supported "
"by this libvirt"));
goto cleanup;
}
/* Get the number of active pools */
- if (!MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ACTIVE) ||
- MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE)) {
+ if (!VSH_MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ACTIVE) ||
+ VSH_MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE)) {
if ((nActivePools = virConnectNumOfStoragePools(ctl->conn)) < 0) {
vshError(ctl, "%s", _("Failed to get the number of active pools "));
goto cleanup;
@@ -658,8 +658,8 @@ fallback:
}
/* Get the number of inactive pools */
- if (!MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ACTIVE) ||
- MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_INACTIVE)) {
+ if (!VSH_MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ACTIVE) ||
+ VSH_MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_INACTIVE)) {
if ((nInactivePools = virConnectNumOfDefinedStoragePools(ctl->conn)) < 0) {
vshError(ctl, "%s", _("Failed to get the number of inactive pools"));
goto cleanup;
@@ -674,8 +674,8 @@ fallback:
names = vshMalloc(ctl, sizeof(char *) * nAllPools);
/* Retrieve a list of active storage pool names */
- if (!MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ACTIVE) ||
- MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE)) {
+ if (!VSH_MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ACTIVE) ||
+ VSH_MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE)) {
if (virConnectListStoragePools(ctl->conn,
names, nActivePools) < 0) {
vshError(ctl, "%s", _("Failed to list active pools"));
@@ -684,8 +684,8 @@ fallback:
}
/* Add the inactive storage pools to the end of the name list */
- if (!MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ACTIVE) ||
- MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE)) {
+ if (!VSH_MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ACTIVE) ||
+ VSH_MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE)) {
if (virConnectListDefinedStoragePools(ctl->conn,
&names[nActivePools],
nInactivePools) < 0) {
@@ -720,26 +720,26 @@ filter:
pool = list->pools[i];
/* persistence filter */
- if (MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_PERSISTENT)) {
+ if (VSH_MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_PERSISTENT)) {
if ((persistent = virStoragePoolIsPersistent(pool)) < 0) {
vshError(ctl, "%s", _("Failed to get pool persistence info"));
goto cleanup;
}
- if (!((MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_PERSISTENT) && persistent) ||
- (MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_TRANSIENT) && !persistent)))
+ if (!((VSH_MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_PERSISTENT) && persistent) ||
+ (VSH_MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_TRANSIENT) && !persistent)))
goto remove_entry;
}
/* autostart filter */
- if (MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_AUTOSTART)) {
+ if (VSH_MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_AUTOSTART)) {
if (virStoragePoolGetAutostart(pool, &autostart) < 0) {
vshError(ctl, "%s", _("Failed to get pool autostart state"));
goto cleanup;
}
- if (!((MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_AUTOSTART) && autostart) ||
- (MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_NO_AUTOSTART) && !autostart)))
+ if (!((VSH_MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_AUTOSTART) && autostart) ||
+ (VSH_MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_NO_AUTOSTART) && !autostart)))
goto remove_entry;
}
--
1.7.11.4
12 years, 2 months
[libvirt] [PATCH] Define DYNLIB_NAME on OpenBSD.
by Jasper Lievisse Adriaanse
>From 05dd99030d865127c874d1b489b9c17412bdbb3b Mon Sep 17 00:00:00 2001
From: Jasper Lievisse Adriaanse <jasper(a)humppa.nl>
Date: Tue, 4 Sep 2012 16:48:51 +0200
Subject: [PATCH] Define DYNLIB_NAME on OpenBSD.
---
src/vbox/vbox_XPCOMCGlue.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/vbox/vbox_XPCOMCGlue.c b/src/vbox/vbox_XPCOMCGlue.c
index e7e9c37..63470ae 100644
--- a/src/vbox/vbox_XPCOMCGlue.c
+++ b/src/vbox/vbox_XPCOMCGlue.c
@@ -48,7 +48,7 @@
/*******************************************************************************
* Defined Constants And Macros *
*******************************************************************************/
-#if defined(__linux__) || defined(__linux_gnu__) || defined(__sun__) || defined(__FreeBSD__)
+#if defined(__linux__) || defined(__linux_gnu__) || defined(__sun__) || defined(__FreeBSD__) || defined(__OpenBSD__)
# define DYNLIB_NAME "VBoxXPCOMC.so"
#elif defined(__APPLE__)
# define DYNLIB_NAME "VBoxXPCOMC.dylib"
--
1.7.6
12 years, 2 months
[libvirt] Compile libvirt on Solaris
by Yang Zhou (yangzho)
Hi Experts,
I am compiling libvirt 0.9.9 on Solaris 9. But got following errors when run "./configure --with-esx --with-qemu"
-------------------------------------------------------------------------------------------------------
checking for library containing dlopen... -ldl
checking for xen_vm_start in -lxenserver... no
checking for libxl_domain_create_new in -lxenlight... no
checking for xs_read in -lxenstore... no
checking linux/kvm.h usability... no
checking linux/kvm.h presence... no
checking for linux/kvm.h... no
checking for shell that supports <> redirection... /bin/sh
checking linux/param.h usability... no
checking linux/param.h presence... no
checking for linux/param.h... no
configure: error: You must install kernel-headers in order to compile libvirt with QEMU or LXC support
bash-2.05$
----------------------------------------------------------------------------------------------------
After look at configure, it's found the headers of linux/param.h, linux/sockios.h. linux/if_bridge.h and linux/if_tun.h are required. Obviously these files are missing on Solaris platform. Anybody can help how to solve this issue?
Thanks!
Regards,
Yang
12 years, 2 months
[libvirt] [PATCH 0/6 v4] Atomic API to list secrets
by Osier Yang
v3 - v4:
* Just rebase on the top, split the patches from v3's larget set
Osier Yang (6):
list: Define new API virConnectListAllSecrets
list: Implement RPC calls for virConnectListAllSecrets
list: Implement listAllSecrets
list: Expose virConnectListAllSecrets to Python binding
list: Expose virConnectListAllSecrets to Python binding
virsh: Remove unused vshNameSorter
daemon/remote.c | 54 ++++++++++
include/libvirt/libvirt.h.in | 3 +
python/generator.py | 1 +
python/libvirt-override-api.xml | 6 +
python/libvirt-override-virConnect.py | 12 ++
python/libvirt-override.c | 48 +++++++++
src/driver.h | 5 +
src/libvirt.c | 50 +++++++++
src/libvirt_public.syms | 1 +
src/remote/remote_driver.c | 64 ++++++++++++
src/remote/remote_protocol.x | 13 ++-
src/remote_protocol-structs | 12 ++
src/secret/secret_driver.c | 59 +++++++++++-
tools/virsh-secret.c | 182 +++++++++++++++++++++++++++-----
tools/virsh.c | 9 --
tools/virsh.h | 1 -
16 files changed, 479 insertions(+), 41 deletions(-)
--
1.7.7.3
12 years, 2 months
[libvirt] An introduction to the "libvirt-designer" library
by Daniel P. Berrange
People might have noticed Michal's patches[1] for the "libvirt-designer"
and wondered wtf.com that is. This is an attempt to explain it...
If you are familiar with the code in virt-install (also used by virt-manager)
you'll know it has a bunch of internal classes / APIs for dealing with
libvirt configuration, particularly wrt guest domains. If you're also
familiar with other apps like GNOME Boxes, VDSM/oVirt, OpenStack, then
you'll know that these apps have roughly the same needs as virt-install
and virt-manager wrt libvirt configuration. The virt-install internal
APIs though cannot practically be used by these apps since they were
never really designed with broad re-use in mind.
Obviously in such scenarios it is desirable to share code across apps
instead of having them all reinvent the wheel. The libvirt-gconfig
library was the first part in an attempt to address this problem by
providing a formal API for creating & reading libvirt configurations
without having to know anything about XML. This library is completely
policy-free, restricting itself to direct/explicit manipulation
of the configuration attributes. This deals with some of functionality
found in the virt-install internal APIs.
The libosinfo library [2] provides an API for discovering supportable
and optimal hardware for operating systems & hypervisors. This replaces
the OS configuration data tables found inside virt-install.
The next step is to provide a policy-driven API for configurating virtual
machines. When configuring a virtual machine, parameters can be
roughly split into two groups - guest hardware config and host interaction
config. The idea behind the libvirt-designer API is that when creating or
changing a guest config, application developers should only need to care
about the host interaction config. The guest hardware config can be
figured out automatically on their behalf using data obtained from the
libosinfo library.
As an example, consider adding a disk to a guest. Traditionally an app
developer needs to
- Choose what virtual hardware to use
- Figure out guest device name
- Set the host filename
- Choose optimal I/O parameters (cache mode, driver type, etc, etc)
With the libvirt-designer APIs, an app developer will need to
- Set the host filename
The rest of the points will be filled in automatically, though the app
developer will still get the opportunity to further customize the
defaults via the existing libvirt-gconfig APIs.
As mentioned above the libvirt-designer library is binding together the
libvirt-gconfig and libosinfo APIs. It explicitly does *not* directly
depend on libvirt or libvirt-gobject. This is to try to allow the
libvirt-designer library to be used by a wide variety of applications,
no matter how they are interacting with libvirt. eg if they use the
CIM, SNMP or QMF bindings to libvirt they can still use libvirt-designer
to build their XML configurations.
The intent is that there is yet another library, so far called
libvirt-builder, which binds together the libvirt-designer and
libvirt-gobject APIs, to actually automate some of the lifecycle
management and VM provisioning tasks. Since it will use libvirt-gobject,
this final library would not be accessible to apps using CIM/SNMP/QMF
bindings. With this library, we would have more or less complete
coverage of all the important tasks found in the virt-install
internal APIs, which can be reused by other apps. There is of course
still quite a long way to go before we get there, since we're aiming to
build this all up incrementally from the bottom up.
The hope is that in the near term, GNOME Boxes will be able to start
taking advantage of some of the code provided by libvirt-designer,
since it already uses libvirt-gconfig & libosinfo. In addition as
more functionality appears we'll be able to start changing virt-install
to switch it over to these APIs in favour of its internal code.
Regards,
Daniel
[1] https://www.redhat.com/archives/libvir-list/2012-September/msg00214.html
[2] https://fedorahosted.org/libosinfo
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
12 years, 2 months
[libvirt] [RFC] [PATCH v2 1/6] add configure option --with-fuse for libvirt
by Gao feng
add a configure option --with-fuse to prepare introduction
of fuse support for libvirt lxc.
With help from Daniel
Signed-off-by: Gao feng <gaofeng(a)cn.fujitsu.com>
---
configure.ac | 36 ++++++++++++++++++++++++++++++++++++
libvirt.spec.in | 9 +++++++++
2 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac
index 3cc7b3c..e6d207e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1695,6 +1695,37 @@ AC_SUBST([CAPNG_CFLAGS])
AC_SUBST([CAPNG_LIBS])
+dnl libfuse
+AC_ARG_WITH([fuse],
+ AC_HELP_STRING([--with-fuse], [use libfuse to proivde fuse filesystem support for libvirt lxc]),
+ [],
+ [with_fuse=check])
+
+dnl
+dnl This check looks for 'fuse'
+dnl
+FUSE_CFLAGS=
+FUSE_LIBS=
+if test "x$with_fuse" != "xno"; then
+ PKG_CHECK_MODULES([FUSE], [fuse],
+ [with_fuse=yes], [
+ if test "x$with_fuse" = "xcheck" ; then
+ with_fuse=no
+ else
+ AC_MSG_ERROR(
+ [You must install fuse-devel to compile libvirt])
+ fi
+ ])
+ if test "x$with_fuse" = "xyes" ; then
+ FUSE_LIBS="-lfuse"
+ FUSE_CFLAGS="-D_FILE_OFFSET_BITS=64"
+ AC_DEFINE_UNQUOTED([HAVE_FUSE], 1, [whether fuse is available for libvirt lxc])
+ fi
+fi
+AM_CONDITIONAL([HAVE_FUSE], [test "x$with_fuse" = "xyes"])
+AC_SUBST([FUSE_CFLAGS])
+AC_SUBST([FUSE_LIBS])
+
dnl virsh libraries
AC_CHECK_HEADERS([readline/readline.h])
@@ -2944,6 +2975,11 @@ AC_MSG_NOTICE([ capng: $CAPNG_CFLAGS $CAPNG_LIBS])
else
AC_MSG_NOTICE([ capng: no])
fi
+if test "$with_fuse" = "yes" ; then
+AC_MSG_NOTICE([ fuse: $FUSE_CFLAGS $FUSE_LIBS])
+else
+AC_MSG_NOTICE([ fuse: no])
+fi
if test "$with_xen" = "yes" ; then
AC_MSG_NOTICE([ xen: $XEN_CFLAGS $XEN_LIBS])
else
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 140a182..939569e 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -91,6 +91,7 @@
# A few optional bits off by default, we enable later
%define with_polkit 0%{!?_without_polkit:0}
%define with_capng 0%{!?_without_capng:0}
+%define with_fuse 0%{!?_without_fuse:0}
%define with_netcf 0%{!?_without_netcf:0}
%define with_udev 0%{!?_without_udev:0}
%define with_hal 0%{!?_without_hal:0}
@@ -466,6 +467,9 @@ BuildRequires: numactl-devel
%if %{with_capng}
BuildRequires: libcap-ng-devel >= 0.5.0
%endif
+%if %{with_fuse}
+BuildRequires: fuse-devel
+%endif
%if %{with_phyp}
BuildRequires: libssh2-devel
%endif
@@ -1116,6 +1120,10 @@ of recent versions of Linux (and other OSes).
%define _without_capng --without-capng
%endif
+%if ! %{with_fuse}
+%define _without_fuse --without-fuse
+%endif
+
%if ! %{with_netcf}
%define _without_netcf --without-netcf
%endif
@@ -1206,6 +1214,7 @@ autoreconf -if
%{?_without_numactl} \
%{?_without_numad} \
%{?_without_capng} \
+ %{?_without_fuse} \
%{?_without_netcf} \
%{?_without_selinux} \
%{?_without_hal} \
--
1.7.7.6
12 years, 2 months
[libvirt] Bug:libvirtd boot up blocked in NAT network setup
by Wenchao Xia
Hello, guys
I met a strange problem in libvirt+kvm massive deployment case. What
shows is that libvirtd will not respond to any virsh calls, with debug
I found that libvirtd was blocked at the step to setup default nat
network, that is command "iptables -table nat xxxxx".
In terminal, I found command "iptables -L" will also block, and
"brctl show" shows that about 160 tap devices "vnetXXX" were attached
to virbr0. After I deleted these tap devices, things become normal, But
when I re-create them and attach these tap device to virbr0, it can't
be reproduced. There are too server met this problem in test, so I think
it is not a hardware problem. Does someone have experience this before?
information:
server: RH6.2
libvirt: libvirt-0.9.4
kernel: 2.6.32
--
Best Regards
Wenchao Xia
12 years, 2 months
[libvirt] [PATCH] pci: Save and restore each devices/functions behind the bus
by Osier Yang
Previously it refuses to do the secondary bus reset as long as
there is(are) devices/functions behind the same bus, regardless
of whether the devices/functions are being used or not. And it
only save and restore the device itself's PCI config space.
But later it was changed to allow the secondary bus reset as long
as the devices/functions behind the same bus are not being
used. Unfortunately, it still just saves and restores the device
itself's PCI config space. It means we will lose the PCI config
space for the devices share same bus when doing passthrough.
Also, (hope my guess is right) as it assumes the secondary reset
is allowed unless the device doesn't have devices/functions behind
the same bus, so it only reads the bridge control register from the
device, but not the parent.
This patch fixes the problem by finding out all the devices/functions
behind the same bus of the device to be reset, and save/restore
PCI config space for all of them. And read the bridge control register
from the device's parent (bridge) before resetting.
* src/util/pci.c:
- New helper pciSharesBus to check if two devices share same bus.
- New helper pciDevicesShareBus to return a list containg all of
the devices/functions which share same bus with the device
- pciTrySecondaryBusReset: Save and restore PCI config space for
all the devices/functions behind the same bus; Read the bridge
control register from the device's parent instead before resetting.
---
src/util/pci.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 75 insertions(+), 5 deletions(-)
diff --git a/src/util/pci.c b/src/util/pci.c
index 0742d07..1a9777a 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -517,6 +517,39 @@ pciBusContainsActiveDevices(pciDevice *dev,
return active;
}
+/*
+ * Check if the @dev and @check share bus.
+ */
+static int
+pciSharesBus(pciDevice *dev, pciDevice *check, void *data ATTRIBUTE_UNUSED)
+{
+ if ((dev->domain == check->domain) &&
+ (dev->bus == check->bus) &&
+ (dev->slot == check->slot))
+ return 1;
+
+ return 0;
+}
+
+/*
+ * Return all the devices/functions share same bus with @dev
+ * as a list.
+ */
+static pciDeviceList *
+pciDevicesShareBus(pciDevice *dev)
+{
+ pciDevice *match = NULL;
+ pciDeviceList *pcis = NULL;
+
+ if (!(pcis = pciDeviceListNew()))
+ return NULL;
+
+ if (pciIterDevices(pciSharesBus, dev, &match, NULL))
+ pciDeviceListAdd(pcis, match);
+
+ return pcis;
+}
+
/* Is @check the parent of @dev ? */
static int
pciIsParent(pciDevice *dev, pciDevice *check, void *data)
@@ -604,6 +637,9 @@ pciTrySecondaryBusReset(pciDevice *dev,
uint8_t config_space[PCI_CONF_LEN];
uint16_t ctl;
int ret = -1;
+ pciDeviceList *list = NULL;
+ uint8_t (*config_spaces)[PCI_CONF_LEN];
+ int i;
/* Refuse to do a secondary bus reset if there are other
* devices/functions behind the bus are used by the host
@@ -628,10 +664,7 @@ pciTrySecondaryBusReset(pciDevice *dev,
VIR_DEBUG("%s %s: doing a secondary bus reset", dev->id, dev->name);
- /* Save and restore the device's config space; we only do this
- * for the supplied device since we refuse to do a reset if there
- * are multiple devices/functions
- */
+ /* Save the device's config space */
if (pciRead(dev, 0, config_space, PCI_CONF_LEN) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to read PCI config space for %s"),
@@ -639,10 +672,29 @@ pciTrySecondaryBusReset(pciDevice *dev,
goto out;
}
+ /* Save the config space of devices behind the same bus */
+ if ((list = pciDevicesShareBus(dev))) {
+ if (VIR_ALLOC_N(config_spaces, list->count) < 0) {
+ virReportOOMError();
+ goto out;
+ }
+
+ for (i = 0; i < list->count; i++) {
+ pciDevice *pci = list->devs[i];
+
+ if (pciRead(pci, 0, config_spaces[i], PCI_CONF_LEN) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to read PCI config space for %s"),
+ pci->name);
+ goto out;
+ }
+ }
+ }
+
/* Read the control register, set the reset flag, wait 200ms,
* unset the reset flag and wait 200ms.
*/
- ctl = pciRead16(dev, PCI_BRIDGE_CONTROL);
+ ctl = pciRead16(parent, PCI_BRIDGE_CONTROL);
pciWrite16(parent, PCI_BRIDGE_CONTROL, ctl | PCI_BRIDGE_CTL_RESET);
@@ -652,14 +704,32 @@ pciTrySecondaryBusReset(pciDevice *dev,
usleep(200 * 1000); /* sleep 200ms */
+ /* Restore the device's config space */
if (pciWrite(dev, 0, config_space, PCI_CONF_LEN) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to restore PCI config space for %s"),
dev->name);
goto out;
}
+
+ /* Restore the config space of devices behind the same bus */
+ if (list) {
+ for (i = 0; i < list->count; i++) {
+ pciDevice *pci = list->devs[i];
+
+ if (pciWrite(pci, 0, config_spaces[i], PCI_CONF_LEN) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to restore PCI config space for %s"),
+ pci->name);
+ goto out;
+ }
+ }
+ }
+
ret = 0;
out:
+ pciDeviceListFree(list);
+ VIR_FREE(config_spaces);
pciFreeDevice(parent);
return ret;
}
--
1.7.7.3
12 years, 2 months
[libvirt] [PATCH v2 0/4] Add cpu hotplug support to libvirt.
by Tang Chen
It seems that libvirt is not cpu hotplug aware.
Please refer to the following problem.
1. At first, we have 2 cpus.
# cat /cgroup/cpuset/cpuset.cpus
0-1
# cat /cgroup/cpuset/libvirt/qemu/cpuset.cpus
0-1
2. And we have a vm1 with following configuration.
<cputune>
<vcpupin vcpu='0' cpuset='1'/>
<emulatorpin cpuset='1'/>
</cputune>
3. Offline cpu1.
# echo 0 > /sys/devices/system/cpu/cpu1/online
# cat /sys/devices/system/cpu/cpu1/online
0
# cat /cgroup/cpuset/cpuset.cpus
0
# cat /cgroup/cpuset/libvirt/qemu/cpuset.cpus
0
# cat /cgroup/cpuset/libvirt/lxc/cpuset.cpus
0
4. Online cpu1.
# echo 1 > /sys/devices/system/cpu/cpu1/online
# cat /sys/devices/system/cpu/cpu1/online
1
# cat /cgroup/cpuset/cpuset.cpus
0-1
# cat /cgroup/cpuset/libvirt/cpuset.cpus
0
# cat /cgroup/cpuset/libvirt/qemu/cpuset.cpus
0
# cat /cgroup/cpuset/libvirt/lxc/cpuset.cpus
0
Here,cgroup updated cpuset.cpus,but not for libvirt directory,and also qemu and lxc directory.
vm1 cannot be started again.
# virsh start vm1
error: Failed to start domain vm1
error: Unable to set cpuset.cpus: Permission denied
And libvird gave the following errors.
2012-07-17 07:30:22.478+0000: 3118: error : qemuSetupCgroupVcpuPin:498 : Unable to set cpuset.cpus: Permission denied
These patches resolves this problem by listening on the netlink for cpu hotplug event.
When the netlink service gets the cpu hotplug event, it will attract the cpuid in the message,
and add it into cpuset.cpus in:
/cgroup/cpuset/libvirt
/cgroup/cpuset/libvirt/qemu
/cgroup/cpuset/libvirt/lxc
change log of v2:
[PATCH v2 1/4]:
* Move all the handlers from hotplug.c to modules who
want to listen to cpu hotplug events.
[PATCH v2 2/4]:
* Set /libvirt/cpuset.cpus to the lastest value when
libvirtd is being initialized.
[PATCH v2 3/4]:
* Set /libvirt/qemu/cpuset.cpus to the lastest value when
qemu driver is being initialized.
[PATCH v2 4/4]:
* Set /libvirt/lxc/cpuset.cpus to the lastest value when
lxc driver is being initialized.
Tang Chen (4):
Add helpers to support cpu hotplug in libvirt.
Register cpu hotplug netlink handler for libvirtd.
Register cpu hotplug netlink handler for qemu driver.
Register cpu hotplug netlink handler for lxc driver.
daemon/libvirtd.c | 62 +++++++++++
include/libvirt/virterror.h | 2 +
src/Makefile.am | 1 +
src/libvirt_private.syms | 7 ++
src/lxc/lxc_driver.c | 67 +++++++++++-
src/qemu/qemu_driver.c | 64 ++++++++++++
src/util/cgroup.c | 10 +-
src/util/cgroup.h | 7 ++
src/util/hotplug.c | 240 +++++++++++++++++++++++++++++++++++++++++++
src/util/hotplug.h | 44 ++++++++
src/util/virterror.c | 3 +-
11 files changed, 499 insertions(+), 8 deletions(-)
create mode 100644 src/util/hotplug.c
create mode 100644 src/util/hotplug.h
--
1.7.10.1
12 years, 2 months
[libvirt] [PATCH 0/2] Fix 'make' issues on OpenBSD.
by Eric Blake
Pushing both under the build-breaker rule. 'make check' still
fails some gnulib tests on OpenBSD, but that's not quite as
severe.
Eric Blake (2):
build: avoid warnings from gcc 4.2.1
build: don't fail when xsltproc is missing
docs/Makefile.am | 9 +++++----
m4/virt-compile-warnings.m4 | 8 +++++++-
src/internal.h | 6 ++++--
3 files changed, 16 insertions(+), 7 deletions(-)
--
1.7.11.4
12 years, 2 months