]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
10 years agomaint: drop spurious semicolons
Eric Blake [Mon, 25 Aug 2014 22:26:56 +0000 (16:26 -0600)]
maint: drop spurious semicolons

I noticed a line 'int nparams = 0;;' in remote_dispatch.h, and
tracked down where it was generated.  While at it, I found a
couple of other double semicolons.  Additionally, I noticed that
commit df0b57a95 left a stale reference to the file name
remote_dispatch_bodies.h.

* src/conf/numatune_conf.c (virDomainNumatuneNodeParseXML): Drop
empty statement.
* tests/virdbustest.c (testMessageStruct, testMessageSimple):
Likewise.
* src/rpc/gendispatch.pl (remote_dispatch_bodies.h): Likewise, and
update stale comments.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agospec: drop anything older than Fedora 13
Eric Blake [Tue, 15 Jul 2014 22:36:00 +0000 (16:36 -0600)]
spec: drop anything older than Fedora 13

RHEL 5 is based on libvirt 0.8.2, as was Fedora 13.  RHEL 5 also
happens to be the oldest box that we actively support with a
buildbot, so it is time to clean up some crufty conditionals in
the spec file that no longer are necessary for modern Fedora.

Although it is probably okay to make further simplifications to
a newer minimum Fedora version, that can be done as a later patch.
This patch just focuses on cleaning any comparison of %{?fedora}
that will always be true or false once we assume a minimum of F13.

* libvirt.spec.in: Make with_audit default to on. Move other
conditionals to a single RHEL-5 block. Simplify any fedora
comparison older than 13.  Document our assumptions.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agodocs: fix bootmenu timeout description
Martin Kletzander [Mon, 25 Aug 2014 16:18:51 +0000 (18:18 +0200)]
docs: fix bootmenu timeout description

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agodaemon: Fix option -v missing info priority log
Zhou Yimin [Mon, 25 Aug 2014 12:18:01 +0000 (20:18 +0800)]
daemon: Fix option -v missing info priority log

Introduce by 63fbcc692.

When start libvirtd with commandline "/usr/sbin/libvirtd -d -l -v",
we expect verbose(info level) log if neither environment variable
nor config file about logging controls is set. But in fact we can't
get any info priority log in the default output file.

The log priority of default output is VIR_LOG_DEFAULT(VIR_LOG_WARN),
so the info log is filtered out.
To record info priority log we must parse option -v before setting the
default output.

After this patch, we get all verbose log in the default output file.

Signed-off-by: Zhou Yimin <zhouyimin@huawei.com>
10 years agoiotune: setting an invalid value now reports error
Erik Skultety [Mon, 25 Aug 2014 08:50:12 +0000 (10:50 +0200)]
iotune: setting an invalid value now reports error

When trying to set an invalid value into iotune element, standard
behavior was to not report any error, rather to reset all affected
subelements of the iotune element back to 0 which results in ignoring
those particular subelements by XML generator. Patch further
examines the return code of the virXPathULongLong function
and in case of an invalid non-integer value raises an error.
Fixed to preserve consistency with invalid value checking
of other elements.

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

10 years agoqemu: add support for splash-timeout
Martin Kletzander [Fri, 22 Aug 2014 12:13:37 +0000 (14:13 +0200)]
qemu: add support for splash-timeout

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: add capability probing for splash-timeout
Martin Kletzander [Fri, 22 Aug 2014 11:42:46 +0000 (13:42 +0200)]
qemu: add capability probing for splash-timeout

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agodocs, conf: add support for bootmenu timeout
Martin Kletzander [Fri, 22 Aug 2014 11:39:26 +0000 (13:39 +0200)]
docs, conf: add support for bootmenu timeout

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agofix mingw build
Pavel Hrdina [Mon, 25 Aug 2014 07:44:32 +0000 (09:44 +0200)]
fix mingw build

The commit "f5b4c141" introduced new "force" parameter
for "virFDStreamOpenFileInternal" but forget to update
one call of that function.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agostorage: zfs: implement download and upload
Roman Bogorodskiy [Fri, 15 Aug 2014 08:18:27 +0000 (12:18 +0400)]
storage: zfs: implement download and upload

Add an implementation of uploadVol and downloadVol using
virStorageBackendVolUploadLocal and virStorageBackendVolDownloadLocal
respectively.

10 years agofdstream: introduce virFDStreamOpenBlockDevice
Roman Bogorodskiy [Fri, 15 Aug 2014 08:11:35 +0000 (12:11 +0400)]
fdstream: introduce virFDStreamOpenBlockDevice

virStorageBackendVolDownloadLocal and virStorageBackendVolUploadLocal
use virFDStreamOpenFile function to work with the volume fd.

virFDStreamOpenFile calls virFDStreamOpenFileInternal that implements
handling of the non-blocking I/O. If a file is not a character device and
not a fifo, it uses libvirt_iohelper.

On FreeBSD, it doesn't work as expected because disk devices (including
ZFS volumes) are exposed as character devices, and ZFS volumes do not
support open(2) with O_NONBLOCK.

To overcome this, introduce a forceIOHelper flag to
virFDStreamOpenFileInternal that forces using libvirt_iohelper. And
introduce virFDStreamOpenBlockDevice that calls
virFDStreamOpenFileInternal with the forceIOHelper set to true.

10 years agofdstream: report error if virSetNonBlock fails
Roman Bogorodskiy [Fri, 15 Aug 2014 04:55:15 +0000 (08:55 +0400)]
fdstream: report error if virSetNonBlock fails

