]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
10 years agovbox_tmpl.c: Add function for undefining snapshot
Yohan BELLEGUIC [Mon, 19 May 2014 12:47:33 +0000 (14:47 +0200)]
vbox_tmpl.c: Add function for undefining snapshot

All snapshots information will be deleted from the vbox XML, but
differencing disks will be kept so the user will be able to redefine the
snapshot.

10 years agovbox_tmpl.c: Patch for redefining snapshots
Yohan BELLEGUIC [Mon, 19 May 2014 12:47:32 +0000 (14:47 +0200)]
vbox_tmpl.c: Patch for redefining snapshots

The machine is unregistered and its vbox XML file is changed in order to
add snapshot information. The machine is then registered with the
snapshot to redefine.

10 years agoAdd vbox_snapshot_conf struct
Yohan BELLEGUIC [Mon, 19 May 2014 12:47:31 +0000 (14:47 +0200)]
Add vbox_snapshot_conf struct

This structure contains the data to be saved in the VirtualBox XML file
and can be manipulated with severals exposed functions.
The structure is created by vboxSnapshotLoadVboxFile taking the
machine XML file.
It also can rewrite the XML by using vboxSnapshotSaveVboxFile.

10 years agovbox_tmpl.c: Better XML description for snapshots
Manuel VIVES [Mon, 19 May 2014 12:47:30 +0000 (14:47 +0200)]
vbox_tmpl.c: Better XML description for snapshots

It will be needed for the future patches because we will
redefine snapshots

10 years agoSELinux: don't fail silently when no label is present
Ján Tomko [Mon, 9 Jun 2014 14:23:52 +0000 (16:23 +0200)]
SELinux: don't fail silently when no label is present

This fixes startup of a domain with:
<seclabel type='none' model='dac'/>
on a host with selinux and dac drivers and
security_default_confined = 0

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

10 years agoqemu: ignore -nodefconfig and -nodefaults when parsing commandline
Laine Stump [Fri, 6 Jun 2014 13:03:58 +0000 (16:03 +0300)]
qemu: ignore -nodefconfig and -nodefaults when parsing commandline

The qemu driver always adds these options to the qemu commandlines,
but the commandline parser didn't recognize them, so sending a
libvirt-generated qemu commandline to its own argvtoxml would always
result in a warning message and a qemu namespace added to the
xml. Since the options don't add any functionality to the domain, they
should just be ignored (similar to -S).

Note that we can't yet add a test for this to qemuargv2xmltest,
because we would have to add QEMU_CAPS_NODEFCONFIG and
QEMU_CAPS_DEVICE to the capabilities for any corresponding
xml2argvtest, and QEMU_CAPS_DEVICE would necessitate having support
for parsing a memballoon device in order for qemuargv2xmltest to
pass. So we wait to add a test for -nodefconfig and -nodefaults until
after adding support for parsing -device virtio-balloon-*.

10 years agotest: display qemuParseCommandline warnings when VIR_TEST_DEBUG > 0
Laine Stump [Fri, 6 Jun 2014 12:40:31 +0000 (15:40 +0300)]
test: display qemuParseCommandline warnings when VIR_TEST_DEBUG > 0

qmeuargv2xmltest.c would fail any test that logged anything during
qemuParseCommandline(), but then discard the log message, even with
VIR_TEST_DEBUG=2. This patch outputs the log messages with
fprintf(stderr,...) when debug logging is on.

In the process of modifying that logic, the testInfo data was made
more similar to that of qemuxml2argvtest.c - rather than turning
info->extraFlags into a bool, an enum of flags is defined, the info
struct is given an "unsigned int flags", and FLAG_EXPECT_WARNING is
saved into info->flags, to be checked during the test; this will make
it easier to add other FLAG_EXPECT_* items in the future.

10 years agoparallels: Avoid possible leak of "cpu" from parallelsBuildCapabilities
Peter Krempa [Mon, 9 Jun 2014 07:36:30 +0000 (09:36 +0200)]
parallels: Avoid possible leak of "cpu" from parallelsBuildCapabilities

4d06af97d38c3648937eb8f732704379b3cd9e59 introduced a possible memory
leak of the memory allocated into the "cpu" pointer in
parallelsBuildCapabilities in the case "nodeGetInfo()" would fail right
after the allocation. Rearrange the code to avoid the possibility of the
leak.

Found by Coverity.

10 years agom4: bhyve: Fix check for the required bhyve programs
Peter Krempa [Fri, 6 Jun 2014 15:25:11 +0000 (17:25 +0200)]
m4: bhyve: Fix check for the required bhyve programs

bhyveload and bhyvectl wouldn't be checked otherwise as the configure
script wouldn't execute one of the tests:

checking for bhyve... /usr/local/sbin/bhyve
checking for bhyvectl... /usr/local/sbin/bhyvectl
checking for bhyveload... /usr/local/sbin/bhyveload
./configure: line 62602: test: too many arguments

Fix the shell statement testing the 3 binaries.

10 years agovmx: Relax virtualHW.version check
Matthias Bolte [Sat, 10 May 2014 14:36:56 +0000 (16:36 +0200)]
vmx: Relax virtualHW.version check

The original implementation of the VMX config parser assumed that the
virtualHW.version would have more influence on the content of the VMX
file than it actually seems to have. It started with accepting only
version 4. Additonal versions were added later without any additional
changes in the parser itself. This suggests that the influence of the
virtualHW.version on the content and format of the VMX file is small
or non-existent.

The parser worked without any changes across several virtualHW and
vSphere versions. So instead of adding new virtualHW.version values to
the parser as they come along, or adding an extra flag to allow unknown
virtualHW.version values just relax the check to require version 4 or
later.

10 years agoconf: alter disk mirror xml output
Eric Blake [Thu, 22 May 2014 04:39:57 +0000 (22:39 -0600)]
conf: alter disk mirror xml output

Now that we track a disk mirror as a virStorageSource, we might
as well update the XML to theoretically allow any type of
mirroring destination (not just a local file).  A later patch
will also be reusing <mirror> to track the block commit of the
top layer of a chain, which is another case where libvirt needs
to update the backing chain after the job is finally pivoted,
and since backing chains can have network backing files as the
destination to commit into, it makes more sense to display that
in the XML.

