[libvirt] [00/11] Automatically shutdown VMs on session quit
by Daniel P. Berrange
This is a followup to Alex's original proposal:
https://www.redhat.com/archives/libvir-list/2012-October/msg00365.html
The core idea & concepts are the same as in Alex's patch, but I
realized I could take the opportunity to refactor part of libvirtd
to improve life in general.
The state drivers currently have an 'active' method which is polled
on every iteration of the event loop to determine if any resources
(such as VMs) are active. This is the kind of information we need
to inhibit …
[View More]host shutdown/suspend, but it is not being made available
in an easily consumable way. The key idea I had was to remove the
'active' method from the state drivers and instead pass in a callback
to the 'startup' method in the state driver. This so called 'inhibit'
callback is used by drivers to signal when they have resources
active. This callback is used both to inhibit shutdown of libvirtd
(when the --timeout arg is used), and to inhibit shutdown of the
host OS itself.
The state driver also gains a 'stop' method which is intended to
stop any resources which are causing the shutdown inhibition. In
other words, to save any VMs to disk.
One of the side effects of this change is that the --timeout param
to libvirtd actually now works much better. Only running VMs cause
libvirtd shutdown to be inhibited. Networks / storage pools no
longer inhibit it.
This is obviously targetted at post-1.0.0
[View Less]
12 years, 5 months
[libvirt] libvirt can not get right stats of a rbd pool
by yue
Allocation exceed Capacity ,but Available is not 0.
#virsh pool-info 2361a6d4-0edc-3534-87ae-e7ee09199921
Name: 2361a6d4-0edc-3534-87ae-e7ee09199921
UUID: 2361a6d4-0edc-3534-87ae-e7ee09199921
State: running
Persistent: yes
Autostart: no
Capacity: 285.57 GiB
Allocation: 489.89 GiB
Available: 230.59 GiB
12 years, 5 months
[libvirt] [PATCH] build: Fix RPM build for non-x86 platforms
by Viktor Mihajlovski
Make the post install script for the lock-sanlock package optional
to prevent break on non-x86 platforms.
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
libvirt.spec.in | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 41d2628..f8ede3f 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1568,12 +1568,13 @@ fi
/bin/systemctl try-restart libvirt-guests.service >/dev/null 2>&1 || :
%endif
…
[View More]
+%if %{with_sanlock}
%post lock-sanlock
if getent group sanlock > /dev/null ; then
chmod 0770 %{_localstatedir}/lib/libvirt/sanlock
chown root:sanlock %{_localstatedir}/lib/libvirt/sanlock
fi
-
+%endif
%files
%defattr(-, root, root)
--
1.7.0.4
[View Less]
12 years, 5 months
[libvirt] [PATCH] Don't assume pid_t is the same size as an int
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
virPidFileReadPathIfAlive passed in an 'int *' where a 'pid_t *'
was expected, which breaks on Mingw64 targets. Also a few places
were using '%d' for formatting pid_t, change them to '%lld' and
force a cast to the longer type as done elsewhere in the same
file.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/util/virpidfile.c | 4 ++--
src/util/virprocess.c | 13 +++++++------
2 files changed, 9 insertions(+), …
[View More]8 deletions(-)
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index cb8a992..90a79c5 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -206,7 +206,7 @@ int virPidFileReadPathIfAlive(const char *path,
pid_t *pid,
const char *binPath)
{
- int ret, retPid;
+ int ret;
bool isLink;
char *procPath = NULL;
char *procLink = NULL;
@@ -215,7 +215,7 @@ int virPidFileReadPathIfAlive(const char *path,
char *resolvedProcLink = NULL;
const char deletedText[] = " (deleted)";
size_t deletedTextLen = strlen(deletedText);
-
+ pid_t retPid;
/* only set this at the very end on success */
*pid = -1;
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 4bb7ebc..f8a8a49 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -250,7 +250,7 @@ virProcessKillPainfully(pid_t pid, bool force)
int i, ret = -1;
const char *signame = "TERM";
- VIR_DEBUG("vpid=%d force=%d", pid, force);
+ VIR_DEBUG("vpid=%lld force=%d", (long long)pid, force);
/* This loop sends SIGTERM, then waits a few iterations (10 seconds)
* to see if it dies. If the process still hasn't exited, and
@@ -265,8 +265,8 @@ virProcessKillPainfully(pid_t pid, bool force)
if (i == 0) {
signum = SIGTERM; /* kindly suggest it should exit */
} else if ((i == 50) & force) {
- VIR_DEBUG("Timed out waiting after SIGTERM to process %d, "
- "sending SIGKILL", pid);
+ VIR_DEBUG("Timed out waiting after SIGTERM to process %lld, "
+ "sending SIGKILL", (long long)pid);
/* No SIGKILL kill on Win32 ! Use SIGABRT instead which our
* virProcessKill proc will handle more or less like SIGKILL */
#ifdef WIN32
@@ -283,8 +283,8 @@ virProcessKillPainfully(pid_t pid, bool force)
if (virProcessKill(pid, signum) < 0) {
if (errno != ESRCH) {
virReportSystemError(errno,
- _("Failed to terminate process %d with SIG%s"),
- pid, signame);
+ _("Failed to terminate process %lld with SIG%s"),
+ (long long)pid, signame);
goto cleanup;
}
ret = signum == SIGTERM ? 0 : 1;
@@ -294,7 +294,8 @@ virProcessKillPainfully(pid_t pid, bool force)
usleep(200 * 1000);
}
- VIR_DEBUG("Timed out waiting after SIGKILL to process %d", pid);
+ VIR_DEBUG("Timed out waiting after SIGKILL to process %lld",
+ (long long)pid);
cleanup:
return ret;
--
1.7.11.7
[View Less]
12 years, 5 months
[libvirt] [PATCH] Fix arch detection for qemu-system-i386 with QMP
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
QEMU uses 'i386' for its 32-bit x86 architecture, but libvirt
wants that to be 'i686', so we must fix it up
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 9f15162..271273c 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2327,6 +…
[View More]2327,14 @@ qemuCapsInitQMP(qemuCapsPtr caps,
if (!(caps->arch = qemuMonitorGetTargetArch(mon)))
goto cleanup;
+ /* Map i386, i486, i586 to i686. */
+ if (caps->arch[0] == 'i' &&
+ caps->arch[1] != '\0' &&
+ caps->arch[2] == '8' &&
+ caps->arch[3] == '6' &&
+ caps->arch[4] == '\0')
+ caps->arch[1] = '6';
+
/* Currently only x86_64 and i686 support PCI-multibus. */
if (STREQLEN(caps->arch, "x86_64", 6) ||
STREQLEN(caps->arch, "i686", 4)) {
--
1.7.12.1
[View Less]
12 years, 5 months
[libvirt] [PATCH 0/3] Use virNodeGetCPUMap where appropriate
by Viktor Mihajlovski
This series concludes the introduction of the virNodeGetCPUMap API
by replacing calls to virNodeGetInfo used only for the purpose
of computing the maximum number of node CPUs (which has the potential
to yield the incorrect number).
Most prominently, with patch 3/3 the output of virsh vcpuinfo will
now be correct for domains on hosts with offline CPUs
Viktor Mihajlovski (3):
qemu, lxc: Change host CPU detection logic.
python: Use virNodeGetCPUMap where possible
virsh: Use virNodeGetCPUMap …
[View More]if possible
python/libvirt-override.c | 100 ++++++++++++++++++++++++++++++++++------------
src/lxc/lxc_controller.c | 8 ++--
src/qemu/qemu_driver.c | 12 ++----
src/qemu/qemu_process.c | 10 ++---
tools/virsh-domain.c | 36 +++++++++++------
5 files changed, 108 insertions(+), 58 deletions(-)
--
1.7.12.4
[View Less]
12 years, 5 months
[libvirt] [PATCH] docs: libvirtd no longer uses abstract namespace
by Eric Blake
Commit 905be03d2 quit using the abstract namespace, but didn't
update the --help text to match.
* daemon/libvirtd.c (daemonUsage): Correct socket listing.
---
See also:
https://www.redhat.com/archives/libvirt-users/2012-October/msg00152.html
daemon/libvirtd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index d5f3e4c..624831a 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -936,7 +936,7 @@ libvirt management daemon:\n"), …
[View More]argv0);
$XDG_CONFIG_HOME/libvirt/libvirtd.conf\n\
\n\
Sockets:\n\
- $XDG_RUNTIME_DIR/libvirt/libvirt-sock (in UNIX abstract namespace)\n\
+ $XDG_RUNTIME_DIR/libvirt/libvirt-sock\n\
\n\
TLS:\n\
CA certificate: $HOME/.pki/libvirt/cacert.pem\n\
--
1.7.11.7
[View Less]
12 years, 5 months
[libvirt] [PATCH] gitignore: Ignore 'tags'
by Michal Privoznik
---
.gitignore | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index 98ce398..79a055b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -193,6 +193,7 @@ results.log
stamp-h
stamp-h.in
stamp-h1
+tags
!/gnulib/lib/Makefile.am
!/gnulib/tests/Makefile.am
!/m4/virt-*.m4
--
1.7.8.6
12 years, 5 months
[libvirt] [PATCH] qemu: Fix EmulatorPinInfo without emulatorpin
by Martin Kletzander
https://bugzilla.redhat.com/show_bug.cgi?id=871312
Recent fixes made almost all the right steps to make emulator pinned
to the cpuset of the whole domain in case <emulatorpin> isn't
specified, but qemudDomainGetEmulatorPinInfo still reports all the
CPUs even when cpuset is specified. This patch fixes that.
---
src/qemu/qemu_driver.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3980c10..8b5f06a …
[View More]100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4352,7 +4352,6 @@ qemudDomainGetEmulatorPinInfo(virDomainPtr dom,
virDomainDefPtr targetDef = NULL;
int ret = -1;
int maxcpu, hostcpus, pcpu;
- virDomainVcpuPinDefPtr emulatorpin = NULL;
virBitmapPtr cpumask = NULL;
bool pinned;
@@ -4394,14 +4393,15 @@ qemudDomainGetEmulatorPinInfo(virDomainPtr dom,
cpumaps[maplen - 1] &= (1 << maxcpu % 8) - 1;
}
- /* If no emulatorpin, all cpus should be used */
- emulatorpin = targetDef->cputune.emulatorpin;
- if (!emulatorpin) {
+ if (targetDef->cputune.emulatorpin) {
+ cpumask = targetDef->cputune.emulatorpin->cpumask;
+ } else if (targetDef->cpumask) {
+ cpumask = targetDef->cpumask;
+ } else {
ret = 0;
goto cleanup;
}
- cpumask = emulatorpin->cpumask;
for (pcpu = 0; pcpu < maxcpu; pcpu++) {
if (virBitmapGetBit(cpumask, pcpu, &pinned) < 0)
goto cleanup;
--
1.7.12.4
[View Less]
12 years, 5 months