]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
10 years agovbox: Rewrite vboxStorageVolCreateXML
Taowei Luo [Fri, 24 Oct 2014 01:46:46 +0000 (09:46 +0800)]
vbox: Rewrite vboxStorageVolCreateXML

If the <path> in target element is not given, libvirt will put the
new volume in ~/.VirtualBox by default.

10 years agovbox: Make CreateHardDisk support all vbox versions
Taowei Luo [Fri, 24 Oct 2014 01:46:45 +0000 (09:46 +0800)]
vbox: Make CreateHardDisk support all vbox versions

The CreateHardDiskMedium only support create HardDisk for medium
type, and it only works when vbox version >= 3.1. This patch make
the function workable with all vbox versions and rename it as
CreateHardDisk.

In vbox 2.2 and 3.0 this function will create a IHardDisk object.
In vbox later than 3.0, this function will create a IMedium object.

10 years agovbox: Rewrite vboxStorageVolLookupByPath
Taowei Luo [Fri, 24 Oct 2014 01:46:44 +0000 (09:46 +0800)]
vbox: Rewrite vboxStorageVolLookupByPath

10 years agovbox: Make FindMedium support old vbox versions
Taowei Luo [Fri, 24 Oct 2014 01:46:43 +0000 (09:46 +0800)]
vbox: Make FindMedium support old vbox versions

In old version, function FindMedium in UIVirtualBox doesn't work
for vbox2.2 and 3.0. We assume it will not be used when vbox in
these versions.

But when rewriting vboxStorageVolLookupByPath, we found it was
compatibe to use FindMedium to get a IHardDisk object, even in
vbox old versions. To achieve this, first make FindMedium call
FindHardDisk when VBOX_API_VERSION < 4000000.
Then change the argument type **IMedium to **IHardDisk. (As the
rules in heriachy, we can't transfer a IHardDisk to match
IMedium in output)

In vbox 2.2 and 3.0, the caller must be aware that they will get
a IHardDisk object in return.

10 years agovbox: Rewrite vboxStorageVolLookupByKey
Taowei Luo [Fri, 24 Oct 2014 01:46:42 +0000 (09:46 +0800)]
vbox: Rewrite vboxStorageVolLookupByKey

10 years agovbox: Rewrite vboxStorageVolLookupByName
Taowei Luo [Fri, 24 Oct 2014 01:46:41 +0000 (09:46 +0800)]
vbox: Rewrite vboxStorageVolLookupByName

10 years agovbox: Rewrite vboxStoragePoolListVolumes
Taowei Luo [Fri, 24 Oct 2014 01:46:40 +0000 (09:46 +0800)]
vbox: Rewrite vboxStoragePoolListVolumes

10 years agovbox: Rewrite vboxStoragePoolNumOfVolumes
Taowei Luo [Fri, 24 Oct 2014 01:46:39 +0000 (09:46 +0800)]
vbox: Rewrite vboxStoragePoolNumOfVolumes

