[libvirt] [PATCH] Fix for parallel port passtrough for QEMU
by Beat.Joerg@ssatr.ch
Hi
As requested by Dave, I send this to the list.
I came across a bug that the command line generated for passtrough of the host parallel port /dev/parport0 by libvirt for QEMU is incorrect.
It currently produces:
-chardev tty,id=charparallel0,path=/dev/parport0
-device isa-parallel,chardev=charparallel0,id=parallel0
The first parameter is "tty". It sould be "parport".
If I launch qemu with -chardev parport,... it works as expected.
I have already filled a bug report ( https://bugzilla.redhat.com/show_bug.cgi?id=823879 ), the topic was already on the list some months ago:
https://www.redhat.com/archives/libvirt-users/2011-September/msg00095.html
Not sure if this is fix is very clean, but for my case it works.
Perhaps it should also be checked if similar problems / patches are required for other chardev backends.
Kind regards
Beat
diff -Naur libvirt-0.9.4.orig/src/qemu/qemu_command.c libvirt-0.9.4/src/qemu/qemu_command.c
--- libvirt-0.9.4.orig/src/qemu/qemu_command.c 2012-05-22 13:40:16.788633656 +0200
+++ libvirt-0.9.4/src/qemu/qemu_command.c 2012-05-22 13:52:18.453608557 +0200
@@ -2357,8 +2357,14 @@
break;
case VIR_DOMAIN_CHR_TYPE_DEV:
- virBufferAsprintf(&buf, "tty,id=char%s,path=%s", alias,
- dev->data.file.path);
+ if (STRPREFIX(dev->data.file.path, "/dev/parport")) {
+ virBufferAsprintf(&buf, "parport,id=char%s,path=%s", alias,
+ dev->data.file.path);
+ }
+ else {
+ virBufferAsprintf(&buf, "tty,id=char%s,path=%s", alias,
+ dev->data.file.path);
+ }
break;
case VIR_DOMAIN_CHR_TYPE_FILE:
12 years, 5 months
[libvirt] [PATCH] Fixes for check and rpm builds without sanlock (and qemu)
by Martin Kletzander
Apart from the non-sanlock check build, there is also a little fix for
qemu (EXTRA_DIST had qemu.conf and others inside even if the build was
supposed to be without qemu).
---
libvirt.spec.in | 5 +++++
src/Makefile.am | 6 +++++-
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index d4e43f6..3c544f1 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1232,6 +1232,11 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug
%endif
%find_lang %{name}
+%if ! %{with_sanlock}
+rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirt_sanlock.aug
+rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirt_sanlock.aug
+%endif
+
%if ! %{with_lxc}
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_lxc.aug
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug
diff --git a/src/Makefile.am b/src/Makefile.am
index 23747d7..e56a8ef 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -785,9 +785,9 @@ augeas_DATA += qemu/libvirtd_qemu.aug
augeastest_DATA += qemu/test_libvirtd_qemu.aug
CLEANFILES += qemu/test_libvirtd_qemu.aug
-endif
EXTRA_DIST += qemu/qemu.conf qemu/libvirtd_qemu.aug \
qemu/test_libvirtd_qemu.aug.in qemu/THREADS.txt
+endif
if WITH_LXC
@@ -1147,6 +1147,7 @@ else
check-augeas-lxc:
endif
+if HAVE_SANLOCK
test_libvirt_sanlock.aug: locking/test_libvirt_sanlock.aug.in \
locking/qemu-sanlock.conf $(AUG_GENTEST)
$(AUG_GENTEST) locking/qemu-sanlock.conf $< $@
@@ -1155,6 +1156,9 @@ check-augeas-sanlock: test_libvirt_sanlock.aug
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
'$(AUGPARSE)' -I $(srcdir)/locking test_libvirt_sanlock.aug; \
fi
+else
+check-augeas-sanlock:
+endif
#
# Build our version script. This is composed of three parts:
--
1.7.8.6
12 years, 5 months
[libvirt] Authentication
by Jagannath Timma
Are there any plans to add support for the default authentication method of
the server?
"""
http://libvirt.org/drvhyperv.html
Authentication
In order to perform any useful operation the driver needs to log into the
Hyper-V server. Therefore, only virConnectOpenAuth can be used to connect
to an Hyper-V server, virConnectOpen and virConnectOpenReadOnly don't work.
To log into an Hyper-V server the driver will request credentials using the
callback passed to the virConnectOpenAuth function. The driver passes the
hostname as challenge parameter to the callback.
Note: Currently only Basic authentication is supported by libvirt. This
method is disabled by default on the Hyper-V server and can be enabled via
the WinRM commandline tool.
""
Regards,
Jagannath
12 years, 5 months
[libvirt] [PATCH] SNMP: include inactive domains in guest table
by Jonathan Daugherty
Hi,
I've written a patch to include inactive domains in the guest table
available via the libvirt-snmp subagent. This makes it possible to
start domains via SNMP (a state transition which AFAICT was previously
impossible, because inactive domains never appeared in the SNMP
result).
The code now collects the IDs of running domains along with the names
of declared (but not running) domains and normalizes them into a list
of domain pointers, which is then processed by the preexisting SNMP
container row allocation code. The change was fairly straightforward,
but certainly there might be Good Reasons it wasn't already
implemented.
As part of this change, the other (noteworthy) change I made was to
move calls to virDomainFree() to the end of libvirtSnmpLoadGuests()
since I have to free all of the used domain pointers there anyway.
Some other issues which may need to be addressed:
- This will be a breaking change for anyone who assumes that the old
behavior is still in place (i.e., that the guest table only
includes non-shutdown domains). However, it might not be *that*
bad because the domain rows already included a 'state' that one
could already filter on.
- I don't know if there exists other code in libvirt-snmp that
assumes inactive domains can't appear in the table.
- I have not tested the inactive -> active state transition (because
I don't want to enable writable SNMP OIDs on my server).
Please let me know if there is anything further I need to do to make
the patch acceptable.
Thanks for libvirt-snmp!
--
Jonathan Daugherty
Software Engineer
Galois, Inc.
12 years, 5 months
[libvirt] [PATCH v2 0/2] Make virsh *edit more bearable
by Michal Privoznik
If there's an error in XML, all changes made by user are lost.
Users (read /me) tends to get angry with this. Allow them to
get back and re-edit.
diff to v1:
-Eric's review suggestions included
Michal Privoznik (2):
virsh: Switch from generated cmd*Edit commands to nongenerated
virsh: Allow users to reedit rejected XML
cfg.mk | 4 +-
po/POTFILES.in | 1 +
tools/Makefile.am | 40 +----
tools/console.c | 40 +++--
tools/console.h | 2 +
tools/virsh-edit.c | 138 +++++++++++++++
tools/virsh.c | 483 ++++++++++++++++++++++------------------------------
7 files changed, 371 insertions(+), 337 deletions(-)
create mode 100644 tools/virsh-edit.c
--
1.7.8.5
12 years, 5 months
[libvirt] [PATCH] tools: make virt-pki-validate work with acls and xattrs
by Martin Kletzander
This patch makes virt-pki-validate work with certificates that have
acl or xattr set. Otherwise it failing due to wrong permissions.
---
tools/virt-pki-validate.in | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/virt-pki-validate.in b/tools/virt-pki-validate.in
index 01825d1..4164758 100755
--- a/tools/virt-pki-validate.in
+++ b/tools/virt-pki-validate.in
@@ -170,7 +170,8 @@ then
else
echo Found client private key $LIBVIRTP/clientkey.pem
OWN=`ls -l "$LIBVIRTP/clientkey.pem" | awk '{ print $3 }'`
- MOD=`ls -l "$LIBVIRTP/clientkey.pem" | awk '{ print $1 }'`
+ # The substr($1, 1, 10) gets rid of acl and xattr markers
+ MOD=`ls -l "$LIBVIRTP/clientkey.pem" | awk '{ print substr($1, 1, 10) }'`
if [ "$OWN" != "root" ]
then
echo The client private key should be owned by root
@@ -222,7 +223,8 @@ then
else
echo Found server private key $LIBVIRTP/serverkey.pem
OWN=`ls -l "$LIBVIRTP/serverkey.pem" | awk '{ print $3 }'`
- MOD=`ls -l "$LIBVIRTP/serverkey.pem" | awk '{ print $1 }'`
+ # The substr($1, 1, 10) gets rid of acl and xattr markers
+ MOD=`ls -l "$LIBVIRTP/serverkey.pem" | awk '{ print substr($1, 1, 10) }'`
if [ "$OWN" != "root" ]
then
echo The server private key should be owned by root
--
1.7.8.6
12 years, 5 months
[libvirt] [PATCHv2 0/4] double close() fixes
by Eric Blake
Updated version of Wen's and my patches. In this version, I
fixed review comments, split Wen's patch into 3, and tracked
down when each bug was introduced.
Eric Blake (2):
command: avoid double close bugs
fdstream: avoid double close bug
Wen Congyang (2):
command: check for fork error before closing fd
qemu: avoid closing fd more than once
src/fdstream.c | 7 +++----
src/qemu/qemu_migration.c | 4 +++-
src/util/command.c | 24 ++++++++++--------------
3 files changed, 16 insertions(+), 19 deletions(-)
--
1.7.7.6
12 years, 6 months
[libvirt] [PATCH 1/3] avoid closing fd more than once in virFDStreamOpenFileInternal()
by Wen Congyang
When we assign fd and childfd to elements of fds[], we will
close these fds more than once on error. So we should assign
fds[] to -1 after we assign fd and childfd to elements of
fds[]. We should also close childfd on error.
---
src/fdstream.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/fdstream.c b/src/fdstream.c
index fca0f41..0de3b04 100644
--- a/src/fdstream.c
+++ b/src/fdstream.c
@@ -581,6 +581,7 @@ virFDStreamOpenFileInternal(virStreamPtr st,
struct stat sb;
virCommandPtr cmd = NULL;
int errfd = -1;
+ int childfd = -1;
VIR_DEBUG("st=%p path=%s oflags=%x offset=%llu length=%llu mode=%o",
st, path, oflags, offset, length, mode);
@@ -619,7 +620,6 @@ virFDStreamOpenFileInternal(virStreamPtr st,
if ((st->flags & VIR_STREAM_NONBLOCK) &&
(!S_ISCHR(sb.st_mode) &&
!S_ISFIFO(sb.st_mode))) {
- int childfd;
if ((oflags & O_ACCMODE) == O_RDWR) {
streamsReportError(VIR_ERR_INTERNAL_ERROR,
@@ -650,6 +650,7 @@ virFDStreamOpenFileInternal(virStreamPtr st,
fd = fds[1];
virCommandSetInputFD(cmd, childfd);
}
+ fds[0] = fds[1] = -1;
virCommandSetErrorFD(cmd, &errfd);
if (virCommandRunAsync(cmd, NULL) < 0)
@@ -668,6 +669,7 @@ error:
VIR_FORCE_CLOSE(fds[0]);
VIR_FORCE_CLOSE(fds[1]);
VIR_FORCE_CLOSE(fd);
+ VIR_FORCE_CLOSE(childfd);
VIR_FORCE_CLOSE(errfd);
if (oflags & O_CREAT)
unlink(path);
--
1.7.1
12 years, 6 months
[libvirt] [PATCH] command: avoid double close bugs
by Eric Blake
KAMEZAWA Hiroyuki reported a nasty double-free bug when virCommand
is used to convert a string into input to a child command. The
problem is that the poll() loop of virCommandProcessIO would close()
the write end of the pipe in order to let the child see EOF, then
the caller virCommandRun() would also close the same fd number, with
the second close possibly nuking an fd opened by some other thread
in the meantime. This in turn can have all sorts of bad effects.
This is based on his first attempt at a patch, at
https://bugzilla.redhat.com/show_bug.cgi?id=823716
* src/util/command.c (_virCommand): Drop inpipe member.
(virCommandProcessIO): Add argument, to avoid closing caller's fd
without informing caller.
(virCommandRun, virCommandNewArgs): Adjust clients.
---
src/util/command.c | 18 ++++++------------
1 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/src/util/command.c b/src/util/command.c
index eaa9f16..bf219e4 100644
--- a/src/util/command.c
+++ b/src/util/command.c
@@ -83,7 +83,6 @@ struct _virCommand {
char **errbuf;
int infd;
- int inpipe;
int outfd;
int errfd;
int *outfdptr;
@@ -788,7 +787,6 @@ virCommandNewArgs(const char *const*args)
cmd->handshakeNotify[1] = -1;
cmd->infd = cmd->outfd = cmd->errfd = -1;
- cmd->inpipe = -1;
cmd->pid = -1;
virCommandAddArgSet(cmd, args);
@@ -1676,7 +1674,7 @@ virCommandTranslateStatus(int status)
* Manage input and output to the child process.
*/
static int
-virCommandProcessIO(virCommandPtr cmd)
+virCommandProcessIO(virCommandPtr cmd, int *inpipe)
{
int infd = -1, outfd = -1, errfd = -1;
size_t inlen = 0, outlen = 0, errlen = 0;
@@ -1687,7 +1685,7 @@ virCommandProcessIO(virCommandPtr cmd)
* via pipe */
if (cmd->inbuf) {
inlen = strlen(cmd->inbuf);
- infd = cmd->inpipe;
+ infd = *inpipe;
}
/* With out/err buffer, the outfd/errfd have been filled with an
@@ -1807,12 +1805,9 @@ virCommandProcessIO(virCommandPtr cmd)
}
} else {
inoff += done;
- if (inoff == inlen) {
- int tmpfd ATTRIBUTE_UNUSED;
- tmpfd = infd;
- if (VIR_CLOSE(infd) < 0)
- VIR_DEBUG("ignoring failed close on fd %d", tmpfd);
- }
+ if (inoff == inlen && VIR_CLOSE(*inpipe) < 0)
+ VIR_DEBUG("ignoring failed close on fd %d", infd);
+ infd = -1;
}
}
}
@@ -1938,7 +1933,6 @@ virCommandRun(virCommandPtr cmd, int *exitstatus)
return -1;
}
cmd->infd = infd[0];
- cmd->inpipe = infd[1];
}
/* If caller requested the same string for stdout and stderr, then
@@ -1981,7 +1975,7 @@ virCommandRun(virCommandPtr cmd, int *exitstatus)
}
if (string_io)
- ret = virCommandProcessIO(cmd);
+ ret = virCommandProcessIO(cmd, &infd[1]);
if (virCommandWait(cmd, exitstatus) < 0)
ret = -1;
--
1.7.7.6
12 years, 6 months
[libvirt] error: this function is not supported by the connection driver : virConnectNumOfStoragePool
by Onkar
Hello,
I configured libvirt like this
./configure --prefix=/ --exec-prefix=/usr/ --libdir=/usr/lib64/
--with-storage-dir --with-storage-dir --with-storage-dir
--with-storage-dir --with-storage-dir --with-storage-dir
--with-storage-dir --with-storage-dir --with-qemu --with-libvirtd
--with-selinux --with-network --with-libblkid
and then,
make -j4
make install
and then
# virsh list --all
Id Name State
----------------------------------------------------
- vm1 shut off
# virsh pool-list --all
error: Failed to list active pools
error: this function is not supported by the connection driver:
virConnectNumOfStoragePools
getting this error , any clues on why is this error ?
Regards,
Onkar
12 years, 6 months