]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
9 years agodocs: website: more header spacing tweaks
Cole Robinson [Fri, 18 Mar 2016 19:57:11 +0000 (15:57 -0400)]
docs: website: more header spacing tweaks

- remove top padding for h1. this means page titles sit flush with the top
  of the side bar (like 'The virtualization API' on the front page)
- up the top padding for the remaining sections. makes it visually easier
  to tell adjacent header sections apart, especially in dense wiki pages
- use two different spacing levels for h2-h4 and h5-h6,
  gives pages some more visual flexibility
- use a slightly lower bottom padding... this makes top padding stick out
  more which makes it visually easier to differentiate between adjacent
  header sections

9 years agodocs: Update the hyperv feature qemu supported version
John Ferlan [Mon, 28 Mar 2016 14:57:55 +0000 (10:57 -0400)]
docs: Update the hyperv feature qemu supported version

In order to follow recent comments which indicate support for specific
feature bits are supported by a specific QEMU version add the version
from whence the relaxed, vapic, and spinlocks support was added.

9 years agoconf: qemu: Add support for more HyperV Enlightenment features
Maxim Nestratov [Thu, 10 Mar 2016 12:43:49 +0000 (15:43 +0300)]
conf: qemu: Add support for more HyperV Enlightenment features

This patch adds support for "vpindex", "runtime", "synic",
"stimer", and "vendor_id" features available in qemu 2.5+.

- When Hyper-V "vpindex" is on, guest can use MSR HV_X64_MSR_VP_INDEX
to get virtual processor ID.

- Hyper-V "runtime" enlightement feature allows to use MSR
HV_X64_MSR_VP_RUNTIME to get the time the virtual processor consumes
running guest code, as well as the time the hypervisor spends running
code on behalf of that guest.

- Hyper-V "synic" stands for Synthetic Interrupt Controller, which is
lapic extension controlled via MSRs.

- Hyper-V "stimer" switches on Hyper-V SynIC timers MSR's support.
Guest can setup and use fired by host events (SynIC interrupt and
appropriate timer expiration message) as guest clock events

- Hyper-V "reset" allows guest to reset VM.

- Hyper-V "vendor_id" exposes hypervisor vendor id to guest.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoconf: refactor hyperv features xml output
Nikolay Shirokovskiy [Thu, 10 Mar 2016 12:43:48 +0000 (15:43 +0300)]
conf: refactor hyperv features xml output

1. All hyperv features are tristate ones. So make tristate generating part common.
2. Reduce nesting on spinlocks.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoconf: refactor hyperv features parsing
Nikolay Shirokovskiy [Thu, 10 Mar 2016 12:43:47 +0000 (15:43 +0300)]
conf: refactor hyperv features parsing

1. All hyperv features are tristate ones. So make tristate parsing code common.
2. Reindent switch statement.
3. Reduce nesting in spinlocks parsing.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoutil: avoid getting stuck on macvtapN name created outside libvirt
Laine Stump [Mon, 28 Mar 2016 14:14:04 +0000 (10:14 -0400)]
util: avoid getting stuck on macvtapN name created outside libvirt

After the patches that added tracking of in-use macvtap names (commit
370608, first appearing in libvirt-1.3.2), if the function to allocate
a new macvtap device came to a device name created outside libvirt, it
would retry the same device name MACVLAN_MAX_ID (8191) times before
finally giving up in failure.

The problem was that virBitmapNextClearBit was always being called
with "0" rather than the value most recently checked (which would
increment each time through the loop), so it would always return the
same id (since we dutifully release that id after failing to create a
new device using it).

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

Signed-off-by: Laine Stump <laine@laine.org>
9 years agolibxl: fix hot add/remove VF from a pool
Chunyan Liu [Mon, 21 Mar 2016 08:11:40 +0000 (16:11 +0800)]
libxl: fix hot add/remove VF from a pool

For those VF allocated from a network pool, we need to set its backend
to be VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN so that later work can be
correct.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
9 years agotests: storagepoolxml2xmltest: Enable pool-rbd
Anatole Denis [Fri, 11 Mar 2016 16:50:54 +0000 (17:50 +0100)]
tests: storagepoolxml2xmltest: Enable pool-rbd

This test was commited 4 years ago, but was never enabled in
storagepoolxml2xmltest.c. This patch reactivates it, conditionnaly on RBD
storage support being enabled

9 years agotests: storagepoolxml2xmltest: Fix pool-rbd test
Anatole Denis [Fri, 11 Mar 2016 16:50:53 +0000 (17:50 +0100)]
tests: storagepoolxml2xmltest: Fix pool-rbd test

This test failed for two reasons:
* The uuid was missing from the input file
* The output file had the <name> in a different place from the actual output

9 years agoRevert "zfs: Only raw volumes are supported"
Roman Bogorodskiy [Sun, 27 Mar 2016 15:07:52 +0000 (11:07 -0400)]
Revert "zfs: Only raw volumes are supported"

This reverts commit bb5f2dc91f43f48ff726aa589bdac546738d2980.

