]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
7 years agoutil: netdevbridge: Refactor error handling in virNetDevBridgeCreate
Peter Krempa [Wed, 28 Jun 2017 12:14:53 +0000 (14:14 +0200)]
util: netdevbridge: Refactor error handling in virNetDevBridgeCreate

Replace the switch statement with a simpler if statement. This also
removes the fallthrough path that coverity was complaining about.

7 years agohotplug: Create helper to remove vport
John Ferlan [Wed, 28 Jun 2017 10:56:47 +0000 (06:56 -0400)]
hotplug: Create helper to remove vport

Combine and "clean up" a bit two places that are removing the vport

7 years agonodedev: Add check for NULL obj before call Unlock
John Ferlan [Wed, 28 Jun 2017 10:54:05 +0000 (06:54 -0400)]
nodedev: Add check for NULL obj before call Unlock

Commit id '95ea171b' was a bit too aggressive in removing the if (obj)
check since cleanup is reachable after Unlock and obj = NULL.

7 years agoqemu: hotplug: Disallow modification of vcpu 0 in inactive config
Peter Krempa [Wed, 28 Jun 2017 08:42:49 +0000 (10:42 +0200)]
qemu: hotplug: Disallow modification of vcpu 0 in inactive config

vcpu 0 must be always enabled and non-hotpluggable, thus you can't
modify it using the vcpu hotplug APIs. Disallow it so that users can't
create invalid configurations.

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

7 years agoman: Fix documentation errors about the paths of the config files
Lily Zhu [Wed, 28 Jun 2017 06:00:48 +0000 (14:00 +0800)]
man: Fix documentation errors about the paths of the config files

The default conf files, for example libvirtd.conf, virtlockd.conf, and
virtlogd.conf, should be located under the directory "/etc/libvirt" when
root as root, rather than "/etc". When run as non-root, the configuration
files should be located under "$XDG_CONFIG_HOME/libvirt/", rather than
"XDG_CONFIG_HOME".

Signed-off-by: Lily Zhu <lizhu@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agodocs: Add callback-related info to virStream{Abort,Finish}
Martin Kletzander [Tue, 20 Jun 2017 13:36:48 +0000 (15:36 +0200)]
docs: Add callback-related info to virStream{Abort,Finish}

When one has a non-blocking stream and aborts or finishes it without
removing the callback, any event loop invocation will trigger that
callback, but it cannot be removed any more.  We cannot remove the
callback automatically from virStream{Abort,Finish} functions due to
forward-compatibility.  So let's at least document this behaviour,
because it is not easy to find out the reason for.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agovirsh: Fix --help problem for domxml-to-native DOMAIN COMMAND
Daniel Liu [Tue, 27 Jun 2017 15:54:50 +0000 (11:54 -0400)]
virsh: Fix --help problem for domxml-to-native DOMAIN COMMAND

Resolves a bug in domxml-to-native command option, so that the
following command displays the help information correctly:
'virsh domxml-to-native --help'.

Signed-off-by: Daniel Liu <srwx4096@gmail.com>
Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
7 years agobhyve: add vga configuration for video driver
Roman Bogorodskiy [Tue, 9 May 2017 10:48:30 +0000 (14:48 +0400)]
bhyve: add vga configuration for video driver

Add support for vgaconf driver configuration. In domain xml it looks like
this:

  <video>
    <driver vgaconf='io|on|off'>
    <model .../>
  </video>

It was added with bhyve gop video in mind to allow users control how the
video device is exposed to the guest, specifically, how VGA I/O is
handled.

One can refer to the bhyve manual page to get more detailed description
of the possible VGA configuration options:

https://www.freebsd.org/cgi/man.cgi?query=bhyve&manpath=FreeBSD+12-current

The relevant part could be found using the 'vgaconf' keyword.

Also, add some tests for this new feature.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoRevert "qemu: Support chardevs with ARM virt machines"
Cole Robinson [Mon, 26 Jun 2017 14:48:33 +0000 (10:48 -0400)]
Revert "qemu: Support chardevs with ARM virt machines"

This reverts commit 70c9b44270f75bfb7a5701d81aa49380d139e8f0.

This commit breaks existing aarch64 machvirt configs with:

    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>

Which fails with:

error: Failed to start domain fedora25-aarch64
error: internal error: process exited while connecting to monitor:
2017-06-26T13:55:34.726293Z qemu-system-aarch64: -chardev pty,id=charserial0:
char device redirected to /dev/pts/5 (label charserial0)
2017-06-26T13:55:34.782121Z qemu-system-aarch64: -device
isa-serial,chardev=charserial0,id=serial0: No 'ISA' bus found for device
'isa-serial'

7 years agoconf: Copy loadparm in virDomainDeviceInfoCopy()
Andrea Bolognani [Mon, 26 Jun 2017 17:13:28 +0000 (19:13 +0200)]
conf: Copy loadparm in virDomainDeviceInfoCopy()

Commit 54fa1b44afc8 added virDomainDeviceInfo::loadparm
and updated virDomainDeviceInfoClear() accordingly, but
omitted the necessary virDomainDeviceInfoCopy() changes.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoHACKING: Drop from the git repository
Andrea Bolognani [Mon, 26 Jun 2017 06:45:44 +0000 (08:45 +0200)]
HACKING: Drop from the git repository

Despite being a generated file, HACKING has been tracked in
the git repository along with actual source files. As far as
I'm aware, it's the only generated file for which that happens.

Times and times again, people[1] have committed changes to
the source file without refreshing the generated copy at the
same time.

The rationale for tracking the generated file is to help out
people who just cloned the git repository looking to contribue;
however, README-hacking already contains enough information to
get perspective contributors to a place where they can simply
look at docs/hacking.html instead.