We use typedef IMedium IHardDisk to make IHardDisk hierachy from
IMedium (Actually it did on vbox 2.2 and 3.0's C++ API).
So when calling
    VBOX_MEDIUM_FUNC_ARG*(IHardDisk, func, args)
we can directly replace it to
    gVBoxAPI.UIMedium.func(IHardDisk, args)

When dealing with this two types, we get some rules from it's
hierachy relationship.

When using IHardDisk and IMedium as input, we can't transfer a
IMedium to IHardDisk. Like:
    gVBoxAPI.UIHardDisk.func(IHardDisk *hardDisk, args)
    Here, we can't put a *IMedium as a argument.

When using IHardDisk and IMedium as output, we can't transfer a
IHardDisk to IMedium. Like:
    gVBoxAPI.UIMachine.GetMedium(IMedium **out)
    Here, we can't put a **IHardDisk as a argument. If this case
    do happen, we either change the API to GetHardDisk or write a
    new one.

10 years agovbox: Rewrite vbox-independent functions
Taowei Luo [Fri, 24 Oct 2014 01:46:38 +0000 (09:46 +0800)]
vbox: Rewrite vbox-independent functions

This patch rewrites the following functions
    *vboxStorageOpen
    *vboxStorageClose
    *vboxConnectNumOfStoragePools
    *vboxConnectListStoragePools
    *vboxStoragePoolLookupByName

These functions do not call any vbox API, so I directly move it
from vbox_tmpl.c to vbox_storage.c

A small improvement is made on vboxConnectListStoragePools.
The if condition nnames == 1 is modified to nnames > 0. So if the
caller put more than one slot to get active storage pools, the new
function will return exactly one, while the old one would only
return 0.

10 years agovbox: move common codes to vbox_common.h
Taowei Luo [Fri, 24 Oct 2014 01:46:37 +0000 (09:46 +0800)]
vbox: move common codes to vbox_common.h

There are lots of macro declarations in vbox_common.c,
vbox_network.c, and the coming vbox_storage.c which simply the API
calling. Since they are totally the same. We shouldn't keep three
copies of that, so they are moved to vbox_common.h.

Note: The macros are quite different from those in vbox_tmpl.c,
      because they are using different API.

10 years agovbox: Remove VBOX_OBJECT_CHECK macro
Taowei Luo [Fri, 24 Oct 2014 01:46:36 +0000 (09:46 +0800)]
vbox: Remove VBOX_OBJECT_CHECK macro

We should follow the rules that CHECK macro only do checking works.
But this VBOX_OBJECT_CHECK and VBOX_OBJECT_HOST_CHECK declared some
varibles at the same time, which broke the rule. So the patch
removed this macros and dispatched it in source code.

The storage driver is still not rewriten at this point. So, I
remains the VBOX_OBJECT_CHECK macro in vbox_tmpl.c. But this will
finally be removed in patch 'vbox: Remove unused things in vbox_tmpl.c'

10 years agovbox: Fix copyright mistake
Taowei Luo [Fri, 24 Oct 2014 01:46:35 +0000 (09:46 +0800)]
vbox: Fix copyright mistake

I made a mistake on copyright in patch 7f0f415b87.

If I copied codes from one file to another, I should copy the
copyright announcement as well. So this patch makes up the
copyright which I should have added in the previous patch.

10 years agovirsh: Improve the job type reported of virsh cmd blockcommit
Shanzhi Yu [Thu, 23 Oct 2014 10:13:15 +0000 (18:13 +0800)]
virsh: Improve the job type reported of virsh cmd blockcommit

When starting an active block commit job in virsh, it will report
"Block Commit started", but for more precise message it could
report "Active Block Commit started".

Signed-off-by: Shanzhi Yu <shyu@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoRenamed internal __mon_yday into mon_yday to avoid conflicts
Cédric Bosdonnat [Thu, 18 Sep 2014 21:23:11 +0000 (23:23 +0200)]
Renamed internal __mon_yday into mon_yday to avoid conflicts

libc has another constant with the same name, which leads to
redefinition error when building against static libvirt

10 years agoqemu_agent: Produce more readable error messages
Michal Privoznik [Tue, 28 Oct 2014 02:41:27 +0000 (03:41 +0100)]
qemu_agent: Produce more readable error messages

Not every error message from qemu-ga has to have the 'class' field
filled out. For instance, I've seen this error message lately:

  qemuAgentCheckError:1047 : unable to execute QEMU agent command \
  {"execute":"guest-set-time"}: \
  {"error":{"desc":"Invalid parameter type, expected: integer"}}

However, this got translated into rather generic error message:

  internal error: unable to execute QEMU agent command
  'guest-set-time': unknown QEMU command error

So we've dropped better error message in favor of a generic one.
This is due to our code which expects 'class' which is not
present here.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoqemu: change macvtap multicast list in response to NIC_RX_FILTER_CHANGED
Tony Krowiak [Fri, 10 Oct 2014 17:55:43 +0000 (13:55 -0400)]
qemu: change macvtap multicast list in response to NIC_RX_FILTER_CHANGED

This patch adds functionality to processNicRxFilterChangedEvent().
The old and new multicast lists are compared and the filters in
the macvtap are programmed to match the guest's filters.

Signed-off-by: Tony Krowiak <akrowiak@linux.vnet.ibm.com>
10 years agoutil: Functions to update host network device's multicast filter
Tony Krowiak [Fri, 10 Oct 2014 17:55:42 +0000 (13:55 -0400)]
util: Functions to update host network device's multicast filter

This patch provides the utility functions to needed to synchronize the
changes made to a guest domain network device's multicast filter
with the corresponding macvtap device's filter on the host:

* Get/add/remove multicast MAC addresses
* Get the macvtap device's RX filter list

Signed-off-by: Tony Krowiak <akrowiak@linux.vnet.ibm.com>
Signed-off-by: Laine Stump <laine@laine.org>
10 years agoqemu: forbid snapshot-delete --children-only on external snapshot
Eric Blake [Mon, 27 Oct 2014 11:37:34 +0000 (05:37 -0600)]
qemu: forbid snapshot-delete --children-only on external snapshot

https://bugzilla.redhat.com/show_bug.cgi?id=956506 documents that
given a domain where an internal snapshot parent has an external
snapshot child, we lacked a safety check when trying to use the
--children-only option to snapshot-delete:

$ virsh start dom
$ virsh snapshot-create-as dom internal
$ virsh snapshot-create-as dom external --disk-only
$ virsh snapshot-delete dom external
error: Failed to delete snapshot external
error: unsupported configuration: deletion of 1 external disk snapshots not supported yet
$ virsh snapshot-delete dom internal --children
error: Failed to delete snapshot internal
error: unsupported configuration: deletion of 1 external disk snapshots not supported yet
$ virsh snapshot-delete dom internal --children-only
Domain snapshot internal children deleted

While I'd still like to see patches that actually do proper external
snapshot deletion, we should at least fix the inconsistency in the
meantime.  With this patch:

$ virsh snapshot-delete dom internal --children-only
error: Failed to delete snapshot internal
error: unsupported configuration: deletion of 1 external disk snapshots not supported yet

* src/qemu/qemu_driver.c (qemuDomainSnapshotDelete): Fix condition.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoutil: eliminate "use after free" in callers of virNetDevLinkDump
Laine Stump [Wed, 15 Oct 2014 22:49:01 +0000 (00:49 +0200)]
util: eliminate "use after free" in callers of virNetDevLinkDump

virNetDevLinkDump() gets a message from netlink into "resp", then
calls nlmsg_parse() to fill the table "tb" with pointers into resp. It
then returns tb to its caller, but not before freeing the buffer at
resp. That means that all the callers of virNetDevLinkDump() are
examining memory that has already been freed. This can be verified by
filling the buffer at resp with garbage prior to freeing it (or, I
suppose, just running libvirtd under valgrind) then performing some
operation that calls virNetDevLinkDump().

The code has been like this ever since virNetDevLinkDump() was written
- the original author didn't notice it, and neither did later
additional users of the function. It has only been pure luck (or maybe
a lack of heavy load, and/or maybe an allocation algorithm in malloc()
that delays re-use of just-freed memory) that has kept this from
causing errors, for example when configuring a PCI passthrough or
macvtap passthrough network interface.

The solution taken in this patch is the simplest - just return resp to
the caller along with tb, then have the caller free it after they are
finished using the data (pointers) in tb. I alternately could have
made a cleaner interface by creating a new struct that put tb and resp
together along with a vir*Free() function for it, but this function is
only used in a couple places, and I'm not sure there will be
additional new uses of virNetDevLinkDump(), so the value of adding a
new type, extra APIs, etc. is dubious.

10 years agotests: Add SELINUX_LIBS to fix viridentitytest linker bug
Julio Faracco [Fri, 24 Oct 2014 12:33:52 +0000 (10:33 -0200)]
tests: Add SELINUX_LIBS to fix viridentitytest linker bug

In a clean build system (Ubuntu 14.04), the viridentitytest failed to compile.
Even if all the SELINUX libraries and depedencies are installed. See the error
message below:

[...]
  CC       viridentitytest.o
  CCLD     viridentitytest
/usr/bin/ld: viridentitytest.o: undefined reference to symbol
                                                       'security_disable'
//lib/x86_64-linux-gnu/libselinux.so.1: error adding symbols: DSO missing
                                                           from command line
collect2: error: ld returned 1 exit status
make: *** [viridentitytest] Error 1

Simply adding the variable SELINUX_LIBS in viridentitytest rules of
Makefile.am to include SELINUX libraries into viridentitytest solved that
compilation issue.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agovbox: network: make sure driver is not NULL in virRegisterNetworkDriver
Shanzhi Yu [Fri, 24 Oct 2014 09:31:43 +0000 (17:31 +0800)]
vbox: network: make sure driver is not NULL in virRegisterNetworkDriver

libvirtd will report below error if it does not make sure driver was not NULL
in virRegisterNetworkDriver

$ libvirtd
2014-10-24 09:24:36.443+0000: 28876: info : libvirt version: 1.2.10
2014-10-24 09:24:36.443+0000: 28876: error : virRegisterNetworkDriver:549 : driver in virRegisterNetworkDriver must not be NULL
2014-10-24 09:24:36.443+0000: 28876: error : virDriverLoadModule:99 : Failed module registration vboxNetworkRegister

Signed-off-by: Shanzhi Yu <shyu@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoAdd new driver-*.h files to DRIVER_SOURCES
Daniel P. Berrange [Fri, 24 Oct 2014 16:39:48 +0000 (17:39 +0100)]
Add new driver-*.h files to DRIVER_SOURCES

The recently added driver-*.h files were not listed in the
Makefile.am causing them to be missed when creating dists.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agoFix indentation of sysinfo data
Daniel P. Berrange [Thu, 23 Oct 2014 17:35:57 +0000 (18:35 +0100)]
Fix indentation of sysinfo data

The <sysinfo> data block was indented by 2 spaces too many.
This was missed because we never had any test validating
the XML formatting.

10 years agoFix preprocessor indentation in libvirt.h.in
Daniel P. Berrange [Thu, 23 Oct 2014 12:54:31 +0000 (13:54 +0100)]
Fix preprocessor indentation in libvirt.h.in

The cfg.mk rule for checking preprocessor indentation was
mistakenly missing the libvirt.h.in file due to bad file
extension matching rule. Fix that and the resolve the
incorrect indentation that is identified.

10 years agoMove virConnect related APIs out of libvirt.h.in
Daniel P. Berrange [Thu, 23 Oct 2014 10:28:16 +0000 (11:28 +0100)]
Move virConnect related APIs out of libvirt.h.in

Create a new libvirt-host.h file to hold the public
API definitions for the virConnect type. This header
file is not self-contained, so applications will not directly
include it. They will continue to #include <libvirt/libvirt.h>

10 years agoMove virDomain related APIs out of libvirt.h.in
Daniel P. Berrange [Thu, 23 Oct 2014 10:28:16 +0000 (11:28 +0100)]
Move virDomain related APIs out of libvirt.h.in

Create a new libvirt-domain.h file to hold the public
API definitions for the virDomain type. This header
file is not self-contained, so applications will not directly
include it. They will continue to #include <libvirt/libvirt.h>

10 years agoMove virEvent related APIs out of libvirt.h.in
Daniel P. Berrange [Thu, 23 Oct 2014 10:28:16 +0000 (11:28 +0100)]
Move virEvent related APIs out of libvirt.h.in

Create a new libvirt-event.h file to hold the public
API definitions for the virEvent type. This header
file is not self-contained, so applications will not directly
include it. They will continue to #include <libvirt/libvirt.h>

10 years agoMove virStoragePool/Vol related APIs out of libvirt.h.in
Daniel P. Berrange [Thu, 23 Oct 2014 10:28:16 +0000 (11:28 +0100)]
Move virStoragePool/Vol related APIs out of libvirt.h.in

Create a new libvirt-storage.h file to hold the public
API definitions for the virStorage/Vol type. This header
file is not self-contained, so applications will not directly
include it. They will continue to #include <libvirt/libvirt.h>

10 years agoMove virStream related APIs out of libvirt.h.in
Daniel P. Berrange [Thu, 23 Oct 2014 10:28:16 +0000 (11:28 +0100)]
Move virStream related APIs out of libvirt.h.in

Create a new libvirt-stream.h file to hold the public
API definitions for the virStream type. This header
file is not self-contained, so applications will not directly
include it. They will continue to #include <libvirt/libvirt.h>

Note the definition of virStreamPtr is not moved, since that
must be declared early for all other libvirt APIs to be able
to reference it.

10 years agoMove virSecret related APIs out of libvirt.h.in
Daniel P. Berrange [Thu, 23 Oct 2014 10:28:16 +0000 (11:28 +0100)]
Move virSecret related APIs out of libvirt.h.in

Create a new libvirt-secret.h file to hold the public
API definitions for the virSecret type. This header
file is not self-contained, so applications will not directly
include it. They will continue to #include <libvirt/libvirt.h>

10 years agoMove virNodeDevice related APIs out of libvirt.h.in
Daniel P. Berrange [Thu, 23 Oct 2014 10:28:16 +0000 (11:28 +0100)]
Move virNodeDevice related APIs out of libvirt.h.in

Create a new libvirt-nodedev.h file to hold the public
API definitions for the virNodeDevice type. This header
file is not self-contained, so applications will not directly
include it. They will continue to #include <libvirt/libvirt.h>

10 years agoMove virNWFilter related APIs out of libvirt.h.in
Daniel P. Berrange [Thu, 23 Oct 2014 10:28:16 +0000 (11:28 +0100)]
Move virNWFilter related APIs out of libvirt.h.in

Create a new libvirt-nwfilter.h file to hold the public
API definitions for the virNWFilter type. This header
file is not self-contained, so applications will not directly
include it. They will continue to #include <libvirt/libvirt.h>

10 years agoMove virInterface related APIs out of libvirt.h.in
Daniel P. Berrange [Thu, 23 Oct 2014 10:28:16 +0000 (11:28 +0100)]
Move virInterface related APIs out of libvirt.h.in

Create a new libvirt-interface.h file to hold the public
API definitions for the virInterface type. This header
file is not self-contained, so applications will not directly
include it. They will continue to #include <libvirt/libvirt.h>

10 years agoMove virNetwork related APIs out of libvirt.h.in
Daniel P. Berrange [Thu, 23 Oct 2014 10:28:16 +0000 (11:28 +0100)]
Move virNetwork related APIs out of libvirt.h.in

Create a new libvirt-network.h file to hold the public
API definitions for the virNetwork type. This header
file is not self-contained, so applications will not directly
include it. They will continue to #include <libvirt/libvirt.h>

10 years agoMove virDomainSnapshot related APIs out of libvirt.h.in
Daniel P. Berrange [Thu, 23 Oct 2014 10:28:16 +0000 (11:28 +0100)]
Move virDomainSnapshot related APIs out of libvirt.h.in

Create a new libvirt-domain-snapshot.h file to hold the public
API definitions for the virDomainSnapshot type. This header
file is not self-contained, so applications will not directly
include it. They will continue to #include <libvirt/libvirt.h>

10 years agoMove virConnect/virNode related APIs out of libvirt.c
Daniel P. Berrange [Wed, 22 Oct 2014 15:29:09 +0000 (16:29 +0100)]
Move virConnect/virNode related APIs out of libvirt.c

Introduce a src/libvirt-host.c file to hold all the
methods related to the virConnect type.

10 years agoMove virDomain related APIs out of libvirt.c
Daniel P. Berrange [Wed, 22 Oct 2014 15:29:09 +0000 (16:29 +0100)]
Move virDomain related APIs out of libvirt.c

Introduce a src/libvirt-domain.c file to hold all the
methods related to the virDomain type.

10 years agoMake virTypedParameterValidateSet non-static
Daniel P. Berrange [Fri, 24 Oct 2014 15:54:29 +0000 (16:54 +0100)]
Make virTypedParameterValidateSet non-static

The virTypedParameterValidateSet method will need to be used
from several libvirt-*.c files so must be non-static

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agoMove virStorage{Pool,Vol} related APIs out of libvirt.c
Daniel P. Berrange [Wed, 22 Oct 2014 15:29:09 +0000 (16:29 +0100)]
Move virStorage{Pool,Vol} related APIs out of libvirt.c

Introduce a src/libvirt-storage.c file to hold all the
methods related to the virStorage{Pool,Vol} types.

10 years agoMove virStream related APIs out of libvirt.c
Daniel P. Berrange [Wed, 22 Oct 2014 15:29:09 +0000 (16:29 +0100)]
Move virStream related APIs out of libvirt.c

Introduce a src/libvirt-stream.c file to hold all the
methods related to the virStream type.

10 years agoMove virSecret related APIs out of libvirt.c
Daniel P. Berrange [Wed, 22 Oct 2014 15:29:09 +0000 (16:29 +0100)]
Move virSecret related APIs out of libvirt.c

Introduce a src/libvirt-secret.c file to hold all the
methods related to the virSecret type.

10 years agoMove virNodeDevice related APIs out of libvirt.c
Daniel P. Berrange [Wed, 22 Oct 2014 15:29:09 +0000 (16:29 +0100)]
Move virNodeDevice related APIs out of libvirt.c

Introduce a src/libvirt-nodedev.c file to hold all the
methods related to the virNodeDevice type.

10 years agoMove virNWFilter related APIs out of libvirt.c
Daniel P. Berrange [Wed, 22 Oct 2014 15:29:09 +0000 (16:29 +0100)]
Move virNWFilter related APIs out of libvirt.c

Introduce a src/libvirt-nwfilter.c file to hold all the
methods related to the virNWFilter type.

10 years agoMove virInterface related APIs out of libvirt.c
Daniel P. Berrange [Wed, 22 Oct 2014 15:29:09 +0000 (16:29 +0100)]
Move virInterface related APIs out of libvirt.c

Introduce a src/libvirt-interface.c file to hold all the
methods related to the virInterface type.

10 years agoMove virNetwork related APIs out of libvirt.c
Daniel P. Berrange [Wed, 22 Oct 2014 15:29:09 +0000 (16:29 +0100)]
Move virNetwork related APIs out of libvirt.c

Introduce a src/libvirt-network.c file to hold all the
methods related to the virNetwork type.

10 years agoMove virDomainSnapshot related APIs out of libvirt.c
Daniel P. Berrange [Wed, 22 Oct 2014 15:29:09 +0000 (16:29 +0100)]
Move virDomainSnapshot related APIs out of libvirt.c

Introduce a src/libvirt-domain-snapshot.c file to hold all the
methods related to the virDomainSnapshot type.

10 years agohyperv: avoid query memleaks on failure
Eric Blake [Wed, 8 Oct 2014 16:23:59 +0000 (10:23 -0600)]
hyperv: avoid query memleaks on failure

The function hypervEnumAndPull consumes query on success, but leaked
it on failure.  Rather than having to change all callers (many of
them indirect callers through the generated
hypervGetMsvmComputerSystemList), it was easier to just guarantee
that the buffer is cleaned on return from the function.

* src/hyperv/hyperv_wmi.c (hypervEnumAndPull): Don't leak query on
failure.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoSplit driver.h into multiple parts
Daniel P. Berrange [Thu, 16 Oct 2014 10:01:19 +0000 (11:01 +0100)]
Split driver.h into multiple parts

With the large number of APIs in libvirt the driver.h file,
it is easy to get lost looking for things. Split each driver
into a separate header file based on the functional driver
groups.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agoRename virDriver to virHypervisorDriver
Daniel P. Berrange [Thu, 16 Oct 2014 09:25:59 +0000 (10:25 +0100)]
Rename virDriver to virHypervisorDriver

To prepare for introducing a single global driver, rename the
virDriver struct to virHypervisorDriver and the registration
API to virRegisterHypervisorDriver()

10 years agoqemu: Disallow NUMA/network tuning for session mode
Erik Skultety [Wed, 1 Oct 2014 12:57:32 +0000 (14:57 +0200)]
qemu: Disallow NUMA/network tuning for session mode

Tuning NUMA or network interface parameters requires root
privileges to manage cgroups. Thus an attempt to set some of these
parameters in session mode on a running domain should be invalid
followed by an error. An example might be memory tuning which raises
an error in such case.

The following behavior in session mode will be present after applying
this patch:

  Tuning  |      SET      |   GET  |
----------|---------------|--------|
NUMA      | shut off only | always |
Memory    |     never     | never  |
Interface |     never     | always |

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

10 years agoqemu: migration: Make check for empty hook XML robust
Peter Krempa [Wed, 22 Oct 2014 09:27:36 +0000 (11:27 +0200)]
qemu: migration: Make check for empty hook XML robust

Also consider whitespace only strings returned from the hook as empty
result.

10 years agoqemu: restore: Fix restoring of VM when the restore hook returns empty XML
Peter Krempa [Wed, 22 Oct 2014 09:22:08 +0000 (11:22 +0200)]
qemu: restore: Fix restoring of VM when the restore hook returns empty XML

The documentation for the restore hook states that returning an empty
XML is equivalent with copying the input. There was a bug in the code
checking the returned string by checking the string instead of the
contents. Use the new helper to check if the string is empty.

10 years agoutil: string: Add helper to check whether string is empty
Peter Krempa [Wed, 22 Oct 2014 08:26:42 +0000 (10:26 +0200)]
util: string: Add helper to check whether string is empty

The helper checks whether a string contains only whitespace or is NULL.
This will be helpful to skip cases where a user string is optional, but
may be provided empty with the same meaning.

10 years agodoc: HACKING: Regenerate after recent change
Peter Krempa [Wed, 22 Oct 2014 15:50:08 +0000 (17:50 +0200)]
doc: HACKING: Regenerate after recent change

10 years agoAdd support for /run/initctl
Rick Harris [Wed, 22 Oct 2014 12:09:49 +0000 (13:09 +0100)]
Add support for /run/initctl

Newer versions of Debian use '/run/initctl' instead of '/dev/initctl'.
This patch updates the code to search for the FIFO from a list of
well-known locations.

10 years agodocs: fix an improper git browsable address
Chen Hanxiao [Wed, 22 Oct 2014 09:38:33 +0000 (17:38 +0800)]
docs: fix an improper git browsable address

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
10 years agoFix cast errors with clang
Roman Bogorodskiy [Tue, 21 Oct 2014 14:22:36 +0000 (18:22 +0400)]
Fix cast errors with clang

Build with clang fails with:

  CC       util/libvirt_util_la-virsocketaddr.lo
util/virsocketaddr.c:904:17: error: cast from 'struct sockaddr *' to
'struct sockaddr_in *' increases required alignment from 1 to 4
[-Werror,-Wcast-align]
        inet4 = (struct sockaddr_in*) res->ai_addr;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
util/virsocketaddr.c:909:17: error: cast from 'struct sockaddr *' to
'struct sockaddr_in6 *' increases required alignment from 1 to 4
[-Werror,-Wcast-align]
        inet6 = (struct sockaddr_in6*) res->ai_addr;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

Fix that by replacing virSocketAddrParseInternal() call with
virSocketAddrParse() in the virSocketAddrIsNumericLocalhost() function.
virSocketAddrParse stores an address in virSocketAddr.
virSocketAddr uses a union to store an address, so it doesn't
need casting.

10 years agodocs: Mention repository locations in contributor guidelines
Martin Kletzander [Tue, 21 Oct 2014 10:20:56 +0000 (12:20 +0200)]
docs: Mention repository locations in contributor guidelines

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: unref cfg after TerminateMachine has been called
Martin Kletzander [Tue, 21 Oct 2014 09:44:13 +0000 (11:44 +0200)]
qemu: unref cfg after TerminateMachine has been called

Commit 4882618ed13b469d92fa8b2b4a158fdb17dbe9f1 added the code that
requests driver cfg, but forgot to unref it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: x86_64 is good enough for i686
Lubomir Rintel [Thu, 16 Oct 2014 19:28:00 +0000 (21:28 +0200)]
qemu: x86_64 is good enough for i686

virt-manager on Fedora sets up i686 hosts with "/usr/bin/qemu-kvm" emulator,
which in turn unconditionally execs qemu-system-x86_64 querying capabilities
then fails:

Error launching details: invalid argument: architecture from emulator 'x86_64' doesn't match given architecture 'i686'

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/engine.py", line 748, in _show_vm_helper
    details = self._get_details_dialog(uri, vm.get_connkey())
  File "/usr/share/virt-manager/virtManager/engine.py", line 726, in _get_details_dialog
    obj = vmmDetails(conn.get_vm(connkey))
  File "/usr/share/virt-manager/virtManager/details.py", line 399, in __init__
    self.init_details()
  File "/usr/share/virt-manager/virtManager/details.py", line 784, in init_details
    domcaps = self.vm.get_domain_capabilities()
  File "/usr/share/virt-manager/virtManager/domain.py", line 518, in get_domain_capabilities
    self.get_xmlobj().os.machine, self.get_xmlobj().type)
  File "/usr/lib/python2.7/site-packages/libvirt.py", line 3492, in getDomainCapabilities
    if ret is None: raise libvirtError ('virConnectGetDomainCapabilities() failed', conn=self)