This patch changes output-only XML; it was already documented
that <mirror> does not affect a domain definition at this point
(because qemu doesn't provide persistent bitmaps yet).  Any
application that was starting a block copy job with older libvirt
and then relying on the domain XML to determine if it was
complete will no longer be able to access the file= and format=
attributes of mirror that were previously used.  However, this is
not going to be a problem in practice: the only time a block copy
job works is on a transient domain, and any app that is managing
a transient domain probably already does enough of its own
bookkeeping to know which file it is mirroring into without
having to re-read it from the libvirt XML.  The one thing that
was likely to be used in a mirroring job was the ready=
attribute, which is unchanged.  Meanwhile, I made sure the schema
and parser still accept the old format, even if we no longer
output it, so that upgrading from an older version of libvirt is
seamless.

* docs/schemas/domaincommon.rng (diskMirror): Alter definition.
* src/conf/domain_conf.c (virDomainDiskDefParseXML): Parse two
styles of mirror elements.
(virDomainDiskDefFormat): Output new style.
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror-old.xml: New
file, copied from...
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: ...here
before modernizing.
* tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old*: New
files.
* tests/qemuxml2xmltest.c (mymain): Test both styles.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoconf: store mirroring information in virStorageSource
Eric Blake [Wed, 21 May 2014 20:22:21 +0000 (14:22 -0600)]
conf: store mirroring information in virStorageSource

The current implementation of 'virsh blockcopy' (virDomainBlockRebase)
is limited to copying to a local file name.  But future patches want
to extend it to also copy to network disks.  This patch converts over
to a virStorageSourcePtr, although it should have no semantic change
visible to the user, in anticipation of those future patches being
able to use more fields for non-file destinations.

* src/conf/domain_conf.h (_virDomainDiskDef): Change type of
mirror information.
* src/conf/domain_conf.c (virDomainDiskDefParseXML): Localize
mirror parsing into new object.
(virDomainDiskDefFormat): Adjust clients.
* src/qemu/qemu_domain.c (qemuDomainDeviceDefPostParse):
Likewise.
* src/qemu/qemu_driver.c (qemuDomainBlockPivot)
(qemuDomainBlockJobImpl, qemuDomainBlockCopy): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoconf: store disk source as pointer, for easier manipulation
Eric Blake [Wed, 21 May 2014 23:13:12 +0000 (17:13 -0600)]
conf: store disk source as pointer, for easier manipulation

As part of the work on backing chains, I'm finding that it would
be easier to directly manipulate chains of pointers (adding a
snapshot merely adjusts pointers to form the correct list) rather
than copy data from one struct to another.  This patch converts
domain disk source to be a pointer.

In this patch, the pointer is ALWAYS allocated (thanks in part to
the previous patch forwarding all disk def allocation through a
common point), and all other changse are just mechanical fallout of
the new type; there should be no functional change.  It is possible
that we may want to leave the pointer NULL for a cdrom with no
medium in a later patch, but as that requires a closer audit of the
source to ensure we don't fault on a null dereference, I didn't do
it here.

* src/conf/domain_conf.h (_virDomainDiskDef): Change type of src.
* src/conf/domain_conf.c: Adjust all clients.
* src/security/security_selinux.c: Likewise.
* src/qemu/qemu_domain.c: Likewise.
* src/qemu/qemu_command.c: Likewise.
* src/qemu/qemu_conf.c: Likewise.
* src/qemu/qemu_process.c: Likewise.
* src/qemu/qemu_migration.c: Likewise.
* src/qemu/qemu_driver.c: Likewise.
* src/lxc/lxc_driver.c: Likewise.
* src/lxc/lxc_controller.c: Likewise.
* tests/securityselinuxlabeltest.c: Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoconf: consolidate disk def allocation
Eric Blake [Wed, 21 May 2014 22:50:41 +0000 (16:50 -0600)]
conf: consolidate disk def allocation

A future patch wants to create disk definitions with non-zero
default contents; to avoid crashes, all callers that allocate
a disk definition should go through a common point.

I found allocation points by looking for any code that increments
ndisks, as well as any matches for ALLOC.*disk.  Most places that
modified ndisks were covered by the parse from XML to domain/device
definition by initial domain creation or device hotplug; I also
hand-checked all drivers that generate a device struct on the
fly during getXMLDesc.

* src/conf/domain_conf.h (virDomainDiskDefNew): New prototype.
* src/conf/domain_conf.c (virDomainDiskDefNew): New function.
(virDomainDiskDefParseXML): Use it.
* src/parallels/parallels_driver.c (parallelsAddHddInfo):
Likewise.
* src/qemu/qemu_command.c (qemuParseCommandLine): Likewise.
* src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc): Likewise.
* src/vmx/vmx.c (virVMXParseDisk): Likewise.
* src/xenxs/xen_sxpr.c (xenParseSxprDisks, xenParseSxpr):
Likewise.
* src/xenxs/xen_xm.c (xenParseXM): Likewise.
* src/libvirt_private.syms (domain_conf.h): Export it.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoconf: store snapshot source as pointer, for easier manipulation
Eric Blake [Wed, 21 May 2014 21:21:02 +0000 (15:21 -0600)]
conf: store snapshot source as pointer, for easier manipulation

As part of the work on backing chains, I'm finding that it would
be easier to directly manipulate chains of pointers (adding a
snapshot merely adjusts pointers to form the correct list) rather
than copy data from one struct to another. This patch converts
snapshot source to be a pointer.

In this patch, the pointer is ALWAYS allocated (any code that
increases ndisks now also allocates a source pointer for each
new disk), and all other changes are just mechanical fallout of
the new type; there should be no functional change.  It is
possible that we may want to leave the pointer NULL for internal
snapshots in a later patch, but as that requires a closer audit
of the source to ensure we don't fault on a null dereference, I
didn't do it here.

* src/conf/snapshot_conf.h (_virDomainSnapshotDiskDef): Change
type of src.
* src/conf/snapshot_conf.c: Adjust all clients.
* src/qemu/qemu_conf.c: Likewise.
* src/qemu/qemu_driver.c: Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoFix virbitmaptest on 32-bit
Ján Tomko [Fri, 6 Jun 2014 14:50:33 +0000 (16:50 +0200)]
Fix virbitmaptest on 32-bit

My commit 7d8afc4 was passing the incorrect size to
virBitmapDataToString in the newly added test.

10 years agonodedev: Export NUMA node locality for PCI devices
Michal Privoznik [Wed, 7 May 2014 16:07:12 +0000 (18:07 +0200)]
nodedev: Export NUMA node locality for PCI devices

A PCI device can be associated with a specific NUMA node. Later, when
a guest is pinned to one NUMA node the PCI device can be assigned on
different NUMA node. This makes DMA transfers travel across nodes and
thus results in suboptimal performance. We should expose the NUMA node
locality for PCI devices so management applications can make better
decisions.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoImplement pretty flag for vcpuinfo and nodecpumap
Ján Tomko [Thu, 5 Jun 2014 11:16:00 +0000 (13:16 +0200)]
Implement pretty flag for vcpuinfo and nodecpumap

Report CPU affinities / online CPUs in human-readable form when
this flag is present:

Before:
CPU Affinity:   y-yy

After:
CPU Affinity:   0,2-3 (out of 4)

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

10 years agoIntroduce virBitmapDataToString
Ján Tomko [Thu, 5 Jun 2014 09:23:28 +0000 (11:23 +0200)]
Introduce virBitmapDataToString

For converting bitmap data to human-readable strings.

10 years agoAlways report an error if virBitmapFormat fails
Ján Tomko [Thu, 5 Jun 2014 09:24:24 +0000 (11:24 +0200)]
Always report an error if virBitmapFormat fails

