daemon: add and use a reply_with_unavailable_feature macro

Handy macro to reply the right way for an unavailable feature.
While generally used so far in generated code, it can shorten that a
bit, and avoid copy&paste when wanting to do manual feature checking.
aarch64: Add common function for getting the CPU model.

And force a 64 bit CPU model when running on aarch64 with TCG.
lua: always return luaL_error in actions

Even if luaL_error is a "no return" function for the Lua runtime, adopt
also in action functions the "return" idiom recommeded for it.

This also helps code analyzers in not thinking that "g" might still be
null after the null check followed by luaL_error.
src: always check value passed to set_memsize

Move the minimum memory check from the environment parsing to
set_memsize, so the limit is actually enforced also when using the API.

Adapt the rhbz557655.sh test to the invalid memsize values being
rejected now, and add a new test for checking invalid parameters
explicitly.
rescue: fix sscanf placeholders for --smp and --memsize

Use %d to parse them as int (since the variables for them as int)
instead of %u, even if they both need to be at least > 0; the library
will check for the validity of them anyway.
daemon: initialize memory when handling DeviceList params

When dealing with DeviceList parameters, the generator produces code
similar to the following:

  CLEANUP_FREE_STRING_LIST char **devices = NULL;
  [...]
  devices = malloc (sizeof (char *) * (args.devices.devices_len+1));
  {
    size_t i;
    for (i = 0; i < args.devices.devices_len; ++i)
      RESOLVE_DEVICE (args.devices.devices_val[i], devices[i],
                      , goto done);
    devices[i] = NULL;
  }

The block hidden within the RESOLVE_DEVICE macro is supposed to
assign something to devices[i]; on the other hand, the code in
RESOLVE_DEVICE can cause to just end (with an error) the current RPC,
which would cause the cleanup of the "devices" array... whose members
from the i-th to the (args.devices.devices_len-1)-th would be garbage
pointers, causing random memory to be free'd (and thus crashing the
daemon).

Avoid the access to garbage memory just by having a cleaned "devices"
array, so there will be always a NULL element after the initialized
members.

Add a test for vgcreate which passes a wrong device path causing the
situation above, to test that vgcreate would fail gracefully.
tests: c-api: do not crash w/ missing hash entry

If an hash does not have the requested key, just error out cleanly
instead of crashing when trying to compare a null string.
daemon: blkid: fix memory issues in "no -p/-i" mode

Fix the memory issues in the implementation that uses no -p nor -i:
- use add_string_nodup to add results from get_blkid_tag (which returns
  new strings), so those strings are not leaked
- use free_stringslen to clean the hash on error, as in such case the
  stringbuf will not be terminated with a null entry, thus causing
  free_strings to crash
daemon: add CLEANUP_CLOSE

Just call close on the specified fd, if valid.
daemon: use CLEANUP_CLOSE
df: unlock retire_mutex on early exit

If pthread_cond_wait fails and the thread worker ends, make sure to
unlock retire_mutex, which has been locked for the condition.

The return value of pthread_mutex_unlock is ignored, as there's nothing
that can be done with it at that point.
p2v: Move libutils before libxml2 in the list of libraries (RHBZ#1102447).

The error is:

../src/.libs/libutils.a(
libutils_la-cleanup.o): In function `guestfs___cleanup_xmlBufferFree':
cleanup.c:(.text+0x79): undefined reference to `xmlBufferFree'
../src/.libs/libutils.a(libutils_la-cleanup.o): In function
`guestfs___cleanup_xmlFreeDoc':
cleanup.c:(.text+0x99): undefined reference to `xmlFreeDoc'
[etc.]

Thanks: Arnaud Gaboury
p2v: check results of strndup and sscanf
python: fix possible free on uninit memory with OStringList optargs

When using optional arguments of type OStringList, the code free'ing
the member in the optargs_s struct corresponding to that optional
argument would just check for a non-PyNone PyObject for that argument.
If before that optional argument there are other arguments which can
cause an earlier error return from that binding function, the free'ing
code will then act on garbage values.

Enhance the check by also checking whether the optargs struct has the
bitmask with the element for that argument, meaning that the
corresponding struct member was initialized.
lib: Typo in comment.
builder: Missing include of <locale.h>.

Required by setlocale.  For some reason you only see the error
when compiling with -O0.
fish: add test-invalid-params.sh to EXTRA_DIST

Followup of commit 7912759fc331f6e8a0f7c87731f6bfe8c6e96c1f.
build: manually drop flex-/bison-generated files from dist

It seems that Automake cannot handle properly the files generated by
flex and bison, leaving them in the dist tarball.

For now, add a dist-hook to manually prune them from distdir.
p2v: Call the remote libvirt XML file 'guest.xml'.

Previously it was called 'libvirt.conf' which is more than a little
bit confusing.

This is only an internal name, so there is no visible change in
functionality.
p2v: Clean up and fix the code for excluding the root device.