libvirtError: invalid argument: architecture from emulator 'x86_64' doesn't match given architecture 'i686'

Journal:

Oct 16 21:08:26 goatlord.localdomain libvirtd[1530]: invalid argument: architecture from emulator 'x86_64' doesn't match given architecture 'i686'

10 years agoqemu: move setting emulatorpin ahead of monitor showing up
Zhou yimin [Thu, 16 Oct 2014 14:18:48 +0000 (22:18 +0800)]
qemu: move setting emulatorpin ahead of monitor showing up

If VM is configured with many devices(including passthrough devices)
and large memory, libvirtd will take seconds(in the worst case) to
wait for monitor. In this period the qemu process may run on any
PCPU though I intend to pin emulator to the specified PCPU in xml
configuration.

Actually qemu process takes high cpu usage during vm startup.
So this is not the strict CPU isolation in this case.

Signed-off-by: Zhou yimin <zhouyimin@huawei.com>
10 years agodocs: apps: Update references to virt-p2v and virt-v2v.
Richard W.M. Jones [Sat, 18 Oct 2014 14:20:26 +0000 (15:20 +0100)]
docs: apps: Update references to virt-p2v and virt-v2v.

These tools have been rewritten upstream, so you don't need to link to
the old tools, link to the new ones and mention they are part of
libguestfs.