It already reports an error if STRDUP fails.

10 years agoFormat NULL bitmap as an empty string
Ján Tomko [Thu, 5 Jun 2014 10:42:40 +0000 (12:42 +0200)]
Format NULL bitmap as an empty string

This simplifies the usage in {libxl,qemu}DomainGetNumaParameters
and it's needed for consistent error reporting in virBitmapFormat.

Also remove the forgotten ATTRIBUTE_NONNULL marker.

10 years agovirsh: Separate API calls and result printing in cmdVcpuinfo
Ján Tomko [Thu, 5 Jun 2014 08:42:23 +0000 (10:42 +0200)]
virsh: Separate API calls and result printing in cmdVcpuinfo

This allows reuse of the result printing code.

10 years agovirsh: Invert logic in cmdVcpuinfo
Ján Tomko [Thu, 5 Jun 2014 08:42:19 +0000 (10:42 +0200)]
virsh: Invert logic in cmdVcpuinfo

Initialize 'ret' to false and introduce a cleanup label.

10 years agoParallels: Include CPU info in the capabilities XML
Alexander Burluka [Thu, 5 Jun 2014 05:50:06 +0000 (09:50 +0400)]
Parallels: Include CPU info in the capabilities XML

Openstack uses (or will start to using) CPU info from the
capabilities XML. So this section is expanded, added CPU info
about arch, type and info about number of cores, sockets and threads.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoParallels: add connectBaselineCPU()
Alexander Burluka [Thu, 5 Jun 2014 05:50:05 +0000 (09:50 +0400)]
Parallels: add connectBaselineCPU()

Openstack Nova (starting at Icehouse release) requires this function
to start VM.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoParallels: add domainGetVcpus()
Alexander Burluka [Thu, 5 Jun 2014 05:50:04 +0000 (09:50 +0400)]
Parallels: add domainGetVcpus()

OpenStack Nova requires this function
to start VM instance. Cpumask info is obtained via prlctl utility.
Unlike KVM, Parallels Cloud Server is unable to set cpu affinity
mask for every VCpu. Mask is unique for all VCpu. You can set it
using 'prlctl set <vm_id|vm_name> --cpumask <{n[,n,n1-n2]|all}>'
command. For example, 'prlctl set SomeDomain --cpumask 0,1,5-7'
would set this mask to yy---yyy.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agomaint: prohibit empty first lines
Martin Kletzander [Tue, 18 Mar 2014 10:29:12 +0000 (11:29 +0100)]
maint: prohibit empty first lines

Based on discussion with Eric:

https://www.redhat.com/archives/libvir-list/2014-March/msg01001.html

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoRemove unnecessary empty first lines
Martin Kletzander [Fri, 6 Jun 2014 08:51:52 +0000 (10:51 +0200)]
Remove unnecessary empty first lines

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agotranslations: Don't leave default template fields in .po files
Martin Kletzander [Tue, 3 Jun 2014 15:18:33 +0000 (17:18 +0200)]
translations: Don't leave default template fields in .po files

New gettext-0.19 doesn't like it and we can't build without it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoFix storage format probing
Ján Tomko [Thu, 5 Jun 2014 16:47:21 +0000 (18:47 +0200)]
Fix storage format probing

Commit fff74b2 moved the probing into virStorageFileGetMetadataFromBuf
but didn't update the format in volume definition.

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

10 years agoSimplify conditions in virStorageBackendProbeTarget
Ján Tomko [Thu, 5 Jun 2014 16:22:48 +0000 (18:22 +0200)]
Simplify conditions in virStorageBackendProbeTarget

Jump out early if no metadata was detected (for directories).
Join the error and cleanup labels.

10 years agoDon't reuse 'ret' variable in virStorageBackendProbeTarget
Ján Tomko [Thu, 5 Jun 2014 16:19:16 +0000 (18:19 +0200)]
Don't reuse 'ret' variable in virStorageBackendProbeTarget

To match the convention:
ret - current function's return value
rc - other function's return values

10 years agoformatcaps: Rework and add stubs to document
Michal Privoznik [Thu, 5 Jun 2014 11:53:17 +0000 (13:53 +0200)]
formatcaps: Rework and add stubs to document

At the moment we are missing even basic documentation on our
capabilities XML. Without demand on completeness, I'm
reorganizing the document structure and adding very basic
documentation to two major components of the capabilities XML.
These stubs are intended to be enhanced in the future.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agovircaps2xmltest: Introduce basic testing
Michal Privoznik [Thu, 5 Jun 2014 11:53:16 +0000 (13:53 +0200)]
vircaps2xmltest: Introduce basic testing

For now only one test is introduced. It's purpose in life
is to check we don't break NUMA host distances XML format.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agolibxl: add migration support
Jim Fehlig [Thu, 8 May 2014 21:56:51 +0000 (15:56 -0600)]
libxl: add migration support

This patch adds initial migration support to the libxl driver,
using the VIR_DRV_FEATURE_MIGRATION_PARAMS family of migration
functions.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agolibxl: introduce libxlDomainDefCheckABIStability
Jim Fehlig [Wed, 4 Jun 2014 20:02:27 +0000 (14:02 -0600)]
libxl: introduce libxlDomainDefCheckABIStability

Introduce a simple libxlDomainDefCheckABIStability() function that
can be used check ABI stability between two virDomainDef objects.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agomaint: detect VPATH builds when checking for gnulib update
Eric Blake [Wed, 4 Jun 2014 21:48:20 +0000 (15:48 -0600)]
maint: detect VPATH builds when checking for gnulib update

I accidentally typed 'make' in the srcdir of a VPATH build, and
was surprised to see this:

$ make
/bin/sh: s/^[ +-]//;s/ .*//: No such file or directory
INFO: gnulib update required; running ./autogen.sh first
make: -n: Command not found
./autogen.sh
I am going to run ./configure with no arguments - if you wish
to pass any to it, please specify them on the ./autogen.sh command line.
running bootstrap...
./bootstrap: Bootstrapping from checked-out libvirt sources...
./bootstrap: getting gnulib files...

Oops - we're trying to execute some fairly bogus command names,
and then trying to configure in-tree (which breaks all existing
VPATH builds, since automake refuses to do a VPATH build if it
detects an in-tree configure).  The third line (executing "-n")
is fixed by updating to the latest gnulib; the rest of the problem
is fixed by copying the same filtering in our cfg.mk as what
gnulib just added, so that we avoid any $(shell) invocations which
in turn depend on variables that are only populated by a working
Makefile.  With that in place, we are back to the much nicer:

$ make
There seems to be no Makefile in this directory.
You must run ./configure before running 'make'.
make: *** [abort-due-to-no-makefile] Error 1

Additionally, although harder to see - there was a trailing space in
the message warning us that autogen would run an in-tree configure.

