Re: [libvirt] [PATCH] libxl: avoid crashing if calling `virsh numatune' on inactive domain

2013-12-28 Thread Doug Goldstein
On Sat, Dec 28, 2013 at 3:18 PM, Doug Goldstein wrote: > On Tue, Dec 24, 2013 at 12:02 AM, Eric Blake wrote: >> On 12/20/2013 11:36 AM, Jim Fehlig wrote: >>> Dario Faggioli wrote: by, in libxlDomainGetNumaParameters(), calling libxl_bitmap_init() as soon as possible, which avoids

Re: [libvirt] [PATCH] libxl: avoid crashing if calling `virsh numatune' on inactive domain

2013-12-28 Thread Doug Goldstein
On Tue, Dec 24, 2013 at 12:02 AM, Eric Blake wrote: > On 12/20/2013 11:36 AM, Jim Fehlig wrote: >> Dario Faggioli wrote: >>> by, in libxlDomainGetNumaParameters(), calling libxl_bitmap_init() as soon >>> as >>> possible, which avoids getting to 'cleanup:', where libxl_bitmap_dispose() >>> happens

[libvirt] [PATCH] docs: fix layout of code snippets

2013-12-28 Thread Eric Blake
Similar to commit 52dbeac, we should indent code snippets in other places to ensure they appear correctly in html. See http://libvirt.org/html/libvirt-libvirt.html#virNodeGetCPUStats for an example improved by this patch. Also fix some missing semicolons in the samples. * src/libvirt.c: Indent c

Re: [libvirt] [PATCH] maint: update to latest gnulib

2013-12-28 Thread Eric Blake
On 12/06/2013 01:33 AM, Michal Privoznik wrote: > On 06.12.2013 00:52, Eric Blake wrote: >> A couple of fixes for bootstrap issues reported on IRC: >> - on some older glibc systems, ./configure could deadlock due to >> a glibc malloc bug >> - on FreeBSD systems, a broken autom4te coupled with gette

Re: [libvirt] [PATCHv2] maint: improve debug of libvirt-{qemu, lxc} apis

2013-12-28 Thread Eric Blake
On 12/19/2013 09:32 PM, Eric Blake wrote: > I noticed that the virDomainQemuMonitorCommand debug output wasn't > telling me the name of the domain it was working on. While it was > easy enough to determine which pointer matches the domain based on > other log messages, it is nicer to be consistent

[libvirt] [PATCH 14/24] maint: improve VIR_ERR_INVALID_NETWORK usage

2013-12-28 Thread Eric Blake
When checking for a valid network, we weren't consistent on whether we reported an invalid network or a connection. Similar to previous patches, use a common macro to make it nicer. * src/datatypes.h (virCheckNetworkReturn, virCheckNetworkGoto): New macros. (VIR_IS_NETWORK, VIR_IS_CONNECTED_NETWO

[libvirt] [PATCH 11/24] maint: inline VIR_IS_CONNECT macro

2013-12-28 Thread Eric Blake
Cleanup after the previous patch. * src/datatypes.h (VIR_IS_CONNECT): Delete, and inline into all callers, since no other file uses it any more. Signed-off-by: Eric Blake --- src/datatypes.h | 24 +++- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/datat

[libvirt] [PATCH 18/24] maint: improve VIR_ERR_INVALID_NODE_DEVICE usage

2013-12-28 Thread Eric Blake
While all errors related to invalid node device appeared to be consistent, we might as well continue the trend of using a common macro. For now, we don't need virCheckNodeDeviceGoto(). * src/datatypes.h (virCheckNodeDeviceReturn): New macro. (VIR_IS_NODE_DEVICE, VIR_IS_CONNECTED_NODE_DEVICE): Dro

[libvirt] [PATCH 13/24] maint: inline VIR_IS*_DOMAIN macro

