]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agoqemu: command: Add support for sparse vcpu topologies
Peter Krempa [Thu, 4 Aug 2016 12:36:24 +0000 (14:36 +0200)]
qemu: command: Add support for sparse vcpu topologies

Add support for using the new approach to hotplug vcpus using device_add
during startup of qemu to allow sparse vcpu topologies.

There are a few limitations imposed by qemu on the supported
configuration:
- vcpu0 needs to be always present and not hotpluggable
- non-hotpluggable cpus need to be ordered at the beginning
- order of the vcpus needs to be unique for every single hotpluggable
  entity

Qemu also doesn't really allow to query the information necessary to
start a VM with the vcpus directly on the commandline. Fortunately they
can be hotplugged during startup.

The new hotplug code uses the following approach:
- non-hotpluggable vcpus are counted and put to the -smp option
- qemu is started
- qemu is queried for the necessary information
- the configuration is checked
- the hotpluggable vcpus are hotplugged
- vcpus are started

This patch adds a lot of checking code and enables the support to
specify the individual vcpu element with qemu.

8 years agoqemu: process: Copy final vcpu order information into the vcpu definition
Peter Krempa [Thu, 4 Aug 2016 12:23:25 +0000 (14:23 +0200)]
qemu: process: Copy final vcpu order information into the vcpu definition

The vcpu order information is extracted only for hotpluggable entities,
while vcpu definitions belonging to the same hotpluggable entity need
to all share the order information.

We also can't overwrite it right away in the vcpu info detection code as
the order is necessary to add the hotpluggable vcpus enabled on boot in
the correct order.

The helper will store the order information in places where we are
certain that it's necessary.

8 years agoqemu: command: Add helper to convert vcpu definition to JSON props
Peter Krempa [Thu, 4 Aug 2016 12:12:39 +0000 (14:12 +0200)]
qemu: command: Add helper to convert vcpu definition to JSON props

For use on the monitor we need to format certain parts of the vcpu
private definition into a JSON object. Add a helper.

8 years agoqemu: migration: Prepare for non-contiguous vcpu configurations
Peter Krempa [Thu, 4 Aug 2016 11:57:46 +0000 (13:57 +0200)]
qemu: migration: Prepare for non-contiguous vcpu configurations

Introduce a new migration cookie flag that will be used for any
configurations that are not compatible with libvirt that would not
support the specific vcpu hotplug approach. This will make sure that old
libvirt does not fail to reproduce the configuration correctly.

8 years agoconf: Add XML for individual vCPU hotplug
Peter Krempa [Tue, 2 Aug 2016 15:58:43 +0000 (17:58 +0200)]
conf: Add XML for individual vCPU hotplug

Individual vCPU hotplug requires us to track the state of any vCPU. To
allow this add the following XML:

<domain>
  ...
  <vcpu current='2'>3</vcpu>
  <vcpus>
    <vcpu id='0' enabled='yes' hotpluggable='no' order='1'/>
    <vcpu id='1' enabled='yes' hotpluggable='yes' order='2'/>
    <vcpu id='1' enabled='no' hotpluggable='yes'/>
  </vcpus>
  ...

The 'enabled' attribute allows to control the state of the vcpu.
'hotpluggable' controls whether given vcpu can be hotplugged and 'order'
allows to specify the order to add the vcpus.

8 years agoutil: Extract and rename qemuDomainDelCgroupForThread to virCgroupDelThread
Peter Krempa [Thu, 4 Aug 2016 21:36:38 +0000 (23:36 +0200)]
util: Extract and rename qemuDomainDelCgroupForThread to virCgroupDelThread

8 years agoqemu: domain: Prepare for VCPUs vanishing while libvirt is not running
Peter Krempa [Fri, 5 Aug 2016 12:48:27 +0000 (14:48 +0200)]
qemu: domain: Prepare for VCPUs vanishing while libvirt is not running

Similarly to devices the guest may allow unplug of the VCPU if libvirt
is down. To avoid problems, refresh the vcpu state on reconnect. Don't
mess with the vcpu state otherwise.

8 years agoqemu: domain: Extract cpu-hotplug related data
Peter Krempa [Sun, 31 Jul 2016 12:05:04 +0000 (14:05 +0200)]
qemu: domain: Extract cpu-hotplug related data

Now that the monitor code gathers all the data we can extract it to
relevant places either in the definition or the private data of a vcpu.

As only thread id is broken for TCG guests we may extract the rest of
the data and just skip assigning of the thread id. In case where qemu
would allow cpu hotplug in TCG mode this will make it work eventually.

8 years agotests: cpu-hotplug: Add data for ppc64 without threads enabled
Peter Krempa [Fri, 29 Jul 2016 17:55:29 +0000 (19:55 +0200)]
tests: cpu-hotplug: Add data for ppc64 without threads enabled

The reported data is unusual so add it to the test suite.

8 years agotests: cpu-hotplug: Add data for ppc64 out-of-order hotplug
Peter Krempa [Fri, 29 Jul 2016 17:44:43 +0000 (19:44 +0200)]
tests: cpu-hotplug: Add data for ppc64 out-of-order hotplug

Test the algorithm that extracts the order in which the vcpu entries
were plugged in on a sample of data created by plugging in vcpus
arbitrarily.

8 years agotests: cpu-hotplug: Add data for ppc64 platform including hotplug
Peter Krempa [Fri, 29 Jul 2016 17:24:22 +0000 (19:24 +0200)]
tests: cpu-hotplug: Add data for ppc64 platform including hotplug

Power 8 platform's basic hotpluggable unit is a core rather than a
thread for x86_64 family. This introduces most of the complexity of the
matching code and thus needs to be tested.

The test data contain data captured from in-order cpu hotplug and
unplug operations.

8 years agotests: cpu-hotplug: Add data for x86 hotplug with 11+ vcpus
Peter Krempa [Tue, 23 Aug 2016 21:05:52 +0000 (17:05 -0400)]
tests: cpu-hotplug: Add data for x86 hotplug with 11+ vcpus

During review it was reported that adding at least 11 vcpus creates a
collision of prefixes in the monitor matching algorithm. Add a test case
to verify that the problem won't happen.

8 years agotests: Add test infrastructure for qemuMonitorGetCPUInfo
Peter Krempa [Fri, 29 Jul 2016 16:08:06 +0000 (18:08 +0200)]
tests: Add test infrastructure for qemuMonitorGetCPUInfo

