[libvirt] [PATCH v2 0/2] test: Implement virConnectListAllNodeDevices
by Cole Robinson
v1: https://www.redhat.com/archives/libvir-list/2018-February/msg01135.html
virnodedeviceobj.c generic ListAll infrastructure is not stateless
and will try to refresh nodedev scsi/pci/etc. config. Understandable
this doesn't play well with the test driver. Trying to untangle it
is a bit tough though.
This series adds a way to skip touching the host so we can implement
ListAllDevices in the test driver, which we want for virt-manager and
libvirt-dbus test suites
Cole Robinson (2):
conf: nodedev: Don't refresh host caps in testdriver
test: Implement virConnectListAllNodeDevices
src/conf/virnodedeviceobj.c | 13 ++++++++++++-
src/conf/virnodedeviceobj.h | 4 ++++
src/test/test_driver.c | 15 +++++++++++++++
3 files changed, 31 insertions(+), 1 deletion(-)
--
2.17.1
6 years, 4 months
[libvirt] [jenkins-ci PATCH] guests: List all known guests in inventory
by Andrea Bolognani
Users will probably want to only work with a subset of
guests but, like any other customization, that should be
handled with local tweaks.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/inventory | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/guests/inventory b/guests/inventory
index 6ea43d9..9838d7c 100644
--- a/guests/inventory
+++ b/guests/inventory
@@ -1,8 +1,12 @@
libvirt-centos-7
libvirt-debian-8
libvirt-debian-9
+libvirt-debian-sid
libvirt-fedora-27
libvirt-fedora-28
libvirt-fedora-rawhide
libvirt-freebsd-10
libvirt-freebsd-11
+libvirt-freebsd-current
+libvirt-ubuntu-16
+libvirt-ubuntu-18
--
2.17.1
6 years, 4 months
[libvirt] [PATCH] docs: schema: Add missing <alias> to vsock device
by Han Han
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1600345
Signed-off-by: Han Han <hhan(a)redhat.com>
---
docs/schemas/domaincommon.rng | 3 +++
1 file changed, 3 insertions(+)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index bd687ce9d3..f24a56392a 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4234,6 +4234,9 @@
<optional>
<ref name="address"/>
</optional>
+ <optional>
+ <ref name="alias"/>
+ </optional>
</interleave>
</element>
</define>
--
2.17.1
6 years, 4 months
[libvirt] [PATCH] virsh.pod: Fix typo of nwfilter-binding-undefine
by Han Han
Rename nwfilter-binding-undefine to nwfilter-binding-delete.
Signed-off-by: Han Han <hhan(a)redhat.com>
---
tools/virsh.pod | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 4c6e21fc22..771e99591e 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -4828,7 +4828,7 @@ of the network filters directly.
Associate a network port with a network filter. The network filter backend
will immediately attempt to instantiate the filter rules on the port.
-=item B<nwfilter-binding-undefine> I<port-name>
+=item B<nwfilter-binding-delete> I<port-name>
Disassociate a network port from a network filter. The network filter
backend will immediately tear down the filter rules that exist on the
--
2.17.1
6 years, 4 months
[libvirt] [PATCH v3 00/35] use GNU C's cleanup attribute in src/util (batch I)
by Sukrit Bhatnagar
This series of patches first introduces a new set of macros which help
in using GNU C's __attribute__((cleanup)) in the code.
Then a few syntax-check rules are added which help in ensuring correct
usage of the newly introduced cleanup macros.
Then the patches modify a few files in src/util to use VIR_AUTOFREE
and VIR_AUTOPTR for automatic freeing of memory and get rid of some
VIR_FREE macro invocations and *Free function calls.
Sukrit Bhatnagar (35):
util: alloc: add macros for implementing automatic cleanup
functionality
cfg.mk: variable initialization when declared with cleanup macro
cfg.mk: correct spacing between type and asterisk in VIR_AUTOFREE
cfg.mk: single variable declaration per line when using cleanup macro
cfg.mk: no trailing semicolon at line invoking VIR_DEFINE_* cleanup
macro
util: string: introduce typedef for string
util: string: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
util: command: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
util: command: remove redundant include directive
util: command: use VIR_AUTOFREE instead of VIR_FREE for scalar types
util: command: use VIR_AUTOPTR for aggregate types
util: file: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
util: file: remove redundant include directive
util: file: use VIR_AUTOFREE instead of VIR_FREE for scalar types
util: file: use VIR_AUTOPTR for aggregate types
util: authconfig: define cleanup function using
VIR_DEFINE_AUTOPTR_FUNC
util: authconfig: remove redundant include directive
util: authconfig: use VIR_AUTOFREE instead of VIR_FREE for scalar
types
util: auth: remove redundant include directive
util: auth: use VIR_AUTOFREE instead of VIR_FREE for scalar types
util: auth: use VIR_AUTOPTR for aggregate types
util: json: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
util: json: remove redundant include directive
util: json: use VIR_AUTOFREE instead of VIR_FREE for scalar types
util: json: use VIR_AUTOPTR for aggregate types
util: bitmap: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
util: bitmap: remove redundant include directive
util: bitmap: use VIR_AUTOPTR for aggregate types
util: iohelper: use VIR_AUTOFREE instead of VIR_FREE for scalar types
util: arptable: use VIR_AUTOFREE instead of VIR_FREE for scalar types
util: audit: use VIR_AUTOFREE instead of VIR_FREE for scalar types
util: fcp: use VIR_AUTOFREE instead of VIR_FREE for scalar types
util: eventpoll: use VIR_AUTOFREE instead of VIR_FREE for scalar types
util: filecache: use VIR_AUTOFREE instead of VIR_FREE for scalar types
util: identity: use VIR_AUTOFREE instead of VIR_FREE for scalar types
cfg.mk | 37 ++++++
src/util/iohelper.c | 4 +-
src/util/viralloc.h | 44 +++++++
src/util/virarptable.c | 14 +-
src/util/viraudit.c | 3 +-
src/util/virauth.c | 61 +++------
src/util/virauthconfig.c | 35 ++---
src/util/virauthconfig.h | 3 +
src/util/virbitmap.c | 8 +-
src/util/virbitmap.h | 3 +
src/util/vircommand.c | 47 ++-----
src/util/vircommand.h | 2 +
src/util/vireventpoll.c | 7 +-
src/util/virfcp.c | 20 +--
src/util/virfile.c | 327 ++++++++++++++++-------------------------------
src/util/virfile.h | 3 +
src/util/virfilecache.c | 35 ++---
src/util/viridentity.c | 52 ++++----
src/util/virjson.c | 68 +++-------
src/util/virjson.h | 3 +
src/util/virstring.h | 5 +
21 files changed, 319 insertions(+), 462 deletions(-)
--
1.8.3.1
6 years, 4 months
[libvirt] [PATCH] qemu: Fix ATTRIBUTE_NONNULL for qemuMonitorAddObject
by John Ferlan
Commit id fac0dacd was trying to make things more robust;
however, the ATTRIBUTE_NONNULL(1) would be for the @mon,
not the intended (2) and the @props argument as described
in the commit message.
Found by Coverity build.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Pushed as trivial and Coverity build breaker.
src/qemu/qemu_monitor.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index e8ed2d044c..81474a04f6 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -824,7 +824,7 @@ int qemuMonitorCreateObjectProps(virJSONValuePtr *propsret,
int qemuMonitorAddObject(qemuMonitorPtr mon,
virJSONValuePtr *props,
char **alias)
- ATTRIBUTE_NONNULL(1);
+ ATTRIBUTE_NONNULL(2);
int qemuMonitorDelObject(qemuMonitorPtr mon,
const char *objalias);
--
2.17.1
6 years, 4 months
[libvirt] [PATCH v2] New virsh feature: domif-setlink --domain --interface --state completer
by Simon Kobyda
After you go through command mentioned above, completer
finds what state the device is currently in, and suggests
an opposite state.
Signed-off-by: Simon Kobyda <skobyda(a)redhat.com>
---
Changes in V2:
- Added "Signed-off-by"
- Changed format of commit message to make it more
readable
tools/virsh-completer.c | 73 ++++++++++++++++++++++++++++++++++++++++-
tools/virsh-completer.h | 4 +++
tools/virsh-domain.c | 1 +
3 files changed, 77 insertions(+), 1 deletion(-)
diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c
index 2327e08340..e32fd82211 100644
--- a/tools/virsh-completer.c
+++ b/tools/virsh-completer.c
@@ -32,6 +32,7 @@
#include "internal.h"
#include "virutil.h"
#include "viralloc.h"
+#include "virmacaddr.h"
#include "virstring.h"
#include "virxml.h"
@@ -750,7 +751,6 @@ virshDomainEventNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED,
return NULL;
}
-
char **
virshPoolEventNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED,
const vshCmd *cmd ATTRIBUTE_UNUSED,
@@ -776,6 +776,77 @@ virshPoolEventNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED,
return NULL;
}
+char **
+virshDomainInterfaceStateCompleter(vshControl *ctl ATTRIBUTE_UNUSED,
+ const vshCmd *cmd ATTRIBUTE_UNUSED,
+ unsigned int flags)
+{
+ virshControlPtr priv = ctl->privData;
+ const char *iface = NULL;
+ char **ret = NULL;
+ xmlDocPtr xml = NULL;
+ virMacAddr macaddr;
+ char *state = NULL;
+ char *xpath = NULL;
+ char macstr[18] = "";
+ xmlXPathContextPtr ctxt = NULL;
+ xmlNodePtr *interfaces = NULL;
+ int ninterfaces;
+
+ virCheckFlags(0, NULL);
+
+ if (!priv->conn || virConnectIsAlive(priv->conn) <= 0)
+ return NULL;
+
+ if (vshCommandOptStringReq(ctl, cmd, "interface", &iface) < 0)
+ goto cleanup;
+
+ if (virshDomainGetXML(ctl, cmd, flags, &xml, &ctxt) < 0)
+ goto cleanup;
+
+ /* normalize the mac addr */
+ if (virMacAddrParse(iface, &macaddr) == 0)
+ virMacAddrFormat(&macaddr, macstr);
+
+ if (virAsprintf(&xpath, "/domain/devices/interface[(mac/@address = '%s') or "
+ " (target/@dev = '%s')]",
+ macstr, iface) < 0)
+ goto cleanup;
+
+ if ((ninterfaces = virXPathNodeSet(xpath, ctxt, &interfaces)) < 0)
+ goto cleanup;
+
+ if (ninterfaces != 1)
+ goto cleanup;
+
+ ctxt->node = interfaces[0];
+
+ if (VIR_ALLOC_N(ret, 2) < 0)
+ goto error;
+
+ if ((state = virXPathString("string(./link/@state)", ctxt)) &&
+ STREQ(state, "down")) {
+ if (VIR_STRDUP(ret[0], "up") < 0)
+ goto error;
+ } else {
+ if (VIR_STRDUP(ret[0], "down") < 0)
+ goto error;
+ }
+
+ cleanup:
+ VIR_FREE(state);
+ VIR_FREE(interfaces);
+ VIR_FREE(xpath);
+ xmlXPathFreeContext(ctxt);
+ xmlFreeDoc(xml);
+ return ret;
+
+ error:
+ virStringListFree(ret);
+ ret = NULL;
+ goto cleanup;
+}
+
char **
virshNodedevEventNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED,
diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h
index 1c14bb2a54..b4fd2a86c6 100644
--- a/tools/virsh-completer.h
+++ b/tools/virsh-completer.h
@@ -94,6 +94,10 @@ char ** virshPoolEventNameCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);
+char ** virshDomainInterfaceStateCompleter(vshControl *ctl,
+ const vshCmd *cmd,
+ unsigned int flags);
+
char ** virshNodedevEventNameCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 3959b5475b..8adec1d9b1 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -3064,6 +3064,7 @@ static const vshCmdOptDef opts_domif_setlink[] = {
{.name = "state",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
+ .completer = virshDomainInterfaceStateCompleter,
.help = N_("new state of the device")
},
{.name = "persistent",
--
2.17.1
6 years, 4 months
[libvirt] [PATCH 0/8] qemu: Sanitize monitor code to create snapshots
by Peter Krempa
Require that the 'transaction' command is present for external snapshots
to work and remove the various hacks which were present to make it work
without that.
Peter Krempa (8):
qemu: snapshot: Require support of 'transaction' command for external
snapshots
qemu: snapshot: Remove monitor code now that 'transaction' is always
used
qemu: snapshot: Unify conditions checking whether snapshot needs to be
taken
qemu: snapshot: Audit actual disk snapshot creation
qemu: monitor: Add API to help creating 'transaction' arguments
qemu: block: Create helper for creating data for legacy snapshots
qemu: monitor: Remove old external snapshot code
qemu: monitor: Remove old code for dual handling of 'transaction' data
src/qemu/qemu_block.c | 37 +++++++++++++
src/qemu/qemu_block.h | 6 ++
src/qemu/qemu_driver.c | 128 ++++++++++++-------------------------------
src/qemu/qemu_monitor.c | 17 ------
src/qemu/qemu_monitor.h | 6 --
src/qemu/qemu_monitor_json.c | 125 +++++++++++++++++++-----------------------
src/qemu/qemu_monitor_json.h | 12 ++--
7 files changed, 138 insertions(+), 193 deletions(-)
--
2.16.2
6 years, 4 months
[libvirt] [PATCH v2] completer: Doesn't alloc enough space for null terminated array of strings
by Simon Kobyda
Functions virshSecretEventNameCompleter, virshPoolEventNameCompleter,
virshNodedevEventNameCompleter allocates only enough space
for array of N strings.
However these are null terminated strings, so program needs to
alloc space for array of N+1 strings.
How to replicate error: valgrind virsh, use completer for
'-nodedev-event --event' or '-pool-event --event' or
'-secret-event --event'.
Signed-off-by: Simon Kobyda <skobyda(a)redhat.com>
---
Changes in V2:
- Added "Signed-off-by"
- Changed format of commit message to make it more
readable
tools/virsh-completer.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c
index 2327e08340..be59ea2e82 100644
--- a/tools/virsh-completer.c
+++ b/tools/virsh-completer.c
@@ -709,7 +709,7 @@ virshSecretEventNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED,
virCheckFlags(0, NULL);
- if (VIR_ALLOC_N(ret, VIR_SECRET_EVENT_ID_LAST) < 0)
+ if (VIR_ALLOC_N(ret, VIR_SECRET_EVENT_ID_LAST + 1) < 0)
goto error;
for (i = 0; i < VIR_SECRET_EVENT_ID_LAST; i++) {
@@ -761,7 +761,7 @@ virshPoolEventNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED,
virCheckFlags(0, NULL);
- if (VIR_ALLOC_N(ret, VIR_STORAGE_POOL_EVENT_ID_LAST) < 0)
+ if (VIR_ALLOC_N(ret, VIR_STORAGE_POOL_EVENT_ID_LAST + 1) < 0)
goto error;
for (i = 0; i < VIR_STORAGE_POOL_EVENT_ID_LAST; i++) {
@@ -787,7 +787,7 @@ virshNodedevEventNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED,
virCheckFlags(0, NULL);
- if (VIR_ALLOC_N(ret, VIR_NODE_DEVICE_EVENT_ID_LAST) < 0)
+ if (VIR_ALLOC_N(ret, VIR_NODE_DEVICE_EVENT_ID_LAST + 1) < 0)
goto error;
for (i = 0; i < VIR_NODE_DEVICE_EVENT_ID_LAST; i++) {
--
2.17.1
6 years, 4 months
[libvirt] [PATCH] completer: Doesn't alloc enough space for null terminated array of strings
by Simon Kobyda
Functions virshSecretEventNameCompleter, virshPoolEventNameCompleter, virshNodedevEventNameCompleter allocates only enough space for array of N strings.
However these are null terminated strings, so program needs to alloc space for array of N+1 strings.
How to replicate error: valgrind virsh, use completer for '-nodedev-event --event' or '-pool-event --event' or '-secret-event --event'.
---
tools/virsh-completer.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c
index 2327e08340..be59ea2e82 100644
--- a/tools/virsh-completer.c
+++ b/tools/virsh-completer.c
@@ -709,7 +709,7 @@ virshSecretEventNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED,
virCheckFlags(0, NULL);
- if (VIR_ALLOC_N(ret, VIR_SECRET_EVENT_ID_LAST) < 0)
+ if (VIR_ALLOC_N(ret, VIR_SECRET_EVENT_ID_LAST + 1) < 0)
goto error;
for (i = 0; i < VIR_SECRET_EVENT_ID_LAST; i++) {
@@ -761,7 +761,7 @@ virshPoolEventNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED,
virCheckFlags(0, NULL);
- if (VIR_ALLOC_N(ret, VIR_STORAGE_POOL_EVENT_ID_LAST) < 0)
+ if (VIR_ALLOC_N(ret, VIR_STORAGE_POOL_EVENT_ID_LAST + 1) < 0)
goto error;
for (i = 0; i < VIR_STORAGE_POOL_EVENT_ID_LAST; i++) {
@@ -787,7 +787,7 @@ virshNodedevEventNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED,
virCheckFlags(0, NULL);
- if (VIR_ALLOC_N(ret, VIR_NODE_DEVICE_EVENT_ID_LAST) < 0)
+ if (VIR_ALLOC_N(ret, VIR_NODE_DEVICE_EVENT_ID_LAST + 1) < 0)
goto error;
for (i = 0; i < VIR_NODE_DEVICE_EVENT_ID_LAST; i++) {
--
2.17.1
6 years, 4 months