]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agolibxl: support usb controller hotplug
Chunyan Liu [Wed, 15 Jun 2016 06:00:10 +0000 (14:00 +0800)]
libxl: support usb controller hotplug

Support USB controller hot-plug and hot-unplug.

 #virsh attach-device dom usbctrl.xml
 #virsh detach-device dom usbctrl.xml
 usbctrl.xml example:
 <controller type='usb' index='0' model='qusb2'>

Signed-off-by: Chunyan Liu <cyliu@suse.com>
8 years agolibxl: support USB controllers in creation time
Chunyan Liu [Wed, 15 Jun 2016 06:00:09 +0000 (14:00 +0800)]
libxl: support USB controllers in creation time

To support USB Controller in xen guest domains, just add
USB controller in domain config xml as following:
<controller type='usb' model='qusb2' ports='4'/>

Signed-off-by: Chunyan Liu <cyliu@suse.com>
8 years agoextend usb controller model to support xen pvusb
Chunyan Liu [Wed, 15 Jun 2016 06:00:08 +0000 (14:00 +0800)]
extend usb controller model to support xen pvusb

According to libxl implementation, it supports pvusb
controller of version 1.1 and version 2.0, and it
supports two types of backend, 'pvusb' (dom0 backend)
and 'qusb' (qemu backend). But currently pvusb backend
is not checked in yet.

To match libxl support, extend usb controller schema
to support two more models: qusb1 (qusb, version 1.1)
and 'qusb2' (qusb version 2.0).

Signed-off-by: Chunyan Liu <cyliu@suse.com>
8 years agovirsh: qemu-monitor-command: Simplify control flow
Peter Krempa [Mon, 1 Aug 2016 04:24:35 +0000 (06:24 +0200)]
virsh: qemu-monitor-command: Simplify control flow

Construct the query string by using virBufferTrim rather than having to
remember to add a space and simplify cleanup path.

8 years agovirsh: qemu-monitor-command: Use macro for exclusive options
Peter Krempa [Mon, 1 Aug 2016 04:12:17 +0000 (06:12 +0200)]
virsh: qemu-monitor-command: Use macro for exclusive options

8 years agoqemu: cap: Refactor access to array in virQEMUCapsProbeQMPMachineTypes
Peter Krempa [Fri, 29 Jul 2016 08:35:48 +0000 (10:35 +0200)]
qemu: cap: Refactor access to array in virQEMUCapsProbeQMPMachineTypes

Use a temporary pointer rather than always recalculating the index in a
very verbose way.

8 years agoqemu: caps: Sanitize storage of machine type related data
Peter Krempa [Fri, 29 Jul 2016 08:13:46 +0000 (10:13 +0200)]
qemu: caps: Sanitize storage of machine type related data

Add a structure to store the data and use a single array of the
structures rather than having 3 separate arrays with shared indexes.

8 years agoqemu: capabilities: Drop unused function virQEMUCapsGetMachineTypes
Peter Krempa [Fri, 29 Jul 2016 08:12:05 +0000 (10:12 +0200)]
qemu: capabilities: Drop unused function virQEMUCapsGetMachineTypes

8 years agostorage: Clean up volume wiping
Martin Kletzander [Thu, 14 Jul 2016 05:27:02 +0000 (07:27 +0200)]
storage: Clean up volume wiping

Let's cleanly differentiate what wiping a volume does for ploop and
other volumes so it's more readable what is done for each one instead of
branching out multiple times in different parts of the same function.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agostorage: Use path instead of volume as an argument
Martin Kletzander [Mon, 1 Aug 2016 12:04:29 +0000 (14:04 +0200)]
storage: Use path instead of volume as an argument

Some functions use volume specification merely to use the target path
from it.  Let's change it to pass the path only so that it can be used
for other files than just volumes.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agostorage: Move functions around
Martin Kletzander [Mon, 1 Aug 2016 11:38:10 +0000 (13:38 +0200)]
storage: Move functions around

This is done in order to call them in next patches from each other and
definitions would be missing otherwise.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: Fix domain state after reset
Martin Kletzander [Wed, 13 Jul 2016 14:13:58 +0000 (16:13 +0200)]
qemu: Fix domain state after reset

When reset was called from a domain that crashed we didn't change the
crashed state into a paused one which could confuse users.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agovirsh: Report error when explicit connection fails
Martin Kletzander [Fri, 29 Jul 2016 06:09:22 +0000 (08:09 +0200)]
virsh: Report error when explicit connection fails

Commit 0c56d9431839 forgot to return false in the cmdConnect command
after the clean up made there.