virFDStreamOpenInternal terminates if virSetNonBlock fails. As
virSetNonBlock uses gnulib's set_nonblocking_flag that sets errno,
call virReportSystemError() to let user know the reason of fail.

10 years agomaint: fix comment typo
Eric Blake [Sat, 23 Aug 2014 19:57:44 +0000 (13:57 -0600)]
maint: fix comment typo

* src/util/virbuffer.h: s/occured/occurred/

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoqemu: check for active domain after agent interaction
Eric Blake [Wed, 20 Aug 2014 21:29:44 +0000 (15:29 -0600)]
qemu: check for active domain after agent interaction

Commit b606bbb41 reminded me that any time we drop locks to run
back-to-back guest interaction commands, we have to check that
the guest didn't disappear in between the two commands.  A quick
audit found a couple of spots that were missing this check.

* src/qemu/qemu_driver.c (qemuDomainShutdownFlags)
(qemuDomainSetVcpusFlags): Check that domain is still up.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoxenconfig: Resolve Coverity RESOURCE_LEAK
John Ferlan [Fri, 22 Aug 2014 15:06:49 +0000 (11:06 -0400)]
xenconfig: Resolve Coverity RESOURCE_LEAK

Since '337a13628' - Coverity complains that 'net' is VIR_ALLOC()'d, but
on various 'cleanup' exit paths from the code there is no corresponding
cleanup.

10 years agovirnetsocket: Resolve Coverity RESOURCE_LEAK
John Ferlan [Fri, 22 Aug 2014 15:01:04 +0000 (11:01 -0400)]
virnetsocket: Resolve Coverity RESOURCE_LEAK

Since '1b807f92d' - Coverity complains that in the error paths of
both virFork() and virProcessWait() that the 'passfd' will not be closed.
Added the VIR_FORCE_CLOSE(passfd) and initialized it to -1.

Also noted that variable 'buf' was never really used - so I removed it

10 years agocommandtest: Resolve Coverity RESOURCE_LEAK
John Ferlan [Fri, 22 Aug 2014 14:30:44 +0000 (10:30 -0400)]
commandtest: Resolve Coverity RESOURCE_LEAK

Since '62f263a73' - Coverity complains if the !pidfile path is taken,
then newfd1 would be leaked.

10 years agonumatune: setting --mode does not work well
Erik Skultety [Fri, 22 Aug 2014 14:05:37 +0000 (16:05 +0200)]
numatune: setting --mode does not work well

When trying to set numatune mode directly using virsh numatune command,
correct error is raised, however numatune structure was not deallocated,
thus resulting in creating an empty numatune element in the guest XML,
if none was present before. Running the same command aftewards results
in a successful change with broken XML structure. Patch fixes the
deallocation problem as well as checking for invalid attribute
combination VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO + a nonempty nodeset.

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

10 years agoqemu: min_guarantee: Parameter 'min_guarantee' not supported
Erik Skultety [Wed, 13 Aug 2014 08:07:46 +0000 (10:07 +0200)]
qemu: min_guarantee: Parameter 'min_guarantee' not supported

The 'min_guarantee' is used by VMware ESX and OpenVZ drivers,
with qemu however, libvirt should report error when starting a domain,
because this element is not used.
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1122455

10 years agoformatdomain: Reformat vCPU description
John Ferlan [Thu, 21 Aug 2014 21:10:35 +0000 (17:10 -0400)]
formatdomain: Reformat vCPU description

Reformat the vCPU description to use list elements rather than one long
run-on paragraph

Signed-off-by: John Ferlan <jferlan@redhat.com>
10 years agoFix spacing around commas
Michal Privoznik [Fri, 22 Aug 2014 12:59:28 +0000 (14:59 +0200)]
Fix spacing around commas

On some places in the libvirt code we have:

  f(a,z)

instead of

  f(a, z)

This trivial patch fixes couple of such occurrences.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoParallels: Change config report errors code.
Alexander Burluka [Fri, 22 Aug 2014 11:04:45 +0000 (15:04 +0400)]
Parallels: Change config report errors code.

Wrong error code in config errors reporting was used. Fixed it.

10 years agoParallels: fix error with video card RAM dimension
Alexander Burluka [Fri, 22 Aug 2014 11:04:44 +0000 (15:04 +0400)]
Parallels: fix error with video card RAM dimension

Libvirt measures vram in Kbytes, not in bytes, so calculation
of Mbytes was incorrect. PCS server can take vram argument
with units, so I added K postfix to make params a little bit clearer.

10 years agoParallels: add virNodeGetCPUMap().
Alexander Burluka [Fri, 22 Aug 2014 11:04:43 +0000 (15:04 +0400)]
Parallels: add virNodeGetCPUMap().

That function caused errors in libvirtd logs when OpenStack Nova
starts VM instance.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agoutil: compare floor attribute in virNetDevBandwidthEqual
Martin Kletzander [Fri, 22 Aug 2014 10:02:12 +0000 (12:02 +0200)]
util: compare floor attribute in virNetDevBandwidthEqual

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agovirsh: Fix help info for freepages
Li Yang [Thu, 21 Aug 2014 03:19:53 +0000 (23:19 -0400)]
virsh: Fix help info for freepages

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
10 years agobuild: fix mingw build with virCommandReorderFDs
Martin Kletzander [Fri, 22 Aug 2014 08:28:17 +0000 (10:28 +0200)]
build: fix mingw build with virCommandReorderFDs

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agodaemon: use socket activation with systemd
Martin Kletzander [Wed, 23 Jul 2014 08:58:00 +0000 (10:58 +0200)]
daemon: use socket activation with systemd

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agorpc: pass listen FD to the daemon being started
Martin Kletzander [Wed, 16 Jul 2014 06:00:19 +0000 (08:00 +0200)]
rpc: pass listen FD to the daemon being started