* .gnulib: Update to latest, in part for maint.mk improvements.
* cfg.mk (_update_required): Don't check for update in
unconfigured directory.
* autogen.sh (no_git): Drop trailing space.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agomaint: optimize locale.h syntax check
Eric Blake [Wed, 4 Jun 2014 17:07:59 +0000 (11:07 -0600)]
maint: optimize locale.h syntax check

Reusing the maint.mk code allows for a more efficient syntax check
(fewer grep processes), and a more compact representation of what
we are really checking for in commit 1919e35.

* cfg.mk (sc_require_locale_h): Use maint.mk loop instead of
rolling our own.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agovirnuma: Check for numa_bitmask_isbitset presence
Michal Privoznik [Wed, 4 Jun 2014 12:39:01 +0000 (14:39 +0200)]
virnuma: Check for numa_bitmask_isbitset presence

On some systems, libnuma can be present but it's so ancient that
it misses some symbols that virNumaGetDistances() needs. To be
more precise: numa_bitmask_isbitset() and numa_nodes_ptr are the
symbols in question. Fortunately, they were both introduced in
the same release so it's sufficient for us to check for only one
of them. And the winner is numa_bitmask_isbitset().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agocfg.mk: Introduce rule for setlocale()
Michal Privoznik [Wed, 4 Jun 2014 08:57:21 +0000 (10:57 +0200)]
cfg.mk: Introduce rule for setlocale()

In the past we had some issues where setlocale() was called without
corresponding include of locale.h. While on some systems this may
work, on others the compilation failed. We should have a syntax-check
rule for that to prevent this from happening again.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agovirnuma: Implement virNumaGetDistances stub for non-NUMA
Michal Privoznik [Wed, 4 Jun 2014 09:05:34 +0000 (11:05 +0200)]
virnuma: Implement virNumaGetDistances stub for non-NUMA

In case the libvirt is built without numactl support, we're
missing the virNumaGetDistances() stub so the linking fails:

  CCLD     libvirt_lxc
libvirt_lxc-nodeinfo.o: In function `virNodeCapsGetSiblingInfo':
/home/zippy/tmp/libvirt.git/src/nodeinfo.c:1763: undefined reference to `virNumaGetDistances'
collect2: error: ld returned 1 exit status
make[3]: *** [libvirt_lxc] Error 1

The issue was introduced in 77c830d8c4.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agovirCaps: Expose distance between host NUMA nodes
Michal Privoznik [Tue, 3 Jun 2014 13:18:27 +0000 (15:18 +0200)]
virCaps: Expose distance between host NUMA nodes

If user or management application wants to create a guest,
it may be useful to know the cost of internode latencies
before the guest resources are pinned. For example:

<capabilities>

  <host>
    ...
    <topology>
      <cells num='2'>
        <cell id='0'>
          <memory unit='KiB'>4004132</memory>
          <distances>
            <sibling id='0' value='10'/>
            <sibling id='1' value='20'/>
          </distances>
          <cpus num='2'>
            <cpu id='0' socket_id='0' core_id='0' siblings='0'/>
            <cpu id='2' socket_id='0' core_id='2' siblings='2'/>
          </cpus>
        </cell>
        <cell id='1'>
          <memory unit='KiB'>4030064</memory>
          <distances>
            <sibling id='0' value='20'/>
            <sibling id='1' value='10'/>
          </distances>
          <cpus num='2'>
            <cpu id='1' socket_id='0' core_id='0' siblings='1'/>
            <cpu id='3' socket_id='0' core_id='2' siblings='3'/>
          </cpus>
        </cell>
      </cells>
    </topology>
    ...
  </host>
  ...
</capabilities>

We can see the distance from node1 to node0 is 20 and within nodes 10.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agovirnuma: Introduce virNumaGetDistances
Michal Privoznik [Mon, 2 Jun 2014 10:06:56 +0000 (12:06 +0200)]
virnuma: Introduce virNumaGetDistances

The API gets a NUMA node and find distances to other nodes.  The
distances are returned in an array. If an item X within the array
equals to value of zero, then there's no such node as X.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agotests: monitor: json: Fix error message when returning json in json
Peter Krempa [Tue, 3 Jun 2014 15:12:48 +0000 (17:12 +0200)]
tests: monitor: json: Fix error message when returning json in json

The qemu JSON monitor test allows to test also expected command
arguments. As the error from the monitor simulator is returned as a
simulated qemu error (in JSON) all other JSON contained in the error
message needs to be escaped. This will happen if the monitor command
under test receives a JSON array as an argument.

This will improve the error message from:
libvirt:  error : internal error: cannot parse json { "error":  { "desc":
"Invalid value of argument 'keys' of command 'send-key': expected 'ble'
got '[{"type":"number","data":43},{"type":"number","data":26},
{"type":"number","data":46},{"type":"number","data":32}]'",
"class": "UnexpectedCommand" } }: lexical error: invalid string in json text.

To:
libvirt: QEMU Driver error : internal error: unable to execute QEMU
command 'send-key': Invalid value of argument 'keys' of command
'send-key': expected 'ble' got '[{"type":"number","data":43},
{"type":"number","data":26},{"type":"number","data":46},
{"type":"number","data":32}]'

This improvement will not have any effect on tests executing as
expected, but it will help test development.

10 years agonetwork: bridge: Avoid memory leak from networkBuildDhcpDaemonCommandLine
Peter Krempa [Tue, 3 Jun 2014 12:34:23 +0000 (14:34 +0200)]
network: bridge: Avoid memory leak from networkBuildDhcpDaemonCommandLine

If the leasehelper_path couldn't be found the code would leak the
freshly constructed command structure. Re-arrange code to avoid the
problem.

Found by coverity, broken by baafe668fa56767c031468ccd5df3e62eaa11370.

10 years agotests: Build virstoragetest only when storage driver is compiled too
Peter Krempa [Tue, 3 Jun 2014 09:47:31 +0000 (11:47 +0200)]
tests: Build virstoragetest only when storage driver is compiled too

virstoragetest now requires parts of the storage driver to be built.
Without this change the test can't be compiled on platforms that don't
build the storage driver (mingw).

make[2]: *** No rule to make target `../src/libvirt_driver_storage_impl.la', needed by `virstoragetest.exe'.  Stop.

Broken by commit 713cc3b0a7ff8ad42b4c13429b624d1b2b5a99f2

10 years agoqemu: monitor: Fix type of holdtime argument in qemuMonitorJSONSendKey
Peter Krempa [Tue, 3 Jun 2014 09:19:51 +0000 (11:19 +0200)]
qemu: monitor: Fix type of holdtime argument in qemuMonitorJSONSendKey

qemuMonitorJSONSendKey declares the "holdtime" argument as unsigned int
while the command was constructed in qemuMonitorJSONMakeCommand using
the "P" modifier which took a unsigned long from the variable
arguments which then made it possible to access uninitialized memory.

