]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
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>
8 years agodomain_conf: silence gcc warnings
Pavel Hrdina [Fri, 10 Jun 2016 17:09:29 +0000 (19:09 +0200)]
domain_conf: silence gcc warnings

../../src/conf/domain_conf.c:10949: error: declaration of 'socket'
shadows a global declaration [-Wshadow]

../../src/conf/domain_conf.c:24373: error: declaration of 'listen'
shadows a global declaration [-Wshadow]

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agovz: fixed build by including necessary headers
Maxim Nestratov [Fri, 10 Jun 2016 17:21:18 +0000 (20:21 +0300)]
vz: fixed build by including necessary headers

After eaf18f4c2 some functions changed their homes
Pushed under build breaking rule

8 years agoqemuMonitorJSONAttachCharDev: Teach spicevmc
Michal Privoznik [Wed, 8 Jun 2016 13:51:27 +0000 (15:51 +0200)]
qemuMonitorJSONAttachCharDev: Teach spicevmc

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

We have the code for attaching redirdevs for ages now.
Unfortunately, our monitor code that handles talking to the qemu
process was missing a little piece of code that actually enabled
the feature.

BTW: it really is called "type" on the monitor, even though it's
called "name" on the cmd line. Don't ask.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoExport virDomainRedirdevDefFree
Michal Privoznik [Thu, 9 Jun 2016 09:56:46 +0000 (11:56 +0200)]
Export virDomainRedirdevDefFree

In the 162efa1a commit the function was introduced, but the
commit forgot to update livirt_private.syms accordingly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirt-login-shell: add ability to join the container cgroups
Daniel P. Berrange [Wed, 13 Apr 2016 10:00:11 +0000 (11:00 +0100)]
virt-login-shell: add ability to join the container cgroups

Prior to joining the namespaces of the container, move the
process into the containers' cgroups, so that the shell that
is subsequently launched is under the container resource
constraints.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirt-login-shell: add ability to auto-detect shell from container
Daniel P. Berrange [Tue, 12 Apr 2016 16:01:39 +0000 (17:01 +0100)]
virt-login-shell: add ability to auto-detect shell from container

Currently the shell must be looked up from the config setting in
/etc/libvirt/virt-login-shell.conf. This is inflexible if there
are containers where different users need different shells. Add
add a new 'auto-shell' config parameter which instructs us to
query the containers' /etc/passwd for the shell to be exec'd.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirt-login-shell: fully reset container environment
Daniel P. Berrange [Tue, 12 Apr 2016 15:52:58 +0000 (16:52 +0100)]
virt-login-shell: fully reset container environment

The virt-login-shell environment will be initialized with
an arbitrary number of environment variables determined
by the SSH daemon and PAM configuration. Most of these are
not relevant inside the container, and at best they are
noise and at worst they'll break apps. For example if
XDG_RUNTIME_DIR is leaked to the container, it'll break
any apps using it, since  the directory it points to is
only visible to the host OS filesystem, not the container
FS.

Use clearenv() to blank out everything and then set known
good values for PATH, SHELL, USER, LOGNAME HOME and TERM.
Everything else is left up to the login shell to initialize.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirt-login-shell: avoid loosing error during cleanup
Daniel P. Berrange [Tue, 12 Apr 2016 15:48:19 +0000 (16:48 +0100)]
virt-login-shell: avoid loosing error during cleanup

The virDomainFree / virConnectClose methods will reset the
last error handle, so we must save the error during cleanup

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirt-login-shell: allow shell to be a simple string argument
Daniel P. Berrange [Tue, 12 Apr 2016 14:31:54 +0000 (15:31 +0100)]
virt-login-shell: allow shell to be a simple string argument

Currently the shell config file parameter must be a list
giving the shell path and args. Allow it to be a plain
string argument as well.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirt-login-shell: change way we request a login shell
Daniel P. Berrange [Tue, 12 Apr 2016 14:45:48 +0000 (15:45 +0100)]
virt-login-shell: change way we request a login shell

