]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agoqemu: restore non-pci hostdev labels after detach
Ján Tomko [Fri, 17 Jun 2016 11:14:56 +0000 (13:14 +0200)]
qemu: restore non-pci hostdev labels after detach

Commit 409de00 changed the logic to only match PCI devices
while moving this before Remove*HostDevice calls.

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

8 years agoRemove stray space in cmdHelp
Ján Tomko [Fri, 17 Jun 2016 17:27:08 +0000 (19:27 +0200)]
Remove stray space in cmdHelp

8 years agoqemu: Permit PCI-free aarch64 mach-virt guests
Andrea Bolognani [Thu, 16 Jun 2016 17:13:19 +0000 (19:13 +0200)]
qemu: Permit PCI-free aarch64 mach-virt guests

There has been some progress lately in enabling virtio-pci on
aarch64 guests; however, guest OS support is still spotty at best,
so most guests are going to be using virtio-mmio instead.

Currently, mach-virt guests are closely modeled after q35 guests,
and that includes always adding a dmi-to-pci-bridge that's just
impossible to get rid of. While that's acceptable (if suboptimal)
for q35, where you will always need some kind of PCI device anyway,
mach-virt guests should be allowed to avoid it.

8 years agoqemuDomainDetachDeviceConfig: Allow cold unplug of redirdevs
Michal Privoznik [Thu, 9 Jun 2016 10:06:47 +0000 (12:06 +0200)]
qemuDomainDetachDeviceConfig: Allow cold unplug of redirdevs

This is fairly simple. We lookup the device in the array of
devices and remove it. No magic.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuDomainAttachDeviceConfig: Allow redirdev coldplug
Michal Privoznik [Thu, 9 Jun 2016 06:37:05 +0000 (08:37 +0200)]
qemuDomainAttachDeviceConfig: Allow redirdev coldplug

This is really simple, we just need to append the device into the
domain def and that's it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirDomainDeviceInfoIterateInternal: Iterate through redirdevs too
Michal Privoznik [Thu, 9 Jun 2016 08:41:13 +0000 (10:41 +0200)]
virDomainDeviceInfoIterateInternal: Iterate through redirdevs too

This is going to be important later when we received
DEVICE_DELETED event on the qemu monitor. If we do,
virDomainDefFindDevice() is called to find the device for given
device alias in the virDomainDef tree. When we enable removal for
redirdevs we need to include them in the lookup process too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirDomainRedirdevDef: Introduce find & remove routines
Michal Privoznik [Thu, 9 Jun 2016 09:17:01 +0000 (11:17 +0200)]
virDomainRedirdevDef: Introduce find & remove routines

Basically, there are just two functions introduced here:
virDomainRedirdevDefFind which looks up given redirdev in domain
definition, and virDomainRedirdevDefRemove which removes the
device at given index in the array of devices.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agodomain_conf: Validate redirdev after parsing
Michal Privoznik [Thu, 9 Jun 2016 06:35:45 +0000 (08:35 +0200)]
domain_conf: Validate redirdev after parsing

There's currently just one limitation: redirdevs that want to go
on USB bus require a USB controller, surprisingly.
At the same time, since I'm using virDomainDefHasUSB() in this
new validator function, it has to be moved a few lines up and
also its header needed to be changed a bit: it is now taking a
const pointer to domain def since it's not changing anything in
there.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoconfigure: remove definition of HAVE_GLIBC_RPCGEN
Ján Tomko [Fri, 17 Jun 2016 10:02:17 +0000 (12:02 +0200)]
configure: remove definition of HAVE_GLIBC_RPCGEN

Unused since commit fb1e8d9 in May 2011.

8 years agoconfigure: error out when asked for mpath on non-Linux
Ján Tomko [Fri, 17 Jun 2016 09:55:04 +0000 (11:55 +0200)]
configure: error out when asked for mpath on non-Linux

8 years agoconfigure: define preprocessor macros for SCSI and MPATH
Ján Tomko [Fri, 17 Jun 2016 08:59:35 +0000 (10:59 +0200)]
configure: define preprocessor macros for SCSI and MPATH

This fixes building these backends when explicitly enabled
on the command line.

Exposed by commit a659559 which started adding
--with-storage-mpath in the spec file.

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

8 years agoqemu: Fix alignment in virDomainDefAddController() call
Andrea Bolognani [Fri, 17 Jun 2016 11:05:51 +0000 (13:05 +0200)]
qemu: Fix alignment in virDomainDefAddController() call

8 years agotests: schema: Remove useless perf schema data
Peter Krempa [Fri, 17 Jun 2016 08:22:48 +0000 (10:22 +0200)]
tests: schema: Remove useless perf schema data

We have a test case that excercises the parser and formatter now which
takes part in schema checking so remove the schema-only test.

8 years agodocs: virsh: Add minimal documentation for 'mbmt' and 'mbml' perf events
Peter Krempa [Fri, 17 Jun 2016 08:20:45 +0000 (10:20 +0200)]
docs: virsh: Add minimal documentation for 'mbmt' and 'mbml' perf events