This eliminates the need for active waiting.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoutil: add virCommandPassListenFDs() function
Martin Kletzander [Tue, 15 Jul 2014 15:07:02 +0000 (17:07 +0200)]
util: add virCommandPassListenFDs() function

That sets a new flag, but that flag does mean the child will get
LISTEN_FDS and LISTEN_PID environment variables properly set and
passed FDs reordered so that it corresponds with LISTEN_FDS (they must
start right after STDERR_FILENO).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agotests: support dynamic prefixes in commandtest
Martin Kletzander [Wed, 16 Jul 2014 14:19:28 +0000 (16:19 +0200)]
tests: support dynamic prefixes in commandtest

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agocfg.mk: allow integers to be assigned a value computed with i|j|k
Martin Kletzander [Wed, 16 Jul 2014 05:56:50 +0000 (07:56 +0200)]
cfg.mk: allow integers to be assigned a value computed with i|j|k

Even line like this:

int asdf = i - somevar;

was matched by the regex, so this patch adds '=' to the list of
characters that break the regexp.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agodaemon: support passing FDs from the calling process
Martin Kletzander [Tue, 15 Jul 2014 13:28:53 +0000 (15:28 +0200)]
daemon: support passing FDs from the calling process

First FD is the RW unix socket to listen on, second one (if
applicable) is the RO unix socket.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agorpc: set listen backlog on FDs as well as on other sockets
Martin Kletzander [Wed, 16 Jul 2014 17:26:16 +0000 (19:26 +0200)]
rpc: set listen backlog on FDs as well as on other sockets

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoremote: create virNetServerServiceNewFDOrUNIX() wrapper
Martin Kletzander [Tue, 15 Jul 2014 12:37:14 +0000 (14:37 +0200)]
remote: create virNetServerServiceNewFDOrUNIX() wrapper

It's just a wrapper around NewFD and NewUNIX that selects the right
option and increments the number of used FDs.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoutil: abstract parsing of passed FDs into virGetListenFDs()
Martin Kletzander [Tue, 15 Jul 2014 12:34:13 +0000 (14:34 +0200)]
util: abstract parsing of passed FDs into virGetListenFDs()

Since not only systemd can do this (we'll be doing it as well few
patches later), change 'systemd' to 'caller' and fix LISTEN_FDS to
LISTEN_PID where applicable.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoconf: net: Correctly switch how to format address fields
Peter Krempa [Thu, 21 Aug 2014 09:06:37 +0000 (11:06 +0200)]
conf: net: Correctly switch how to format address fields

When formatting the forward mode addresses or interfaces the switch was
done based on the type of the network rather than of the type of the
individual <interface>/<address> element. In case a user would specify
an incorrect network type ("passhtrough") with <address> elements,
libvirtd would crash as it would attempt to format an <interface>.

Use the type of the individual element to format the XML.

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

10 years agovirsh: man: Add LXC format info for domxml-from/to-native
Li Yang [Thu, 21 Aug 2014 06:12:45 +0000 (02:12 -0400)]
virsh: man: Add LXC format info for domxml-from/to-native

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
10 years agoPerform disk config validity checking for attach-device config
John Ferlan [Tue, 29 Jul 2014 13:21:05 +0000 (09:21 -0400)]
Perform disk config validity checking for attach-device config

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

Using 'virsh attach-device --config' (or --persistent) to attach a
file backed lun device will succeed; however, subsequent domain restarts
will result in failure because the configuration of a file backed lun
is not supported.

Although allowing 'illegal configurations' is something that can be
allowed, it may not be practical in this case. Generally, when attaching
a device to a domain means the domain must be running. A way around
this is using the --config (or --persistent) option. When an attach
is done to a running domain, a temporary configuration is modified
first followed by the live update. The live update will make a number
of disk validity checks when building the qemu command to attach the
disk. If any fail, then change is rejected.

Rather than allow a potentially illegal combination, adjust the code
in the configuration path to make the same checks as the running path
will make with respect to disk validity checks. This way we avoid
having the potential for some subsequent start/reboot to fail because
an illegal combination was allowed.

NB: The live path still checks the configuration since it is possible
to just do --live guest modification...

10 years agovirsh: Don't print extra '-'s in error message for -k and -K options
Peter Krempa [Thu, 21 Aug 2014 07:58:34 +0000 (09:58 +0200)]
virsh: Don't print extra '-'s in error message for -k and -K options

The error message contains one extra dash.

10 years agohvsupport: Adapt to vbox driver rewrite
Michal Privoznik [Wed, 20 Aug 2014 16:17:07 +0000 (18:17 +0200)]
hvsupport: Adapt to vbox driver rewrite

Since vbox driver rewrite the virDriver structure init moved from
vbox_tmpl.c into vbox_common.c. However, our hvsupport.pl script
doesn't count with that. It still parses vbox_tmp.c and looks for
virDriver structure which is not found there anymore. As a result,
at hvsupport page is seems like vbox driver doesn't support
anything.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agonodeCapsInitNUMA: Avoid @cpumap leak
Michal Privoznik [Wed, 20 Aug 2014 13:59:25 +0000 (15:59 +0200)]
nodeCapsInitNUMA: Avoid @cpumap leak

