[libvirt] [PATCH 00/18] Make bash completion great again
by Michal Privoznik
Technically, this is a v2 of [1], but this implements the feature from
different angle and therefore it's a start of new series.
What's implemented?
===================
Auto completion for both interactive and non-interactive
virsh/virt-admin.
Known limitations
=================
Currently, just options completers work. I mean, to bring up list
of domains you have to:
virsh # start --domain <TAB><TAB>
Doing bare:
virsh # start <TAB><TAB>
brings up list of --options. With the new approach implemented
here it should be easy to implement this. But that can be saved
for later.
How to test this?
=================
Interactive completion should work out of the box. Just make sure
you're connected. Completers don't connect! You certainly don't
want ssh's 'Password:' prompt show on <TAB><TAB>, do you?
Non-interactive completers do connect, but in order to avoid any
password prompts, /dev/stdin is closed before anything else is
done. In order to test it, just:
libvirt.git $ source tools/bash-completion/vsh
Now, bash completion should work:
libvirt.git $ ./tools/virsh -c qemu:///system start --domain <TAB><TAB>
Notes
=====
As usual, you can find all the patches on my github [2]. I've
tried to work in all the review suggestions from v1. Due to
changes in design (reusing parse code instead of duplicating it)
not all suggestions were possible to work in though.
Michal
1: https://www.redhat.com/archives/libvir-list/2017-November/msg00213.html
2: https://github.com/zippy2/libvirt/tree/bash_autocomplete_v3 (yeah v3, don't ask)
Michal Privoznik (18):
vsh: Drop useless check for opts != NULL
vsh: Drop useless check for cmd != NULL
vshCommandParse: Don't leak @tkdata
vshCommandStringParse: Allow retrieving partial result
vshReadlineParse: Drop code duplication
vshReadlineParse: Escape returned results if needed
vshReadlineParse: Use string list
vshCommandOpt: Allow caller avoiding assert()
util: Introduce virStringListMerge
vsh: Fix vshCompleter signature
vsh: Call vshCmdOptDef completer
vsh: Prune string list returned by completer
vsh: Filter --options
vsh: Introduce complete command
tools: Provide bash autompletion file
virsh: Introduce virshDomainNameCompleter
virsh: Introduce virshDomainInterfaceCompleter
virt-admin: Introduce vshAdmServerCompleter
configure.ac | 3 +
libvirt.spec.in | 3 +
m4/virt-bash-completion.m4 | 74 +++++
src/libvirt_private.syms | 1 +
src/util/virstring.c | 36 +++
src/util/virstring.h | 3 +
tools/Makefile.am | 40 ++-
tools/bash-completion/vsh | 67 +++++
tools/virsh-completer.c | 150 ++++++++++
tools/virsh-completer.h | 41 +++
tools/virsh-domain-monitor.c | 33 ++-
tools/virsh-domain.c | 186 ++++++------
tools/virsh-snapshot.c | 24 +-
tools/virsh.c | 5 +-
tools/virsh.h | 7 +-
tools/virt-admin-completer.c | 76 +++++
tools/virt-admin-completer.h | 33 +++
tools/virt-admin.c | 13 +-
tools/vsh.c | 663 ++++++++++++++++++++++++++-----------------
tools/vsh.h | 23 +-
20 files changed, 1097 insertions(+), 384 deletions(-)
create mode 100644 m4/virt-bash-completion.m4
create mode 100644 tools/bash-completion/vsh
create mode 100644 tools/virsh-completer.c
create mode 100644 tools/virsh-completer.h
create mode 100644 tools/virt-admin-completer.c
create mode 100644 tools/virt-admin-completer.h
--
2.13.6
7 years, 2 months
[libvirt] [PATCH v2 0/2] processor frequency information on S390
by Bjoern Walk
Since kernel version 4.7, processor frequency information is available
on S390. This patch series extends the parser for system information.
Let's also add a testcase to the test suite for a S390 CPU configuration
running kernel version 4.14 on LPAR.
This is basically patch 3 of this series:
https://www.redhat.com/archives/libvir-list/2017-December/msg00633.html
v1 -> v2:
- add debug logging
- don't discard the whole hostsysinfo when the parsing fails
- don't try to parse a value for external_clock, that information is
not available on S390
- add test case for to sysinfotest.c
Bjoern Walk (2):
util: virsysinfo: parse frequency information on S390
tests: sysinfotest: add new test case for S390
src/util/virsysinfo.c | 41 ++++++-
tests/sysinfodata/s390-freqcpuinfo.data | 52 +++++++++
tests/sysinfodata/s390-freqsysinfo.data | 173 ++++++++++++++++++++++++++++++
tests/sysinfodata/s390-freqsysinfo.expect | 63 +++++++++++
tests/sysinfotest.c | 1 +
5 files changed, 325 insertions(+), 5 deletions(-)
create mode 100644 tests/sysinfodata/s390-freqcpuinfo.data
create mode 100644 tests/sysinfodata/s390-freqsysinfo.data
create mode 100644 tests/sysinfodata/s390-freqsysinfo.expect
--
2.13.4
7 years, 2 months
[libvirt] [jenkins-ci PATCH] guests: Make rpcgen mapping more future-proof
by Andrea Bolognani
Since whatever is in Fedora Rawhide will end up in future Fedora
releases, it makes sense to use the newer package as default and
override it for existing releases (as well as CentOS), so that
no tweaking will be needed when Fedora 28 and later are added to
the CI setup.
Suggested-by: Peter Krempa <pkrempa(a)redhat.com>
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/vars/mappings.yml | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml
index b79757e..0b32f90 100644
--- a/guests/vars/mappings.yml
+++ b/guests/vars/mappings.yml
@@ -606,8 +606,10 @@ mappings:
rpcgen:
deb: libc-dev-bin
- rpm: glibc-common
- FedoraRawhide: glibc-rpcgen
+ rpm: glibc-rpcgen
+ CentOS: glibc-common
+ Fedora26: glibc-common
+ Fedora27: glibc-common
FreeBSD:
rpmbuild:
--
2.14.3
7 years, 2 months
[libvirt] [PATCH 0/2] travis: Fix build failure
by Andrea Bolognani
It would be nice to have all greens before the release :)
Andrea Bolognani (2):
travis: Sync packages with libvirt-jenkins-ci
travis: Skip nfs-common installation
.travis.yml | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
--
2.14.3
7 years, 2 months
[libvirt] [PATCH V4] blockjob: Fix error checking of blockjob status
by Jie Wang
offset and len can also be equal to 0 on failed if blockjob return
status:"BLOCK_JOB_COMPLETED" with error:"File descriptor in bad state",
so we need to check 'error' in this case.
---
src/qemu/qemu_monitor_json.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index e45868b..39c0909 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -886,7 +886,7 @@ qemuMonitorJSONHandleBlockJobImpl(qemuMonitorPtr mon,
case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
error = virJSONValueObjectGetString(data, "error");
/* Make sure the whole device has been processed */
- if (offset != len)
+ if (offset != len || error)
event = VIR_DOMAIN_BLOCK_JOB_FAILED;
break;
case VIR_DOMAIN_BLOCK_JOB_CANCELED:
--
1.8.3.1
7 years, 2 months
[libvirt] [jenkins-ci PATCH] guests: Install rpcgen when building libvirt
by Andrea Bolognani
The dependency on rpcgen had not been made explicit up until now
because the command was part of the base glibc development packages;
however, Fedora Rawhide now ships it in a separate package, so we
need to list it along with all other dependencies in order for it
to get installed.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/vars/mappings.yml | 6 ++++++
guests/vars/projects/libvirt.yml | 1 +
2 files changed, 7 insertions(+)
diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml
index eca8dbe..b79757e 100644
--- a/guests/vars/mappings.yml
+++ b/guests/vars/mappings.yml
@@ -604,6 +604,12 @@ mappings:
pkg: readline
rpm: readline-devel
+ rpcgen:
+ deb: libc-dev-bin
+ rpm: glibc-common
+ FedoraRawhide: glibc-rpcgen
+ FreeBSD:
+
rpmbuild:
rpm: rpm-build
diff --git a/guests/vars/projects/libvirt.yml b/guests/vars/projects/libvirt.yml
index 407881d..ba1e4c3 100644
--- a/guests/vars/projects/libvirt.yml
+++ b/guests/vars/projects/libvirt.yml
@@ -67,6 +67,7 @@ packages:
- qemu-img
- radvd
- readline
+ - rpcgen
- sanlock
- scrub
- sheepdog
--
2.14.3
7 years, 2 months
[libvirt] [PATCH] libvirtd: clarify the TLS conf default vaule setting
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)gmail.com>
As the description of daemon/libvirtd.conf, setting
key_file, cert_file or key_file will override the default value.
But if we set any one of them, we need to set all the rest of them.
This patch clarify that description.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
daemon/libvirtd.conf | 3 +++
1 file changed, 3 insertions(+)
diff --git a/daemon/libvirtd.conf b/daemon/libvirtd.conf
index 8e0c0d96d..7040ff26b 100644
--- a/daemon/libvirtd.conf
+++ b/daemon/libvirtd.conf
@@ -183,6 +183,9 @@
#
+# NB, if the default value of 'key_file', 'cert_file" or
+# 'ca_file' would be changed,
+# all of them should be changed together.
# Override the default server key file path
#
#key_file = "/etc/pki/libvirt/private/serverkey.pem"
--
2.14.3
7 years, 2 months
[libvirt] [PATCH] m4: Don't enable bash-completion by default
by Michal Privoznik
Due to the way that check logic was written we basically enabled
bash completion whenever readline was enabled. This is not right
because it made bash-completion pkg-config module required.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Even though this would qualify as a build breaker, I'd rather have
another pair of eyes to look at it (sorry Cyclops).
m4/virt-bash-completion.m4 | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/m4/virt-bash-completion.m4 b/m4/virt-bash-completion.m4
index e1ef58740..c8342176f 100644
--- a/m4/virt-bash-completion.m4
+++ b/m4/virt-bash-completion.m4
@@ -30,14 +30,10 @@ AC_DEFUN([LIBVIRT_CHECK_BASH_COMPLETION], [
AC_REQUIRE([LIBVIRT_CHECK_READLINE])
if test "x$with_readline" != "xyes" ; then
- if test "x$with_bash_completion" != "xyes" ; then
- with_bash_completion=no
- else
+ if test "x$with_bash_completion" = "xyes" ; then
AC_MSG_ERROR([readline is required for bash completion support])
- fi
- else
- if test "x$with_bash_completion" = "xcheck" ; then
- with_bash_completion=yes
+ else
+ with_bash_completion=no
fi
fi
--
2.13.6
7 years, 2 months
[libvirt] [PATCH] qemu: Fix type of a completed job
by Jiri Denemark
Libvirt 3.7.0 and earlier libvirt reported a migration job as completed
immediately after QEMU finished sending migration data at which point
migration was not really complete yet. Commit v3.7.0-29-g3f2d6d829e
fixed this, but caused a regression in reporting statistics for
completed jobs which started reporting the job as still running. This
happened because the completed job statistics including the job status
are copied from the running job before we finally mark it as completed.
Let's make sure QEMU_DOMAIN_JOB_STATUS_COMPLETED is always set in the
completed job info even when the job has not finished yet.
https://bugzilla.redhat.com/show_bug.cgi?id=1523036
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_migration.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index c1ceb164d1..a56bc596ff 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1646,8 +1646,10 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver,
qemuDomainJobInfoUpdateTime(jobInfo);
qemuDomainJobInfoUpdateDowntime(jobInfo);
VIR_FREE(priv->job.completed);
- if (VIR_ALLOC(priv->job.completed) == 0)
+ if (VIR_ALLOC(priv->job.completed) == 0) {
*priv->job.completed = *jobInfo;
+ priv->job.completed->status = QEMU_DOMAIN_JOB_STATUS_COMPLETED;
+ }
if (asyncJob != QEMU_ASYNC_JOB_MIGRATION_OUT &&
jobInfo->status == QEMU_DOMAIN_JOB_STATUS_QEMU_COMPLETED)
@@ -5479,8 +5481,9 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
}
if (dom) {
- priv->job.completed = jobInfo;
- jobInfo = NULL;
+ VIR_STEAL_PTR(priv->job.completed, jobInfo);
+ priv->job.completed->status = QEMU_DOMAIN_JOB_STATUS_COMPLETED;
+
if (qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutlen,
QEMU_MIGRATION_COOKIE_STATS) < 0)
VIR_WARN("Unable to encode migration cookie");
--
2.15.1
7 years, 2 months