]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
10 years agoqemu: monitor: Convert common code to a macro
Peter Krempa [Tue, 10 Mar 2015 13:32:46 +0000 (14:32 +0100)]
qemu: monitor: Convert common code to a macro

The function that is extracting block stats data from the QMP monitor
reply contains a lot of repeated code. Since I'd be changing each of the
copies in the next patch, lets convert it to a macro right away.

10 years agoqemu: monitor: Implement HMP version for listing all block device stats
Peter Krempa [Mon, 9 Mar 2015 16:23:49 +0000 (17:23 +0100)]
qemu: monitor: Implement HMP version for listing all block device stats

Add a different version of parser for "info blockstats" that basically
parses the same information as the existing copy of the function.

This will allow us to remove the single device version
qemuMonitorGetBlockStatsInfo in the future.

The new implementation uses few new helpers so it should be more
understandable and provides a test case to verify that it works.

10 years agotest: qemu: Fix qemu monitor test utils to allow testing HMP
Peter Krempa [Tue, 10 Mar 2015 12:10:20 +0000 (13:10 +0100)]
test: qemu: Fix qemu monitor test utils to allow testing HMP

qemu HMP commands sent by libvirt are terminated just by a '\r'. The
fake monitor used in tests wasn't prepared to handle this and the
communication would hang on an attempt to do a HMP conversation.

Add a special case for handling commands separated by \r in case HMP is
used.

10 years agoqemu: blockstats: Switch to caller allocated hash table
Peter Krempa [Tue, 10 Mar 2015 09:02:40 +0000 (10:02 +0100)]
qemu: blockstats: Switch to caller allocated hash table

Allocate the hash table in the monitor wrapper function instead of the
worker itself so that the text monitor impl that will be added in the
next patch doesn't have to duplicate it.

10 years agoqemu: monitor: Drop parsing of 'errs' from block info
Peter Krempa [Mon, 9 Mar 2015 14:25:17 +0000 (15:25 +0100)]
qemu: monitor: Drop parsing of 'errs' from block info

The error count statistic is not supported by qemu, so there's no need
to pass the variables around if the result is ignored anyways.

10 years agoqemu: Use macro to set block stats typed parameters
Peter Krempa [Mon, 9 Mar 2015 14:17:33 +0000 (15:17 +0100)]
qemu: Use macro to set block stats typed parameters

All the setters are the same code except for parameter name and
variable, so they can be converted to a macro to save a ton of
duplicated code.

10 years agoRNG: Allow multiple parameters to be passed to an interface filter
Michal Privoznik [Wed, 11 Mar 2015 08:54:29 +0000 (09:54 +0100)]
RNG: Allow multiple parameters to be passed to an interface filter

Our code supports that for ages. When using a <filterref/> to an
<interface/> several parameters can be passed to the filter. Later,
when building firewall rules, parameters are substituted for their
values. However, our RNG schema allowed only one parameter to be
passed.

Reported-by: Brian Rak <brak@gameservers.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoparallels: prevent domain define only if vcpupin is specified
Maxim Nestratov [Tue, 10 Mar 2015 20:12:22 +0000 (23:12 +0300)]
parallels: prevent domain define only if vcpupin is specified

and their settings differ from common cpumask

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
10 years agoparallels: prevent domain define only if NUMA is really specified
Maxim Nestratov [Tue, 10 Mar 2015 20:12:21 +0000 (23:12 +0300)]
parallels: prevent domain define only if NUMA is really specified

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
10 years agoparallels: don't forget to unlock domain in parallelsDomainHasManagedSaveImage
Maxim Nestratov [Tue, 10 Mar 2015 20:12:20 +0000 (23:12 +0300)]
parallels: don't forget to unlock domain in parallelsDomainHasManagedSaveImage

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
10 years agoparallels: cpumask support
Maxim Nestratov [Tue, 10 Mar 2015 20:12:19 +0000 (23:12 +0300)]
parallels: cpumask support

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
10 years agodomain_conf: fix crash in virDomainObjListFindByUUIDInternal
Michael Chapman [Wed, 11 Mar 2015 02:19:54 +0000 (13:19 +1100)]
domain_conf: fix crash in virDomainObjListFindByUUIDInternal

If a domain object is being removed and looked up concurrently we must
ensure we unlock the object before unreferencing it, since the latter
might free the object.

The flaw was introduced in commit feb1a4d792e1c35b1009e69c00bf351b39.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
10 years ago{domain, network}_conf: disable autostart when deleting config
Michael Chapman [Wed, 11 Mar 2015 02:20:28 +0000 (13:20 +1100)]
{domain, network}_conf: disable autostart when deleting config

Undefining a running, autostarted domain removes the autostart link, but
dom->autostart is not cleared. If the domain is subsequently redefined,
libvirt thinks it is already autostarted and will not create the link
even if requested:

  # virsh dominfo example | grep Autostart
  Autostart:      enable

  # ls /etc/libvirt/qemu/autostart/example.xml
  /etc/libvirt/qemu/autostart/example.xml

  # virsh undefine example
  Domain example has been undefined

  # virsh define example.xml
  Domain example defined from example.xml

  # virsh dominfo example | grep Autostart
  Autostart:      enable

  # virsh autostart example
  Domain example marked as autostarted

  # ls /etc/libvirt/qemu/autostart/example.xml
  ls: cannot access /etc/libvirt/qemu/autostart/example.xml: No such file or directory

This commit ensures dom->autostart is cleared whenever the config and
autostart link (if present) are removed.

The bridge network driver cleared this flag itself in networkUndefine.
This commit moves this into virNetworkDeleteConfig for symmetry with
virDomainDeleteConfig, and to ensure it is not missed in future network
drivers.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
10 years agoqemu: Remove unnecessary virReportError on networkGetNetworkAddress return
Luyao Huang [Sat, 28 Feb 2015 09:08:34 +0000 (17:08 +0800)]
qemu: Remove unnecessary virReportError on networkGetNetworkAddress return