Also remove the link to "Poor man's P2V".  There's no real reason to
use that technique any longer since the rewritten tools are simple,
fast and highly capable.

10 years agotests: fix incorrect caps for shmem-invalid-size, shmem-small-size
Maxime Leroy [Fri, 17 Oct 2014 16:05:38 +0000 (18:05 +0200)]
tests: fix incorrect caps for shmem-invalid-size, shmem-small-size

VIR_TEST_DEBUG=2 ./qemuxml2argvtest generates the following output:

409) QEMU XML-2-ARGV shmem-invalid-size
... Got expected error: unsupported configuration: ivshmem device is not \
 supported with this QEMU binary
OK
410) QEMU XML-2-ARGV shmem-small-size
... Got expected error: unsupported configuration: ivshmem device is not \
supported with this QEMU binary
OK

We should have:

409) QEMU XML-2-ARGV shmem-invalid-size
... Got expected error: XML error: shmem size must be a power of two
OK
410) QEMU XML-2-ARGV shmem-small-size
... Got expected error: XML error: shmem size must be at least 1 MiB
OK

This commit fixes the issue by providing QEMU_CAPS_DEVICE_IVSHMEM caps
for shmem-invalid-size, shmem-small-size test.

Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
10 years agoconf: tests: fix virDomainNetDefFormat for vhost-user in client mode
Maxime Leroy [Fri, 17 Oct 2014 16:45:18 +0000 (18:45 +0200)]
conf: tests: fix virDomainNetDefFormat for vhost-user in client mode