As the combination algorithm is rather complex and ugly it's necessary
to make sure it works properly. Add test suite infrastructure for
testing it along with a basic test based on x86_64 platform.

8 years agoqemu: monitor: Add algorithm for combining query-(hotpluggable-)-cpus data
Peter Krempa [Mon, 1 Aug 2016 11:56:23 +0000 (13:56 +0200)]
qemu: monitor: Add algorithm for combining query-(hotpluggable-)-cpus data

For hotplug purposes it's necessary to retrieve data using
query-hotpluggable-cpus while the old query-cpus API report thread IDs
and order of hotplug.

This patch adds code that merges the data using a rather non-trivial
algorithm and fills the data to the qemuMonitorCPUInfo structure for
adding to appropriate place in the domain definition.

8 years agoqemu: monitor: Add support for calling query-hotpluggable-cpus
Peter Krempa [Fri, 8 Jul 2016 11:52:11 +0000 (13:52 +0200)]
qemu: monitor: Add support for calling query-hotpluggable-cpus

Add support for retrieving information regarding hotpluggable cpu units
supported by qemu. Data returned by the command carries information
needed to figure out the granularity of hotplug, the necessary cpu type
name and the topology information.

Note that qemu doesn't specify any particular order of the entries thus
it's necessary sort them by socket_id, core_id and thread_id to the
order libvirt expects.

8 years agoqemu: monitor: Extract QOM path from query-cpus reply
Peter Krempa [Thu, 28 Jul 2016 08:33:10 +0000 (10:33 +0200)]
qemu: monitor: Extract QOM path from query-cpus reply

To allow matching up the data returned by query-cpus to entries in the
query-hotpluggable-cpus reply for CPU hotplug it's necessary to extract
the QOM path as it's the only link between the two.

8 years agoqemu: capabilities: Extract availability of new cpu hotplug for machine types
Peter Krempa [Fri, 29 Jul 2016 07:45:19 +0000 (09:45 +0200)]
qemu: capabilities: Extract availability of new cpu hotplug for machine types

QEMU reports whether 'query-hotpluggable-cpus' is supported for a given
machine type. Extract and cache the information using the capability
cache.

When copying the capabilities for a new start of qemu, mask out the
presence of QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS if the machine type
doesn't support hotpluggable cpus.

8 years agoqemu: Forbid config when topology based cpu count doesn't match the config
Peter Krempa [Mon, 1 Aug 2016 08:35:04 +0000 (10:35 +0200)]
qemu: Forbid config when topology based cpu count doesn't match the config

As of qemu commit:
commit a32ef3bfc12c8d0588f43f74dcc5280885bbdb30
Author: Thomas Huth <thuth@redhat.com>
Date:   Wed Jul 22 15:59:50 2015 +0200

    vl: Add another sanity check to smp_parse() function

v2.4.0-952-ga32ef3b

configuration where the maximum CPU count doesn't match the topology is
rejected. Prior to that only configurations where the topology would
contain more cpus than the maximum count would be rejected.

Use QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS as a relevant recent enough
witness to avoid breaking old configs.

8 years agoqemu: Add capability for query-hotpluggable-cpus command
Peter Krempa [Thu, 23 Jun 2016 11:56:12 +0000 (13:56 +0200)]
qemu: Add capability for query-hotpluggable-cpus command

8 years agoqemu: monitor: Return struct from qemuMonitor(Text|Json)QueryCPUs
Peter Krempa [Mon, 1 Aug 2016 11:44:25 +0000 (13:44 +0200)]
qemu: monitor: Return struct from qemuMonitor(Text|Json)QueryCPUs

Prepare to extract more data by returning an array of structs rather than
just an array of thread ids. Additionally report fatal errors separately
from qemu not being able to produce data.

8 years agoqemu: monitor: Return structures from qemuMonitorGetCPUInfo
Peter Krempa [Mon, 1 Aug 2016 05:43:32 +0000 (07:43 +0200)]
qemu: monitor: Return structures from qemuMonitorGetCPUInfo

The function will gradually add more returned data. Return a struct for
every vCPU containing the data.

8 years agostorage_backend_rbd: fix typos
Chen Hanxiao [Wed, 24 Aug 2016 07:25:49 +0000 (15:25 +0800)]
storage_backend_rbd: fix typos

s/failed/failed to

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
8 years agovirsh: use vshError consistently after virBufferError checks
Pino Toscano [Wed, 24 Aug 2016 14:14:25 +0000 (16:14 +0200)]
virsh: use vshError consistently after virBufferError checks

If virBufferError() reports an error, then vshError() is needed to
report the error situation instead of a simple vshError().

8 years agovirsh: avoid i18n puzzle
Pino Toscano [Wed, 24 Aug 2016 14:14:24 +0000 (16:14 +0200)]
virsh: avoid i18n puzzle

Use the full versions of the message, instead of composing a base
message with what was updated; the change makes the messages properly
translatable, since different parts of a sentence might need different
declensions for example.

8 years agovirsh: respect -q/--quiet more
Pino Toscano [Wed, 24 Aug 2016 14:14:23 +0000 (16:14 +0200)]
virsh: respect -q/--quiet more

Turn various vshPrint() informative messages into vshPrintExtra(), so
they are not printed when requesting the quiet mode; neither XML/info
outputs nor the results of commands are affected.
Also change the expected outputs of the virsh-undefine test, since virsh
is invoked in quiet mode there.

Some informative messages might still be converted (and thus silenced
when in quiet mode), but this is an improvements nonetheless.

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

8 years agoFix remote_protocol-structs after recent commit
Peter Krempa [Tue, 23 Aug 2016 19:47:10 +0000 (15:47 -0400)]
Fix remote_protocol-structs after recent commit

Commit 0adc9d26ae0cfbb4aa227e89424f3d48bb977da0 broke the build since
remote_protocol-structs was not updated.

8 years agovz: add ACL checks to API calls
Nikolay Shirokovskiy [Fri, 24 Jun 2016 14:32:38 +0000 (17:32 +0300)]
vz: add ACL checks to API calls

  vzDomainMigrateConfirm3Params is whitelisted. Otherwise we need to
move removing domain from domain list from perform to confirm
step. This would further imply adding a flag and check that migration
is in progress to prohibit mistakenly (maliciously) removing domains
on confirm step. vz version of p2p also need to be fixed to include confirm step.
One would also need to add means to cleanup pending migration
on client disconnect as now is has state across several API
calls.

  On the other hand current version of confirm step is totaly