In case the host has 2 or more NUMA nodes, we fetch CPU map for each
node. However, we need to free the CPU map in between loops:

==29513== 96 (72 direct, 24 indirect) bytes in 3 blocks are definitely lost in loss record 951 of 1,264
==29513==    at 0x4C2A700: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==29513==    by 0x52AD24B: virAlloc (viralloc.c:144)
==29513==    by 0x52AF0E6: virBitmapNew (virbitmap.c:78)
==29513==    by 0x52FB720: virNumaGetNodeCPUs (virnuma.c:294)
==29513==    by 0x53C700B: nodeCapsInitNUMA (nodeinfo.c:1886)
==29513==    by 0x11759708: vboxCapsInit (vbox_common.c:398)
==29513==    by 0x11759CC4: vboxConnectOpen (vbox_common.c:514)
==29513==    by 0x53C965F: do_open (libvirt.c:1147)
==29513==    by 0x53C9EBC: virConnectOpen (libvirt.c:1317)
==29513==    by 0x142905: remoteDispatchConnectOpen (remote.c:1215)
==29513==    by 0x126ADF: remoteDispatchConnectOpenHelper (remote_dispatch.h:2346)
==29513==    by 0x5453D21: virNetServerProgramDispatchCall (virnetserverprogram.c:437)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoexamples: test: Kill unsupported maxMemory element
Peter Krempa [Mon, 11 Aug 2014 15:28:34 +0000 (17:28 +0200)]
examples: test: Kill unsupported maxMemory element

The "maxMemory" element was never supported by libvirt. Remove it from
the test XMLs. (Found while actually trying to add support for a
identically named element).

10 years agocleanup spaces between parentheses and braces
Martin Kletzander [Wed, 20 Aug 2014 11:00:30 +0000 (13:00 +0200)]
cleanup spaces between parentheses and braces

And add a syntax-check for '){$'.  It's not perfect, but better than
nothing.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: Issue rtc-reset-reinjection command after guest-set-time
Michal Privoznik [Wed, 13 Aug 2014 12:28:24 +0000 (14:28 +0200)]
qemu: Issue rtc-reset-reinjection command after guest-set-time

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

An advice appeared there on the qemu-devel list [1]. When a domain is
suspended and then resumed guest kernel is not aware of this. So we've
introduced virDomainSetTime API that resets the time within guest
using qemu-ga. On the other hand, qemu itself is trying to make RTC
beat faster to catch the difference. But if we don't tell qemu that
guest's time was reset via the other method, both mechanisms are
applied resulting in again wrong guest time. In order to avoid summing
both corrections we need to tell qemu that it should not use the RTC
injection if the guest time is set via guest agent.

1: http://www.mail-archive.com/qemu-devel@nongnu.org/msg236435.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoqemu: forbid negative blkio values
Martin Kletzander [Tue, 19 Aug 2014 12:54:30 +0000 (14:54 +0200)]
qemu: forbid negative blkio values

Partially resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1131306

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agolxc: forbid negative blkio values
Martin Kletzander [Tue, 19 Aug 2014 12:54:24 +0000 (14:54 +0200)]
lxc: forbid negative blkio values

Partially resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1131306

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: Fix build error introduced in 653137eb957a278b556c6226424aad5395a
Peter Krempa [Wed, 20 Aug 2014 09:52:33 +0000 (11:52 +0200)]
qemu: Fix build error introduced in 653137eb957a278b556c6226424aad5395a

The build failure is caused by a false positive of some static analysys
steps done by gcc (that don't happen on -O0).

10 years agoqemu: blkiotune: Avoid accessing non-existing disk configuration
Peter Krempa [Wed, 20 Aug 2014 08:49:49 +0000 (10:49 +0200)]
qemu: blkiotune: Avoid accessing non-existing disk configuration

When a user would try changing the persistent IO tuning settings for a
disk that was hotplugged to a vm in a transient way, the
qemuDomainSetBlockIoTune API would use the same index for both the
live and config disk array. The disk was missing from the config array
though causing a crash of libvirtd.

To fix the issue, determine the indexes separately.

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

10 years agoqemu: Label all TAP FDs
Michal Privoznik [Wed, 13 Aug 2014 14:08:03 +0000 (16:08 +0200)]
qemu: Label all TAP FDs

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

When starting up the domain the domain's NICs are allocated. As of
1f24f682 (v1.0.6) we are able to use multiqueue feature on virtio
NICs. It breaks network processing into multiple queues which can be
processed in parallel by different host CPUs. The queues are, however,
created by opening /dev/net/tun several times. Unfortunately, only the
first FD in the row is labelled so when turning the multiqueue feature
on in the guest, qemu will get AVC denial. Make sure we label all the
FDs needed.

Moreover, the default label of /dev/net/tun doesn't allow
attaching a queue:

    type=AVC msg=audit(1399622478.790:893): avc:  denied  { attach_queue }
    for  pid=7585 comm="qemu-kvm"
    scontext=system_u:system_r:svirt_t:s0:c638,c877
    tcontext=system_u:system_r:virtd_t:s0-s0:c0.c1023
    tclass=tun_socket

And as suggested by SELinux maintainers, the tun FD should be labeled
as svirt_t. Therefore, we don't need to adjust any range (as done
previously by Guannan in ae368ebf) rather set the seclabel of the
domain directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoqemu: hotplug: Sanitize shared device removal on media change
Peter Krempa [Fri, 8 Aug 2014 08:55:30 +0000 (10:55 +0200)]
qemu: hotplug: Sanitize shared device removal on media change

