]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/log
people/liuw/libxenctrl-split/libvirt.git
10 years agoIntroduce domain_capabilities
Michal Privoznik [Wed, 25 Jun 2014 11:24:53 +0000 (13:24 +0200)]
Introduce domain_capabilities

This new module holds and formats capabilities for emulator. If you
are about to create a new domain, you may want to know what is the
host or hypervisor capable of. To make sure we don't regress on the
XML, the formatting is not something left for each driver to
implement, rather there's general format function.

The domain capabilities is a lockable object (even though the locking
is not necessary yet) which uses reference counter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoxenapiConnectGetCapabilities: Remove unused 'cleanup' label
Michal Privoznik [Thu, 3 Jul 2014 10:21:00 +0000 (12:21 +0200)]
xenapiConnectGetCapabilities: Remove unused 'cleanup' label

In the lastest rework (9e7ecabf) a cleanup label was left over which
results in compilation error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoRemove double OOM error reporting
Ján Tomko [Fri, 27 Jun 2014 06:44:15 +0000 (08:44 +0200)]
Remove double OOM error reporting

10 years agoRemove double OOM error reporting from JSON monitor
Ján Tomko [Fri, 27 Jun 2014 06:45:14 +0000 (08:45 +0200)]
Remove double OOM error reporting from JSON monitor

The functions called here report an OOM error when the allocation
fails, or quietly return -1 on wrong usage (which is not the case
here)

10 years agoAdd OOM error reporting to a few fucntions
Ján Tomko [Fri, 27 Jun 2014 08:47:11 +0000 (10:47 +0200)]
Add OOM error reporting to a few fucntions

They report errors in all other cases.

10 years agoSet errno on OOM in lxcProcReadMeminfo
Ján Tomko [Fri, 27 Jun 2014 08:47:05 +0000 (10:47 +0200)]
Set errno on OOM in lxcProcReadMeminfo

It sets the errno on all other errors, do it here too.
Also report an error.

10 years agoUse virBufferCheckError everywhere we report OOM error
Ján Tomko [Fri, 27 Jun 2014 08:40:15 +0000 (10:40 +0200)]
Use virBufferCheckError everywhere we report OOM error

Replace:
if (virBufferError(&buf)) {
    virBufferFreeAndReset(&buf);
    virReportOOMError();
    ...
}

with:
if (virBufferCheckError(&buf) < 0)
    ...

This should not be a functional change (unless some callers
misused the virBuffer APIs - a different error would be reported
then)

10 years agoReport errors in virCapabilitiesFormatXML
Ján Tomko [Fri, 27 Jun 2014 07:55:44 +0000 (09:55 +0200)]
Report errors in virCapabilitiesFormatXML

So far, we only report an error if formatting the siblings bitmap
in NUMA topology fails.

Be consistent and always report error in virCapabilitiesFormatXML.

10 years agoIntroduce virBufferCheckError
Ján Tomko [Fri, 27 Jun 2014 07:23:13 +0000 (09:23 +0200)]
Introduce virBufferCheckError

Check if the buffer is in error state and report an error if it is.

This replaces the pattern:
if (virBufferError(buf)) {
    virReportOOMError();
    goto cleanup;
}
with:

if (virBufferCheckError(buf) < 0)
    goto cleanup;

Document typical buffer usage to favor this.
Also remove the redundant FreeAndReset - if an error has
been set via virBufferSetError, the content is already freed.

10 years agoUse virStringReplace instead of openvz_replace
Ján Tomko [Fri, 27 Jun 2014 07:32:38 +0000 (09:32 +0200)]
Use virStringReplace instead of openvz_replace

This function didn't report an error on OOM. Better delete it
and use virStringReplace instead. :)

10 years agoRemove useless condition in networkRadvdConfContents
Ján Tomko [Fri, 27 Jun 2014 09:21:06 +0000 (11:21 +0200)]
Remove useless condition in networkRadvdConfContents

If v6present is false, this code is not reachable.
Also, there is no need to check for errors twice.

10 years agousb: Remove redundant comment
Ján Tomko [Fri, 27 Jun 2014 06:46:26 +0000 (08:46 +0200)]
usb: Remove redundant comment

10 years agoMore indentation fixes
Ján Tomko [Fri, 27 Jun 2014 09:25:05 +0000 (11:25 +0200)]
More indentation fixes

Reindent nwfilter gentech driver and one block in rbd storage backend.

10 years agoFix indentation in bridge driver
Ján Tomko [Mon, 23 Jun 2014 09:51:38 +0000 (11:51 +0200)]
Fix indentation in bridge driver

10 years agoqemu_domain: fix startup policy for disks
Pavel Hrdina [Fri, 27 Jun 2014 14:34:07 +0000 (16:34 +0200)]
qemu_domain: fix startup policy for disks

https://bugzilla.redhat.com/show_bug.cgi?id=1086121

We now support startupPolicy='optional' for disks, but this
should work only for cold boot, not for restore or migrate.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agoLXC: update comments of lxcDomainCreateXMLWithFiles() and lxcDomainCreateXML()
Yue wenyuan [Wed, 25 Jun 2014 08:16:16 +0000 (16:16 +0800)]
LXC: update comments of lxcDomainCreateXMLWithFiles() and lxcDomainCreateXML()

The comments for lxcDomainCreateXMLWithFiles are out of date. So update them.
And add comments for lxcDomainCreateXML

Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
Signed-off-by: Yue wenyuan <yuewenyuan@huawei.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agovirsh: Allow attach-disk to specify disk target bus
Yanbing Du [Tue, 1 Jul 2014 10:02:03 +0000 (18:02 +0800)]
virsh: Allow attach-disk to specify disk target bus

By default, the bus type is inferred from the style of the device
name('target' in this command), e.g. a device named 'sda' will
typically be exported using a SCSI bus. Actually, not only SCSI bus,
but USB/SATA bus also use this kind of device name. So add '--bus'
option for attach-disk command to allow user specify the target bus.

