[libvirt] [PATCH] Fixes for VNC port handling
by john.levon@sun.com
# HG changeset patch
# User john.levon(a)sun.com
# Date 1233118371 28800
# Node ID f91041f0c607be72c4b5695f081d20716521f6c5
# Parent 8fce2ce6108eb1ff1865ecc21d57114db036f2a2
Fixes for VNC port handling
When parsing sexpr, the VNC port should not be ignored, even when vncunused is
set. Fix the parsing of vncdisplay, which was broken due to strtol() (never
use this function!).
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/src/xend_internal.c b/src/xend_internal.c
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -612,7 +612,9 @@ sexpr_get(virConnectPtr xend, const char
*
* convenience function to lookup an int value in the S-Expression
*
- * Returns the value found or 0 if not found (but may not be an error)
+ * Returns the value found or 0 if not found (but may not be an error).
+ * This function suffers from the flaw that zero is both a correct
+ * return value and an error indicator: careful!
*/
static int
sexpr_int(const struct sexpr *sexpr, const char *name)
@@ -2091,15 +2093,16 @@ xenDaemonParseSxprGraphicsNew(virConnect
port = xenStoreDomainGetVNCPort(conn, def->id);
xenUnifiedUnlock(priv);
+ // Didn't find port entry in xenstore
if (port == -1) {
- // Didn't find port entry in xenstore
- port = sexpr_int(node, "device/vfb/vncdisplay");
+ const char *value = sexpr_node(node,
+ "device/vfb/vncdisplay");
+ if (value != NULL)
+ port = strtol(value, NULL, 0);
}
- if ((unused && STREQ(unused, "1")) || port == -1) {
+ if ((unused && STREQ(unused, "1")) || port == -1)
graphics->data.vnc.autoport = 1;
- port = -1;
- }
if (port >= 0 && port < 5900)
port += 5900;
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-autoport.sexpr b/tests/sexpr2xmldata/sexpr2xml-fv-autoport.sexpr
new file mode 100644
--- /dev/null
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-autoport.sexpr
@@ -0,0 +1,85 @@
+(domain
+ (domid 21)
+ (on_crash destroy)
+ (uuid e0c172e6-4ad8-7353-0ece-515d2f181365)
+ (bootloader_args )
+ (vcpus 1)
+ (name domu-224)
+ (on_poweroff destroy)
+ (on_reboot destroy)
+ (bootloader )
+ (maxmem 512)
+ (memory 512)
+ (shadow_memory 5)
+ (cpu_weight 256)
+ (cpu_cap 0)
+ (features )
+ (on_xend_start ignore)
+ (on_xend_stop shutdown)
+ (start_time 1233108538.42)
+ (cpu_time 907.159661051)
+ (online_vcpus 1)
+ (image
+ (hvm
+ (kernel /usr/lib/xen/boot/hvmloader)
+ (boot d)
+ (device_model /usr/lib/xen/bin/qemu-dm)
+ (keymap en-us)
+ (localtime 1)
+ (pae 1)
+ (serial pty)
+ (usb 1)
+ (usbdevice tablet)
+ (notes (SUSPEND_CANCEL 1))
+ )
+ )
+ (status 2)
+ (state r-----)
+ (store_mfn 131070)
+ (device
+ (vif
+ (bridge e1000g0)
+ (mac 00:16:3e:1b:e8:18)
+ (script vif-vnic)
+ (uuid 7da8c614-018b-dc87-6bfc-a296a95bca4f)
+ (backend 0)
+ )
+ )
+ (device
+ (vbd
+ (uname phy:/iscsi/winxp)
+ (uuid 65e19258-f4a2-a9ff-3b31-469ceaf4ec8d)
+ (mode w)
+ (dev hda:disk)
+ (backend 0)
+ (bootable 1)
+ )
+ )
+ (device
+ (vbd
+ (uname file:/net/heaped/export/netimage/windows/xp-sp2-vol.iso)
+ (uuid 87d9383b-f0ad-11a4-d668-b965f55edc3f)
+ (mode r)
+ (dev hdc:cdrom)
+ (backend 0)
+ (bootable 0)
+ )
+ )
+ (device (vkbd (backend 0)))
+ (device
+ (vfb
+ (vncunused 1)
+ (keymap en-us)
+ (type vnc)
+ (uuid 09666ad1-0c94-d79c-1439-99e05394ee51)
+ (location localhost:5900)
+ )
+ )
+ (device
+ (console
+ (protocol vt100)
+ (location 3)
+ (uuid cabfc0f5-1c9c-0e6f-aaa8-9974262aff66)
+ )
+ )
+)
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml b/tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml
new file mode 100644
--- /dev/null
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml
@@ -0,0 +1,48 @@
+<domain type='xen' id='21'>
+ <name>domu-224</name>
+ <uuid>e0c172e6-4ad8-7353-0ece-515d2f181365</uuid>
+ <memory>524288</memory>
+ <currentMemory>524288</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type>hvm</type>
+ <loader>/usr/lib/xen/boot/hvmloader</loader>
+ <boot dev='cdrom'/>
+ </os>
+ <features>
+ <pae/>
+ </features>
+ <clock offset='localtime'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
+ <disk type='block' device='disk'>
+ <driver name='phy'/>
+ <source dev='/iscsi/winxp'/>
+ <target dev='hda' bus='ide'/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='file'/>
+ <source file='/net/heaped/export/netimage/windows/xp-sp2-vol.iso'/>
+ <target dev='hdc' bus='ide'/>
+ <readonly/>
+ </disk>
+ <interface type='bridge'>
+ <mac address='00:16:3e:1b:e8:18'/>
+ <source bridge='e1000g0'/>
+ <script path='vif-vnic'/>
+ <target dev='vif21.0'/>
+ </interface>
+ <serial type='pty'>
+ <target port='0'/>
+ </serial>
+ <console type='pty'>
+ <target port='0'/>
+ </console>
+ <input type='tablet' bus='usb'/>
+ <input type='mouse' bus='ps2'/>
+ <graphics type='vnc' port='5900' autoport='yes' keymap='en-us'/>
+ </devices>
+</domain>
15 years, 11 months
[libvirt] [PATCH] proxy: Fix use of uninitalized memory
by Rasputin
On short read, members of packet header are checked before actually read.
If uninitialized values can pass the test, they can be set to arbitrary
values while reading remaining portion of a packet.
Buffer overflow is possible. libvirt_proxy is suid-root.
diff -urp libvirt-0.5.1/proxy/libvirt_proxy.c libvirt-dev/proxy/libvirt_proxy.c
--- libvirt-0.5.1/proxy/libvirt_proxy.c 2008-11-20 08:58:43.000000000 +0100
+++ libvirt-dev/proxy/libvirt_proxy.c 2009-01-25 12:51:33.000000000 +0100
@@ -385,7 +385,8 @@ retry:
fprintf(stderr, "read %d bytes from client %d on socket %d\n",
ret, nr, pollInfos[nr].fd);
- if ((req->version != PROXY_PROTO_VERSION) ||
+ if ((ret != sizeof(virProxyPacket)) ||
+ (req->version != PROXY_PROTO_VERSION) ||
(req->len < sizeof(virProxyPacket)) ||
(req->len > sizeof(virProxyFullPacket)))
goto comm_error;
15 years, 11 months
[libvirt] PATCH: Detect SASL library on Solaris
by Daniel P. Berrange
I did a test build of CVS on Solaris and noticed it didn't detect SASL,
even though SASL was available. It turns out the library on SOlaris is
called libsasl.so, instead of libsasl2.so. It is still API compatible
with the Linux one, so there does not seem to be a reason not to use it
So this patch extends the configure test to make this work
Daniel
Index: configure.in
===================================================================
RCS file: /data/cvs/libvirt/configure.in,v
retrieving revision 1.202
diff -u -p -u -p -r1.202 configure.in
--- configure.in 27 Jan 2009 15:29:53 -0000 1.202
+++ configure.in 28 Jan 2009 11:38:25 -0000
@@ -517,18 +517,26 @@ if test "x$with_sasl" != "xno"; then
fail=1
fi])
if test "x$with_sasl" != "xno" ; then
- AC_CHECK_LIB([sasl2], [sasl_client_init],[with_sasl=yes],[
- if test "x$with_sasl" = "xcheck" ; then
+ AC_CHECK_LIB([sasl2], [sasl_client_init],[
+ SASL_LIBS="$SASL_LIBS -lsasl2"
+ with_sasl=yes
+ ],[
+ AC_CHECK_LIB([sasl], [sasl_client_init],[
+ SASL_LIBS="$SASL_LIBS -lsasl"
+ with_sasl=yes
+ ],[
+ if test "x$with_sasl" = "xcheck" ; then
with_sasl=no
- else
+ else
fail=1
- fi])
+ fi
+ ])
+ ])
fi
test $fail = 1 &&
AC_MSG_ERROR([You must install the Cyrus SASL development package in order to compile libvirt])
CFLAGS="$old_cflags"
LIBS="$old_libs"
- SASL_LIBS="$SASL_LIBS -lsasl2"
if test "x$with_sasl" = "xyes" ; then
AC_DEFINE_UNQUOTED([HAVE_SASL], 1,
[whether Cyrus SASL is available for authentication])
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
15 years, 11 months
[libvirt] PATCH: Reset global error object at end of test
by Daniel P. Berrange
There statstest test case is expected to raise a number of libvirt
errors. Since these are now stored in thread locals, it is expected
that this won't be free'd automatically at system shutdown. This
patch adds a call to virResetError() at the end to release the memory
associated with the stored error object. There is still one block of
memory alocated though, which is the thread local error error object
itself. We can't free this easily, so I just add a valgrind suppression
rule instead. This lets 'make valgrind' pass again
Also since the test case doesn't call virInitialize()as a normal
app would do, we need to explicitly initialize the thread local storage
to ensure things work correctly.
Daniel
diff -r 93337ec227d6 tests/.valgrind.supp
--- a/tests/.valgrind.supp Mon Jan 26 15:25:53 2009 +0000
+++ b/tests/.valgrind.supp Tue Jan 27 11:15:47 2009 +0000
@@ -238,3 +238,18 @@
fun:virtTestRun
fun:mymain
}
+{
+ ignoreThreadLocalErrorObject
+ Memcheck:Leak
+ fun:calloc
+ fun:virAlloc
+ fun:virLastErrorObject
+ fun:virRaiseError
+ fun:statsErrorFunc
+ fun:xenLinuxDomainDeviceID
+ fun:testDeviceHelper
+ fun:virtTestRun
+ fun:mymain
+ fun:virtTestMain
+ fun:main
+}
diff -r 93337ec227d6 tests/testutils.c
--- a/tests/testutils.c Mon Jan 26 15:25:53 2009 +0000
+++ b/tests/testutils.c Tue Jan 27 11:15:47 2009 +0000
@@ -26,6 +26,8 @@
#include "internal.h"
#include "memory.h"
#include "util.h"
+#include "threads.h"
+#include "virterror_internal.h"
#if TEST_OOM_TRACE
#include <execinfo.h>
@@ -319,8 +321,8 @@ int virtTestMain(int argc,
int (*func)(int, char **))
{
char *debugStr;
+ int ret;
#if TEST_OOM
- int ret;
int approxAlloc = 0;
int n;
char *oomStr = NULL;
@@ -330,6 +332,10 @@ int virtTestMain(int argc,
int worker = 0;
#endif
+ if (virThreadInitialize() < 0 ||
+ virErrorInitialize() < 0)
+ return 1;
+
if ((debugStr = getenv("VIR_TEST_DEBUG")) != NULL) {
if (virStrToLong_ui(debugStr, NULL, 10, &testDebug) < 0)
testDebug = 0;
@@ -349,8 +355,10 @@ int virtTestMain(int argc,
if (getenv("VIR_TEST_MP") != NULL) {
mp = sysconf(_SC_NPROCESSORS_ONLN);
fprintf(stderr, "Using %d worker processes\n", mp);
- if (VIR_ALLOC_N(workers, mp) < 0)
- return EXIT_FAILURE;
+ if (VIR_ALLOC_N(workers, mp) < 0) {
+ ret = EXIT_FAILURE;
+ goto cleanup;
+ }
}
if (testOOM)
@@ -359,7 +367,7 @@ int virtTestMain(int argc,
/* Run once to count allocs, and ensure it passes :-) */
ret = (func)(argc, argv);
if (ret != EXIT_SUCCESS)
- return EXIT_FAILURE;
+ goto cleanup;
#if TEST_OOM_TRACE
if (testDebug)
@@ -431,9 +439,11 @@ int virtTestMain(int argc,
else
fprintf(stderr, " FAILED\n");
}
+cleanup:
+#else
+ ret = (func)(argc, argv);
+#endif
+
+ virResetLastError();
return ret;
-
-#else
- return (func)(argc, argv);
-#endif
}
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
15 years, 11 months
[libvirt] [PATCH] Fix stderr spewage from docs/examples install
by john.levon@sun.com
# HG changeset patch
# User John Levon <john.levon(a)sun.com>
# Date 1232970961 28800
# Node ID 839f1721d6d9c2cfdbc9327814a4c4a9564ff814
# Parent 26d337992a98a00d98f83247eb113ca3d729d8ef
Fix stderr spewage from docs/examples install
*.res don't exist, so shouldn't be in the generated Makefile.am
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/docs/examples/Makefile.am b/docs/examples/Makefile.am
--- a/docs/examples/Makefile.am
+++ b/docs/examples/Makefile.am
@@ -20,7 +20,7 @@ install-data-local:
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)
-@INSTALL@ -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml \
- $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR)
+ $(srcdir)/*.xsl $(DESTDIR)$(HTML_DIR)
EXTRA_DIST=examples.xsl index.py examples.xml
diff --git a/docs/examples/index.py b/docs/examples/index.py
--- a/docs/examples/index.py
+++ b/docs/examples/index.py
@@ -241,7 +241,7 @@ install-data-local:
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)
-@INSTALL@ -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml \\
- $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR)
+ $(srcdir)/*.xsl $(DESTDIR)$(HTML_DIR)
"""
EXTRA_DIST= string.join(extras, ' ')
15 years, 11 months
[libvirt] [PATCH] Fix misuse of PF_UNIX
by john.levon@sun.com
# HG changeset patch
# User john.levon(a)sun.com
# Date 1233105335 28800
# Node ID b3a2537e2f3d5ccb055df1820c112b469a26efdb
# Parent 35f5d4f77a3f50cadacf32100fdbd992394f6002
Fix misuse of PF_UNIX
PF_UNIX is a protocol familay, not a valid protocol, so isn't suitable
for the 3rd socket() argument. Solaris should be ignoring the invalid
protocol anyway, but this fix is correct regardless.
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/src/xend_internal.c b/src/xend_internal.c
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -752,7 +752,11 @@ xenDaemonOpen_unix(virConnectPtr conn, c
memset(&priv->addr, 0, sizeof(priv->addr));
priv->addrfamily = AF_UNIX;
- priv->addrprotocol = PF_UNIX;
+ /*
+ * This must be zero on Solaris at least for AF_UNIX (which should
+ * really be PF_UNIX, but doesn't matter).
+ */
+ priv->addrprotocol = 0;
priv->addrlen = sizeof(struct sockaddr_un);
addr = (struct sockaddr_un *)&priv->addr;
15 years, 11 months
[libvirt] [PATCH] Install schemas into correct location for Solaris
by john.levon@sun.com
# HG changeset patch
# User john.levon(a)sun.com
# Date 1233119659 28800
# Node ID cc848242fa810e8d0126b651849de715c7ef32e4
# Parent f91041f0c607be72c4b5695f081d20716521f6c5
Install schemas into correct location for Solaris
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/configure.in b/configure.in
--- a/configure.in
+++ b/configure.in
@@ -141,6 +141,10 @@ if test -n "$UDEVSETTLE"; then
AC_DEFINE_UNQUOTED([UDEVSETTLE],["$UDEVSETTLE"],
[Location or name of the udevsettle program])
fi
+
+SCHEMA_DIR=${pkgdatadir}/schemas
+test `uname -s` = SunOS && SCHEMA_DIR=${datadir}/lib/xml/rng/libvirt
+AC_SUBST([SCHEMA_DIR])
dnl Specific dir for HTML output ?
AC_ARG_WITH([html-dir], [AC_HELP_STRING([--with-html-dir=path],
diff --git a/docs/schemas/Makefile.am b/docs/schemas/Makefile.am
--- a/docs/schemas/Makefile.am
+++ b/docs/schemas/Makefile.am
@@ -1,6 +1,7 @@
-schemadir = $(pkgdatadir)/schemas
+schemadir = $(SCHEMA_DIR)
+
schema_DATA = \
domain.rng \
network.rng \
15 years, 11 months
[libvirt] [PATCH] avoid printf format-mismatch warnings
by Jim Meyering
autobuild.sh fails like this on at least RHEL5.3:
cc1: warnings being treated as errors
qemud.c: In function 'qemudClientReadBuf':
qemud.c:1470: warning: format '%d' expects type 'int', but argument 7 has type 'ssize_t'
qemud.c: In function 'qemudClientWriteBuf':
qemud.c:1695: warning: format '%d' expects type 'int', but argument 7 has type 'ssize_t'
make[2]: *** [libvirtd-qemud.o] Error 1
so I'm about to apply the following fix:
>From 162177b69fec410b7d940cf9242cba9b147f0bdb Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Wed, 28 Jan 2009 12:08:26 +0100
Subject: [PATCH] avoid printf format-mismatch warnings
* qemud/qemud.c (qemudClientReadBuf, qemudClientWriteBuf):
Use %lld and a (long long int) cast to print a ssize_t value.
---
qemud/qemud.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/qemud/qemud.c b/qemud/qemud.c
index eb91533..fa5e17d 100644
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -1467,7 +1467,8 @@ static ssize_t qemudClientReadBuf(struct qemud_client *client,
ssize_t ret;
if (len < 0) {
- VIR_ERROR(_("unexpected negative length request %d"), len);
+ VIR_ERROR(_("unexpected negative length request %lld"),
+ (long long int) len);
qemudDispatchClientFailure(client);
return -1;
}
@@ -1692,7 +1693,8 @@ static ssize_t qemudClientWriteBuf(struct qemud_client *client,
ssize_t ret;
if (len < 0) {
- VIR_ERROR(_("unexpected negative length request %d"), len);
+ VIR_ERROR(_("unexpected negative length request %lld"),
+ (long long int) len);
qemudDispatchClientFailure(client);
return -1;
}
--
1.6.1.1.374.g0d9d7
15 years, 11 months
[libvirt] use virReportOOMError, not VIR_ERR_NO_MEMORY
by Jim Meyering
I've changed over 200 uses of <some_error_function> with the
VIR_ERR_NO_MEMORY flag to call virReportOOMError with whatever
"conn"-like argument (if any) was in the original call.
I don't claim to have tested these changes (OOM is a pain to simulate,
and besides, testing so many failure points would take more
infrastructure than we have right now).
However, I did automate most of the process.
most of the changes were performed automatically via this:
perl -0x0 -pi -e \
's/\w+( ?)\(([\w>-]+), *(?:(?:VIR_FROM_NONE|domcode|vm|dom|net|NULL), ?){0,3}VIR_ERR_NO_MEMORY,.*?\);/virReportOOMError$1($2);/sg' \
$(g grep -l VIR_ERR_NO_MEMORY|grep '\.c$'|grep -vF virterror.c)
Exceptions:
======================
Exceptions (as noted in ChangeLog) were to add the now-required
definitions of VIR_FROM_THIS, as needed, e.g.,
#define VIR_FROM_THIS VIR_FROM_OPENVZ
in openvz-related files.
Also, I replaced uses of qparam_report_oom automatically:
perl -pi -e 's/qparam_report_oom\(\);/virReportOOMError(NULL);/' \
src/qparams.c
and removed the definition of that macro manually.
I spotted and manually adjusted one misuse of VIR_ERR_NO_MEMORY:
remote_internal.c: fix typo that would mistakenly report OOM
* src/remote_internal.c (addrToString): Report VIR_ERR_UNKNOWN_HOST,
not VIR_ERR_NO_MEMORY.
ctxt in src/conf.c is not usable:
perl -pi -e 's/virReportOOMError\(ctxt\);/virReportOOMError(NULL);/' \
src/conf.c
I manually converted two uses of virSexprError(VIR_ERR_NO_MEMORY in
src/sexpr.c.
And of course, copyright dates were updated via an emacs write hook.
The first iteration involved applying the perl-based xforms
more of less file by file, and making sure everything still compiled.
Once done, I repeated the process on a new branch, automating as much
as possible, and then diff'd the branches. The diff was nearly empty,
modulo copyright dates and added VIR_FROM_THIS definitions.
I'm posting two small sort-of-different changes here.
I'll post this big first one separately.
>From 099536470ae2cbe9503ed471d391e403fb2587a4 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 27 Jan 2009 12:20:06 +0100
Subject: [PATCH 1/3] error-reporting calls using VIR_ERR_NO_MEMORY: use virReportOOMError instead
* src/uml_conf.c (VIR_FROM_THIS): Define to VIR_FROM_UML.
* src/xs_internal.c (VIR_FROM_THIS): Define to VIR_FROM_XEN.
* src/xml.c (VIR_FROM_THIS): Define to VIR_FROM_XML.
* src/stats_linux.c (VIR_FROM_THIS): Define to VIR_FROM_STATS_LINUX.
* src/datatypes.c (VIR_FROM_THIS): Define to VIR_FROM_NONE.
* src/lxc_conf.c (VIR_FROM_THIS): Define to VIR_FROM_LXC.
* src/libvirt.c (VIR_FROM_THIS): Define to VIR_FROM_NONE.
* src/node_device_conf.c (VIR_FROM_THIS): Define to VIR_FROM_NODEDEV.
* src/openvz_conf.c (VIR_FROM_THIS): Define to VIR_FROM_OPENVZ.
* src/openvz_driver.c (VIR_FROM_THIS): Define to VIR_FROM_OPENVZ.
* src/conf.c (VIR_FROM_THIS): Define to VIR_FROM_CONF.
Note: this loses config_filename:config_lineno diagnostics,
but that's ok.
* src/node_device.c (VIR_FROM_THIS): Define to VIR_FROM_NODEDEV.
* src/sexpr.c (VIR_FROM_THIS): Define to VIR_FROM_SEXPR.
---
...
>From a223b8f6064e867d304df9a0a1498ef2940631ef Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 27 Jan 2009 15:58:07 +0100
Subject: [PATCH 2/3] qparams.c: Use virReportOOMError(NULL), not qparam_report_oom()
* src/qparams.c (VIR_FROM_THIS): Define to VIR_FROM_NONE.
(qparam_report_oom): Remove definition.
Replace all uses.
---
src/qparams.c | 22 ++++++++++------------
1 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/src/qparams.c b/src/qparams.c
index 22c5853..d0a84b3 100644
--- a/src/qparams.c
+++ b/src/qparams.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007 Red Hat, Inc.
+/* Copyright (C) 2007, 2009 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -33,9 +33,7 @@
#include "memory.h"
#include "qparams.h"
-#define qparam_report_oom(void) \
- virReportErrorHelper(NULL, VIR_FROM_NONE, VIR_ERR_NO_MEMORY, \
- __FILE__, __FUNCTION__, __LINE__, NULL)
+#define VIR_FROM_THIS VIR_FROM_NONE
struct qparam_set *
new_qparam_set (int init_alloc, ...)
@@ -47,14 +45,14 @@ new_qparam_set (int init_alloc, ...)
if (init_alloc <= 0) init_alloc = 1;
if (VIR_ALLOC(ps) < 0) {
- qparam_report_oom();
+ virReportOOMError(NULL);
return NULL;
}
ps->n = 0;
ps->alloc = init_alloc;
if (VIR_ALLOC_N(ps->p, ps->alloc) < 0) {
VIR_FREE (ps);
- qparam_report_oom();
+ virReportOOMError(NULL);
return NULL;
}
@@ -98,7 +96,7 @@ grow_qparam_set (struct qparam_set *ps)
{
if (ps->n >= ps->alloc) {
if (VIR_REALLOC_N(ps->p, ps->alloc * 2) < 0) {
- qparam_report_oom();
+ virReportOOMError(NULL);
return -1;
}
ps->alloc *= 2;
@@ -115,14 +113,14 @@ append_qparam (struct qparam_set *ps,
pname = strdup (name);
if (!pname) {
- qparam_report_oom();
+ virReportOOMError(NULL);
return -1;
}
pvalue = strdup (value);
if (!pvalue) {
VIR_FREE (pname);
- qparam_report_oom();
+ virReportOOMError(NULL);
return -1;
}
@@ -156,7 +154,7 @@ qparam_get_query (const struct qparam_set *ps)
}
if (virBufferError(&buf)) {
- qparam_report_oom();
+ virReportOOMError(NULL);
return NULL;
}
@@ -184,7 +182,7 @@ qparam_query_parse (const char *query)
ps = new_qparam_set (0, NULL);
if (!ps) {
- qparam_report_oom();
+ virReportOOMError(NULL);
return NULL;
}
@@ -257,7 +255,7 @@ qparam_query_parse (const char *query)
return ps;
out_of_memory:
- qparam_report_oom();
+ virReportOOMError(NULL);
free_qparam_set (ps);
return NULL;
}
--
1.6.1.1.363.g2a3bd
>From dd9477353e930ba75dea1e06ccbced5b1cb61e09 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 27 Jan 2009 15:53:27 +0100
Subject: [PATCH 3/3] remote_internal.c: fix typo that would mistakenly report OOM
* src/remote_internal.c (addrToString): Report VIR_ERR_UNKNOWN_HOST,
not VIR_ERR_NO_MEMORY.
---
src/remote_internal.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/remote_internal.c b/src/remote_internal.c
index 8ed52bc..5c2e705 100644
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -2,7 +2,7 @@
* remote_internal.c: driver to provide access to libvirtd running
* on a remote machine
*
- * Copyright (C) 2007-2008 Red Hat, Inc.
+ * Copyright (C) 2007-2009 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -4949,10 +4949,10 @@ static char *addrToString(struct sockaddr_storage *sa, socklen_t salen)
port, sizeof(port),
NI_NUMERICHOST | NI_NUMERICSERV)) != 0) {
virRaiseError (NULL, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_NO_MEMORY, VIR_ERR_ERROR,
- NULL, NULL, NULL, 0, 0,
- _("Cannot resolve address %d: %s"),
- err, gai_strerror(err));
+ VIR_ERR_UNKNOWN_HOST, VIR_ERR_ERROR,
+ NULL, NULL, NULL, 0, 0,
+ _("Cannot resolve address %d: %s"),
+ err, gai_strerror(err));
return NULL;
}
@@ -6836,4 +6836,3 @@ remoteRegister (void)
return 0;
}
-
--
1.6.1.1.363.g2a3bd
15 years, 11 months
Re: [libvirt] Clock problems with Windows guests and Xen
by Matthew Donovan
> On Tue, Jan 27, 2009 at 01:33:21PM -0500, Matthew Donovan wrote:
> > When I start Windows guests with libvirt my clocks are 5 hours off.
When I
> > use a Xen configuration file, I can specify an offset (rtc_timeoffset =
> > -18000) to get my clock to sync with the host. Is there a way to do
specify
> > this offset in XML with libvirt?
> >
> > Right now, I'm using version 0.4.4 but I downloaded the source for 0.5.1
and
> > it looks like that part of domain_conf.c hasn't changed.
> Sounds like you have the wrong clock offset setting, in the XML. There
> are two options:
> <clock offset="localtime"/>
> <clock offset="utc"/>
> Usually for Windows you want the 'localtime' one since it is dumb at time
> keeping & DST shifts.
> Daniel
That seems to have done it.
Thanks!
-matthew
15 years, 11 months