Instead of tediously copying of the disk source to remove it later
ensure that the media change function removes the old device after it
succeeds.

10 years agoqemu: conf: Split out code to retrieve hostdev key and reuse it
Peter Krempa [Thu, 7 Aug 2014 16:16:38 +0000 (18:16 +0200)]
qemu: conf: Split out code to retrieve hostdev key and reuse it

Both addition and removal of a shared hostdev share the code to generate
the hostdev key. Split it out into a separate function and refactor
them.

10 years agoqemu: conf: Split up qemuRemoveSharedDevice into per-device-type functions
Peter Krempa [Thu, 7 Aug 2014 13:20:40 +0000 (15:20 +0200)]
qemu: conf: Split up qemuRemoveSharedDevice into per-device-type functions

Removing a shared device needs special steps for disks and hostdevs.
Instead of having one function dealing this split the code into two
separate functions that can be used with better granularity.

10 years agoqemu: conf: Split up qemuAddSharedDevice into per-device-type functions
Peter Krempa [Thu, 7 Aug 2014 13:20:40 +0000 (15:20 +0200)]
qemu: conf: Split up qemuAddSharedDevice into per-device-type functions

Adding a shared device needs special steps for disks and hostdevs.
Instead of having one function dealing this split the code into two
separate functions that can be used with better granularity.

10 years agoqemu: conf: rename qemuCheckSharedDevice to qemuCheckSharedDisk
Peter Krempa [Thu, 7 Aug 2014 12:56:30 +0000 (14:56 +0200)]
qemu: conf: rename qemuCheckSharedDevice to qemuCheckSharedDisk

The qemuCheckSharedDevice function is operating only on disk devices.
Rename it and change the arguments to reflect that and refactor some
logic for more readability.

10 years agoqemu: shared: Split out shared device list remove code
Peter Krempa [Thu, 7 Aug 2014 15:55:12 +0000 (17:55 +0200)]
qemu: shared: Split out shared device list remove code

Split it out into a separate function and simplify the code. There's no
need to copy the entry to update it as the hash returns pointer to the
existing item.

Also remove the now unused qemuSharedDeviceEntryCopy function.

10 years agoqemu: shared: Split out insertion code to the shared device list
Peter Krempa [Wed, 6 Aug 2014 11:57:42 +0000 (13:57 +0200)]
qemu: shared: Split out insertion code to the shared device list

To allow reuse split the code into a separate function and refactor it.
To update an existing entry there's no need to copy it first, just
update it inplace.

10 years agoqemu: hotplug: Format proper source string for cdrom media change
Peter Krempa [Fri, 8 Aug 2014 08:16:32 +0000 (10:16 +0200)]
qemu: hotplug: Format proper source string for cdrom media change

Use the qemu source string formatter to format the source string
correctly for remote and other storage instead of passing source->path
blindly.

10 years agoqemu: hotplug: Change arguments for qemuDomainChangeEjectableMedia
Peter Krempa [Tue, 5 Aug 2014 11:43:57 +0000 (13:43 +0200)]
qemu: hotplug: Change arguments for qemuDomainChangeEjectableMedia

Pass the source of the changed media instead of a complete disk
definition.

Note that the @disk argument now contains what @olddisk would contain.
The new source is passed as a virStorageSource struct.

10 years agoqemu: hotplug: Add helper to initialize/teardown new disks for VMs
Peter Krempa [Tue, 5 Aug 2014 12:53:01 +0000 (14:53 +0200)]
qemu: hotplug: Add helper to initialize/teardown new disks for VMs

When we are changing media (or doing other hotplug operations) we need
to setup cgroups, locking and seclabels on the new disk. This is a
multi-step process where every piece can fail. To simplify dealing with
this introduce qemuDomainPrepareDisk that similarly to
qemuDomainPrepareDiskChainElement initializes/tears down  a whole new
disk to be used with the domain.

Additionally the function supports passing a different source struct for
media changes of cdroms that will be refactored later.

10 years agoqemu: hotplug: Untangle cleanup paths in qemuDomainChangeEjectableMedia
Peter Krempa [Tue, 5 Aug 2014 12:09:44 +0000 (14:09 +0200)]
qemu: hotplug: Untangle cleanup paths in qemuDomainChangeEjectableMedia

Avoid the "audit" label to simplify control flow.

10 years agoconf: Pass virStorageSource into virDomainDiskSourceIsBlockType
Peter Krempa [Fri, 1 Aug 2014 12:00:51 +0000 (14:00 +0200)]
conf: Pass virStorageSource into virDomainDiskSourceIsBlockType

All checks are based on the storage source, thus there's no need to pass
the complete disk def.

10 years agoqemu: Explicitly state that hotplugging cdroms and floppies doesn't work
Peter Krempa [Fri, 1 Aug 2014 09:22:16 +0000 (11:22 +0200)]
qemu: Explicitly state that hotplugging cdroms and floppies doesn't work