Before (assuming you don't have uri alias for 'asdf'):
  $ virsh connect asdf
  error: failed to connect to the hypervisor

  $ echo $?
  0

After (with the same assumption):
  $ virsh connect asdf
  error: failed to connect to the hypervisor
  error: no connection driver available for asdf

  $ echo $?
  1

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: Fix support for startupPolicy with volume/pool disks
Martin Kletzander [Mon, 1 Aug 2016 15:51:28 +0000 (17:51 +0200)]
qemu: Fix support for startupPolicy with volume/pool disks

Until now we simply errored out when the translation from pool+volume
failed.  However, we should instead check whether that disk is needed or
not since there is an option for that.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: Remove unnecessary label and its only reference
Martin Kletzander [Mon, 1 Aug 2016 15:56:26 +0000 (17:56 +0200)]
qemu: Remove unnecessary label and its only reference

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: Make qemuDomainCheckDiskStartupPolicy self-contained
Martin Kletzander [Mon, 1 Aug 2016 15:52:02 +0000 (17:52 +0200)]
qemu: Make qemuDomainCheckDiskStartupPolicy self-contained

There is an error reset following the function and check for
startupPolicy before that.  Let's reflect those things inside that
function so that future code doesn't have to be that complex.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoPost-release version bump to 2.2.0
Michal Privoznik [Tue, 2 Aug 2016 11:00:38 +0000 (13:00 +0200)]
Post-release version bump to 2.2.0

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoFix unbalanced quotation marks
Yuri Chornoivan [Tue, 2 Aug 2016 07:04:39 +0000 (09:04 +0200)]
Fix unbalanced quotation marks

8 years agoRelease of libvirt-2.1.0
Daniel Veillard [Tue, 2 Aug 2016 08:33:35 +0000 (10:33 +0200)]
Release of libvirt-2.1.0

* docs/news.html.in: updated for release
* po/*.po*: regenerated

8 years agoRevert "Fix unbalanced quotation marks"
Daniel Veillard [Tue, 2 Aug 2016 10:34:18 +0000 (12:34 +0200)]
Revert "Fix unbalanced quotation marks"

This reverts commit 6a40801186d1fcba38360f58659f898b67f08a01.
release of 2.1.0 need to go first

8 years agoFix unbalanced quotation marks
Yuri Chornoivan [Tue, 2 Aug 2016 07:04:39 +0000 (09:04 +0200)]
Fix unbalanced quotation marks

8 years agodaemon: sasl: Don't forget to save SASL username to client's identity
Erik Skultety [Thu, 28 Jul 2016 14:42:04 +0000 (16:42 +0200)]
daemon: sasl: Don't forget to save SASL username to client's identity

Once the SASL authentication process has successfully passed, we should also
save the SASL username used to client's identity, so that when a client like
virt-admin tries to obtain it, the server will actually format the username to
the response data.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoadmin: Retrieve the SASL context for both local and remote connection
Erik Skultety [Tue, 19 Jul 2016 06:55:31 +0000 (08:55 +0200)]
admin: Retrieve the SASL context for both local and remote connection

When commit 4a0e9108 added a support for client information retrieval, it made
the API return SASL identity info only for clients connected remotely, yet SASL
can be happily used with UNIX sockets as well.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agostorage: Document wiping formatted volume types
Martin Kletzander [Thu, 14 Jul 2016 09:34:14 +0000 (11:34 +0200)]
storage: Document wiping formatted volume types

When wiping a volume we just rewrite all the data of the volume, not
only the content.  Since format gets overridden, we need to recreate the
volume.  However we can't do that for every possible format out there.
Since it was only coded for the ploop volume type, let's document what
might be the consequences instead of forbidding it for every other
format out there.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: remove panic dev models s390 and pseries when migrating
Boris Fiuczynski [Thu, 28 Jul 2016 13:15:49 +0000 (15:15 +0200)]
qemu: remove panic dev models s390 and pseries when migrating

The panic devices with models s390 and pseries are autogenerated.
For backwards compatibility reasons the devices are to be removed
when migrating.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
8 years agowireshark: Drop glib dependency
Michal Privoznik [Mon, 1 Aug 2016 08:21:04 +0000 (10:21 +0200)]
wireshark: Drop glib dependency

The only function that we currently use from glib is g_sprintf().
That's a very big gun for such small target. Not only that, but
we've silently relied on wireshark dragging in the glib. Replace
the g_sprintf() with plain sprinf() so that we can drop the glib
dependency.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoschema: fix resolved interfaces of network type
Nikolay Shirokovskiy [Wed, 20 Jul 2016 12:11:46 +0000 (15:11 +0300)]
schema: fix resolved interfaces of network type

  This patch reflects cases when <interface> element and its <source>
subelement for network type are formated based on actual type resolved
from referenced network instead of original one. networkAllocateActualDevice
and virDomainActualNetDefContentsFormat are taken as reference.

8 years agoschema: add missed alias element to memory device
Nikolay Shirokovskiy [Wed, 20 Jul 2016 12:11:45 +0000 (15:11 +0300)]
schema: add missed alias element to memory device

8 years agoqemu: fix domain id after domainCreateWithFlags()
Sascha Silbe [Wed, 27 Jul 2016 14:05:20 +0000 (16:05 +0200)]
qemu: fix domain id after domainCreateWithFlags()

Ever since virDomainCreateWithFlags() was introduced by de3aadaa
[drivers: add virDomainCreateWithFlags if virDomainCreate exists], the
domain ID retrieved with virDomainGetID() was incorrect for several
drivers after virDomainCreateWithFlags() was called. The API consumer
had to look up the domain anew to retrieve the correct ID.

For the ESX driver, this was fixed in 6139b274 [esx: Update ID after
starting a domain]. For the openvz driver, it was fixed in fd81a097
[openvzDomainCreateWithFlags: set domain id to the correct value]. The
test driver, the OpenNebula driver (removed in the meantime) and the
vbox driver were already updating the domain ID correctly in
domainCreate().

Copy over the ID in qemuDomainCreateWithFlags() to fix this for the qemu
driver, too.

Fixes: de3aadaa ("drivers: add virDomainCreateWithFlags if virDomainCreate exists")
Reported-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com>
Tested-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
8 years agotests: qemu: Don't leak security manager object
Peter Krempa [Fri, 29 Jul 2016 16:06:51 +0000 (18:06 +0200)]
tests: qemu: Don't leak security manager object

==2064442== 200 (88 direct, 112 indirect) bytes in 1 blocks are definitely lost in loss record 54 of 73
==2064442==    at 0x4C2E0F0: calloc (vg_replace_malloc.c:711)
==2064442==    by 0x18E75B80: virAllocVar (viralloc.c:560)
==2064442==    by 0x18EC43B0: virObjectNew (virobject.c:193)
==2064442==    by 0x18EC476E: virObjectLockableNew (virobject.c:219)
==2064442==    by 0x1906BC73: virSecurityManagerNewDriver (security_manager.c:93)
==2064442==    by 0x1906C076: virSecurityManagerNewStack (security_manager.c:115)
==2064442==    by 0x43CC39: qemuTestDriverInit (testutilsqemu.c:548)
==2064442==    by 0x4337ED: mymain (qemumonitorjsontest.c:2440)
==2064442==    by 0x43BABE: virTestMain (testutils.c:982)
==2064442==    by 0x43A490: main (qemumonitorjsontest.c:2558)

8 years agoconf: Catch invalid memory model earlier
Michal Privoznik [Thu, 28 Jul 2016 16:20:31 +0000 (18:20 +0200)]
conf: Catch invalid memory model earlier

Consider the following XML snippet:

    <memory model=''>
      <target>
        <size unit='KiB'>523264</size>
        <node>0</node>
      </target>
    </memory>

Whats wrong you ask? The @model attribute. This should result in
an error thrown into users faces during virDomainDefine phase.
Except it doesn't. The XML validation catches this error, but if
users chose to ignore that, they will end up with invalid XML.
Well, they won't be able to start the machine - that's when error
is produced currently. But it would be nice if we could catch the
error like this earlier.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoadmin: Fix default uri config option name s/admin_uri_default/uri_default
Erik Skultety [Wed, 27 Jul 2016 11:23:03 +0000 (13:23 +0200)]
admin: Fix default uri config option name s/admin_uri_default/uri_default

The original name 'admin_uri_default' was introduced to our code by commit
dbecb87f. However, at that time we already had a separate config file for
admin library but the commit mentioned above didn't properly adjust the
config's option name. The result is that when we're loading the config, we
check a non-existent config option (there's not much to do with the URIs
anyway, since we only allow local connection). Additionally, virt-admin's man
page documents, that the default URI can be altered by setting
admin_uri_default option. So the fix proposed by this patch leaves the
libvirt-admin.conf as is and adjusts the naming in the code as well as in the
virt-admin's man page.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agowireshark: Adapt to dissector function header change
Michal Privoznik [Thu, 28 Jul 2016 08:21:45 +0000 (10:21 +0200)]
wireshark: Adapt to dissector function header change

In wireshark commit bbdd89b9 (contained in 2.1.0 release) they
have changed prototype of dissector function. Now it returns
number of bytes consumed by the dissector, and can get a pointer
to user specified data (which we don't use).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Need to free fileprops in error path
John Ferlan [Thu, 28 Jul 2016 13:25:40 +0000 (09:25 -0400)]
qemu: Need to free fileprops in error path

The virJSONValueObjectCreate only consumes the object on success, so on
failure we must free - from commit id 'f4441017' (found by Coverity).

8 years agoiscsi: Establish connection to target via static target login
John Ferlan [Sat, 16 Jul 2016 12:15:03 +0000 (08:15 -0400)]
iscsi: Establish connection to target via static target login

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

Commit id '56057900' altered the discovery of iSCSI node targets by
using the "--op nonpersistent". This caused issues for clean environments
or if by chance a "-m node -o delete" was executed.

Since each iSCSI Storage Pool has the required iSCSI target path, use
that and the virISCSINodeNew API in order to generate the iSCSI node record.

8 years agoutil: Introduce virISCSINodeNew
John Ferlan [Sat, 16 Jul 2016 12:10:30 +0000 (08:10 -0400)]
util: Introduce virISCSINodeNew

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

According to RFC 3721 (https://www.ietf.org/rfc/rfc3721.txt), there are
two ways to "discover" targets in/for the iSCSI environment. Discovery
is the process which allows the initiator to find the targets to which
it has access and at least one address at which each target may be
accessed.

The method currently implemented in libvirt using the virISCSIScanTargets
API is known as "SendTargets" discovery. This method is more useful when
the target IP Address and TCP port information are available, e.g. in
libvirt terms the "portal". It returns a list of targets for the portal.
From that list, the target can be found. This operation can also fill an
iSCSI node table into which iSCSI logins may occur. Commit id '56057900'
altered that filling by adding the "--op nonpersistent" since it was
not necessarily desired to perform that for non libvirt related targets.

The second method is "Static Configuration". This method not only needs
the IP Address and TCP port (e.g. portal), but also the iSCSI target name.
In libvirt terms this would be the device path field from the iSCSI pool
<source> XML. This patch implements the second methodology using that
required device path as the targetname.

8 years agotools: Make use of the correct environment variables
Erik Skultety [Thu, 28 Jul 2016 10:54:16 +0000 (12:54 +0200)]
tools: Make use of the correct environment variables

Since commit 834c5720 which extracted the generic functionality out of virsh
and made it available for other clients like virt-admin to make use of it, it
also introduced a bug when it renamed the original VIRSH_ environment variables
to VSH_ variables. Virt-admin of course suffers from the same bug, so this
patch modifies the generic module vsh.c to construct the correct name for
environment variables of each client from information it has.

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agovsh: Make vshInitDebug return int instead of void
Erik Skultety [Thu, 28 Jul 2016 10:33:21 +0000 (12:33 +0200)]
vsh: Make vshInitDebug return int instead of void

Well, the reason behind this change is that if the function is extended in some
way that e.g. would involve allocation we do not have a way of telling it to
the caller. More specifically, vshInitDebug only relies on some hardcoded
environment variables (by a mistake) that aren't documented anywhere so neither
virsh's nor virt-admin's documented environment variables take effect. One
possible solution would be duplicate the code for each CLI client or leave the
method be generic and provide means that it could figure out, which client
called it, thus initializing the proper environment variables but that could
involve operations that might as well fail in certain circumstances and the
caller should know that an error occurred.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoRefresh translations from zanata
Daniel P. Berrange [Thu, 28 Jul 2016 10:22:28 +0000 (11:22 +0100)]
Refresh translations from zanata

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovshReadlineParse: Drop some unused variables
Michal Privoznik [Wed, 27 Jul 2016 15:40:35 +0000 (17:40 +0200)]
vshReadlineParse: Drop some unused variables

My compiler identified some variables that were set, but never
actually used. For instance, opts_required, and data_acomplete.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovshCmddefGetOption: Change type of opt_index
Michal Privoznik [Wed, 27 Jul 2016 15:28:40 +0000 (17:28 +0200)]
vshCmddefGetOption: Change type of opt_index

This function tries to look up desired option for a given parsed
command. Upon successful return it also stores option position
into passed *opt_index. Now, this variable is type of int, even
though it is never ever used to store negative value. Moreover,
the variable is set from a local variable which is type of
size_t.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agolibvirt.spec.in: fix indentation in previous commit
Daniel P. Berrange [Thu, 28 Jul 2016 10:48:00 +0000 (11:48 +0100)]
libvirt.spec.in: fix indentation in previous commit

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoFix RPM spec for wireshark on Fedora < 24
Daniel P. Berrange [Thu, 28 Jul 2016 10:00:18 +0000 (11:00 +0100)]
Fix RPM spec for wireshark on Fedora < 24

This previous commit

  commit cd9fcc8be7dcb9126d70f744ce54b0b742eeefb8
  Author: Michal Privoznik <mprivozn@redhat.com>
  Date:   Wed Jul 27 16:58:32 2016 +0200

    libvirt.spec.in: Adapt to newest wireshark plugindir

Adapted the libvirt spec for wireshark >= 2.1.0 but
this ignored the fact that we enable wireshark from
Fedora 21 and 2.1.0 was only added in Fedora 24

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agostorage: remove "luks" storage volume type
Daniel P. Berrange [Tue, 26 Jul 2016 16:41:46 +0000 (17:41 +0100)]
storage: remove "luks" storage volume type

The current LUKS support has a "luks" volume type which has
a "luks" encryption format.

This partially makes sense if you consider the QEMU shorthand
syntax only requires you to specify a format=luks, and it'll
automagically uses "raw" as the next level driver. QEMU will
however let you override the "raw" with any other driver it
supports (vmdk, qcow, rbd, iscsi, etc, etc)

IOW the intention though is that the "luks" encryption format
is applied to all disk formats (whether raw, qcow2, rbd, gluster
or whatever). As such it doesn't make much sense for libvirt
to say the volume type is "luks" - we should be saying that it
is a "raw" file, but with "luks" encryption applied.

IOW, when creating a storage volume we should use this XML

  <volume>
    <name>demo.raw</name>
    <capacity>5368709120</capacity>
    <target>
      <format type='raw'/>
      <encryption format='luks'>
        <secret type='passphrase' uuid='0a81f5b2-8403-7b23-c8d6-21ccd2f80d6f'/>
      </encryption>
    </target>
  </volume>

and when configuring a guest disk we should use

  <disk type='file' device='disk'>
    <driver name='qemu' type='raw'/>
    <source file='/home/berrange/VirtualMachines/demo.raw'/>
    <target dev='sda' bus='scsi'/>
    <encryption format='luks'>
      <secret type='passphrase' uuid='0a81f5b2-8403-7b23-c8d6-21ccd2f80d6f'/>
    </encryption>
  </disk>

This commit thus removes the "luks" storage volume type added
in

  commit 318ebb36f1027b3357a32d6f781bd77d7a9043fd
  Author: John Ferlan <jferlan@redhat.com>
  Date:   Tue Jun 21 12:59:54 2016 -0400

    util: Add 'luks' to the FileTypeInfo

The storage file probing code is modified so that it can probe
the actual encryption formats explicitly, rather than merely
probing existance of encryption and letting the storage driver
guess the format.

The rest of the code is then adapted to deal with
VIR_STORAGE_FILE_RAW w/ VIR_STORAGE_ENCRYPTION_FORMAT_LUKS
instead of just VIR_STORAGE_FILE_LUKS.

The commit mentioned above was included in libvirt v2.0.0.
So when querying volume XML this will be a change in behaviour
vs the 2.0.0 release - it'll report 'raw' instead of 'luks'
for the volume format, but still report 'luks' for encryption
format.  I think this change is OK because the storage driver
did not include any support for creating volumes, nor starting
guets with luks volumes in v2.0.0 - that only since then.
Clearly if we change this we must do it before v2.1.0 though.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirstoragefile: refactor virStorageFileMatchesNNN methods
Daniel P. Berrange [Tue, 26 Jul 2016 17:10:41 +0000 (18:10 +0100)]
virstoragefile: refactor virStorageFileMatchesNNN methods

Refactor the virStorageFileMatchesNNN methods so that
they don't take a struct FileFormatInfo parameter, but
instead get the actual raw dat items they needs. This
will facilitate reuse in other contexts.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt.spec.in: Adapt to newest wireshark plugindir
Michal Privoznik [Wed, 27 Jul 2016 14:58:32 +0000 (16:58 +0200)]
libvirt.spec.in: Adapt to newest wireshark plugindir

In the old days, when wireshark plugin was introduced it was
installed under /usr/lib64/wireshark/plugins/$VERSION/ while with
wireshark-2.1.0 this path has changed just to
/usr/lib64/wireshark/plugins. We should teach our spec file about
this change.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirt-wireshark: Properly substract wireshark prefix
Michal Privoznik [Wed, 27 Jul 2016 14:44:25 +0000 (16:44 +0200)]
virt-wireshark: Properly substract wireshark prefix

So, when building wireshark plugin, we get the plugindir variable
from the wireshark.pc as well as prefix. Then we replace the
prefix in the plugindir with our own prefix where libvirt is
building to:

  plugindir="${prefix}${plugindir#ws_prefix}"

However, as you can see, there's '$' missing in front of the
ws_prefix variable. This results in the mangled plugindir, for
instance like this:

  plugindir='/usr/usr/lib64/wireshark/plugins'

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: return balloon statistics when all domain statistics reported
Derbyshev Dmitry [Wed, 13 Jul 2016 10:42:16 +0000 (13:42 +0300)]
qemu: return balloon statistics when all domain statistics reported

To collect all balloon statistics for all guests it was necessary to make
several libvirt requests. Now it's possible to get all balloon statiscs via
single connectGetAllDomainStats call.

Signed-off-by: Derbyshev Dmitry <dderbyshev@virtuozzo.com>
8 years agoqemu: split qemuDomainMemoryStats into internal and external functions
Derbyshev Dmitry [Wed, 13 Jul 2016 10:42:15 +0000 (13:42 +0300)]
qemu: split qemuDomainMemoryStats into internal and external functions

Is necessary to call it from other contexts, such as qemuDomainGetStatsBalloon.

Signed-off-by: Derbyshev Dmitry <dderbyshev@virtuozzo.com>
8 years agoqemu: fix domain memory 'last-update' timestamp
Pavel Hrdina [Wed, 27 Jul 2016 13:33:44 +0000 (15:33 +0200)]
qemu: fix domain memory 'last-update' timestamp

This fixes commit 200a40f9 which introduced 'last-update' timestamp.

Signed-off-by: Derbyshev Dmitry <dderbyshev@virtuozzo.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu: fix domain memory 'usable' stat
Pavel Hrdina [Wed, 27 Jul 2016 13:28:55 +0000 (15:28 +0200)]
qemu: fix domain memory 'usable' stat

This fixes commit 65bf0446 which introduced 'usable' stat.

Signed-off-by: Derbyshev Dmitry <dderbyshev@virtuozzo.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agovirsh: Add balloon stats description to .pod
Derbyshev Dmitry [Wed, 13 Jul 2016 10:42:12 +0000 (13:42 +0300)]
virsh: Add balloon stats description to .pod

Description for existing balloon stats was missing for dommemstat.

Signed-off-by: Derbyshev Dmitry <dderbyshev@virtuozzo.com>
8 years agovirt-admin.pod: Remove a statement about remote access to the daemon
Erik Skultety [Wed, 27 Jul 2016 11:39:57 +0000 (13:39 +0200)]
virt-admin.pod: Remove a statement about remote access to the daemon

There's been a forgotten fragment (copy-paste error probably) in the
virt-admin's man page referring the reader to our web page on how to construct
URIs in case of remote access, which sort of implies that we support it which
we don't at the moment, so better remove that.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agoqemu: command: Add support for multi-host gluster disks
Prasanna Kumar Kalever [Mon, 25 Jul 2016 13:24:54 +0000 (15:24 +0200)]
qemu: command: Add support for multi-host gluster disks

To allow using failover with gluster it's necessary to specify multiple
volume hosts. Add support for starting qemu with such configurations.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
8 years agoqemu: command: Add infrastructure for object specified disk sources
Peter Krempa [Mon, 25 Jul 2016 17:51:18 +0000 (19:51 +0200)]
qemu: command: Add infrastructure for object specified disk sources

To allow richer definitions of disk sources add infrastructure that will
allow to register functionst generating a JSON object based definition.

This infrastructure will then convert the definition to the proper
command line syntax and use it in cases where it's necessary. This will
allow to keep legacy definitions for back-compat when possible and use
the new definitions for the configurations requiring them.

8 years agoutil: qemu: Add support for numbered array members
Peter Krempa [Mon, 25 Jul 2016 17:47:40 +0000 (19:47 +0200)]
util: qemu: Add support for numbered array members

Add support for converting objects nested in arrays with a numbering
discriminator on the command line. This syntax is used for the
object-based specification of disk source properties.

8 years agostorage: gluster: Support multiple hosts in backend functions
Peter Krempa [Fri, 22 Jul 2016 07:48:51 +0000 (09:48 +0200)]
storage: gluster: Support multiple hosts in backend functions

As gluster natively supports multiple hosts for failover reasons we can
easily add the support to the storage driver code in libvirt.

Extract the code setting an individual host into a separate function and
call them in a loop. The new code also tries to keep the debug log
entries sane.

8 years agoqemu: command: Refactor code extracted to qemuBuildDriveSourceStr
Peter Krempa [Mon, 25 Jul 2016 12:33:57 +0000 (14:33 +0200)]
qemu: command: Refactor code extracted to qemuBuildDriveSourceStr

Avoid a large block by tweaking the condition skipping empty drives and
split up the switch containing two branches having different purpose.

8 years agoqemu: command: Extract drive source command line formatter
Peter Krempa [Mon, 25 Jul 2016 12:18:50 +0000 (14:18 +0200)]
qemu: command: Extract drive source command line formatter

The disk source formatting code grew rather ugly and complex and it will
get worse. Extract it into a separated function to contain the mess.

8 years agoqemu: command: Split out network disk URI building
Peter Krempa [Fri, 22 Jul 2016 08:07:24 +0000 (10:07 +0200)]
qemu: command: Split out network disk URI building

Extract the code so that it can be called from multiple places. This
also removes a tricky fallthrough in the large switch in
qemuBuildNetworkDriveStr.

8 years agoqemu: command: Rename qemuBuildNetworkDriveURI to qemuBuildNetworkDriveStr
Peter Krempa [Fri, 22 Jul 2016 08:01:04 +0000 (10:01 +0200)]
qemu: command: Rename qemuBuildNetworkDriveURI to qemuBuildNetworkDriveStr

The function builds also non-uri strings for the various protocols.

8 years agoutil: storage: Add JSON backing volume parser for 'ssh' protocol
Peter Krempa [Fri, 15 Jul 2016 13:12:10 +0000 (15:12 +0200)]
util: storage: Add JSON backing volume parser for 'ssh' protocol

8 years agoutil: storage: Add 'ssh' network storage protocol
Peter Krempa [Tue, 9 Sep 2014 15:56:04 +0000 (17:56 +0200)]
util: storage: Add 'ssh' network storage protocol

Allow using 'ssh' protocol in backing chains and later for disks
themselves.

8 years agoutil: storage: Add JSON backing store parser for 'sheepdog' protocol
Peter Krempa [Thu, 14 Jul 2016 11:07:46 +0000 (13:07 +0200)]
util: storage: Add JSON backing store parser for 'sheepdog' protocol

8 years agoutil: storage: Add JSON backing volume parser for 'nbd' protocol
Peter Krempa [Thu, 14 Jul 2016 06:10:31 +0000 (08:10 +0200)]
util: storage: Add JSON backing volume parser for 'nbd' protocol

8 years agoutil: storage: Add json pseudo protocol support for iSCSI volumes
Peter Krempa [Wed, 13 Jul 2016 13:40:33 +0000 (15:40 +0200)]
util: storage: Add json pseudo protocol support for iSCSI volumes

iSCSI is a bit odd in this aspect since it only supports URIs but using
the 'filename' property and does not have any alternative syntax.

8 years agoutil: storage: Add json pseudo protocol support for gluster volumes
Peter Krempa [Wed, 13 Jul 2016 13:35:29 +0000 (15:35 +0200)]
util: storage: Add json pseudo protocol support for gluster volumes

Along with the legacy URI based syntax add support for the brand-new
fully object based syntax.

8 years agoutil: storage: Add support for URI based backing volumes in qemu's JSON pseudo-protocol
Peter Krempa [Tue, 12 Jul 2016 15:59:58 +0000 (17:59 +0200)]
util: storage: Add support for URI based backing volumes in qemu's JSON pseudo-protocol

http(s), ftp(s) and tftp use URIs for volume definitions in the JSON
pseudo protocol so it's pretty straightforward to add support for them.

8 years agoutil: storage: Add support for host device backing specified via JSON
Peter Krempa [Thu, 14 Jul 2016 11:58:26 +0000 (13:58 +0200)]
util: storage: Add support for host device backing specified via JSON

JSON pseudo protocol for qemu allows to explicitly specify devices.
Add convertor to the internal type.

8 years agoutil: storage: Add parser for qemu's json backing pseudo-protocol
Peter Krempa [Fri, 8 Apr 2016 07:55:46 +0000 (09:55 +0200)]
util: storage: Add parser for qemu's json backing pseudo-protocol

Add a modular parser that will allow to parse 'json' backing definitions
that are supported by qemu. The initial implementation adds support for
the 'file' driver.

Due to the approach qemu took to implement the JSON backing strings it's
possible to specify them in two approaches.

The object approach:
    json:{ "file" : { "driver":"file",
                      "filename":"/path/to/file"
                    }
         }

And a partially flattened approach:
    json:{"file.driver":"file"
          "file.filename":"/path/to/file"
         }

Both of the above are supported by qemu and by the code added in this
commit. The current implementation de-flattens the first level ('file.')
if possible and required. Other handling may be added later but
currently only one level was possible anyways.

8 years agoutil: json: Make first argument of virJSONValueCopy const
Peter Krempa [Wed, 27 Jul 2016 08:39:23 +0000 (10:39 +0200)]
util: json: Make first argument of virJSONValueCopy const

It's just read.

8 years agoqemu: Adjust the cur_ballon on coldplug/unplug of dimms
Shivaprasad G Bhat [Thu, 21 Jul 2016 10:09:30 +0000 (15:39 +0530)]
qemu: Adjust the cur_ballon on coldplug/unplug of dimms

The cur_balloon also increases/decreases with dimm hotplug/unplug.
To be consistent, adjust the value for coldplug too. This was inconsistently
taken care when cur_ballon != memory to begin with. The patch fixes it
irrespective of that.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
8 years agovirconf: Fix config file path construction
Erik Skultety [Tue, 26 Jul 2016 12:06:13 +0000 (14:06 +0200)]
virconf: Fix config file path construction

Since commit c4bdff19, the path to the configuration file has been constructed
in the following manner:
 - if no config filename was passed to virConfLoadConfigPath, libvirt.conf was
 used as default
 - otherwise the filename was concatenated with
 "<config_dir>/libvirt/libvirt%s%s.conf" which in admin case resulted in
 "libvirt-libvirt-admin.conf.conf". Obviously, this non-existent config led to
 ignoring  all user settings in libvirt-admin.conf. This patch requires the
 config filename to be always provided as an argument with the concatenation
 being simplified.

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agodocs: Add Kimchi as Web Application
Ramon Medeiros [Thu, 14 Jul 2016 18:54:59 +0000 (15:54 -0300)]
docs: Add Kimchi as Web Application

Kimchi is a open-source interface to kvm. It runs with HTML5, simple and
easy to manage kvm guests.

Signed-off-by: Ramon Medeiros <ramonn@linux.vnet.ibm.com>
8 years agoutil: qemu: Don't generate any extra commas in virQEMUBuildCommandLineJSON
Peter Krempa [Mon, 25 Jul 2016 12:59:19 +0000 (14:59 +0200)]
util: qemu: Don't generate any extra commas in virQEMUBuildCommandLineJSON

The function would generate a leading comma. Let the callers properly
add commas by formatting the commas at the end and trimming the trailing
one.

8 years agoutil: qemu: Allow for different approaches to format JSON arrays
Peter Krempa [Fri, 22 Jul 2016 15:50:03 +0000 (17:50 +0200)]
util: qemu: Allow for different approaches to format JSON arrays

For use with memory hotplug virQEMUBuildCommandLineJSONRecurse attempted
to format JSON arrays as bitmap on the command line. Make the formatter
function configurable so that it can be reused with different syntaxes
of arrays such as numbered arrays for use with disk sources.

This patch extracts the code and adds a parameter for the function that
will allow to plug in different formatters.

8 years agoutil: qemu: Allow nested objects in JSON -> commandline generator
Peter Krempa [Fri, 22 Jul 2016 15:19:28 +0000 (17:19 +0200)]
util: qemu: Allow nested objects in JSON -> commandline generator

Move the iterator of objects to the recursive function so that nested
objects are supported by flattening the structure with '.' delimiters.

8 years agoutil: qemu: Add support for user-passed strings in JSON->commandline
Peter Krempa [Mon, 25 Jul 2016 12:37:47 +0000 (14:37 +0200)]
util: qemu: Add support for user-passed strings in JSON->commandline

Until now the JSON->commandline convertor was used only for objects
created by qemu. To allow reusing it with disk formatter we'll need to
escape ',' as usual in qemu commandlines.

8 years agoutil: qemu: Add wrapper for JSON -> commandline conversion
Peter Krempa [Fri, 22 Jul 2016 13:54:57 +0000 (15:54 +0200)]
util: qemu: Add wrapper for JSON -> commandline conversion

Refactor the command line generator by adding a wrapper (with
documentation) that will handle the outermost object iteration.

This patch also renames the functions and tweaks the error message for
nested arrays to be more universal.

The new function is then reused to simplify qemucommandutiltest.

8 years agoutil: json: Make first argument of virJSONValueObjectForeachKeyValue const
Peter Krempa [Fri, 22 Jul 2016 14:56:37 +0000 (16:56 +0200)]
util: json: Make first argument of virJSONValueObjectForeachKeyValue const

The iterator function (second argument) already requires that the object
is handled as 'const' thus we won't modify the object itself.

8 years agotests: Add testing of backing store string parser
Peter Krempa [Tue, 12 Jul 2016 15:04:16 +0000 (17:04 +0200)]
tests: Add testing of backing store string parser

As we already test that the extraction of the backing store string works
well additional tests for the backing store string parser can be made
simpler.

Export virStorageSourceNewFromBackingAbsolute and use it to parse the
backing store strings, format them using virDomainDiskSourceFormat and
match them against expected XMLs.

8 years agotests: qemuxml2xml: Avoid crash when processing an XML that fails to parse
Peter Krempa [Mon, 25 Jul 2016 08:33:03 +0000 (10:33 +0200)]
tests: qemuxml2xml: Avoid crash when processing an XML that fails to parse

Failure to parse a XML that was not supposed to fail would result into a
crash in the test suite as the vcpu bitmap would not be filled prior to
the active XML->XML test.

Skip formatting of the vcpu snippet in the fake status XML formatter in
such case to avoid the crash. The test would fail anyways.

8 years agoRemove unnecessary virDomainDefClearDeviceAliases
John Ferlan [Tue, 19 Jul 2016 12:11:01 +0000 (08:11 -0400)]
Remove unnecessary virDomainDefClearDeviceAliases

Nothing in the code path after the removed call has needs/uses the alias
anyway (as would be the case for command line building or talking to monitor).
The alias is VIR_FREE'd in virDomainDeviceInfoClear which is called for any
device that needs/uses an alias via virDomainDeviceDefFree or virDomainDefFree
as well as during virDomainDeviceInfoFree for host devices.

For persistent domains, the domain definition (including aliases) gets
freed a few screens later when it's replaced with newDef.

For transient domains, the definition is freed/unref'd along with the
virDomainObj a few moments later.

8 years agoconf: Remove CCW,PCI clear address helpers
John Ferlan [Tue, 19 Jul 2016 12:06:49 +0000 (08:06 -0400)]
conf: Remove CCW,PCI clear address helpers

Since commit id 'fb06350' these are no longer called, so remove them

8 years agolibxl: implement virDomainBlockStats
Joao Martins [Mon, 25 Jul 2016 23:45:14 +0000 (00:45 +0100)]
libxl: implement virDomainBlockStats

Introduce initial support for domainBlockStats API call that
allow us to query block device statistics. OpenStack nova
uses this API call to query block statistics, alongside
virDomainMemoryStats and virDomainInterfaceStats.  Note that
this patch only introduces it for VBD for starters. QDisk
would come in a separate patch series.

A new statistics data structure is introduced to fit common
statistics among others specific to the underlying block
backends. For the VBD statistics on linux these are exported
via sysfs on the path:

"/sys/bus/xen-backend/devices/vbd-<domid>-<devid>/statistics"

To calculate the block devno libxlDiskPathToID is introduced.
Each backend implements its own function to extract statistics,
allowing support for multiple backends and different platforms.

VBD stats are exposed in reqs and number of sectors from
blkback, and it's up to us to convert it to sector sizes.
The sector size is gathered through xenstore in the device
backend entry "physical-sector-size".

BlockStatsFlags variant is also implemented which has the
added benefit of getting the number of flush requests.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
8 years agoqemu: rename QEMU_CAPS_MLOCK to QEMU_CAPS_REALTIME_MLOCK
Henning Schild [Mon, 25 Jul 2016 12:44:16 +0000 (14:44 +0200)]
qemu: rename QEMU_CAPS_MLOCK to QEMU_CAPS_REALTIME_MLOCK

Purely cosmetic change to be consistent with the other names.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
8 years agoconf: events: handle NULL uuid
Jovanka Gulicoska [Tue, 19 Jul 2016 17:23:06 +0000 (19:23 +0200)]
conf: events: handle NULL uuid

Not all objects have a uuid, such as nodedevs. When we add events
support for them, NULL will be passed here, so handle it.

8 years agonetwork: Added hook for network modification event
Anton Khramov [Wed, 13 Jul 2016 11:06:05 +0000 (13:06 +0200)]
network: Added hook for network modification event

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

8 years agoqemu: expand domain memory statistics with 'last-update' timestamp
Derbyshev Dmitry [Wed, 1 Jun 2016 17:07:07 +0000 (20:07 +0300)]
qemu: expand domain memory statistics with 'last-update' timestamp

QEMU reports timestamp along with other memory statistics, but this information is not saved into domain statistics.
It could be useful to determine if the data reported is fresh or not.
Balloon statistics are not reported in hrf, so no modifications are made in qemu_monitor_text.c.

Signed-off-by: Derbyshev Dmitry <dderbyshev@virtuozzo.com>
8 years agoqemu: expand domain memory statistics with 'usable'
Derbyshev Dmitry [Wed, 1 Jun 2016 17:07:06 +0000 (20:07 +0300)]
qemu: expand domain memory statistics with 'usable'

'memtotal' in virtio drivers and qemu corresponds to 'available' in libvirt.
Because of that, 'stat-available-memory' is renamed into 'usable'.
Balloon statistics are not reported in hrf, so no modifications are made in qemu_monitor_text.c.

Signed-off-by: Derbyshev Dmitry <dderbyshev@virtuozzo.com>
8 years agoqemu: remove ccwaddrs caching
Tomasz Flendrich [Sat, 23 Jul 2016 01:47:11 +0000 (03:47 +0200)]
qemu: remove ccwaddrs caching

Dropping the caching of ccw address set.
The cached set is not required anymore, because the set is now being
recalculated from the domain definition on demand, so the cache
can be deleted.

8 years agoqemu_hotplug: generate ccw address list on demand
Tomasz Flendrich [Sat, 23 Jul 2016 01:47:10 +0000 (03:47 +0200)]
qemu_hotplug: generate ccw address list on demand

Dropping the caching of ccw address set.
Instead of using the cached address set, functions in qemu_hotplug.c
now recalculate it on demand.

8 years agoAdd qemuDomainCCWAddrSetCreateFromDomain
Tomasz Flendrich [Sat, 23 Jul 2016 01:47:09 +0000 (03:47 +0200)]
Add qemuDomainCCWAddrSetCreateFromDomain

The address sets (pci, ccw, virtio serial) are currently cached
in qemu private data, but all the information required to recreate
these sets is in the domain definition. Therefore I am removing
the redundant data and adding a way to recalculate these sets.

Add a function that calculates the ccw address set
from the domain definition.

8 years agoqemu: remove vioserialaddrs caching
Tomasz Flendrich [Sat, 23 Jul 2016 01:47:08 +0000 (03:47 +0200)]
qemu: remove vioserialaddrs caching

Dropping the caching of virtio serial address set.
The cached set is not required anymore, because the set is now being
recalculated from the domain definition on demand, so the cache
can be deleted.

Credit goes to Cole Robinson.

8 years agoqemu_hotplug: generate vioserial address list on demand
Tomasz Flendrich [Sat, 23 Jul 2016 01:47:07 +0000 (03:47 +0200)]
qemu_hotplug: generate vioserial address list on demand

Dropping the caching of virtio serial address set.
Instead of using the cached address set, a function in qemu_hotplug.c
now recalculates it on demand.

Credit goes to Cole Robinson.

8 years agoadd virDomainVirtioSerialAddrSetCreateFromDomain
Tomasz Flendrich [Sat, 23 Jul 2016 01:47:06 +0000 (03:47 +0200)]
add virDomainVirtioSerialAddrSetCreateFromDomain

The address sets (pci, ccw, virtio serial) are currently cached
in qemu private data, but all the information required to recreate
these sets is in the domain definition. Therefore I am removing
the redundant data and adding a way to recalculate these sets.

Add a function that calculates the virtio serial address set
from the domain definition.

Credit goes to Cole Robinson.

8 years agocgroup: drop INSERT_ELEMENT usage virCgroupPartitionEscape
Ján Tomko [Tue, 14 Jun 2016 06:02:30 +0000 (08:02 +0200)]
cgroup: drop INSERT_ELEMENT usage virCgroupPartitionEscape

Use virAsprintf to prepend an underscore to make the code more
readable.

8 years agoutil: systemd: Define MSG_NOSIGNAL if needed
Andrea Bolognani [Wed, 20 Jul 2016 13:46:56 +0000 (15:46 +0200)]
util: systemd: Define MSG_NOSIGNAL if needed

The symbol being missing has been reported as causing build
failures on OS X. If it's not already defined, define it to
zero so that it won't have any effect.

8 years agoqemu_monitor: search memballoon QOM device path using alias
Pavel Hrdina [Mon, 25 Jul 2016 15:07:38 +0000 (17:07 +0200)]
qemu_monitor: search memballoon QOM device path using alias

Commit 4a585a88 introduced searching QOM device path by alias, let's use it for
memballoon too.  This may speedup the search because in most cases we will find
the correct QOM device path directly by using alias without the need for the
recursion code.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu_monitor_json: add support to search QOM device path by device alias
Pavel Hrdina [Mon, 25 Jul 2016 08:47:00 +0000 (10:47 +0200)]
qemu_monitor_json: add support to search QOM device path by device alias

Commit ce745914 introduced detection of actual video ram sizes to fix migration
if QEMU decide to modify the values provided by libvirt.  This works perfectly
for domains with number of video devices up to two.

If there are more than two video devices in the guest all the secondary devices
in the XML will have the same memory values.  This is because our current code
search for QOM device path only by the device type name and all the secondary
video devices has the same name "qxl".

This patch introduces a new search function that will try to search a QOM device
path using also device's alias if the alias is available. After that it will
fallback to the old recursive code if the alias search found no results.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>