Error messages are already set in all code paths returning -1 from
networkGetNetworkAddress, so we don't want to overwrite them.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
10 years agovirQEMUCapsInitQMP: Don't dispose locked @vm
Michal Privoznik [Tue, 10 Mar 2015 13:23:43 +0000 (14:23 +0100)]
virQEMUCapsInitQMP: Don't dispose locked @vm

When creating qemu capabilities, a dummy virDomainObj is created just
because our monitor code expects that. However, the object is created
locked already. Then, under cleanup label, we simply unref the object
which results in whole domain object to be disposed. The object lock
is destroyed subsequently, but hey - it's still locked:

==24845== Thread #14's call to pthread_mutex_destroy failed
==24845==    with error code 16 (EBUSY: Device or resource busy)
==24845==    at 0x4C3024E: pthread_mutex_destroy (in /usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so)
==24845==    by 0x531F72E: virMutexDestroy (virthread.c:83)
==24845==    by 0x5302977: virObjectLockableDispose (virobject.c:237)
==24845==    by 0x5302A89: virObjectUnref (virobject.c:265)
==24845==    by 0x1DD37866: virQEMUCapsInitQMP (qemu_capabilities.c:3397)
==24845==    by 0x1DD37CC6: virQEMUCapsNewForBinary (qemu_capabilities.c:3481)
==24845==    by 0x1DD381E2: virQEMUCapsCacheLookup (qemu_capabilities.c:3609)
==24845==    by 0x1DD30F8A: virQEMUCapsInitGuest (qemu_capabilities.c:744)
==24845==    by 0x1DD31889: virQEMUCapsInit (qemu_capabilities.c:1020)
==24845==    by 0x1DD7DD36: virQEMUDriverCreateCapabilities (qemu_conf.c:888)
==24845==    by 0x1DDC57C0: qemuStateInitialize (qemu_driver.c:803)
==24845==    by 0x53DC743: virStateInitialize (libvirt.c:777)
==24845==

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoqemu: fix memory leak in qemuAgentGetFSInfo
Chen Fan [Tue, 10 Mar 2015 05:56:11 +0000 (13:56 +0800)]
qemu: fix memory leak in qemuAgentGetFSInfo

in virDomainFSInfoFree(), don't free the virDomainFSInfo data.

==10670== 80 bytes in 2 blocks are definitely lost in loss record 576 of 793
==10670==    at 0x4A06BC3: calloc (vg_replace_malloc.c:618)
==10670==    by 0x509DEBD: virAlloc (viralloc.c:144)
==10670==    by 0x19FBD558: qemuAgentGetFSInfo (qemu_agent.c:1837)
==10670==    by 0x1A03CF91: qemuDomainGetFSInfo (qemu_driver.c:19238)

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
10 years agoReverse the logic in virbitmaptest
Ján Tomko [Fri, 6 Mar 2015 16:55:38 +0000 (17:55 +0100)]
Reverse the logic in virbitmaptest

Test the whole range in testBit, not just the first bit.

10 years agoUse virBitmapNextClearBit in networkNextClassID
Ján Tomko [Fri, 6 Mar 2015 16:09:49 +0000 (17:09 +0100)]
Use virBitmapNextClearBit in networkNextClassID

Instead of finding the next clear bit by calling virBitmapGetBit
in a loop, use the virBitmapNextClearBit helper.

10 years agoqemu: don't fill in nicindexes for session mode libvirtd
Laine Stump [Tue, 10 Mar 2015 06:09:24 +0000 (02:09 -0400)]
qemu: don't fill in nicindexes for session mode libvirtd

Commit 4bbe1029f fixed a problem in commit f7afeddc by moving the call
to virNetDevGetIndex() to a location common to all interface types (so
that the nicindex array would be filled in for macvtap as well as tap
interfaces), but the location was *too* common, as the original call
to virNetDevGetIndex() had been in a section qualified by "if
(cfg->privileged)". The result was that the "fixed" libvirtd would try
to call virNetDevGetIndex() even for session mode libvirtd, and end up
failing with the log message:

  Unable to open control socket: Operation not permitted

To remedy that, this patch qualifies the call to virNetDevGetIndex()
in its new location with cfg->privileged.

This resolves https://bugzilla.redhat.com/show_bug.cgi?id=1198244

10 years agovirnet*: Don't unlock object in dispose
Michal Privoznik [Tue, 10 Mar 2015 10:06:35 +0000 (11:06 +0100)]
virnet*: Don't unlock object in dispose

As of bba93d40 all of our RPC objects are derived from
virObjectLockable. However, during rewrite some errors sneaked
in. For instance, the dispose functions to virNetClient and
virNetServerClient objects were not only freeing allocated
memory, but unlocking themselves. This is wrong. Object should
never disappear while locked.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agodocs: add a note that spice channel is usable only with spice graphics
Pavel Hrdina [Thu, 26 Feb 2015 10:59:41 +0000 (11:59 +0100)]
docs: add a note that spice channel is usable only with spice graphics

To prevent a confusion about missing chardev argument in qemu
command line add a note about that behavior into documentation.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agonet-define: update or unify documentation
Pavel Hrdina [Wed, 25 Feb 2015 15:01:09 +0000 (16:01 +0100)]
net-define: update or unify documentation

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agopool-define: update and unify documentation
Pavel Hrdina [Wed, 25 Feb 2015 14:51:41 +0000 (15:51 +0100)]
pool-define: update and unify documentation

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agoiface-define: update and unify documentation
Pavel Hrdina [Wed, 25 Feb 2015 14:37:00 +0000 (15:37 +0100)]
iface-define: update and unify documentation

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agonetwork_conf: Turn struct _virNetworkObjList private
Michal Privoznik [Tue, 24 Feb 2015 12:48:50 +0000 (13:48 +0100)]
network_conf: Turn struct _virNetworkObjList private

Now that all the code uses accessors, don't expose the structure
anyway.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agonetwork_conf: Turn virNetworkObjList into virObject
Michal Privoznik [Tue, 24 Feb 2015 12:45:45 +0000 (13:45 +0100)]
network_conf: Turn virNetworkObjList into virObject

