]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
9 years agonwfilter: Fix potential locking problems on ObjLoad failure
Cole Robinson [Sun, 24 Apr 2016 22:49:02 +0000 (18:49 -0400)]
nwfilter: Fix potential locking problems on ObjLoad failure

In virNWFilterObjLoad we can still fail after virNWFilterObjAssignDef,
but we don't unlock and free the created virNWFilterObjPtr in the
cleanup path.

The bit we are trying to do after AssignDef is just STRDUP in the
configFile path. However caching the configFile in the NWFilterObj
is largely redundant and doesn't follow the same pattern we use
for domain and network objects.

So just remove all the configFile caching which fixes the latent
bug as a side effect.

9 years agonetwork: Fix segfault on daemon reload
Cole Robinson [Sun, 24 Apr 2016 21:37:13 +0000 (17:37 -0400)]
network: Fix segfault on daemon reload

We will segfault of a daemon reload picks up a new network config
that needs to be autostarted. We shouldn't be passing NULL for
network_driver here. This seems like it was missed in the larger
rework in commit 1009a61e

9 years agosend default USB controller in xml to destination during migration
Shivaprasad G Bhat [Fri, 29 Apr 2016 14:01:51 +0000 (19:31 +0530)]
send default USB controller in xml to destination during migration

The default USB controller is not sent to destination as the older versions
of libvirt(0.9.4 or earlier as I see in commit log of 409b5f54) didn't
support them. For some archs where the support started much later can
safely send the USB controllers without this worry. So, send the controller
to destination for all archs except x86. Moreover this is not very applicable
to x86 as the USB controller has model ich9_ehci1 on q35 and for pc-i440fx,
there cant be any slots before USB as it is fixed on slot 1.

The patch fixes a bug that, if the USB controller happens to occupy
a slot after disks/interfaces and one of them is hot-unplugged, then
the default USB controller added on destination takes the smallest slot
number and that would lead to savestate mismatch and migration
failure. Seen and verified on PPC64.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
9 years agoconf: format runtime DAC seclabel, unless MIGRATABLE
Cole Robinson [Sat, 23 Apr 2016 17:46:25 +0000 (13:46 -0400)]
conf: format runtime DAC seclabel, unless MIGRATABLE

We historically format runtime seclabel selinux/apparmor values,
however we skip formatting runtime DAC values. This was added in

commit 990e46c4542349f838e001d30638872576c389e9
Author: Marcelo Cerri <mhcerri@linux.vnet.ibm.com>
Date:   Fri Aug 31 13:40:41 2012 +0200

    conf: Avoid formatting auto-generated DAC labels

to maintain migration compatibility with libvirt < 0.10.0.

However the formatting was skipped unconditionally. Instead only
skip formatting in the VIR_DOMAIN_DEF_FORMAT_MIGRATABLE case.

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

9 years agoconf: storage: pool: reject name containing '/'
Cole Robinson [Tue, 26 Apr 2016 18:51:33 +0000 (14:51 -0400)]
conf: storage: pool: reject name containing '/'

Trying to define a pool name containing an embedded '/'
will immediately fail when trying to write the XML to disk.
This patch explicitly rejects names containing a '/'

Besides our stateful driver, there are two other storage impls:
esx and phyp. esx doesn't support pool creation, so this should
doesn't apply.

phyp does support pool creation, and the name is passed to the
'mksp' tool, which google doesn't reveal whether it accepts '/'
or not. IMO the likeliness of this impacting any users is near zero

9 years agoconf: network: reject name containing '/'
Cole Robinson [Tue, 26 Apr 2016 16:47:42 +0000 (12:47 -0400)]
conf: network: reject name containing '/'

Trying to define a network name containing an embedded '/'
will immediately fail when trying to write the XML to disk.
This patch explicitly rejects names containing a '/'

Besides the network bridge driver, the only other network
implementation is a very thin one for virtualbox, which seems to
use the network name as a host interface name, which won't
accept '/' anyways, so I think this is fine to do unconitionally.

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

9 years agoconf: domain: reject name containing '/'
Cole Robinson [Tue, 26 Apr 2016 15:23:12 +0000 (11:23 -0400)]
conf: domain: reject name containing '/'

Trying to define a domain name containing an embedded '/'
will immediately fail when trying to write the XML to disk for
our stateful drivers. This patch explicitly rejects names
containing a '/', and provides an xmlopt feature for drivers
to avoid this validation check, which is enabled in every
non-stateful driver that already has xmlopt handling wired up.

(Technically this could reject a previously accepted vmname like
 '/foo', however at least for the qemu driver that falls over
 later when starting qemu)

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

9 years agoconf: Parse more of our nodedev XML
Martin Kletzander [Sun, 3 Apr 2016 19:01:06 +0000 (21:01 +0200)]
conf: Parse more of our nodedev XML

We were lacking tests that are checking for the completeness of our
nodedev XMLs and also whether we output properly formatted ones.  This
patch adds parsing for the capability elements inside the <capability
type='pci'> element.  Also bunch of tests are added to show everything
works properly.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoschemas: Update nodedev schema to match reality
Martin Kletzander [Sun, 3 Apr 2016 18:57:58 +0000 (20:57 +0200)]
schemas: Update nodedev schema to match reality

There were few things done in the nodedev code but we were lacking tests
for it.  And because of that we missed that the schema was not updated
either.  Fix the schema and add various test files to show the schema
is correct.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoMove capability formatting together
Martin Kletzander [Sun, 3 Apr 2016 18:36:40 +0000 (20:36 +0200)]
Move capability formatting together