Currently we request a login shell by passing the -l argument
to the shell. This is either hardcoded, or required to be
specified by the user in the virt-login-shell.conf file.

The standard way for login programs to request a shell run
as a login shell is to modify the argv passed to execve()
so that argv[0] contains the relative shell filename
prefixed with a zero. eg instead of doing

  const char **shellargs = ["/bin/bash", "-l", NULL];
  execve(shellargs[0], shellargs, env);

We should be doing

  const char **shellargs = ["-bash", NULL];
  execve("/bin/bash", shellargs, env);

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirt-login-shell: honour the -c option to launch commands
Daniel P. Berrange [Tue, 12 Apr 2016 14:18:04 +0000 (15:18 +0100)]
virt-login-shell: honour the -c option to launch commands

The virt-login-shell program is supposed to look like a
regular shell to clients. Login services like sshd
expect the shell to accept a '-c cmdstring' argument to
specify a command to launch instead of presenting an
interactive prompt.

We can implement this by simply passing the '-c cmdstring'
data straight through to the real shell we use. This does
not open any security holes, since the command is not run
until we're inside the container namespaces. This allows
scp to work for users with virt-login-shell.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agovirsh: make lxc-enter-namespace also join the cgroups
Daniel P. Berrange [Thu, 14 Apr 2016 14:19:56 +0000 (15:19 +0100)]
virsh: make lxc-enter-namespace also join the cgroups

Extend the lxc-enter-namespace command so that it joins the
containers' cgroups before starting new namespaces. This
ensures that the commands run have the normal resource
limits applied

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agolibvirt-lxc: add virDomainLxcEnterCGroup API
Daniel P. Berrange [Thu, 14 Apr 2016 14:16:22 +0000 (15:16 +0100)]
libvirt-lxc: add virDomainLxcEnterCGroup API

Add the virDomainLxcEnterCGroup API to the libvirt-lxc.so
file. This method moves the calling process into the cgroups
associated with the container.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoutil: add function for looking up the user shell
Daniel P. Berrange [Tue, 12 Apr 2016 17:11:20 +0000 (18:11 +0100)]
util: add function for looking up the user shell

Add a virGetUserShell wrapper around virGetUserEnt, that
returns the shell field.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agonodeinfo: move host memory APIs out into virhostmem file
Daniel P. Berrange [Wed, 13 Apr 2016 17:53:02 +0000 (18:53 +0100)]
nodeinfo: move host memory APIs out into virhostmem file

Move all APIs with a virHostMEM name prefix out into new
util/virhostmem.h & util/virhostmem.c files

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agonodeinfo: move host CPU APIs out into virhostcpu.c file
Daniel P. Berrange [Wed, 13 Apr 2016 17:53:02 +0000 (18:53 +0100)]
nodeinfo: move host CPU APIs out into virhostcpu.c file

Move all APIs with a virHostCPU name prefix out into new
util/virhostcpu.h & util/virhostcpu.c files

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agonodeinfo: rename all CPU APIs to have a virHostCPU prefix
Daniel P. Berrange [Wed, 13 Apr 2016 17:16:16 +0000 (18:16 +0100)]
nodeinfo: rename all CPU APIs to have a virHostCPU prefix

In preparation for moving all the CPU related APIs out of
the nodeinfo file, give them a virHostCPU name prefix.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agonodeinfo: rename all memory APIs to have a virHostMem prefix
Daniel P. Berrange [Wed, 13 Apr 2016 17:16:16 +0000 (18:16 +0100)]
nodeinfo: rename all memory APIs to have a virHostMem prefix

In preparation for moving all the memory related APIs out of
the nodeinfo file, give them a virHostMem name prefix.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agonodeinfo: split CPU info retrieval out of nodeGetInfo
Daniel P. Berrange [Wed, 13 Apr 2016 16:45:22 +0000 (17:45 +0100)]
nodeinfo: split CPU info retrieval out of nodeGetInfo