The mode attribute is required for the source element of vhost-user.
Thus virDomainNetDefFormat should always generate a xml with it and not
only when the mode is server.

The commit fixes the issue. And it adds a vhostuser interface in
'client' mode to qemuxml2argv-net-vhostuser.(args|xml) to test this
usecase.

Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
10 years agolibxl: add missing 'break' from commit 1298daca
Jim Fehlig [Thu, 16 Oct 2014 06:48:57 +0000 (00:48 -0600)]
libxl: add missing 'break' from commit 1298daca

Add missing 'break's from commit 1298daca, as noted by John Ferlan

https://www.redhat.com/archives/libvir-list/2014-October/msg00430.html

10 years agoqemu: Convert qemuDomainUpdateDeviceConfig to typecasted enum
Peter Krempa [Wed, 15 Oct 2014 10:24:02 +0000 (12:24 +0200)]
qemu: Convert qemuDomainUpdateDeviceConfig to typecasted enum

10 years agoqemu: Convert qemuDomainDetachDeviceConfig to typecasted enum
Peter Krempa [Wed, 15 Oct 2014 10:24:02 +0000 (12:24 +0200)]
qemu: Convert qemuDomainDetachDeviceConfig to typecasted enum

10 years agoqemu: Convert qemuDomainAttachDeviceConfig to typecasted enum
Peter Krempa [Wed, 15 Oct 2014 10:24:02 +0000 (12:24 +0200)]
qemu: Convert qemuDomainAttachDeviceConfig to typecasted enum