This broke the qemumonitorjsontest on 32bit fedora 20:
64) qemuMonitorJSONSendKey
... libvirt: QEMU Driver error : internal error: unsupported data type 'W' for arg 'WVS\83ì \8bD$0è\91wÿÿ\81ÃAå' FAILED

Uncovered by upstream commit f744b831c66d9e82453f7a96cab5eddf7570c253.

Additionally add test for the hold-time option.

10 years agolibxl: Avoid possible use of uninitialized mem in libxlDomainStart
Daniel P. Berrange [Mon, 2 Jun 2014 10:53:03 +0000 (11:53 +0100)]
libxl: Avoid possible use of uninitialized mem in libxlDomainStart

The 'libxl_domain_config' object is stack allocated which means its
memory contents are undefined. The libxl_domain_config_dispose() call
is only safe if the memory is initialized to a defined state. Not all
code paths which reach libxl_domain_config_dispose() will ensure that
libxl_domain_config_init() is called. Move the libxl_domain_config_init()
call earlier in the function to ensure all codepaths have defined
memory state.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agolibxl: Move virDomainXMLOptionNew into libxlCreateXMLConf
Daniel P. Berrange [Fri, 30 May 2014 14:53:12 +0000 (15:53 +0100)]
libxl: Move virDomainXMLOptionNew into libxlCreateXMLConf

To allow the test suite to creat the XML option object,
move the virDomainXMLOptionNew call into a libxlCreateXMLConf
method.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agolibxl: Don't pass libxlDriverPrivatePtr into libxlBuildDomainConfig
Daniel P. Berrange [Fri, 30 May 2014 13:48:56 +0000 (14:48 +0100)]
libxl: Don't pass libxlDriverPrivatePtr into libxlBuildDomainConfig

To make it easier to test, change libxlBuildDomainConfig so
that it takes a virPortAllocatorPtr instead of the larger
libxlDriverPrivatePtr object.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agolibxl: Don't pass virDomainObjPtr to libxlBuildDomainConfig
Daniel P. Berrange [Fri, 30 May 2014 13:46:35 +0000 (14:46 +0100)]
libxl: Don't pass virDomainObjPtr to libxlBuildDomainConfig

To make it easier to unit test, change libxlBuildDomainConfig
so that it takes 'virDomainDefPtr' and 'libxl_ctx *' objects
as separate parameters.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agoqemu: Return in from qemuDomainRemove*Device
Jiri Denemark [Tue, 3 Jun 2014 08:18:48 +0000 (10:18 +0200)]
qemu: Return in from qemuDomainRemove*Device

Some of the APIs already return int since they can produce errors that
need to be propagated. For consistency reasons, this patch changes the
rest of the APIs to also return int even though they do not fail or
report any errors.

10 years agoqemu: Remove character device backend only after frontend is gone
Jiri Denemark [Tue, 27 May 2014 11:30:04 +0000 (13:30 +0200)]
qemu: Remove character device backend only after frontend is gone

In general, we should only remove a backend after seeing DEVICE_DELETED
event for a corresponding frontend.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoqemu: Remove disk backend only after frontend is gone
Jiri Denemark [Tue, 27 May 2014 10:09:09 +0000 (12:09 +0200)]
qemu: Remove disk backend only after frontend is gone

In general, we should only remove a backend after seeing DEVICE_DELETED
event for a corresponding frontend. This doesn't make any difference for
disks attached using -drive or drive_add since QEMU automatically
removes their backends but it's still better to make our code
consistent. And it may start making difference in case we switch to
attaching disks using -blockdev.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoqemu: Remove interface backend only after frontend is gone
Jiri Denemark [Tue, 27 May 2014 09:50:41 +0000 (11:50 +0200)]
qemu: Remove interface backend only after frontend is gone

[1] reported that we are removing network's backend too early. I didn't
really get the reproducer but libvirt behaves strangely when a guest
does not confirm the removal, e.g., it does not support PCI hotplug. In
such case, detaching a network device leaves its frontend in place but
removes the backend, which makes the device unusable for the guest.
Moreover attaching the same device again succeeds and both the guest and
libvirt will see two network interfaces attached but only one of them is
actually working.

I checked with Paolo Bonzini and he confirmed we should only remove a
backend after seeing DEVICE_DELETED event for a corresponding frontend.

[1] https://www.redhat.com/archives/libvir-list/2014-March/msg01740.html

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agotests: storagetest: Unify and reformat storage chain format string
Peter Krempa [Mon, 26 May 2014 13:38:29 +0000 (15:38 +0200)]
tests: storagetest: Unify and reformat storage chain format string

All the fields crammed into two lines weren't easy to parse by human
eyes. Split up the format string into lines and put it into a central
variable so that changes in two places aren't necessary.

10 years agoqemu: json: Add format strings for optional command arguments
Peter Krempa [Tue, 13 May 2014 15:28:45 +0000 (17:28 +0200)]
qemu: json: Add format strings for optional command arguments

This patch adds option to specify that a json qemu command argument is
optional without the need to use if's or ternary operators to pass the
list. Additionally all the modifier characters are documented to avoid
user confusion.

10 years agoutil: string: Return element count from virStringSplit
Peter Krempa [Mon, 12 May 2014 07:46:37 +0000 (09:46 +0200)]
util: string: Return element count from virStringSplit

To allow using the array manipulation macros on the arrays returned by
virStringSplit we need to know the count of the elements in the array.
Modify virStringSplit to return this value, rename it and add a helper
with the old name so that we don't need to update all the code.

10 years agostorage: Traverse backing chains of network disks
Peter Krempa [Mon, 28 Apr 2014 13:09:32 +0000 (15:09 +0200)]
storage: Traverse backing chains of network disks

Now we don't need to skip backing chain detection for remote disks.

10 years agostorage: Change to new backing store parser
Peter Krempa [Mon, 5 May 2014 16:05:03 +0000 (18:05 +0200)]
storage: Change to new backing store parser

Use the new backing store parser in the backing chain crawler. This
change needs one test change where information about the NBD image are
now parsed differently.

10 years agostorage: Add infrastructure to parse remote network backing names
Peter Krempa [Fri, 25 Apr 2014 11:23:50 +0000 (13:23 +0200)]
storage: Add infrastructure to parse remote network backing names

Add parsers for relative and absolute backing names for local and remote
storage files.

This parser parses relative paths as relative to their parents and
absolute paths according to the protocol or local access.

For remote storage volumes, all URI based backing file names are
supported and for the qemu colon syntax the NBD protocol is supported.

10 years agostorage: Switch metadata crawler to use storage driver file access check
Peter Krempa [Mon, 28 Apr 2014 06:44:42 +0000 (08:44 +0200)]
storage: Switch metadata crawler to use storage driver file access check

Use virStorageFileAccess() to to check whether the file is accessible in
the main part of the metadata crawler.

10 years agostorage: Switch metadata crawler to use storage driver to read headers
Peter Krempa [Fri, 25 Apr 2014 19:38:40 +0000 (21:38 +0200)]
storage: Switch metadata crawler to use storage driver to read headers