10 years agoconf: fix comment
Giuseppe Scrivano [Mon, 11 Aug 2014 12:52:49 +0000 (14:52 +0200)]
conf: fix comment

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoqemu_command: fix block indentation
Giuseppe Scrivano [Thu, 7 Aug 2014 11:45:34 +0000 (13:45 +0200)]
qemu_command: fix block indentation

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoconf, virDomainFSDefPtr: rename "path" argument to "target"
Giuseppe Scrivano [Thu, 7 Aug 2014 13:01:16 +0000 (15:01 +0200)]
conf, virDomainFSDefPtr: rename "path" argument to "target"

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agobhyve: add volumes support
Roman Bogorodskiy [Thu, 14 Aug 2014 16:15:57 +0000 (20:15 +0400)]
bhyve: add volumes support

Update bhyveBuildDiskArgStr to support volumes:

 - Make virBhyveProcessBuildBhyveCmd and
   virBhyveProcessBuildLoadCmd take virConnectPtr as the
   first argument instead of bhyveConnPtr as virConnectPtr is
   needed for virStorageTranslateDiskSourcePool,
 - Add virStorageTranslateDiskSourcePool call to
   virBhyveProcessBuildBhyveCmd and
   virBhyveProcessBuildLoadCmd,
 - Allow disks of type VIR_STORAGE_TYPE_VOLUME

10 years agostorage: make disk source pool translation generic
Roman Bogorodskiy [Thu, 14 Aug 2014 16:05:48 +0000 (20:05 +0400)]
storage: make disk source pool translation generic

Currently, qemu driver uses qemuTranslateDiskSourcePool()
to translate disk volume information. This function is
general enough and could be used for other drivers as well,
so move it to conf/domain_conf.c along with its helpers.

 - qemuTranslateDiskSourcePool: move to storage/storage_driver.c
   and rename to virStorageTranslateDiskSourcePool,
 - qemuAddISCSIPoolSourceHost: move to storage/storage_driver.c
   and rename to virStorageAddISCSIPoolSourceHost,
 - qemuTranslateDiskSourcePoolAuth: move to storage/storage_driver.c
   and rename to virStorageTranslateDiskSourcePoolAuth,
 - Update users of qemuTranslateDiskSourcePool to use a
   new name.

10 years agovirsh: Fix comment for net-undefine
Li Yang [Tue, 19 Aug 2014 02:59:51 +0000 (22:59 -0400)]
virsh: Fix comment for net-undefine

net-undefine doesn't only undefine an inactive network,
but also an active network(persistent), it just cannot
undefine a transient network.

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agodriver: Move virDrvNetworkGetDHCPLeases to the appropriate section
Peter Krempa [Mon, 18 Aug 2014 15:14:54 +0000 (17:14 +0200)]
driver: Move virDrvNetworkGetDHCPLeases to the appropriate section

The prototype was along with domain API prototypes instead of network
API ones.

10 years agoman: virsh: add missing auto-converge option for 'migrate'
Pradipta Kr. Banerjee [Tue, 19 Aug 2014 12:56:11 +0000 (18:26 +0530)]
man: virsh: add missing auto-converge option for 'migrate'

  * tools/virsh.pod (migrate): Add --auto-converge flag

Signed-off-by: Pradipta Kr. Banerjee <bpradip@in.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agoqemu: allow device block I/O tuning in session mode
Martin Kletzander [Fri, 15 Aug 2014 12:35:53 +0000 (14:35 +0200)]
qemu: allow device block I/O tuning in session mode

In commit 45ad1adb I added a nicer message for tunings that need
cgroups when unavailable (unprivileged), but I added this check for
I/O tuning of block devices, which doesn't need cgroups, because it is
done by QEMU, so let's fix that.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agodocs: nwfilter: add missing dscp attribute
Jianwei Hu [Thu, 7 Aug 2014 04:27:32 +0000 (12:27 +0800)]
docs: nwfilter: add missing dscp attribute

Added attribute dscp to below supported protocols table in nwfilter docs.
IPV4 (ip)
TCP/UDP/SCTP (tcp/udp/sctp)
ICMP (icmp)
IGMP,ESP,AH,UDPLITE,'ALL' (igmp,esp,ah,udplite,all)
TCP/UDP/SCTP over IPV6 (tcp-ipv6,udp-ipv6,sctp-ipv6)
ICMPV6 (icmpv6)
IGMP,ESP,AH,UDPLITE,'ALL' over IPv6 (igmp-ipv6,esp-ipv6,ah-ipv6,udplite-ipv6,all-ipv6)

Here is a simple example:
[root@localhost ~]# virsh nwfilter-dumpxml myself
<filter name='myself' chain='root'>
  <uuid>7192ef51-cd50-4f14-ad7b-fa5c69ea19e3</uuid>
  <rule action='accept' direction='in' priority='500'>
    <ip dscp='1'/>
  </rule>
  <rule action='accept' direction='in' priority='500'>
    <tcp dscp='1'/>
  </rule>
  <rule action='accept' direction='in' priority='500'>
    <tcp-ipv6 dscp='2'/>
  </rule>
  <rule action='accept' direction='in' priority='500'>
    <icmp dscp='55'/>
  </rule>
  <rule action='accept' direction='in' priority='500'>
    <icmpv6 dscp='55'/>
  </rule>
  <rule action='accept' direction='in' priority='500'>
    <udp dscp='3'/>
  </rule>
  <rule action='accept' direction='in' priority='500'>
    <udp-ipv6 dscp='4'/>
  </rule>
  <rule action='accept' direction='in' priority='500'>
    <udplite dscp='5'/>
  </rule>
  <rule action='accept' direction='in' priority='500'>
    <udplite-ipv6 dscp='6'/>
  </rule>
  <rule action='accept' direction='in' priority='500'>
    <esp dscp='7'/>
  </rule>
  <rule action='accept' direction='in' priority='500'>
    <esp-ipv6 dscp='8'/>
  </rule>
  <rule action='accept' direction='in' priority='500'>
    <ah dscp='9'/>
  </rule>
  <rule action='accept' direction='in' priority='500'>
    <ah-ipv6 dscp='10'/>
  </rule>
  <rule action='accept' direction='in' priority='500'>
    <sctp dscp='11'/>
  </rule>
  <rule action='accept' direction='in' priority='500'>
    <sctp-ipv6 dscp='55'/>
  </rule>
  <rule action='accept' direction='in' priority='500'>
    <igmp dscp='55'/>
  </rule>
  <rule action='accept' direction='in' priority='500'>
    <all-ipv6 dscp='55'/>
  </rule>
  <rule action='accept' direction='in' priority='500'>
    <all dscp='55'/>
  </rule>