[1] Mostly me, to be honest

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoREADME: Remove 'git send-email' mention
Andrea Bolognani [Mon, 26 Jun 2017 08:48:20 +0000 (10:48 +0200)]
README: Remove 'git send-email' mention

The use of 'git send-email' is described in detail in the
contributor guidelines (docs/hacking.html), which are
mentioned in docs/contribute.html, the non-local version
of which is in turn mentioned in README.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoREADME: Various minor style tweaks
Andrea Bolognani [Mon, 26 Jun 2017 09:01:03 +0000 (11:01 +0200)]
README: Various minor style tweaks

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agodocs: Point to hacking.html from contribute.html
Andrea Bolognani [Mon, 26 Jun 2017 08:39:02 +0000 (10:39 +0200)]
docs: Point to hacking.html from contribute.html

People looking to help out should really go through the
contributor guidelines when getting started, so the more
documents point to them the better.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: Avoid fd leak on incoming tunneled migration
Jiri Denemark [Mon, 19 Jun 2017 15:00:28 +0000 (17:00 +0200)]
qemu: Avoid fd leak on incoming tunneled migration

While qemuProcessIncomingDefNew takes an fd argument and stores it in
qemuProcessIncomingDef structure, the caller is still responsible for
closing the file descriptor.

Introduced by commit v1.2.21-140-ge7c6f4575.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoREADME: Remove unnecessary empty line
Andrea Bolognani [Mon, 26 Jun 2017 08:14:38 +0000 (10:14 +0200)]
README: Remove unnecessary empty line

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoutil: Extract locale-related fixes into separate functions
Martin Kletzander [Thu, 22 Jun 2017 12:36:53 +0000 (14:36 +0200)]
util: Extract locale-related fixes into separate functions

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 years agoHACKING: Refresh after changes to source file
Andrea Bolognani [Mon, 26 Jun 2017 06:34:56 +0000 (08:34 +0200)]
HACKING: Refresh after changes to source file

Commit 79c1900fc1eb changed docs/hacking.html.in, but *of
course* I forgot once again to update the text-only version
of the file at the same time.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agohacking: Improve 'git send-email' documentation
Andrea Bolognani [Thu, 15 Jun 2017 03:25:31 +0000 (11:25 +0800)]
hacking: Improve 'git send-email' documentation

For the benefit of first time contributors, we point out that 'git
send-email' might have to be installed separately; however, we omit
the fact that some configuration will likely be needed before it
can successfully deliver patches to the mailing list.

Some minor tweaks to the existing contents are included as well.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemuMonitorTextAddDrive: Fail on unrecognized disk format
Michal Privoznik [Thu, 15 Jun 2017 13:46:32 +0000 (15:46 +0200)]
qemuMonitorTextAddDrive: Fail on unrecognized disk format

Since qemu commit 3ef6c40ad0b it can fail if trying to hotplug a
disk that is not qcow2 despite us saying it is. We need to error
out in that case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoevents: Avoid double free possibility on remote call failure
John Ferlan [Wed, 14 Jun 2017 11:32:15 +0000 (07:32 -0400)]
events: Avoid double free possibility on remote call failure

If a remote call fails during event registration (more than likely from
a network failure or remote libvirtd restart timed just right), then when
calling the virObjectEventStateDeregisterID we don't want to call the
registered @freecb function because that breaks our contract that we
would only call it after succesfully returning.  If the @freecb routine
were called, it could result in a double free from properly coded
applications that free their opaque data on failure to register, as seen
in the following details:

    Program terminated with signal 6, Aborted.
    #0  0x00007fc45cba15d7 in raise
    #1  0x00007fc45cba2cc8 in abort
    #2  0x00007fc45cbe12f7 in __libc_message
    #3  0x00007fc45cbe86d3 in _int_free
    #4  0x00007fc45d8d292c in PyDict_Fini
    #5  0x00007fc45d94f46a in Py_Finalize
    #6  0x00007fc45d960735 in Py_Main
    #7  0x00007fc45cb8daf5 in __libc_start_main
    #8  0x0000000000400721 in _start

The double dereference of 'pyobj_cbData' is triggered in the following way:

    (1) libvirt_virConnectDomainEventRegisterAny is invoked.
    (2) the event is successfully added to the event callback list
        (virDomainEventStateRegisterClient in
        remoteConnectDomainEventRegisterAny returns 1 which means ok).
    (3) when function remoteConnectDomainEventRegisterAny is hit,
        network connection disconnected coincidently (or libvirtd is
        restarted) in the context of function 'call' then the connection
        is lost and the function 'call' failed, the branch
        virObjectEventStateDeregisterID is therefore taken.
    (4) 'pyobj_conn' is dereferenced the 1st time in
        libvirt_virConnectDomainEventFreeFunc.
    (5) 'pyobj_cbData' (refered to pyobj_conn) is dereferenced the
         2nd time in libvirt_virConnectDomainEventRegisterAny.
    (6) the double free error is triggered.

Resolve this by adding a @doFreeCb boolean in order to avoid calling the
freeCb in virObjectEventStateDeregisterID for any remote call failure in
a remoteConnect*EventRegister* API. For remoteConnect*EventDeregister* calls,
the passed value would be true indicating they should run the freecb if it
exists; whereas, it's false for the remote call failure path.

Patch based on the investigation and initial patch posted by
fangying <fangying1@huawei.com>.

7 years agoqemu: Support chardevs with ARM virt machines
Christoffer Dall [Wed, 7 Jun 2017 21:13:30 +0000 (23:13 +0200)]
qemu: Support chardevs with ARM virt machines

The function to check if -chardev is supported by QEMU was written a
long time ago, where adding chardevs did not make sense on the fixed ARM
platforms.  Since then, we now have a general purpose virt platform,
which should support plugging in any device over PCIe which is supported
in a similar fashion on x86.