8 years agocpu_x86: Use signature in CPU detection code
Jiri Denemark [Thu, 25 Jun 2015 13:06:19 +0000 (15:06 +0200)]
cpu_x86: Use signature in CPU detection code

Our current detection code uses just the number of CPU features which
need to be added/removed from the CPU model to fully describe the CPUID
data. The smallest number wins. But this may sometimes generate wrong
results as one can see from the fixed test cases. This patch modifies
the algorithm to prefer the CPU model with matching signature even if
this model results in a longer list of additional features.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Add Skylake-Client x86 CPU model
Jiri Denemark [Wed, 1 Jun 2016 13:50:40 +0000 (15:50 +0200)]
cpu: Add Skylake-Client x86 CPU model

The CPU model was implemented in QEMU by commit f6f949e929.

The change to i7-5600U is wrong since it's a 5th generation CPU, i.e.,
Broadwell rather than Skylake, but that's just the result of our CPU
detection code (which is fixed by the following commit).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agospec: Make driver-qemu require driver-storage
Martin Kletzander [Thu, 16 Jun 2016 16:42:20 +0000 (18:42 +0200)]
spec: Make driver-qemu require driver-storage

Without that we might get similar messages in the log:

  error : virDriverLoadModule:73 : failed to load module
  /usr/lib64/libvirt/connection-driver/libvirt_driver_qemu.so
  /usr/lib64/libvirt/connection-driver/libvirt_driver_qemu.so: undefined
  symbol: virStorageFileCreate

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoconf: Rename virDomainDefGetMemoryActual to virDomainDefGetMemoryTotal
Peter Krempa [Wed, 15 Jun 2016 13:34:04 +0000 (15:34 +0200)]
conf: Rename virDomainDefGetMemoryActual to virDomainDefGetMemoryTotal

8 years agoconf: Remove pre-calculation of initial memory size
Peter Krempa [Tue, 14 Jun 2016 09:23:23 +0000 (11:23 +0200)]
conf: Remove pre-calculation of initial memory size

While we need to know the difference between the total memory stored in
<memory> and the actual size not included in the possible memory modules
we can't pre-calculate it reliably. This is due to the fact that
libvirt's XML is copied via formatting and parsing the XML and the
initial memory size can be reliably calculated only when certain
conditions are met due to backwards compatibility.

This patch removes the storage of 'initial_memory' and fixes the helpers
to recalculate the initial memory size all the time from the total
memory size. This conversion is possible when we also make sure that
memory hotplug accounts properly for the update of the total memory size
and thus the helpers for inserting and removing memory devices need to
be tweaked too.

This fixes a bug where a cold-plug and cold-remove of a memory device
would increase the size reported in <memory> in the XML by the size of
the memory device. This would happen as the persistent definition is
copied before attaching the device and this would lead to the loss of
data in 'initial_memory'.

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

8 years agoconf: Fix perf event parser
Peter Krempa [Wed, 15 Jun 2016 14:33:20 +0000 (16:33 +0200)]
conf: Fix perf event parser

The parser was totaly broken. Fix it by rewriting it. Add tests so that
it doesn't happen.

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

8 years agodocs: Add at least some docs and fix schema entry for perf events
Peter Krempa [Wed, 15 Jun 2016 14:31:19 +0000 (16:31 +0200)]
docs: Add at least some docs and fix schema entry for perf events

There was no documentation at all for the XML part. I added at least
some. The 2.0.0 introduction date is deliberate as the parser for the
XML is broken.

The schema file was missing entries for 'mbml' and 'mbmt'.

8 years agoqemu: perf: Don't set state of first event for every other event
Peter Krempa [Wed, 15 Jun 2016 14:07:20 +0000 (16:07 +0200)]
qemu: perf: Don't set state of first event for every other event

A bug in the code used the value of the first perf event as state for
all the mentioned one rather than extracting individual ones.

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

8 years agoxenconfig: fix conversion of <driver> to backendtype
Jim Fehlig [Thu, 16 Jun 2016 05:09:36 +0000 (23:09 -0600)]
xenconfig: fix conversion of <driver> to backendtype

When converting domXML to xen xl.cfg, backendtype should
not be emitted if <driver> is not specified. Moreover,
<driver name='file'/> should be converted to backendtype
qdisk, similar to handling of <driver> in libxlMakeDisk()
in libxl_conf.c.

Prior to this change, connectDomainXMLToNative would
produce incorrect xl.cfg when the input domXML contained
<driver name='file'/>

domXML:

  <disk type="file" device="disk">
    <driver name="file"/>
    <source file="/image/file/path"/>
    <target dev="xvda" bus="xen"/>
  </disk>

virsh domxml-to-native xen-xl domXML

disk = [ "format=raw,vdev=xvda,access=rw,backendtype=target=/image/file/path" ]