Signed-off-by: Yanbing Du <ydu@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoFix segfault when starting a domain with no cpu definition
Ján Tomko [Wed, 2 Jul 2014 08:35:31 +0000 (10:35 +0200)]
Fix segfault when starting a domain with no cpu definition

My commit fba6bc4 iterated over the features in cpu definition
without checking if there is one.

10 years agoqemu: Add cmd_per_lun, max_sectors to virtio-scsi
Mike Perez [Thu, 22 May 2014 18:22:52 +0000 (11:22 -0700)]
qemu: Add cmd_per_lun, max_sectors to virtio-scsi

This introduces two new attributes "cmd_per_lun" and "max_sectors" same
with the names QEMU uses for virtio-scsi. An example of the XML:

<controller type='scsi' index='0' model='virtio-scsi' cmd_per_lun='50'
max_sectors='512'/>

The corresponding QEMU command line:

-device virtio-scsi-pci,id=scsi0,cmd_per_lun=50,max_sectors=512,
bus=pci.0,addr=0x3

Signed-off-by: Mike Perez <thingee@gmail.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agoAdd invariant TSC cpu flag
Ján Tomko [Tue, 6 May 2014 11:55:44 +0000 (13:55 +0200)]
Add invariant TSC cpu flag

Add suport for invariant TSC flag (CPUID 0x80000007, bit 8 of EDX).
If this flag is enabled, the TSC ticks at a constant rate across
all ACPI P-, C- and T-states.

This can be enabled by adding:
<feature name='invtsc'/>
to the <cpu> element.

Migration and saving the domain does not work with this flag.

QEMU support: http://git.qemu.org/?p=qemu.git;a=commitdiff;h=303752a

The feature name "invtsc" differs from the name "" used by the linux kernel:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/x86/kernel/cpu/powerflags.c?id=30321c7b#n18

10 years agoqemu: raise an error when trying to use readonly ide disks
Giuseppe Scrivano [Mon, 30 Jun 2014 10:05:06 +0000 (12:05 +0200)]
qemu: raise an error when trying to use readonly ide disks

The IDE bus doesn't support readonly disks, so inform the user with an
error message instead of let qemu fail with a more obscure "Device
'ide-hd' could not be initialized" error message.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1112939
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoutil: unify extra asterisk in viralloc.h
Martin Kletzander [Mon, 30 Jun 2014 07:33:41 +0000 (09:33 +0200)]
util: unify extra asterisk in viralloc.h

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoPost-release version bump for new dev cycle
Martin Kletzander [Wed, 2 Jul 2014 06:16:13 +0000 (08:16 +0200)]
Post-release version bump for new dev cycle

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoRelease of libvirt-1.2.6
Daniel Veillard [Wed, 2 Jul 2014 05:50:18 +0000 (13:50 +0800)]
Release of libvirt-1.2.6

10 years agoqemu: copy: Accept 'format' parameter when copying to a non-existing img
Peter Krempa [Tue, 1 Jul 2014 11:52:51 +0000 (13:52 +0200)]
qemu: copy: Accept 'format' parameter when copying to a non-existing img

We have the following matrix of possible arguments handled by the logic
statement touched by this patch:
       | flags & _REUSE_EXT | !(flags & _REUSE_EXT)
-------+--------------------+----------------------
 format| (1)                | (2)
-------+--------------------+----------------------
!format| (3)                | (4)
-------+--------------------+----------------------

In cases 1 and 2 the user provided a format, in cases 3 and 4 not. The
user requests to use a pre-existing image in 1 and 3 and libvirt will
create a new image in 2 and 4.

The difference between cases 3 and 4 is that for 3 the format is probed
from the user-provided image, whereas in 4 we just use the existing disk
format.

The current code would treat cases 1,3 and 4 correctly but in case 2 the
format provided by the user would be ignored.

The particular piece of code was broken in commit 35c7701c64508f975dfeb8
but since it was introduced a few commits before that it was never
released as working.

10 years agostorage: gluster: Fix header reader function
Peter Krempa [Tue, 1 Jul 2014 14:54:11 +0000 (16:54 +0200)]
storage: gluster: Fix header reader function

Advance the right pointer to actually append to the buffer. We were
lucky that all reads were completed in one try.

10 years agoconf: storage: Add volume feature formatter for gluster pools
Peter Krempa [Tue, 1 Jul 2014 14:50:06 +0000 (16:50 +0200)]
conf: storage: Add volume feature formatter for gluster pools

Libvirt didn't output feature flags for images stored on native gluster.
Fix this trivially by adding a feature formatter callback.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1095035

10 years agobuild: link libvirt_conf with libxml
Martin Kletzander [Tue, 1 Jul 2014 15:09:48 +0000 (17:09 +0200)]
build: link libvirt_conf with libxml

Since there is code using functions from the libxml library,
libvirt_conf should have that in LIBADD so it can be linked against
even without libvirt_util (which usually deals with the error itself,
since libvirt_util has libxml in LIBADD).  The same applies to
storage_backend.c.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agovboxsnapshotxmltest: Don't write to a file in abs_srcdir
Michal Privoznik [Tue, 1 Jul 2014 13:23:36 +0000 (15:23 +0200)]
vboxsnapshotxmltest: Don't write to a file in abs_srcdir

In the test, the snapshot XML is written into a file that's located
under:

  abs_srcdir/vboxsnapshotxmldata/testResult.vbox

However, the abs_srcdir doesn't have to be necessarily writable. It
should have been abs_builddir instead. Moreover, the label in the func
creating the file is called 'fail' while it fulfils the duty of
'cleanup' label.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agosecurityselinuxlabeltest: Don't create dummy file in the srcdir
Michal Privoznik [Tue, 1 Jul 2014 12:52:28 +0000 (14:52 +0200)]
securityselinuxlabeltest: Don't create dummy file in the srcdir

At the very beginning of the test we check if the underlying
filesystem supports extended attributes as they are used to store fake
SELinux labels. In order to check that, a dummy file is created and
semi-random attribute is set. However, the file is created under:

  abs_srcdir "/securityselinuxlabeldata/testxattr"