All sub-PCI capabilities should be next to each other for clarity.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoChange virDevicePCIAddress to virPCIDeviceAddress
Martin Kletzander [Sun, 3 Apr 2016 18:16:51 +0000 (20:16 +0200)]
Change virDevicePCIAddress to virPCIDeviceAddress

We had both and the only difference was that the latter also included
information about multifunction setting.  The problem with that was that
we couldn't use functions made for only one of the structs (e.g.
parsing).  To consolidate those two structs, use the one in virpci.h,
include that in domain_conf.h and add the multifunction member in it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoqemu: hotplug: Fix possible memory leak of props
John Ferlan [Mon, 11 Apr 2016 14:00:32 +0000 (10:00 -0400)]
qemu: hotplug: Fix possible memory leak of props

If we failed to build the aliases or attach the chardev, then the props
would be leaked - fix that.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: hotplug: Adjust error path for attach hostdev scsi disk
John Ferlan [Mon, 11 Apr 2016 17:32:12 +0000 (13:32 -0400)]
qemu: hotplug: Adjust error path for attach hostdev scsi disk

Adjust error path logic to make it clearer how to undo the failed add.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: hotplug: Adjust error path for attach virtio disk
John Ferlan [Mon, 11 Apr 2016 13:16:54 +0000 (09:16 -0400)]
qemu: hotplug: Adjust error path for attach virtio disk

Adjust error path logic to make it clearer how to undo the failed add.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: hotplug: Adjust error path for attach scsi disk
John Ferlan [Mon, 11 Apr 2016 13:42:54 +0000 (09:42 -0400)]
qemu: hotplug: Adjust error path for attach scsi disk

Adjust error path logic to make it clearer how to undo the failed add.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Use qemuDomainSecretInfoPtr in qemuBuildNetworkDriveURI
John Ferlan [Thu, 7 Apr 2016 18:53:14 +0000 (14:53 -0400)]
qemu: Use qemuDomainSecretInfoPtr in qemuBuildNetworkDriveURI

Rather than take username and password as parameters, now take
a qemuDomainSecretInfoPtr and decode within the function.

NB: Having secinfo implies having the username for a plain type
    from a successful virSecretGetSecretString

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuDomainSecretHostdevPrepare and Destroy
John Ferlan [Wed, 6 Apr 2016 14:41:33 +0000 (10:41 -0400)]
qemu: Introduce qemuDomainSecretHostdevPrepare and Destroy

Similar to the qemuDomainSecretDiskPrepare, generate the secret
for the Hostdev's prior to call qemuProcessLaunch which calls
qemuBuildCommandLine. Additionally, since the secret is not longer
added as part of building the command, the hotplug code will need
to make the call to add the secret in the hostdevPriv.

Since this then is the last requirement to pass a virConnectPtr
to qemuBuildCommandLine, we now can remove that as part of these
changes. That removal has cascading effects through various callers.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuDomainHostdevPrivatePtr
John Ferlan [Wed, 6 Apr 2016 13:46:49 +0000 (09:46 -0400)]
qemu: Introduce qemuDomainHostdevPrivatePtr

Modeled after the qemuDomainDiskPrivatePtr logic, create a privateData
pointer in the _virDomainHostdevDef to allow storage of private data
for a hypervisor in order to at least temporarily store auth/secrets
data for usage during qemuBuildCommandLine.

NB: Since the qemu_parse_command (qemuParseCommandLine) code is not
expecting to restore the auth/secret data, there's no need to add
code to handle this new structure there.

Updated copyrights for modules touched. Some didn't have updates in a
couple years even though changes have been made.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuDomainSecretPrepare and Destroy
John Ferlan [Wed, 6 Apr 2016 19:00:59 +0000 (15:00 -0400)]
qemu: Introduce qemuDomainSecretPrepare and Destroy

Rather than needing to pass the conn parameter to various command
line building API's, add qemuDomainSecretPrepare just prior to the
qemuProcessLaunch which calls qemuBuilCommandLine. The function
must be called after qemuProcessPrepareHost since it's expected
to eventually need the domain masterKey generated during the prepare
host call. Additionally, future patches may require device aliases
(assigned during the prepare domain call) in order to associate
the secret objects.

The qemuDomainSecretDestroy is called after the qemuProcessLaunch
finishes in order to clear and free memory used by the secrets
that were recently prepared, so they are not kept around in memory
too long.