Signed-off-by: Christoffer Dall <cdall@linaro.org>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agovirsh: add [--domain DOMAIN] option to domxml-to-native DOMAIN COMMAND
Daniel Liu [Fri, 2 Jun 2017 15:04:52 +0000 (11:04 -0400)]
virsh: add [--domain DOMAIN] option to domxml-to-native DOMAIN COMMAND

The option allows someone to run domain-to-native on already existing
domain without the need of supplying their XML.  It is basically
wrapper around 'virsh dumpxml  | virsh domxml-to-native /dev/stdin'.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=835476
Signed-off-by: Daniel Liu <srwx4096@gmail.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoutil: Force reading of meta data to get encryption capacity value
John Ferlan [Thu, 15 Jun 2017 18:32:43 +0000 (14:32 -0400)]
util: Force reading of meta data to get encryption capacity value

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

As it turns out the volume create, build, and refresh path was not peeking
at the meta data, so immediately after a create operation the value displayed
for capacity was still incorrect. However, if a pool refresh was done the
correct value was fetched as a result of a meta data peek.

The reason is it seems historically if the file type is RAW then peeking
at the file just took the physical value for the capacity. However, since
we know if it's an encrypted file, then peeking at the meta data will be
required in order to get a true capacity value.

So check for encryption in the source and if present, use the meta data
in order to fill in the capacity value and set the payload_offset.

7 years agotests: hotplug: Test disks with duplicate WWNs
Peter Krempa [Fri, 23 Jun 2017 12:11:25 +0000 (14:11 +0200)]
tests: hotplug: Test disks with duplicate WWNs

7 years agoRevert "qemu: Check duplicate WWNs also for hotplugged disks"
Peter Krempa [Wed, 21 Jun 2017 09:44:59 +0000 (11:44 +0200)]
Revert "qemu: Check duplicate WWNs also for hotplugged disks"

Similarly to commit 5da28cc3069b573f54f0bcaf8eb75476bcfdc6e9 this check
actually does not make sense since duplicate WWNs are used e.g. when
multipathing disks.

This reverts commit 780fe4e4baf7e2f10f65ba1a34f9274fc547cad2.

7 years agovirNetDevOpenvswitchInterfaceStats: Be more forgiving when fetching stats
Michal Privoznik [Wed, 14 Jun 2017 13:23:29 +0000 (15:23 +0200)]
virNetDevOpenvswitchInterfaceStats: Be more forgiving when fetching stats

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

When fetching stats for a vhost-user type of interface, we run
couple of ovs-vsctl commands and parse their output. However, not
all stats exist at all times, for instance "rx_dropped" or
"tx_errors" can be missing. Thing is, we ask for a bulk of
statistics and if one of them is missing an error is reported
instead of returning the rest. Since we ignore errors, we fail to
set statistics. Fix this by asking for each piece alone.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoutil: Introduce virObjectGetLockableObj
John Ferlan [Wed, 29 Mar 2017 20:21:31 +0000 (16:21 -0400)]
util: Introduce virObjectGetLockableObj

Split out the object fetch in virObject{Lock|Unlock} into a helper

Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agoutil: Formatting cleanups to virobject API
John Ferlan [Tue, 28 Mar 2017 19:09:55 +0000 (15:09 -0400)]
util: Formatting cleanups to virobject API

Alter to use more recent formatting guidelines

Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agoutil: Move locale.h include from virutil to virstring
Martin Kletzander [Thu, 22 Jun 2017 11:34:38 +0000 (13:34 +0200)]
util: Move locale.h include from virutil to virstring

Commit 5c54d29aaeb7 forgot to do that when moving the only function
using it and it broke the build on some platforms.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agosecurity: Don't skip relabel for all chardevs
Michal Privoznik [Thu, 22 Jun 2017 11:51:58 +0000 (13:51 +0200)]
security: Don't skip relabel for all chardevs

Our commit e13e8808f9 was way too generic. Currently, virtlogd is
used only for chardevs type of file and nothing else. True, we
must not relabel the path in this case, but we have to in all
other cases. For instance, if you want to have a physical console
attached to your guest:

    <console type='dev'>
      <source path='/dev/ttyS0'/>
      <target type='virtio' port='1'/>
    </console>

Starting such domain fails because qemu doesn't have access to
/dev/ttyS0 because we haven't relabelled the path.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoutil: fix locale problem with virStrToDouble().
Julio Faracco [Wed, 21 Jun 2017 17:08:29 +0000 (14:08 -0300)]
util: fix locale problem with virStrToDouble().

This commit fixes a locale problem with locales that use comma as a mantissa
separator. Example: 12.34 en_US = 12,34 pt_BR. Since strtod() is a non-safe
function, virStrToDouble() will have problems to parse double numbers from
kernel settings and other double numbers from static files (XMLs, JSONs, etc).

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

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
7 years agoutil: moving virDoubleToStr() from virutil to virstring.
Julio Faracco [Wed, 21 Jun 2017 17:08:28 +0000 (14:08 -0300)]
util: moving virDoubleToStr() from virutil to virstring.

The function virDoubleToStr() is defined in virutil.* and virStrToDouble() is
defined in virstring.*. Joining both functions into the same file makes more
sense.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
7 years agotests: virstoragetest: fix --without-yajl
Cole Robinson [Wed, 21 Jun 2017 12:55:58 +0000 (08:55 -0400)]
tests: virstoragetest: fix --without-yajl

Recently added JSON tests should be skipped if compiled --without-yajl

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