which has two problems: abs_srcdir is not required to be writable, so
it should have been abs_builddir. The second one is - there's no
"securityselinuxlabeldata" folder under abs_builddir. The problem was
introduced in caf164f1.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoReport one error less when getting net dev speed
Ján Tomko [Mon, 30 Jun 2014 13:00:33 +0000 (15:00 +0200)]
Report one error less when getting net dev speed

virFileReadAll already logs an error. If reading the 'speed' file
fails with EINVAL, we log an error even though we ignore it. If it
fails with other errors, we log two errors.

Use virFileReadAllQuiet - ignore EINVAL and report just one error
in other cases.

Fixes this error on libvirtd startup:
2014-06-30 12:47:14.583+0000: 20971: error : virFileReadAll:1297 :
Failed to read file '/sys/class/net/wlan0/speed': Invalid argument

10 years agoIntroduce virFileReadAllQuiet
Ján Tomko [Mon, 30 Jun 2014 12:59:42 +0000 (14:59 +0200)]
Introduce virFileReadAllQuiet

Just like virFileReadAll, but returns -errno instead
of reporting errors. Useful for ignoring some errors.

10 years agoOnly detect PCI Express devices as root in udev nodedev driver
Ján Tomko [Mon, 30 Jun 2014 13:18:23 +0000 (15:18 +0200)]
Only detect PCI Express devices as root in udev nodedev driver

This stops the error message spam when running unprivileged
libvirtd:
2014-06-30 12:38:47.990+0000: 631: error : virPCIDeviceConfigOpen:300 :
Failed to open config space file
'/sys/bus/pci/devices/0000:00:00.0/config': Permission denied

Reported by Daniel Berrange:
https://www.redhat.com/archives/libvir-list/2014-June/msg01082.html

10 years agoTrack privileged state in udev nodedev driver
Ján Tomko [Mon, 30 Jun 2014 13:16:33 +0000 (15:16 +0200)]
Track privileged state in udev nodedev driver

Remember if libvirtd is running as root or not.

10 years agolibxl: add PV console if not explicitly specified
Jim Fehlig [Mon, 30 Jun 2014 16:20:38 +0000 (10:20 -0600)]
libxl: add PV console if not explicitly specified

Xen PV domains always have a PV console, so add one to the domain
config via post-parse callback if not explicitly specified in
the XML.  The legacy Xen driver behaves similarly, causing a
regression when switching to the new Xen toolstack.  I.e.

  virsh console pv-domain

will no longer work after upgrading a xm/xend stack to xl/libxl.

10 years agobuild: fix 'make syntax-check' after commit c6cf5df3
Jim Fehlig [Tue, 1 Jul 2014 00:48:19 +0000 (18:48 -0600)]
build: fix 'make syntax-check' after commit c6cf5df3

The commit caused prohibit_long_lines to fail in src/Makefile.am.

10 years agovbox: fix linker error
Jim Fehlig [Mon, 30 Jun 2014 22:34:46 +0000 (16:34 -0600)]
vbox: fix linker error

Noticed the following error when building the vbox driver
in the openSUSE build service

CCLD     vboxsnapshotxmltest
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
../src/.libs/libvirt_driver_vbox_impl.a
(libvirt_driver_vbox_impl_la-vbox_snapshot_conf.o):
undefined reference to symbol 'xmlXPathRegisterNs@@LIBXML2_2.4.30'
/usr/lib64/libxml2.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

Fixed by adding LIBXML_LIBS to libvirt_driver_vbox_impl_la_LIBADD

10 years agolibxl: don't break the build on Xen>=4.5 because of libxl_vcpu_setaffinity()
Dario Faggioli [Mon, 30 Jun 2014 17:19:01 +0000 (19:19 +0200)]
libxl: don't break the build on Xen>=4.5 because of libxl_vcpu_setaffinity()

libxl interface for vcpu pinning is changing in Xen 4.5. Basically,
libxl_set_vcpuaffinity() now wants one more parameter. That is
representative of 'VCPU soft affinity', which libvirt does not use.

To mark such change, the macro LIBXL_HAVE_VCPUINFO_SOFT_AFFINITY is
defined. Use it as a gate and, if present, re-#define the calls from
the old to the new interface, to avoid breaking the build.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Cc: Jim Fehlig <jfehlig@suse.com>
Cc: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
10 years agoLXC: throw an error if we failed to get Idmap elements
Chen Hanxiao [Mon, 30 Jun 2014 03:42:43 +0000 (11:42 +0800)]
LXC: throw an error if we failed to get Idmap elements

Throwing an error is much friendly than just
"error: An error occurred, but the cause is unknown"

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
10 years agoqemu: snapshot: Save persistent domain config when taking external snapshot
Peter Krempa [Mon, 30 Jun 2014 11:44:26 +0000 (13:44 +0200)]
qemu: snapshot: Save persistent domain config when taking external snapshot

Commit 55bbb011b965c7962933604c70f61cef45e8ec04 introduced a regression
where we forgot to save the persistent domain configuration after an
external snapshot. This would make libvirt forget the snapshots and
effectively revert to the previous state in the following scenario:

1) Start VM
2) Take snapshot
3) Destroy VM
4) Restart libvirtd

Also fix spurious blank line added by patch mentioned above.

10 years agobhyve: fix build by fixing typo in variable name
Roman Bogorodskiy [Fri, 27 Jun 2014 15:04:41 +0000 (19:04 +0400)]
bhyve: fix build by fixing typo in variable name

Commit 80d0918b introduced a typo in variable name:

s/failIncomaptible/failIncompatible/

Pushed under the build breaker rule.

10 years agocpu: Add new Broadwell CPU model
Jiri Denemark [Wed, 18 Jun 2014 11:52:13 +0000 (13:52 +0200)]
cpu: Add new Broadwell CPU model