Instead of having platform specific code in nodeGetInfo to
fetch CPU topology, split it all out into a new method
nodeGetCPUInfo.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agonodeinfo: remove FreeBSD specific code for getting memory
Daniel P. Berrange [Wed, 27 Apr 2016 15:30:21 +0000 (16:30 +0100)]
nodeinfo: remove FreeBSD specific code for getting memory

The GNULIB physmem module already provides support for
the FreeBSD platform, so there's no reason to re-implement
FreeBSD portability code in libvirt. If there are bugs in
the GNULIB code, we should fix GNULIB rather than workaround
it in libvirt.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agonodeinfo: make nodeGetInfo() call nodeGetMemory for memory size
Daniel P. Berrange [Wed, 13 Apr 2016 16:28:10 +0000 (17:28 +0100)]
nodeinfo: make nodeGetInfo() call nodeGetMemory for memory size

The nodeGetInfo() method currently has its own code for getting
memory size in KB, that basically just re-invents what nodeGetMemory
already does. Remove it and just call nodeGetMemory, converting its
result from bytes to KB, allowing removal of more platform specific
conditional code.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agonodeinfo: remove sysfs_prefix from all methods
Daniel P. Berrange [Wed, 13 Apr 2016 14:28:55 +0000 (15:28 +0100)]
nodeinfo: remove sysfs_prefix from all methods

Nearly all the methods in the nodeinfo file are given a
'const char *sysfs_prefix' parameter to override the
default sysfs path (/sys/devices/system). Every single
caller passes in NULL for this, except one use in the
unit tests. Furthermore this parameter is totally
Linux-specific, when the APIs are intended to be cross
platform portable.

This removes the sysfs_prefix parameter and instead gives
a new method linuxNodeInfoSetSysFSSystemPath for use by
the test suite.

For two of the methods this hardcodes use of the constant
SYSFS_SYSTEM_PATH, since the test suite does not need to
override the path for thos methods.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoqemu: Yet another check for blkdeviotune values
Martin Kletzander [Tue, 7 Jun 2016 13:24:13 +0000 (15:24 +0200)]
qemu: Yet another check for blkdeviotune values

If you want to set block device I/O tuning values that end with '_max'
and there is nothing else set, libvirt emits an error.  In particular:

  error: internal error: Unexpected error

That's an unknown error.  That is because *_max values depend on their
respective non-_max values.  QEMU even says that in the error message
sent as a response to the monitor command:

  "error": {"class": "GenericError", "desc": "bps_max/iops_max require
  corresponding bps/iops values"}

the problem was that we didn't know that and there was no check for it.
Adding such check makes sure that there will be less confused users.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agovnc: add support for listen type none
Pavel Hrdina [Wed, 8 Jun 2016 13:15:54 +0000 (15:15 +0200)]
vnc: add support for listen type none

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agospice: introduce listen type none
Pavel Hrdina [Wed, 18 May 2016 06:33:28 +0000 (08:33 +0200)]
spice: introduce listen type none

This new listen type is currently supported only by spice graphics.
It's introduced to make it easier and clearer specify to not listen
anywhere in order to start a guest with OpenGL support.

The old way to do this was set spice graphics autoport='no' and don't
specify any ports.  The new way is to use <listen type='none'/>.  In
order to be able to migrate to old libvirt the migratable XML will be
generated without the listen element and with autoport='no'.  Also the
old configuration will be automatically converted to the this listen
type.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agospice: introduce spice_auto_unix_socket config option
Pavel Hrdina [Wed, 18 May 2016 12:11:20 +0000 (14:11 +0200)]
spice: introduce spice_auto_unix_socket config option

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agospice: add support for listen type socket
Pavel Hrdina [Wed, 8 Jun 2016 13:18:59 +0000 (15:18 +0200)]
spice: add support for listen type socket

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

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