harmless thus it is easier to whitelist it at the moment.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agoremote: rename protocol names for close callbacks
Nikolay Shirokovskiy [Fri, 24 Jun 2016 14:32:37 +0000 (17:32 +0300)]
remote: rename protocol names for close callbacks

This way we make naming consistent to API calls and make subsequent
ACL checks possible (otherwise ACL check would discover name
discrepancies).

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: prepare migration for ACL checks
Nikolay Shirokovskiy [Fri, 24 Jun 2016 14:32:36 +0000 (17:32 +0300)]
vz: prepare migration for ACL checks

  ACL check on perform step should be in API call itself to make ACL
checking script pass. Thus we need to reorganize code to obtain
domain object in perform API itself. Most of this is straight
forward, the only nuance is dropping locks on lengthy remote
operations.
  The other motivation is to have only perform step ACL checks for
p2p migration instead of both begin in perform if we can leave
ACL check in vzDomainMigratePerformStep.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: expand setting memory API calls
Nikolay Shirokovskiy [Fri, 24 Jun 2016 14:32:35 +0000 (17:32 +0300)]
vz: expand setting memory API calls

We need it to prepare the calls for ACL checks otherwise ACL checking
script will fail.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: add missing flagged versions of API functions
Nikolay Shirokovskiy [Fri, 24 Jun 2016 14:32:34 +0000 (17:32 +0300)]
vz: add missing flagged versions of API functions

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: factor out converting block stats to params
Nikolay Shirokovskiy [Fri, 24 Jun 2016 14:32:33 +0000 (17:32 +0300)]
vz: factor out converting block stats to params

This action deserves its own function and makes main API call
structure much cleaner.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: factor out block stats impl
Nikolay Shirokovskiy [Fri, 24 Jun 2016 14:32:32 +0000 (17:32 +0300)]
vz: factor out block stats impl

Now we can use intended ACL check for both API calls.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: implement plain create API thru createFlags instead of visa versa
Nikolay Shirokovskiy [Fri, 24 Jun 2016 14:32:31 +0000 (17:32 +0300)]
vz: implement plain create API thru createFlags instead of visa versa

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agovz: expand start/stop/... APIs for ACL checks
Nikolay Shirokovskiy [Fri, 24 Jun 2016 14:32:30 +0000 (17:32 +0300)]
vz: expand start/stop/... APIs for ACL checks

  The original motivation is to expand API calls like start/stop etc so that
the ACL checks could be added. But this patch has its own befenits.

1. functions like prlsdkStart/Stop use common routine to wait for
job without domain lock. They become more self contained and do
not return intermediate PRL_RESULT.

2. vzDomainManagedSave do not update cache twice.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agonetwork: Need to free formatted addr in networkDnsmasqConfContents
John Ferlan [Sat, 20 Aug 2016 13:26:26 +0000 (09:26 -0400)]
network: Need to free formatted addr in networkDnsmasqConfContents

Commit id '0b6336c2' formatted the 'addr', but didn't VIR_FREE it.

Found by Coverity.

8 years agoremove the dead code this patch is to remove the dead code Signed-off-by: JieWang...
JieWang [Mon, 22 Aug 2016 12:17:37 +0000 (20:17 +0800)]
remove the dead code this patch is to remove the dead code Signed-off-by: JieWang <wangjie88@huawei.com>

Signed-off-by: JieWang <wangjie88@huawei.com>
8 years agoqemu: Fix crash hot plugging luks volume
John Ferlan [Wed, 17 Aug 2016 14:25:43 +0000 (10:25 -0400)]
qemu: Fix crash hot plugging luks volume

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

Crash occurs because 'secrets' is being dereferenced in call:

        if (qemuDomainSecretSetup(conn, priv, secinfo, disk->info.alias,
                                  VIR_SECRET_USAGE_TYPE_VOLUME, NULL,
                                  &src->encryption->secrets[0]->seclookupdef,
                                  true) < 0)

(gdb) p *src->encryption
$1 = {format = 2, nsecrets = 0, secrets = 0x0, encinfo = {cipher_size = 0,
    cipher_name = 0x0, cipher_mode = 0x0, cipher_hash = 0x0, ivgen_name = 0x0,
    ivgen_hash = 0x0}}
(gdb) bt
    priv=priv@entry=0x7fffc03be160, disk=disk@entry=0x7fffb4002ae0)
    at qemu/qemu_domain.c:1087
    disk=0x7fffb4002ae0, vm=0x7fffc03a2580, driver=0x7fffc02ca390,
    conn=0x7fffb00009a0) at qemu/qemu_hotplug.c:355

Upon entry to qemuDomainAttachVirtioDiskDevice, src->encryption points
at a valid 'secret' buffer w/ nsecrets == 1; however, the call to
qemuDomainDetermineDiskChain will call virStorageFileGetMetadata
and eventually virStorageFileGetMetadataInternal where the src->encryption
was overwritten when probing the volume.

Commit id 'a48c7141' added code to virStorageFileGetMetadataInternal
to determine if the disk/volume would use/need encryption and allocated
a meta->encryption. This overwrote an existing encryption buffer
already provided by the XML

This patch adds a check for meta->encryption already present before
just allocating and overwriting an existing buffer. It then checks the
existing encryption data to ensure the XML provided format for the
disk matches the expected format read from the disk and errors if there
is a mismatch.

8 years agonetwork: allow limiting a <forwarder> element to certain domains
Laine Stump [Fri, 12 Aug 2016 02:28:27 +0000 (22:28 -0400)]
network: allow limiting a <forwarder> element to certain domains

For some unknown reason the original implementation of the <forwarder>
element only took advantage of part of the functionality in the
dnsmasq feature it exposes - it allowed specifying the ip address of a
DNS server which *all* DNS requests would be forwarded to, like this:

   <forwarder addr='192.168.123.25'/>

This is a frontend for dnsmasq's "server" option, which also allows
you to specify a domain that must be matched in order for a request to
be forwarded to a particular server. This patch adds support for
specifying the domain. For example:

   <forwarder domain='example.com' addr='192.168.1.1'/>
   <forwarder domain='www.example.com'/>
   <forwarder domain='travesty.org' addr='10.0.0.1'/>