The "if (vol->target.format != VIR_STORAGE_FILE_RAW)" check in the
createVol backend. This check is bogus because virStorageVolDefParseXML()
in conf/storage_conf.c sets target.format only if volOptions in
virStoragePoolTypeInfo has formatFromString set, and that's not the
case the zfs backend.

So the check always fails and breaks volume creation.

9 years agoRevert "logical: Only raw volumes are supported"
Roman Bogorodskiy [Sun, 27 Mar 2016 14:59:22 +0000 (10:59 -0400)]
Revert "logical: Only raw volumes are supported"

This reverts commit 6682d6219d4595b51f06867e0c30e7efd745f682.

The "if (vol->target.format != VIR_STORAGE_FILE_RAW)" check in the
createVol backend. This check is bogus because virStorageVolDefParseXML()
in conf/storage_conf.c sets target.format only if volOptions in
virStoragePoolTypeInfo has formatFromString set, and that's not the
case the logical backend.

So the check always fails and breaks volume creation.

9 years agolibxlDomainDetachDeviceLive: handle hostdev parent is network device
Chunyan Liu [Mon, 21 Mar 2016 08:11:38 +0000 (16:11 +0800)]
libxlDomainDetachDeviceLive: handle hostdev parent is network device

When hostdev parent is network device, should call
libxlDomainDetachNetDevice to detach the device from a higher level.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
9 years agolibxlDomainDetachNetDevice: cleanup codes
Chunyan Liu [Mon, 21 Mar 2016 08:11:37 +0000 (16:11 +0800)]
libxlDomainDetachNetDevice: cleanup codes

Adjust codes to make it cleaner.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
9 years agolibxlDomainAttachNetDevice: release actual deivce and remove hostdev when fail
Chunyan Liu [Mon, 21 Mar 2016 08:11:36 +0000 (16:11 +0800)]
libxlDomainAttachNetDevice: release actual deivce and remove hostdev when fail

When AttachNetDevice failed, should call networkReleaseActualDevice
to release actual device, and if actual device is hostdev, should
remove the hostdev from vm->def->hostdevs.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
9 years agonetwork: call proper start/stop functions for macvtap bridge-mode networks
Laine Stump [Fri, 25 Mar 2016 17:17:28 +0000 (13:17 -0400)]
network: call proper start/stop functions for macvtap bridge-mode networks

networkStartNetwork() and networkShutdownNetwork() were calling the
wrong type-specific function in the case of networks that were
configured for macvtap ("direct") bridge mode - they were instead
calling the functions for a tap+bridge network. Currently none of
these functions does anything (they just return 0) so it hasn't
created any problems, but that could change in the future.

9 years agonetwork: differentiate macvtap/bridge from host-bridge based networks
Laine Stump [Fri, 11 Mar 2016 15:59:19 +0000 (10:59 -0500)]
network: differentiate macvtap/bridge from host-bridge based networks

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

An attempt to simplify the code for the VIR_NETWORK_FORWARD_BRIDGE
case of networkUpdateState in commit b61db335 (first in release
1.2.14) resulted in networks based on macvtap bridge mode being
erroneously marked as inactive any time libvirtd was restarted.

The problem is that the original code had differentiated between a
network using tap devices to connect to an existing host-bridge device
(forward mode of VIR_NETWORK_FORWARD_BRIDGE and a non-NULL
def->bridge), and one using macvtap bridge mode to connect to any
ethernet device (still forward mode VIR_NETWORK_FORWARD_BRIDGE, but
null def->bridge), but the changed code assumed that all networks with
VIR_NETWORK_FORWARD_BRIDGE were tap + host-bridge networks, so a null
def->bridge was interpreted as "inactive".

This patch restores the original code in networkUpdateState

9 years agotest: Fix typo in testutils.h header guard
Christophe Fergeau [Fri, 25 Mar 2016 09:51:34 +0000 (10:51 +0100)]
test: Fix typo in testutils.h header guard

This changes __VIT_TEST_UTILS_H__ to __VIR_TEST_UTILS_H__

9 years agostorage/rbd: Use correct printf-modifier for uint64
Christophe Fergeau [Mon, 14 Mar 2016 10:41:05 +0000 (11:41 +0100)]
storage/rbd: Use correct printf-modifier for uint64

%zu is for size_t variables, not uint64 ones. This causes a warning when building on
a 32 bit linux.

9 years agovirTestSetEnvPath: Avoid clearing out PATH
Michal Privoznik [Fri, 25 Mar 2016 09:20:28 +0000 (10:20 +0100)]
virTestSetEnvPath: Avoid clearing out PATH

If the abs_builddir path already is in PATH and it's in the first
position, due to a bug in our code PATH would be cleared out.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoadmin_server: Avoid accessing unallocated memory
Michal Privoznik [Fri, 25 Mar 2016 09:18:00 +0000 (10:18 +0100)]
admin_server: Avoid accessing unallocated memory

In 68b726b93c11cc90 we tried to fix a mem leak. However, it
wasn't done quite well. Problem is, virNetDaemonGetServers() may
fail in which case virObjectListFreeCount() would be called with
-1 objects to free. But the number of elements is taken in
unsigned rather than signed integer.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: Replace some VIR_ERROR with vir*Error
Jovanka Gulicoska [Wed, 23 Mar 2016 18:32:13 +0000 (19:32 +0100)]
qemu: Replace some VIR_ERROR with vir*Error