7 years agoqemu: Do not skip virCPUUpdateLive if priv->origCPU is set
Jiri Denemark [Wed, 21 Jun 2017 13:31:38 +0000 (15:31 +0200)]
qemu: Do not skip virCPUUpdateLive if priv->origCPU is set

Even though we got both the original CPU (used for starting a domain)
and the updated version (the CPU really provided by QEMU) during
incoming migration, restore, or snapshot revert, we still need to update
the CPU according to the data we got from the freshly started QEMU.
Otherwise we don't know whether the CPU we got from QEMU matches the one
before migration. We just need to keep the original CPU in
priv->origCPU.

Messed up by me in v3.4.0-58-g8e34f4781.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemuProcessBuildDestroyHugepagesPath: Don't warn on destroying non-existent path
Michal Privoznik [Tue, 20 Jun 2017 15:55:21 +0000 (17:55 +0200)]
qemuProcessBuildDestroyHugepagesPath: Don't warn on destroying non-existent path

This function is called unconditionally from qemuProcessStop to
make sure we leave no dangling dirs behind. However, whenever the
directory we want to rmdir() is not there (e.g. because it hasn't
been created in the first place because domain doesn't use
hugepages at all), we produce a warning like this:

2017-06-20 15:58:23.615+0000: 32638: warning :
qemuProcessBuildDestroyHugepagesPath:3363 : Unable to remove
hugepage path: /dev/hugepages/libvirt/qemu/1-instance-00000001
(errno=2)

Fix this by not producing the warning on ENOENT.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
7 years agoqemu: Change coalesce settings on hotplug when they are different
Martin Kletzander [Wed, 21 Jun 2017 07:00:58 +0000 (09:00 +0200)]
qemu: Change coalesce settings on hotplug when they are different

Part of the condition was reverted so no value update was propagated
through.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agoqemu: capabilities: Move comments separating groups of capabilities
Peter Krempa [Tue, 20 Jun 2017 14:15:11 +0000 (16:15 +0200)]
qemu: capabilities: Move comments separating groups of capabilities

Similarly to how we specify the groups of 5 capabilities in the header
file move the labels to separate line also for the VIR_ENUM_IMPL part.

This simplifies rebase conflict resolution in the capability file since
only lines have to be shuffled around, but they don't need to be edited.

7 years agoutil: storage: Make @backingFormat optional in virStorageFileGetMetadataInternal
Peter Krempa [Tue, 20 Jun 2017 14:34:14 +0000 (16:34 +0200)]
util: storage: Make @backingFormat optional in virStorageFileGetMetadataInternal

Some callers don't need to know the backing format. Make the argument
optional by using a dummy int if NULL is passed.

7 years agoqemu: snapshot: Load data necessary for relative block commit to work
Peter Krempa [Tue, 20 Jun 2017 06:19:02 +0000 (08:19 +0200)]
qemu: snapshot: Load data necessary for relative block commit to work

Commit 7456c4f5f introduced a regression by not reloading the backing
chain of a disk after snapshot. The regression was caused as
src->relPath was not set and thus the block commit code could not
determine the relative path.

This patch adds code that will load the backing store string if
VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT and store it in the correct place
when a snapshot is successfully completed.

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

7 years agostorage: Add helper to retrieve the backing store string of a storage volume
Peter Krempa [Mon, 19 Jun 2017 16:16:30 +0000 (18:16 +0200)]
storage: Add helper to retrieve the backing store string of a storage volume

It is necessary for some parts of the code to refresh just data
based on the based on the backing store string. Add a convenience
function that will retrieve this data.

7 years agoutil: storage: Export virStorageIsRelative
Peter Krempa [Mon, 19 Jun 2017 16:06:34 +0000 (18:06 +0200)]
util: storage: Export virStorageIsRelative

7 years agoqemu: block commit: Don't overwrite error when rolling back disk labels
Peter Krempa [Tue, 20 Jun 2017 10:18:34 +0000 (12:18 +0200)]
qemu: block commit: Don't overwrite error when rolling back disk labels

Calls to qemuDomainDiskChainElementPrepare resets the original error,
thus we need to save it in the cleanup path of qemuDomainBlockCommit.

7 years agoqemu: block commit: Determine relative path of images before initializing
Peter Krempa [Tue, 20 Jun 2017 07:06:35 +0000 (09:06 +0200)]
qemu: block commit: Determine relative path of images before initializing

Changing labelling of the images does not need to happen after setting
the labeling and lock manager access. This saves the cleanup of the
labeling if the relative path can't be determined.

7 years agonews: Update news for loadparm feature
Farhan Ali [Thu, 1 Jun 2017 16:36:27 +0000 (12:36 -0400)]
news: Update news for loadparm feature

Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com>
7 years agoqemu: Add loadparm to qemu command line string
Farhan Ali [Thu, 1 Jun 2017 16:36:25 +0000 (12:36 -0400)]
qemu: Add loadparm to qemu command line string

Check for the LOADPARM capabilility and potentially add a loadparm=x to
the "-machine" string for the QEMU command line.

Also add xml2argv test cases for loadparm.

Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
7 years agoqemu: Introduce a new QEMU capability for -machine loadparm
Farhan Ali [Thu, 1 Jun 2017 16:36:26 +0000 (12:36 -0400)]
qemu: Introduce a new QEMU capability for -machine loadparm

Add new capability for the "-machine loadparm" QEMU option.

Add the capabilities replies/xml for s390x for QEMU 2.9.50.

Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com>
7 years agoconf: Add loadparm boot option for a boot device
Farhan Ali [Thu, 1 Jun 2017 16:36:24 +0000 (12:36 -0400)]
conf: Add loadparm boot option for a boot device

Update the per device boot schema to add an optional loadparm parameter.

eg: <boot order='1' loadparm='2'/>

