[libvirt] [PATCH] Fix segfault if virtual network has no bridge listed
by Cole Robinson
The attached patch fixes a libvirtd segfault if we try to call
virNetworkGetBridgeName on a virtual network with no bridge in its xml.
This occurs if the network hasn't been started as long as the daemon has
been running.
This patch also cleans up an error path in qemu_conf which was
overwriting the error returned by virNetworkGetBridgeName.
Thanks,
Cole
16 years
[libvirt] [PATCH] add fullscreen support to qemu sdl xml (via fullscreen='true' attribute for the graphics element)
by Itamar Heim
diff --git a/src/domain_conf.c b/src/domain_conf.c
index 32ed59f..018d07f 100644
--- a/src/domain_conf.c
+++ b/src/domain_conf.c
@@ -212,6 +212,7 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr
def)
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
VIR_FREE(def->data.sdl.display);
VIR_FREE(def->data.sdl.xauth);
+ VIR_FREE(def->data.sdl.fullscreen);
break;
}
@@ -1403,6 +1404,7 @@ virDomainGraphicsDefParseXML(virConnectPtr conn,
} else if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
def->data.sdl.xauth = virXMLPropString(node, "xauth");
def->data.sdl.display = virXMLPropString(node, "display");
+ def->data.sdl.fullscreen = virXMLPropString(node, "fullscreen");
}
cleanup:
@@ -2951,6 +2953,10 @@ virDomainGraphicsDefFormat(virConnectPtr conn,
if (def->data.sdl.xauth)
virBufferEscapeString(buf, " xauth='%s'",
def->data.sdl.xauth);
+ if (def->data.sdl.fullscreen)
+ virBufferEscapeString(buf, " fullscreen='%s'",
+ def->data.sdl.fullscreen);
+
break;
}
diff --git a/src/domain_conf.h b/src/domain_conf.h
index 51cf6d5..436d0b1 100644
--- a/src/domain_conf.h
+++ b/src/domain_conf.h
@@ -268,6 +268,7 @@ struct _virDomainGraphicsDef {
struct {
char *display;
char *xauth;
+ char *fullscreen;
} sdl;
} data;
};
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index e6c378f..e53f5f0 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -35,6 +35,7 @@
#include <sys/wait.h>
#include <arpa/inet.h>
#include <sys/utsname.h>
+#include <stdbool.h>
#if HAVE_NUMACTL
#define NUMA_VERSION1_COMPATIBILITY 1
@@ -1213,6 +1214,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
vm->def->graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
char *xauth = NULL;
char *display = NULL;
+ bool fullscreen = false;
if (vm->def->graphics->data.sdl.xauth &&
asprintf(&xauth, "XAUTHORITY=%s",
@@ -1225,10 +1227,17 @@ int qemudBuildCommandLine(virConnectPtr conn,
goto no_memory;
}
+ if (vm->def->graphics->data.sdl.fullscreen &&
+ STREQ(vm->def->graphics->data.sdl.fullscreen, "true")) {
+ fullscreen=true;
+ }
+
if (xauth)
ADD_ENV(xauth);
if (display)
ADD_ENV(display);
+ if (fullscreen)
+ ADD_ARG_LIT("-full-screen");
}
/* Add sound hardware */
diff --git
a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.args
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.args
new file mode 100644
index 0000000..da2adc0
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test
XAUTHORITY=/root/.Xauthority DISPLAY=:0.1 /usr/bin/qemu -S -M pc -m 214
-smp 1 -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none
-serial none -parallel none -usb -full-screen
diff --git
a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml
b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml
new file mode 100644
index 0000000..007677a
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml
@@ -0,0 +1,24 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory>219200</memory>
+ <currentMemory>219200</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ </disk>
+ <input type='mouse' bus='ps2'/>
+ <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority'
fullscreen='true'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 6e5355a..a04d508 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -195,6 +195,7 @@ mymain(int argc, char **argv)
DO_TEST("disk-usb", 0);
DO_TEST("graphics-vnc", 0);
DO_TEST("graphics-sdl", 0);
+ DO_TEST("graphics-sdl-fullscreen", 0);
DO_TEST("input-usbmouse", 0);
DO_TEST("input-usbtablet", 0);
DO_TEST("input-xen", 0);
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index c810f78..613926a 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -98,6 +98,7 @@ mymain(int argc, char **argv)
DO_TEST("disk-usb");
DO_TEST("graphics-vnc");
DO_TEST("graphics-sdl");
+ DO_TEST("graphics-sdl-fullscreen");
DO_TEST("input-usbmouse");
DO_TEST("input-usbtablet");
DO_TEST("input-xen");
16 years
[libvirt] [PATCH] avoid a new "make distcheck" failure
by Jim Meyering
I noticed that "make distcheck" was failing.
This fixes it:
>From b80b724feb30ba46c5481e5b1198bbdfc2bfe428 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Wed, 10 Dec 2008 17:45:32 +0100
Subject: [PATCH] avoid a new "make distcheck" failure
Distribute the new file, libvirtd.logrotate.in, and make
distclean remove the build product, libvirtd.logrotate.
* qemud/Makefile.am (EXTRA_DIST): Add libvirtd.logrotate.in.
(DISTCLEANFILES): Initialize, and append libvirtd.logrotate.in.
---
qemud/Makefile.am | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/qemud/Makefile.am b/qemud/Makefile.am
index df1e100..8cb0847 100644
--- a/qemud/Makefile.am
+++ b/qemud/Makefile.am
@@ -13,6 +13,7 @@ DAEMON_SOURCES = \
AVAHI_SOURCES = \
mdns.c mdns.h
+DISTCLEANFILES =
EXTRA_DIST = \
default-network.xml \
remote_generate_stubs.pl rpcgen_fix.pl \
@@ -24,6 +25,7 @@ EXTRA_DIST = \
libvirtd.sysconf \
libvirtd.aug \
libvirtd_qemu.aug \
+ libvirtd.logrotate.in \
test_libvirtd.aug \
test_libvirtd_qemu.aug \
$(AVAHI_SOURCES) \
@@ -198,7 +200,7 @@ remote_dispatch_args.h: $(srcdir)/remote_generate_stubs.pl remote_protocol.x
remote_dispatch_ret.h: $(srcdir)/remote_generate_stubs.pl remote_protocol.x
perl -w $(srcdir)/remote_generate_stubs.pl -r $(srcdir)/remote_protocol.x > $@
-
+DISTCLEANFILES += libvirtd.logrotate
libvirtd.logrotate: libvirtd.logrotate.in
sed \
-e s!\@localstatedir\@!@localstatedir@!g \
--
1.6.0.4.1044.g77718
16 years
[libvirt] [PATCH] avoid format string warnings
by Jim Meyering
* src/openvz_conf.c (openvzGetNodeCPUs): Add "%s" arg before _(...).
* src/uml_driver.c (umlDomainBlockPeek): Likewise.
---
src/openvz_conf.c | 2 +-
src/uml_driver.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/openvz_conf.c b/src/openvz_conf.c
index fc4ef20..1361c53 100644
--- a/src/openvz_conf.c
+++ b/src/openvz_conf.c
@@ -466,7 +466,7 @@ openvzGetNodeCPUs(void)
if (virNodeInfoPopulate(NULL, &nodeinfo) < 0) {
openvzError(NULL, VIR_ERR_INTERNAL_ERROR,
- _("Cound not read nodeinfo"));
+ "%s", _("Cound not read nodeinfo"));
return 0;
}
diff --git a/src/uml_driver.c b/src/uml_driver.c
index 9c0d9c4..408096e 100644
--- a/src/uml_driver.c
+++ b/src/uml_driver.c
@@ -1764,13 +1764,13 @@ umlDomainBlockPeek (virDomainPtr dom,
if (!vm) {
umlReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- _("no domain with matching uuid"));
+ "%s", _("no domain with matching uuid"));
goto cleanup;
}
if (!path || path[0] == '\0') {
umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- _("NULL or empty path"));
+ "%s", _("NULL or empty path"));
goto cleanup;
}
@@ -1807,7 +1807,7 @@ umlDomainBlockPeek (virDomainPtr dom,
ret = 0;
} else {
umlReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- _("invalid path"));
+ "%s", _("invalid path"));
}
cleanup:
--
1.6.0.4.1044.g77718
16 years
[libvirt] PATCH 0/5: connection cloning support (WIP)
by Daniel P. Berrange
This series is a work-in-progress set of patches implementing connection
cloning. The idea is that if you want to use a connection form multiple
threads, you could do
virConnectPtr copy = virConnectClone(conn)
and use 'copy' from the other thread. This avoids the problem of having
to make all the virError handling stuff thread-local whic is the blocker
for allowing real mutlti-thread access to a single virConnectPtr object.
I believe this cloning support should be sufficient for the Java bindings
need to use a thread for its event loop. The idea being that if you wanted
to use an event loop in a background thread, you'd create a cloned object
for use event loop triggered callbacks like domain events notifications.
I'd still like to do some experiments later making the single virConnectPtr
fully thread safe, but that'll take a little more time. I'm hoping this
cloning will address the Java needs right now...
Daniel
--
|: 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 :|
16 years
[libvirt] F10 rpm problems
by Ben Guthro
So...I decided to make the leap, and upgraded to F10 (from F9)
After my upgrade, I decided to build the libvirt rpm from source, and install it.
So far, so good...everything built, and installs nicely.
However, when I run virsh, I get the following error:
virsh: error while loading shared libraries: libgnutls.so.13: cannot open shared object file: No such file or directory
Fedora 10 has /usr/lib/libgnutls.so.26, so I'm not real sure why it is looking for the old F9 versions.
I have tried a make clean, make distclean, even re-cloning the repo...without effect.
Does anyone have any thoughts as to why it is choosing this version of gnutls?
16 years
[libvirt] [PATCH] fix just-broken "virsh start" and "virsh pool-start" commands
by Jim Meyering
* src/virsh.c (cmdPoolStart, cmdStart): Change hard-coded
vshCommandOptDomainBy string argument to match just-changed
option name. Cole Robinson reported that "virsh start" was
broken and provided that part of the fix.
Bug introduced by yesterday's "virsh.c: tweak options to produce
more accurate help".
* tests/start: New file. Test for the above fix.
* tests/Makefile.am (test_scripts): Add start.
---
Without this change, "virsh start" and "virsh pool-start"
would always fail.
I'm fixing this in two steps: first is this patch: make the tiny
string-changing fixes (along with the new test).
Second will be a more invasive change to make it so the duplicate
strings are removed altogether, so they'll never get out of sync again.
src/virsh.c | 4 ++--
tests/Makefile.am | 1 +
tests/start | 42 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 45 insertions(+), 2 deletions(-)
create mode 100755 tests/start
diff --git a/src/virsh.c b/src/virsh.c
index bb81f25..1a5b42f 100644
--- a/src/virsh.c
+++ b/src/virsh.c
@@ -1021,7 +1021,7 @@ cmdStart(vshControl *ctl, const vshCmd *cmd)
if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
return FALSE;
- if (!(dom = vshCommandOptDomainBy(ctl, cmd, "name", NULL, VSH_BYNAME)))
+ if (!(dom = vshCommandOptDomainBy(ctl, cmd, "domain", NULL, VSH_BYNAME)))
return FALSE;
if (virDomainGetID(dom) != (unsigned int)-1) {
@@ -3693,7 +3693,7 @@ cmdPoolStart(vshControl *ctl, const vshCmd *cmd)
if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
return FALSE;
- if (!(pool = vshCommandOptPoolBy(ctl, cmd, "name", NULL, VSH_BYNAME)))
+ if (!(pool = vshCommandOptPoolBy(ctl, cmd, "pool", NULL, VSH_BYNAME)))
return FALSE;
if (virStoragePoolCreate(pool, 0) == 0) {
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fd319e1..9e794c5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -64,6 +64,7 @@ test_scripts += \
int-overflow \
read-bufsiz \
read-non-seekable \
+ start \
undefine \
vcpupin
virsh-all
diff --git a/tests/start b/tests/start
new file mode 100755
index 0000000..a436f9b
--- /dev/null
+++ b/tests/start
@@ -0,0 +1,42 @@
+#!/bin/sh
+# ensure that virsh start works properly
+
+# Copyright (C) 2008 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ virsh --version
+fi
+
+test -z "$srcdir" && srcdir=$(pwd)
+test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
+. "$srcdir/test-lib.sh"
+
+fail=0
+
+test_url=test:///default
+
+# expect this to fail
+virsh -c $test_url start test > out 2> err && fail=1
+
+# stdout gets a newline
+echo > exp || fail=1
+compare out exp || fail=1
+
+echo 'error: Domain is already active' > exp || fail=1
+compare err exp || fail=1
+
+(exit $fail); exit $fail
--
1.6.0.4.1044.g77718
16 years
[libvirt] [Python] libvirt.libvirtError output
by Ivan Vovk
Hello,
i have the following piece of pyhton test code:
try:
dom = conn.createXML(xmldata, 0)
except libvirt.libvirtError, le:
sys.stderr.write(le.message)
as a result in case of exception i get 2 outputs in stderr:
libvir: OpenVZ error : operation failed: Already an OPENVZ VM defined with the id '3005'
operation failed: Already an OPENVZ VM defined with the id '3005'
Actually, i just need only second string, which is generated by sys.stderr.write(le.message).
Can an exception be raised without "uncontrolled" direction to stderr (fisrt string)?
________________________________
This message (including attachments) is private and confidential. If you have received this message in error, please notify us and remove it from your system.
16 years
[libvirt] Open monitor logs O_APPEND
by Guido Günther
Hi,
attached patch is from Debian Bug #507553:
The logfile is opened with O_APPEND (to make logrotate work with
copytruncate) and without O_TRUNC (to not lose log information e.g. with
stop and start of a VM).
Using collectd or munin to monitor VMs creates quiet a bit of qemu
monitor output so the ability to use logrotate makes a lot of sense to
me.
O.k. to apply?
-- Guido
diff -ur libvirt-0.4.4.orig/src/qemu_driver.c libvirt-0.4.4/src/qemu_driver.c
--- libvirt-0.4.4.orig/src/qemu_driver.c 2008-06-12
16:52:53.000000000 +0200
+++ libvirt-0.4.4/src/qemu_driver.c 2008-12-02 12:48:32.271881000 +0100
@@ -844,7 +844,7 @@
return -1;
}
- if ((vm->logfile = open(logfile, O_CREAT | O_TRUNC | O_WRONLY,
+ if ((vm->logfile = open(logfile, O_CREAT | O_APPEND | O_WRONLY,
S_IRUSR | S_IWUSR)) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
_("failed to create logfile %s: %s"),
16 years
[libvirt] how to get started with libvirt & central access control
by Juan Miscaro
Quite new to libvirt (and kvm). I played with a few vm's with
libvirt/kvm and vnc/virsh/virt-manager. I would now like to implement
access control for my vm's (of any format: xen, kvm, etc) to a remote
backend (mysql/ldap/other). Where does one begin? I would later want
to do the same but in the context of a cluster of hosts (each running
multiple vm's). Thanks in advance for any advice.
/juan
16 years