Well, one day this will be self-locking object, but not today.
But lets prepare the code for that! Moreover,
virNetworkObjListFree() is no longer needed, so turn it into
virNetworkObjListDispose().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoparallels_network: Adapt to new virNetworkObjList accessors
Michal Privoznik [Tue, 24 Feb 2015 10:32:52 +0000 (11:32 +0100)]
parallels_network: Adapt to new virNetworkObjList accessors

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agotest_driver: Adapt to new virNetworkObjList accessors
Michal Privoznik [Tue, 24 Feb 2015 10:32:52 +0000 (11:32 +0100)]
test_driver: Adapt to new virNetworkObjList accessors

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agobridge_driver: Adapt to new virNetworkObjList accessors
Michal Privoznik [Mon, 23 Feb 2015 17:29:20 +0000 (18:29 +0100)]
bridge_driver: Adapt to new virNetworkObjList accessors

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agonetwork_conf: Introduce virNetworkObjListPrune
Michal Privoznik [Wed, 4 Mar 2015 16:38:39 +0000 (17:38 +0100)]
network_conf: Introduce virNetworkObjListPrune

The API will iterate over the list of network object and remove
desired ones from it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agonetwork_conf: Introduce virNetworkObjListNumOfNetworks
Michal Privoznik [Mon, 23 Feb 2015 16:46:01 +0000 (17:46 +0100)]
network_conf: Introduce virNetworkObjListNumOfNetworks

An accessor following pattern laid out by virDomainObjList* APIs.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agonetwork_conf: Introduce virNetworkObjListGetNames
Michal Privoznik [Mon, 23 Feb 2015 16:37:17 +0000 (17:37 +0100)]
network_conf: Introduce virNetworkObjListGetNames

An accessor following pattern laid out by virDomainObjList* APIs.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agonetwork_conf: Introduce virNetworkObjListForEach
Michal Privoznik [Mon, 23 Feb 2015 16:21:46 +0000 (17:21 +0100)]
network_conf: Introduce virNetworkObjListForEach

This API will be used in the future to call passed callback over
each network object in the list. It's slightly different to its
virDomainObjListForEach counterpart, because virDomainObjList
uses a hash table to store domain object, while virNetworkObjList
uses an array.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agosanlock: Don't spam logs with "target pid not found"
Jiri Denemark [Fri, 6 Mar 2015 14:58:55 +0000 (15:58 +0100)]
sanlock: Don't spam logs with "target pid not found"

Commit v1.2.4-52-gda879e5 fixed issues with domains started before
sanlock driver was enabled by checking whether a running domain is
registered with sanlock and if it's not, sanlock driver is basically
ignored for the domain.

However, it was checking this even for domain which has just been
started and no sanlock_* API was called for them yet. This results in

    cmd 9 target pid 2135544 not found

error messages to appear in sanlock.log whenever we start a new domain.

This patch avoids this useless check for freshly started domains.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agolocking: Fix flags in virLockManagerLockDaemonNew
Jiri Denemark [Mon, 9 Mar 2015 12:12:36 +0000 (13:12 +0100)]
locking: Fix flags in virLockManagerLockDaemonNew

virLockManager*New APIs are never called with
VIR_LOCK_MANAGER_USES_STATE. Moreover, lockd driver does not maintain
any state that would need to be transferred during migration and thus it
should not mention VIR_LOCK_MANAGER_USES_STATE at all.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agotests: fix qemuxml2argvtest to be arch independent
Pavel Hrdina [Sat, 7 Mar 2015 10:24:48 +0000 (11:24 +0100)]
tests: fix qemuxml2argvtest to be arch independent

Commit 5aee81a0 introduced a new test for disk-serial.  The test fails
on i686 arch because there is no need to add "-cpu qemu32" to command
line.  To fix the test update emulator in XML to "/usr/bin/qemu" so we
don't add the "-cpu qemu32" to command while running the test on i686 or
x86_64 host.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agoqemu: Change qemuDomainGetEmulatorPinInfo bitmap manipulation
John Ferlan [Fri, 6 Mar 2015 18:26:46 +0000 (13:26 -0500)]
qemu: Change qemuDomainGetEmulatorPinInfo bitmap manipulation

Follow-up to the IOThread review on CPU affinity map manipulation:

http://www.redhat.com/archives/libvir-list/2015-March/msg00294.html

indicates that the GetEmulatorPinInfo could use similar algorithm adjustments
which is what this patch does.

10 years agoqemu: Change qemuDomainGetVcpuPinInfo bitmap manipulation
John Ferlan [Fri, 6 Mar 2015 17:58:25 +0000 (12:58 -0500)]
qemu: Change qemuDomainGetVcpuPinInfo bitmap manipulation

Follow-up to the IOThread review on CPU affinity map manipulation:

http://www.redhat.com/archives/libvir-list/2015-March/msg00294.html

indicates that the GetVcpuPinInfo could use similar algorithm adjustments
which is what this patch does.

10 years agoqemu: Resolve Coverity CHECKED_RETURN issue
John Ferlan [Fri, 6 Mar 2015 17:27:37 +0000 (12:27 -0500)]
qemu: Resolve Coverity CHECKED_RETURN issue

By adding a call and check of return of virBitmapToData to the
IOThreads code, my Coverity checker lets me know qemuDomainHelperGetVcpus
also needs to check the status...

10 years agoqemu: Change/Fix IOThread CPU affinity bitmap manipulation
John Ferlan [Fri, 6 Mar 2015 17:07:56 +0000 (12:07 -0500)]
qemu: Change/Fix IOThread CPU affinity bitmap manipulation

Based on review:

http://www.redhat.com/archives/libvir-list/2015-March/msg00294.html

Adjust how the cpumap and cpumaplen to be returned are generated

10 years agoRemove ReadOnly check for GetIOThreadsInfo
John Ferlan [Fri, 6 Mar 2015 15:26:51 +0000 (10:26 -0500)]
Remove ReadOnly check for GetIOThreadsInfo