Use virStorageFileReadHeader() to read headers of storage files possibly
on remote storage to retrieve the image metadata.

The backend information is now parsed by
virStorageFileGetMetadataInternal which is now exported from the util
source and virStorageFileGetMetadataFromFDInternal now doesn't need to
be exported.

10 years agostorage: Switch metadata crawler to use storage driver to get unique path
Peter Krempa [Thu, 24 Apr 2014 14:59:56 +0000 (16:59 +0200)]
storage: Switch metadata crawler to use storage driver to get unique path

Use the virStorageFileGetUniqueIdentifier() function to get a unique
identifier regardless of the target storage type instead of relying on
canonicalize_path().

A new function that checks whether we support a given image is
introduced to avoid errors for unimplemented backends.

10 years agostorage: backend: Add possibility to suppress errors from backend lookup
Peter Krempa [Thu, 24 Apr 2014 14:21:20 +0000 (16:21 +0200)]
storage: backend: Add possibility to suppress errors from backend lookup

Add a new function wrapper and tweak the storage file backend lookup
function so that it can be used without reporting error. This will be
useful in the metadata crawler code where we need silently break if
metadata retrieval is not supported for the current storage type.

10 years agotest: storage: Initialize storage source to correct type
Peter Krempa [Fri, 25 Apr 2014 19:44:06 +0000 (21:44 +0200)]
test: storage: Initialize storage source to correct type

Stat the path of the storage file being tested to set the correct type
into the virStorageSource. This will avoid breaking the test suite when
inquiring metadata of directory paths in the next patches.

10 years agostorage: Determine the local storage type right away
Peter Krempa [Fri, 25 Apr 2014 13:16:25 +0000 (15:16 +0200)]
storage: Determine the local storage type right away

When walking the backing chain we previously set the storage type to
_FILE and let the virStorageFileGetMetadataFromFDInternal update it to
the correct type later on.

This patch moves the actual storage type determination to the place
where we parse the backing store name so that the code can later be
switched to use virStorageFileReadHeader() directly.

10 years agostorage: Move virStorageFileGetMetadata to the storage driver
Peter Krempa [Thu, 24 Apr 2014 10:14:01 +0000 (12:14 +0200)]
storage: Move virStorageFileGetMetadata to the storage driver

My future work will modify the metadata crawler function to use the
storage driver file APIs to access the files instead of accessing them
directly so that we will be able to request the metadata for remote
files too. To avoid linking the storage driver to every helper file
using the utils code, the backing chain traversal function needs to be
moved to the storage driver source.

Additionally the virt-aa-helper and virstoragetest programs need to be
linked with the storage driver as a result of this change.

10 years agostorage: Add API to check accessibility of storage volumes
Peter Krempa [Sat, 26 Apr 2014 16:15:41 +0000 (18:15 +0200)]
storage: Add API to check accessibility of storage volumes

Add a storage driver API equivalent of the access() function.
Implementations for the filesystem and gluster backends are provided.

10 years agostorage: backend: Add unique id retrieval API
Peter Krempa [Tue, 22 Apr 2014 14:02:54 +0000 (16:02 +0200)]
storage: backend: Add unique id retrieval API

Different protocols have different means to uniquely identify a storage
file. This patch implements a storage driver API to retrieve a unique
string describing a volume. The current implementation works for local
storage only and returns the canonical path of the volume.

To add caching support the local filesystem driver now has a private
structure holding the cached string, which is created only when it's
initially accessed.

This patch provides the implementation for local files only for start.

10 years agoxenapi_utils: Adapt to enum cleanups
Michal Privoznik [Tue, 3 Jun 2014 07:18:58 +0000 (09:18 +0200)]
xenapi_utils: Adapt to enum cleanups

It was just very recently that we transfered from:

  enum virSomeEnumName{
      ...
  };

to:
  typedef enum {
      ...
  } virSomeEnumName;

This change requires some code adaptation, which wasn't done for
xenapi driver. With this fix we are able to build again.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agovirnuma.c: Fix some comments
Michal Privoznik [Mon, 2 Jun 2014 10:05:28 +0000 (12:05 +0200)]
virnuma.c: Fix some comments

In 9dd02965 the virNumaGetNodeMemory was introduced, however the
comment describing the function mentions virNumaGetNodeMemorySize.
And there's one typo in virNumaIsAvailable() description.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoconf: more enum cleanups in "src/conf/domain_conf.h"
Julio Faracco [Sun, 1 Jun 2014 00:22:30 +0000 (21:22 -0300)]
conf: more enum cleanups in "src/conf/domain_conf.h"

In "src/conf/domain_conf.h" there are many enum declarations. The
cleanup in this header filer was started, but it wasn't enough and
there are many other files that has enum variables declared. So, the
commit was starting to be big. This commit finish the cleanup in this
header file and in other files that has enum variables, parameters,
or functions declared.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoconf: enum cleanups in "src/conf/domain_conf.h"
Julio Faracco [Sun, 1 Jun 2014 00:22:29 +0000 (21:22 -0300)]
conf: enum cleanups in "src/conf/domain_conf.h"

In "src/conf/domain_conf.h" there are many enumerations (enum)
declarations to be converted as a typedef too. As mentioned before,
it's better to use a typedef for variable types, function types and
other usages. I think this file has most of those enum declarations
at "src/conf/". So, me and Eric Blake plan to keep the cleanups all
over the source code. This time, most of the files changed in this
commit are related to part of one file: "src/conf/domain_conf.h".

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
10 years agocpu: use typedefs for enums in "src/cpu/cpu_map.h"
Julio Faracco [Sun, 1 Jun 2014 00:22:28 +0000 (21:22 -0300)]
cpu: use typedefs for enums in "src/cpu/cpu_map.h"

In "src/cpu/" there are some enumerations (enum) declarations.
Similar to the recent cleanup to "src/util", "src/conf" and other
directories, it's better to use a typedef for variable types,
function types and other usages. Other enumeration and folders will
be changed to typedef's in the future. Specially, in files that are
in different places of "src/util" and "src/conf". Most of the files
changed in this commit are related to CPU (cpu_map.h) enums.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
10 years agovirsh-nodedev: Avoid spurious errors
Michal Privoznik [Mon, 2 Jun 2014 14:48:22 +0000 (16:48 +0200)]
virsh-nodedev: Avoid spurious errors

Our public free functions explicitly don't accept NULL pointers
(sigh). Therefore, callers must do something like this:

    if (dev)
        virNodeDeviceFree(dev);

And we are not doing that on two places I've found. This leads to
dummy error message thrown by virsh:

    virsh # nodedev-dumpxml nonexistent-device
    error: Could not find matching device 'nonexistent-device'
    error: invalid node device pointer in virNodeDeviceFree

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoDon't use AI_ADDRCONFIG when binding to wildcard addresses
Ján Tomko [Thu, 29 May 2014 09:21:25 +0000 (11:21 +0200)]
Don't use AI_ADDRCONFIG when binding to wildcard addresses

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