xl create xl.cfg
config parsing error in disk specification: unknown value
for backendtype: near `target=/image/file/path' in
`format=raw,vdev=xvda,access=rw,backendtype=target=/image/file/path'

8 years agoutil: fix missing broadcast address in bridge and tap device IP addresses
Laine Stump [Thu, 16 Jun 2016 17:03:00 +0000 (13:03 -0400)]
util: fix missing broadcast address in bridge and tap device IP addresses

Commit b3d069872ce53eb added peer address setting to the low level
virNetDevSetIPAddress() function, but ended up causing a segfault in
cases where the caller passed NULL for peer address.

Commit a3510e33d33e52c fixed the segfault, but managed to cause us to
skip setting the broadcast address when setting an interface's IP
address. The result is that the broadcast address is 0.0.0.0 for all
libvirt-created bridges (and interfaces in lxc containers with IP
addresses set by libvirt).

This was reported on the mailing list:

  https://www.redhat.com/archives/libvir-list/2016-June/msg00027.html

but I was too busy to investigate at the time. I found it by accident
today while refactoring virNetDevSetIPAddress(). Since this regression
is present in the 1.3.5 release, I'm sending the bugfix as a separate
patch from my larger refactoring patchset.

8 years agoqemu: don't add pci-bridge to Q35/arm domains unless it's needed
Laine Stump [Fri, 22 Apr 2016 21:01:33 +0000 (17:01 -0400)]
qemu: don't add pci-bridge to Q35/arm domains unless it's needed

Until now, a Q35 domain (or arm/virt, or any other domain that has a
pcie-root bus) would always have a pci-bridge added, so that there
would be a hotpluggable standard PCI slot available to plug in any PCI
devices that might be added. This patch removes the explicit add,
instead relying on the pci-bridge being auto-added during PCI address
assignment (it will add a pci-bridge if there are no free slots).