</filter>

Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agocmdMigrate: move vshConnect before vshWatchJob
Chunyan Liu [Fri, 8 Aug 2014 08:44:36 +0000 (16:44 +0800)]
cmdMigrate: move vshConnect before vshWatchJob

A possible fix to issue:
http://www.redhat.com/archives/libvir-list/2014-August/thread.html#00227

While doing migration on KVM host, found problem sometimes:
VM is already running on the target host and disappears from source
host, but 'virsh migrate' command line hangs, cannot exit normally.
If pressing "ENTER" key, it will exit.

The code hangs at tools/virsh-domain.c: cmdMigrate
->vshWatchJob->poll():
poll() is trying to select pipe_fd, which is used to receive message
from doMigrate thread. In debugging, found that doMigrate finishes
and at the end it does call safewrite() to write the retval ('0' or
'1') to pipe_fd, and the write is completed. But cmdMigrate poll()
cannot get the event. If pressing "ENTER" key, poll() can get the
event and select pipe_fd, then command line can exit.

In current code, authentication thread which is called by vshConnect
will use stdin, and at the same time, in cmdMigrate main process,
poll() is listening to stdin, that probably affect poll() to get
pipe_fd event. Better to move authentication before vshWatchJob. With
this change, above problem does not exist.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
10 years agosrc/xenconfig: move common parsing/formatting to xen_common
Jim Fehlig [Sat, 16 Aug 2014 02:52:15 +0000 (20:52 -0600)]
src/xenconfig: move common parsing/formatting to xen_common

XM and XL config are very similar.  Disks are specified differently
in XL, but the old XM disk config is still supported by XL.  XL also
supports new config like spice that was never supported by XM.

This patch moves all the common parsing and formatting functions to
the new file xen_common.c and adapts the XM parser/formatter accordingly.
This restructuring paves way for introducing an XL parser/formatter in
the future.

While moving the code, fixup whitespace, comments, and style issues.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agosrc/xenconfig: wrap common formatting code
Kiarie Kahurani [Mon, 11 Aug 2014 21:21:35 +0000 (00:21 +0300)]
src/xenconfig: wrap common formatting code

Wrap formatting code common to xm and xl in xenFormatConfigCommon
and export it.

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agosrc/xenconfig: wrap common parsing code
Kiarie Kahurani [Mon, 11 Aug 2014 21:21:24 +0000 (00:21 +0300)]
src/xenconfig: wrap common parsing code

Wrap parsing code common to xm and xl in xenParseConfigCommon
and export it.

Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agoxen: rename xenxs to xenconfig
Jim Fehlig [Thu, 14 Aug 2014 18:43:32 +0000 (12:43 -0600)]
xen: rename xenxs to xenconfig

src/xenxs contains parsing/formating functions for the various xen
config formats, and is better named src/xenconfig.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
10 years agoqemu: process: Pin on per-vcpu basis instead of per-vcpupin element
Peter Krempa [Fri, 15 Aug 2014 14:41:47 +0000 (16:41 +0200)]
qemu: process: Pin on per-vcpu basis instead of per-vcpupin element

Pin existing vcpus rather than existing vcpu pinning infos. This
increases the complexity of the lookup, but avoids pinning cpus that are
not enabled actually.

10 years agoqemu: cpu: unplug: Remove vcpu pinning on cold cpu unplug
Peter Krempa [Fri, 15 Aug 2014 14:28:58 +0000 (16:28 +0200)]
qemu: cpu: unplug: Remove vcpu pinning on cold cpu unplug

Remove the pinning info when removing to CPU, otherwise when the VM will
be started our code will try to pin non-existing vcpus as the definition
wasn't updated.

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

10 years agoconf: Refactor virDomainVcpuPinDefParseXML
Peter Krempa [Thu, 14 Aug 2014 12:38:06 +0000 (14:38 +0200)]
conf: Refactor virDomainVcpuPinDefParseXML

Tidy up control flow, change boolean argument to use 'bool', improve
error message in case the function is used to parse emulator pinning
info and avoid a few temp variables that made no sense.

Also when the function is called to parse emulator pinning info, there's
no need to check the processor ID in that case.

10 years agoconf: cpupin: Remove useless checking of vcpupin element count
Peter Krempa [Thu, 14 Aug 2014 12:20:37 +0000 (14:20 +0200)]
conf: cpupin: Remove useless checking of vcpupin element count

The check doesn't make much sense as right below it the entries are
either checked for duplicity or ignored in some cases. Having this check
doesn't actually forbid passing invalid values.