With parallel boot, network addresses might not yet be assigned [1],
but binding to wildcard addresses should work.

For non-wildcard addresses, ADDRCONFIG is still used. Document this
in libvirtd.conf.

[1] http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/

10 years agoqemu: Unref cfg when detaching hostdev interface
Jiri Denemark [Tue, 27 May 2014 09:49:53 +0000 (11:49 +0200)]
qemu: Unref cfg when detaching hostdev interface

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoqemu: Process DEVICE_DELETED event in a separate thread
Jiri Denemark [Mon, 26 May 2014 15:02:05 +0000 (17:02 +0200)]
qemu: Process DEVICE_DELETED event in a separate thread

Currently, we don not acquire any job when removing a device after
DEVICE_DELETED event was received from QEMU. This means that if there is
another API running at the time DEVICE_DELETED is delivered and the API
acquired a job, we may happily change the definition of the domain the
API is working with whenever it unlocks the domain object (e.g., to talk
with its monitor). That said, we have to acquire a job before finishing
device removal to make things safe. However, doing so in the main event
loop would cause a deadlock so we need to move most of the event handler
into a separate thread.

Another good reason for both acquiring a job and handling the event in a
separate thread is that we currently remove a device backend immediately
after removing its frontend while we should only remove the backend once
we already received DEVICE_DELETED event. That is, we will have to talk
to QEMU monitor from the event handler.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoqemu: Finish device removal in the original thread
Jiri Denemark [Mon, 26 May 2014 15:01:52 +0000 (17:01 +0200)]
qemu: Finish device removal in the original thread

If QEMU supports DEVICE_DELETED event, we always call
qemuDomainRemoveDevice from the event handler. However, we will need to
push this call away from the main event loop and begin a job for it (see
the following commit), we need to make sure the device is fully removed
by the original thread (and within its existing job) in case the
DEVICE_DELETED event arrives before qemuDomainWaitForDeviceRemoval times
out.

Without this patch, device removals would be guaranteed to never finish
before the timeout because the could would be blocked by the original
job being still active.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoFix build on freebsd
Pavel Hrdina [Mon, 2 Jun 2014 14:43:11 +0000 (16:43 +0200)]
Fix build on freebsd

On freebsd there isn't known "setlocale" so we have to include locale.h

10 years agoAdd helper program to create custom leases
Nehal J Wani [Mon, 2 Jun 2014 10:19:26 +0000 (11:19 +0100)]
Add helper program to create custom leases

Introduce helper program to catch events from dnsmasq and maintain a custom
lease file per network. It supports dhcpv4 and dhcpv6. The file is saved as
"<interface-name>.status".

Each lease contains the following info:
<expiry-time (epoch time)> <mac> <iaid> <ip-address> <hostname> <clientid>

Example of custom leases file content:
[
    {
        "iaid": "1221229",
        "ip-address": "2001:db8:ca2:2:1::95",
        "mac-address": "52:54:00:12:a2:6d",
        "hostname": "Fedora20",
        "client-id": "00:04:1a:c1:d9:6b:5a:0a:e2:bc:f8:4b:1e:37:2e:38:22:55",
        "expiry-time": 1393244216
    },
    {
        "ip-address": "192.168.150.208",
        "mac-address": "52:54:00:11:56:b3",
        "hostname": "Wani-PC",
        "client-id": "01:52:54:00:11:56:b3",
        "expiry-time": 1393244248
    }
]

src/Makefile.am:
   * Add options to compile the helper program

src/network/bridge_driver.c:
   * Introduce networkDnsmasqLeaseFileNameCustom()
   * Invoke helper program along with dnsmasq
   * Delete the .status file when corresponding n/w is destroyed.

src/network/leaseshelper.c
   * Helper program to create the custom lease file

10 years agovirsh: Check whether found volume is member of the specified storage pool
Peter Krempa [Fri, 30 May 2014 12:44:55 +0000 (14:44 +0200)]
virsh: Check whether found volume is member of the specified storage pool

When looking up storage volumes virsh uses multiple lookup steps. Some
of the steps don't require a pool name specified. This resulted into a
possibility that a volume would be part of a different pool than the
user specified:

Let's have a /var/lib/libvirt/images/test.qcow image in the 'default'
pool and a second pool 'emptypool':

Currently we'd return:
  $ virsh vol-info --pool emptypool /var/lib/libvirt/images/test.qcow
  Name:           test.qcow
  Type:           file
  Capacity:       100.00 MiB
  Allocation:     212.00 KiB

After the fix:
 $ tools/virsh vol-info --pool emptypool /var/lib/libvirt/images/test.qcow
 error: Requested volume '/var/lib/libvirt/images/test.qcow' is not in pool 'emptypool'

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

10 years agoBump version to 1.2.6 for new dev cycle
Daniel Veillard [Mon, 2 Jun 2014 01:53:30 +0000 (09:53 +0800)]
Bump version to 1.2.6 for new dev cycle

10 years agoForgot spec changelog in 1.2.5 commit
Daniel Veillard [Mon, 2 Jun 2014 01:52:44 +0000 (09:52 +0800)]
Forgot spec changelog in 1.2.5 commit

10 years agoRelease of libvirt-1.2.5
Daniel Veillard [Mon, 2 Jun 2014 01:47:05 +0000 (09:47 +0800)]
Release of libvirt-1.2.5