10 years agoFix syntax for vcpupin description
John Ferlan [Fri, 6 Mar 2015 15:17:50 +0000 (10:17 -0500)]
Fix syntax for vcpupin description

10 years agotests: Add test for os interleaving
Martin Kletzander [Wed, 25 Feb 2015 14:45:26 +0000 (15:45 +0100)]
tests: Add test for os interleaving

We don't usually do tests purely for one change, but one change was
special because when users will migrate to OVMF/AAVMF, commit 18f9f69b
makes their lives easier by allowing them to interleave <type/> inside
<os/>.  It would be nice of us to keep the possibility of them pasting
the loader and nvram elements wherever it is valid, hence this test.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agotests: Add test for virtio-mmio address type
Martin Kletzander [Wed, 25 Feb 2015 14:12:31 +0000 (15:12 +0100)]
tests: Add test for virtio-mmio address type

Commit 3e4b783e fixed an issue with RNG schema where this address type
was missing, this commit adds a test for it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agodomain_conf: Format <pvpanic/> without address correctly
Michal Privoznik [Thu, 26 Feb 2015 14:28:07 +0000 (15:28 +0100)]
domain_conf: Format <pvpanic/> without address correctly

We have something like pvpanic device. However, in some cases it does
not have any address assigned, in which case we produce this ugly XML
(still valid though):

  <devices>
    <emulator>/usr/bin/qemu</emulator>
    ...
    <panic>
    </panic>
  </devices>

Lets format "<panic/>" instead.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoRefresh translations from Zanata
Daniel P. Berrange [Fri, 6 Mar 2015 13:06:57 +0000 (13:06 +0000)]
Refresh translations from Zanata

Delete .po files which contain zero translated strings. Refresh
the .pot file and pull down latest translations from Zanata.

When refreshing the libvirt.pot, it can be pushed to zanata
and .po files resynchonized using

 # cd po
 # rm libvirt.pot
 # make libvirt.pot
 # zanata-cli push
 # zanata-cli pull

Note there is no need for 'make update-po', as long as you do
a zanata push, immediately followed by zanata pull, as the
Zanata server will ensure the .po files downloaded match the
just pushed .pot file.