10 years agoqemu: Convert qemuDomainUpdateDeviceLive to typecasted enum
Peter Krempa [Wed, 15 Oct 2014 10:24:02 +0000 (12:24 +0200)]
qemu: Convert qemuDomainUpdateDeviceLive to typecasted enum

10 years agoqemu: Convert qemuDomainDetachDeviceLive to typecasted enum
Peter Krempa [Wed, 15 Oct 2014 10:24:02 +0000 (12:24 +0200)]
qemu: Convert qemuDomainDetachDeviceLive to typecasted enum

10 years agoconf: fix an memory leak in virSocketAddrIsNumericLocalhost()
Chen Fan [Wed, 15 Oct 2014 09:36:29 +0000 (17:36 +0800)]
conf: fix an memory leak in virSocketAddrIsNumericLocalhost()

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
10 years agoconf: Move definition of virDomainParseMemory
Peter Krempa [Mon, 29 Sep 2014 15:38:18 +0000 (17:38 +0200)]
conf: Move definition of virDomainParseMemory

Shove it to the top of the file so that it can be reused earlier.

10 years agoImplement empty post parse callbacks for all drivers
Peter Krempa [Mon, 6 Oct 2014 15:28:46 +0000 (17:28 +0200)]
Implement empty post parse callbacks for all drivers