10 years agonet: merge virNetworkGetDHCPLeases and virNetworkGetDHCPLeasesForMAC
Peter Krempa [Thu, 26 Jun 2014 14:08:34 +0000 (16:08 +0200)]
net: merge virNetworkGetDHCPLeases and virNetworkGetDHCPLeasesForMAC

Instead of maintaining two very similar APIs, add the "@mac" parameter
to virNetworkGetDHCPLeases and kill virNetworkGetDHCPLeasesForMAC. Both
of those functions would return data the same way, so making @mac an
optional filter simplifies a lot of stuff.

10 years agoAdd test for type none model dac seclabel
Ján Tomko [Tue, 10 Jun 2014 08:19:40 +0000 (10:19 +0200)]
Add test for type none model dac seclabel

10 years agotest: add user_xattr check for securityselinuxlabeltest
Jincheng Miao [Mon, 9 Jun 2014 11:36:07 +0000 (19:36 +0800)]
test: add user_xattr check for securityselinuxlabeltest

libvirt unit test used setxattr with "user.libvirt.selinux" name to
emulate setfilecon of selinux. But for some old kernel filesystem
(like 2.6.32-431.el6.x86_64), if the filesystem is not mounted with
user_xattr flag, the setxattr with "user.libvirt.selinux" will fail.

So adding testUserXattrEnabled() in securityselinuxlabeltest.c,
if user_xattr is not enabled, skip this case.

The user_xattr is departed in newer kernel, therefore this commit is
only for the compatablity for old kernel.

Signed-off-by: Jincheng Miao <jmiao@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Tested-by: Scott Sullivan <ssullivan@liquidweb.com>
10 years agodocs: publish correct enum values
Eric Blake [Wed, 25 Jun 2014 20:54:36 +0000 (14:54 -0600)]
docs: publish correct enum values

We publish libvirt-api.xml for others to use, and in fact, the
libvirt-python bindings use it to generate python constants that
correspond to our enum values.  However, we had an off-by-one bug
that any enum that relied on C's rules for implicit initialization
of the first enum member to 0 got listed in the xml as having a
value of 1 (and all later members of the enum were equally
botched).

The fix is simple - since we add one to the previous value when
encountering an enum without an initializer, the previous value
must start at -1 so that the first enum member is assigned 0.

The python generator code has had the off-by-one ever since DV
first wrote it years ago, but most of our public enums were immune
because they had an explicit = 0 initializer.  The only affected
enums are:
- virDomainEventGraphicsAddressType (such as
VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV4), since commit 987e31e
(libvirt v0.8.0)
- virDomainCoreDumpFormat (such as VIR_DOMAIN_CORE_DUMP_FORMAT_RAW),
since commit 9fbaff0 (libvirt v1.2.3)
- virIPAddrType (such as VIR_IP_ADDR_TYPE_IPV4), since commit
03e0e79 (not yet released)

Thanks to Nehal J Wani for reporting the problem on IRC, and
for helping me zero in on the culprit function.

* docs/apibuild.py (CParser.parseEnumBlock): Fix implicit enum
values.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agolibxl: detect support for save and restore
Jim Fehlig [Tue, 24 Jun 2014 17:10:49 +0000 (11:10 -0600)]
libxl: detect support for save and restore

libxl does not support save, restore, or migrate on all architectures,
notably ARM.  Detect whether libxl supports these operations using
LIBXL_HAVE_NO_SUSPEND_RESUME.  If not supported, drop advertisement of
<migration_features>.

Found by Ian Campbell while improving Xen's OSSTEST infrastructure

http://lists.xen.org/archives/html/xen-devel/2014-06/msg02171.html

10 years agoqemu: fix guestfwd chardev option back how it was
Martin Kletzander [Thu, 26 Jun 2014 14:09:46 +0000 (16:09 +0200)]
qemu: fix guestfwd chardev option back how it was

Since commit d86c876a66e320b55220d00113027c9ad6199cff we are using
guestfwd=tcp:IP:PORT,chardev=ID for guestfwd specification, however,
that has not changed in qemu, so guestfwd does not work since.

Apart from that, guestfwd is not working with older qemu that doesn't
have QEMU_CAPS_DEVICE.

Both regressions exist since late 2009 and nobody found that (until
now), so I'm only fixing the first one.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1112066

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoAdd PKG_CONFIG_PATH to run.in script.
Daniel P. Berrange [Thu, 26 Jun 2014 10:53:20 +0000 (11:53 +0100)]
Add PKG_CONFIG_PATH to run.in script.

Allow people to build external bindings using the 'run' script
by defining the PKG_CONFIG_PATH var in it. eg to build Python
you could do

   ../libvirt/run python setup.py build

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agoFix typo s/SASL_CONF_DIR/SASL_CONF_PATH/ in QEMU VNC code
Daniel P. Berrange [Thu, 17 Oct 2013 15:05:03 +0000 (16:05 +0100)]
Fix typo s/SASL_CONF_DIR/SASL_CONF_PATH/ in QEMU VNC code

The QEMU VNC client arg code has a long standing typo
of SASL_CONF_DIR when it should be SASL_CONF_PATH for
the env variable name.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agoqemu: blockcopy: Don't remove existing disk mirror info
Peter Krempa [Wed, 25 Jun 2014 16:11:17 +0000 (18:11 +0200)]
qemu: blockcopy: Don't remove existing disk mirror info

When creating a new disk mirror the new struct is stored in a separate
variable until everything went well. The removed hunk would actually
remove existing mirror information for example when the api would be run
if a mirror still exists.

10 years agosecurity: nop: Avoid very long lines
Peter Krempa [Mon, 23 Jun 2014 14:41:31 +0000 (16:41 +0200)]
security: nop: Avoid very long lines

The function headers contain type on the same line as the name. When
combined with usage of ATTRIBUTE_UNUSED, the function headers were very
long. Shorten them by breaking the line after the type.

10 years agosecurity: Fix header formatting of a few functions
Peter Krempa [Mon, 23 Jun 2014 13:38:24 +0000 (15:38 +0200)]
security: Fix header formatting of a few functions