10 years agoqemu: process: Remove unnecessary argument and rename function
Peter Krempa [Wed, 13 Aug 2014 16:08:07 +0000 (18:08 +0200)]
qemu: process: Remove unnecessary argument and rename function

We set just one affinity of the emulator and the virConnectPtr isn't
needed for that function.

10 years agovirsh: man: Crosslink "desc" and "metadata" sections
Peter Krempa [Mon, 18 Aug 2014 14:47:13 +0000 (16:47 +0200)]
virsh: man: Crosslink "desc" and "metadata" sections

Those two commands work with a single API so cross-link them.

10 years agoman: virsh: Add 'vcpu_period' and 'vcpu_quota' support info for LXC
Li Yang [Mon, 18 Aug 2014 08:29:33 +0000 (04:29 -0400)]
man: virsh: Add 'vcpu_period' and 'vcpu_quota' support info for LXC

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
10 years agoqemu: Redundant listen address entry in quest xml
Erik Skultety [Fri, 15 Aug 2014 11:50:59 +0000 (13:50 +0200)]
qemu: Redundant listen address entry in quest xml

When editing guest's XML (on QEMU), it was possible to add multiple
listen elements into graphics parent element. However QEMU does not
support listening on multiple addresses. Configuration is tested for
multiple 'listen address' and if positive, an error is raised.

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

10 years agodaemon: Fix driver registration ordering
Michal Privoznik [Fri, 15 Aug 2014 10:26:09 +0000 (12:26 +0200)]
daemon: Fix driver registration ordering

There are some stateless drivers which implement subdrivers
(typically vbox and its own network and storage subdrivers). However,
as of ba5f3c7c8ecc10 the vbox driver lives in the daemon, not the
client library. This means, in order for vbox (or any stateless domain
driver) to use its subdrivers, it must register before the general
drivers. Later, when the virConnectOpen function goes through the
subdrivers, stateless drivers are searched first. If the connection
request is aiming at stateless driver, it will be opened. Otherwise
the generic subdriver is opened.

The other change done in this commit is moving interface module load a
bit earlier to match the ordering in case libvirt is built without
driver modules.

Reported-by: Taowei Luo <uaedante@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoman: virsh: Add man page for "virsh metadata"
Peter Krempa [Fri, 15 Aug 2014 15:08:29 +0000 (17:08 +0200)]
man: virsh: Add man page for "virsh metadata"

Patch adding the command forgot to add the man page entry.

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

10 years agovbox: Introducing vboxCommonDriver
Taowei [Mon, 11 Aug 2014 10:07:09 +0000 (18:07 +0800)]
vbox: Introducing vboxCommonDriver

After this patch, we will have only one common domain driver.
So, the rewritten on domain driver is finished in this patch.

10 years agovbox: Add registerDomainEvent
Taowei [Mon, 11 Aug 2014 10:07:08 +0000 (18:07 +0800)]
vbox: Add registerDomainEvent

10 years agovbox: Rewrite vboxNode functions
Taowei [Mon, 11 Aug 2014 10:07:07 +0000 (18:07 +0800)]
vbox: Rewrite vboxNode functions

Four functions are rewrite in this patch, that is:
vboxNodeGetInfo
vboxNodeGetCellsFreeMemory
vboxNodeGetFreeMemory
vboxNodeGetFreePages
Since these functions has nothing to do with vbox,
it can be directly moved to vbox_common.c. So, I
merged these things into one patch.

10 years agovbox: Rewrite vboxConnectListAllDomains
Taowei [Mon, 11 Aug 2014 10:07:06 +0000 (18:07 +0800)]
vbox: Rewrite vboxConnectListAllDomains

10 years agovbox: Rewrite vboxDomainScreenshot
Taowei [Mon, 11 Aug 2014 10:07:05 +0000 (18:07 +0800)]
vbox: Rewrite vboxDomainScreenshot

10 years agovbox: Rewrite vboxDomainSnapshotDelete
Taowei [Mon, 11 Aug 2014 10:07:04 +0000 (18:07 +0800)]
vbox: Rewrite vboxDomainSnapshotDelete

10 years agovbox: Rewrite vboxDomainRevertToSnapshot
Taowei [Mon, 11 Aug 2014 10:07:03 +0000 (18:07 +0800)]
vbox: Rewrite vboxDomainRevertToSnapshot

10 years agovbox: Rewrite vboxDomainSnapshotHasMetadata
Taowei [Mon, 11 Aug 2014 10:07:02 +0000 (18:07 +0800)]
vbox: Rewrite vboxDomainSnapshotHasMetadata

10 years agovbox: Rewrite vboxDomainSnapshotIsCurrent
Taowei [Mon, 11 Aug 2014 10:07:01 +0000 (18:07 +0800)]
vbox: Rewrite vboxDomainSnapshotIsCurrent

10 years agovbox: Rewrite vboxDomainSnapshotCurrent
Taowei [Mon, 11 Aug 2014 10:07:00 +0000 (18:07 +0800)]
vbox: Rewrite vboxDomainSnapshotCurrent

10 years agovbox: Rewrite vboxDomainSnapshotGetParent
Taowei [Mon, 11 Aug 2014 10:06:59 +0000 (18:06 +0800)]
vbox: Rewrite vboxDomainSnapshotGetParent

10 years agovbox: Rewrite vboxDomainHasCurrentSnapshot
Taowei [Mon, 11 Aug 2014 10:06:58 +0000 (18:06 +0800)]
vbox: Rewrite vboxDomainHasCurrentSnapshot