* docs/news.html.in: update for release
* po/*.po*: updated ukrainian localization and regenerated

10 years agodocs: bhyve driver documentation improvements
Roman Bogorodskiy [Sun, 11 May 2014 07:25:08 +0000 (11:25 +0400)]
docs: bhyve driver documentation improvements

- Document 'domxml-to-native' command
- Mention that the nmdm console support needs an appropriate
  kernel module loaded

10 years agoutil: fix DST end date in virtimetest timezones
Laine Stump [Sun, 1 Jun 2014 02:21:19 +0000 (05:21 +0300)]
util: fix DST end date in virtimetest timezones

Reported by: Roman Bogorodskiy <bogorodskiy@gmail.com>

Some of the tests for virTimeLocalOffsetFromUTC set an imaginary
timezone that attempts to force dyalight savings time active all the
time by setting a start date of 0/00:00:00 and end date of
366/23:59:59. Since the day is 0-based, 366 really means "day 367"
which will never occur - this was an attempt to eliminate problems
with DST not being active in some cases right around midnight on
January 1. Even though it didn't completely solve the problem, it
didn't seem to cause harm so it was left in the test timezones.

Although Linux glibc doesn't mind having a DST end date of 366,
FreeBSD refuses to use such timezones, so the tests fail. This patch
changes the 366 to 365.

This may or may not cause failure of the remaining DST tests around
midnight Jan 1. If so, we will need to disable those tests at year's
end too.

10 years agobuild: avoid compiler warning on 32-bit platform
Eric Blake [Fri, 30 May 2014 22:30:07 +0000 (16:30 -0600)]
build: avoid compiler warning on 32-bit platform

On a 32-bit platform:

virstringtest.c: In function 'mymain':
virstringtest.c:673: warning: this decimal constant is unsigned only in ISO C90

I already had a comment in the file about the 64-bit counterpart;
the easiest fix was to make both sites use the standardized macro
that is guaranteed to work.

* tests/virstringtest.c (mymain): Minimum signed integers are a pain.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoqemu: snapshot: Improve detection of mixed snapshots
Peter Krempa [Thu, 29 May 2014 09:02:43 +0000 (11:02 +0200)]
qemu: snapshot: Improve detection of mixed snapshots

Currently we don't support mixed (external + internal) snapshots. The
code detecting the snapshot type didn't make sure that the memory image
was consistent with the snapshot type leading into strange error
message:

 $ virsh snapshot-create-as --domain VM --diskspec vda,snapshot=internal --memspec snapshot=external,file=/tmp/blah
 error: internal error: unexpected code path

Fix the mixed detection code to detect this kind of mistake:

 $ virsh snapshot-create-as --domain VM --diskspec vda,snapshot=internal --memspec snapshot=external,file=/tmp/blah
 error: unsupported configuration: mixing internal and external targets for a snapshot is not yet supported

10 years agoqemu: snapshot: Reject internal active snapshot without memory state
Peter Krempa [Thu, 29 May 2014 08:52:57 +0000 (10:52 +0200)]
qemu: snapshot: Reject internal active snapshot without memory state

A internal snapshot of a active VM with the memory snapshot disabled
explicitly would actually still take the memory snapshot. Reject it
explicitly.

Before:
 $ virsh snapshot-create-as --domain VM --diskspec vda,snapshot=internal --memspec snapshot=no
 Domain snapshot 1401353155 created

After:
 $ virsh snapshot-create-as --domain VM --diskspec vda,snapshot=internal --memspec snapshot=no
 error: Operation not supported: internal snapshot of a running VM must include the memory state

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

10 years agoutil: storage: Fix crash of libvirtd on network backed guest block-pull
Peter Krempa [Thu, 29 May 2014 14:46:38 +0000 (16:46 +0200)]
util: storage: Fix crash of libvirtd on network backed guest block-pull

For guests backed by gluster volumes (or other network storage) we don't
fill the backing chain (see qemuDomainDetermineDiskChain). This leaves
the "relPath" field of the top image NULL. This causes a crash in
virStorageFileChainLookup() when looking up a backing element for such a
disk.

Since I'm working on adding support for network storage and one of the
steps will make the "relPath" field optional let's use STREQ_NULLABLE
instead of STREQ in virStorageFileChainLookup() to avoid the problem.

10 years agoutil: fix virTimeLocalOffsetFromUTC DST processing
Laine Stump [Tue, 27 May 2014 13:35:57 +0000 (16:35 +0300)]
util: fix virTimeLocalOffsetFromUTC DST processing

The original version of virTimeLocalOffsetFromUTC() would fail for
certain times of the day if daylight savings time was active. This
could most easily be seen by uncommenting the TEST_LOCALOFFSET() cases
that include a DST setting.

After a lot of experimenting, I found that the way to solve it in
almost all test cases is to set tm_isdst = -1 in the struct tm prior
to calling mktime(). Once this is done, the correct offset is returned
for all test cases at all times except the two hours just after
00:00:00 Jan 1 UTC - during that time, any timezone that is *behind*
UTC, and that is supposed to always be in DST will not have DST
accounted for in its offset.

I believe that the code of virTimeLocalOffsetFromUTC() actually is
correct for all cases, but the problem still encountered is due to our
inability to come up with a TZ string that properly forces DST to
*always* be active. Since a modfication of the (currently fixed)
expected result data to account for this would necessarily use the
same functions that we're trying to test, I've instead just made the
test program conditionally bypass the problematic cases if the current
date is either December 31 or January 1. This way we get maximum
testing during 363 days of the year, but don't get false failures on
Dec 31 and Jan 1.

10 years agovirsh: fix typos in virsh man page
Eric Blake [Thu, 29 May 2014 02:10:38 +0000 (20:10 -0600)]
virsh: fix typos in virsh man page

* tools/virsh.pod (attach-disk): Drop duplicate --config, fix typo
in --sourcetype.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agomaint: fix typo in previous patch
Eric Blake [Wed, 28 May 2014 22:10:26 +0000 (16:10 -0600)]
maint: fix typo in previous patch

Use correct variable name.

* m4/virt-selinux.m4: Fix one last variable name.

10 years agomaint: cleanup detection of const'ness of selinux ctx
Jim Fehlig [Wed, 28 May 2014 19:48:21 +0000 (13:48 -0600)]
maint: cleanup detection of const'ness of selinux ctx

Commit 292d3f2d fixed the build with libselinux 2.3, but missed
some suggestions by eblake

https://www.redhat.com/archives/libvir-list/2014-May/msg00977.html

This patch changes the macro introduced in 292d3f2d to either be
empty in the case of newer libselinux, or contain 'const' in the
case of older libselinux.  The macro is then used directly in
tests/securityselinuxhelper.c.

10 years agobuild: fix build with libselinux 2.3
Cédric Bosdonnat [Wed, 28 May 2014 12:44:08 +0000 (14:44 +0200)]
build: fix build with libselinux 2.3

Several function signatures changed in libselinux 2.3, now taking
a 'const char *' instead of 'security_context_t'.  The latter is
defined in selinux/selinux.h as

  typedef char *security_context_t;

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoqemu: managedsave: Don't spam logs with warnings about corrupted image
Peter Krempa [Wed, 28 May 2014 14:46:48 +0000 (16:46 +0200)]
qemu: managedsave: Don't spam logs with warnings about corrupted image

Even successful start of a VM from a managed save image would spam the
logs with the following message:

Unable to restore from managed state [path]. Maybe the file is
corrupted?

Re-arrange the logic to output the warning only when the image is
corrupted.

The flaw was introduced in commit cfc28c66.

10 years agoutils: storage: Canonicalize paths only for local filesystems
Peter Krempa [Wed, 28 May 2014 13:17:11 +0000 (15:17 +0200)]
utils: storage: Canonicalize paths only for local filesystems

Now that virStorageFileGetMetadataFromBuf is used only for remote
filesystems, don't canonicalize the path in it.

10 years agostorage: fs: Drop-in replace use of virStorageFileGetMetadataFromBuf
Peter Krempa [Wed, 28 May 2014 12:48:36 +0000 (14:48 +0200)]
storage: fs: Drop-in replace use of virStorageFileGetMetadataFromBuf

Use virStorageFileGetMetadataFromFD instead in
virStorageBackendProbeTarget as it now returns all required data and the
storage file is already open in a filedescriptor.

Also fix improper error code being returned when virFileReadHeaderFD
would fail as virStorageBackendUpdateVolTargetInfoFD would set the
return code to 0.