would forward requests for bob.example.com, ftp.example.com and
joe.corp.example.com all to the DNS server at 192.168.1.1, but would
forward requests for travesty.org and www.travesty.org to
10.0.0.1. And due to the second line, requests for www.example.com,
and odd.www.example.com would be resolved by the libvirt network's own
DNS server (i.e. thery wouldn't be immediately forwarded) even though
they also match 'example.com' - the match is given to the entry with
the longest matching domain. DNS requests not matching any of the
entries would be resolved by the libvirt network's own DNS server.

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

8 years agonetwork: allow disabling dnsmasq's DNS server
Laine Stump [Thu, 11 Aug 2016 21:29:43 +0000 (17:29 -0400)]
network: allow disabling dnsmasq's DNS server

If you define a libvirt virtual network with one or more IP addresses,
it starts up an instance of dnsmasq. It's always been possible to
avoid dnsmasq's dhcp server (simply don't include a <dhcp> element),
but until now it wasn't possible to avoid having the DNS server
listening; even if the network has no <dns> element, it is started
using default settings.

This patch adds a new attribute to <dns>: enable='yes|no'. For
backward compatibility, it defaults to 'yes', but if you don't want a
DNS server created for the network, you can simply add:

   <dns enable='no'/>

to the network configuration, and next time the network is started
there will be no dns server created (if there is dhcp configuration,
dnsmasq will be started with "port=0" which disables the DNS server;
if there is no dhcp configuration, dnsmasq won't be started at all).

8 years agonetwork: new network forward mode 'open'
Laine Stump [Wed, 10 Aug 2016 23:09:55 +0000 (19:09 -0400)]
network: new network forward mode 'open'

The new forward mode 'open' is just like mode='route', except that no
firewall rules are added to assure that any traffic does or doesn't
pass. It is assumed that either they aren't necessary, or they will be
setup outside the scope of libvirt.

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

8 years agonetworkxml2conftest: Don't leak dnsmasq capabilities
Michal Privoznik [Thu, 18 Aug 2016 09:06:26 +0000 (11:06 +0200)]
networkxml2conftest: Don't leak dnsmasq capabilities

==18324== 32 bytes in 1 blocks are still reachable in loss record 41 of 114
==18324==    at 0x4C2C070: calloc (vg_replace_malloc.c:623)
==18324==    by 0x4EA479B: virAlloc (viralloc.c:144)
==18324==    by 0x4EA674A: virBitmapNewQuiet (virbitmap.c:77)
==18324==    by 0x4EA67F7: virBitmapNew (virbitmap.c:106)
==18324==    by 0x4EC777D: dnsmasqCapsNewEmpty (virdnsmasq.c:801)
==18324==    by 0x4EC781B: dnsmasqCapsNewFromBuffer (virdnsmasq.c:815)
==18324==    by 0x407CF4: mymain (networkxml2conftest.c:99)
==18324==    by 0x409CF0: virTestMain (testutils.c:982)
==18324==    by 0x4080EA: main (networkxml2conftest.c:136)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovz: add validation callbacks
Mikhail Feoktistov [Thu, 18 Aug 2016 11:43:09 +0000 (07:43 -0400)]
vz: add validation callbacks

This patch fixes a bug which occurs when we check a bus and unit number
for a new attached disk. We should do this check in ValidadionCallback,
not in PostParse callback. Because in PostParse we have not initialized
disk->info.addr.drive struct yet.
Move part of code from domainPostParseCallback to domainValidateCallback
and part from devicesPostParseCallback to deviceValidateCallback.
PostParse callbacks are for modification data.
ValidateCallbacks are only for checks.

8 years agovz: fixed race in vzDomainAttach/DettachDevice
Olga Krishtal [Thu, 18 Aug 2016 12:37:00 +0000 (15:37 +0300)]
vz: fixed race in vzDomainAttach/DettachDevice

While dettaching/attaching device in OpenStack, nova
calls vzDomainDettachDevice twice, because the update of the internal
configuration of the ct comes a bit latter than the update event.
As the result, we suffer from the second call to dettach the same device.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
8 years agovz: specify VIR_DOMAIN_NET_TYPE_NETWORK for routed networks
Maxim Nestratov [Wed, 3 Aug 2016 11:40:20 +0000 (14:40 +0300)]
vz: specify VIR_DOMAIN_NET_TYPE_NETWORK for routed networks

Somehow we lost this during recent refactoring

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: reset errors after ignoring return values
Maxim Nestratov [Wed, 3 Aug 2016 09:41:53 +0000 (12:41 +0300)]
vz: reset errors after ignoring return values

If we are going to ignore return value of a functions
that can raise an error, it's not enough to use ignore_value
construction. We should explicitly call virResetLastError

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: don't fail query domain info in case we don't have valid stats handle
Maxim Nestratov [Tue, 7 Jun 2016 16:34:50 +0000 (19:34 +0300)]
vz: don't fail query domain info in case we don't have valid stats handle

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: get additional error information from job correctly
Maxim Nestratov [Thu, 26 May 2016 08:56:23 +0000 (11:56 +0300)]
vz: get additional error information from job correctly

First, make function logPrlEventErrorHelper be void and only
print information (if any) from an event.
Second, don't rewrite original error with any errors we get
during parsing event info.
Third, ignore PRL_ERR_NO_DATA at all.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agocfg.mk: join not_streq and not_strneq tests
Ján Tomko [Thu, 16 Jun 2016 12:16:43 +0000 (14:16 +0200)]
cfg.mk: join not_streq and not_strneq tests

The marginally nicer error message is not worth the extra lines in
cfg.mk.

Also drop the excludes since there was only one offender in the tests.

8 years agocfg.mk: drop redundant sc_prohibit_gethostby
Ján Tomko [Tue, 26 Jul 2016 11:18:43 +0000 (13:18 +0200)]
cfg.mk: drop redundant sc_prohibit_gethostby

Both gethostbyaddr and gethostbyname* are already checked
by sc_prohibit_nonreentrant.

8 years agocfg.mk: use subst instead of tr
Ján Tomko [Thu, 16 Jun 2016 10:05:35 +0000 (12:05 +0200)]
cfg.mk: use subst instead of tr

GNU make is able to replace characters, no need to call tr.

8 years agotests: fix the return value of test-wrap-argv
Ján Tomko [Tue, 26 Jul 2016 11:33:36 +0000 (13:33 +0200)]
tests: fix the return value of test-wrap-argv

The script was returning success unless it failed on the last file.
This went unnoticed because sc_prohibit_long_lines forbids lines
longer than 90 characters in .arg[sv] files.

8 years agomaint: update to latest gnulib
Ján Tomko [Wed, 3 Aug 2016 10:20:36 +0000 (12:20 +0200)]
maint: update to latest gnulib

Pick up the new syntax-check speedups.

8 years agoIntroduce QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY
Ján Tomko [Mon, 8 Aug 2016 14:05:27 +0000 (16:05 +0200)]
Introduce QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY

Check whether the disable-legacy property is present on the following
devices:
  virtio-balloon-pci
  virtio-blk-pci
  virtio-scsi-pci
  virtio-serial-pci
  virtio-9p-pci
  virtio-net-pci
  virtio-rng-pci
  virtio-gpu-pci
  virtio-input-host-pci
  virtio-keyboard-pci
  virtio-mouse-pci
  virtio-tablet-pci

Assuming that if QEMU knows other virtio devices where this property
is applicable, it will have at least one of these devices.

Added in QEMU by:
commit e266d421490e0ae83044bbebb209b2d3650c0ba6
    virtio-pci: add flags to enable/disable legacy/modern

8 years agoqemu: Fix the command line generation for rbd auth using aes secrets
John Ferlan [Tue, 16 Aug 2016 20:50:15 +0000 (16:50 -0400)]
qemu: Fix the command line generation for rbd auth using aes secrets

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

Since libvirt still uses a legacy qemu arg format to add a disk, the
manner in which the 'password-secret' argument is passed to qemu needs
to change to prepend a 'file.' If in the future, usage of the more
modern disk format, then the prepended 'file.' can be removed.

Fix based on Jim Fehlig <jfehlig@suse.com> posting and subsequent
upstream list followups, see:

http://www.redhat.com/archives/libvir-list/2016-August/msg00777.html

for details. Introduced by commit id 'a1344f70'.

8 years agoqemu_driver: update comments for qemuDomainSaveInternal
Chen Hanxiao [Fri, 12 Aug 2016 08:51:49 +0000 (16:51 +0800)]
qemu_driver: update comments for qemuDomainSaveInternal

s/libvirt.c/libvirt-domain.c

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
8 years agoconf: Provide error on undefined vcpusched entry
John Ferlan [Mon, 15 Aug 2016 14:37:34 +0000 (10:37 -0400)]
conf: Provide error on undefined vcpusched entry

Modify virDomainDefGetVcpuSched to emit an error message if
virDomainDefGetVcpu returns NULL meaning the vcpu could not
be found. Prior to commit id '9cc931f0b' the error message
would have been issued in virDomainDefGetVcpu.

8 years agoqemu_process: graphics: setup listen types before ports are reserved/allocated
Pavel Hrdina [Sat, 13 Aug 2016 19:29:38 +0000 (21:29 +0200)]
qemu_process: graphics: setup listen types before ports are reserved/allocated

The code that setups listen types may change a listen type from address to
socket based on configuration from qemu.conf.  This needs to be done before we
reserve/allocate ports that won't be used.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_process: graphics: reserve port only if listen type is address or network
Pavel Hrdina [Sat, 13 Aug 2016 19:03:15 +0000 (21:03 +0200)]
qemu_process: graphics: reserve port only if listen type is address or network

Ports are valid only for listen types 'address' and 'network', other listen
types doesn't use them so we should not try to reserve any ports.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_process: graphics: extract for loop out of qemuProcessGraphicsReservePorts
Pavel Hrdina [Sat, 13 Aug 2016 19:01:38 +0000 (21:01 +0200)]
qemu_process: graphics: extract for loop out of qemuProcessGraphicsReservePorts

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_process: graphics: extract port allocation into function
Pavel Hrdina [Sat, 13 Aug 2016 18:58:55 +0000 (20:58 +0200)]
qemu_process: graphics: extract port allocation into function

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_process: graphics: ref driver config only in function where it is used
Pavel Hrdina [Sat, 13 Aug 2016 18:54:58 +0000 (20:54 +0200)]
qemu_process: graphics: ref driver config only in function where it is used

Signed-off-by: Pavel Hrdina <phrdina@redhat.com
8 years agoutil: Make virStringArrayHasString() const-correct
Andrea Bolognani [Tue, 16 Aug 2016 10:20:56 +0000 (12:20 +0200)]
util: Make virStringArrayHasString() const-correct

The first argument should be const char ** instead of
char **, because this is a search function and as such it
doesn't, and shouldn't, alter the haystack in any way.

This change means we no longer have to cast arrays of
immutable strings to arrays of mutable strings; we still
have to do the opposite, though, but that's reasonable.

8 years agoconf: Provide error on undefined iothreadsched entry
John Ferlan [Mon, 15 Aug 2016 13:45:28 +0000 (09:45 -0400)]
conf: Provide error on undefined iothreadsched entry

When commit id '6dfb4507' refactored where the iothreadsched data was
stored, the error message for when the virDomainIOThreadIDFind failed
to find an iothreadid ("iothreadsched attribute 'iothreads' uses
undefined iothread ids") was lost. This led to the possibility that
someone would try to use it, but receive the generic message "An error
occurred, but the cause is unknown".

This patch adds the error message back so that someone will know that
they have an invalid configuration.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: driver: Split out regular vcpu hotplug code into a function
Peter Krempa [Tue, 16 Aug 2016 12:07:12 +0000 (14:07 +0200)]
qemu: driver: Split out regular vcpu hotplug code into a function

All other modes of qemuDomainSetVcpusFlags have helpers so finish the
work by splitting the regular code into a new function.

This patch also touches up the coding (spacing) style.

8 years agoqemu: driver: Extract setting of live vcpu count
Peter Krempa [Tue, 16 Aug 2016 11:27:57 +0000 (13:27 +0200)]
qemu: driver: Extract setting of live vcpu count

The live code does ugly things. Contain it in a separate function.

8 years agoqemu: setvcpus: Extract setting of maximum vcpu count
Peter Krempa [Wed, 3 Aug 2016 11:21:42 +0000 (13:21 +0200)]
qemu: setvcpus: Extract setting of maximum vcpu count

Setting of the maximum vcpu count is slightly semantically different
thus split it into a self-contained func.

8 years agoutils: storage: Fix JSON field name for uri based storage
Peter Krempa [Tue, 16 Aug 2016 07:24:12 +0000 (09:24 +0200)]
utils: storage: Fix JSON field name for uri based storage

qemu uses 'url' instead of 'uri'. They unfortunately look very similar.

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

8 years agoconf: report an error message for non-existing USB hubs
Ján Tomko [Mon, 15 Aug 2016 15:39:35 +0000 (17:39 +0200)]
conf: report an error message for non-existing USB hubs

If any of the devices referenced a USB hub that does not exist,
defining the domain would either fail with:
error: An error occurred, but the cause is unknown
(if only the last hub in the path is missing)
or crash.

Return a proper error instead of crashing.

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

8 years agoconf: free the ports array of a USB hub
Ján Tomko [Mon, 15 Aug 2016 15:21:32 +0000 (17:21 +0200)]
conf: free the ports array of a USB hub

The array needs to be freed too, not just its members.

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

8 years agoqemu: setcpus: Report better errors
Peter Krempa [Wed, 3 Aug 2016 10:57:23 +0000 (12:57 +0200)]
qemu: setcpus: Report better errors

Mention whether it was the live or persistent definition which caused an
error reported and explicitly error out in case when attempting to set
maximum vcpu count for a live domain.

8 years agolxc: don't try to reference NULL when mounting filesystems
Daniel P. Berrange [Thu, 11 Aug 2016 13:02:48 +0000 (14:02 +0100)]
lxc: don't try to reference NULL when mounting filesystems

  <filesystem type='ram' accessmode='passthrough'>
    <source usage='524288' units='KiB'/>
    <target dir='/dev/shm'/>
  </filesystem>

would lead to lxcContainerMountAllFS calling STRPREFIX
on a NLL pointer because it failed to check if fs->src->path
was non-NULL. This is a regression caused by

  commit da665fbd4858890fbb3bbf5da2a7b6ca37bb3220
  Author: Olga Krishtal <okrishtal@virtuozzo.com>
  Date:   Thu Jul 14 16:52:38 2016 +0300

    filesystem: adds possibility to use storage pool as fs source

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolxc: don't try to resolve a NULL path for filesystems
Daniel P. Berrange [Thu, 11 Aug 2016 13:02:48 +0000 (14:02 +0100)]
lxc: don't try to resolve a NULL path for filesystems

  <filesystem type='ram' accessmode='passthrough'>
    <source usage='524288' units='KiB'/>
    <target dir='/dev/shm'/>
  </filesystem>

would lead to lxcContainerResolveSymlinks calling
access(NULL) because it failed to check if fs->src->path
was non-NULL. This is a regression caused by

  commit da665fbd4858890fbb3bbf5da2a7b6ca37bb3220
  Author: Olga Krishtal <okrishtal@virtuozzo.com>
  Date:   Thu Jul 14 16:52:38 2016 +0300

    filesystem: adds possibility to use storage pool as fs source

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibxl_driver: Indent LIBXL_VBD_SECTOR_SIZE macro correctly
Michal Privoznik [Tue, 16 Aug 2016 07:04:47 +0000 (09:04 +0200)]
libxl_driver: Indent LIBXL_VBD_SECTOR_SIZE macro correctly

Because of change in caaa1bd357a99ad this macro is no under
#ifdef block. That means it needs to be re-intended correctly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agotests: fix domaincapstest linking for libxl
Roman Bogorodskiy [Sun, 14 Aug 2016 23:18:35 +0000 (02:18 +0300)]
tests: fix domaincapstest linking for libxl

Commit 11567cf added some libxl tests into domaincapstest and
added libvirt_driver_libxl_impl.la to domaincapstest_LDADD.

This causes link fail on systems without GNU regex implementation:

gmake[2]: Entering directory '/usr/home/novel/code/libvirt/tests'
  CCLD     domaincapstest
  ../src/.libs/libvirt_driver_libxl_impl.a(libvirt_driver_libxl_impl_la-libxl_capabilities.o):
  In function `libxlMakeCapabilities':
  libxl/libxl_capabilities.c:(.text+0x6b2): undefined reference to
  `rpl_regcomp'
  libxl/libxl_capabilities.c:(.text+0x6d0): undefined reference to
  `rpl_regerror'
  libxl/libxl_capabilities.c:(.text+0x803): undefined reference to
  `rpl_regexec'
  libxl/libxl_capabilities.c:(.text+0xa58): undefined reference to
  `rpl_regfree'
  clang-3.8: error: linker command failed with exit code 1 (use -v to
  see invocation)

This happens because on these system it tries to use gnulib's builtin
regex implementation, but doesn't link to gnulib.

Fix by adding $(GNULIB_LIBS) along with libvirt_driver_libxl_impl.la to
domaincapstest_LDADD.

8 years agolibxl: fix unused functions
Roman Bogorodskiy [Sun, 14 Aug 2016 01:24:37 +0000 (04:24 +0300)]
libxl: fix unused functions

Commit eee7bd4e introduced two functions: libxlDiskPathToID and
libxlDiskSectorSize.

However, as they're used only by code under #ifdef __linux__,
on non-Linux platforms it results in errors similar to this:

 CC       libxl/libvirt_driver_libxl_impl_la-libxl_driver.lo
libxl/libxl_driver.c:5263:1: error: unused function 'libxlDiskPathToID' [-Werror,-Wunused-function]
libxlDiskPathToID(const char *virtpath)
^
libxl/libxl_driver.c:5312:1: error: unused function 'libxlDiskSectorSize' [-Werror,-Wunused-function]
libxlDiskSectorSize(int domid, int devno)
^
2 errors generated.

Fix that by moving these functions under the #ifdef __linux__ block.

8 years agoIntroduce node device update event as top level event
Jovanka Gulicoska [Thu, 11 Aug 2016 15:15:23 +0000 (17:15 +0200)]
Introduce node device update event as top level event

This event is emitted when a nodedev XML definition is updated,
like when cdrom media is changed in a cdrom block device.

Also includes node device update event implementation for udev
backend, virsh nodedev-event support, and event-test support

8 years agovirsh: Fix core for cmdSecretGetValue
John Ferlan [Mon, 15 Aug 2016 11:53:45 +0000 (07:53 -0400)]
virsh: Fix core for cmdSecretGetValue

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

When commit id 'cb2e3e50' reworked the cmdSecretGetValue call to use
VIR_DISPOSE_STRING for base64, it neglected to initialize the base64
value to NULL since the cleanup: label could be reached prior to the
base64 value being set or not.  This resulted in a core dump, adding
the initialization will avoid the issue.

8 years agoqemu_command: don't modify heads for graphics device
Pavel Hrdina [Fri, 12 Aug 2016 14:12:39 +0000 (16:12 +0200)]
qemu_command: don't modify heads for graphics device

Setting heads to 0 in case that *max_outputs* is not supported while building
command line doesn't have any real effect.  It only removes *heads* attribute
from live XML, but after restarting libvirt the default value is restored.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agovirschematest: Make sure that validator is initialized
Michal Privoznik [Mon, 15 Aug 2016 07:51:10 +0000 (09:51 +0200)]
virschematest: Make sure that validator is initialized

It may happen that a developer wants to run just a specific
subset of tests:

tests $ VIR_TEST_RANGE=22 ../run ./virschematest

This now fails miserably:

    ==6840== Invalid read of size 8
    ==6840==    at 0x4F397C0: virXMLValidatorValidate (virxml.c:1216)
    ==6840==    by 0x402B72: testSchemaFile (virschematest.c:53)
    ==6840==    by 0x403737: virTestRun (testutils.c:180)
    ==6840==    by 0x402CF5: testSchemaDir (virschematest.c:98)
    ==6840==    by 0x402EB1: testSchemaDirs (virschematest.c:131)
    ==6840==    by 0x40314D: mymain (virschematest.c:194)
    ==6840==    by 0x4051AF: virTestMain (testutils.c:982)
    ==6840==    by 0x4035A9: main (virschematest.c:217)
    ==6840==  Address 0x10 is not stack'd, malloc'd or (recently) free'd

Problem is, we are trying to do two types of tests here: validate
RNG schema itself, and validate XML files against RNG schemas.
And the latter tries to re-use a resource allocated in the
former. Therefore if the former is skipped (due to
VIR_TEST_RANGE) we have to allocate the resource manually.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agocpu_x86: fix libvirtd crash when host cpu vendor is not available
Jim Fehlig [Fri, 5 Aug 2016 21:23:47 +0000 (15:23 -0600)]
cpu_x86: fix libvirtd crash when host cpu vendor is not available

When starting a guest and copying host vendor cpuid to the guest
cpu, libvirtd would crash if the host cpu contained a NULL vendor
field. Avoid the crash by checking for a valid vendor in the host
cpu before copying the cpuid to the guest cpu.

For completeness, here is a backtrace from the crash

(gdb) bt
f0  0x00007ffff739bf33 in x86DataCpuid (cpuid=0x8, cpuid=0x8,
    data=data@entry=0x7fffb800ee78) at cpu/cpu_x86.c:287
f1  virCPUx86DataAddCPUID (data=data@entry=0x7fffb800ee78, cpuid=0x8)
    at cpu/cpu_x86.c:355
f2  0x00007ffff739ef47 in x86Compute (host=<optimized out>, cpu=0x7fffb8000cc0,
    guest=0x7fffecca7348, message=<optimized out>) at cpu/cpu_x86.c:1580
f3  0x00007fffd2b38e53 in qemuBuildCpuModelArgStr (migrating=false,
    hasHwVirt=<synthetic pointer>, qemuCaps=0x7fffb8001040, buf=0x7fffecca7360,
    def=0x7fffc400ce20, driver=0x1c) at qemu/qemu_command.c:6283
f4  qemuBuildCpuCommandLine (cmd=cmd@entry=0x7fffb8002f60,
    driver=driver@entry=0x7fffc80882c0, def=def@entry=0x7fffc400ce20,
    qemuCaps=qemuCaps@entry=0x7fffb8001040, migrating=<optimized out>)
    at qemu/qemu_command.c:6445
(gdb) f2
(gdb) p *host_model
$23 = {name = 0x7fffb800ec50 "qemu64", vendor = 0x0, signature = 0, data = {
    len = 2, data = 0x7fffb800e720}}

8 years agoqemu: command: Simplify USB controller model selection
Andrea Bolognani [Thu, 28 Jul 2016 15:39:05 +0000 (17:39 +0200)]
qemu: command: Simplify USB controller model selection

Since we now pick the default USB controller model when parsing
the guest XML, we can get rid of some duplicated code so that
the default model selection happens in one place only.

Add some comments as well.

8 years agoqemu: domain: Drop piix3-ohci controller for migration
Andrea Bolognani [Fri, 12 Aug 2016 15:10:40 +0000 (17:10 +0200)]
qemu: domain: Drop piix3-ohci controller for migration

Now that the default USB controller model is explicit rather
than implicit for i440fx machines, we have to tweak the
conditions for dropping it in order to keep migration towards
libvirt <= 0.9.4 working.

8 years agoqemu: domain: Reflect USB controller model in guest XML
Andrea Bolognani [Thu, 28 Jul 2016 13:33:29 +0000 (15:33 +0200)]
qemu: domain: Reflect USB controller model in guest XML

When the user doesn't specify any model for a USB controller,
we use an architecture-dependent default, but we don't reflect
it in the guest XML.

Pick the default USB controller model when parsing the guest
XML instead of when creating the QEMU command line, so that
our choice is saved back to disk.

8 years agovirschematest: Initialize @data
Michal Privoznik [Fri, 12 Aug 2016 10:19:44 +0000 (12:19 +0200)]
virschematest: Initialize @data

==8630== Invalid read of size 8
==8630==    at 0x4EA4F0F: virFree (viralloc.c:582)
==8630==    by 0x4F398F0: virXMLValidatorFree (virxml.c:1257)
==8630==    by 0x40305C: mymain (virschematest.c:191)
==8630==    by 0x405159: virTestMain (testutils.c:982)
==8630==    by 0x403553: main (virschematest.c:215)
==8630==  Address 0xcd72243 is 131 bytes inside a block of size 177 free'd
==8630==    at 0x4C2B1F0: free (vg_replace_malloc.c:473)
==8630==    by 0x4EA4F19: virFree (viralloc.c:582)
==8630==    by 0x4ED0973: virFindFileInPath (virfile.c:1646)
==8630==    by 0x405149: virTestMain (testutils.c:980)
==8630==    by 0x403553: main (virschematest.c:215)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoschema: Don't validate paths
Michal Privoznik [Fri, 12 Aug 2016 08:52:30 +0000 (10:52 +0200)]
schema: Don't validate paths

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

On UNIX like systems there are no constraints on what characters
can be in file/dir names (except for NULL, obviously). Moreover,
some values that we think of as paths (e.g. disk source) are not
necessarily paths at all. For instance, some hypervisors take
that as an arbitrary identifier and corresponding file is then
looked up by hypervisor in its table. Instead of trying to fix
our regular expressions (and forgetting to include yet another
character there), lets drop the validation completely.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirNetDevMacVLanCreateWithVPortProfile: Drop @ret
Michal Privoznik [Tue, 9 Aug 2016 17:25:44 +0000 (19:25 +0200)]
virNetDevMacVLanCreateWithVPortProfile: Drop @ret

Usually, this variable is used to hold the return value for a
function of ours. Well, this is not the case. Its use does not
match our pattern and therefore it is very misleading. Drop it
and define an alternative @rc variable, but only in that single
block where it is needed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirNetDevMacVLanCreateWithVPortProfile: Drop @rc
Michal Privoznik [Tue, 9 Aug 2016 17:23:15 +0000 (19:23 +0200)]
virNetDevMacVLanCreateWithVPortProfile: Drop @rc

This variable is very misleading. We use VIR_FORCE_CLOSE to set
it to -1 and returning it even though it does not refer to a FD
at all. It merely holds 0 or -1. Drop it completely. Also, at the
same time some corner cases are fixed too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirNetDevMacVLanCreateWithVPortProfile: Don't mask virNetDevMacVLanTapOpen error
Michal Privoznik [Tue, 9 Aug 2016 16:47:49 +0000 (18:47 +0200)]
virNetDevMacVLanCreateWithVPortProfile: Don't mask virNetDevMacVLanTapOpen error

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

In this function we create a macvtap device and open its tap
device. Possibly multiple times. Now the thing is, if opening the
tap device fails, that is virNetDevMacVLanTapOpen() returns a
negative value, we unroll all the changes BUT return 0 fooling
caller into thinking everything went okay.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: fix qemu.conf security_driver
Cole Robinson [Wed, 10 Aug 2016 14:32:03 +0000 (10:32 -0400)]
qemu: fix qemu.conf security_driver

Since a9331394 (first release v2.1.0), specifying a manual
security_driver setting in qemu.conf causes the daemon to fail to
start, erroring with 'Duplicate security driver X'.

The duplicate checking was incorrectly comparing every entry
against itself, guaranteeing a false positive.

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

8 years agoconf: restrict expander buses to connect only to a root bus
Laine Stump [Sat, 6 Aug 2016 23:03:31 +0000 (19:03 -0400)]
conf: restrict expander buses to connect only to a root bus

More misunderstanding/mistaken assumptions on my part - I had thought
that a pci-expander-bus could be plugged into any legacy PCI slot, and
that pcie-expander-bus could be plugged into any PCIe slot. This isn't
correct - they can both be plugged ontly into their respective root
buses. This patch adds that restriction.

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

8 years agoconf: restrict where dmi-to-pci-bridge can be connected
Laine Stump [Fri, 5 Aug 2016 19:01:08 +0000 (15:01 -0400)]
conf: restrict where dmi-to-pci-bridge can be connected

libvirt had allowed a dmi-to-pci-bridge to be plugged in anywhere a
normal PCIe endpoint can be connected, but this is wrong - it will
only work if it's plugged into pcie-root (the PCIe root complex) or a
pcie-expander-bus (the qemu device pxb-pcie). This patch adjusts the
connection flags accordingly.

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

8 years agoconf: don't allow connecting upstream-port directly to pce-expander-bus
Laine Stump [Thu, 4 Aug 2016 17:04:12 +0000 (13:04 -0400)]
conf: don't allow connecting upstream-port directly to pce-expander-bus

I apparently misunderstood Marcel's description of what could and
couldn't be plugged into qemu's pxb-pcie controller (known as
pcie-expander-bus in libvirt) - I specifically allowed directly
connecting a pcie-switch-upstream-port, and it turns out that causes
the guest kernel to crash.

This patch forbids such a connection, and updates the xml docs
appropriately.

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

8 years agoconf: improve error log when PCI devices don't match requested controller
Laine Stump [Sat, 6 Aug 2016 01:19:27 +0000 (21:19 -0400)]
conf: improve error log when PCI devices don't match requested controller

The virDomainPCIAddressFlagsCompatible() error logs report that a
device required a controller that accepted standard PCI endpoint
devices, or PCI Express endpoint devices, and if hotplug was required
by the configuration but not provided by the selected controller. But
the wording of the error messages was apparently confusing (according
to the bugzilla report referenced below). On top of that, if the
device was something other than an endpoint device (e.g. a
pcie-switch-downstream-port) the error message was a complete punt -
it would just say that the flags were incorrect.

This patch makes the messages for PCI/PCIe endpoint and hotplug
requirements more clear, and also specifically indicates what was the
device type when it is other than an endpoint device.

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

8 years agovirt-admin: Fix the error when an invalid URI has been provided
Erik Skultety [Tue, 9 Aug 2016 14:11:26 +0000 (16:11 +0200)]
virt-admin: Fix the error when an invalid URI has been provided

After commit 9d479dd1 fiddled with the cmdConnect's output which used to be a
bit more verbose prior to the mentioned commit, the program flow would result
in a quite confusing error if an invalid URI has been provided:

    error: Failed to connect to the admin server
    Connected to the admin server
    error: <some error>

The problem is that the commit mentioned above relied on the fact that
connect routine always succeeds which is not true.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agocpu_x86: Fix host-model CPUs on hosts with CMT
Jiri Denemark [Tue, 9 Aug 2016 13:15:20 +0000 (15:15 +0200)]
cpu_x86: Fix host-model CPUs on hosts with CMT

Since the introduction of CMT features (commit v1.3.5-461-gf294b83)
starting a domain with host-model CPU on a host which supports CMT fails
because QEMU complains about unknown 'cmt' feature:

    qemu-system-x86_64: CPU feature cmt not found

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agotests: Add a test for host-model CPU with CMT feature
Jiri Denemark [Tue, 9 Aug 2016 13:03:20 +0000 (15:03 +0200)]
tests: Add a test for host-model CPU with CMT feature

The generated command line wouldn't work since QEMU doesn't know what
'cmt' is. The following patch will fix this issue.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Properly drop non-migratable features
Jiri Denemark [Tue, 28 Jun 2016 09:12:41 +0000 (11:12 +0200)]
cpu_x86: Properly drop non-migratable features

By removing a non-migratable feature in a for loop we would fail to drop
every second non-migratable feature if the features array contained
several of them in a row.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Introduce x86FeatureIsMigratable
Jiri Denemark [Tue, 28 Jun 2016 08:51:41 +0000 (10:51 +0200)]
cpu_x86: Introduce x86FeatureIsMigratable

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agovirsh: clarify snapshot --live
Chen Hanxiao [Fri, 5 Aug 2016 07:23:52 +0000 (15:23 +0800)]
virsh: clarify snapshot --live

In libvirt, snapshot means disk snapshot.
snapshot --live is more like VM checkpoint.
Make it clear in virsh.pod.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>