[libvirt] [PATCH] util: Fix virStorageBackendIQNFound() to work on FreeBSD
by Andrea Bolognani
Despite being standardized in POSIX.1-2008, the 'm'
sscanf() modifier is currently not available on FreeBSD.
Reimplement parsing without sscanf() to work around the
issue.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/util/viriscsi.c | 34 ++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/src/util/viriscsi.c b/src/util/viriscsi.c
index e2c80acaaa..96934df948 100644
--- a/src/util/viriscsi.c
+++ b/src/util/viriscsi.c
@@ -146,8 +146,10 @@ virStorageBackendIQNFound(const char *initiatoriqn,
line = outbuf;
while (line && *line) {
+ char *current = line;
char *newline;
- int num;
+ char *next;
+ int i;
if (!(newline = strchr(line, '\n')))
break;
@@ -156,15 +158,29 @@ virStorageBackendIQNFound(const char *initiatoriqn,
VIR_FREE(iface);
VIR_FREE(iqn);
- num = sscanf(line, "%ms %*[^,],%*[^,],%*[^,],%*[^,],%ms", &iface, &iqn);
- if (num != 2) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("malformed output of %s: %s"),
- ISCSIADM, line);
+ /* Find the first space, copy everything up to that point into
+ * iface and move past it to continue processing */
+ if (!(next = strchr(current, ' ')))
+ goto error;
+
+ if (VIR_STRNDUP(iface, current, (next - current)) < 0)
goto cleanup;
+
+ current = next + 1;
+
+ /* There are five comma separated fields after iface and we only
+ * care about the last one, so we need to skip four commas and
+ * copy whatever's left into iqn */
+ for (i = 0; i < 4; i++) {
+ if (!(next = strchr(current, ',')))
+ goto error;
+ current = next + 1;
}
+ if (VIR_STRDUP(iqn, current) < 0)
+ goto cleanup;
+
if (STREQ(iqn, initiatoriqn)) {
VIR_STEAL_PTR(*ifacename, iface);
@@ -186,6 +202,12 @@ virStorageBackendIQNFound(const char *initiatoriqn,
VIR_FREE(outbuf);
virCommandFree(cmd);
return ret;
+
+ error:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("malformed output of %s: %s"),
+ ISCSIADM, line);
+ goto cleanup;
}
--
2.17.1
6 years, 5 months
[libvirt] [PATCH] esx storage: Fix typo lsilogic -> lsiLogic
by Marcos Paulo de Souza
Commit 77298458d027db4d3e082213355e2d792f65158d changed the esx storage
adapter from busLogic to lsilogic, introducing a typo. Changing it back
to lsiLogic (with capital L) solves the issue. With this change, libvirt can now
create volumes in ESX again.
Thanks to Jaroslav Suchanek who figured out what was the issue in the
first place.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1571759
Signed-off-by: Marcos Paulo de Souza <marcos.souza.org(a)gmail.com>
---
src/esx/esx_storage_backend_vmfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backend_vmfs.c
index 630a6aa8c9..bb2de4b69f 100644
--- a/src/esx/esx_storage_backend_vmfs.c
+++ b/src/esx/esx_storage_backend_vmfs.c
@@ -967,9 +967,9 @@ esxStorageVolCreateXML(virStoragePoolPtr pool,
/*
* FIXME: The adapter type is a required parameter, but there is no
* way to let the user specify it in the volume XML config. Therefore,
- * default to 'lsilogic' here.
+ * default to 'lsiLogic' here.
*/
- virtualDiskSpec->adapterType = (char *)"lsilogic";
+ virtualDiskSpec->adapterType = (char *)"lsiLogic";
virtualDiskSpec->capacityKb->value =
VIR_DIV_UP(def->target.capacity, 1024); /* Scale from byte to kilobyte */
--
2.17.0
6 years, 5 months
[libvirt] [PATCH] IGNORE. Testing patchew.org syntax-check reporting
by Daniel P. Berrangé
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/libvirt.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index aeb8804714..ed4ec062e7 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -21,8 +21,6 @@
* Daniel Veillard <veillard(a)redhat.com>
*/
-#include <config.h>
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
--
2.17.1
6 years, 5 months
[libvirt] [dbus PATCH] tests: Fix sha-bang for test_interface.py
by Andrea Bolognani
We need to call python3 through /usr/bin/env so that
the script will work on platforms, such as FreeBSD, where
the interpreter is installed under a different path.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
Pushed under the build-breaker rule.
tests/test_interface.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/test_interface.py b/tests/test_interface.py
index 9503eef..3b8b344 100755
--- a/tests/test_interface.py
+++ b/tests/test_interface.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
import dbus
import libvirttest
--
2.17.1
6 years, 5 months
[libvirt] [PATCH] news: Add --alias to virsh attach-disk and attach-interface
by Han Han
Signed-off-by: Han Han <hhan(a)redhat.com>
---
docs/news.xml | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/docs/news.xml b/docs/news.xml
index 20c2ff7a6f..1e632eb378 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -67,6 +67,15 @@
only rendering devices within the guest.
</description>
</change>
+ <change>
+ <summary>
+ virsh: Add --alias to attach-disk and attach-interface command.
+ </summary>
+ <description>
+ Add option --alias to set customized device alias name when
+ attach-disk or attach-interface.
+ </description>
+ </change>
</section>
<section title="Bug fixes">
</section>
--
2.18.0
6 years, 5 months
Re: [libvirt] [PATCH] util: Fix virStorageBackendIQNFound() to work on FreeBSD
by Andrea Bolognani
On Wed, 2018-07-25 at 02:49 -0700, no-reply(a)patchew.org wrote:
> Hi,
>
> This series was run against 'syntax-check' test by patchew.org,
> which failed, please find the details below:
[...]
> src/util/viriscsi.c:152: int i;
> maint.mk: use size_t, not int/unsigned int for loop vars i, j, k
> make: *** [cfg.mk:573: sc_prohibit_int_ijk] Error 1
My bad. Consider the diff below squashed in.
diff --git a/src/util/viriscsi.c b/src/util/viriscsi.c
index 96934df948..653b4fd932 100644
--- a/src/util/viriscsi.c
+++ b/src/util/viriscsi.c
@@ -149,7 +149,7 @@ virStorageBackendIQNFound(const char *initiatoriqn,
char *current = line;
char *newline;
char *next;
- int i;
+ size_t i;
if (!(newline = strchr(line, '\n')))
break;
--
Andrea Bolognani / Red Hat / Virtualization
6 years, 5 months
[libvirt] [jenkins-ci PATCH] guests: Make mappings more future proof
by Andrea Bolognani
We can reasonably expect the next major release of CentOS
to be somewhat close to current Fedora releases in terms of
packaging, and to ditch the soon-to-be-unsupported Python 2
in favor of Python 3.
Rewrite some of the mappings based on these expectations.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/vars/mappings.yml | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml
index 92822cb..454afe5 100644
--- a/guests/vars/mappings.yml
+++ b/guests/vars/mappings.yml
@@ -651,12 +651,12 @@ mappings:
python3:
default: python3
- CentOS:
+ CentOS7:
python3-dbus:
default: python3-dbus
FreeBSD: py36-dbus
- CentOS:
+ CentOS7:
python3-devel:
deb: python3-dev
@@ -667,34 +667,34 @@ mappings:
deb: python3-gi
pkg: py36-gobject3
rpm: python3-gobject
- CentOS:
+ CentOS7:
python3-libxml2:
default: python3-libxml2
FreeBSD: py36-libxml2
- CentOS:
+ CentOS7:
Debian8:
Ubuntu16:
python3-lxml:
default: python3-lxml
FreeBSD: py36-lxml
- CentOS:
+ CentOS7:
python3-nose:
default: python3-nose
FreeBSD: py36-nose
- CentOS:
+ CentOS7:
python3-pytest:
default: python3-pytest
FreeBSD: py36-pytest
- CentOS:
+ CentOS7:
python3-requests:
default: python3-requests
FreeBSD: py36-requests
- CentOS:
+ CentOS7:
qemu-img:
default: qemu-utils
@@ -711,7 +711,7 @@ mappings:
rpcgen:
deb: libc-dev-bin
rpm: rpcgen
- CentOS: glibc-common
+ CentOS7: glibc-common
Fedora26: glibc-common
Fedora27: glibc-common
FreeBSD:
--
2.17.1
6 years, 5 months
[libvirt] [PATCH] use model "qemu" for s390 tcg cpu-model-expansion
by Collin Walling
When calling the query-cpu-model-expansion command via libvirt, we pass in model
name "max" when using TCG. However, this model name is not supported for s390 on
TCG. Let's use the model name "qemu" as an alternative.
QEMU Results:
When executing query-cpu-model-expansion via QEMU on s390 with TCG, the name "max"
results in this error:
{ "execute": "query-cpu-model-expansion", "arguments": {"type": "static", "model": {"name": "max"}}}
-> {"error": {"class": "GenericError", "desc": "The CPU definition 'max' is unknown."}}
An alternative is to use model name "qemu." On a z13.2 machine:
{ "execute": "query-cpu-model-expansion", "arguments": {"type": "static", "model": {"name": "qemu"}}}
-> {"return": {"model": {"name": "zEC12.2-base", "props": {"dateh2": false, "aen": true, "kmac-tdea-192": false,
"kmc-tdea-192": false, "parseh": false, "csske": false, "hfpm": false, "hfpue": false, "dfp": false, "km-dea": false,
"emon": false, "kimd-sha-1": false, "cmpsceh": false, "dfpzc": false, "dfphp": false, "kmc-dea": false,
"klmd-sha-1": false, "asnlxr": false, "km-tdea-192": false, "km-tdea-128": false, "fpe": false, "kmac-dea": false,
"kmc-tdea-128": false, "ais": true, "kmac-tdea-128": false, "nonqks": false, "pfpo": false, "msa4-base": true,
"msa3-base": true, "tods": false}}}}
I am by all means *not* an expert in TCG, but I noticed this error while I was messing
around with things on my system.
Thanks!
Collin Walling (1):
qemu: caps: use model "qemu" for s390 tcg cpu-model-expansion
src/qemu/qemu_capabilities.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--
2.7.4
6 years, 5 months
[libvirt] [PATCH v2] qemuDomainSaveMemory: Don't enforce dynamicOwnership
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1589115
When doing a memory snapshot qemuOpenFile() is used. This means
that the file where memory is saved is firstly attempted to be
created under root:root (because that's what libvirtd is running
under) and if this fails the second attempt is done under
domain's uid:gid. This does not make much sense - qemu is given
opened FD so it does not need to access the file. Moreover, if
dynamicOwnership is set in qemu.conf and the file lives on a
squashed NFS this is deadly combination and very likely to fail.
The fix consists of using:
qemuOpenFileAs(fallback_uid = cfg->user,
fallback_gid = cfg->group,
dynamicOwnership = false)
In other words, dynamicOwnership is turned off for memory
snapshot (chown() will still be attempted if the file does not
live on NFS) and instead of using domain DAC label, configured
user:group is set as fallback.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Diff to v1:
- Fix doCoreDump too (raised in review by John).
src/qemu/qemu_driver.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 9a35e04a85..86674e519b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3185,6 +3185,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
unsigned int flags,
qemuDomainAsyncJob asyncJob)
{
+ virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
bool needUnlink = false;
int ret = -1;
int fd = -1;
@@ -3202,9 +3203,10 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
goto cleanup;
}
}
- fd = qemuOpenFile(driver, vm, path,
- O_WRONLY | O_TRUNC | O_CREAT | directFlag,
- &needUnlink);
+
+ fd = qemuOpenFileAs(cfg->user, cfg->group, false, path,
+ O_WRONLY | O_TRUNC | O_CREAT | directFlag,
+ &needUnlink);
if (fd < 0)
goto cleanup;
@@ -3244,6 +3246,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
cleanup:
VIR_FORCE_CLOSE(fd);
virFileWrapperFdFree(wrapperFd);
+ virObjectUnref(cfg);
if (ret < 0 && needUnlink)
unlink(path);
@@ -3793,9 +3796,9 @@ doCoreDump(virQEMUDriverPtr driver,
/* Core dumps usually imply last-ditch analysis efforts are
* desired, so we intentionally do not unlink even if a file was
* created. */
- if ((fd = qemuOpenFile(driver, vm, path,
- O_CREAT | O_TRUNC | O_WRONLY | directFlag,
- NULL)) < 0)
+ if ((fd = qemuOpenFileAs(cfg->user, cfg->group, false, path,
+ O_CREAT | O_TRUNC | O_WRONLY | directFlag,
+ NULL)) < 0)
goto cleanup;
if (!(wrapperFd = virFileWrapperFdNew(&fd, path, flags)))
--
2.16.4
6 years, 5 months
[libvirt] [PATCH v2 00/10] viriscsi: Couple of fixes
by Michal Privoznik
v2 of:
https://www.redhat.com/archives/libvir-list/2018-June/msg01861.html
diff to v1:
- fixed misleading while() loop in 03/10
- Introduced some tests
- patch 06/10 is new, while writing the tests I've noticed that
errors from testIscsiadmCb were not propagated properly.
Patches 01,02,04 and 05 are ACKed already. Even though John
suggested merging 04 and 05 together I haven't done that because
I believe "iscsi --interface" and "iscsi --op nonpersistent" are
orthogonal and even though we currently treat them as mutually
exclusive (in storage backend) the util/viriscsi.c API should not
suffer because of that.
Michal Privoznik (10):
virStorageBackendIQNFound: Fix ret value assignment
virStorageBackendIQNFound: Rename out label
virStorageBackendIQNFound: Rework iscsiadm output parsing
virISCSIScanTargets: Honour iSCSI interface
virISCSIScanTargets: Allow making targets persistent
virCommandWait: Propagate dryRunCallback return value properly
viriscsitest: Test virISCSIConnectionLogin
viriscsitest: Move testSessionInfo struct
viriscsitest: Introduce testIscsiadmCbData struct
viriscsitest: Extend virISCSIConnectionLogin test
src/storage/storage_backend_iscsi.c | 5 +-
src/util/vircommand.c | 2 +
src/util/viriscsi.c | 196 ++++++++++++++++++++++++------------
src/util/viriscsi.h | 2 +
tests/viriscsitest.c | 145 ++++++++++++++++++++++++--
5 files changed, 272 insertions(+), 78 deletions(-)
--
2.16.4
6 years, 5 months