Extend the virDomainDeviceInfo to support loadparm option.
Modify the appropriate functions to parse loadparm from boot device xml.
Add the xml2xml test to validate the field.

Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
7 years agocheck the return value of qemuBuildVirtioOptionsStr
Ján Tomko [Thu, 15 Jun 2017 08:24:58 +0000 (10:24 +0200)]
check the return value of qemuBuildVirtioOptionsStr

Only qemuBuildFSDevStr missed the return check.

7 years agoutil: storage: adapt to changes in JSON format for sheepdog
Peter Krempa [Thu, 15 Jun 2017 15:44:18 +0000 (17:44 +0200)]
util: storage: adapt to changes in JSON format for sheepdog

Since qemu 2.9 the options changed from a monolithic string into fine
grained options for the json pseudo-protocol object.

7 years agoutil: storage: adapt to changes in JSON format for ssh
Peter Krempa [Thu, 15 Jun 2017 15:44:18 +0000 (17:44 +0200)]
util: storage: adapt to changes in JSON format for ssh

Since qemu 2.9 the options changed from a monolithic string into fine
grained options for the json pseudo-protocol object.

7 years agoutil: storage: adapt to changes in JSON format for ceph/rbd
Peter Krempa [Thu, 15 Jun 2017 15:44:18 +0000 (17:44 +0200)]
util: storage: adapt to changes in JSON format for ceph/rbd

Since qemu 2.9 the options changed from a monolithic string into fine
grained options for the json pseudo-protocol object.

7 years agoutil: storage: adapt to changes in JSON format for NBD
Peter Krempa [Thu, 15 Jun 2017 15:44:18 +0000 (17:44 +0200)]
util: storage: adapt to changes in JSON format for NBD

Since 2.9 the host and port for NBD are no longer directly under the
json pseudo-protocol object, but rather belong to a sub-object called
'server'.

7 years agoutil: storage: Add JSON parser for new options in iSCSI protocol
Peter Krempa [Thu, 15 Jun 2017 15:12:01 +0000 (17:12 +0200)]
util: storage: Add JSON parser for new options in iSCSI protocol

Starting from qemu 2.9, more granular options are supported. Add parser
for the relevant bits.

With this patch libvirt is able to parse the host and target IQN of from
the JSON pseudo-protocol specification.

This corresponds to BlockdevOptionsIscsi in qemu qapi.

7 years agoutil: storage: Report errors when source host data is missing
Peter Krempa [Mon, 19 Jun 2017 12:47:41 +0000 (14:47 +0200)]
util: storage: Report errors when source host data is missing

Merge the reporting of the missing source host data into the parser
functions so that callers don't have to do it separately.

7 years agoutil: storage: Split out parsing of TCP network host from JSON pseudoprotocol
Peter Krempa [Mon, 19 Jun 2017 12:42:18 +0000 (14:42 +0200)]
util: storage: Split out parsing of TCP network host from JSON pseudoprotocol

Few backing protocols support only TCP. Split out the function which
will correspond to parsing qemu's InetSocketAddressBase.

7 years agoutil: storage: Add support for type 'inet' in virStorageSourceParseBackingJSONSocketA...
Peter Krempa [Mon, 19 Jun 2017 12:37:47 +0000 (14:37 +0200)]
util: storage: Add support for type 'inet' in virStorageSourceParseBackingJSONSocketAddress

'SocketAddress' structure was changed to contain 'inet' instead of
'tcp' since qemu commit c5f1ae3ae7b. Existing entries have a backward
compatibility layer.

Libvirt will parse 'inet' and 'tcp' as equivalents.

7 years agoqemu: Remove coverity[negative_returns] annotation
Andrea Bolognani [Mon, 19 Jun 2017 08:23:17 +0000 (16:23 +0800)]
qemu: Remove coverity[negative_returns] annotation

It was added in commit 6c2e4c3856c8ed48c378bf1bf357cab46271a47a
so that Coverity would not complain about passing -1 to
qemuDomainDetachThisHostDevice(), but the function in question
has changed since and so the annotation doesn't apply anymore.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoutil: storage: make virStorageSourceParseBackingJSONGlusterHost universal
Peter Krempa [Thu, 15 Jun 2017 15:23:15 +0000 (17:23 +0200)]
util: storage: make virStorageSourceParseBackingJSONGlusterHost universal

The same json strucutre is used for NBD and sheepdog volumes for
specifying of the host. Rename the function and fix up error messages to
be more universal.

7 years agoutil: storage: Add missing return to virStorageSourceParseBackingJSONGluster
Peter Krempa [Thu, 15 Jun 2017 15:09:26 +0000 (17:09 +0200)]
util: storage: Add missing return to virStorageSourceParseBackingJSONGluster

If the number of servers is not expected the code would report an error
but would not return failure.

7 years agoutil: storage: Output parsed network backing store string to debug log
Peter Krempa [Fri, 16 Jun 2017 15:07:55 +0000 (17:07 +0200)]
util: storage: Output parsed network backing store string to debug log

7 years agoqemu: Pass the number of heads even with -vga qxl
Martin Kletzander [Wed, 14 Jun 2017 09:20:52 +0000 (11:20 +0200)]
qemu: Pass the number of heads even with -vga qxl

When added in multiple previous commits, it was used only with -device
qxl(-vga), but for some QEMUs (< 1.6) we need to add this
functionality when using -vga qxl as well.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agosecurity: don't relabel chardev source if virtlogd is used as stdio handler
Pavel Hrdina [Mon, 29 May 2017 12:27:51 +0000 (14:27 +0200)]
security: don't relabel chardev source if virtlogd is used as stdio handler

