[libvirt] [PATCH] hooks: let virCommand do the error reporting
by Eric Blake
The code was reporting raw exit status without decoding it into
normal vs. signal exit. virCommandRun already does this, but
with a different error type, so all we have to do is recast
the error to the correct type.
Reported by li guang.
* src/util/hooks.c (virHookCall): Simplify.
---
In response to:
https://www.redhat.com/archives/libvir-list/2012-October/msg00308.html
src/util/hooks.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/util/hooks.c b/src/util/hooks.c
index f5890d2..8817a4e 100644
--- a/src/util/hooks.c
+++ b/src/util/hooks.c
@@ -1,7 +1,7 @@
/*
* hooks.c: implementation of the synchronous hooks support
*
- * Copyright (C) 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2010-2012 Red Hat, Inc.
* Copyright (C) 2010 Daniel Veillard
*
* This library is free software; you can redistribute it and/or
@@ -206,7 +206,6 @@ virHookCall(int driver,
char **output)
{
int ret;
- int exitstatus;
char *path;
virCommandPtr cmd;
const char *drvstr;
@@ -279,12 +278,11 @@ virHookCall(int driver,
if (output)
virCommandSetOutputBuffer(cmd, output);
- ret = virCommandRun(cmd, &exitstatus);
- if (ret == 0 && exitstatus != 0) {
- virReportError(VIR_ERR_HOOK_SCRIPT_FAILED,
- _("Hook script %s %s failed with error code %d"),
- path, drvstr, exitstatus);
- ret = -1;
+ ret = virCommandRun(cmd, NULL);
+ if (ret < 0) {
+ /* Convert INTERNAL_ERROR into known error. */
+ virErrorPtr err = virGetLastError();
+ virReportError(VIR_ERR_HOOK_SCRIPT_FAILED, "%s", err->message);
}
virCommandFree(cmd);
--
1.7.11.4
12 years, 1 month
[libvirt] [libvirt-designer][PATCH 1/2] spec: Update changelog
by Michal Privoznik
to reflect the brand new release
---
libvirt-designer.spec.in | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/libvirt-designer.spec.in b/libvirt-designer.spec.in
index 667366c..2ff7487 100644
--- a/libvirt-designer.spec.in
+++ b/libvirt-designer.spec.in
@@ -103,3 +103,6 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/gtk-doc/html/libvirt-designer
%changelog
+
+Tue Oct 09 2012 Daniel P. Berrange <berrange(a)redhat.com> 0.0.1-1
+- created
--
1.7.8.6
12 years, 1 month
[libvirt] [PATCH] doc: update description about user/group in qemu.conf
by Marcelo Cerri
As a side effect of changes in the functions virGetUserID and
virGetGroupID, the user and group configurations for DAC in qemu.conf
are now able to accept both names and IDs, supporting a leading plus
sign to ensure that a numeric value will not be interpreted as a name.
This patch updates the comments in qemu.conf, including a description of
this new behavior.
---
src/qemu/qemu.conf | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index 18105ca..dd853c8 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -180,10 +180,25 @@
# guests will be blocked. Defaults to 0.
#security_require_confined = 1
-# The user ID for QEMU processes run by the system instance.
+# The user for QEMU processes run by the system instance. It can be
+# specified as a user name or as a user id. The qemu driver will try to
+# parse this value first as a name and then, if the name doesn't exist,
+# as a user id.
+#
+# Since a sequence of digits is a valid user name, a leading plus sign
+# can be used to ensure that a user id will not be interpreted as a user
+# name.
+#
+# Some examples of valid values are:
+#
+# user = "qemu" # A user named "qemu"
+# user = "+0" # Super user (uid=0)
+# user = "100" # A user named "100" or a user with uid=100
+#
#user = "root"
-# The group ID for QEMU processes run by the system instance.
+# The group for QEMU processes run by the system instance. It can be
+# specified in a similar way to user.
#group = "root"
# Whether libvirt should dynamically change file ownership
--
1.7.12
12 years, 1 month
[libvirt] [PATCH] nodeinfo: Fully convert to new virReportError
by Michal Privoznik
With our latest s/[a-z]+ReportError/virReportError/ rewrite
(47ab34e2) we forgot to update arm part of the code.
---
Thanks to my masochist idea of compiling libvirt
on my Raspberry PI I've discovered this.
Pushing under trivial & build breaker (on arm platforms obviously) rules.
For those who are interested, it took ages and we
don't build cleanly:
http://pastebin.com/dkrJaV5Z
But I am not sure how to fix those 'cast increases required
alignment of target type' warnings. And I am not sure anybody
else is ever going to use libvirt on arm.
src/nodeinfo.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 4cbfe63..c0e60d8 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -423,8 +423,8 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
buf++;
if (*buf != ':' || !buf[1]) {
- nodeReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("parsing cpu MHz from cpuinfo"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("parsing cpu MHz from cpuinfo"));
goto cleanup;
}
--
1.7.8.6
12 years, 1 month
[libvirt] [PATCH] docs: Drop useless </p> in drvphyp.html.in
by Michal Privoznik
---
Pushing under trivial rule.
docs/drvphyp.html.in | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/docs/drvphyp.html.in b/docs/drvphyp.html.in
index 0bd20dd..50e26b2 100644
--- a/docs/drvphyp.html.in
+++ b/docs/drvphyp.html.in
@@ -43,6 +43,5 @@ phyp://user@ivm/system (IVM connection)
<pre>
phyp://[username@]{hmc|ivm}/managed_system
</pre>
- </p>
</body></html>
--
1.7.8.6
12 years, 1 month
[libvirt] [PATCH v2 0/2] extend virGetUserID and virGetGroupID
by Marcelo Cerri
This patch series moves the logic for parsing users and groups in a
similar way to coreutils' chown from security_dac.c to util.c, as
suggested by Eric Blake.
This change has two majors side effects:
1. Some error messages that were issued when security_dac.c tried to
parse an ID as a name are no longer issued.
2. The keys `user` and `group` in qemu.conf can now be defined in the
same way that in DAC security labels.
Peter Krempa's fix for correctly handling errors returned by getpwnam_r and
getgrnam_r is squashed into this patch series.
Marcelo Cerri (2):
util: extend virGetUserID and virGetGroupID to support names and IDs
security: update user and group parsing in security_dac.c
src/security/security_dac.c | 45 +++-----------
src/util/util.c | 143 ++++++++++++++++++++++++++++++++------------
2 files changed, 112 insertions(+), 76 deletions(-)
--
1.7.12
12 years, 1 month
[libvirt] [PATCH 0/3] Cleanly save session VMs on logout/shutdown
by Alexander Larsson
Atm, when you exit the sessin (via logout or shutdown for instance) we
just leave the qemu:///session handling libvirtd process around, including
any running VMs. This is not particularly nice, as there is no way to
know that the VMs are running, and you risk data loss if you shutdown
while the VMs are running.
This patch series adds a babysitter to the session that will track session
lifetime and shutdown events and save running VMs as needed.
Outstanding questions:
Can this code be inside libvirtd itself? I.E. is it possible to do VM
management calls like virDomainManagedSave() from inside libvirtd itself.
If not, who will launch the babysitter?
Alexander Larsson (3):
Fix typo in HAVE_DBUS automake conditional
virdbus: Add virDBusGetSessionBus helper
Add new libvirt-babysitter tool
configure.ac | 2 +-
src/util/virdbus.c | 84 ++++++++++----
src/util/virdbus.h | 1 +
tools/Makefile.am | 21 ++++
tools/libvirt-babysitter.c | 276 +++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 363 insertions(+), 21 deletions(-)
create mode 100644 tools/libvirt-babysitter.c
--
1.7.12.1
12 years, 1 month
[libvirt] [PATCH 00/12] Structured syslog (Lumberjack/CEE) support
by Miloslav Trmač
This patch set adds structured syslog support to libvirt.
In short, the idea is to embed JSON in a syslog record. This format
is used in a new log output type called "syslog/json".
Example "syslog/json" record (line-wrapped for readability):
Sep 20 19:59:40 kulicka libvirt: @cee: {"msg":"libvirt version: 0.10.1",
"category":"../../src/test/test_driver.c","priority":"info",
"funcname":"virLogVMessage","line":769,
"timestamp":"2012-09-20 17:59:40.853+0000"}
compared with existing "syslog" record format:
Sep 20 20:02:24 kulicka libvirt: 5896: info : libvirt version: 0.10.1
This JSON embedding format is defined by the Lumberjack project led
by the major Open Source syslog implementations
(https://fedorahosted.org/lumberjack/). The format is also a base
for a future MITRE CEE standard. Some of the fields are specified
at https://fedorahosted.org/lumberjack/wiki/FieldList , but applications
are free to use whatever fields make sense for them.
The JSON structure makes easy to process logs by programs without writing
code that understands the specific format used by each application,
or using unreliable regexps (https://fedorahosted.org/ceelog/ is a
companion project that allows processing such logs).
Current systems will store and these records unmodified and present them
to users unmodified, but tools (and probably /var/log/messages) will
be able to show only the "msg" field; this allows us to add more detailed
information without worsening the user experience (the example above
already shows added information that is currently being thrown away when
logging to syslog).
The patch set, aside from building the required infrastructure, has two
main components:
* Add the "syslog/json" output type, and use it to record all information
passed to virLogMessage. The example result is shown above. This primarily
makes it easier to parse the message.
* Allow callers of virLogMessage to add arbitrary additional JSON fields,
and use it in virRaiseErrorFull and its callers. Because the additional
fields for errors include virErrorDomain and virErrorNumber, this allows
_programs_ to _automatically_ detect the event and react to it, perhaps
alerting the user about a situation that requires immediate attention,
or automatically suggesting a solution.
This has not been possible until now because the current logs contain
only a translated error message, so the log record doesn't contain
anything stable that could be detected by a program.
It is assumed that other parts of libvirt may add more event-specific
JSON fields in the future, based on demand by applications that process
the logs; I have, however, no immediate plans to add more.
Miloslav Trmač (12):
Drop unused return value of virLogOutputFunc
Add JSON API for preallocated objects.
Split yajl_gen allocation into a separate function.
Split adding object properties from virJSONValueToStringOne
Add a JSON generator API.
Pass the "raw" log message to each virLogOutputFunc
Split priority conversion from virLogOutputToSyslog
Add "syslog/json" log output format.
Add a JSON properties parameter to virLog{,V}Message
Add a JSON properties parameter to virLogOutputFunc
Add detailed error information to JSON syslog
Add a test for the new error reporting mechanism.
docs/logging.html.in | 3 +
src/libvirt_private.syms | 4 +
src/uml/uml_conf.c | 2 +-
src/util/json.c | 232 +++++++++++++++++++++++++++++++++++++++++-----
src/util/json.h | 26 ++++++
src/util/logging.c | 233 ++++++++++++++++++++++++++++++++++-------------
src/util/logging.h | 35 +++----
src/util/viraudit.c | 4 +-
src/util/virterror.c | 32 ++++++-
tests/Makefile.am | 6 +-
tests/errorjsontest.c | 211 ++++++++++++++++++++++++++++++++++++++++++
tests/testutils.c | 7 +-
12 files changed, 684 insertions(+), 111 deletions(-)
create mode 100644 tests/errorjsontest.c
--
1.7.11.4
12 years, 1 month
[libvirt] [ANNOUNCE] libvirt-designer 0.0.1 release
by Daniel P. Berrange
I am pleased to announce that the first release of the libvirt-designer
package, version 0.0.1, is now available from
ftp://ftp.libvirt.org/libvirt/designer/
The packages are GPG signed with
Key fingerprint: DAF3 A6FD B26B 6291 2D0E 8E3F BE86 EBB4 1510 4FDF (4096R)
New in this release:
- Everything !
The libvirt-designer package provides a library that integrates libosinfo
and libvirt-gconfig. Given an operating system identifier and libvirt
host capabilities, it queries the libosinfo database to determine optimal
hardware configuration and uses this information to design suitable domain
XML for running the OS as a guest. In a similar manner it facilitates the
setup of guest hardware devices such as disks, network interfaces, video
cards, etc. These APIs are inspired by experience creating internal APIs
for similar tasks in the virt-install/virt-manager projects.
Since it builds on libosinfo and libvirt-gconfig, the libvirt-designer
library relies on GObject introspection to provide access to its APIs
for non-C programming languages. In addition it explicitly avoids a
direct depedancy on libvirt.so, to enable usage by applications using
alternative SNMP, CIM, etc bindings to libvirt, or those applications
which simply need to construct libvirt XML without actually booting
the guests afterwards.
These early releases of libvirt-designer should be considered experimental.
While we don't actively plan to change/break the API/ABI, we are not going
to guarantee API/ABI stability of libvirt-designer at this time.
Follow up comments about libvirt-designer should be directed to the
regular libvir-list(a)redhat.com development list.
Thanks to all the people involved in contributing to this release, in
particular Michal who is actually doing the vast majority of the hard
work here.
Regards,
Daniel
--
|: 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, 1 month
[libvirt] [PATCH] qemu: Fix QMP detection of QXL graphics
by Jiri Denemark
With the recent introduction of QMP capabilities probing, libvirt failed
to detect support for QXL graphics in QEMU 1.2 and newer. In addition to
fixing that, this patch also causes libvirt to detect QXL support for
qemu-kvm-0.13.0, which doesn't advertise it in -help output but mentions
it in device list. Since qemu-kvm-0.13.0 supported -spice, it looks like
not having qxl in -help was a bug.
---
src/qemu/qemu_capabilities.c | 1 +
tests/qemuhelptest.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index d16a7bc..982b875 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1276,6 +1276,7 @@ struct qemuCapsStringFlags qemuCapsObjectTypes[] = {
{ "virtio-scsi-pci", QEMU_CAPS_VIRTIO_SCSI_PCI },
{ "spicevmc", QEMU_CAPS_DEVICE_SPICEVMC },
{ "qxl-vga", QEMU_CAPS_DEVICE_QXL_VGA },
+ { "qxl", QEMU_CAPS_VGA_QXL },
{ "sga", QEMU_CAPS_SGA },
{ "scsi-block", QEMU_CAPS_SCSI_BLOCK },
{ "scsi-cd", QEMU_CAPS_SCSI_CD },
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 681f425..df30ac1 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -467,6 +467,7 @@ mymain(void)
QEMU_CAPS_NESTING,
QEMU_CAPS_NAME_PROCESS,
QEMU_CAPS_SMBIOS_TYPE,
+ QEMU_CAPS_VGA_QXL,
QEMU_CAPS_SPICE,
QEMU_CAPS_VGA_NONE,
QEMU_CAPS_MIGRATE_QEMU_FD,
--
1.7.12
12 years, 1 month