Some of the functions in the storage driver had their headers formatted
incorrectly.

10 years agosecurity: manager: Document behavior of disk label manipulation funcs
Peter Krempa [Thu, 19 Jun 2014 15:18:02 +0000 (17:18 +0200)]
security: manager: Document behavior of disk label manipulation funcs

virSecurityManagerSetDiskLabel and virSecurityManagerRestoreDiskLabel
don't have complementary semantics. Document the semantics to avoid
possible problems.

10 years agosecurity: manager: Unify function header format
Peter Krempa [Thu, 19 Jun 2014 15:09:59 +0000 (17:09 +0200)]
security: manager: Unify function header format

10 years agosecurity: manager: Avoid forward decl of virSecurityManagerDispose
Peter Krempa [Thu, 19 Jun 2014 15:01:10 +0000 (17:01 +0200)]
security: manager: Avoid forward decl of virSecurityManagerDispose

10 years agosecurity: Rename virSecurityManagerRestoreImageLabel to *Disk*
Peter Krempa [Wed, 18 Jun 2014 12:46:27 +0000 (14:46 +0200)]
security: Rename virSecurityManagerRestoreImageLabel to *Disk*

I'm going to add functions that will deal with individual image files
rather than whole disks. Rename the security function to make room for
the new one.

10 years agoutil: s/virStorageSourceClearBackingStore/virStorageSourceBackingStoreClear
Peter Krempa [Fri, 20 Jun 2014 08:40:45 +0000 (10:40 +0200)]
util: s/virStorageSourceClearBackingStore/virStorageSourceBackingStoreClear

Rename them to comply with the naming policy.

10 years agoFix a typo in a localized string
Daniel Veillard [Thu, 26 Jun 2014 07:47:16 +0000 (15:47 +0800)]
Fix a typo in a localized string

As pointed by Yuri Chornoivan in transifex:
https://fedora.transifex.com/projects/p/libvirt/translate/#uk/strings/27026506

10 years agovirConnectCompareCPU: Introduce FAIL_INCOMPATIBLE flag
Jiri Denemark [Wed, 28 May 2014 13:12:59 +0000 (15:12 +0200)]
virConnectCompareCPU: Introduce FAIL_INCOMPATIBLE flag

The new VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE flag for
virConnectCompareCPU can be used to get an error
(VIR_ERR_CPU_INCOMPATIBLE) describing the incompatibility instead of the
usual VIR_CPU_COMPARE_INCOMPATIBLE return code.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agocpuCompare*: Add support for reporting failure on incompatible CPUs
Jiri Denemark [Wed, 28 May 2014 13:11:57 +0000 (15:11 +0200)]
cpuCompare*: Add support for reporting failure on incompatible CPUs

When CPU comparison APIs return VIR_CPU_COMPARE_INCOMPATIBLE, the caller
has no clue why the CPU is considered incompatible with host CPU. And in
some cases, it would be nice to be able to get such info in a client
rather than having to look in logs.

To achieve this, the APIs can be told to return VIR_ERR_CPU_INCOMPATIBLE
error for incompatible CPUs and the reason will be described in the
associated error message.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agocpu: Cleanup coding style in generic CPU driver
Jiri Denemark [Wed, 28 May 2014 12:49:45 +0000 (14:49 +0200)]
cpu: Cleanup coding style in generic CPU driver

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoRemove redundant docs from libvirt.h
Jiri Denemark [Wed, 28 May 2014 12:46:49 +0000 (14:46 +0200)]
Remove redundant docs from libvirt.h

Only types and macros are documented in libvirt.h, APIs are documented
in the *.c file they are implemented in.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agovirsh: Remove bogus stat on log file
Jiri Denemark [Tue, 24 Jun 2014 08:50:10 +0000 (10:50 +0200)]
virsh: Remove bogus stat on log file

Let's just open the file right away and deal with errors. Moreover,
there's no reason to forbid logging to, e.g., a pipe.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoconf: whitespace tweak
Chen Fan [Wed, 25 Jun 2014 08:45:32 +0000 (16:45 +0800)]
conf: whitespace tweak

Fix missing whitespace when parsing 'managed' attribute.

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoenhance hostdev mode 'capabilities' process
Jincheng Miao [Wed, 25 Jun 2014 06:45:59 +0000 (14:45 +0800)]
enhance hostdev mode 'capabilities' process

Currently, only LXC has hostdev mode 'capabilities' support,
so the other drivers should forbid to define it in XML.
The hostdev mode check is added to devicesPostParseCallback()
for each hypervisor driver.

But there are some drivers lack function devicesPostParseCallback(),
so only add check for qemu, libxl, openvz, uml, xen, xenapi.

Signed-off-by: Jincheng Miao <jmiao@redhat.com>
10 years agostorage: Don't store parent directory of an image explicitly
Peter Krempa [Tue, 27 May 2014 13:32:21 +0000 (15:32 +0200)]
storage: Don't store parent directory of an image explicitly

The parent directory doesn't necessarily need to be stored after we
don't mangle the path stored in the image. Remove it and tweak the code
to avoid using it.

10 years agostorage: Don't canonicalize paths unnecessarily
Peter Krempa [Tue, 27 May 2014 12:49:41 +0000 (14:49 +0200)]
storage: Don't canonicalize paths unnecessarily

Store backing chain paths as non-canonical. The canonicalization step
will be already taken. This will allow to avoid storing unnecessary
amounts of data.

10 years agotests: virstoragetest: Remove unneeded relative test plumbing
Peter Krempa [Tue, 27 May 2014 12:15:31 +0000 (14:15 +0200)]
tests: virstoragetest: Remove unneeded relative test plumbing

After we don't test relative paths, remove even more unnecessary cruft
from the test code.

10 years agotests: virstoragetest: Don't test relative start of backing chains
Peter Krempa [Tue, 27 May 2014 11:43:08 +0000 (13:43 +0200)]
tests: virstoragetest: Don't test relative start of backing chains