In the case that virtlogd is used as stdio handler we pass to QEMU
only FD to a PIPE connected to virtlogd instead of the file itself.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
7 years agoqemu: propagate chardevStdioLogd to qemuBuildChrChardevStr
Pavel Hrdina [Mon, 29 May 2017 12:11:25 +0000 (14:11 +0200)]
qemu: propagate chardevStdioLogd to qemuBuildChrChardevStr

Improve the code to decide whether to use virtlogd or not by checking
the same variable that is updated in qemuProcessPrepareDomain().

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: introduce chardevStdioLogd to qemu private data
Pavel Hrdina [Thu, 15 Jun 2017 06:34:55 +0000 (08:34 +0200)]
qemu: introduce chardevStdioLogd to qemu private data

In QEMU driver we can use virtlogd as stdio handler for source backend
of char devices if current QEMU is new enough and it's enabled in
qemu.conf.  We should store this information while starting a guest
because the config option may change while the guest is running.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoconf: move seclabel for chardev source to the correct sturcture
Pavel Hrdina [Fri, 26 May 2017 15:53:09 +0000 (17:53 +0200)]
conf: move seclabel for chardev source to the correct sturcture

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemuDomainGetPreservedMounts: Fix suffixes for corner cases
Michal Privoznik [Mon, 12 Jun 2017 14:44:45 +0000 (16:44 +0200)]
qemuDomainGetPreservedMounts: Fix suffixes for corner cases

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

Imagine a FS mounted on /dev/blah/blah2. Our process of creating
suffix for temporary location where all the mounted filesystems
are moved is very simplistic. We want:

/var/run/libvirt/qemu/$domName.$suffix\

were $suffix is just the mount point path stripped of the "/dev/"
prefix. For instance:

/var/run/libvirt/qemu/fedora.mqueue  for /dev/mqueue
/var/run/libvirt/qemu/fedora.pts     for /dev/pts

and so on. Now if we plug /dev/blah/blah2 into the example we see
some misbehaviour:

/var/run/libvirt/qemu/fedora.blah/blah2

Well, misbehaviour if /dev/blah/blah2 is a file, because in that
case we call virFileTouch() instead of virFileMakePath().
The solution is to replace all the slashes in the suffix with say
dots. That way we don't have to care about nested directories.
IOW, the result we want for given example is:

/var/run/libvirt/qemu/fedora.blah.blah2

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemuDomainGetPreservedMounts: Prune nested mount points
Michal Privoznik [Mon, 12 Jun 2017 14:28:03 +0000 (16:28 +0200)]
qemuDomainGetPreservedMounts: Prune nested mount points

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

There can be nested mount points. For instance /dev/shm/blah can
be a mount point and /dev/shm too. It doesn't make much sense to
return the former path because callers preserve the latter (and
with that the former too). Therefore prune nested mount points.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemuDomainBuildNamespace: Clean up temp files
Michal Privoznik [Mon, 12 Jun 2017 15:46:30 +0000 (17:46 +0200)]
qemuDomainBuildNamespace: Clean up temp files

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