qemuStateInitialize uses a mix of VIR_ERROR and standard vir*Error
calls. Prefer the standard vir*Error

9 years agoqemu: Don't duplicate virGetLastErrorMessage
Jovanka Gulicoska [Wed, 23 Mar 2016 18:31:50 +0000 (19:31 +0100)]
qemu: Don't duplicate virGetLastErrorMessage

These uses of virGetLastError message are just duplicating
virGetLastErrorMessage.

9 years agotestutils: Adapt to highly unlikely case
Michal Privoznik [Thu, 24 Mar 2016 13:57:42 +0000 (14:57 +0100)]
testutils: Adapt to highly unlikely case

Coverity pointed out that getenv("PATH") may return NULL. Well,
we check for that in virFindFileInPath() too. If this happens, we
will pass NULL into strstr(). Ouch.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agonsstest: Drop useless @data check
Michal Privoznik [Thu, 24 Mar 2016 13:54:58 +0000 (14:54 +0100)]
nsstest: Drop useless @data check

The variable is dereferenced prior its check for NULL. The check
itself does not make much sense anyway - it's our test, we know
we are not passing NULL.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirlog: Refactor virLogParseFilters
Erik Skultety [Wed, 16 Mar 2016 22:24:47 +0000 (23:24 +0100)]
virlog: Refactor virLogParseFilters

Patch 0b231195 refactored logging output parser to make it more readable.
This patch does similar thing to logging filter parser.

9 years agotests: Add new testcases to test parsing of log filters in virlogtest
Erik Skultety [Thu, 17 Mar 2016 08:37:24 +0000 (09:37 +0100)]
tests: Add new testcases to test parsing of log filters in virlogtest

9 years agotests: virlogtest: Fix testLogParseOutputs return value
Erik Skultety [Thu, 17 Mar 2016 09:16:19 +0000 (10:16 +0100)]
tests: virlogtest: Fix testLogParseOutputs return value

The test can return positive value even though it should have failed. It just
returns the value parser returned, which should be flipped back to -1 if
something went wrong or the result was unexpected, but it isn't.

9 years agoadmin_server: fix memory leak
Pavel Hrdina [Thu, 24 Mar 2016 09:48:30 +0000 (10:48 +0100)]
admin_server: fix memory leak

If caller of adminConnectListServers() pass NULL instead of servers we
need to free the list we've received from virNetDaemonGetServers().

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agogendispatch: Avoid comparing signed and unsigned vars
Michal Privoznik [Wed, 16 Mar 2016 09:24:38 +0000 (10:24 +0100)]
gendispatch: Avoid comparing signed and unsigned vars

The adminDispatchConnectListServers() function is generated by
our great perl script. However, it has a tiny flaw: if
adminConnectListServers() it calls fails, the control jumps onto
cleanup label where we try to free any list of servers built so
far. However, in the loop @i is unsigned (size_t) while @nresults
is signed (int). Currently, it does no harm because of the check
for @result being non-NULL. But if that ever changes in the
future, this bug will be hard to chase.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoevent-test: Check for virConnectRegisterCloseCallback return value
Michal Privoznik [Wed, 16 Mar 2016 08:32:44 +0000 (09:32 +0100)]
event-test: Check for virConnectRegisterCloseCallback return value

In an unlikely event of virConnectRegisterCloseCallback failing,
the error is ignored. This is an example file and we shouldn't
get a bad example.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoevent-test: Use goto cleanup instead of if else jungle
Michal Privoznik [Wed, 16 Mar 2016 08:55:47 +0000 (09:55 +0100)]
event-test: Use goto cleanup instead of if else jungle

Like in the rest of our code we tend to prefer 'goto' and
'cleanup' over 'if else' code structure. Do the same here.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemuxml2argvtest: Adapt to ethernet automatic tap creation
Michal Privoznik [Wed, 23 Mar 2016 15:19:26 +0000 (16:19 +0100)]
qemuxml2argvtest: Adapt to ethernet automatic tap creation

After 9c17d665fdc5 the tap device for ethernet network type is
automatically precreated before spawning qemu. Problem is, the
qemuxml2argvtest wasn't updated and thus is failing. Because of
all the APIs that new code is calling, I had to mock a lot. Also,
since the tap FDs are labeled separately from the rest of the
devices/files I had to enable NOP security driver for the test
too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoremote: Fix error message
Cole Robinson [Wed, 23 Mar 2016 20:51:59 +0000 (16:51 -0400)]
remote: Fix error message

We were printing the wrong MAX value

9 years agoqemuxml2argv: Mock virSCSIDeviceGetSgName
Michal Privoznik [Wed, 23 Mar 2016 08:57:06 +0000 (09:57 +0100)]
qemuxml2argv: Mock virSCSIDeviceGetSgName