Note at time of writing, it is strongly recommended to only
use the zanata Java client binary (zanata-cli), and not the
python client binary (zanata). This is because the moderately
large size of the libvirt pot file is causing errors when the
python client tries to push, which have been known to result
in the loss of all translations on the server, as well as also
preventing uploading of .po files themselves :-(

10 years agovirsh: Add 'iothreadsinfo' command
John Ferlan [Wed, 11 Feb 2015 20:29:22 +0000 (15:29 -0500)]
virsh: Add 'iothreadsinfo' command

Add the 'iothreadsinfo' command to display IOThread Info data. Allow for
[--live] or [--config] options in order to display live or config data
for an active domain.

$ virsh iothreadsinfo --help
  NAME
    iothreadsinfo - view domain IOThreads

  SYNOPSIS
    iothreadsinfo <domain> [--config] [--live] [--current]

  DESCRIPTION
    Returns basic information about the domain IOThreads.

  OPTIONS
    [--domain] <string>  domain name, id or uuid
    --config         affect next boot
    --live           affect running domain
    --current        affect current domain

An active domain may return:

$ virsh iothreads $dom
 IOThread ID     CPU Affinity
---------------------------------------------------
  1               2
  2               3
  3               0

$ echo $?
0

For domains which don't have IOThreads the following is returned:

$ virsh iothreads $dom
No IOThreads found for the domain

$ echo $?
0

For domains which are not running the following is returned:

$ virsh iothreads $dom --live
error: Unable to get domain IOThreads information
error: Requested operation is not valid: domain is not running

$ echo $?
1

Editing a domains configuration and modifying the iothreadpin data for
thread 3 from nothing provided to setting a cpuset of '0-1' and then
displaying using --config would display:

$ virsh iothreads f18iothr --config
 IOThread ID     CPU Affinity
 ----------------------------
  1               2
  2               3
  3               0-1

$

Signed-off-by: John Ferlan <jferlan@redhat.com>
10 years agoqemu: Implement the qemu driver fetch for IOThreads
John Ferlan [Wed, 11 Feb 2015 17:45:58 +0000 (12:45 -0500)]
qemu: Implement the qemu driver fetch for IOThreads

Depending on the flags passed, either attempt to return the active/live
IOThread data for the domain or the config data.

The active/live path will call into the Monitor in order to get the
IOThread data and then correlate the thread_id's returned from the
monitor to the currently running system/threads in order to ascertain
the affinity for each iothread_id.

The config path will map each of the configured IOThreads and return
any configured iothreadspin data

Signed-off-by: John Ferlan <jferlan@redhat.com>
10 years agoremote: Implement the remote plumbing for virDomainGetIOThreadsInfo
John Ferlan [Mon, 9 Feb 2015 23:59:23 +0000 (18:59 -0500)]
remote: Implement the remote plumbing for virDomainGetIOThreadsInfo

Implement the remote plumbing for virDomainGetIOThreadsInfo

Signed-off-by: John Ferlan <jferlan@redhat.com>
10 years agoImplement public API for virDomainGetIOThreadsInfo
John Ferlan [Mon, 9 Feb 2015 21:16:55 +0000 (16:16 -0500)]
Implement public API for virDomainGetIOThreadsInfo

Add virDomainGetIOThreadInfo in order to return a list of
virDomainIOThreadInfoPtr structures which list the IOThread ID
and the CPU Affinity map for each IOThread for the domain.

For an active domain, the live data will be returned, while for
an inactive domain, the config data will be returned.

The API supports either the --live or --config flag, but not both.

Also added virDomainIOThreadsInfoFree in order to free the cpumap
and the IOThreadInfo structure.

Signed-off-by: John Ferlan <jferlan@redhat.com>
10 years agomemtune: change the way how we store unlimited value
Pavel Hrdina [Mon, 2 Mar 2015 19:04:12 +0000 (20:04 +0100)]
memtune: change the way how we store unlimited value

There was a mess in the way how we store unlimited value for memory
limits and how we handled values provided by user.  Internally there
were two possible ways how to store unlimited value: as 0 value or as
VIR_DOMAIN_MEMORY_PARAM_UNLIMITED.  Because we chose to store memory
limits as unsigned long long, we cannot use -1 to represent unlimited.
It's much easier for us to say that everything greater than
VIR_DOMAIN_MEMORY_PARAM_UNLIMITED means unlimited and leave 0 as valid
value despite that it makes no sense to set limit to 0.

Remove unnecessary function virCompareLimitUlong.  The update of test
is to prevent the 0 to be miss-used as unlimited in future.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agovirutil: introduce helper functions for memory limits
Pavel Hrdina [Wed, 4 Mar 2015 14:08:09 +0000 (15:08 +0100)]
virutil: introduce helper functions for memory limits

The first one is to truncate the memory limit to
VIR_DOMAIN_MEMORY_PARAM_UNLIMITED if the value is greater and the second
one is to decide whether the memory limit is set or not, unlimited means
that it's not set.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agovirsh: fix memtune to also accept 0 as valid value
Pavel Hrdina [Mon, 2 Mar 2015 15:26:52 +0000 (16:26 +0100)]
virsh: fix memtune to also accept 0 as valid value

Fix vshMemtuneGetSize to return correct value.  We can then decide
according that return code whether a parameter is present and valid or
not.  This will allow as to accept 0 as a valid value.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agoqemu: Pass file descriptor when using TPM passthrough
Stefan Berger [Thu, 5 Mar 2015 23:57:06 +0000 (18:57 -0500)]
qemu: Pass file descriptor when using TPM passthrough

Pass the TPM file descriptor to QEMU via command line.
Instead of passing /dev/tpm0 we now pass /dev/fdset/10 and the additional
parameters -add-fd set=10,fd=20.

This addresses the use case when QEMU is started with non-root privileges
and QEMU cannot open /dev/tpm0 for example.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
10 years agoqemu: Move TPM command line build code into own function
Stefan Berger [Thu, 5 Mar 2015 23:57:06 +0000 (18:57 -0500)]
qemu: Move TPM command line build code into own function

Move the TPM command line build code into its own function.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
10 years agoutils: Implement virCommandPassFDGetFDIndex
Stefan Berger [Thu, 5 Mar 2015 23:57:06 +0000 (18:57 -0500)]
utils: Implement virCommandPassFDGetFDIndex

Implement virCommandPassFDGetFDIndex to determine the index a given
file descriptor will have when passed to the child process.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
10 years agolibxl: remove unneeded cleanup_unlock label
Jim Fehlig [Mon, 2 Mar 2015 01:33:48 +0000 (18:33 -0700)]
libxl: remove unneeded cleanup_unlock label

In the old days of a global driver lock, it was necessary to unlock
the driver after a domain restore operation.  When the global lock
was removed from the driver, some remnants were left behind in
libxlDomainRestoreFlags.  Remove this unneeded (and incorrect) code.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agolibxl: use libxl_ctx passed to libxlConsoleCallback
Jim Fehlig [Wed, 11 Feb 2015 21:54:43 +0000 (14:54 -0700)]
libxl: use libxl_ctx passed to libxlConsoleCallback

Instead of using the libxl_ctx in the libxlDomainObjPrivatePtr,
use the ctx passed to the callback.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agolibxl: remove redundant calls to libxl_evdisable_domain_death
Jim Fehlig [Thu, 12 Feb 2015 17:42:25 +0000 (10:42 -0700)]
libxl: remove redundant calls to libxl_evdisable_domain_death

Domain death watch is already disabled in libxlDomainCleanup.  No
need to disable it a second and third time.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agospec: Enable RBD storage driver in RHEL-7
Peter Krempa [Thu, 5 Mar 2015 10:40:54 +0000 (11:40 +0100)]
spec: Enable RBD storage driver in RHEL-7

Use correct package names too as they differ.

10 years agoconf: Remove duplicate entries in <metadata> by namespace
Peter Krempa [Tue, 3 Mar 2015 16:50:59 +0000 (17:50 +0100)]
conf: Remove duplicate entries in <metadata> by namespace

Since the APIs support just one element per namespace and while
modifying an element all duplicates would be removed, let's do this
right away in the post parse callback.

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

10 years agoqemu: Allow spaces in disk serial
Michal Privoznik [Mon, 23 Feb 2015 11:34:23 +0000 (12:34 +0100)]
qemu: Allow spaces in disk serial

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

There's been a bug report appearing on the qemu-devel list, that
libvirt is unable to pass spaces in disk serial number [1]. Not only
our RNG schema forbids that, the code is not prepared either. However,
with a bit of escaping (if needed) we can allow spaces there.

1: https://lists.gnu.org/archive/html/qemu-devel/2015-02/msg04041.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoFix build on mingw
Ján Tomko [Thu, 5 Mar 2015 11:04:11 +0000 (12:04 +0100)]
Fix build on mingw

Last commit unconditionally included a linux-specific header.

Do not do that.

10 years agoSRIOV NIC offload feature discovery
James Chapman [Mon, 23 Feb 2015 15:38:29 +0000 (15:38 +0000)]
SRIOV NIC offload feature discovery

Adding functionality to libvirt that will allow it
query the ethtool interface for the availability
of certain NIC HW offload features

Here is an example of the feature XML definition:

<device>
<name>net_eth4_90_e2_ba_5e_a5_45</name>
  <path>/sys/devices/pci0000:00/0000:00:03.0/0000:08:00.1/net/eth4</path>
  <parent>pci_0000_08_00_1</parent>
  <capability type='net'>
    <interface>eth4</interface>
    <address>90:e2:ba:5e:a5:45</address>
    <link speed='10000' state='up'/>
    <feature name='rx'/>
    <feature name='tx'/>
    <feature name='sg'/>
    <feature name='tso'/>
    <feature name='gso'/>
    <feature name='gro'/>
    <feature name='rxvlan'/>
    <feature name='txvlan'/>
    <feature name='rxhash'/>
    <capability type='80203'/>
  </capability>
</device>

Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agoparallels: Cleanup partly opened drivers on connect open failure
Michal Privoznik [Thu, 26 Feb 2015 16:13:53 +0000 (17:13 +0100)]
parallels: Cleanup partly opened drivers on connect open failure

Well, the parallelsConnectOpen() joins several sub-driver openings
into one big if condition. If any of sub-driver fails to open, the
whole API finishes immediately. The problem is, sub-drivers may have
left some memory allocated. Fortunately, we have a free function for
that: parallelsConnectClose(). This is, however, not prepared for
partially allocated driver structure. So, prepare the free function
for it and call it at the right place, in the if body.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agostorage: tweak condition to properly test lseek
Erik Skultety [Tue, 3 Mar 2015 15:57:38 +0000 (16:57 +0100)]
storage: tweak condition to properly test lseek

According to the POSIX standard, off_t (returned by lseek) is defined as
signed integral type no shorter than int. Because our offset variable is defined
as unsigned long long, the original check was passed successfully if UINT64_MAX had
been used as offset value, due to implicit conversion.

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

10 years agovirsh: tweak domif-getlink link state reporting message
Erik Skultety [Tue, 24 Feb 2015 16:25:55 +0000 (17:25 +0100)]
virsh: tweak domif-getlink link state reporting message

According to docs, we only support 2 link states for an interface
up/down, 'up' being the default state if link state is unspecified in
domain's XML, so the message when no link state is provided should be
changed a little.

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

10 years agoqemu: snapshot: Don't skip check for qcow2 format with network disks
Shanzhi Yu [Sat, 28 Feb 2015 09:51:36 +0000 (17:51 +0800)]
qemu: snapshot: Don't skip check for qcow2 format with network disks

When the domain's source disk type is network, if source protocol is rbd
or sheepdog, the 'if().. break' will end the current case, which lead to
miss check the driver type is raw or qcow2. Libvirt will allow to create
internal snapshot for a running domain with raw format disk which based
on rbd storage.

While both protocols support internal snapshots of the disk qemu is not
able to use it as it requires some place to store the memory image. The
check if the disk is backed by a qcow2 image needs to be executed
always.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1179533
Signed-off-by: Shanzhi Yu <shyu@redhat.com>
10 years agoqemu: Allow inactive domains in qemuDomainGetControlInfo()
Peter Krempa [Thu, 19 Feb 2015 11:00:27 +0000 (12:00 +0100)]
qemu: Allow inactive domains in qemuDomainGetControlInfo()

Inactive domains can still be stuck in a job or other problems. Add a
way to detect it.

10 years agoqemu: Properly report error state in qemuDomainGetControlInfo()
Peter Krempa [Thu, 19 Feb 2015 10:53:42 +0000 (11:53 +0100)]
qemu: Properly report error state in qemuDomainGetControlInfo()

Previously when a domain would get stuck in a domain job due to a
programming mistake we'd report the following control state:

$ virsh domcontrol domain
occupied (1424343406.150s)

The timestamp is invalid as the monitor was not entered for that domain.
We can use that to detect that the domain has an active job and report a
better error instead:

$ virsh domcontrol domain
error: internal (locking) error

10 years agoconf: s/virNetworkFindByName/virNetworkObjFindByName/
Michal Privoznik [Mon, 23 Feb 2015 16:05:52 +0000 (17:05 +0100)]
conf: s/virNetworkFindByName/virNetworkObjFindByName/

It's returning virNetworkObjPtr after all. And it matches the
pattern laid out by domain_conf.h.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoconf: s/virNetworkFindByUUID/virNetworkObjFindByUUID/
Michal Privoznik [Mon, 23 Feb 2015 15:57:29 +0000 (16:57 +0100)]
conf: s/virNetworkFindByUUID/virNetworkObjFindByUUID/

It's returning virNetworkObjPtr after all. And it matches the
pattern laid out by domain_conf.h.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agobridge_driver: s/virNetworkObjList/virNetworkObjListPtr/
Michal Privoznik [Mon, 23 Feb 2015 15:41:55 +0000 (16:41 +0100)]
bridge_driver: s/virNetworkObjList/virNetworkObjListPtr/

In order to hide the object internals (and use just accessors
everywhere), lets store a pointer to the object, instead of object
itself.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoparallels: s/virNetworkObjList/virNetworkObjListPtr/
Michal Privoznik [Mon, 23 Feb 2015 14:55:24 +0000 (15:55 +0100)]
parallels: s/virNetworkObjList/virNetworkObjListPtr/

In order to hide the object internals (and use just accessors
everywhere), lets store a pointer to the object, instead of object
itself.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agotest_driver: s/virNetworkObjList/virNetworkObjListPtr/
Michal Privoznik [Mon, 23 Feb 2015 14:54:54 +0000 (15:54 +0100)]
test_driver: s/virNetworkObjList/virNetworkObjListPtr/

In order to hide the object internals (and use just accessors
everywhere), lets store a pointer to the object, instead of object
itself.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agovirNetworkObjListExport: Pass virNetworkObjListPtr
Michal Privoznik [Mon, 23 Feb 2015 14:44:57 +0000 (15:44 +0100)]
virNetworkObjListExport: Pass virNetworkObjListPtr

Instead of copying the whole object onto stack when calling the
function, just pass the pointer to the object and save up some
space on the stack. Moreover, this prepares the code to hide the
virNetworkObjList structure into network_conf.c and use accessors
only.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agovirNetworkObjListFree: Accept NULL
Michal Privoznik [Mon, 23 Feb 2015 15:19:54 +0000 (16:19 +0100)]
virNetworkObjListFree: Accept NULL

All of our vir*Free() functions should accept NULL, even though
that there's no way of actually passing NULL with current code.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agovirNetworkObjIsDuplicate: s/@doms/@nets/
Michal Privoznik [Wed, 25 Feb 2015 14:10:53 +0000 (15:10 +0100)]
virNetworkObjIsDuplicate: s/@doms/@nets/

This is probably a copy-paste error from virDomainObj*
counterpart.  But when speaking of virNetworkObj we should use
variable @nets for an array of networks, rather than @doms. It's
just confusing.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agonetworkGetNetworkAddress: Drop empty 'error' label
Michal Privoznik [Wed, 25 Feb 2015 16:51:37 +0000 (17:51 +0100)]
networkGetNetworkAddress: Drop empty 'error' label

Moreover, there are two points within the function, where we're
missing 'goto cleanup'. Fix this too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agotestNetworkUpdate: Unlock network at the end
Michal Privoznik [Wed, 25 Feb 2015 16:46:45 +0000 (17:46 +0100)]
testNetworkUpdate: Unlock network at the end

Silly this bug went unnoticed so long. At the beginning we try to
find the passed network in the list of network objects. If found,
it's locked and real work takes place. Then, in the end, the
network object is never unlocked.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agobridge_driver: Don't check network active unlocked
Michal Privoznik [Mon, 23 Feb 2015 18:00:57 +0000 (19:00 +0100)]
bridge_driver: Don't check network active unlocked

Okay, this is mainly for educational purposes since is called
from single point only with all the possible locks held. So
there's no way for other thread to hop in and do something wrong.
Nevertheless, we should not give bad example.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agonetworkLookupByUUID: Improve error message
Michal Privoznik [Mon, 23 Feb 2015 14:05:44 +0000 (15:05 +0100)]
networkLookupByUUID: Improve error message

We have this function networkObjFromNetwork() which for given
virNetworkPtr tries to find corresponding virNetworkObjPtr. If no
object is found, a nice error message is printed out:

  no network with matching uuid '$uuid' ($name)

Let's improve the error message produced by networkLookupByUUID to
follow that logic.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoqemuProcessReconnect: Fill in pid file path
Michal Privoznik [Tue, 3 Mar 2015 10:51:19 +0000 (11:51 +0100)]
qemuProcessReconnect: Fill in pid file path

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

So, libvirt uses pid file to track pid of started qemus. Whenever
a domain is started, its pid is put into corresponding pid file.
The pid file path is generated based on domain name and stored
into domain object internals. However, it's not stored in the
status XML and therefore lost on daemon restarts. Hence, later,
when domain is being shut down, the daemon does not know which
pid file to unlink, and the correct pid file is left behind. To
avoid this, lets generate the pid file path again in
qemuProcessReconnect().

Reported-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoqemu: check defaultMode for spice graphics independently
Pavel Hrdina [Fri, 27 Feb 2015 14:07:03 +0000 (15:07 +0100)]
qemu: check defaultMode for spice graphics independently

Instead of checking defaultMode for every channel that has no mode
configured, test it only once outside of channel loop.  This fixes a bug
that in case all possible channels are fore example set to insecure, but
defaultMode is set to secure, we wouldn't auto-generate TLS port.  This
results in failure while starting a guest.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agoqemu: remove duplicated code for allocating spice ports
Pavel Hrdina [Fri, 27 Feb 2015 13:28:53 +0000 (14:28 +0100)]
qemu: remove duplicated code for allocating spice ports

We have two different places that needs to be updated while touching
code for allocation spice ports.  Add a bool option to
'qemuProcessSPICEAllocatePorts' function to switch between true and fake
allocation so we can use this function also in qemu_driver to generate
native domain definition.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agotests : Add test for 'ppc64le' architecture.
Prerna Saxena [Thu, 26 Feb 2015 17:15:54 +0000 (22:45 +0530)]
tests : Add test for 'ppc64le' architecture.

Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
10 years agoRNG: Add 'ppc64le' arch and newer pseries-2.* machine types
Prerna Saxena [Thu, 26 Feb 2015 14:10:58 +0000 (08:10 -0600)]
RNG: Add 'ppc64le' arch and newer pseries-2.* machine types

Acked-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
10 years agoschema: Fix interface link state schema
Peter Krempa [Mon, 2 Mar 2015 16:21:23 +0000 (17:21 +0100)]
schema: Fix interface link state schema

In commit edd1295e1da6bfe8e4e257e5fbfad71ac0bf7c87 I've introduced an
XML element that allows to configure state of the network interface
link. Somehow the RNG schema hunk ended up in a weird place in the
network schema definition. Move it to the right place and add a test
case.

Note that the link state is set up via the monitor at VM startup so I
originally didn't think of adding a test case.

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

10 years agoconf: De-duplicate scheduling policy enums
Martin Kletzander [Mon, 2 Mar 2015 16:14:39 +0000 (17:14 +0100)]
conf: De-duplicate scheduling policy enums

Since adding the support for scheduler policy settings in commit
8680ea97, there are two enums with the same information.  That was
caused by rewriting the patch since first draft.

Find out thanks to clang, but there was no impact whatsoever.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: Don't crash in qemuDomainOpenChannel()
Martin Kletzander [Mon, 2 Mar 2015 14:42:41 +0000 (15:42 +0100)]
qemu: Don't crash in qemuDomainOpenChannel()

The problem here was that when opening a channel, we were checking
whether the channel given is alias (can't be NULL for running domain) or
it's name, which can be NULL (for example with spicevmc).  In case of
such domain qemuDomainOpenChannel() made the daemon crash.
STREQ_NULLABLE() is safe to use since the code in question is wrapped in
"if (name)" and is more readable, so use that instead of checking for
non-NULL "vm->def->channels[i]->target.name".

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agovirsh.pod: Update find-storage-pool-sources[-as] man page
John Ferlan [Wed, 25 Feb 2015 22:41:34 +0000 (17:41 -0500)]
virsh.pod: Update find-storage-pool-sources[-as] man page

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

Add to the man page a more complete description of what exactly the
command expects on input and will return on output based on what is
currently supported.

Perhaps missing findPoolSources implementations are backends for
sheepdog and rbd.  Also missing any backend is zfs.

10 years agoiscsi: Adjust error message for findStorageSources backend
John Ferlan [Wed, 25 Feb 2015 22:31:55 +0000 (17:31 -0500)]
iscsi: Adjust error message for findStorageSources backend

The virStorageBackendISCSIFindPoolSources API only needs the 'host' name
in order to discover iSCSI pools, it returns the various device paths.
On input, it's also possible to further restrict a search by providing the
port attribute for the host element and the (undocumented) initiator element.

For example:

$  virsh find-storage-pool-sources-as iscsi
error: Failed to find any iscsi pool sources
error: invalid argument: hostname and device path must be specified for iscsi sources

$ virsh find-storage-pool-sources-as iscsi 192.168.122.1
<sources>
  <source>
    <host name='192.168.122.1' port='3260'/>
    <device path='iqn.2013-12.com.example:iscsi-chap-lclpool'/>
  </source>
</sources>

10 years agovirsh.pod: Add information regarding LXC for setmem, memtune, and dominfo
John Ferlan [Thu, 26 Feb 2015 23:31:06 +0000 (18:31 -0500)]
virsh.pod: Add information regarding LXC for setmem, memtune, and dominfo

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

Modify the virsh man page to more accurately describe which values are
set by the virsh setmem and displayed by the virsh memtune or dominfo
based on the setmem command results.

10 years agodisk: Provide a default storage source format type.
John Ferlan [Fri, 27 Feb 2015 00:39:36 +0000 (19:39 -0500)]
disk: Provide a default storage source format type.

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

According to the formatstorage.html description for <source> element
and "format" attribute: "All drivers are required to have a default
value for this, so it is optional."

As it turns out the disk backend did not choose a default value, so I
added a default of "msdos" if the source type is "unknown" as well as
updating the storage.html backend disk volume driver documentation to
indicate the default format is dos.

10 years agodisk: Disallow duplicated target 'dev' values
John Ferlan [Thu, 26 Feb 2015 17:20:01 +0000 (12:20 -0500)]
disk: Disallow duplicated target 'dev' values

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

This patch resolves a situation where the same "<target dev='$name'...>"
can be used for multiple disks in the domain.

While the $name is "mostly" advisory regarding the expected order that
the disk is added to the domain and not guaranteed to map to the device
name in the guest OS, it still should be unique enough such that other
domblk* type operations can be performed.

Without the patch, the domblklist will list the same Target twice:

$ virsh domblklist $dom
Target     Source
------------------------------------------------
sda        /var/lib/libvirt/images/file.qcow2
sda        /var/lib/libvirt/images/file.img

Additionally, getting domblkstat, domblkerror, domblkinfo, and other block*
type calls will not be able to reference the second target.

Fortunately, hotplug disallows adding a "third" sda value:

$ qemu-img create -f raw /var/lib/libvirt/images/file2.img 10M
$ virsh attach-disk $dom /var/lib/libvirt/images/file2.img sda
error: Failed to attach disk
error: operation failed: target sda already exists

$

BUT, it since 'sdb' doesn't exist one would get the following on the same
hotplug attempt, but changing to use 'sdb' instead of 'sda'

$ virsh attach-disk $dom /var/lib/libvirt/images/file2.img sdb
error: Failed to attach disk
error: internal error: unable to execute QEMU command 'device_add': Duplicate ID 'scsi0-0-1' for device

$

Since we cannot fix this issue at parsing time, the best that can be done so
as to not "lose" a domain is to make the check prior to starting the guest
with the results as follows:

$ virsh start $dom
error: Failed to start domain $dom
error: XML error: target 'sda' duplicated for disk sources '/var/lib/libvirt/images/file.qcow2' and '/var/lib/libvirt/images/file.img'

$

Running 'make check' found a few more instances in the tests where this
duplicated target dev value was being used. These also exhibited some
duplicated 'id=' values (negating the uniqueness argument of aliases) in
the corresponding .args file and of course the *xmlout version of a few
input XML files.

10 years agovirsh: Adjust domblklist to understand disk volume syntax
John Ferlan [Thu, 26 Feb 2015 16:22:17 +0000 (11:22 -0500)]
virsh: Adjust domblklist to understand disk volume syntax

A disk using a source pool is listed as having a source '-' in domblklist
because it doesn't check the right XML syntax to find the source.

Add a check for "./source/volume" which is where the "path" (of sorts)
to the volume name is described.

10 years agoconf: numa: Add helper to count total memory size configured in NUMA
Peter Krempa [Mon, 16 Feb 2015 19:15:04 +0000 (20:15 +0100)]
conf: numa: Add helper to count total memory size configured in NUMA

The total NUMA memory consists of the sum of individual NUMA node memory
amounts.

10 years agoqemu: Forbid setting maximum memory size with the API with NUMA enabled
Peter Krempa [Tue, 17 Feb 2015 15:53:25 +0000 (16:53 +0100)]
qemu: Forbid setting maximum memory size with the API with NUMA enabled

NUMA enabled guest configuration explicitly specifies memory sizes for
individual nodes. Allowing the virDomainSetMemoryFlags API (and friends)
to change the total doesn't make sense as the individual node configs
are not updated in that case.

Forbid use of the API in case NUMA is specified.

10 years agophyp: Fix error messages mentioning memory
Peter Krempa [Tue, 24 Feb 2015 17:08:51 +0000 (18:08 +0100)]
phyp: Fix error messages mentioning memory

The messages for currentMemory and memory were swapped.

10 years agodocs: add a note that attr 'managed' is only used by PCI devices
Erik Skultety [Fri, 27 Feb 2015 11:45:57 +0000 (12:45 +0100)]
docs: add a note that attr 'managed' is only used by PCI devices

Our documentation isn't 100% clear about hostdev 'managed' attribute usage,
because it only makes sense to use it with PCI devices, yet we format
this attribute to all hostdev devices. By adding a note into the docs,
we can possibly avoid confusion from customer's side and also avoid a solution
using ternary logic.

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