libvirt always uses an absolute path to address the top image of an
image chain. Our storage test tests also the relative path which won't
ever be used. Additionally it makes the test more complicated.

10 years agoutil: storage: Remove now redundant backingRelative from virStorageSource
Peter Krempa [Tue, 27 May 2014 08:40:59 +0000 (10:40 +0200)]
util: storage: Remove now redundant backingRelative from virStorageSource

Now that we store only relative names in virStorageSource's member
relPath the backingRelative member is obsolete. Remove it and adapt the
code to the removal.

10 years agotests: virstoragetest: Remove now unused pathAbs
Peter Krempa [Tue, 27 May 2014 08:15:06 +0000 (10:15 +0200)]
tests: virstoragetest: Remove now unused pathAbs

Separately remove the now unused variable.

10 years agostorage: Store relative path only for relatively backed storage
Peter Krempa [Tue, 27 May 2014 08:05:57 +0000 (10:05 +0200)]
storage: Store relative path only for relatively backed storage

Due to various refactors and compatibility with the virstoragetest the
relPath field of the virStorageSource structure was always filled either
with the relative name or the full path in case of absolutely backed
storage. Return its original purpose to store only the relative name of
the disk if it is backed relatively and tweak the tests.

10 years agotests: virstoragetest: Remove "expBackingStore" field
Peter Krempa [Mon, 26 May 2014 14:05:44 +0000 (16:05 +0200)]
tests: virstoragetest: Remove "expBackingStore" field

Now that we changed ordering of the stored metadata so that the backing
store is described by the child element the test should reflect this
change too.

Remove the expected backing store field as it's actually described by
the next element in the backing chain, so there's no need for
duplication.

10 years agoutil: storage: Add helper to resolve relative path difference
Peter Krempa [Tue, 13 May 2014 08:10:56 +0000 (10:10 +0200)]
util: storage: Add helper to resolve relative path difference

This patch introduces a function that will allow us to resolve a
relative difference between two elements of a disk backing chain. This
function will be used to allow relative block commit and block pull
where we need to specify the new relative name of the image to qemu.

This patch also adds unit tests for the function to verify that it works
correctly.

10 years agoLXC: check whether we get MemSwap[Total|Usage]
Chen Hanxiao [Wed, 25 Jun 2014 01:57:32 +0000 (09:57 +0800)]
LXC: check whether we get MemSwap[Total|Usage]

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
10 years agoqemu: enum cleanups in "src/qemu/*"
Julio Faracco [Sun, 15 Jun 2014 16:32:56 +0000 (13:32 -0300)]
qemu: enum cleanups in "src/qemu/*"

As we are doing with the enum structures, a cleanup in "src/qemu/"
directory was done now. All the enums that were defined in the
header files were converted to typedefs in this directory. This
patch includes all the adjustments to remove conflicts when you do
this kind of change. "Enum-to-typedef"'s conversions were made in
"src/qemu/qemu_{capabilities, domain, migration, hotplug}.h".

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
10 years agolibxl: fix version annotation of migration functions
Jim Fehlig [Tue, 24 Jun 2014 17:12:21 +0000 (11:12 -0600)]
libxl: fix version annotation of migration functions

Commit 9b8d6e1e missed updating the libvirt version which
introduced support for domainMigrate*3Params functions.

10 years agobridge: leases: Fix potential crash caused by use after free
Peter Krempa [Tue, 24 Jun 2014 11:52:57 +0000 (13:52 +0200)]
bridge: leases: Fix potential crash caused by use after free

Don't free individual JSON array members as the array will be freed at
the end. This may potentially lead to a crash although it didn't crash
on my setup.

10 years agoFree DHCP leases file in networkGetDHCPLeasesHelper
Ján Tomko [Tue, 24 Jun 2014 12:40:14 +0000 (14:40 +0200)]
Free DHCP leases file in networkGetDHCPLeasesHelper

Introduced by commit ba51398

10 years agoRework remoteSerializeDHCPLease
Ján Tomko [Tue, 24 Jun 2014 12:37:55 +0000 (14:37 +0200)]
Rework remoteSerializeDHCPLease

Don't leak the temporary variables on success if NULL is returned
for that field.

Don't dereference NULL on failure to allocate some of the temporaries.

Introduced by commit 990c3b6

10 years agoFree file header in virStorageFileGetMetadataRecurse
Ján Tomko [Tue, 24 Jun 2014 12:35:59 +0000 (14:35 +0200)]
Free file header in virStorageFileGetMetadataRecurse

Introduced by commit 2bdb8b9

10 years agoChange 'interface' to 'iface' in virNetworkDHCPLease
Daniel P. Berrange [Tue, 24 Jun 2014 12:23:59 +0000 (13:23 +0100)]
Change 'interface' to 'iface' in virNetworkDHCPLease

Variables/fields named 'interface' clash with system
header symbols on some platforms.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agographics: remember graphics not auto allocated ports
Giuseppe Scrivano [Tue, 24 Jun 2014 11:34:18 +0000 (13:34 +0200)]
graphics: remember graphics not auto allocated ports

When looking for a port to allocate, the port allocator didn't take in
consideration ports that are statically set by the user.  Defining
these two graphics elements in the XML would cause an error, as the
port allocator would try to use the same port for the spice graphics
element:

    <graphics type='spice' autoport='yes'/>
    <graphics type='vnc' port='5900' autoport='no'/>

The new *[pP]ortReserved variables keep track of the ports that were
successfully tracked as used by the port allocator but that weren't
bound.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1081881
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agovirtportallocator: new function "virPortAllocatorSetUsed"
Giuseppe Scrivano [Tue, 24 Jun 2014 11:34:17 +0000 (13:34 +0200)]
virtportallocator: new function "virPortAllocatorSetUsed"