When constructing SCSI hostdev command line for qemu, the
/sys/bus/scsi/devices/... dir is scanned. Unfortunately, even in
the tests. This is needed to determine the name of SCSI device to
passthrough to qemu, because in the domain XML we were given its
address instead. Anyway, we should not be touching live system
data in our test suite as it produced unpredictable results. The
test is regressing from 1e9a083742efe on.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoautocreate tap device for ethernet network type
Vasiliy Tolstov [Wed, 23 Mar 2016 11:37:59 +0000 (11:37 +0000)]
autocreate tap device for ethernet network type

If a user specify network type ethernet, then create it via libvirt and run
script if it provided. After this commit user does not need to
run external script to create tap device or add root permissions to qemu
process.

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
9 years agotests: hostdev: Add more tests
Andrea Bolognani [Fri, 18 Mar 2016 17:03:53 +0000 (18:03 +0100)]
tests: hostdev: Add more tests

Ensure the code behaves properly even for situations that were not
being considered before, such as simply detaching devices from the
host without attaching them to a guest and attaching devices as
managed even though they had already been manually detached from
the host.

9 years agohostdev: Use actual device when reattaching
Andrea Bolognani [Fri, 18 Mar 2016 17:03:52 +0000 (18:03 +0100)]
hostdev: Use actual device when reattaching

Instead of forcing the values for the unbind_from_stub, remove_slot
and reprobe properties, look up the actual device and use that when
calling virPCIDeviceReattach().

This ensures the device is restored to its original state after
reattach: for example, if it was not bound to any driver before
detach, it will not be bound forcefully during reattach.

9 years agohostdev: Save netdev configuration of actual device
Andrea Bolognani [Fri, 18 Mar 2016 17:03:51 +0000 (18:03 +0100)]
hostdev: Save netdev configuration of actual device

We would be just fine looking up the information in pcidevs most
of the time; however, some corner cases would not be handled
properly, so look up the actual device instead.

9 years agohostdev: Streamline device ownership tracking
Andrea Bolognani [Fri, 18 Mar 2016 17:03:50 +0000 (18:03 +0100)]
hostdev: Streamline device ownership tracking

After this patch, ownership of virPCIDevice instances is very easy
to keep track of: for each host PCI device, the only instance that
actually matters is the one inside one of the bookkeeping list.

Whenever some operation needs to be performed on a PCI device, the
actual device is looked up first; when this is not the case, a
comment explains the reason.

9 years agohostdev: Stop early if unmanaged devices have not been detached
Andrea Bolognani [Fri, 4 Mar 2016 15:16:16 +0000 (16:16 +0100)]
hostdev: Stop early if unmanaged devices have not been detached

Unmanaged devices, as the name suggests, are not detached
automatically from the host by libvirt before being attached to a
guest: it's the user's responsability to detach them manually
beforehand. If that preliminary step has not been performed, the
attach operation can't complete successfully.

Instead of relying on the lower layers to error out with cryptic
messages such as

  error: Failed to attach device from /tmp/hostdev.xml
  error: Path '/dev/vfio/12' is not accessible: No such file or directory

prevent the situation altogether and provide the user with a more
useful error message.

9 years agohostdev: Detect untracked inactive devices
Andrea Bolognani [Thu, 17 Mar 2016 16:41:31 +0000 (17:41 +0100)]
hostdev: Detect untracked inactive devices

Unmanaged devices are attached to guests in two steps: first,
the device is detached from the host and marked as inactive;
subsequently, it is marked as active and attached to the guest.

If the daemon is restarted between these two operations, we lose
track of the inactive device.

Steps 5 and 6 of virHostdevPreparePCIDevices() already subtly
take care of this situation, but some planned changes will make
it so that's no longer the case. Plus, explicit is always better
than implicit.

9 years agoqemuxml2argvtest: cleanup test
Pavel Hrdina [Tue, 15 Mar 2016 12:57:47 +0000 (13:57 +0100)]
qemuxml2argvtest: cleanup test

Use qemuProcessCreatePretendCmd instead duplicating required steps from
qemuProcessStart.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemuxml2argvtest: use driver.config and priv for qemuDomainSetPrivatePaths
Pavel Hrdina [Tue, 15 Mar 2016 12:54:24 +0000 (13:54 +0100)]
qemuxml2argvtest: use driver.config and priv for qemuDomainSetPrivatePaths

Update testutilsqemu to overwrite libDir and channelTargetDir and set
private paths using domain's privateData.  This changes is required for
following patch.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_driver: cleanup qemuConnectDomainXMLToNative
Pavel Hrdina [Thu, 17 Mar 2016 12:20:58 +0000 (13:20 +0100)]
qemu_driver: cleanup qemuConnectDomainXMLToNative

Use qemuProcessCreatePretendCmd instead duplicating required steps from
qemuProcessStart.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: introduce qemuProcessCreatePretendCmd
Pavel Hrdina [Tue, 22 Mar 2016 12:17:27 +0000 (13:17 +0100)]
qemu_process: introduce qemuProcessCreatePretendCmd

This will skip few steps from qemuProcessStart in order to create only
qemu CMD.  Use a VIR_QEMU_PROCESS_START_PRETEND for all the qemuProcess*
functions called by this one to not modify or check host.

This new function will be used later on for XMLToNative API and also for
qemuxml2argvtest to make sure that both API and test uses the same code
as qemuProcessStart.

