[libvirt] [jenkins-ci PATCH] guests: Install libtirpc when building libvirt
by Andrea Bolognani
Recent glibc versions don't include an RPC library anymore, so
we need to make sure an alternative implementation is available
for libvirt to use.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/vars/mappings.yml | 4 ++++
guests/vars/projects/libvirt.yml | 1 +
2 files changed, 5 insertions(+)
diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml
index 9c194d0..e669b6c 100644
--- a/guests/vars/mappings.yml
+++ b/guests/vars/mappings.yml
@@ -279,6 +279,10 @@ mappings:
pkg: libssh2
rpm: libssh2-devel
+ libtirpc:
+ deb: libtirpc-dev
+ rpm: libtirpc-devel
+
libtool:
default: libtool
Debian: libtool-bin
diff --git a/guests/vars/projects/libvirt.yml b/guests/vars/projects/libvirt.yml
index ba1e4c3..598dfc4 100644
--- a/guests/vars/projects/libvirt.yml
+++ b/guests/vars/projects/libvirt.yml
@@ -32,6 +32,7 @@ packages:
- libselinux
- libssh
- libssh2
+ - libtirpc
- libudev
- libxml2
- lvm2
--
2.14.3
6 years, 10 months
[libvirt] [PATCH] vshReadlineOptionsPrune: Fix possible leak
by Michal Privoznik
The function should prune list of --options so that options
already specified are not offered to user for completion again.
However, if the list of offered options contains a string that
doesn't start with double dash the function returns leaking
partially constructed list. There's not much benefit from trying
to roll back. Just free everything up - our only caller would do
that anyway.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/vsh.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/tools/vsh.c b/tools/vsh.c
index 4426c08d6..7db0a16f1 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -2798,8 +2798,17 @@ vshReadlineOptionsPrune(char ***list,
vshCmdOpt *opt = last->opts;
/* Should never happen (TM) */
- if (!list_opt)
+ if (!list_opt) {
+ /* But in case it does, we're in a tough situation
+ * because @list[0..i-1] is possibly sparse. That
+ * means if caller were to call virStringListFree
+ * over it some memory is definitely going to be
+ * leaked. The best we can do is to free from list[i]
+ * as our only caller is just fine with it. */
+ virStringListFree(list[i]);
+ virStringListFree(newList);
return -1;
+ }
while (opt) {
if (STREQ(opt->def->name, list_opt)) {
--
2.13.6
6 years, 10 months
[libvirt] [PATCH] virsh: fix build without readline
by Roman Bogorodskiy
Completion in virsh is enabled when readline is available. However,
when it's not available, we should:
* avoid defining completers with completion functions;
* in cmdComplete(), mark unused arguments when there's no readline with
ATTRIBUTE_UNUSED.
---
tools/virsh-domain-monitor.c | 6 ++++++
tools/virsh-domain.c | 6 ++++++
tools/virsh.h | 11 ++++++++++-
tools/virt-admin.c | 14 ++++++++++++++
tools/vsh.c | 2 +-
5 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 32a42707e..0df20eea0 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -659,7 +659,9 @@ static const vshCmdOptDef opts_domif_getlink[] = {
{.name = "interface",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
+#if WITH_READLINE
.completer = virshDomainInterfaceCompleter,
+#endif
.help = N_("interface device (MAC Address)")
},
{.name = "persistent",
@@ -996,7 +998,9 @@ static const vshCmdOptDef opts_domifstat[] = {
{.name = "interface",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
+#ifdef WITH_READLINE
.completer = virshDomainInterfaceCompleter,
+#endif
.help = N_("interface device specified by name or MAC Address")
},
{.name = NULL}
@@ -2151,7 +2155,9 @@ static const vshCmdOptDef opts_domifaddr[] = {
{.name = "interface",
.type = VSH_OT_STRING,
.flags = VSH_OFLAG_NONE,
+#ifdef WITH_READLINE
.completer = virshDomainInterfaceCompleter,
+#endif
.help = N_("network interface name")},
{.name = "full",
.type = VSH_OT_BOOL,
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 0f329d6d7..c5511adbf 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -2977,7 +2977,9 @@ static const vshCmdOptDef opts_domif_setlink[] = {
{.name = "interface",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
+#ifdef WITH_READLINE
.completer = virshDomainInterfaceCompleter,
+#endif
.help = N_("interface device (MAC Address)")
},
{.name = "state",
@@ -3148,7 +3150,9 @@ static const vshCmdOptDef opts_domiftune[] = {
{.name = "interface",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
+#ifdef WITH_READLINE
.completer = virshDomainInterfaceCompleter,
+#endif
.help = N_("interface device (MAC Address)")
},
{.name = "inbound",
@@ -11985,8 +11989,10 @@ static const vshCmdOptDef opts_detach_interface[] = {
},
{.name = "mac",
.type = VSH_OT_STRING,
+#ifdef WITH_READLINE
.completer = virshDomainInterfaceCompleter,
.completer_flags = VIRSH_DOMAIN_INTERFACE_COMPLETER_MAC,
+#endif
.help = N_("MAC address")
},
VIRSH_COMMON_OPT_DOMAIN_PERSISTENT,
diff --git a/tools/virsh.h b/tools/virsh.h
index 528e04558..b3cb15ac4 100644
--- a/tools/virsh.h
+++ b/tools/virsh.h
@@ -71,7 +71,8 @@
.help = _helpstr \
}
-# define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \
+# ifdef WITH_READLINE
+# define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \
{.name = "domain", \
.type = VSH_OT_DATA, \
.flags = VSH_OFLAG_REQ, \
@@ -79,6 +80,14 @@
.completer = virshDomainNameCompleter, \
.completer_flags = cflags, \
}
+# else
+# define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \
+ {.name = "domain", \
+ .type = VSH_OT_DATA, \
+ .flags = VSH_OFLAG_REQ, \
+ .help = _helpstr, \
+ }
+# endif
# define VIRSH_COMMON_OPT_CONFIG(_helpstr) \
{.name = "config", \
diff --git a/tools/virt-admin.c b/tools/virt-admin.c
index c86b5763a..ac4d00dd7 100644
--- a/tools/virt-admin.c
+++ b/tools/virt-admin.c
@@ -429,7 +429,9 @@ static const vshCmdOptDef opts_srv_threadpool_info[] = {
{.name = "server",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
+#ifdef WITH_READLINE
.completer = vshAdmServerCompleter,
+#endif
.help = N_("Server to retrieve threadpool attributes from."),
},
{.name = NULL}
@@ -491,7 +493,9 @@ static const vshCmdOptDef opts_srv_threadpool_set[] = {
{.name = "server",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
+#ifdef WITH_READLINE
.completer = vshAdmServerCompleter,
+#endif
.help = N_("Server to alter threadpool attributes on."),
},
{.name = "min-workers",
@@ -598,7 +602,9 @@ static const vshCmdOptDef opts_srv_clients_list[] = {
{.name = "server",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
+#ifdef WITH_READLINE
.completer = vshAdmServerCompleter,
+#endif
.help = N_("server which to list connected clients from"),
},
{.name = NULL}
@@ -680,7 +686,9 @@ static const vshCmdOptDef opts_client_info[] = {
{.name = "server",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
+#ifdef WITH_READLINE
.completer = vshAdmServerCompleter,
+#endif
.help = N_("server to which <client> is connected to"),
},
{.name = "client",
@@ -768,7 +776,9 @@ static const vshCmdOptDef opts_client_disconnect[] = {
{.name = "server",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
+#ifdef WITH_READLINE
.completer = vshAdmServerCompleter,
+#endif
.help = N_("server which the client is currently connected to"),
},
{.name = "client",
@@ -834,7 +844,9 @@ static const vshCmdOptDef opts_srv_clients_info[] = {
{.name = "server",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
+#ifdef WITH_READLINE
.completer = vshAdmServerCompleter,
+#endif
.help = N_("Server to retrieve the client limits from."),
},
{.name = NULL}
@@ -894,7 +906,9 @@ static const vshCmdOptDef opts_srv_clients_set[] = {
{.name = "server",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
+#ifdef WITH_READLINE
.completer = vshAdmServerCompleter,
+#endif
.help = N_("Server to alter the client-related configuration limits on."),
},
{.name = "max-clients",
diff --git a/tools/vsh.c b/tools/vsh.c
index 4426c08d6..59c8a440e 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -3500,7 +3500,7 @@ const vshCmdInfo info_complete[] = {
};
bool
-cmdComplete(vshControl *ctl, const vshCmd *cmd)
+cmdComplete(vshControl *ctl ATTRIBUTE_UNUSED, const vshCmd *cmd ATTRIBUTE_UNUSED)
{
bool ret = false;
#ifdef WITH_READLINE
--
2.15.1
6 years, 10 months
[libvirt] [resend][PATCH] deamon: use default value if ca_file, cert_file or key_file not set
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 set default value to them as daemon/libvirtd.conf
described.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
daemon/libvirtd.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 6d3b83355..93983f63b 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -493,19 +493,28 @@ daemonSetupNetworking(virNetServerPtr srv,
config->cert_file ||
config->key_file) {
if (!config->ca_file) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("No CA certificate path set to match server key/cert"));
- goto cleanup;
+ VIR_WARN("Using default path for ca_file");
+ if (VIR_STRDUP(config->ca_file, LIBVIRT_CACERT) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("No CA certificate path set to match server key/cert"));
+ goto cleanup;
+ }
}
if (!config->cert_file) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("No server certificate path set to match server key"));
- goto cleanup;
+ VIR_WARN("Using default path for cert_file");
+ if (VIR_STRDUP(config->cert_file, LIBVIRT_SERVERCERT) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("No server certificate path set to match server key"));
+ goto cleanup;
+ }
}
if (!config->key_file) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("No server key path set to match server cert"));
- goto cleanup;
+ VIR_WARN("Using default path for key_file");
+ if (VIR_STRDUP(config->key_file, LIBVIRT_SERVERKEY) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("No server key path set to match server cert"));
+ goto cleanup;
+ }
}
VIR_DEBUG("Using CA='%s' cert='%s' key='%s'",
config->ca_file, config->cert_file, config->key_file);
--
2.14.3
6 years, 10 months
[libvirt] [PATCH v2] domain_conf: skip boot order check of CD-ROM or floppy device when change-media
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)gmail.com>
If we insert or eject a CD-ROM/floppy device by:
'virsh change-media VM --eject/--insert some.iso --live',
and the original CD-ROM device was configed with a boot order,
we may get:
unsupported configuration: boot order 2 is already used by another device
We just updated 'source file' section rather than hotplug a new device.
This check should be skipped in this case.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
v2:
commit message updated
remove ATTRIBUTE_UNUSED from @device
src/conf/domain_conf.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a1c25060f..e006cea0a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -26881,17 +26881,26 @@ virDomainDeviceIsUSB(virDomainDeviceDefPtr dev)
static int
virDomainDeviceInfoCheckBootIndex(virDomainDefPtr def ATTRIBUTE_UNUSED,
- virDomainDeviceDefPtr device ATTRIBUTE_UNUSED,
+ virDomainDeviceDefPtr device,
virDomainDeviceInfoPtr info,
void *opaque)
{
virDomainDeviceInfoPtr newinfo = opaque;
+ virDomainDiskDefPtr disk = device->data.disk;
+ int disk_device = disk->device;
if (info->bootIndex == newinfo->bootIndex) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("boot order %u is already used by another device"),
- newinfo->bootIndex);
- return -1;
+ /* Skip check for insert or eject CD-ROM device */
+ if (disk_device == VIR_DOMAIN_DISK_DEVICE_FLOPPY ||
+ disk_device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
+ VIR_DEBUG("Skip boot index check for floppy or CDROM");
+ return 0;
+ } else {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("boot order %u is already used by another device"),
+ newinfo->bootIndex);
+ return -1;
+ }
}
return 0;
}
--
2.14.3
6 years, 10 months
[libvirt] [PATCH v2 0/2] qemu_hotplug: introduce VIR_ERR_DEVICE_MISSING for failing to find the desired device
by Chen Hanxiao
We used VIR_ERR_OPERATION_INVALID for failing to find the desired
device.
But this error code is widely used.
This brings troubles to the project(i.e nova) powered by libvirt,
they had to analyze error messages to find out what
had happened.
Chen Hanxiao (2):
qemu_hotplug: more proper error messages when target detaching device
is not found
qemu_hotplug: introduce VIR_ERR_DEVICE_MISSING for failing to find
desired device
include/libvirt/virterror.h | 1 +
src/libvirt_private.syms | 2 ++
src/qemu/qemu_hotplug.c | 54 +++++++++++++++++++++++++++++----------------
src/util/virerror.c | 6 +++++
4 files changed, 44 insertions(+), 19 deletions(-)
--
2.14.3
6 years, 10 months
[libvirt] [PATCH python v2 0/9] Various improvements to RPM spec
by Daniel P. Berrange
Daniel P. Berrange (9):
Allow disabling of python2 RPM build
Allow override of which sub-RPMs to build
Add checks for min supported distros
Add emacs mode marker to activate rpm-spec highlighting
Adapt to rename of py2 RPMs from python- to python2- prefix
Turn on python3 sub-RPMs for RHEL > 7
Require libvirt native version matching py version by default
Fix filtering of RPM provides for .so files
Use python*_sitearch macros instead of manually defining the dir
libvirt-python.spec.in | 89 +++++++++++++++++++++++++++++++++++++++-----------
setup.py | 3 +-
2 files changed, 71 insertions(+), 21 deletions(-)
--
2.14.3
6 years, 10 months
[libvirt] [PATCH python 0/7] Misc improvements to RPM spec
by Daniel P. Berrange
Various improvements to the RPM spec to help future Fedora/RHEL maint
Daniel P. Berrange (7):
Allow disabling of python2 RPM build
Allow override of which sub-RPMs to build
Add checks for min supported distros
Add emacs mode marker to activate rpm-spec highlighting
Adapt to rename of py2 RPMs from python- to python2- prefix
Turn on python3 sub-RPMs for RHEL > 7
Require libvirt native version matching py version by default
libvirt-python.spec.in | 54 ++++++++++++++++++++++++++++++++++++++++++++++----
setup.py | 3 +--
2 files changed, 51 insertions(+), 6 deletions(-)
--
2.14.3
6 years, 10 months
[libvirt] [PATCH] fixed bug:if expand thread pool, will lose some one
by Di Wei
---
src/util/virthreadpool.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/util/virthreadpool.c b/src/util/virthreadpool.c
index 10f2bd2..0983ee2 100644
--- a/src/util/virthreadpool.c
+++ b/src/util/virthreadpool.c
@@ -186,6 +186,7 @@ virThreadPoolExpand(virThreadPoolPtr pool, size_t gain, bool priority)
size_t *curWorkers = priority ? &pool->nPrioWorkers : &pool->nWorkers;
size_t i = 0;
struct virThreadPoolWorkerData *data = NULL;
+ size_t oldNWorkers = *curWorkers;
if (VIR_EXPAND_N(*workers, *curWorkers, gain) < 0)
return -1;
@@ -198,7 +199,7 @@ virThreadPoolExpand(virThreadPoolPtr pool, size_t gain, bool priority)
data->cond = priority ? &pool->prioCond : &pool->cond;
data->priority = priority;
- if (virThreadCreateFull(&(*workers)[i],
+ if (virThreadCreateFull(&(*workers)[i + oldNWorkers],
false,
virThreadPoolWorker,
pool->jobFuncName,
--
2.9.3
6 years, 10 months
[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
6 years, 10 months