virPortAllocatorSetUsed permits to set a port as already used and
prevent the port allocator to use it without any attempt to bind it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agonet-dhcp-leases: Add virsh support
Nehal J Wani [Mon, 23 Jun 2014 21:01:52 +0000 (02:31 +0530)]
net-dhcp-leases: Add virsh support

Use virNetworkGetDHCPLeases and virNetworkGetDHCPLeasesForMAC in virsh.

The new feature supports the follwing methods:

1. Retrieve leases info for a given virtual network

2. Retrieve leases info for given network interface

tools/virsh-domain-monitor.c
   * Introduce new command : net-dhcp-leases
     Example Usage: net-dhcp-leases <network> [mac]

   virsh # net-dhcp-leases --network default6
   Expiry Time          MAC address        Protocol  IP address                Hostname        Client ID or DUID
   -------------------------------------------------------------------------------------------------------------------
   2014-06-16 03:40:14  52:54:00:85:90:e2  ipv4      192.168.150.231/24        fedora20-test   01:52:54:00:85:90:e2
   2014-06-16 03:40:17  52:54:00:85:90:e2  ipv6      2001:db8:ca2:2:1::c0/64   fedora20-test   00:04:b1:d8:86:42:e1:6a:aa:cf:d5:86:94:23:6f:94:04:cd
   2014-06-16 03:34:42  52:54:00:e8:73:eb  ipv4      192.168.150.181/24        ubuntu14-vm     -
   2014-06-16 03:34:46  52:54:00:e8:73:eb  ipv6      2001:db8:ca2:2:1::5b/64   -               00:01:00:01:1b:30:c6:aa:52:54:00:e8:73:eb

tools/virsh.pod
   * Document new command

src/internal.h
   * Introduce new macro: EMPTYSTR

10 years agonet-dhcp-leases: Private implementation inside network
Nehal J Wani [Mon, 23 Jun 2014 21:01:51 +0000 (02:31 +0530)]
net-dhcp-leases: Private implementation inside network

Query the network driver for the path of the custom leases file for the given
virtual network and parse it to retrieve info.

src/network/bridge_driver.c:
* Implement networkGetDHCPLeases
* Implement networkGetDHCPLeasesForMAC
* Implement networkGetDHCPLeasesHelper

10 years agonet-dhcp-leases: Implement the remote protocol
Nehal J Wani [Mon, 23 Jun 2014 21:01:50 +0000 (02:31 +0530)]
net-dhcp-leases: Implement the remote protocol

Implement RPC calls for virNetworkGetDHCPLeases, virNetworkGetDHCPLeasesForMAC

daemon/remote.c
   * Define remoteSerializeNetworkDHCPLeases,
            remoteDispatchNetworkGetDHCPLeases
   * Define remoteDispatchNetworkGetDHCPLeasesForMAC
   * Define helper function remoteSerializeDHCPLease

src/remote/remote_driver.c
   * Define remoteNetworkGetDHCPLeases
   * Define remoteNetworkGetDHCPLeasesForMAC
   * Define helper function remoteSerializeDHCPLease

src/remote/remote_protocol.x
   * New RPC procedure: REMOTE_PROC_NETWORK_GET_DHCP_LEASES
   * Define structs remote_network_dhcp_leases, remote_network_get_dhcp_leases_args,
                    remote_network_get_dhcp_leases_ret
   * New RPC procedure: REMOTE_PROC_NETWORK_GET_DHCP_LEASES_FOR_MAC
   * Define structs remote_network_dhcp_leases_for_mac, remote_network_get_dhcp_leases_for_mac_args,
                    remote_network_get_dhcp_leases_for_mac_ret

src/remote_protocol-structs
   * New structs added

src/rpc/gendispatch.pl
   * Add exception (s/Dhcp/DHCP) for auto-generating names of the remote functions
     in daemon/remote_dispatch.h

10 years agonet-dhcp-leases: Implement the public APIs
Nehal J Wani [Mon, 23 Jun 2014 21:01:49 +0000 (02:31 +0530)]
net-dhcp-leases: Implement the public APIs

Introduce 3 new APIs, virNetworkGetDHCPLeases, virNetworkGetDHCPLeasesForMAC
and virNetworkDHCPLeaseFree.

* virNetworkGetDHCPLeases: returns the dhcp leases information for a given
     virtual network.

  For DHCPv4, the information returned:
  - Network Interface Name
  - Expiry Time
  - MAC address
  - IAID (NULL)
  - IPv4 address (with type and prefix)
  - Hostname (can be NULL)
  - Client ID (can be NULL)

  For DHCPv6, the information returned:
  - Network Interface Name
  - Expiry Time
  - MAC address
  - IAID (can be NULL, only in rare cases)
  - IPv6 address (with type and prefix)
  - Hostname (can be NULL)
  - Client DUID

  Note: @mac, @iaid, @ipaddr, @clientid are in ASCII form, not raw bytes.
  Note: @expirytime can 0, in case the lease is for infinite time.

* virNetworkGetDHCPLeasesForMAC: returns the dhcp leases information for a
     given virtual network and specified MAC Address.

* virNetworkDHCPLeaseFree: allows the upper layer application to free the
     network interface object conveniently.

There is no support for flags, so user is expected to pass 0 for
both the APIs.

include/libvirt/libvirt.h.in:
  * Define virNetworkGetDHCPLeases
  * Define virNetworkGetDHCPLeasesForMAC
  * Define virNetworkDHCPLeaseFree

src/driver.h:
  * Define networkGetDHCPLeases
  * Define networkGetDHCPLeasesForMAC

src/libvirt.c:
  * Implement virNetworkGetDHCPLeases
  * Implement virNetworkGetDHCPLeasesForMAC
  * Implement virNetworkDHCPLeaseFree

src/libvirt_public.syms:
  * Export the new symbols

10 years agoFix shadowed variable with older gcc
Ján Tomko [Tue, 24 Jun 2014 10:53:44 +0000 (12:53 +0200)]
Fix shadowed variable with older gcc

Commit 2cff94c fixed the shadowed 'link' added by commit 975f0e2,
but forgot the 'link' added by commit 08aa22e.