2013-12-28 Thread Eric Blake
Cleanup after the previous patch. In particular, note that xenDomainUsedCpus can only be reached from xenUnifiedDomainGetXMLDesc, which in turn is only reached from public API that already validated the domain. * src/xen/xen_driver.c (xenDomainUsedCpus): Drop redundant check. * src/datatypes.h (V

[libvirt] [PATCH 20/24] maint: improve VIR_ERR_INVALID_STREAM usage

2013-12-28 Thread Eric Blake
For streams validation, we weren't consistent on whether to use VIR_FROM_NONE or VIR_FROM_STREAMS. Furthermore, in many API, we want to ensure that a stream is tied to the same connection as the other object we are operating on; while other API failed to validate the stream at all. Similar to prev

[libvirt] [PATCH 15/24] maint: improve VIR_ERR_INVALID_INTERFACE usage

2013-12-28 Thread Eric Blake
When checking for a valid interface, we weren't consistent on whether ew reported as VIR_FROM_NONE or VIR_FROM_INTERFACE. Similar to previous patches, use a common macro to make it nicer. For now, we don't need virCheckInterfaceGoto(). * src/datatypes.h (virCheckInterfaceReturn): New macro. (VIR_I

[libvirt] [PATCH 16/24] maint: improve VIR_ERR_INVALID_STORAGE_POOL usage

2013-12-28 Thread Eric Blake
virStoragePoolBuild reported an invalid pool as if it were an invalid network. Likewise, we weren't consistent on whether to use VIR_FROM_NONE or VIR_FROM_STORAGE. Similar to previous patches, use a common macro to make it nicer. For now, we don't need virCheckStoragePoolGoto(). * src/datatypes

[libvirt] [PATCH 23/24] maint: clean up error reporting in migration

2013-12-28 Thread Eric Blake
While auditing the error reporting, I noticed that migration had some issues. Some of the static helper functions tried to call virDispatchError(), even though their caller will also report the error. Also, if a migration is cancelled early because a uri was not set, we did not guarantee that the

[libvirt] [PATCH 21/24] maint: improve VIR_ERR_INVALID_NWFILTER usage

2013-12-28 Thread Eric Blake
While all errors related to invalid nwfilters appeared to be consistent, we might as well continue the trend of using a common macro. For now, we don't need virCheckNWFilterGoto(). * src/datatypes.h (virCheckNWFilterReturn): New macro. (VIR_IS_NWFILTER, VIR_IS_CONNECTED_NWFILTER): Drop unused mac

[libvirt] [PATCH 17/24] maint: improve VIR_ERR_INVALID_STORAGE_VOL usage

2013-12-28 Thread Eric Blake
For storage volume validation, we weren't consistent on whether to use VIR_FROM_NONE or VIR_FROM_STORAGE. Similar to previous patches, use a common macro to make it nicer. virStorageVolCreateXMLFrom allows cross-connection cloning, where the error is reported against the connection of the destina

[libvirt] [PATCH 22/24] maint: improve VIR_ERR_INVALID_DOMAIN_SNAPSHOT usage

2013-12-28 Thread Eric Blake
The existing check of domain snapshots validated that they point to a domain, but did not validate that the domain points to a connection, even though any errors blindly assume the connection is valid. For consistency with previous patches, continue the trend of using a common macro. For now, we

[libvirt] [PATCH 24/24] maint: replace remaining virLib*Error with better names

2013-12-28 Thread Eric Blake
Finish the cleanup; all uses of virLib*Error have now been converted to more canonical conventions. * src/libvirt.c: Use virReportError in remaining errors. (virLibConnError, virLibDomainError): Delete unused macros. * cfg.mk (msg_gen_function): Drop unused names. Signed-off-by: Eric Blake ---

[libvirt] [PATCH 04/24] maint: improve error condition style in public API

2013-12-28 Thread Eric Blake
While auditing error messages in libvirt.c, I found a couple instances that had not been converted to modern error styles, and a few places that failed to dispatch the error through the known-good connection. * src/libvirt.c (virDomainPinEmulator, virDomainGetDiskErrors) (virDomainSendKey, virDoma

[libvirt] [PATCH 05/24] maint: don't leave garbage on early API exit

2013-12-28 Thread Eric Blake
Several APIs clear out a user input buffer before attempting to populate it; but in a few cases we missed this memset if we detect a reason for an early exit. * src/libvirt.c (virDomainGetInfo, virDomainGetBlockInfo) (virStoragePoolGetInfo, virStorageVolGetInfo) (virDomainGetJobInfo, virDomainGetB

[libvirt] [PATCH 07/24] maint: avoid nested public calls

2013-12-28 Thread Eric Blake
Having one API call into another is generally not good; among other issues, it gives confusing logs, and is not quite as efficient. This fixes several instances, but not all: we still have instances in both libvirt.c and in backend hypervisors (lxc and qemu) calling the public virTypedParamsGetStr

[libvirt] [PATCH 03/24] maint: move debug statements first in public API

2013-12-28 Thread Eric Blake
Most of our public APIs emit a debug log on entry, prior to anything else. There were a few exceptions where obvious failures were not logged, so fix those. Many of the fixes are made more careful to avoid a NULL deref if the user passes NULL for the object. * src/libvirt.c (virConnectOpen, virC

[libvirt] [PATCH 19/24] maint: improve VIR_ERR_INVALID_SECRET usage

2013-12-28 Thread Eric Blake
While all errors related to invalid secrets appeared to be consistent, we might as well continue the trend of using a common macro. For now, we don't need virCheckSecretGoto(). * src/datatypes.h (virCheckSecretReturn): New macro. (VIR_IS_SECRET, VIR_IS_CONNECTED_SECRET): Drop unused macros. * src

[libvirt] [PATCH 06/24] maint: reset error on entrance to public API

2013-12-28 Thread Eric Blake
We document that calling any public API wipes out all prior libvirt errors in the same thread; but weren't obeying this style in a few functions. * src/libvirt.c (virGetVersion, virConnectRef, virDomainRef) (virDomainGetSecurityLabel, virDomainGetSecurityLabelList) (virDomainSetMetadata, virDomain

[libvirt] [PATCH 02/24] maint: improve debug of libvirt-{qemu, lxc} apis

2013-12-28 Thread Eric Blake
I noticed that the virDomainQemuMonitorCommand debug output wasn't telling me the name of the domain it was working on. While it was easy enough to determine which pointer matches the domain based on other log messages, it is nicer to be consistent. * src/util/viruuid.h (VIR_UUID_DEBUG): Moved he

[libvirt] [PATCH 00/24] libvirt.c error handling audit

2013-12-28 Thread Eric Blake
This series is in response to: https://www.redhat.com/archives/libvir-list/2013-December/msg01101.html It turned into a much bigger cleanup project, where I ended up with a lot of changes; hopefully the division into multiple patches makes review easier, and the end result diffstat shows that the