This doesn't eliminate the dmi-to-pci-bridge controller that is
explicitly added whether or not a standard PCI slot is required (and
that is almost never used as anything other than a converter between
pcie.0's PCIe slots and standard PCI). That will be done separately.

8 years agoqemu: don't be as insistent about adding dmi-to-pci-bridge or pci-bridge
Laine Stump [Tue, 19 Apr 2016 21:37:51 +0000 (17:37 -0400)]
qemu: don't be as insistent about adding dmi-to-pci-bridge or pci-bridge

Previously there was no way to have a Q35 domain that didn't have
these two controllers. This patch skips their creation as long as
there are some other kinds of pci controllers at index 1 and 2
(e.g. some pcie-root-port controllers).

I'm hoping that soon we won't add them at all, plugging all devices
into auto-added pcie-*-port ports instead, but in the meantime this
makes it easier to experiment with alternative bus hierarchies.

8 years agoutil: remove redundant comments
Chen Hanxiao [Tue, 14 Jun 2016 11:08:26 +0000 (19:08 +0800)]
util: remove redundant comments

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
8 years agoevent-test: support storage lifecycle event APIs
Jovanka Gulicoska [Wed, 15 Jun 2016 18:50:18 +0000 (20:50 +0200)]
event-test: support storage lifecycle event APIs

8 years agostorage: implement storage lifecycle event APIs
Jovanka Gulicoska [Wed, 15 Jun 2016 18:48:30 +0000 (20:48 +0200)]
storage: implement storage lifecycle event APIs

Implement storage pool event callbacks for START, STOP, DEFINE, UNDEFINED
and REFRESHED in functions when a storage pool is created/started/stopped
etc. accordingly

8 years agoremote: implement storage lifecycle event APIs
Jovanka Gulicoska [Wed, 15 Jun 2016 18:35:45 +0000 (20:35 +0200)]
remote: implement storage lifecycle event APIs

8 years agotest: implement storage lifecycle event APIs
Jovanka Gulicoska [Wed, 15 Jun 2016 18:15:39 +0000 (20:15 +0200)]
test: implement storage lifecycle event APIs

Also includes unittests for storage pool lifecycle events API

8 years agoconf: add storage_event handling
Jovanka Gulicoska [Wed, 15 Jun 2016 17:59:16 +0000 (19:59 +0200)]
conf: add storage_event handling

Add storage event handling infrastructure to storage_event.[ch], following
the network_event.[ch] pattern.

8 years agoIntroduce storage lifecycle event APIs
Jovanka Gulicoska [Wed, 15 Jun 2016 17:57:06 +0000 (19:57 +0200)]
Introduce storage lifecycle event APIs

Storage pool lifecycle event API entry points for registering and deregistering
storage pool events, as well as types of events associated with storage pools.
These entry points will be used for implementing asynchronous lifecycle events.

Storage pool API:
virConnectStoragePoolEventRegisterAny
virConnectStoragePoolEventDeregisterAny
virStoragePoolEventLifecycleType which has events STARTED, STOPPED, DEFINED,
UNDEFINED, and REFRESHED

8 years agoqemu: Remove useless block in processWatchdogEvent
Martin Kletzander [Thu, 16 Jun 2016 15:05:07 +0000 (17:05 +0200)]
qemu: Remove useless block in processWatchdogEvent

Best viewed with -w since this is mostly just an indentation patch.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: Follow coding style convention
Martin Kletzander [Thu, 16 Jun 2016 15:03:40 +0000 (17:03 +0200)]
qemu: Follow coding style convention

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: Unify automatic coredump filenames
Martin Kletzander [Thu, 16 Jun 2016 15:00:05 +0000 (17:00 +0200)]
qemu: Unify automatic coredump filenames

Just create a helper for it and use it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: Add cfg pointer to various command line helpers
John Ferlan [Wed, 15 Jun 2016 16:03:29 +0000 (12:03 -0400)]
qemu: Add cfg pointer to various command line helpers

Soon at least one of them will need to grab something out of the
qemu config structure

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: Make qemuBuildShmemBackendStr private
John Ferlan [Wed, 15 Jun 2016 16:07:21 +0000 (12:07 -0400)]
qemu: Make qemuBuildShmemBackendStr private

It's not used externally anywhere else

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: Shorten domain name for watchdog coredump
Martin Kletzander [Mon, 13 Jun 2016 14:28:06 +0000 (16:28 +0200)]
qemu: Shorten domain name for watchdog coredump

Similarly to commit d294f6b0dff7, if the name is long enough, the
filename can be longer than filesystem's limit.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: migration: use consistent error message
Cole Robinson [Thu, 9 Jun 2016 11:19:41 +0000 (07:19 -0400)]
qemu: migration: use consistent error message

The other two DomainHasBlockJob usage error messages don't contain
'an', so unify things to save translators some effort. Dropping
the 'an' is closer to the sentence structure in the errors from
qemuDomainDiskBlockJobIsActive as well

8 years agoqemu: More usage of qemuDomainDiskBlockJobIsActive
Cole Robinson [Thu, 9 Jun 2016 11:16:10 +0000 (07:16 -0400)]
qemu: More usage of qemuDomainDiskBlockJobIsActive

qemuDomainDiskBlockJobIsActive already checks if a disk has a
blockjob, and if so, raises an error

8 years agovirsh: Fix help string for net-dumpxml
sannyshao [Wed, 15 Jun 2016 06:54:40 +0000 (14:54 +0800)]
virsh: Fix help string for net-dumpxml

Follow other examples (dumpxml, iface-dumpxml, and pool-dumpxml)
for the --inactive .help string

8 years agoutil: Fix broken syntax-check
John Ferlan [Thu, 16 Jun 2016 10:17:58 +0000 (06:17 -0400)]
util: Fix broken syntax-check

Commit id '743db933' broke at least one syntax check rule regard open/close
braces and perhaps more with spacing.  Just remove the braces

8 years agoadd default mapping of credentials to machine
yuelongguang [Mon, 13 Jun 2016 09:29:57 +0000 (17:29 +0800)]
add default mapping of credentials to machine

In the auth config file, it is currently required to have
an entry for each hostname to connect to, eg

  [auth-libvirt-prod1.example.com]
  credentials=prod

This is inconvenient when there are large numbers of machines
all with the same credentials. Add support for a default
entry:

  [auth-default]
  credentials=prod

8 years agosyntax-check: drop prohibit_undesirable_word_seq
Ján Tomko [Wed, 15 Jun 2016 16:09:04 +0000 (18:09 +0200)]
syntax-check: drop prohibit_undesirable_word_seq

This checks forbids using "can not" and checks the placement
of some texinfo tags.

Drop it since we do not use texinfo and the check takes almost
twice as much as the rest of the checks.

8 years agomaint: Switch to xz compressed PAX release archives
Andrea Bolognani [Wed, 15 Jun 2016 11:19:32 +0000 (13:19 +0200)]
maint: Switch to xz compressed PAX release archives

This allows us to produce releases that are roughly a third in
size, have no limitation on path length, and are still readable
by all supported platforms.

8 years agovz: get rid of unused home state variable in private domain obj
Nikolay Shirokovskiy [Fri, 20 May 2016 07:26:46 +0000 (10:26 +0300)]
vz: get rid of unused home state variable in private domain obj

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
8 years agocheck-spacing: fix error message
Ján Tomko [Wed, 15 Jun 2016 14:05:08 +0000 (16:05 +0200)]
check-spacing: fix error message

The check for whitespace before comma or semicolon referred
to comma as colon.

8 years agocheck-spacing: use non-capturing groups
Ján Tomko [Tue, 14 Jun 2016 15:13:13 +0000 (17:13 +0200)]
check-spacing: use non-capturing groups

8 years agocheck-spacing: remove virAssertCmpInt exception
Ján Tomko [Tue, 14 Jun 2016 16:42:12 +0000 (18:42 +0200)]
check-spacing: remove virAssertCmpInt exception

The macro is now called testAssertEq and no longer
takes an operator as its argument.

8 years agocheck-spacing: simplify keyword spacing check
Ján Tomko [Tue, 14 Jun 2016 16:30:30 +0000 (18:30 +0200)]
check-spacing: simplify keyword spacing check

We do not need a separate check forbidding whitespace
after the opening parenthesis after a keyword -
we forbid it after all of them.

The only allowed whitespace after an opening parenthesis
is a newline, tune the regex to reflect that.

8 years agocheck-spacing: rewrite regex for checking the closing parenthesis
Ján Tomko [Tue, 14 Jun 2016 16:27:24 +0000 (18:27 +0200)]
check-spacing: rewrite regex for checking the closing parenthesis

Instead of matching multiple characters before the parenthesis,
only check for a single whitespace, which is much less cpu-intensive.

This only matches a few dozen of places where they are on an separate
line, filter out those with a separate regex.

8 years agocheck-spacing: rewrite whitespace check before (semi)colon
Ján Tomko [Tue, 14 Jun 2016 16:13:42 +0000 (18:13 +0200)]
check-spacing: rewrite whitespace check before (semi)colon

Instead of matching multiple characters, match any occurrence
preceded by a single whitespace and handle the exceptions
later.

8 years agoRename bracket-spacing.pl to check-spacing.pl
Ján Tomko [Wed, 15 Jun 2016 07:15:38 +0000 (09:15 +0200)]
Rename bracket-spacing.pl to check-spacing.pl

We test whitespace with lots of other characters now.

8 years agoRename virAssertCmpInt to testAssertEq
Ján Tomko [Wed, 15 Jun 2016 08:17:05 +0000 (10:17 +0200)]
Rename virAssertCmpInt to testAssertEq

Drop the op parameter, we only use equality.
Drop the vir prefix since it's only used in the tests.

8 years agomaint: remove whitespace from closing parentheses
Ján Tomko [Wed, 15 Jun 2016 07:43:29 +0000 (09:43 +0200)]
maint: remove whitespace from closing parentheses

To allow tightening syntax check.

8 years agovbox: reformat multi-line error reports
Ján Tomko [Tue, 14 Jun 2016 16:11:12 +0000 (18:11 +0200)]
vbox: reformat multi-line error reports

Put the comma on the first line.

8 years agocfg.mk: use a single regex for all non-reentrant functions
Ján Tomko [Tue, 14 Jun 2016 12:27:51 +0000 (14:27 +0200)]
cfg.mk: use a single regex for all non-reentrant functions

The prohibit_nonreentrant syntax-check rule spawns a new shell
for every non-reentrant function we know, to make it easier
to mention the function name in the error message, with the _r
appended.

Since the line with the offending function is already printed
and some of the functions on our list do not have a _r counterpart,
compile them into one big regex and use a more generic error message
to save time.

8 years agodocs: document rng backend path restrictions of older libvirt
Ján Tomko [Tue, 14 Jun 2016 07:41:09 +0000 (09:41 +0200)]
docs: document rng backend path restrictions of older libvirt

Commit 67f2b72 removed the path restrictions for rng backend,
along with the documentation of the restriction.

Restore the documentation for users still using older libvirt.

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

8 years agovirHostCPUGetInfo: Fix build on non-Unix like systems
Michal Privoznik [Tue, 14 Jun 2016 14:46:06 +0000 (16:46 +0200)]
virHostCPUGetInfo: Fix build on non-Unix like systems

This function is plenty of ifdefs providing implementations for
Linux, *BSD and OS-X. However, if we are being build for any
other architecture, all that's left behind by preprocessor is
just a error reporting call and return of -1. In that case,
passed arguments are unused:

../../src/util/virhostcpu.c: In function 'virHostCPUGetInfo':
../../src/util/virhostcpu.c:966:33: error: unused parameter 'cpus' [-Werror=unused-parameter]
                   unsigned int *cpus,
                                 ^~~~

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agodoc: Fix explanation of S3 and S4 states
Jingjing Shao [Wed, 15 Jun 2016 03:14:32 +0000 (11:14 +0800)]
doc: Fix explanation of S3 and S4 states

Explanation of S3 and S4 states was swapped.

8 years agoxlconfigtest: add test for USB config conversion
Chunyan Liu [Thu, 19 May 2016 08:14:36 +0000 (16:14 +0800)]
xlconfigtest: add test for USB config conversion

Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agoAdd conversion of domxml USB config to/from xl.cfg
Chunyan Liu [Thu, 19 May 2016 08:14:35 +0000 (16:14 +0800)]
Add conversion of domxml USB config to/from xl.cfg

xl.cfg:
usbdev = [ "hostbus=1,hostaddr=3" ]

usb.xml:
  <hostdev mode='subsystem' type='usb' managed='no'>
    <source>
      <address bus='1' device='3'/>
    </source>
  </hostdev>

Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agolibxl: support hotplug USB host device
Chunyan Liu [Thu, 19 May 2016 08:14:34 +0000 (16:14 +0800)]
libxl: support hotplug USB host device

Support hot attach/detach a USB host device to guest.
Currently libxl only supports xen PV guest, and only
supports specifying USB host device by 'bus number'
and 'device number', for example:

 usb.xml:
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <address bus='1' device='3'/>
      </source>
    </hostdev>
 #xl attach-device dom usb.xml
 #xl detach-device dom usb.xml

Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agolibxl: support creating guest with USB hostdev
Chunyan Liu [Thu, 19 May 2016 08:14:33 +0000 (16:14 +0800)]
libxl: support creating guest with USB hostdev

Support creating guest with USB host device in config file.
Currently libxl only supports xen PV guest, and only supports
specifying USB host device by 'bus number' and 'device number',
for example:

    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <address bus='1' device='3'/>
      </source>
    </hostdev>

Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agoqemu: Refactor qemuDomainAttachChrDevice error paths
John Ferlan [Mon, 13 Jun 2016 16:57:15 +0000 (12:57 -0400)]
qemu: Refactor qemuDomainAttachChrDevice error paths

Refactor the error paths for attaching char device (it's about to be
more complicated).

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agodocs: Clarify chardev protocol
John Ferlan [Thu, 9 Jun 2016 19:22:19 +0000 (15:22 -0400)]
docs: Clarify chardev protocol

Add a slight clarification to usage of "telnet", "telnets", or "tls" as
the protocol type value.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agocaps: Add capability for tls-x509-creds
John Ferlan [Tue, 7 Jun 2016 15:28:20 +0000 (11:28 -0400)]
caps: Add capability for tls-x509-creds

Add the capability flag and checks for the qemu object 'tls-creds-x509'

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agodocs: Fix syntax-check
John Ferlan [Tue, 14 Jun 2016 10:22:37 +0000 (06:22 -0400)]
docs: Fix syntax-check

Commit id '42ff399a' broke syntax-check by not encasing <dt> elements
in <code>xxx</code>

8 years agoFix renumbering once again
Martin Kletzander [Tue, 14 Jun 2016 10:06:13 +0000 (12:06 +0200)]
Fix renumbering once again

I screwed up by accidentally pushing incomplete version of the
renumbering commit.  This patch just fixes the rest so the tree matches
changes in v2.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoChange 1.3.6 occurrences to 2.0.0 to follow version bump
Martin Kletzander [Tue, 14 Jun 2016 09:15:18 +0000 (11:15 +0200)]
Change 1.3.6 occurrences to 2.0.0 to follow version bump

Version was bumped but documentation (and comments) didn't follow the
numbering.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: Allow ACPI shutdown only for running domains
Martin Kletzander [Mon, 13 Jun 2016 12:33:42 +0000 (14:33 +0200)]
qemu: Allow ACPI shutdown only for running domains

If the domain is not running, but for example the CPUs are stopped, the
ACPI event gets queued and resume of the domain will just shut it off.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: Obtain job before checking if domain is live
Martin Kletzander [Mon, 13 Jun 2016 12:17:39 +0000 (14:17 +0200)]
qemu: Obtain job before checking if domain is live

Since obtaining a job can wait for another job to finish, the state
might change in the meantime.  And checking it more than once is
pointless.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoBump release to 2.0.0 and document release schedule & versioning
Daniel P. Berrange [Mon, 13 Jun 2016 17:34:48 +0000 (18:34 +0100)]
Bump release to 2.0.0 and document release schedule & versioning

This bumps the release number of 2.0.0, to reflect the switch to
a new time based release versioning scheme. The downloads page
is updated to describe our policies for release schedules and
release version numbering

The stable release docs are changed to reflect the fact that
the stable version numbers are now just 3 digits long instead
of 4.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agocputest: Get rid of the array of test functions
Jiri Denemark [Wed, 8 Jun 2016 14:57:28 +0000 (16:57 +0200)]
cputest: Get rid of the array of test functions

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Add support for zero-detection writes
Martin Kletzander [Mon, 14 Dec 2015 08:35:20 +0000 (09:35 +0100)]
qemu: Add support for zero-detection writes

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoconf: Add support of zero-detection for disks
Martin Kletzander [Thu, 14 Apr 2016 20:32:54 +0000 (22:32 +0200)]
conf: Add support of zero-detection for disks

This option allows or disallows detection of zero-writes if it is set to
"on" or "off", respectively.  It can be also set to "unmap" in which
case it will try discarding that part of image based on the value of the
"discard" option.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoFix build without xen
Martin Kletzander [Tue, 14 Jun 2016 06:21:01 +0000 (08:21 +0200)]
Fix build without xen

Commit 11567cf66f36 introduced an include which will only work when
building with xen (particularly libxl).  However, that file is supposed
to be includable from anywhere (as with other testutils* files.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agovirt-host-validate: fix build with clang
Roman Bogorodskiy [Tue, 14 Jun 2016 05:02:45 +0000 (08:02 +0300)]
virt-host-validate: fix build with clang

Building with clang 3.8 triggers the following error:

  CC       virt_host_validate-virt-host-validate-qemu.o
virt-host-validate-qemu.c:36:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
    char *kvmhint = _("Check that CPU and firmware supports virtualization "
          ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
virt-host-validate-qemu.c:46:17: error: assigning to 'char *' from 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
        kvmhint = _("Check that the 'kvm-intel' or 'kvm-amd' modules are "
                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

Fix by using 'const' for kvmhint declaration.

8 years agolibxl: Add support for ovmf firmware
Jim Fehlig [Wed, 20 Apr 2016 21:14:35 +0000 (15:14 -0600)]
libxl: Add support for ovmf firmware

Populate libxl_domain_build_info struct with bios and firmware
info from virDomainLoaderDef.

Note: Currently libxl only allows specifying the type of BIOS.
For type LIBXL_BIOS_TYPE_OVMF, the firmware path is configured
when building Xen using '--with-system-ovmf='. If not specified,
LIBXL_FIRMWARE_DIR/ovmf.bin is used. In the future, Xen will
support a user-specified firmware path. See

http://lists.xenproject.org/archives/html/xen-devel/2016-03/msg01628.html

Once that work is merged into xen.git, the libvirt libxl driver
will be able to honor a user-specified path. In the meantime use
the implicit path, which is tolerable since it is advertised in
domcapabilities.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agoxenconfig: support bios=ovmf xl.cfg
Jim Fehlig [Wed, 20 Apr 2016 21:14:34 +0000 (15:14 -0600)]
xenconfig: support bios=ovmf xl.cfg

Add support to xenconfig for conversion of xl.cfg(5) bios config
to/from libvirt domXml <loader> config. SeaBIOS is the default
for HVM guests using upstream QEMU. ROMBIOS is the default when
using the old qemu-dm. This patch allows specifying OVMF as an
alternate firmware.

Example xl.cfg:
  bios = "ovmf"

Example domXML:
  <os>
    ...
    <loader readonly='yes' type='pflash'>/usr/lib/xen/boot/ovmf.bin</loader>
  </os>

Note that currently Xen does not support a separate nvram for
non-volatile variables.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agolibxl: implement connectGetDomainCapabilities
Jim Fehlig [Mon, 16 May 2016 21:21:59 +0000 (15:21 -0600)]
libxl: implement connectGetDomainCapabilities

Add domain capabilities for PV and HVM domains.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agolibxl: introduce libxl_capabilities.{ch}
Jim Fehlig [Fri, 4 Mar 2016 18:35:20 +0000 (11:35 -0700)]
libxl: introduce libxl_capabilities.{ch}

Move capabilities code out of libxl_conf.{ch} and into new
libxl_capabilities.{ch} files.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agolibxl: add default firmwares to driver config object
Jim Fehlig [Wed, 18 May 2016 14:24:37 +0000 (08:24 -0600)]
libxl: add default firmwares to driver config object

Prefer firmwares specified via --with-loader-nvram configure
option. If none are specified, use the Xen-provided default
firmwares found in LIBXL_FIRMWARE_DIR.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agodriver config: Introduce virFirmware object
Jim Fehlig [Tue, 17 May 2016 22:45:27 +0000 (16:45 -0600)]
driver config: Introduce virFirmware object

The virQEMUDriverConfig object contains lists of
loader:nvram pairs to advertise firmwares supported by
by the driver, and qemu_conf.c contains code to populate
the lists, all of which is useful for other drivers too.

To avoid code duplication, introduce a virFirmware object
to encapsulate firmware details and switch the qemu driver
to use it.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agolibxl: fix vm lock overwritten bug
Wang Yufei [Sun, 12 Jun 2016 10:30:00 +0000 (18:30 +0800)]
libxl: fix vm lock overwritten bug

In libxl driver we do virObjectRef in libxlDomainObjBeginJob,
If virCondWaitUntil failed, it goes to error, do virObjectUnref,
There's a chance that someone undefine the vm at the same time,
and refs unref to zero, vm is freed in libxlDomainObjBeginJob.
But the vm outside function is not Null, we do virObjectUnlock(vm).
That's how we overwrite the vm memory after it's freed. I fix it.

Signed-off-by: Wang Yufei <james.wangyufei@huawei.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirt-host-validate: improve tests for arm/aarch64
Riku Voipio [Fri, 3 Jun 2016 12:53:58 +0000 (15:53 +0300)]
virt-host-validate: improve tests for arm/aarch64

ARM/Aarch64 /proc/cpuinfo has no virtualization related flags.
Refactor the Qemu/KVM test a bit:

1) run the "for hardware virtualization" test only on plaforms with known
   cpuinfo flags (x86, s390)
2) test for /dev/kvm also on platforms where no cpu flags are set

Finally Add a more generic error hint message for non-x86 plaforms
when /dev/kvm is missing.

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agotests: fix CPUID detection tests compilation failure
Wei Liu [Mon, 13 Jun 2016 09:11:41 +0000 (10:11 +0100)]
tests: fix CPUID detection tests compilation failure

In 3704b9003 ("tests: Add CPU detection tests"), a macro called
DO_TEST_CPUID_JSON is added. But it took only two arguments when QEMU
or YAJL is not set.

Fix it by adding a third argument. Shouldn't have any effect because
that macro compiles to nothing.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
8 years agovirt-login-shell: mark as Linux only
Roman Bogorodskiy [Sun, 12 Jun 2016 09:05:57 +0000 (12:05 +0300)]
virt-login-shell: mark as Linux only

Currently, virt-login-shell is not allowed to build on Windows.
However, as it's designed around LXC, it does not make sense to
build it on anything but Linux, so make the check stricter and allow to
enable it on Linux only.

8 years agoapparmor: Don't scrub environment of virtlogd process
Guido Günther [Sat, 11 Jun 2016 19:22:00 +0000 (21:22 +0200)]
apparmor: Don't scrub environment of virtlogd process

otherwise we drop variables like XDG_RUNTIME_DIR with qemu:///session
and libvirtd faild to find virtlogd's socket.

8 years agobhyve: fix bhyvexml2arg test
Roman Bogorodskiy [Sun, 12 Jun 2016 08:01:50 +0000 (11:01 +0300)]
bhyve: fix bhyvexml2arg test

Don't use duplicating target dev names.

8 years agobhyve: add missing virhost(cpu|mem).h headers
Roman Bogorodskiy [Sun, 12 Jun 2016 07:56:11 +0000 (10:56 +0300)]
bhyve: add missing virhost(cpu|mem).h headers

8 years agohostcpu: fix build on FreeBSD
Roman Bogorodskiy [Sun, 12 Jun 2016 07:53:23 +0000 (10:53 +0300)]
hostcpu: fix build on FreeBSD

 * Fix misspelt function name:
    s/virHostCPUGetStatsFreebsd/virHostCPUGetStatsFreeBSD/
 * Mark the first argument to virHostCPUGetInfo with ATTRIBUTE_UNUSED
   as it's not actually used on non-Linux

8 years agonodeinfo: fix build on non-Linux
Roman Bogorodskiy [Sun, 12 Jun 2016 07:33:17 +0000 (10:33 +0300)]
nodeinfo: fix build on non-Linux

SYSFS_SYSTEM_PATH is only defined for Linux, however it's used outside
of #ifdef __linux__ code, e.g. as the first argument to
nodeCapsInitNUMAFake().

But as this argument's value is used on Linux only, it's safe to define
SYSFS_SYSTEM_PATH to "fake" to get things built on FreeBSD.

8 years agovz: fix crash when parsing unexpected disk configuration
Maxim Nestratov [Mon, 6 Jun 2016 15:54:23 +0000 (18:54 +0300)]
vz: fix crash when parsing unexpected disk configuration

As it turned out PrlVmDev_GetStackIndex can return negative values
without reporting an error, which is incorrect but nevertheless.
After that we feed this negative index to virIndexToDiskName,
which in turn returns NULL and we set it to virDomainDiskDef.dst.
Using virDiskNameToBusDeviceIndex with a virDomainDiskDef structure
which has NULL dst field crashes.
Fix this by returning an error in prlsdkGetDiskId in such cases.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: implementation of domainSetUserPassword callback
Mikhail Feoktistov [Fri, 27 May 2016 15:16:34 +0000 (11:16 -0400)]
vz: implementation of domainSetUserPassword callback

8 years agovz: return correct result for unimplemented ChangeState actions
Maxim Nestratov [Thu, 26 May 2016 09:15:21 +0000 (12:15 +0300)]
vz: return correct result for unimplemented ChangeState actions

Map PRL_ERR_UNIMPLEMENTED to VIR_ERR_OPERATION_INVALID

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: remove unused macro logPrlEventError
Maxim Nestratov [Thu, 26 May 2016 08:53:08 +0000 (11:53 +0300)]
vz: remove unused macro logPrlEventError

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: keep subscription to performance events thru domain lifetime
Nikolay Shirokovskiy [Fri, 3 Jun 2016 07:11:44 +0000 (10:11 +0300)]
vz: keep subscription to performance events thru domain lifetime

The approach of subscribing on first stat API call and then waiting
for receiving of performance event from sdk to process the call originates
in times when every vz libvirt connections spawns its own sdk connection.
Thus without this waiting virsh stat call would return empty stats. Now
with single sdk connection this scheme is unnecessary complicated.

This patch subscribes to performance events on first domain appearence
and unsubscribe on its removing.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: use consistent naming for different domain object in vz_driver.c
Nikolay Shirokovskiy [Fri, 3 Jun 2016 07:11:43 +0000 (10:11 +0300)]
vz: use consistent naming for different domain object in vz_driver.c

Naming scheme is next:

virDomainPtr domain;
virDomainObjPtr dom;

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>