10 years agoLXC: trivially support flag VIR_DRV_FEATURE_TYPED_PARAM_STRING
Chen Hanxiao [Tue, 24 Jun 2014 09:44:18 +0000 (17:44 +0800)]
LXC: trivially support flag VIR_DRV_FEATURE_TYPED_PARAM_STRING

Fix lxcDomainGetMemoryParameters and lxcDomainGetSchedulerParametersFlags:
virsh -c lxc:/// memtune DOMAIN
error: Unable to get number of memory parameters
error: unsupported flags (0x4) in function lxcDomainGetMemoryParameters

Introduced by commit 399394.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agovirNumaGetPages: Don't fail on huge page-less systems
Michal Privoznik [Mon, 23 Jun 2014 13:46:31 +0000 (15:46 +0200)]
virNumaGetPages: Don't fail on huge page-less systems

If we are running on a system that is not capable of huge pages (e.g.
because the kernel is not configured that way) we still try to open
"/sys/kernel/mm/hugepages/" which however does not exist. We should
be tolerant to this specific use case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agovirNumaGetPageInfo: Take huge pages into account
Michal Privoznik [Mon, 23 Jun 2014 13:04:11 +0000 (15:04 +0200)]
virNumaGetPageInfo: Take huge pages into account

On the Linux kernel, if huge pages are allocated the size they cut off
from memory is accounted under the 'MemUsed' in the meminfo file.
However, we want the sum to be subtracted from 'MemTotal'. This patch
implements this feature. After this change, we can enable reporting
of the ordinary system pages in the capability XML:

<capabilities>

  <host>
    <uuid>01281cda-f352-cb11-a9db-e905fe22010c</uuid>
    <cpu>
      <arch>x86_64</arch>
      <model>Haswell</model>
      <vendor>Intel</vendor>
      <topology sockets='1' cores='1' threads='1'/>
      <feature/>
      <pages unit='KiB' size='4'/>
      <pages unit='KiB' size='2048'/>
      <pages unit='KiB' size='1048576'/>
    </cpu>
    <power_management/>
    <migration_features/>
    <topology>
      <cells num='4'>
        <cell id='0'>
          <memory unit='KiB'>4048248</memory>
          <pages unit='KiB' size='4'>748382</pages>
          <pages unit='KiB' size='2048'>3</pages>
          <pages unit='KiB' size='1048576'>1</pages>
          <distances/>
          <cpus num='1'>
            <cpu id='0' socket_id='0' core_id='0' siblings='0'/>
          </cpus>
        </cell>
        ...
      </cells>
    </topology>
  </host>
</capabilities>

You can see the beautiful thing about this: if you sum up all the
<pages/> you'll get <memory/>.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agostorage: gluster: Avoid name shadow on older compilers
Peter Krempa [Tue, 24 Jun 2014 09:22:17 +0000 (11:22 +0200)]
storage: gluster: Avoid name shadow on older compilers

s/link/linkpath/g in virStorageFileBackendGlusterReadlinkCallback as
older gcc complains.

10 years agostorage: gluster: Add backend to return unique storage file path
Peter Krempa [Mon, 5 May 2014 16:04:16 +0000 (18:04 +0200)]
storage: gluster: Add backend to return unique storage file path

Use virStorageFileSimplifyPathInternal to canonicalize gluster paths
via a callback and use it for the unique volume path retrieval API.

10 years agoutil: storagefile: Introduce universal function to canonicalize paths
Peter Krempa [Fri, 2 May 2014 17:22:17 +0000 (19:22 +0200)]
util: storagefile: Introduce universal function to canonicalize paths

Introduce a common function that will take a callback to resolve links
that will be used to canonicalize paths on various storage systems and
add extensive tests.

10 years agoutil: string: Add helper to free non-NULL terminated string arrays
Peter Krempa [Mon, 19 May 2014 12:20:09 +0000 (14:20 +0200)]
util: string: Add helper to free non-NULL terminated string arrays

To free string lists with some strings stolen from the middle we need to
walk the complete array. Introduce a new helper that takes the string
list size to free such string lists.

10 years agolibxl: prefer qdisk for <driver name='file'>
Jim Fehlig [Fri, 20 Jun 2014 05:36:25 +0000 (23:36 -0600)]
libxl: prefer qdisk for <driver name='file'>

The libxl driver currently sets the disk backend to
LIBXL_DISK_BACKEND_TAP when <driver name='file'> is specified
in the <disk> config.  qdisk should be prefered with this
configuration, otherwise existing configuration such as the
following, which worked with the old Xen driver, will not work
with the libxl driver

  <disk type='file' device='cdrom'>
    <driver name='file'/>
    <source file='/path/to/some/iso'/>
    <target dev='hdc' bus='ide'/>
    <readonly/>
  </disk>

In addition, tap performs poorly compared to qdisk.

10 years agocmdFreepages: initialize @tmp
Michal Privoznik [Mon, 23 Jun 2014 18:25:22 +0000 (20:25 +0200)]
cmdFreepages: initialize @tmp

In the 404bac14 the @tmp variable was introduced. It's purpose is to
avoid typecasting when parsing --pagesize argument. However, if the
argument is not presented, tmp may be used uninitialized resulting in
bogus virNodeGetFreePages() API call:

virsh freepages --cellno 2
error: Failed to open file '/sys/devices/system/node/node2/hugepages/hugepages-4294967295kB/free_hugepages': No such file or directory

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoFix closedir usage in virNumaGetPages
Roman Bogorodskiy [Sat, 21 Jun 2014 15:24:04 +0000 (19:24 +0400)]
Fix closedir usage in virNumaGetPages

virNumaGetPages calls closedir(dir) in cleanup and dir could
be NULL if we jump there from the failed opendir() call.

While it's not harmful on Linux, FreeBSD libc crashes [1], so
make sure that dir is not NULL before calling closedir.

1: http://lists.freebsd.org/pipermail/freebsd-standards/2014-January/002704.html