[libvirt] [PATCH v2 0/2] Add function for XML yes|no string handling
by Shotaro Gotanda
Changes since v1:
- remove NULL check of string in virStringParseYesNo
- remove error handling in virStringParseYesNo.
- remove temporary variable.
Shotaro Gotanda (2):
util: add virStringParseYesNo()
conf: Use virStringParseYesNo()
src/conf/domain_conf.c | 30 +++++-------------------------
src/conf/secret_conf.c | 12 ++----------
src/util/virstring.c | 23 +++++++++++++++++++++++
src/util/virstring.h | 3 +++
4 files changed, 33 insertions(+), 35 deletions(-)
--
2.19.1
5 years, 9 months
[libvirt] [PATCH] tests: Drop unnecessary variables
by Andrea Bolognani
In qemuxml2xmltest, both activeVcpus and blockjobs members
of the testInfo struct have been entirely unused ever since
commit d1a7fc8bb303.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
Pushed as trivial.
tests/qemuxml2xmltest.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index e08d30c676..3efa498114 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -30,9 +30,6 @@ struct testInfo {
char *outActiveName;
char *outInactiveName;
- virBitmapPtr activeVcpus;
- bool blockjobs;
-
virQEMUCapsPtr qemuCaps;
};
@@ -108,9 +105,6 @@ testInfoClear(struct testInfo *info)
VIR_FREE(info->outActiveName);
VIR_FREE(info->outInactiveName);
- virBitmapFree(info->activeVcpus);
- info->activeVcpus = NULL;
-
virObjectUnref(info->qemuCaps);
}
--
2.20.1
5 years, 9 months
[libvirt] [jenkins-ci PATCH 0/3] lcitool: tweaks to exception handling
by Daniel P. Berrangé
A few tweaks to exception handling identified in previous discussions
about the use of Exception.
Daniel P. Berrangé (3):
lcitool: remove Error class for exception handling
lcitool: push exception catching down into run method
lcitool: add support for --debug / -d argument
guests/lcitool | 72 +++++++++++++++++++++++++-------------------------
1 file changed, 36 insertions(+), 36 deletions(-)
--
2.20.1
5 years, 9 months
[libvirt] [PATCH] virsh: Make self-test failures noisy
by Eric Blake
In local testing, I accidentally introduced a self-test failure,
and spent way too much time debugging it. Make sure the testsuite
log includes some hint as to why command option validation failed.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
tools/vsh.c | 56 +++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 42 insertions(+), 14 deletions(-)
diff --git a/tools/vsh.c b/tools/vsh.c
index 2fd1564d15..1d30019c2c 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -331,21 +331,26 @@ vshCmddefGetInfo(const vshCmdDef * cmd, const char *name)
/* Check if the internal command definitions are correct */
static int
-vshCmddefCheckInternals(const vshCmdDef *cmd)
+vshCmddefCheckInternals(vshControl *ctl,
+ const vshCmdDef *cmd)
{
size_t i;
const char *help = NULL;
/* in order to perform the validation resolve the alias first */
if (cmd->flags & VSH_CMD_FLAG_ALIAS) {
- if (!cmd->alias)
+ if (!cmd->alias) {
+ vshError(ctl, _("command '%s' has inconsistent alias"), cmd->name);
return -1;
+ }
cmd = vshCmddefSearch(cmd->alias);
}
/* Each command has to provide a non-empty help string. */
- if (!(help = vshCmddefGetInfo(cmd, "help")) || !*help)
+ if (!(help = vshCmddefGetInfo(cmd, "help")) || !*help) {
+ vshError(ctl, _("command '%s' lacks help"), cmd->name);
return -1;
+ }
if (!cmd->opts)
return 0;
@@ -353,14 +358,19 @@ vshCmddefCheckInternals(const vshCmdDef *cmd)
for (i = 0; cmd->opts[i].name; i++) {
const vshCmdOptDef *opt = &cmd->opts[i];
- if (i > 63)
+ if (i > 63) {
+ vshError(ctl, _("command '%s' has too many options"), cmd->name);
return -1; /* too many options */
+ }
switch (opt->type) {
case VSH_OT_STRING:
case VSH_OT_BOOL:
- if (opt->flags & VSH_OFLAG_REQ)
- return -1; /* nor bool nor string options can't be mandatory */
+ if (opt->flags & VSH_OFLAG_REQ) {
+ vshError(ctl, _("command '%s' misused VSH_OFLAG_REQ"),
+ cmd->name);
+ return -1; /* neither bool nor string options can be mandatory */
+ }
break;
case VSH_OT_ALIAS: {
@@ -368,11 +378,17 @@ vshCmddefCheckInternals(const vshCmdDef *cmd)
char *name = (char *)opt->help; /* cast away const */
char *p;
- if (opt->flags || !opt->help)
+ if (opt->flags || !opt->help) {
+ vshError(ctl, _("command '%s' has incorrect alias option"),
+ cmd->name);
return -1; /* alias options are tracked by the original name */
+ }
if ((p = strchr(name, '=')) &&
- VIR_STRNDUP(name, name, p - name) < 0)
+ VIR_STRNDUP(name, name, p - name) < 0) {
+ vshError(ctl, _("allocation failure while checking command '%s'"),
+ cmd->name);
return -1;
+ }
for (j = i + 1; cmd->opts[j].name; j++) {
if (STREQ(name, cmd->opts[j].name) &&
cmd->opts[j].type != VSH_OT_ALIAS)
@@ -381,21 +397,33 @@ vshCmddefCheckInternals(const vshCmdDef *cmd)
if (name != opt->help) {
VIR_FREE(name);
/* If alias comes with value, replacement must not be bool */
- if (cmd->opts[j].type == VSH_OT_BOOL)
+ if (cmd->opts[j].type == VSH_OT_BOOL) {
+ vshError(ctl, _("command '%s' has mismatched alias type"),
+ cmd->name);
return -1;
+ }
}
- if (!cmd->opts[j].name)
+ if (!cmd->opts[j].name) {
+ vshError(ctl, _("command '%s' has missing alias option"),
+ cmd->name);
return -1; /* alias option must map to a later option name */
+ }
}
break;
case VSH_OT_ARGV:
- if (cmd->opts[i + 1].name)
+ if (cmd->opts[i + 1].name) {
+ vshError(ctl, _("command '%s' has option after argv"),
+ cmd->name);
return -1; /* argv option must be listed last */
+ }
break;
case VSH_OT_DATA:
- if (!(opt->flags & VSH_OFLAG_REQ))
+ if (!(opt->flags & VSH_OFLAG_REQ)) {
+ vshError(ctl, _("command '%s' has non-required VSH_OT_DATA"),
+ cmd->name);
return -1; /* OT_DATA should always be required. */
+ }
break;
case VSH_OT_INT:
@@ -3405,7 +3433,7 @@ const vshCmdInfo info_selftest[] = {
* That runs vshCmddefOptParse which validates
* the per-command options structure. */
bool
-cmdSelfTest(vshControl *ctl ATTRIBUTE_UNUSED,
+cmdSelfTest(vshControl *ctl,
const vshCmd *cmd ATTRIBUTE_UNUSED)
{
const vshCmdGrp *grp;
@@ -3413,7 +3441,7 @@ cmdSelfTest(vshControl *ctl ATTRIBUTE_UNUSED,
for (grp = cmdGroups; grp->name; grp++) {
for (def = grp->commands; def->name; def++) {
- if (vshCmddefCheckInternals(def) < 0)
+ if (vshCmddefCheckInternals(ctl, def) < 0)
return false;
}
}
--
2.20.1
5 years, 9 months
[libvirt] [libvirt-go PATCH] connect: Add the new libvirt API virConnectGetStoragePoolCapabilities
by Erik Skultety
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
connect.go | 17 +++++++++++++++++
connect_wrapper.go | 13 +++++++++++++
connect_wrapper.h | 4 ++++
3 files changed, 34 insertions(+)
diff --git a/connect.go b/connect.go
index 0d5118c..04badfc 100644
--- a/connect.go
+++ b/connect.go
@@ -2985,3 +2985,20 @@ func (c *Connect) NWFilterBindingCreateXML(xmlConfig string, flags uint32) (*NWF
}
return &NWFilterBinding{ptr: ptr}, nil
}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virConnectGetStorag...
+func (c *Connect) GetStoragePoolCapabilities(flags uint32) (string, error) {
+ if C.LIBVIR_VERSION_NUMBER < 5002000 {
+ return "", makeNotImplementedError("virConnectGetStoragePoolCapabilities")
+ }
+
+ var err C.virError
+ ret := C.virConnectGetStoragePoolCapabilitiesWrapper(c.ptr, C.uint(flags), &err)
+ if ret == nil {
+ return "", makeError(&err)
+ }
+
+ defer C.free(unsafe.Pointer(ret))
+
+ return C.GoString(ret), nil
+}
diff --git a/connect_wrapper.go b/connect_wrapper.go
index 89727d0..7be3361 100644
--- a/connect_wrapper.go
+++ b/connect_wrapper.go
@@ -1761,6 +1761,19 @@ virStreamNewWrapper(virConnectPtr conn,
}
+char *
+virConnectGetStoragePoolCapabilitiesWrapper(virConnectPtr conn,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virConnectGetStoragePoolCapabilities(conn, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
////////////////////////////////////////////////
*/
import "C"
diff --git a/connect_wrapper.h b/connect_wrapper.h
index 5c282d2..2e57ebd 100644
--- a/connect_wrapper.h
+++ b/connect_wrapper.h
@@ -726,5 +726,9 @@ virStreamNewWrapper(virConnectPtr conn,
unsigned int flags,
virErrorPtr err);
+char *
+virConnectGetStoragePoolCapabilitiesWrapper(virConnectPtr conn,
+ unsigned int flags,
+ virErrorPtr err);
#endif /* LIBVIRT_GO_CONNECT_WRAPPER_H__ */
--
2.20.1
5 years, 9 months
Re: [libvirt] Contributing to Libvirt
by Dan Fries
Hi Libvirt,
It's often said that persistence and patience are the keys to success in
life. I think persons managing content and marketing at Libvirt would be
remiss for not trying out my work. Hoping to hear from you soon.
Best,
Dan
On Monday, March 4, 2019 at 7:36 AM, Dan Fries <dan(a)danfries.net> wrote:
> Hello again Libvirt,
>
> Following up in case my previous message was lost or buried. Reiterating
> my interest to contribute to Libvirt.
>
> Warmly,
> Dan
>
> On Wednesday, February 27, 2019 at 3:27 AM, Dan Fries <dan(a)danfries.net>
> wrote:
>
>> Dear Libvirt,
>>
>> I hope you do not mind me contacting you directly, as I was given your
>> email by a colleague. My name is Dan Fries, and I am a technical copywriter
>> focused on the open source / free software community.
>>
>> I'm reaching out to you today in the hopes of writing for Libvirt. Is
>> there any availability to contribute to the site as a guest author? I'm
>> not seeking employment nor remuneration, only volunteer work.
>>
>> Thanks for your time and consideration.
>>
>> Dan
>> __
>> *Daniel Fries - Linkedin
>> <http://go.danfries.net/x/d?c=3582051&l=ae0cb955-cae7-4cb8-9c98-35ef497e89...>*
>>
>>
>> If I've reached you in error or you would prefer to not receive another
>> message at this address, I apologize for the inconvenience. Click here
>> <http://go.danfries.net/x/u?u=95b4b2a0-e834-43d9-ab3d-30462ef34ab1> and
>> you shouldn't hear from me again.
>>
>>
>
5 years, 9 months
[libvirt] [PATCH v3 0/4] PPC64 support for NVIDIA V100 GPU with NVLink2 passthrough
by Daniel Henrique Barboza
This series includes Libvirt support for a new QEMU feature for
the spapr (PPC64) machine, NVIDIA V100 + P9 passthrough. Refer to
[1] for the version 3 of this feature (same version used as a reference
for this series).
Changes in v3:
- added a new patch (patch 2) that isolates the PPC64 exclusive
code to calculate the memLockLimit (suggested by Erik Skultety)
- fixed 'make syntax-check' errors across all patches
- v2 can be found at [2]
[1] https://patchwork.kernel.org/cover/10831413/
[2] https://www.redhat.com/archives/libvir-list/2019-March/msg00059.html
Daniel Henrique Barboza (4):
qemu_domain: simplify non-VFIO memLockLimit calc for PPC64
qemu_domain: add a PPC64 memLockLimit helper
qemu_domain: NVLink2 device tree functions for PPC64
PPC64 support for NVIDIA V100 GPU with NVLink2 passthrough
src/qemu/qemu_domain.c | 402 ++++++++++++++++++++++++++++++++---------
1 file changed, 321 insertions(+), 81 deletions(-)
--
2.20.1
5 years, 9 months
[libvirt] [dockerfiles PATCH] Fix name for ppc64le architecture
by Andrea Bolognani
lcitool expects libvirt architecture names, which means the
correct value for little-endian 64-bit PowerPC is ppc64le
(VIR_ARCH_PPC64LE).
Note that, while "ppc64el" is not an architecture name
libvirt would recognize, mips64el (VIR_ARCH_MIPS64EL) and
mipsel (VIR_ARCH_MIPSEL) are indeed correct.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
...c64el.Dockerfile => buildenv-debian-9-cross-ppc64le.Dockerfile | 0
...4el.Dockerfile => buildenv-debian-sid-cross-ppc64le.Dockerfile | 0
2 files changed, 0 insertions(+), 0 deletions(-)
rename buildenv-debian-9-cross-ppc64el.Dockerfile => buildenv-debian-9-cross-ppc64le.Dockerfile (100%)
rename buildenv-debian-sid-cross-ppc64el.Dockerfile => buildenv-debian-sid-cross-ppc64le.Dockerfile (100%)
diff --git a/buildenv-debian-9-cross-ppc64el.Dockerfile b/buildenv-debian-9-cross-ppc64le.Dockerfile
similarity index 100%
rename from buildenv-debian-9-cross-ppc64el.Dockerfile
rename to buildenv-debian-9-cross-ppc64le.Dockerfile
diff --git a/buildenv-debian-sid-cross-ppc64el.Dockerfile b/buildenv-debian-sid-cross-ppc64le.Dockerfile
similarity index 100%
rename from buildenv-debian-sid-cross-ppc64el.Dockerfile
rename to buildenv-debian-sid-cross-ppc64le.Dockerfile
--
2.20.1
5 years, 9 months
[libvirt] [jenkins-ci PATCH] lcitool: Raise Error instead of Exception
by Andrea Bolognani
This results in
$ ./lcitool dockerfile dockerfile -x foo libvirt-debian-9 libvirt
FROM debian:9
./lcitool: Unsupported architecture ppc64el
being printed on error, instead of the much nastier
$ ./lcitool dockerfile dockerfile -x foo libvirt-debian-9 libvirt
FROM debian:9
Traceback (most recent call last):
File "./lcitool", line 704, in <module>
Application().run()
File "./lcitool", line 699, in run
args.func(args)
File "./lcitool", line 643, in _action_dockerfile
deb_arch = Util.native_arch_to_deb_arch(args.cross_arch)
File "./lcitool", line 126, in native_arch_to_deb_arch
raise Exception("Unsupported architecture {}".format(native_arch))
Exception: Unsupported architecture foo
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/lcitool | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/guests/lcitool b/guests/lcitool
index d6c8105..1119aaf 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -105,7 +105,7 @@ class Util:
"x86_64": "x86_64-linux-gnu",
}
if native_arch not in archmap:
- raise Exception("Unsupported architecture {}".format(native_arch))
+ raise Error("Unsupported architecture {}".format(native_arch))
return archmap[native_arch]
@staticmethod
@@ -123,7 +123,7 @@ class Util:
"x86_64": "amd64",
}
if native_arch not in archmap:
- raise Exception("Unsupported architecture {}".format(native_arch))
+ raise Error("Unsupported architecture {}".format(native_arch))
return archmap[native_arch]
--
2.20.1
5 years, 9 months
[libvirt] [PATCH] resctrl: Fix testing line
by Martin Kletzander
Forgot to remove this before pushing.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
Pushed as trivial.
src/util/virresctrl.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index ab977b995c4d..9e477fc064ed 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
@@ -2166,10 +2166,8 @@ virResctrlAllocCopyMemBW(virResctrlAllocPtr dst,
return -1;
for (i = 0; i < src_bw->nbandwidths; i++) {
- if (dst_bw->bandwidths[i]) {
- *dst_bw->bandwidths[i] = 123;
+ if (dst_bw->bandwidths[i])
continue;
- }
if (VIR_ALLOC(dst_bw->bandwidths[i]) < 0)
return -1;
*dst_bw->bandwidths[i] = *src_bw->bandwidths[i];
--
2.21.0
5 years, 9 months