After 290a00e41d we know how to deal with file mount points.
However, when cleaning up the temporary location for preserved
mount points we are still calling rmdir(). This won't fly for
files. We need to call unlink(). Now, since we don't really care
if the cleanup succeeded or not (it's the best effort anyway), we
can call both rmdir() and unlink() without need for
differentiation between files and directories.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoReport more correct information for cache control
Martin Kletzander [Mon, 5 Jun 2017 12:00:45 +0000 (14:00 +0200)]
Report more correct information for cache control

On some platforms the number of bits in the cbm_mask might not be
divisible by 4 (and not even by 2), so we need to properly count the
bits.  Similar file, min_cbm_bits, is properly parsed and used, but if
the number is greater than one, we lose the information about
granularity when reporting the data in capabilities.  For that matter
always report granularity, but if it is not the same as the minimum,
add that information in there as well.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agoapparmor, libvirt-qemu: Allow access to certificates used by libvirt-vnc
Serge Hallyn [Tue, 23 May 2017 16:22:48 +0000 (18:22 +0200)]
apparmor, libvirt-qemu: Allow access to certificates used by libvirt-vnc

When setting up VncTLS according to the official Libvirt documentation,
only one certificate for libvirt/libvirt-vnc is used. The document
indicates to use the following directories :

 /etc/pki/CA
 /etc/pki/libvirt
 /etc/pki/libvirt/private

in order to manage the certificates used by libvirt-vnc.

Bug-Ubuntu: https://bugs.launchpad.net/bugs/901272

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
7 years agoapparmor, libvirt-qemu: Allow access to ceph config
Serge Hallyn [Tue, 23 May 2017 16:22:45 +0000 (18:22 +0200)]
apparmor, libvirt-qemu: Allow access to ceph config

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
7 years agoapparmor, libvirtd: Allow libxl-save-helper to run on Debian/Ubuntu
Stefan Bader [Fri, 16 Jun 2017 08:20:11 +0000 (10:20 +0200)]
apparmor, libvirtd: Allow libxl-save-helper to run on Debian/Ubuntu

On Debian/Ubuntu the libxl-save-helper (used when saving/restoring
a domain through libxl) is located under /usr/lib/xen-<version>/bin.

Bug-Ubuntu: https://bugs.launchpad.net/bugs/1334195

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
7 years agoapparmor, libvirt-qemu: Add ppc64el related changes
Serge Hallyn [Tue, 23 May 2017 16:22:42 +0000 (18:22 +0200)]
apparmor, libvirt-qemu: Add ppc64el related changes

Updates profile to allow running on ppc64el.

Bug-Ubuntu: https://bugs.launchpad.net/bugs/1374554

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
7 years agoapparmor, virt-aa-helper: Allow aarch64 UEFI.
William Grant [Tue, 23 May 2017 16:22:41 +0000 (18:22 +0200)]
apparmor, virt-aa-helper: Allow aarch64 UEFI.

Allow access to aarch64 UEFI images.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Guido Günther <agx@sigxcpu.org>
7 years agovirt-aa-helper: Generalize test for firmware paths
Christian Ehrhardt [Tue, 23 May 2017 16:22:40 +0000 (18:22 +0200)]
virt-aa-helper: Generalize test for firmware paths

This replaces individual tests for firmware locations by
a generic function which will simplify having additional
locations in the future.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
7 years agovirt-aa-helper, apparmor: allow /usr/share/OVMF/ too
Simon McVittie [Tue, 23 May 2017 16:22:39 +0000 (18:22 +0200)]
virt-aa-helper, apparmor: allow /usr/share/OVMF/ too

The split firmware and variables files introduced by
https://bugs.debian.org/764918 are in a different directory for
some reason. Let the virtual machine read both.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
7 years agoqemu: Allow live-updates of coalesce settings
Martin Kletzander [Thu, 15 Jun 2017 12:22:26 +0000 (14:22 +0200)]
qemu: Allow live-updates of coalesce settings

Change the settings from qemuDomainUpdateDeviceLive() as otherwise the
call would succeed even though nothing has changed.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agoTemporarily disable format truncation warnings
Daniel P. Berrange [Thu, 15 Jun 2017 13:22:54 +0000 (14:22 +0100)]
Temporarily disable format truncation warnings

GCC 7.1 introduces a new -Wformat-truncation warning
flag that reports if it thinks the maximum possible
size of the formatted output will exceed the provided
fixed buffer. This is enabled automatically by the
-Wformat warning flag. There are quite a few places
hit by this in libvirt which need rewriting. This is
non-trivial work in some places, so temporarily
disable the new warning until those fixes can be
implemented.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agoDisable the -Wduplicated-branches warning
Daniel P. Berrange [Wed, 14 Jun 2017 14:10:02 +0000 (15:10 +0100)]
Disable the -Wduplicated-branches warning

Depending on the platform/architecture, a number of conditionals
in libvirt code expand the same on both branches. This is expected
behaviour and harmless, so disable the warning to avoid creating
unexpected build failures

Two examples, mingw32:

../../src/util/vircommand.c: In function 'virCommandWait':
../../src/util/vircommand.c:2562:51: error: this condition has identical branches [-Werror=duplicated-branches]
             *exitstatus = cmd->rawStatus ? status : WEXITSTATUS(status);
                                                   ^
and gcc7.1

In file included from util/virobject.c:28:0:
util/virobject.c: In function 'virClassNew':
util/viratomic.h:176:46: error: this condition has identical branches [-Werror=duplicated-branches]
            (void)(0 ? *(atomic) ^ *(atomic) : 0);                      \
                                             ^
util/virobject.c:144:20: note: in expansion of macro 'virAtomicIntInc'
    klass->magic = virAtomicIntInc(&magicCounter);
                   ^~~~~~~~~~~~~~~

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agoqemu: Use qemuDomainCheckABIStability where needed
Jiri Denemark [Wed, 14 Jun 2017 12:56:21 +0000 (14:56 +0200)]
qemu: Use qemuDomainCheckABIStability where needed

Most places which want to check ABI stability for an active domain need
to call this API rather than the original
qemuDomainDefCheckABIStability. The only exception is in snapshots where
we need to decide what to do depending on the saved image data.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Add qemuDomainCheckABIStability
Jiri Denemark [Wed, 14 Jun 2017 11:43:37 +0000 (13:43 +0200)]
qemu: Add qemuDomainCheckABIStability

When making ABI stability checks for an active domain, we need to make
sure we use the same migratable definition which virDomainGetXMLDesc
with the MIGRATABLE flag provides, otherwise the ABI check will fail.
This is implemented in the new qemuDomainCheckABIStability which takes a
domain object and generates the right migratable definition from it.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Add qemuDomainMigratableDefCheckABIStability
Jiri Denemark [Wed, 14 Jun 2017 11:43:12 +0000 (13:43 +0200)]
qemu: Add qemuDomainMigratableDefCheckABIStability

This patch separates the actual ABI checks from getting migratable defs
in qemuDomainDefCheckABIStability so that we can create another wrapper
which will use different methods to get the migratable defs.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Introduce qemuDomainDefFromXML helper
Jiri Denemark [Wed, 14 Jun 2017 11:42:16 +0000 (13:42 +0200)]
qemu: Introduce qemuDomainDefFromXML helper

The main goal of this function is to enable reusing the parsing code
from qemuDomainDefCopy.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Don't try to use hugepages if not enabled
Michal Privoznik [Wed, 14 Jun 2017 08:40:20 +0000 (10:40 +0200)]
qemu: Don't try to use hugepages if not enabled

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

My fix 671d18594f4 was incomplete. If domain doesn't have
hugepages enabled, because of missing condition we would still be
putting hugepages path onto qemu cmd line. Clean up the
conditions so that it's more visible next time.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoUse sys/uio.h for writev()
Daniel P. Berrange [Wed, 14 Jun 2017 13:38:01 +0000 (14:38 +0100)]
Use sys/uio.h for writev()

With glibc >= 2.25.90 writev() is only available if you explicitly
include sys/uio.h. This matches the documented requirements, but
older glibc and other *NIX pulled in writev indirectly so the bug
wasn't noticed previously.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agomaint: update to latest gnulib
Daniel P. Berrange [Wed, 14 Jun 2017 10:18:57 +0000 (11:18 +0100)]
maint: update to latest gnulib

This fixes an incompatibility with glibc 2.25.90

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agoqemu: monitor: Fix a memory leak in qemuMonitorJSONAttachCharDevCommand
Erik Skultety [Tue, 13 Jun 2017 15:55:36 +0000 (17:55 +0200)]
qemu: monitor: Fix a memory leak in qemuMonitorJSONAttachCharDevCommand

With the current logic, we only free @tlsalias as part of the error
label and would have to free it explicitly earlier in the code. Convert
the error label to cleanup, so that we have only one sink, where we
handle all frees. Since JSON object append operation consumes pointers,
make sure @backend is cleared before we hit the cleanup label.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Prefer hugepages over mem source='file'
Michal Privoznik [Thu, 8 Jun 2017 14:45:02 +0000 (16:45 +0200)]
qemu: Prefer hugepages over mem source='file'

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

Consider the following XML:

  <memoryBacking>
    <hugepages>
      <page size='2048' unit='KiB' nodeset='1'/>
    </hugepages>
    <source type='file'/>
    <access mode='shared'/>
  </memoryBacking>

  <numa>
    <cell id='0' cpus='0-3' memory='512000' unit='KiB'/>
    <cell id='1' cpus='4-7' memory='512000' unit='KiB'/>
  </numa>

The following cmd line is generated:

  -object
  memory-backend-file,id=ram-node0,mem-path=/var/lib/libvirt/qemu/ram,
  share=yes,size=524288000 -numa node,nodeid=0,cpus=0-3,memdev=ram-node0
  -object
  memory-backend-file,id=ram-node1,mem-path=/var/lib/libvirt/qemu/ram,
  share=yes,size=524288000 -numa node,nodeid=1,cpus=4-7,memdev=ram-node1

This is obviously wrong as for node 1 hugepages should have been
used. The hugepages configuration is more specific than <source
type='file'/>.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemu: Allow memAccess for hugepages again
Michal Privoznik [Tue, 6 Jun 2017 08:58:37 +0000 (10:58 +0200)]
qemu: Allow memAccess for hugepages again

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

Historically, we've always supported memAccess for domains backed
by hugepages. However, somewhere along the way we've regressed
and stopped allowing such configuration. Fix it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemuxml2xmltest: Test hugepage enabled domains
Michal Privoznik [Thu, 8 Jun 2017 14:20:31 +0000 (16:20 +0200)]
qemuxml2xmltest: Test hugepage enabled domains

We have couple of hugepage enabled domains for qemuxml2argvtest.
Unfortunately, often when adding a test case there I forget to
add it to xml2xml test too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemuDomainAttachMemory: Crate hugepage dir if needed
Michal Privoznik [Wed, 7 Jun 2017 12:47:37 +0000 (14:47 +0200)]
qemuDomainAttachMemory: Crate hugepage dir if needed

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

It may happen that a domain is started without any huge pages.
However, user might try to attach a DIMM module later. DIMM
backed by huge pages (why would somebody want to mix regular and
huge pages is beyond me). Therefore we have to create the dir if
we haven't done so far.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemuProcessBuildDestroyHugepagesPath: create path more frequently
Michal Privoznik [Wed, 7 Jun 2017 11:38:14 +0000 (13:38 +0200)]
qemuProcessBuildDestroyHugepagesPath: create path more frequently

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

Currently, the per-domain path for huge pages mmap() for qemu is
created iff domain has memoryBacking and hugepages in it
configured. However, this alone is not enough because there can
be a DIMM module with hugepages configured too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agodaemonUnixSocketPaths: Unify exit paths
Michal Privoznik [Wed, 3 May 2017 06:01:14 +0000 (08:01 +0200)]
daemonUnixSocketPaths: Unify exit paths

Right now, there is a lot of exit points from the function.
Depending on their position they need to copy the same free
calls. This goes against our style where we usually have just one
exit point from the function which also does the necessary free.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemu: Fix starting a domain with corrupted managed save file
Jiri Denemark [Tue, 13 Jun 2017 11:25:07 +0000 (13:25 +0200)]
qemu: Fix starting a domain with corrupted managed save file

Commit v3.4.0-44-gac793bd71 fixed a memory leak, but failed to return
the special -3 value. Thus an attempt to start a domain with corrupted
managed save file would removed the corrupted file and report
"An error occurred, but the cause is unknown" instead of starting the
domain from scratch.

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

7 years agodaemon: fix memory leak in daemonUnixSocketPaths
Yi Wang [Mon, 12 Jun 2017 06:02:20 +0000 (02:02 -0400)]
daemon: fix memory leak in daemonUnixSocketPaths

@rundir, allocated by virGetUserRuntimeDirectory, is leaked in case
virFileMakePath fails.

Signed-off-by: Xi Xu <xu.xi8@zte.com.cn>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agocpu_ppc64: Add support for host-model on POWER9
Jiri Denemark [Wed, 17 May 2017 14:39:16 +0000 (16:39 +0200)]
cpu_ppc64: Add support for host-model on POWER9

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu/doc: Fix function name for handling events
Philipp Hahn [Mon, 12 Jun 2017 15:11:20 +0000 (17:11 +0200)]
qemu/doc: Fix function name for handling events

Insert missing "IO" into function name.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agoqemu: Explain why mdevs are assumed to be PCI Express
Andrea Bolognani [Mon, 12 Jun 2017 09:57:31 +0000 (17:57 +0800)]
qemu: Explain why mdevs are assumed to be PCI Express

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoUse ATTRIBUTE_FALLTHROUGH
Marc Hartmayer [Wed, 7 Jun 2017 08:46:41 +0000 (10:46 +0200)]
Use ATTRIBUTE_FALLTHROUGH

Use ATTRIBUTE_FALLTHROUGH, introduced by commit
5d84f5961b8e28e802f600bb2d2c6903e219092e, instead of comments to
indicate that the fall through is an intentional behavior.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>