Placing the setup here is beneficial for future patches which will
need the domain masterKey in order to generate an encrypted secret
along with an initialization vector to be saved and passed (since
the masterKey shouldn't be passed around).

Finally, since the secret is not added during command line build,
the hotplug code will need to get the secret into the private disk data.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuDomainSecretInfo
John Ferlan [Wed, 6 Apr 2016 12:56:52 +0000 (08:56 -0400)]
qemu: Introduce qemuDomainSecretInfo

Introduce a new private structure to hold qemu domain auth/secret data.
This will be stored in the qemuDomainDiskPrivate as a means to store the
auth and fetched secret data rather than generating during building of
the command line.

The initial changes will handle the current username and secret values
for rbd and iscsi disks (in their various forms). The rbd secret is
stored as a base64 encoded value, while the iscsi secret is stored as
a plain text value. Future changes will store encoded/encrypted secret
data as well as an initialization vector needed to be given to qemu
in order to decrypt the encoded password along with the domain masterKey.
The inital assumption will be that VIR_DOMAIN_SECRET_INFO_PLAIN is
being used.

Although it's expected that the cleanup of the secret data will be
done immediately after command line generation, reintroduce the object
dispose function qemuDomainDiskPrivateDispose to handle removing
memory associated with the structure for "normal" cleanup paths.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoAdapt augeas profile to handle negative int values.
Cédric Bosdonnat [Fri, 15 Apr 2016 15:01:02 +0000 (17:01 +0200)]
Adapt augeas profile to handle negative int values.

Introducing keepalive_interval = -1 breaks to augeas lens. Fix the lens
by allowing signed ints in the regular expression.

9 years agoqemu: monitor: Kill legacy PCI hotplug code
Peter Krempa [Tue, 26 Apr 2016 13:23:40 +0000 (15:23 +0200)]
qemu: monitor: Kill legacy PCI hotplug code

9 years agoqemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainAttachControllerDevice
Peter Krempa [Tue, 26 Apr 2016 13:15:03 +0000 (15:15 +0200)]
qemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainAttachControllerDevice

9 years agoqemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainDetachNetDevice
Peter Krempa [Tue, 26 Apr 2016 13:09:49 +0000 (15:09 +0200)]
qemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainDetachNetDevice

9 years agoqemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainDetachHostPCIDevice
Peter Krempa [Tue, 26 Apr 2016 13:06:07 +0000 (15:06 +0200)]
qemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainDetachHostPCIDevice

9 years agoqemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainDetachControllerDevice
Peter Krempa [Tue, 26 Apr 2016 13:03:01 +0000 (15:03 +0200)]
qemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainDetachControllerDevice

9 years agoqemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainDetachVirtioDiskDevice
Peter Krempa [Tue, 26 Apr 2016 12:53:46 +0000 (14:53 +0200)]
qemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainDetachVirtioDiskDevice

9 years agoqemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainAttachHostPCIDevice
Peter Krempa [Tue, 26 Apr 2016 12:23:12 +0000 (14:23 +0200)]
qemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainAttachHostPCIDevice

9 years agoqemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainAttachNetDevice
Peter Krempa [Tue, 26 Apr 2016 12:04:49 +0000 (14:04 +0200)]
qemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainAttachNetDevice

9 years agoqemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainAttachVirtioDiskDevice
Peter Krempa [Tue, 26 Apr 2016 11:51:41 +0000 (13:51 +0200)]
qemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainAttachVirtioDiskDevice

After killing one of the conditionals it's now guaranteed to have
@drivealias populated when calling the monitor, so the code attempting
to cleanup can be simplified.

9 years agoqemu: monitor: Kill legacy USB monitor code
Peter Krempa [Tue, 26 Apr 2016 11:45:15 +0000 (13:45 +0200)]
qemu: monitor: Kill legacy USB monitor code

Code was obsoleted by using -device.

9 years agoqemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainAttachHostUSBDevice
Peter Krempa [Tue, 26 Apr 2016 11:40:34 +0000 (13:40 +0200)]
qemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainAttachHostUSBDevice

9 years agoqemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainAttachUSBMassStorageDevice
Peter Krempa [Tue, 26 Apr 2016 11:35:37 +0000 (13:35 +0200)]
qemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainAttachUSBMassStorageDevice

9 years agoqemu: remove default case from few typecasted enums
Peter Krempa [Tue, 26 Apr 2016 12:18:04 +0000 (14:18 +0200)]
qemu: remove default case from few typecasted enums

Commit 98c5c53d69b partially reverted the effort to use typecasted enums
for compiler notification. Turn it back.

9 years agoqemu: process: Don't needlesly clear the perf events in qemuDomainPerfRestart
Peter Krempa [Wed, 27 Apr 2016 13:22:33 +0000 (15:22 +0200)]
qemu: process: Don't needlesly clear the perf events in qemuDomainPerfRestart

At that point the perf events struct should not be allocated so there's
no use in clearing it.

9 years agoqemu: process: Fix failure semantics for perf events
Peter Krempa [Wed, 27 Apr 2016 12:58:32 +0000 (14:58 +0200)]
qemu: process: Fix failure semantics for perf events

For strange reasons if a perf event type was not supported or failed to
be enabled at VM start libvirt would ignore the failure.

On the other hand on restart if the event could not be re-enabled
libvirt would fail to reconnect to the VM and kill it.

Both don't make really sense. Fix it by failing to start the VM if the
event is not supported and change the event to disabled if it can't be
reconnected (unlikely).

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

9 years agoutil: perf: Adhere to coding style of error checks in qemuDomainSetPerfEvents
Peter Krempa [Wed, 27 Apr 2016 12:57:28 +0000 (14:57 +0200)]
util: perf: Adhere to coding style of error checks in qemuDomainSetPerfEvents

9 years agoutil: perf: Adhere to coding style of error checks in virPerfEventEnable
Peter Krempa [Wed, 27 Apr 2016 12:57:28 +0000 (14:57 +0200)]
util: perf: Adhere to coding style of error checks in virPerfEventEnable

9 years agoutil: perf: Use 'error' label in virPerfCmtEnable
Peter Krempa [Wed, 27 Apr 2016 12:55:12 +0000 (14:55 +0200)]
util: perf: Use 'error' label in virPerfCmtEnable

The label is used only for the error path, thus rename cleanup.

9 years agoqemu: perf: Don't ignore perf setup if allocation fails
Peter Krempa [Wed, 27 Apr 2016 12:40:23 +0000 (14:40 +0200)]
qemu: perf: Don't ignore perf setup if allocation fails

Reject the VM startup if the perf event structure can't be allocated.

9 years agoqemu: hotplug: Allow update of disk default snapshot location
Peter Krempa [Thu, 28 Apr 2016 15:57:33 +0000 (17:57 +0200)]
qemu: hotplug: Allow update of disk default snapshot location

Since the field is internal to libvirt we can allow the users to modify
it.

9 years agoqemu: domain: Check few more fields for when changing disk source
Peter Krempa [Thu, 28 Apr 2016 14:45:02 +0000 (16:45 +0200)]
qemu: domain: Check few more fields for when changing disk source

Both disk->src->shared and disk->src->readonly can't be modified when
changing disk source for floppy and cdrom drives since both arguments
are passed as arguments of the disk rather than the image in qemu.

Historically these fields have only two possible values since they are
represented as XML thus we need to ignore if user did not provide them
and thus we are treating them as false.

9 years agoqemu: domain: Fix error message in qemuDomainDiskChangeSupported
Peter Krempa [Thu, 28 Apr 2016 15:50:40 +0000 (17:50 +0200)]
qemu: domain: Fix error message in qemuDomainDiskChangeSupported

disk->dst represents the <target> element in the XML.

9 years agoqemu: hotplug: Skip waiting for tray opening if qemu doesn't notify us
Peter Krempa [Fri, 29 Apr 2016 11:49:13 +0000 (13:49 +0200)]
qemu: hotplug: Skip waiting for tray opening if qemu doesn't notify us

If qemu doesn't support DEVICE_TRAY_MOVED event the code that attempts
to change media would attempt to re-eject the tray even if it wouldn't
be notified when the tray opened. Add a capability bit and skip retrying
for old qemus.

9 years agoqemu: process: Refresh ejectable media tray state on VM start
Peter Krempa [Fri, 29 Apr 2016 11:38:51 +0000 (13:38 +0200)]
qemu: process: Refresh ejectable media tray state on VM start

Empty floppy drives start with tray in "open" state and libvirt did not
refresh it after startup. The code that inserts media into the tray then
waited until the tray was open before inserting the media and thus
floppies could not be inserted.

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

9 years agovirStream{Recv,Send}All: Increase client buffer
Michal Privoznik [Wed, 13 Apr 2016 08:03:50 +0000 (10:03 +0200)]
virStream{Recv,Send}All: Increase client buffer

These are wrappers over virStreamRecv and virStreamSend so that
users have to care about nothing but writing data into / reading
data from a sink (typically a file). Note, that these wrappers
are used exclusively on client side as the daemon has slightly
different approach. Anyway, the wrappers allocate this buffer and
use it for intermediate data storage until the data is passed to
stream to send, or to the client application. So far, we are
using 64KB buffer. This is enough, but suboptimal because server
can send messages up to VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX bytes
big (262120B, roughly 256KB). So if we make the buffer this big,
a single message containing the data is sent instead of four,
which is current situation. This means lower overhead, because
each message contains a header which needs to be processed, each
message is processed roughly same amount of time regardless of
its size, less bytes need to be sent through the wire, and so on.
Note that since server will never sent us a stream message bigger
than VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX there's no point in
sizing up the client buffer past this threshold.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirnetclientstream: Process stream messages later
Michal Privoznik [Sat, 9 Apr 2016 07:24:51 +0000 (09:24 +0200)]
virnetclientstream: Process stream messages later

There are two functions on the client that handle incoming stream
data.  The first one virNetClientStreamQueuePacket() is a low
level function that just processes the incoming stream data from
the socket and stores it into an internal structure. This happens
in the client event loop therefore the shorter the callbacks are,
the better. The second function virNetClientStreamRecvPacket()
then handles copying data from internal structure into a client
provided buffer.
Change introduced in this commit makes just that: new queue for
incoming stream packets is introduced. Then instead of copying
data into intermediate internal buffer and then copying them into
user buffer, incoming stream messages are queue into the queue
and data is copied just once - in the upper layer function
virNetClientStreamRecvPacket(). In the end, there's just one
copying of data and therefore shorter event loop callback. This
should boost the performance which has proven to be the case in
my testing.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoRevert "rpc: Fix slow volume download (virsh vol-download)"
Michal Privoznik [Sat, 9 Apr 2016 06:55:25 +0000 (08:55 +0200)]
Revert "rpc: Fix slow volume download (virsh vol-download)"

This reverts commit d9c9e138f22c48626f719f880920e04c639e0177.

Unfortunately, things are going to be handled differently so this
commit must go.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agotools: Fix connect command
Martin Kletzander [Thu, 21 Apr 2016 12:06:10 +0000 (14:06 +0200)]
tools: Fix connect command

The man page says: "(Re)-Connect to the hypervisor. When the shell is
first started, this is automatically run with the URI parameter
requested by the "-c" option on the command line."  However, if you run:

  virsh -c 'test://default' 'connect; uri'

the output will not be 'test://default'.  That's because the 'connect'
command does not care about any virsh-only related settings and if it is
run without parameters, it connects with @uri == NULL.  Not only that
doesn't comply to what the man page describes, but it also doesn't make
sense.  It also means you aren't able to reconnect to whatever you are
connected currently.

So let's fix that in both virsh and virt-admin add a test case for it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoPost-release version bump to 1.3.5
John Ferlan [Sun, 1 May 2016 12:28:34 +0000 (08:28 -0400)]
Post-release version bump to 1.3.5

9 years agoRelease of libvirt-1.3.4
Daniel Veillard [Sun, 1 May 2016 01:50:21 +0000 (09:50 +0800)]
Release of libvirt-1.3.4

* docs/news.html.in libvirt.spec.in: update for release
* po/*.po* : regenerated

9 years agoFix minor typos in messages
Yuri Chornoivan [Fri, 29 Apr 2016 18:22:36 +0000 (21:22 +0300)]
Fix minor typos in messages

Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
9 years agoRevert "qemu domain allow to set ip address, peer address and route"
Laine Stump [Fri, 29 Apr 2016 15:32:09 +0000 (11:32 -0400)]
Revert "qemu domain allow to set ip address, peer address and route"

This reverts commit 6e244c659fb004503fd2a94319dae8fa6fecf045, which
added support to qemu for the "peer" attribute in domain interface <ip>
elements.

It's being removed temporarily for the release of libvirt 1.3.4
because the feature doesn't work, and there are concerns that it may
need to be modified in an externally visible manner which could create
backward compatibility problems.

 Conflicts:
   tests/qemuxml2argvmock.c - a mock of virNetDevSetOnline() was added
   which may be assumed by other tests added since the original commit,
   so it isn't being reverted.

9 years agoRevert "lxc domain allow to set peer address"
Laine Stump [Fri, 29 Apr 2016 15:35:08 +0000 (11:35 -0400)]
Revert "lxc domain allow to set peer address"

This reverts commit afee47d07c521b4bb10a12e253a29363d16ab8f0, which
added support to lxc for the "peer" attribute in domain interface <ip>
elements.

It's being removed temporarily for the release of libvirt 1.3.4
because the feature doesn't work, and there are concerns that it may
need to be modified in an externally visible manner which could create
backward compatibility problems.

9 years agoRevert "libvirt domain xml allow to set peer address"
Laine Stump [Fri, 29 Apr 2016 15:36:38 +0000 (11:36 -0400)]
Revert "libvirt domain xml allow to set peer address"

This reverts commit 690969af9ccdf9b2012b97af0462bae8e312c9c9, which
added the domain config parts to support a "peer" attribute in domain
interface <ip> elements.

It's being removed temporarily for the release of libvirt 1.3.4
because the feature doesn't work, and there are concerns that it may
need to be modified in an externally visible manner which could create
backward compatibility problems.

9 years agorpc: Don't leak fd via CreateXMLWithFiles
Ben Gray [Sat, 23 Apr 2016 22:38:21 +0000 (18:38 -0400)]
rpc: Don't leak fd via CreateXMLWithFiles

FD passing APIs like CreateXMLWithFiles or OpenGraphicsFD will leak
file descriptors. The user passes in an fd, which is dup()'d in
virNetClientProgramCall. The new fd is what is transfered to the
server virNetClientIOWriteMessage.

Once all the fds have been written though, the parent msg->fds list
is immediately free'd, so the individual fds are never closed.

This closes each FD as its send to the server, so all fds have been
closed by the time msg->fds is free'd.

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

9 years agovz: fix disk enumeration
Mikhail Feoktistov [Wed, 27 Apr 2016 15:37:27 +0000 (11:37 -0400)]
vz: fix disk enumeration

If we want to delete all disks for container or vm
we should make a loop from 0 to NumberOfDisks and always
use zero index in PrlVmCfg_GetHardDisk to get disk handle.
When we delete first disk after that numbers of other disks
will be changed, start from 0 to NumberOfDisks-1.
That's why we should always use zero index.

9 years agovirsh: Fix support for 64 migration options
Nikolay Shirokovskiy [Wed, 20 Apr 2016 13:51:43 +0000 (16:51 +0300)]
virsh: Fix support for 64 migration options

Add ULL suffix to all related operands of << or shift will give
all zeros instead of correct mask.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agoqemu: Regenerate VNC socket paths
Martin Kletzander [Tue, 26 Apr 2016 12:27:16 +0000 (14:27 +0200)]
qemu: Regenerate VNC socket paths

Similarly to what commit 714080791778 did with some internal paths,
clear vnc socket paths that were generated by us.  Having such path in
the definition can cause trouble when restoring the domain.  The path is
generated to the per-domain directory that contains the domain ID.
However, that ID will be different upon restoration, so qemu won't be
able to create that socket because the directory will not be prepared.

To be able to migrate to older libvirt, skip formatting the socket path
in migratable XML if it was autogenerated.  And mark it as autogenerated
if it already exists and we're parsing live XML.

Best viewed with '-C'.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoqemu: Error out if setting vcpu count would lead to invalid config
Peter Krempa [Wed, 27 Apr 2016 14:39:41 +0000 (16:39 +0200)]
qemu: Error out if setting vcpu count would lead to invalid config

When the domain definition describes a machine with NUMA, setting the
maximum vCPU count via the API might lead to an invalid config.

Add a check that will forbid this until we add more advanced cpu config
capabilities.

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

9 years agoqemu: conf: Set default logging approach in virQEMUDriverConfigNew
Peter Krempa [Wed, 27 Apr 2016 10:58:13 +0000 (12:58 +0200)]
qemu: conf: Set default logging approach in virQEMUDriverConfigNew

Instead of setting the default qemu stdio logging approach in
virQEMUDriverConfigLoadFile set it in virQEMUDriverConfigNew so that
it's properly set even when the config is not present.

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

9 years agoShorten domain name for automatic coredump
Martin Kletzander [Tue, 26 Apr 2016 07:44:18 +0000 (09:44 +0200)]
Shorten domain name for automatic coredump

If the domain name is long enough, the timestamp can prolong the
filename for automatic coredump to more than the filesystem's limit.
Simply shorten it like we do in other places.  The timestamp helps with
the unification, but having the ID in the name won't hurt.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoUnify domain name shortening
Martin Kletzander [Tue, 26 Apr 2016 06:43:40 +0000 (08:43 +0200)]
Unify domain name shortening

Add virDomainObjGetShortName() and use it.  For now that's used in one
place, but we should expose it so that future patches can use it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoqemu: Unref cfg in qemuDomainDefPostParse
Martin Kletzander [Tue, 26 Apr 2016 12:38:14 +0000 (14:38 +0200)]
qemu: Unref cfg in qemuDomainDefPostParse

Introduced by commit 15ad2ecf114d.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoconf: Drop restrictions on rng backend path
Cole Robinson [Wed, 13 Apr 2016 19:09:30 +0000 (15:09 -0400)]
conf: Drop restrictions on rng backend path

Currently we only allow /dev/random and /dev/hwrng as host input
for <rng><backend model='random'/> device. This was added after
various upstream discussions in commit 4932ef45

However this restriction has generated quite a few complaints over
the years, so a new discussion was initiated:

http://www.redhat.com/archives/libvir-list/2016-April/msg00987.html

Several people suggested removing the restriction, and nobody really
spoke up to defend it. So this patch drops the path restriction
entirely

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

9 years agoremote: Don't reject remote polkit if client lacks support
Cole Robinson [Thu, 14 Apr 2016 18:58:40 +0000 (14:58 -0400)]
remote: Don't reject remote polkit if client lacks support

If you compile a client --without-polkit, and connect to a URI that needs
polkit auth, the connection will fail with:

$ ./tools/virsh --connect qemu+ssh://crobinso@machine/system
error: failed to connect to the hypervisor
error: authentication failed: unsupported authentication type 2

This is because the client side portion of the polkit handling is
compiled out. However, nothing polkit specific is actually required
of the client.

Fix that error by unconditionally compiling the basic polkit client
handling.

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

9 years agospec: Use proper indentation
Andrea Bolognani [Tue, 26 Apr 2016 15:37:16 +0000 (17:37 +0200)]
spec: Use proper indentation

Commit 1d4400082a02 added some code that was not indented properly
and broke syntax-check. Fix it.

9 years agospec: If installing default network, restart libvirtd
Cole Robinson [Thu, 16 Apr 2015 19:42:05 +0000 (15:42 -0400)]
spec: If installing default network, restart libvirtd

If libvirt-daemon-config-network is installed while libvirtd is already
running, the daemon doesn't notice the network. Users then have to
manually restart libvirtd (or reboot) to pick up the network.

Instead let's trigger a daemon restart when the package is first installed.
Then the default network is available immediately if libvirtd was already
running.

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

9 years agoschema: Allow space character in disk vendor/product
Cole Robinson [Fri, 15 Apr 2016 17:21:27 +0000 (13:21 -0400)]
schema: Allow space character in disk vendor/product

The hex range already tried to allow for it, but it wasn't using
the correct XML hex syntax. Fix it, and test it

9 years agomaint: Ignore all intermediate and generated man pages
Andrea Bolognani [Mon, 25 Apr 2016 15:45:14 +0000 (17:45 +0200)]
maint: Ignore all intermediate and generated man pages

Since commit 9b77ce63f1d7 we create a .in file while building all
man pages, including those in the tools/ directory; update the
ignore patterns to take this change into account.

The new ignore patterns are generic enough that we can get rid of
a few existing ones as well.

9 years agoapibuild: Fix method call
Andrea Bolognani [Mon, 25 Apr 2016 12:30:14 +0000 (14:30 +0200)]
apibuild: Fix method call

9 years agoapibuild: Introduce app class
Andrea Bolognani [Mon, 25 Apr 2016 12:26:50 +0000 (14:26 +0200)]
apibuild: Introduce app class

All top-level functions have been moved to this class.

On top of that, the app.warning() method has been defined,
so that calls to it - already present in rebuild() - can
actually succeed.

9 years agoapibuild: Add index.warning() method
Andrea Bolognani [Mon, 25 Apr 2016 12:23:04 +0000 (14:23 +0200)]
apibuild: Add index.warning() method

This method is used in eg. index.merge(), but is not defined
anywhere. The implementation has been copied from docBuilder.

9 years agodocs: Pass relative paths to apibuild.py
Andrea Bolognani [Mon, 25 Apr 2016 11:40:04 +0000 (13:40 +0200)]
docs: Pass relative paths to apibuild.py

Since commit d195cffa2e1b, both $(srcdir) and $(abs_builddir)
are passed to the apibuild.py script; however, since the
former is a relative path and the latter an absolute one, the
script might not be able to detect whether they point to the
same location.

Pass both as relative paths to avoid the issue.

9 years agosecret: Change virSecretDef variable names
John Ferlan [Tue, 8 Mar 2016 16:34:56 +0000 (11:34 -0500)]
secret: Change virSecretDef variable names

Change 'ephemeral' to 'isephemeral' and 'private' to 'isprivate' since
both are bools.

9 years agosecret: Introduce virSecretObjGetValue and virSecretObjGetValueSize
John Ferlan [Tue, 8 Mar 2016 00:40:58 +0000 (19:40 -0500)]
secret: Introduce virSecretObjGetValue and virSecretObjGetValueSize

Introduce the final accessor's to _virSecretObject data and move the
structure from virsecretobj.h to virsecretobj.c

The virSecretObjSetValue logic will handle setting both the secret
value and the value_size. Some slight adjustments to the error path
over what was in secretSetValue were made.

Additionally, a slight logic change in secretGetValue where we'll
check for the internalFlags and error out before checking for
and erroring out for a NULL secret->value. That way, it won't be
obvious to anyone that the secret value wasn't set rather they'll
just know they cannot get the secret value since it's private.

9 years agosecret: Introduce virSecretObj{Get|Set}Def
John Ferlan [Tue, 8 Mar 2016 00:22:04 +0000 (19:22 -0500)]
secret: Introduce virSecretObj{Get|Set}Def

Introduce fetch and set accessor to the secretObj->def field for usage
by the driver to avoid the driver needing to know the format of virSecretObj

9 years agosecret: Introduce virSecretObjSave{Config|Data}
John Ferlan [Fri, 18 Mar 2016 14:17:25 +0000 (10:17 -0400)]
secret: Introduce virSecretObjSave{Config|Data}

Move and rename the secretRewriteFile, secretSaveDef, and secretSaveValue
from secret_driver to virsecretobj

Need to make some slight adjustments since the secretSave* functions
called secretEnsureDirectory, but otherwise mostly just a move of code.

9 years agosecret: Introduce virSecretObjDelete{Config|Data}
John Ferlan [Mon, 7 Mar 2016 23:06:57 +0000 (18:06 -0500)]
secret: Introduce virSecretObjDelete{Config|Data}

Move and rename secretDeleteSaved from secret_driver into virsecretobj and
split it up into two parts since there is error path code that looks to
just delete the secret data file

9 years agosecret: Move and rename secretLoadAllConfigs
John Ferlan [Wed, 2 Mar 2016 18:10:54 +0000 (13:10 -0500)]
secret: Move and rename secretLoadAllConfigs

Move to secret_conf.c and rename to virSecretLoadAllConfigs. Also includes
moving/renaming the supporting virSecretLoad, virSecretLoadValue, and
virSecretLoadValidateUUID.

9 years agosecret: Use the hashed virSecretObjList
John Ferlan [Thu, 25 Feb 2016 11:30:39 +0000 (06:30 -0500)]
secret: Use the hashed virSecretObjList

This patch replaces most of the guts of secret_driver.c with recently
added secret_conf.c APIs in order manage secret lists and objects
using the hashed virSecretObjList* lookup API's.

9 years agosecret: Introduce virSecretObjListGetUUIDs
John Ferlan [Sun, 28 Feb 2016 15:56:17 +0000 (10:56 -0500)]
secret: Introduce virSecretObjListGetUUIDs

Add function to return counted listed of uuids to from the hashed secrets
object list. This will replace the guts of secretConnectListSecrets.

9 years agosecret: Introduce virSecretObjListExport
John Ferlan [Mon, 29 Feb 2016 11:52:00 +0000 (06:52 -0500)]
secret: Introduce virSecretObjListExport

Add function to return a "match" filtered list of secret objects. This
function replaces the guts of secretConnectListAllSecrets.

Need to also move and make global virSecretUsageIDForDef since it'll
be used by both secret_driver.c and secret_conf.c

9 years agosecret: Introduce virSecretObjListNumOfSecrets
John Ferlan [Sun, 28 Feb 2016 14:34:21 +0000 (09:34 -0500)]
secret: Introduce virSecretObjListNumOfSecrets

Add function to count the hashed secret obj list with filters. This
will replace the guts of secret_driver's secretConnectNumOfSecrets.

9 years agosecret: Introduce virSecretObjListAdd* and virSecretObjListRemove
John Ferlan [Tue, 19 Apr 2016 20:05:38 +0000 (16:05 -0400)]
secret: Introduce virSecretObjListAdd* and virSecretObjListRemove

Add the functions to add/remove elements from the hashed secret obj list.
These will replace secret_driver functions secretAssignDef and secretObjRemove.

The virSecretObjListAddLocked will perform the necessary lookups and
decide whether to replace an existing hash entry or create a new one.
This includes setting up the configPath and base64Path as well as being
able to support the caller's need to restore from a previous definition
in case something goes wrong in the caller.

9 years agosecret: Introduce virSecretUsageIDForDef
John Ferlan [Tue, 19 Apr 2016 19:20:20 +0000 (15:20 -0400)]
secret: Introduce virSecretUsageIDForDef

Move the driver specific secretUsageIDForDef into secret_conf.c. It could
be more of a general purpose API.

9 years agosecret: Introduce virSecretObjListFindBy{UUID|Usage} support
John Ferlan [Tue, 19 Apr 2016 19:13:00 +0000 (15:13 -0400)]
secret: Introduce virSecretObjListFindBy{UUID|Usage} support

New API's including unlocked and Locked versions in order to be able
to use in either manner.

Support for searching hash object lists instead of linked lists will
replace existing secret_driver functions secretFindByUUID and
secretFindByUsage

9 years agosecret: Create virsecretobj.c and virsecretconf.h
John Ferlan [Sat, 27 Feb 2016 11:49:12 +0000 (06:49 -0500)]
secret: Create virsecretobj.c and virsecretconf.h

Move virSecretObj from secret_driver.c to virsecretobj.h

To support being able to create a hashed secrets list, move the
virSecretObj to virsecretobj.h so that the code can at least find
the definition.

This should be a temporary situation while the virsecretobj.c code
is patched in order to support a hashed secret object while still
having the linked list support in secret_driver.c. Eventually, the
goal is to move the virSecretObj into virsecretobj.c, although it
is notable that the existing model from which virSecretObj was
derived has virDomainObj in src/conf/domain_conf.h and virNetworkObj
in src/conf/network_conf.h, so virSecretObj wouldn't be unique if
it were to remain in virsecretobj.h  Still adding accessors to fetch
and store hashed object data will be the end goal.

Add definitions and infrastucture in virsecretobj.c to create and
handle a hashed virSecretObj and virSecretObjList including the class,
object, lock setup, and disposal API's. Nothing will call these yet.

This infrastructure will replace the forward linked list logic
within the secret_driver, eventually.

9 years agowireshark: Fix distcheck
Michal Privoznik [Thu, 21 Apr 2016 05:33:01 +0000 (07:33 +0200)]
wireshark: Fix distcheck

Our distcheck is broken. Well, it works but only by pure chance.
When wireshark plugin is enabled, we try to query which path
should the plugin be installed into. Firstly, we try to ask
pkg-config as some releases of wireshark already sets
corresponding variable in their pkg-config files. However, if we
obtained no value from there we try to construct the path on our
own. Based on our observations it usually is:
$libdir/wireshark/plugins/$version/.
Now, the problem is in the way we are deciding whether we have
obtained the plugin directory from pkg-config or not. Simply
said, we are checking wrong variable. The variable we are
checking has never been set, thus in our test is empty and
therefore we will always construct the plugin dir path on our
own, regardless of its presence in the pkg-config file.
To make things worse, after fixing this problem, VPATH build was
broken as it now tried to install plugin into correct directory.
Yes, this is problem, because --prefix was not honoured and
everything but the plugin was installed into given prefix. I've
managed to resolve this issue by replacing plugin dir prefix with
our own. So when doing regular installation (our prefix ==
wireshark prefix), nothing changes. When doing VPATH build &
installation plugin is installed into correctly prefixed dir.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agotools: Introduce install-nss targets
Michal Privoznik [Wed, 20 Apr 2016 08:14:23 +0000 (10:14 +0200)]
tools: Introduce install-nss targets

We do have something similar for installing init system files.
Basically I'm trying to avoid the following warning produced by
automake:

tools/Makefile.am:429: warning: uninstall-local was already defined in condition TRUE, which includes condition WITH_BSD_NSS ...
tools/Makefile.am:292: ... 'uninstall-local' previously defined here

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoMakefile: Enable distuninstallcheck again
Michal Privoznik [Wed, 20 Apr 2016 07:27:06 +0000 (09:27 +0200)]
Makefile: Enable distuninstallcheck again

This target has been disabled historically for whatever reason.
Now that we do uninstall properly enable the test again.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemuProcessCreatePretendCmd: Rework FIPS handling
Michal Privoznik [Mon, 25 Apr 2016 05:47:59 +0000 (07:47 +0200)]
qemuProcessCreatePretendCmd: Rework FIPS handling

This function - in contrast with qemuBuildCommandLine - merely
constructs our internal command representation of a domain. This
is then later compared against expected output. Or, this function
is used also in virConnectDomainXMLToNative(). But due to a copy
paste error this function, just like its image - has @forceFips
argument that if enabled forces FIPS, otherwise mimics FIPS state
in the host. If FIPS is enabled or forced the generated command
line is different to state in which FIPS is disabled. Problem is,
while this could be desired in the virConnectDomainXMLToNative()
case, this is undesirable in the test suite as it will produce
unpredicted results.
Solution to this is to rename argument to @enableFips to
specifically tell whether we expect command line to be build in
either of fashions and make virConnectDomainXMLToNative()
implementation fetch FIPS state and pass it to
qemuProcessCreatePretendCmd().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: fix error log in qemuAssignPCIAddresses()
Laine Stump [Tue, 19 Apr 2016 16:53:02 +0000 (12:53 -0400)]
qemu: fix error log in qemuAssignPCIAddresses()

This error message was too specific, based on the incorrect assumption
that any error was cause by auto-added bridges:

  failed to create PCI bridge on bus 2: too many devices
  with fixed addresses

In practice you can't know if a bridge with an index <= the bus it's
connecting to was added automatically, or if it was a mistake in
explicit config, and the auto-add problem is going to be dealt with in
a different way in an upcoming patch. The new message is this:

  PCI Controller at index 1 (0x01) has "
  bus='0x02', but bus must be <= index

(note that index is given in both decimal and hex because it is
formatted as decimal in the XML, but bus is formatted as hex, and
displaying the hex value of index makes it easier to see the problem
when index > 9 (which will often be the case with PCIe, since most
controllers only have a single port, not 32 slots as with standard
PCI)).

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

9 years agoman: Fix links
Andrea Bolognani [Wed, 13 Apr 2016 17:46:06 +0000 (19:46 +0200)]
man: Fix links

Use L<> instead of C<> for URLs and man pages.

9 years agoman: Fix SYNOPSIS section
Andrea Bolognani [Wed, 13 Apr 2016 17:57:37 +0000 (19:57 +0200)]
man: Fix SYNOPSIS section

Format the text properly.

9 years agoman: Fix NAME section
Andrea Bolognani [Wed, 13 Apr 2016 17:34:01 +0000 (19:34 +0200)]
man: Fix NAME section

podchecker(1) complained about these, eg.

  *** WARNING: Verbatim paragraph in NAME section at line 3 in
               file tools/virt-host-validate.pod

9 years agobuild: Always ship virt-login-shell.conf
Andrea Bolognani [Wed, 13 Apr 2016 17:24:51 +0000 (19:24 +0200)]
build: Always ship virt-login-shell.conf

No need to special-case this one: we can add it to EXTRA_DIST so
that it will be shipped in any case, and if WITH_LOGIN_SHELL
happens to be enabled we mark it for installation as well.

9 years agobuild: Replace variables in man pages
Andrea Bolognani [Wed, 13 Apr 2016 16:52:12 +0000 (18:52 +0200)]
build: Replace variables in man pages

We can't use eg. @sysconfdir@ directly in the .pod file, because
pod2man(1) will interpret that as a variable name and format it
accordingly.

Instead, we use eg. SYSCONFDIR and use a subsequent sed(1) call
to turn it into the expected @sysconfdir@.

9 years agobuild: Ensure intermediate files are cleaned up properly
Andrea Bolognani [Wed, 13 Apr 2016 15:12:24 +0000 (17:12 +0200)]
build: Ensure intermediate files are cleaned up properly

All $(MANINFILES) should be deleted on distclean.

9 years agobuild: Group files
Andrea Bolognani [Wed, 13 Apr 2016 15:09:14 +0000 (17:09 +0200)]
build: Group files

Define $(PODFILES) and $(MANINFILES) so that adding a new man
page only requires changes in a few, well defined spots.