We need also update qemuProcessInit to wrap few lines of code with check
that VIR_QEMU_PROCESS_START_PRETEND that makes sense only for
qemuProcessStart.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: move qemuDomainSetPrivatePaths to qemuProcessInit
Pavel Hrdina [Mon, 14 Mar 2016 09:31:28 +0000 (10:31 +0100)]
qemu_process: move qemuDomainSetPrivatePaths to qemuProcessInit

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: move checks to qemuProcessStartValidate
Pavel Hrdina [Thu, 17 Mar 2016 12:51:20 +0000 (13:51 +0100)]
qemu_process: move checks to qemuProcessStartValidate

Move all code that checks host and domain.  Do not check host if we use
VIR_QEMU_PROCESS_START_PRETEND flag.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu: update callers of qemuProcessStartValidate to use virDomainObjPtr
Pavel Hrdina [Thu, 17 Mar 2016 12:19:35 +0000 (13:19 +0100)]
qemu: update callers of qemuProcessStartValidate to use virDomainObjPtr

This change is required by following patches.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: introduce qemuProcessPrepareHost
Pavel Hrdina [Tue, 22 Mar 2016 12:16:05 +0000 (13:16 +0100)]
qemu_process: introduce qemuProcessPrepareHost

Move all code that modifies host system to this function.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: introduce qemuProcessPrepareDomain
Pavel Hrdina [Tue, 15 Mar 2016 12:00:59 +0000 (13:00 +0100)]
qemu_process: introduce qemuProcessPrepareDomain

Move all code that modifies only live XML to this function.  The new
VIR_QEMU_PROCESS_START_PRETEND flag will be used by qemuXMLToNative and
qemuxml2argvtest later in order to reuse the same code as
qemuProcessStart uses.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agotests: cleanup qemuxml2argvtest
Pavel Hrdina [Mon, 14 Mar 2016 09:37:40 +0000 (10:37 +0100)]
tests: cleanup qemuxml2argvtest

This removes the testFailed magic and makes the code more readable.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agonvram: generate it's path in qemuDomainDefPostParse
Pavel Hrdina [Wed, 9 Mar 2016 15:10:54 +0000 (16:10 +0100)]
nvram: generate it's path in qemuDomainDefPostParse

The postParse callback is the correct place to generate default values
that should be present in offline XML.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_process: check for correct return value while starting domain
Pavel Hrdina [Mon, 14 Mar 2016 15:54:03 +0000 (16:54 +0100)]
qemu_process: check for correct return value while starting domain

Function qemuProcessLaunch returns '-2' in case there was an error and
we need to cleanup labels.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu-hotplug: fix eject media
Pavel Hrdina [Thu, 17 Mar 2016 15:38:28 +0000 (16:38 +0100)]
qemu-hotplug: fix eject media

QEMU changed the error message to:

        "Tray of device 'drive-sata0-0-1' is not open"

and they may change the error massage in the future.

This updates the code to not depend on the text from the error message
but only on error itself.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agonss: Make aligning look nicer
Martin Kletzander [Fri, 18 Mar 2016 15:46:41 +0000 (16:46 +0100)]
nss: Make aligning look nicer

Every aligning requires at least one cast and it's hard to read.  Let's
make a function that makes sure the pointer is moved according to the
alignment and use that to move throughout the data buffer.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agotests: Produce predictable results in nsstest
Michal Privoznik [Mon, 21 Mar 2016 13:52:49 +0000 (14:52 +0100)]
tests: Produce predictable results in nsstest

