[libvirt] [libvirt-sandbox PATCH] sandbox-builder: Don't try g_file_enumerator_next_file if enumerator is NULL
by Guido Günther
Passing the NULL enumerator to g_file_enumerator_next_file makes
us overwrite error information otherwise:
$ sudo bin/virt-sandbox-service create --unitfile foo.service foo
(process:18529): GLib-GIO-CRITICAL **: g_file_enumerator_next_file: assertion 'G_IS_FILE_ENUMERATOR (enumerator)' failed
(process:18529): GLib-GIO-CRITICAL **: g_file_enumerator_close: assertion 'G_IS_FILE_ENUMERATOR (enumerator)' failed
bin/virt-sandbox-service:318: Warning: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Error removing file: No such file or directory context.undefine()
bin/virt-sandbox-service:318: Warning: g_object_unref: assertion 'G_IS_OBJECT (object)' failed context.undefine()
Cleanup failed: g-io-error-quark: No such file or directory (1)
bin/virt-sandbox-service: g-io-error-quark: No such file or directory (1)
also make sure we don't unref NULL in this case.
---
libvirt-sandbox/libvirt-sandbox-builder.c | 37 +++++++++++++++++--------------
1 file changed, 20 insertions(+), 17 deletions(-)
diff --git a/libvirt-sandbox/libvirt-sandbox-builder.c b/libvirt-sandbox/libvirt-sandbox-builder.c
index 1745c88..0c43b62 100644
--- a/libvirt-sandbox/libvirt-sandbox-builder.c
+++ b/libvirt-sandbox/libvirt-sandbox-builder.c
@@ -727,32 +727,35 @@ gboolean gvir_sandbox_builder_clean_post_stop(GVirSandboxBuilder *builder,
errno != ENOENT)
ret = FALSE;
- if (!(enumerator = g_file_enumerate_children(libsFile, "*", G_FILE_QUERY_INFO_NONE,
- NULL, error)) &&
- (*error)->code != G_IO_ERROR_NOT_FOUND) {
- ret = FALSE;
- goto cleanup;
- }
+ if ((enumerator = g_file_enumerate_children(libsFile, "*", G_FILE_QUERY_INFO_NONE,
+ NULL, error))) {
+ while ((info = g_file_enumerator_next_file(enumerator, NULL, error))) {
+ child = g_file_enumerator_get_child(enumerator, info);
+ if (!g_file_delete(child, NULL, error))
+ ret = FALSE;
+ g_object_unref(child);
+ child = NULL;
+ g_object_unref(info);
+ info = NULL;
+ }
- while ((info = g_file_enumerator_next_file(enumerator, NULL, error))) {
- child = g_file_enumerator_get_child(enumerator, info);
- if (!g_file_delete(child, NULL, error))
+ if (!g_file_enumerator_close(enumerator, NULL, error))
+ ret = FALSE;
+ } else {
+ if ((*error)->code != G_IO_ERROR_NOT_FOUND) {
ret = FALSE;
- g_object_unref(child);
- child = NULL;
- g_object_unref(info);
- info = NULL;
+ goto cleanup;
+ }
+ g_clear_error(error);
}
- if (!g_file_enumerator_close(enumerator, NULL, error))
- ret = FALSE;
-
if (!g_file_delete(libsFile, NULL, error) &&
(*error)->code != G_IO_ERROR_NOT_FOUND)
ret = FALSE;
cleanup:
- g_object_unref(enumerator);
+ if (enumerator)
+ g_object_unref(enumerator);
g_object_unref(libsFile);
g_free(libsdir);
g_free(dskfile);
--
2.7.0
8 years, 9 months
[libvirt] [PATCH] tests: Produce predictable results in nsstest
by Michal Privoznik
Problem is that in the test any status file matching
tests/nssdata/*.status is loaded as it contains IP addresses that
are parsed. However, there's no order specified in which the
files are loaded. Therefore on different systems the order may be
different. This is then producing an unexpected results.
Instead of defining an order in which the files are loaded, make
the code that checks for missing IP addresses (or redundant ones)
cope with unordered list of addresses. The reasoning behind is
that the code doing the parsing is used in real NSS module where
we don't care for ordering.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tests/nsstest.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/tests/nsstest.c b/tests/nsstest.c
index 68f1c60..9d7bc40 100644
--- a/tests/nsstest.c
+++ b/tests/nsstest.c
@@ -49,7 +49,7 @@ testGetHostByName(const void *opaque)
char buf[BUF_SIZE] = { 0 };
char **addrList;
int rv, tmp_errno = 0, tmp_herrno = 0;
- size_t i = 0;
+ size_t i = 0, j = 0;
if (!data)
goto cleanup;
@@ -141,30 +141,29 @@ testGetHostByName(const void *opaque)
goto cleanup;
}
- if (!data->ipAddr[i]) {
+ for (j = 0; data->ipAddr[j]; j++) {
+ if (STREQ(data->ipAddr[j], ipAddr))
+ break;
+ }
+
+ if (!data->ipAddr[j]) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"Unexpected address %s", ipAddr);
VIR_FREE(ipAddr);
goto cleanup;
}
-
- if (STRNEQ(data->ipAddr[i], ipAddr)) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "Address mismatch. Expected %s got %s",
- data->ipAddr[i], ipAddr);
- VIR_FREE(ipAddr);
- goto cleanup;
- }
VIR_FREE(ipAddr);
addrList++;
i++;
}
- if (data->ipAddr[i]) {
+ for (j = 0; data->ipAddr[j]; j++)
+ ;
+
+ if (i != j) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- "Address mismatch. Expected %s got nothing",
- data->ipAddr[i]);
+ "Expected %zu addresses, got %zu", j, i);
goto cleanup;
}
--
2.7.3
8 years, 9 months
[libvirt] nss build failure on arm32
by Cole Robinson
Just a note, I'm getting build failures with the nss module on Fedora 23 arm
32bit:
nss/libvirt_nss.c: In function '_nss_libvirt_gethostbyname3_r':
nss/libvirt_nss.c:325:17: error: cast increases required alignment of target
type [-Werror=cast-align]
r_aliases = (char **) buffer + idx;
^
nss/libvirt_nss.c:336:19: error: cast increases required alignment of target
type [-Werror=cast-align]
r_addr_list = (char **) buffer + idx;
^
nss/libvirt_nss.c: In function '_nss_libvirt_gethostbyname4_r':
nss/libvirt_nss.c:427:21: error: cast increases required alignment of target
type [-Werror=cast-align]
r_tuple_first = (struct gaih_addrtuple*) (buffer + idx);
^
nss/libvirt_nss.c:431:19: error: cast increases required alignment of target
type [-Werror=cast-align]
r_tuple = (struct gaih_addrtuple*) (buffer + idx);
^
nss/libvirt_nss.c:435:29: error: cast increases required alignment of target
type [-Werror=cast-align]
r_tuple->next = (struct gaih_addrtuple*) ((char*) r_tuple +
ALIGN(sizeof(struct gaih_addrtuple)));
- Cole
8 years, 9 months
[libvirt] [PATCH v2 0/2] Fixup SCSI node devices
by Bjoern Walk
SCSI targets seem to be missing proper treatment and it was actually not
possible to import a SCSI target nodedev device definition because of some
typo. In order to extend the test case to catch this, I found that the XML
schema was missing as well.
Bjoern Walk (2):
conf: node_device: fix up SCSI target
tests: nodedevxml2xml: add test for SCSI target
docs/schemas/nodedev.rng | 11 +++++++++++
src/conf/node_device_conf.c | 2 +-
tests/nodedevschemadata/scsi_target0_0_0.xml | 7 +++++++
tests/nodedevxml2xmltest.c | 1 +
4 files changed, 20 insertions(+), 1 deletion(-)
create mode 100644 tests/nodedevschemadata/scsi_target0_0_0.xml
--
2.6.5
8 years, 9 months
[libvirt] [PATCH V2 0/4] Extend <hap> to a tristate
by Jim Fehlig
An expanded V2 of
https://www.redhat.com/archives/libvir-list/2016-February/msg00140.html
In V2, the <hap> feature is extended with a state='on|off' attribute to
allow differentiating the 'on' and 'off' states with not set (or hypervisor
default).
Obviously post 1.3.2 material. See individual patches for details.
Jim Fehlig (4):
conf: add 'state' attribute to <hap> feature
xenconfig: change 'hap' setting to align with Xen behavior
Xen drivers: show hap enabled by default in capabilities
libxl: support enabling and disabling <hap> feature
docs/formatdomain.html.in | 6 ++-
docs/schemas/domaincommon.rng | 6 ++-
src/conf/domain_conf.c | 4 +-
src/libxl/libxl_conf.c | 20 ++++++--
src/xen/xen_hypervisor.c | 2 +-
src/xenconfig/xen_common.c | 14 ++---
.../test-disk-positional-parms-full.cfg | 1 -
.../test-disk-positional-parms-partial.cfg | 1 -
...est-fullvirt-direct-kernel-boot-bogus-extra.cfg | 1 -
.../test-fullvirt-direct-kernel-boot-extra.cfg | 1 -
.../test-fullvirt-direct-kernel-boot.cfg | 1 -
tests/xlconfigdata/test-fullvirt-multiusb.cfg | 1 -
tests/xlconfigdata/test-fullvirt-nohap.cfg | 26 ++++++++++
tests/xlconfigdata/test-fullvirt-nohap.xml | 59 ++++++++++++++++++++++
tests/xlconfigdata/test-new-disk.cfg | 1 -
tests/xlconfigdata/test-rbd-multihost-noauth.cfg | 1 -
tests/xlconfigdata/test-spice-features.cfg | 1 -
tests/xlconfigdata/test-spice.cfg | 1 -
tests/xlconfigdata/test-vif-rate.cfg | 1 -
tests/xlconfigtest.c | 1 +
tests/xmconfigdata/test-escape-paths.cfg | 1 -
.../xmconfigdata/test-fullvirt-default-feature.cfg | 1 -
tests/xmconfigdata/test-fullvirt-force-hpet.cfg | 1 -
tests/xmconfigdata/test-fullvirt-force-nohpet.cfg | 1 -
tests/xmconfigdata/test-fullvirt-localtime.cfg | 1 -
tests/xmconfigdata/test-fullvirt-net-netfront.cfg | 1 -
tests/xmconfigdata/test-fullvirt-new-cdrom.cfg | 1 -
tests/xmconfigdata/test-fullvirt-nohap.cfg | 28 ++++++++++
tests/xmconfigdata/test-fullvirt-nohap.xml | 51 +++++++++++++++++++
tests/xmconfigdata/test-fullvirt-parallel-tcp.cfg | 1 -
.../test-fullvirt-serial-dev-2-ports.cfg | 1 -
.../test-fullvirt-serial-dev-2nd-port.cfg | 1 -
tests/xmconfigdata/test-fullvirt-serial-file.cfg | 1 -
tests/xmconfigdata/test-fullvirt-serial-null.cfg | 1 -
tests/xmconfigdata/test-fullvirt-serial-pipe.cfg | 1 -
tests/xmconfigdata/test-fullvirt-serial-pty.cfg | 1 -
tests/xmconfigdata/test-fullvirt-serial-stdio.cfg | 1 -
.../test-fullvirt-serial-tcp-telnet.cfg | 1 -
tests/xmconfigdata/test-fullvirt-serial-tcp.cfg | 1 -
tests/xmconfigdata/test-fullvirt-serial-udp.cfg | 1 -
tests/xmconfigdata/test-fullvirt-serial-unix.cfg | 1 -
tests/xmconfigdata/test-fullvirt-sound.cfg | 1 -
tests/xmconfigdata/test-fullvirt-usbmouse.cfg | 1 -
tests/xmconfigdata/test-fullvirt-usbtablet.cfg | 1 -
tests/xmconfigdata/test-fullvirt-utc.cfg | 1 -
tests/xmconfigdata/test-no-source-cdrom.cfg | 1 -
tests/xmconfigdata/test-pci-devs.cfg | 1 -
tests/xmconfigtest.c | 1 +
48 files changed, 202 insertions(+), 52 deletions(-)
create mode 100644 tests/xlconfigdata/test-fullvirt-nohap.cfg
create mode 100644 tests/xlconfigdata/test-fullvirt-nohap.xml
create mode 100755 tests/xmconfigdata/test-fullvirt-nohap.cfg
create mode 100644 tests/xmconfigdata/test-fullvirt-nohap.xml
--
2.1.4
8 years, 9 months
[libvirt] [PATCH v3 00/14] Implement post-copy migration
by Jiri Denemark
(See "Add public APIs for post-copy migration" patch for more details
about post-copy migration.)
Post-copy support was originally written by Cristian Klein in 2014, but
no one touched the series since then. Some patches in this series are
modified versions of the old patches from Cristian, some patches had to
be rewritten from scratch since libvirt code changed a lot (we started
using migration events), and some patches are completely new.
While post-copy migration is included in QEMU 2.5.0, it didn't support
everything libvirt needs. Thus you need QEMU from git to use post-copy.
Luckily, the QEMU migration capability we need to enable to use
post-copy is still prefixed with "x-", which means it's still considered
experimental. We are pretty sure the interface QEMU provides is OK, but
we'd like to wait until seamless SPICE migration is fixed for post-copy
before removing the experimental prefix. This should hopefully happen in
time for QEMU 2.6.0.
This series applies on top of "Fix and enhance statistics of a completed
job" series I sent yesterday. Both series on top of current master can
be fetched from the "post-copy-migration" branch of my staging
repository at https://gitlab.com/jirkade/libvirt
Version 3:
- VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED will only be emitted on the
destination host
- discard completed stats of an incoming post-copy migration
Version 2:
- VIR_MIGRATE_POSTCOPY_AFTER_PRECOPY flag dropped
- --postcopy-after-precopy implemented entirely in virsh
Cristian Klein (6):
Add public APIs for post-copy migration
qemu: Add QMP functions for post-copy migration
qemu: Add support for VIR_MIGRATE_POSTCOPY flag
qemu: Implement virDomainMigrateStartPostCopy
virsh: Add support for post-copy migration
virsh: Add --postcopy-after-precopy option to migrate
Jiri Denemark (8):
Add event and state details for post-copy
qemu: Handle postcopy-active migration state
virsh: Configurable migrate --timeout action
qemu: Don't kill running migrated domain on daemon restart
qemu: Refactor qemuProcessRecoverMigration
qemu: Handle post-copy migration failures
qemu: Refuse to abort migration in post-copy mode
qemu: Add flags to qemuMigrationWaitForCompletion
examples/object-events/event-test.c | 9 ++
include/libvirt/libvirt-domain.h | 11 ++
src/conf/domain_conf.c | 7 +-
src/driver-hypervisor.h | 5 +
src/libvirt-domain.c | 141 ++++++++++++++++-
src/libvirt_public.syms | 4 +
src/qemu/qemu_domain.c | 1 +
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_driver.c | 72 ++++++++-
src/qemu/qemu_migration.c | 291 +++++++++++++++++++++++++++++++-----
src/qemu/qemu_migration.h | 6 +-
src/qemu/qemu_monitor.c | 16 +-
src/qemu/qemu_monitor.h | 4 +
src/qemu/qemu_monitor_json.c | 23 +++
src/qemu/qemu_monitor_json.h | 3 +
src/qemu/qemu_process.c | 233 ++++++++++++++++++-----------
src/remote/remote_driver.c | 1 +
src/remote/remote_protocol.x | 13 +-
src/remote_protocol-structs | 5 +
tools/virsh-domain-monitor.c | 7 +-
tools/virsh-domain.c | 157 +++++++++++++++++--
tools/virsh.pod | 31 +++-
22 files changed, 880 insertions(+), 161 deletions(-)
--
2.7.2
8 years, 9 months
[libvirt] [PATCH] conf: node_device: fix wrong XML element reference
by Bjoern Walk
When reading in a XML definition for a SCSI target device, the name
property of struct scsi_target refers to the @target element.
Let's fix this obvious typo.
Signed-off-by: Bjoern Walk <bwalk(a)linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.vnet.ibm.com>
---
src/conf/node_device_conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 611045c..f74b34d 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -822,7 +822,7 @@ virNodeDevCapSCSITargetParseXML(xmlXPathContextPtr ctxt,
orignode = ctxt->node;
ctxt->node = node;
- data->scsi_target.name = virXPathString("string(./name[1])", ctxt);
+ data->scsi_target.name = virXPathString("string(./target[1])", ctxt);
if (!data->scsi_target.name) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("no target name supplied for '%s'"),
--
2.6.5
8 years, 9 months
[libvirt] [libvirt-sandbox PATCH] tests: add file extension for host mounts
by Guido Günther
otherwise we fail in gvir_sandbox_util_guess_image_format with
"Cannot identify file extension in '/tmp/home'
---
libvirt-sandbox/tests/test-config.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libvirt-sandbox/tests/test-config.c b/libvirt-sandbox/tests/test-config.c
index ac10bab..71a65c8 100644
--- a/libvirt-sandbox/tests/test-config.c
+++ b/libvirt-sandbox/tests/test-config.c
@@ -53,7 +53,7 @@ int main(int argc, char **argv)
int ret = EXIT_FAILURE;
const gchar *mounts[] = {
"host-bind:/var/run/hell=/tmp/home",
- "host-image:/etc=/tmp/home",
+ "host-image:/etc=/tmp/home/img.qcow2",
"host-image:/etc=/tmp/home,format=qcow2",
"host-bind:/tmp=",
NULL
--
2.7.0
8 years, 9 months
[libvirt] [PATCH 0/2] Some libvirt_nss cleanups
by Martin Kletzander
*** SOME PSEUDO-RANDOM BLURB ***
Martin Kletzander (2):
util: Add virSocketAddrSetIPv[46]AddrNetOrder and use it
nss: Make aligning look nicer
src/libvirt_private.syms | 2 ++
src/nwfilter/nwfilter_dhcpsnoop.c | 4 +--
src/util/virsocketaddr.c | 45 +++++++++++++++++++++++++++++-----
src/util/virsocketaddr.h | 2 ++
tests/nsstest.c | 7 +++---
tools/nss/libvirt_nss.c | 51 +++++++++++++++++++++++++--------------
6 files changed, 81 insertions(+), 30 deletions(-)
--
2.7.3
8 years, 9 months
[libvirt] Storage Backend Error Handling Consistency
by Richard Laager
These two blocks exist in different storage backends' createVol
implementations:
if (vol->target.format != VIR_STORAGE_FILE_RAW) {
virReportError(VIR_ERR_NO_SUPPORT, "%s",
_("only RAW volumes are supported by this storage pool"));
return -VIR_ERR_NO_SUPPORT;
}
if (vol->target.encryption != NULL) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("storage pool does not support encrypted "
"volumes"));
return -1;
}
My hunch is that the second example (VIR_ERR_CONFIG_UNSUPPORTED and
returning -1) is correct in both of these cases.
Related... Which backends should be restricted to only raw? That code
is from storage_backend_rbd.c, which seems to be the only one
restricted in that way. But does it make sense to allow !raw on LVM (or
ZFS), for example?
Whatever the correct answer, I'm looking to submit one or more patches.
--
Richard
8 years, 9 months