To allow easy implementation of a callback check this patch adds empty
post parse callbacks to drivers that were missing them.

10 years agoqemu: monitor: Add functions for object hot-add/remove
Peter Krempa [Tue, 23 Sep 2014 11:25:25 +0000 (13:25 +0200)]
qemu: monitor: Add functions for object hot-add/remove

To allow live modification of device backends in qemu libvirt needs to
be able to hot-add/remove "objects". Add monitor backend functions to
allow this.

This function will be used for hot-add/remove of RNG backends,
IOThreads, memory backing objects, etc.

10 years agoutil: json: Add option to skip adding a JSON object if it is NULL
Peter Krempa [Wed, 15 Oct 2014 07:41:49 +0000 (09:41 +0200)]
util: json: Add option to skip adding a JSON object if it is NULL

Add a new option specifier that will optionally add a JSON key=value pair
containing a nested object if the added object isn't NULL.

10 years agoutil: json: Improve handling and docs for adding JSON objects
Peter Krempa [Tue, 23 Sep 2014 09:48:08 +0000 (11:48 +0200)]
util: json: Improve handling and docs for adding JSON objects

The JSON structure constructor has an option to add JSON arrays to the
constructed object. The description is inaccurate as it can add any json
object even a dict. Change the docs to cover this option and reject
adding NULL objects.

10 years agoutil: json: Split out code to create json value objects
Peter Krempa [Mon, 22 Sep 2014 14:35:02 +0000 (16:35 +0200)]
util: json: Split out code to create json value objects

Our qemu monitor code has a converter from key-value pairs to a json
value object. I want to re-use the code later and having it part of the
monitor command generator is inflexible. Split it out into a separate
helper.

10 years agoqemu: hotplug: Use typecasted switch statement when plugging new devices
Peter Krempa [Mon, 22 Sep 2014 11:42:02 +0000 (13:42 +0200)]
qemu: hotplug: Use typecasted switch statement when plugging new devices

10 years agoconf: Add compile time check that devices were checked for ABI stability
Peter Krempa [Mon, 29 Sep 2014 16:43:34 +0000 (18:43 +0200)]
conf: Add compile time check that devices were checked for ABI stability

As in the device info iterator add a switch that will force the compiler
to check that new device types are added to the ABI stability checker.

10 years agoconf: shmem: Add ABI stability check
Peter Krempa [Tue, 7 Oct 2014 12:26:32 +0000 (14:26 +0200)]
conf: shmem: Add ABI stability check

Although the device will probably inhibit migration add checks to make
sure that the configuration change gets caught.

10 years agoconf: Improve adding of new address types
Peter Krempa [Tue, 7 Oct 2014 15:21:45 +0000 (17:21 +0200)]
conf: Improve adding of new address types

Use typecasted switch statement and note the type used to select the
address type in a comment.

10 years agoCleanup maintainers list
Jiri Denemark [Tue, 14 Oct 2014 21:03:13 +0000 (23:03 +0200)]
Cleanup maintainers list

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agolibvirt: Document UNDEFINE_NVRAM in UndefineFlags doc
Cole Robinson [Tue, 14 Oct 2014 09:27:33 +0000 (11:27 +0200)]
libvirt: Document UNDEFINE_NVRAM in UndefineFlags doc

10 years agoconf: fix a wrong comment in virSocketAddrNumericFamily()
Chen Fan [Wed, 15 Oct 2014 07:50:09 +0000 (15:50 +0800)]
conf: fix a wrong comment in virSocketAddrNumericFamily()

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
10 years agoconf: Check whether migration_address is localhost
Chen Fan [Tue, 7 Oct 2014 04:07:32 +0000 (12:07 +0800)]
conf: Check whether migration_address is localhost

When enabling the migration_address option, by default it is
set to "127.0.0.1", but it's not a valid address for migration.
so we should add verification and set the default migration_address
to "0.0.0.0".

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agoconf: add check if migration_host is a localhost address
Chen Fan [Tue, 7 Oct 2014 04:07:31 +0000 (12:07 +0800)]
conf: add check if migration_host is a localhost address

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agomigration: add migration_host support for IPv6 address without brackets
Chen Fan [Tue, 7 Oct 2014 04:07:30 +0000 (12:07 +0800)]
migration: add migration_host support for IPv6 address without brackets

if specifying migration_host to an Ipv6 address without brackets,
it was resolved to an incorrect address, such as:
    tcp:2001:0DB8::1428:4444,
but the correct address should be:
    tcp:[2001:0DB8::1428]:4444
so we should add brackets when parsing it.

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
10 years agoIntroduce virStringStripIPv6Brackets
Ján Tomko [Tue, 7 Oct 2014 15:27:40 +0000 (17:27 +0200)]
Introduce virStringStripIPv6Brackets

Helper function to strip the brackets from an IPv6 address.
Tested by viruritest.

10 years agovirsh: domain: Use global constant for XML file size limit
Peter Krempa [Tue, 14 Oct 2014 08:04:31 +0000 (10:04 +0200)]
virsh: domain: Use global constant for XML file size limit

Few places still used hardcoded limit for maximum XML size for commands
that accept XML files. The hardcoded limits ranged from 8k to 1M. Use
VSH_MAX_XML_FILE to express this limit in a unified way. This will bump
the limit for the commands that used hardcoded string lengths to 10M.

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

10 years agovirsh: man: Fix description of --live/--config usage
Peter Krempa [Tue, 14 Oct 2014 07:41:24 +0000 (09:41 +0200)]
virsh: man: Fix description of --live/--config usage