Problem is that in the test any status file matching
tests/nssdata/*.status is loaded as it contains IP addresses that
are parsed. However, there's no order specified in which the
files are loaded. Therefore on different systems the order may be
different. This is then producing an unexpected results.
Instead of defining an order in which the files are loaded, make
the code that checks for missing IP addresses (or redundant ones)
cope with unordered list of addresses. The reasoning behind is
that the code doing the parsing is used in real NSS module where
we don't care for ordering.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agotests: nodedevxml2xml: add test for SCSI target
Bjoern Walk [Mon, 21 Mar 2016 14:49:30 +0000 (15:49 +0100)]
tests: nodedevxml2xml: add test for SCSI target

Let's add a test for SCSI target nodedev devices.

Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
9 years agoconf: node_device: fix up SCSI target
Bjoern Walk [Mon, 21 Mar 2016 14:49:29 +0000 (15:49 +0100)]
conf: node_device: fix up SCSI target

When reading in an XML definition for a SCSI target device, the name
property of struct scsi_target refers to the @target element.

Let's fix this obvious typo and also extend the XML schema to provide
validation.

Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
9 years agolibxl: support enabling and disabling <hap> feature
Jim Fehlig [Tue, 23 Feb 2016 03:06:57 +0000 (20:06 -0700)]
libxl: support enabling and disabling <hap> feature

Until now, the libxl driver ignored any <hap> setting in domain XML
and deferred to libxl, which enables hap if not specified. While
this is a good default, it prevents disabling hap if desired.

This change allows disabling hap with <hap state='off'/>. hap is
explicitly enabled with <hap/> or <hap state='on/>. Absense of <hap>
retains current behavior of deferring default state to libxl.

9 years agoXen drivers: show hap enabled by default in capabilities
Jim Fehlig [Tue, 23 Feb 2016 02:20:41 +0000 (19:20 -0700)]
Xen drivers: show hap enabled by default in capabilities

Hardware Assisted Paging is enabled by default in Xen. Change
the capabilities output to reflect this.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoxenconfig: change 'hap' setting to align with Xen behavior
Jim Fehlig [Tue, 23 Feb 2016 01:50:19 +0000 (18:50 -0700)]
xenconfig: change 'hap' setting to align with Xen behavior

hap is enabled by default in xm and xl config and usually only
specified when it is desirable to disable hap (hap = 0). Change
the xm,xl <-> xml converter to behave similarly. I.e. only
produce 'hap = 0' when <hap state='off'/> and vice versa.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoconf: add 'state' attribute to <hap> feature
Jim Fehlig [Tue, 23 Feb 2016 00:03:21 +0000 (17:03 -0700)]
conf: add 'state' attribute to <hap> feature

Most hypervisors use Hardware Assisted Paging by default and don't
require specifying the feature in domain conf. But some hypervisors
support disabling HAP on a per-domain basis. To enable HAP by default
yet provide a knob to disable it, extend the <hap> feature with a
'state=on|off' attribute, similar to <pvspinlock> and <vmport> features.

In the absence of <hap>, the hypervisor default (on) is used. <hap>
without the state attribute would be the same as <hap state='on'/> for
backwards compatibility. And of course <hap state='off'/> disables hap.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoqemu: Add flags to qemuMigrationWaitForCompletion
Jiri Denemark [Thu, 17 Dec 2015 12:46:18 +0000 (13:46 +0100)]
qemu: Add flags to qemuMigrationWaitForCompletion

The function already takes two bool arguments, switching to flags makes
it a lot easier to read. Especially in case we need to add another
boolean in the future.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Refuse to abort migration in post-copy mode
Jiri Denemark [Thu, 14 Jan 2016 23:10:37 +0000 (00:10 +0100)]
qemu: Refuse to abort migration in post-copy mode

In post-copy mode none of the hosts has a complete guest state and
rolling back migration is impossible. Thus aborting it would be
equivalent to destroying the domain.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Handle post-copy migration failures
Jiri Denemark [Wed, 13 Jan 2016 15:29:58 +0000 (16:29 +0100)]
qemu: Handle post-copy migration failures

When migration fails in the post-copy mode, it's impossible to just kill
the destination domain and resume the source since the source no longer
contains current guest state. Let's mark domains on both sides as
VIR_DOMAIN_PAUSED_POSTCOPY_FAILED to let the upper layer decide what to
do with them.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Refactor qemuProcessRecoverMigration
Jiri Denemark [Thu, 14 Jan 2016 14:55:18 +0000 (15:55 +0100)]
qemu: Refactor qemuProcessRecoverMigration

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Don't kill running migrated domain on daemon restart
Jiri Denemark [Fri, 8 Jan 2016 13:06:52 +0000 (14:06 +0100)]
qemu: Don't kill running migrated domain on daemon restart

When destination libvirtd is restarted during migration in Finish phase
just after the point we started guest CPUs, we should not kill the
domain.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agovirsh: Add --postcopy-after-precopy option to migrate
Cristian Klein [Mon, 1 Dec 2014 16:00:02 +0000 (17:00 +0100)]
virsh: Add --postcopy-after-precopy option to migrate

Signed-off-by: Cristian Klein <cristiklein@gmail.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agovirsh: Configurable migrate --timeout action
Jiri Denemark [Wed, 2 Dec 2015 14:14:41 +0000 (15:14 +0100)]
virsh: Configurable migrate --timeout action

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agovirsh: Add support for post-copy migration
Cristian Klein [Mon, 1 Dec 2014 15:59:58 +0000 (16:59 +0100)]
virsh: Add support for post-copy migration

Signed-off-by: Cristian Klein <cristiklein@gmail.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Implement virDomainMigrateStartPostCopy
Cristian Klein [Mon, 1 Dec 2014 15:59:57 +0000 (16:59 +0100)]
qemu: Implement virDomainMigrateStartPostCopy

Signed-off-by: Cristian Klein <cristiklein@gmail.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Add support for VIR_MIGRATE_POSTCOPY flag
Cristian Klein [Mon, 1 Dec 2014 15:59:55 +0000 (16:59 +0100)]
qemu: Add support for VIR_MIGRATE_POSTCOPY flag

Signed-off-by: Cristian Klein <cristiklein@gmail.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Add QMP functions for post-copy migration
Cristian Klein [Mon, 1 Dec 2014 15:59:54 +0000 (16:59 +0100)]
qemu: Add QMP functions for post-copy migration

Signed-off-by: Cristian Klein <cristiklein@gmail.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Handle postcopy-active migration state
Jiri Denemark [Thu, 26 Nov 2015 14:37:23 +0000 (15:37 +0100)]
qemu: Handle postcopy-active migration state

Migration enters "postcopy-active" state after QEMU switches to
post-copy and pauses guest CPUs. From libvirt's point of view this state
is similar to "completed" because we need to transfer guest execution to
the destination host.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoAdd public APIs for post-copy migration
Cristian Klein [Mon, 1 Dec 2014 15:59:53 +0000 (16:59 +0100)]
Add public APIs for post-copy migration

To use post-copy one has to start the migration with
VIR_MIGRATE_POSTCOPY flag and, while migration is in progress, call
virDomainMigrateStartPostCopy() to switch from pre-copy to post-copy.

Signed-off-by: Cristian Klein <cristiklein@gmail.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoAdd event and state details for post-copy
Jiri Denemark [Tue, 5 Jan 2016 11:08:37 +0000 (12:08 +0100)]
Add event and state details for post-copy

VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY and VIR_DOMAIN_PAUSED_POSTCOPY are
used on the source host once migration enters post-copy mode (which
means the domain gets paused on the source. After the destination host
takes over the execution of the domain, its virtual CPUs are resumed and
the domain enters VIR_DOMAIN_RUNNING_POSTCOPY state and
VIR_DOMAIN_EVENT_RESUMED_POSTCOPY event is emitted.

In case migration fails during post-copy mode and none of the hosts have
complete state of the domain, both domains will remain paused with
VIR_DOMAIN_PAUSED_POSTCOPY_FAILED reason and an upper layer may decide
what to do.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoutil: Add virSocketAddrSetIPv[46]AddrNetOrder and use it
Martin Kletzander [Fri, 18 Mar 2016 15:34:10 +0000 (16:34 +0100)]
util: Add virSocketAddrSetIPv[46]AddrNetOrder and use it

This allows setting the address in host and/or network order and makes
the naming consistent.  Now you don't need to call [hn]to[nh]l()
functions as that is taken care of by these functions.  Also, now
the *NetOrder take the address in network order, the other functions in
host order so the naming and usage is consistent.  Some places were
having the address in network order and calling ntohl() just so the
original function can call htonl() again.  This makes it nicer to read.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoqemu: Don't add -spice port=0 when no port is specified
Christophe Fergeau [Wed, 16 Mar 2016 11:11:58 +0000 (12:11 +0100)]
qemu: Don't add -spice port=0 when no port is specified

If a <graphics type='spice'> has no port nor tlsPort set, the generated
QEMU command line will contain -spice port=0.
This is later going to be ignored by spice-server, but it's better not
to add it at all in this situation.
As an empty -spice is not allowed, we still need to append port=0 if we
did not add any other argument.

9 years agoqemu: Omit SPICE address if no port is specified
Christophe Fergeau [Fri, 11 Mar 2016 17:18:12 +0000 (18:18 +0100)]
qemu: Omit SPICE address if no port is specified

Currently -spice addr=127.0.0.1 is generated, but spice-server is going
to ignore this as no port is specified.

9 years agoqemu: Make all SPICE command-line args optional
Christophe Fergeau [Fri, 11 Mar 2016 17:15:25 +0000 (18:15 +0100)]
qemu: Make all SPICE command-line args optional

The end goal is to avoid adding -spice port=0,addr=127.0.0.1 to QEMU command
line when no SPICE port is specified in libvirt XML.

Currently, the code relies on port=xx to always be present, so subsequent
args can be unconditionally appended with a leading ','. Since port=0
will no longer be added in a subsequent commit, we append a ',' to every
arg instead of prepending, and remove the last one before adding it to
the arg list.

9 years agozfs: Only unencrypted volumes are supported
Richard Laager [Tue, 15 Mar 2016 06:17:36 +0000 (01:17 -0500)]
zfs: Only unencrypted volumes are supported

9 years agozfs: Only raw volumes are supported
Richard Laager [Tue, 15 Mar 2016 06:17:35 +0000 (01:17 -0500)]
zfs: Only raw volumes are supported

9 years agological: Only raw volumes are supported
Richard Laager [Tue, 15 Mar 2016 06:17:34 +0000 (01:17 -0500)]
logical: Only raw volumes are supported

9 years agostorage: Improve code consistency between backends
Richard Laager [Tue, 15 Mar 2016 06:17:33 +0000 (01:17 -0500)]
storage: Improve code consistency between backends

This improves the code consistency around freeing vol->target.path in
createVol implementations.

9 years agosheepdog: Use a consistent error message
Richard Laager [Tue, 15 Mar 2016 06:17:32 +0000 (01:17 -0500)]
sheepdog: Use a consistent error message

This also reduces the number of strings to translate.

9 years agorbd: Use proper error type
Richard Laager [Tue, 15 Mar 2016 06:17:31 +0000 (01:17 -0500)]
rbd: Use proper error type

9 years agodomain: Add virDomainDefAddImplicitDevices
Cole Robinson [Fri, 8 Jan 2016 03:49:58 +0000 (22:49 -0500)]
domain: Add virDomainDefAddImplicitDevices

It's just a combination of AddImplicitControllers, and AddConsoleCompat.
Every caller that wants ImplicitControllers also wants the ConsoleCompat
AFAICT, so lump them together. We also need it for future patches.

9 years agonss: don't try to build nss plugin when disabled
Roman Bogorodskiy [Sat, 19 Mar 2016 16:56:02 +0000 (19:56 +0300)]
nss: don't try to build nss plugin when disabled

Even if nss is disabled, the build system tries to build some
targets like libnss_libvirt_impl.la and nsstest. Hide those
under the "if WITH_NSS" block like the rest of NSS plugin bits.

9 years agobhyve: caps: Log error message when CPU init fails
Cole Robinson [Fri, 18 Mar 2016 22:33:05 +0000 (18:33 -0400)]
bhyve: caps: Log error message when CPU init fails

virBhyveCapsInitCPU will raise a libvirt error; even though we treat
it as non-fatal we should log the actual message.

9 years agodomain: Remove controller/net address whitelists
Cole Robinson [Wed, 6 Jan 2016 20:44:30 +0000 (15:44 -0500)]
domain: Remove controller/net address whitelists

Judging by how the whitelist has skewed quite far from the original
error message, I think it's better to just drop these.

If someone wants to revive this check I suggest implementing it on
a per-HV driver basis with PostParse callbacks.

9 years agonodedev: Expose PCI header type
Martin Kletzander [Tue, 15 Mar 2016 11:22:03 +0000 (12:22 +0100)]
nodedev: Expose PCI header type

If we expose this information, which is one byte in every PCI config
file, we let all mgmt apps know whether the device itself is an endpoint
or not so it's easier for them to decide whether such device can be
passed through into a VM (endpoint) or not (*-bridge).

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agonodedev: Indent PCI express for future fix
Martin Kletzander [Tue, 15 Mar 2016 12:13:48 +0000 (13:13 +0100)]
nodedev: Indent PCI express for future fix

Best viewed with '-w' as this is just an adjustment for future patch to
be readable without that.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agotests: Introduce nsslinktest
Michal Privoznik [Thu, 3 Mar 2016 14:29:51 +0000 (15:29 +0100)]
tests: Introduce nsslinktest

The only purpose of this test is to catch possible linking
problems with libnss_libvirt.so.2.
One of the problems I faced was that the NSS plugin was unloaded
immediately after it got loaded and the name resolution process
continued with next configured option. Without any error. It was
very hard to debug why until I created this simple test and found
out immediately that there were some symbols missing. The reason
why problem was not caught in nsstest is that in the test we want
to use all the fancy stuff and therefore link it with libvirt.la.
So even if there's a symbol missing in the NSS plugin it will be
found in the libvirt.la.
But even after I resolved the issue we still need this test
because files the NSS plugin is built from are still live (mostly
those under utils/ dir). So as they change new symbol might be
required which would render the NSS plugin unusable.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agonss: Introduce a test
Michal Privoznik [Mon, 15 Feb 2016 13:02:05 +0000 (14:02 +0100)]
nss: Introduce a test

A small test to see how is the nss module working.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoImplement _nss_libvirt_gethostbyname4_r
Michal Privoznik [Sun, 14 Feb 2016 07:13:54 +0000 (08:13 +0100)]
Implement _nss_libvirt_gethostbyname4_r

This function is a different beast compared to previous ones.
But yet again, nothing surprising is happening here.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agonss: Implement _nss_libvirt_gethostbyname3_r
Michal Privoznik [Sun, 14 Feb 2016 10:38:37 +0000 (11:38 +0100)]
nss: Implement _nss_libvirt_gethostbyname3_r

The implementation is pretty straightforward. Moreover, because
of the nature of things, gethostbyname_r and gethostbyname2_r can
be implemented at the same time too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agolibvirt.spec.in: Introduce libvirt-nss package
Michal Privoznik [Tue, 16 Feb 2016 08:41:30 +0000 (09:41 +0100)]
libvirt.spec.in: Introduce libvirt-nss package

Lets put the NSS module into its own package.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoInitial support for NSS plugin skeleton
Michal Privoznik [Sat, 13 Feb 2016 08:27:50 +0000 (09:27 +0100)]
Initial support for NSS plugin skeleton

Name Service Switch is a glibc feature responsible for many
things. Translating domain names into IP addresses and vice versa
is just one of them. However, currently it's the only
functionality that this commit is tickling. Well, in this commit
the plugin skeleton is introduced. Implementation to come in next
patches.
Because of the future testing, where the implementation is to be
linked with a test, this needs to go into static library. Linking
a program with an .so statically is not portable. Therefore a
dummy libnss_libvirt_impl library is being introduced too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirsocketaddr: Introduce virSocketAddrSetIPv6Addr
Michal Privoznik [Tue, 15 Mar 2016 15:35:23 +0000 (16:35 +0100)]
virsocketaddr: Introduce virSocketAddrSetIPv6Addr

This is a missing counterpart for virSocketAddrSetIPv4Addr()
and is going to be needed later in the tests.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirLeaseReadCustomLeaseFile: Allow server_duid to be NULL
Michal Privoznik [Tue, 15 Mar 2016 15:49:37 +0000 (16:49 +0100)]
virLeaseReadCustomLeaseFile: Allow server_duid to be NULL

This function is going to be used later in such context where the
argument makes no sense. Teach this function to cope with that
instead of the caller having to deal with passing some dummy
argument.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>