dommemstat and blkdeviotune's man page incorrectly stated the usage of
--live and --config.

10 years agoconf: improve the comments for "xmlopt"
Wang Rui [Sat, 11 Oct 2014 06:09:22 +0000 (14:09 +0800)]
conf: improve the comments for "xmlopt"

Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
10 years agoFix leftover typo '&' -> '&&'
Martin Kletzander [Thu, 9 Oct 2014 08:00:05 +0000 (10:00 +0200)]
Fix leftover typo '&' -> '&&'

The actual origin of this so called typo are two commits.  The first one
was commit 72f8a7f that came up with the following condition:

if ((i == 8) & (flags & VIR_QEMU_PROCESS_KILL_FORCE))

Fortunately this succeeded thanks to bool being (int)1 and
VIR_QEMU_PROCESS_KILL_FORCE having the value of 1 << 0.  The check was
then moved and altered in 8fd38231179c394f07d8a26bcbf3a0faa5eeaf24 to
current state:

if ((i == 50) & force)

that will work again (both sides of '&' being booleans), but since this
was missed so many times, it may pose a problem in the future in case it
gets copy-pasted again.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agolibxl: Implement basic video device selection
Stefan Bader [Tue, 1 Jul 2014 07:58:18 +0000 (09:58 +0200)]
libxl: Implement basic video device selection

This started as an investigation into an issue where libvirt (using the
libxl driver) and the Xen host, like an old couple, could not agree on
who is responsible for selecting the VNC port to use.

Things usually (and a bit surprisingly) did work because, just like that
old couple, they had the same idea on what to do by default. However it
was possible that this ended up in a big argument.

The problem is that display information exists in two different places:
in the vfbs list and in the build info. And for launching the device model,
only the latter is used. But that never gets initialized from libvirt. So
Xen allows the device model to select a default port while libvirt thinks
it has told Xen that this is done by libvirt (though the vfbs config).

While fixing that, I made a stab at actually evaluating the configuration
of the video device. So that it is now possible to at least decide between
a Cirrus or standard VGA emulation and to modify the VRAM within certain
limits using libvirt.

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agolibxl: Add function to determine device model type
Jim Fehlig [Fri, 19 Sep 2014 16:32:43 +0000 (10:32 -0600)]
libxl: Add function to determine device model type

This patch introduces a function to detect whether the specified
emulator is QEMU_XEN or QEMU_XEN_TRADITIONAL.  Detection is based on the
string "Options specific to the Xen version:" in '$qemu -help' output.
AFAIK, the only qemu containing that string in help output is the
old Xen fork (aka qemu-dm).

Note:
QEMU_XEN means a qemu that contains support for Xen.

QEMU_XEN_TRADITIONAL means Xen's old forked qemu 0.10.2

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agoXen: Defer setting default vram value to Xen drivers
Jim Fehlig [Fri, 19 Sep 2014 16:13:40 +0000 (10:13 -0600)]
Xen: Defer setting default vram value to Xen drivers

Allow the Xen drivers to determine default vram values.  Sane
default vaules depend on the device model being used, so the
drivers are in the best position to determine the defaults.

For the legacy xen driver, it is best to maintain the existing
logic for setting default vram values to ensure there are no
regressions.  The libxl driver currently does not support
configuring a video device.  Support will be added in a
subsequent patch, where the benefit of this change will be
reaped.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agolibxl: Copy user-specified keymap to libxl build info struct
Jim Fehlig [Fri, 19 Sep 2014 16:38:37 +0000 (10:38 -0600)]
libxl: Copy user-specified keymap to libxl build info struct

Commit 4dfc34c3 missed copying the user-specified keymap to
libxl_domain_build_info struct when creating a VFB device.

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agoqemu: save domain status after set domain's numa parameters
Shanzhi Yu [Mon, 6 Oct 2014 15:00:00 +0000 (17:00 +0200)]
qemu: save domain status after set domain's numa parameters

After set domain's numa parameters for running domain, save the change,
save the change into live xml is needed to survive restarting the libvirtd,
same story with bug 1146511; meanwihle add call
qemuDomainObjBeginJob/qemuDomainObjEndJob in qemuDomainSetNumaParameters

Signed-off-by: Shanzhi Yu <shyu@redhat.com>
10 years agoqemu: call qemuDomainObjBeginJob/qemuDomainObjEndJob in qemuDomainSetInterfaceParameters
Shanzhi Yu [Mon, 6 Oct 2014 15:00:00 +0000 (17:00 +0200)]
qemu: call qemuDomainObjBeginJob/qemuDomainObjEndJob in qemuDomainSetInterfaceParameters

add call qemuDomainObjBeginJob/qemuDomainObjEndJob in
qemuDomainSetInterfaceParameters

Signed-off-by: Shanzhi Yu <shyu@redhat.com>
10 years agoqemu: save domain status after set the blkio parameters
Shanzhi Yu [Mon, 6 Oct 2014 15:00:00 +0000 (17:00 +0200)]
qemu: save domain status after set the blkio parameters

After set the blkio parameters for running domain, save the change into
live xml is needed to survive restarting the libvirtd, same story with
bug 1146511, meanwhile add call qemuDomainObjBeginJob/qemuDomainObjEndJob
in qemuDomainSetBlkioParameters

Signed-off-by: Shanzhi Yu <shyu@redhat.com>
10 years agoFix build-time pkg-config files in VPATH
Jiri Denemark [Tue, 7 Oct 2014 13:22:52 +0000 (15:22 +0200)]
Fix build-time pkg-config files in VPATH

The pkg-config files in src/ make it pretty easy to build language
bindings against an uninstalled libvirt, however, they don't work with
VPATH builds. The reason is that all *-api.xml files are generated in
source rather than build directory.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>