]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
9 years agoqemu: Introduce qemuBuildPMCommandLine
John Ferlan [Thu, 18 Feb 2016 13:06:17 +0000 (08:06 -0500)]
qemu: Introduce qemuBuildPMCommandLine

Add new function to manage adding the power management options to the
command line removing that task from the mainline qemuBuildCommandLine.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: Introduce qemuBuildClockCommandLine
John Ferlan [Thu, 18 Feb 2016 11:42:45 +0000 (06:42 -0500)]
qemu: Introduce qemuBuildClockCommandLine

Add new function to manage adding the '-clock' options to the command
line removing that task from the mainline qemuBuildCommandLine.

Also includes some minor formatting cleanups.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: enable debug threads
Marc-André Lureau [Thu, 10 Mar 2016 19:46:39 +0000 (20:46 +0100)]
qemu: enable debug threads

When debug-threads is enabled, individual threads are given a separate
name (on Linux)

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

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: check for debug-threads capability
Marc-André Lureau [Thu, 10 Mar 2016 19:46:38 +0000 (20:46 +0100)]
qemu: check for debug-threads capability

QEMU (somewhere around 2.0) added a new sub-option to the -name flag
-name debug-threads=on.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agolibxl_conf: reuse virDomainNetGetActualtype in libxlMakeNicList
Chunyan Liu [Thu, 10 Mar 2016 02:50:41 +0000 (10:50 +0800)]
libxl_conf: reuse virDomainNetGetActualtype in libxlMakeNicList

Reuse existing helper function virDomainNetGetActualtype.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agoqemuxml2argvtest: Fix monitor path in serial-file-log
Jiri Denemark [Thu, 10 Mar 2016 17:54:59 +0000 (18:54 +0100)]
qemuxml2argvtest: Fix monitor path in serial-file-log

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agodocs: generic.css: Indentation and spacing tweaks
Cole Robinson [Thu, 10 Mar 2016 01:57:59 +0000 (20:57 -0500)]
docs: generic.css: Indentation and spacing tweaks

- Add line-height:150% spacing for all text. This makes text lines far
  less cramped, and seems closer visually to what wikipedia uses.

- Remove bottom and top margin from lists: entries seemed needlessly
  spread out.

- Reduce sublist indentation a bit

- Add a bottom border after headings: IMO this greatly helps in break
  up the vertical flow of a big page of text. Doesn't look great on the
  front page, but helps a lot on dense pages like formatdomain

9 years agodocs: generic.css: font size tweaks
Cole Robinson [Thu, 10 Mar 2016 01:53:58 +0000 (20:53 -0500)]
docs: generic.css: font size tweaks

- change font-family to just 'sans-serif' rather than hardcode a few
  font families. this means we abide the user's browser font setting,
  and makes us consistent with other sites like en.wikipedia.org
- raise font-size to 90%. this is what en.wikipedia.org uses.

With these two tweaks, libvirt.org text renders the same as
en.wikipedia.org with fedora firefox out of the box config. Previously
the font on libvirt.org was very small and difficult to read.

9 years agodocs: generic.css: minor cleanups
Cole Robinson [Thu, 10 Mar 2016 01:42:26 +0000 (20:42 -0500)]
docs: generic.css: minor cleanups

- Drop some redundant bits
- Use consistent spacing
- Group similar blocks near each other

There should be no functional change

9 years agodocs: website: Remove the et.redhat.com footer
Cole Robinson [Thu, 10 Mar 2016 01:35:37 +0000 (20:35 -0500)]
docs: website: Remove the et.redhat.com footer

This is long since obsolete, just scrap it all

9 years agoqemu: support use of virtlogd with file based chardevs
Daniel P. Berrange [Tue, 23 Feb 2016 13:41:57 +0000 (13:41 +0000)]
qemu: support use of virtlogd with file based chardevs

Currently the file based character devices let QEMU write
directly to a file on disk. This allows a malicious QEMU
to inflict a denial of service by consuming all free space.

Switch QEMU to use a pipe to virtlogd, which will enforce
file rollover.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agoqemu: use virtlogd for character device log files
Daniel P. Berrange [Tue, 23 Feb 2016 13:05:09 +0000 (13:05 +0000)]
qemu: use virtlogd for character device log files

If use of virtlogd is enabled, then use it for backing the
character device log files too. This avoids the possibility
of a guest denial of service by writing too much data to
the log file.

9 years agologging: support truncation of logfiles when opening
Daniel P. Berrange [Mon, 29 Feb 2016 12:26:02 +0000 (12:26 +0000)]
logging: support truncation of logfiles when opening

The virtlogd daemon currently opens all files for append, but
in some cases the user may wish to discard existing data. Define
a new flag to indicate that logfiles should be truncated when
opening.

9 years agoqemu: move functions for handling FD passing
Daniel P. Berrange [Mon, 29 Feb 2016 12:24:40 +0000 (12:24 +0000)]
qemu: move functions for handling FD passing

The functions for handling FD passing when building command line
arguments need to be used by many different bits of code, so need
to be at the start of the source file

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agoqemu: don't append -chardev arg until after value is formatted
Daniel P. Berrange [Mon, 29 Feb 2016 12:21:14 +0000 (12:21 +0000)]
qemu: don't append -chardev arg until after value is formatted

The act of formatting a chardev backend value may need to
append command line arguments for passing FDs. If we append
the -chardev arg before formatting the value, then the
resulting arguments will end up interspersed

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agoqemu: add support for logging chardev output to a file
Daniel P. Berrange [Tue, 23 Feb 2016 11:56:34 +0000 (11:56 +0000)]
qemu: add support for logging chardev output to a file

Honour the <log file='...'/> element in chardevs to output
data to a file. This requires QEMU >= 2.6

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agoconf: allow use of a logfile with chardev backends
Daniel P. Berrange [Fri, 11 Dec 2015 16:58:13 +0000 (16:58 +0000)]
conf: allow use of a logfile with chardev backends

Extend the chardev source XML so that there is a new optional
<log/> element, which is applicable to all character device
backend types. For example, to log output of a TCP backed
serial port

    <serial type='tcp'>
      <source mode='connect' host='127.0.0.1' service='9999'/>
      <protocol type='raw'/>
      <log file='/var/log/libvirt/qemu/demo-serial0.log' append='on'/>
      <target port='0'/>
    </serial>

Not all hypervisors will support use of logfiles.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agologging: allow inode/offset params to be NULL
Daniel P. Berrange [Fri, 11 Dec 2015 10:58:29 +0000 (10:58 +0000)]
logging: allow inode/offset params to be NULL

Not all callers of virLogManagerDomainOpenLogFile will
care about getting the current inode/offset, so we should
allow those parameters to be NULL

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agoqemu: cpu: Don't remove pinning of cold-unplugged cpu
Peter Krempa [Thu, 10 Mar 2016 08:37:08 +0000 (09:37 +0100)]
qemu: cpu: Don't remove pinning of cold-unplugged cpu

After adding support for offline vcpu pinning the code that removes the
pinning for cpu cold-unplug was forgotten. This fixes up commit 02ae21d

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

9 years agoqemu: Fix memory leak in qemuGetSchedInfo
Peter Krempa [Thu, 10 Mar 2016 08:57:13 +0000 (09:57 +0100)]
qemu: Fix memory leak in qemuGetSchedInfo

Memory returned from virStringSplit shall be freed with
virStringFreeList rather than VIR_FREE. Introduced in commit 511e7c5b.

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

9 years agoconf: Fix off-by-one in virDomainDefGetVcpu
Peter Krempa [Thu, 10 Mar 2016 08:46:53 +0000 (09:46 +0100)]
conf: Fix off-by-one in virDomainDefGetVcpu

Cpus are indexed starting from '0' so the check was invalid.

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

9 years agoqemu: Refactor bitmap handling in qemuDomainPinVcpuFlags
Peter Krempa [Tue, 23 Feb 2016 18:15:01 +0000 (19:15 +0100)]
qemu: Refactor bitmap handling in qemuDomainPinVcpuFlags

Now that the function was extracted we can get rid of some temp
variables. Additionally formatting of the bitmap string for the event
code should be checked.

9 years agoqemu: vcpupin: Extract live vcpupin setting into a separate function
Peter Krempa [Tue, 23 Feb 2016 12:41:43 +0000 (13:41 +0100)]
qemu: vcpupin: Extract live vcpupin setting into a separate function

The function was now beyond maintainability.

9 years agoutil: virfile: Only setuid for virFileRemove if on NFS
Cole Robinson [Wed, 9 Mar 2016 17:20:37 +0000 (12:20 -0500)]
util: virfile: Only setuid for virFileRemove if on NFS

NFS with root-squash is the only reason we need to do setuid/setgid
crazyness in virFileRemove, so limit that behavior to the NFS case.

9 years agoutil: virfile: Clarify setuid usage for virFileRemove
Cole Robinson [Wed, 9 Mar 2016 15:53:54 +0000 (10:53 -0500)]
util: virfile: Clarify setuid usage for virFileRemove

Break these checks out into their own function, and clearly document
each one. This shouldn't change behavior

9 years agoqemu: add support for offline vcpupin
Peter Krempa [Fri, 12 Feb 2016 13:57:45 +0000 (14:57 +0100)]
qemu: add support for offline vcpupin

Allow pinning for inactive vcpus. The pinning mask will be automatically
applied as we would apply the default mask in case of a cpu hotplug.

Setting the scheduler settings for a vcpu has the same semantics.

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

9 years agoconf: extract ignoring of inactive vcpu pinning information
Peter Krempa [Tue, 23 Feb 2016 11:35:40 +0000 (12:35 +0100)]
conf: extract ignoring of inactive vcpu pinning information

Introduce VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN domain feature flag
whcih will allow to skip ignoring of the pinning information for
hypervisor drivers which will want to implement forward-pinning of
vcpus.

9 years agoconf: refactor checking for unsupported memory devices
Peter Krempa [Tue, 23 Feb 2016 09:58:10 +0000 (10:58 +0100)]
conf: refactor checking for unsupported memory devices

Introduce a helper to check supported device and domain config and move
the memory hotplug checks to it.

The advantage of this approach is that by default all new features are
considered unsupported by all hypervisors unless specifically changed
rather than the previous approach where every hypervisor would need to
declare that a given feature is unsupported.

9 years agoconf: introduce parser feature flags
Peter Krempa [Tue, 23 Feb 2016 09:32:19 +0000 (10:32 +0100)]
conf: introduce parser feature flags

To avoid having to forbid new features added to domain XML in post parse
callbacks for individual hypervisor drivers the feature flag mechanism
will allow to add a central check that will be disabled for the drivers
that will add support.

As a first example flag, the 'hasWideSCSIBus' is converted to the new
bitmap.

9 years agoqemu: Report pinning for all vCPUs in qemuDomainGetVcpuPinInfo
Peter Krempa [Fri, 12 Feb 2016 13:57:41 +0000 (14:57 +0100)]
qemu: Report pinning for all vCPUs in qemuDomainGetVcpuPinInfo

The API documentation states that the function is returning pinning for
all vCPUs, so we can actually do so if the user passes a large enough
array.

9 years agoconf: Extract code filling data for virDomainGetVcpuPinInfo
Peter Krempa [Mon, 22 Feb 2016 14:29:25 +0000 (15:29 +0100)]
conf: Extract code filling data for virDomainGetVcpuPinInfo

The implementation of the inner guts of the function is similar for all
drivers, so we can add a helper and not have to reimplement it three
times.

9 years agovirsh: vcpupin: Ask for pinning info for all vCPUs
Peter Krempa [Wed, 17 Feb 2016 14:53:42 +0000 (15:53 +0100)]
virsh: vcpupin: Ask for pinning info for all vCPUs

The API docs state that the API queries pinning info for all vCPUs and
thus we should allocate the bitmap even for the inactive ones.

The API will currently return bitmap only for the active vCPUs but that
will change in the future.

9 years agoqemu: Add support for job completed event
Jiri Denemark [Wed, 17 Feb 2016 23:12:33 +0000 (00:12 +0100)]
qemu: Add support for job completed event

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoIntroduce job completed event
Jiri Denemark [Wed, 17 Feb 2016 20:20:11 +0000 (21:20 +0100)]
Introduce job completed event

The VIR_DOMAIN_EVENT_ID_JOB_COMPLETED event will be triggered once a job
(such as migration) finishes and it will contain statistics for the job
as one would get by calling virDomainGetJobStats. Thanks to this event
it is now possible to get statistics of a completed migration of a
transient domain on the source host.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Do not report completed stats until the job finishes
Jiri Denemark [Tue, 23 Feb 2016 11:40:47 +0000 (12:40 +0100)]
qemu: Do not report completed stats until the job finishes

We would happily report and free statistics of a completed migration
even before it actually completed (on the source host while migration is
in the Finish phase).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Fix a race when computing migration downtime
Jiri Denemark [Tue, 23 Feb 2016 09:47:01 +0000 (10:47 +0100)]
qemu: Fix a race when computing migration downtime

Computing a total downtime during a migration requires us to store a
time stamp when guest CPUs get stopped. The value (and all other
statistics) is then transferred to the destination to compute the
downtime. Because the stopped time stamp is stored by a STOP event
handler while the statistics which will be sent over to the destination
are copied synchronously within qemuMigrationWaitForCompletion.

Depending on the timing of STOP and MIGRATION events, we may end up
copying (and transferring) statistics without the stopped time stamp
set. Let's make sure we always use the correct time stamp.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Don't explicitly stop CPUs after migration
Jiri Denemark [Tue, 5 Jan 2016 21:19:28 +0000 (22:19 +0100)]
qemu: Don't explicitly stop CPUs after migration

With a very old QEMU which doesn't support events we need to explicitly
call qemuMigrationSetOffline at the end of migration to update our
internal state. On the other hand, if we talk to QEMU using QMP, we
should just wait for the STOP event and let the event handler update the
state and trigger a libvirt event.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Properly update completed migration stats
Jiri Denemark [Thu, 18 Feb 2016 13:44:48 +0000 (14:44 +0100)]
qemu: Properly update completed migration stats

We should not overwrite all migration statistics on the source with the
numbers sent by the destination since the source may have an updated
view in some cases (such as post-copy migration). It's safer to update
just the timing info we need to get from the destination and be prepared
for the future. And we should only do all this after a successful
migration.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Store completed stats at the very end of migration
Jiri Denemark [Thu, 18 Feb 2016 13:02:15 +0000 (14:02 +0100)]
qemu: Store completed stats at the very end of migration

Statistics for a completed migration only make sense if the migration
was successful. Let's not store them in priv->job.completed until we
are sure it was a success.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agohostdev: Remove explicit NULL checks
Andrea Bolognani [Thu, 25 Feb 2016 13:50:54 +0000 (14:50 +0100)]
hostdev: Remove explicit NULL checks

NULL checks are performed implicitly in the rest of the module,
including other allocations in the very same function.

9 years agohostdev: Fix indentation
Andrea Bolognani [Wed, 24 Feb 2016 12:44:09 +0000 (13:44 +0100)]
hostdev: Fix indentation

9 years agohostdev: Remove inaccurate comment
Andrea Bolognani [Mon, 7 Mar 2016 13:14:54 +0000 (14:14 +0100)]
hostdev: Remove inaccurate comment

The comment claimed that virPCIDeviceReattach() does not reattach
a device to the host driver; except it actually does, so the
comment is just confusing and we're better off removing it.

9 years agohostdev: Make comments easier to change later
Andrea Bolognani [Mon, 22 Feb 2016 14:02:23 +0000 (15:02 +0100)]
hostdev: Make comments easier to change later

Replace the term "loop" with the more generic "step". This allows us
to be more flexible and eg. have a step that consists in a single
function call.

Don't include the number of steps in the first comment of the
function, so that we can add or remove steps without having to worry
about keeping that comment in sync.

For the same reason, remove the summary contained in that comment.

Clean up some weird vertical spacing while we're at it.

9 years agotests: hostdev: Group test cases
Andrea Bolognani [Thu, 3 Mar 2016 15:13:04 +0000 (16:13 +0100)]
tests: hostdev: Group test cases

Instead of considering each single step its own test case, create
high level test cases that reproduce a certain scenario.

9 years agotests: hostdev: Add more checks on list size
Andrea Bolognani [Wed, 2 Mar 2016 14:33:18 +0000 (15:33 +0100)]
tests: hostdev: Add more checks on list size

Always call CHECK_LIST_COUNT() to check the size of both the active
and inactive devices list.

9 years agotests: hostdev: Use size_t for count variables
Andrea Bolognani [Wed, 2 Mar 2016 14:27:06 +0000 (15:27 +0100)]
tests: hostdev: Use size_t for count variables

virPCIDeviceListCount()'s return type is size_t, so variables that
store its return value should be of that type.

9 years agotests: hostdev: Move variable declaration inside CHECK_LIST_COUNT()
Andrea Bolognani [Wed, 2 Mar 2016 14:23:51 +0000 (15:23 +0100)]
tests: hostdev: Move variable declaration inside CHECK_LIST_COUNT()

The 'actualCount' variable, formerly just 'count', is only used
internally by the macro, so it's better to move its declaration
inside the macro as well: this way, it doesn't have to be declared
by every single user.

The new name is less generic to make clashes less likely.

9 years agotests: hostdev: Use better variable names
Andrea Bolognani [Wed, 2 Mar 2016 14:15:07 +0000 (15:15 +0100)]
tests: hostdev: Use better variable names

Change the extremely generic count1 and count2 to the more
descriptive active_count and inactive_count.

9 years agotests: hostdev: Remove magic numbers
Andrea Bolognani [Wed, 2 Mar 2016 12:17:08 +0000 (13:17 +0100)]
tests: hostdev: Remove magic numbers

When checking the number of devices added to a device list, use the
nhostdevs variable instead of its value, so that the test can keep
working even if more hostdevs are added.

9 years ago_virtualboxCreateMachine: Avoid unbounded stack
Michal Privoznik [Sat, 5 Mar 2016 11:59:45 +0000 (12:59 +0100)]
_virtualboxCreateMachine: Avoid unbounded stack

If the stars are in the right position and you're building with
VBox >= 4.2.0 it will happen that compiler thinks an array
allocated on the stack may be unbounded:

In file included from vbox/vbox_V4_2.c:13:0:
vbox/vbox_tmpl.c: In function '_virtualboxCreateMachine':
vbox/vbox_tmpl.c:2811:1: error: stack usage might be unbounded [-Werror=stack-usage=]
 _virtualboxCreateMachine(vboxGlobalData *data, virDomainDefPtr def, IMachine **machine, char *uuidstr ATTRIBUTE_UNUSED)
 ^

Well, given how the variable is declared, I had some hard time
seeing it is actually bounded. Surprisingly compiler does not
complain because of -Wframe-larger-than. This is because
variable length arrays do not count into that warning.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoAdd secretObjFromSecret
John Ferlan [Mon, 29 Feb 2016 22:15:26 +0000 (17:15 -0500)]
Add secretObjFromSecret

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agolocking: Use bit shift for flag values not constant values.
John Ferlan [Fri, 4 Mar 2016 14:35:19 +0000 (09:35 -0500)]
locking: Use bit shift for flag values not constant values.

So far it hasn't bitten us, but if the next value wasn't 4, then
the logic used to check flag bits would have issues.

9 years agoFix minor typos
Yuri Chornoivan [Mon, 7 Mar 2016 13:24:51 +0000 (15:24 +0200)]
Fix minor typos

9 years agoqemu: improve the error when try to undefine transient network
Shanzhi Yu [Sun, 6 Mar 2016 10:54:21 +0000 (18:54 +0800)]
qemu: improve the error when try to undefine transient network

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

Signed-off-by: Shanzhi Yu <shyu@redhat.com>
9 years agoqemu: rename: Forbid renaming domains with managed save image
Peter Krempa [Mon, 7 Mar 2016 09:06:19 +0000 (10:06 +0100)]
qemu: rename: Forbid renaming domains with managed save image

The code does not handle renaming of the save state file. In addition to
that the resuming code would need to be tweaked to handle the name
change since the XML is extracted from the save image. The easies option
is to make the rename API even less useful by forbiding this.

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

9 years agovirLXCProcessMonitorInitNotify: Initialize @inode
Michal Privoznik [Fri, 4 Mar 2016 14:21:36 +0000 (15:21 +0100)]
virLXCProcessMonitorInitNotify: Initialize @inode

This is an error message I've just seen. Fix it by initializing
@inode.

  CC       lxc/libvirt_driver_lxc_impl_la-lxc_process.lo
lxc/lxc_process.c: In function 'virLXCProcessMonitorInitNotify':
lxc/lxc_process.c:767:23: error: 'inode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     virDomainAuditInit(vm, initpid, inode);
                       ^

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agolibxl: reuse virDomainObjUpdateModificationImpact
Nikolay Shirokovskiy [Wed, 2 Mar 2016 14:30:04 +0000 (17:30 +0300)]
libxl: reuse virDomainObjUpdateModificationImpact

Original current flag expansion does not filter out non
_CONFIG and _LIVE flags explicitly but they are prohibited
earlier by virCheckFlags.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agolxc: reuse virDomainObjUpdateModificationImpact
Nikolay Shirokovskiy [Wed, 2 Mar 2016 14:30:03 +0000 (17:30 +0300)]
lxc: reuse virDomainObjUpdateModificationImpact

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agolibxl: Use virDomainLiveConfigHelperMethod for libxlDomainSetMemoryFlags
Nikolay Shirokovskiy [Wed, 24 Feb 2016 08:38:37 +0000 (11:38 +0300)]
libxl: Use virDomainLiveConfigHelperMethod for libxlDomainSetMemoryFlags

Flag expansion is the same as in virDomainObjUpdateModificationImpact
which virDomainLiveConfigHelperMethod calls internally. The difference
is merely in implementation. Note that VIR_DOMAIN_MEM_CONFIG is the
same as VIR_DOMAIN_AFFECT_CONFIG.  Additionally, the called functions
will properly use flag OR and thus handle the VIR_DOMAIN_MEM_MAXIMUM case.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agotools: do not leak uri in disconnect handler
Ján Tomko [Thu, 3 Mar 2016 16:31:47 +0000 (17:31 +0100)]
tools: do not leak uri in disconnect handler

Commit 035947e introduced a call to virConnectGetURI
without a matching free() in virshCatchDisconnect.

Also fix vshAdmCatchDisconnect where it was copied by
commit 6dd7e42.

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

9 years agoInitialize couple of variables.
Michal Privoznik [Thu, 3 Mar 2016 08:10:27 +0000 (09:10 +0100)]
Initialize couple of variables.

While trying to build with -Os couple of compile errors showed
up.

conf/domain_conf.c: In function 'virDomainChrRemove':
conf/domain_conf.c:13666:24: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     virDomainChrDefPtr ret, **arrPtr = NULL;
                        ^
Compiler fails to see that @ret is used only if set in the loop,
but whatever, there's no harm in initializing the variable.

In vboxAttachDrivesNew and _vboxAttachDrivesOld compiler thinks
that @rc may be used uninitialized. Well, not directly, but maybe
after some optimization. Yet again, no harm in initializing a
variable.

In file included from ./util/virthread.h:26:0,
                 from ./datatypes.h:28,
                 from vbox/vbox_tmpl.c:43,
                 from vbox/vbox_V3_1.c:37:
vbox/vbox_tmpl.c: In function '_vboxAttachDrivesOld':
./util/virerror.h:181:5: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     virReportErrorHelper(VIR_FROM_THIS, code, __FILE__,              \
     ^
In file included from vbox/vbox_V3_1.c:37:0:
vbox/vbox_tmpl.c:1041:14: note: 'rc' was declared here
     nsresult rc;
              ^
Yet again, one uninitialized variable:

qemu/qemu_driver.c: In function 'qemuDomainBlockCommit':
qemu/qemu_driver.c:17194:9: error: 'baseSource' may be used uninitialized in this function [-Werror=maybe-uninitialized]
         qemuDomainPrepareDiskChainElement(driver, vm, baseSource,
         ^

And another one:

storage/storage_backend_logical.c: In function 'virStorageBackendLogicalMatchPoolSource.isra.2':
storage/storage_backend_logical.c:618:33: error: 'thisSource' may be used uninitialized in this function [-Werror=maybe-uninitialized]
                       thisSource->devices[j].path))
                                 ^

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoDrop inline keyword from some functions.
Michal Privoznik [Thu, 3 Mar 2016 07:14:37 +0000 (08:14 +0100)]
Drop inline keyword from some functions.

While trying to build with -Os I've encountered some build
failures.

util/vircommand.c: In function 'virCommandAddEnvFormat':
util/vircommand.c:1257:1: error: inlining failed in call to 'virCommandAddEnv': call is unlikely and code size would grow [-Werror=inline]
 virCommandAddEnv(virCommandPtr cmd, char *env)
 ^
util/vircommand.c:1308:5: error: called from here [-Werror=inline]
     virCommandAddEnv(cmd, env);
     ^
This function is big enough for the compiler to be not inlined.
This is the error message I'm seeing:

Then virDomainNumatuneNodeSpecified is exported and called from
other places. It shouldn't be inlined then.

In file included from network/bridge_driver_platform.h:30:0,
                 from network/bridge_driver_platform.c:26:
network/bridge_driver_linux.c: In function 'networkRemoveRoutingFirewallRules':
./conf/network_conf.h:350:1: error: inlining failed in call to 'virNetworkDefForwardIf.constprop': call is unlikely and code size would grow [-Werror=inline]
 virNetworkDefForwardIf(const virNetworkDef *def, size_t n)
 ^

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: Check if domain is active in GetControlInfo
Jiri Denemark [Thu, 3 Mar 2016 12:26:51 +0000 (13:26 +0100)]
qemu: Check if domain is active in GetControlInfo

Reporting status of a control connection makes no sense for an inactive
domain.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoUse correct LDFLAGS for leaseshelper
Jiri Denemark [Tue, 1 Mar 2016 13:40:39 +0000 (14:40 +0100)]
Use correct LDFLAGS for leaseshelper

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agodaemon: fixup refcounting in close callback handling
Nikolay Shirokovskiy [Thu, 3 Mar 2016 08:01:15 +0000 (11:01 +0300)]
daemon: fixup refcounting in close callback handling

remoteDispatchConnectCloseCallbackRegister introduced in
f484310a has problems. It refcounts network client object and in case of NOOP
driver operations for registering/unregistering close callback (any driver
except for vz) nobody will unref it later. As a result, client connection
will not be disposed and driver connection will not be closed.

The fix is easy. We don't need to refcount at all. We don't get a dangling
pointer because in remoteClientFreeFunc, which is called
upon disposing this network client object, we unregister the close
callback.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
9 years agoutil: Cleanup error path for virPolkitAgentCreate
John Ferlan [Wed, 2 Mar 2016 18:59:37 +0000 (13:59 -0500)]
util: Cleanup error path for virPolkitAgentCreate

More fallout from changing to using virPolkitAgent and handling error
paths.  Needed to clear the 'cmd' once stored and of course add the
virCommandFree(cmd) in the error: label.

9 years agodatatypes.c: Replace 'close' with 'closeData'
Michal Privoznik [Tue, 1 Mar 2016 16:39:54 +0000 (17:39 +0100)]
datatypes.c: Replace 'close' with 'closeData'

Older compilers fail to see that 'close' is not used a function
rather than a variable and produce the following error:

cc1: warnings being treated as errors
../../src/datatypes.c: In function 'virConnectCloseCallbackDataReset':
../../src/datatypes.c:149: error: declaration of 'close' shadows a global declaration [-Wshadow]

Replace all the 'close' occurrences with 'closeData' to resolve
this.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoutil: Fix missing initializer for agent
John Ferlan [Wed, 2 Mar 2016 00:36:37 +0000 (19:36 -0500)]
util: Fix missing initializer for agent

In virPolkitAgentCreate neglected to initialize agent to NULL. If
there was an error in the pipe, then we jump to error and would have
an issue. Found by coverity.

9 years agoLibvirt: Add missing default value for config option max_queued_clients
Jason J. Herne [Mon, 29 Feb 2016 13:33:20 +0000 (08:33 -0500)]
Libvirt: Add missing default value for config option max_queued_clients

Commit 1199edb1d4e3 added config option max_queued_clients and documented the
default value as 1000 but never actually set that value. This patch sets the
default value.

This addresses an issue whereby the following error message is reported if too
many migrations are started simultaneously:

error: End of file while reading data: Ncat: Invalid argument.: Input/output error

The problem is that too many ncat processes are spawned on the destination
system. They all attempt to connect to the libvirt socket. Because the
destination libvirtd cannot respond to the connect requests quickly enough we
overrun the socket's pending connections queue.

Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
9 years agolibxl: Remove extraneous AFFECT_LIVE and not active check.
Nikolay Shirokovskiy [Wed, 24 Feb 2016 08:38:39 +0000 (11:38 +0300)]
libxl: Remove extraneous AFFECT_LIVE and not active check.

libxlDomainPinVcpuFlags calls virDomainLiveConfigHelperMethod which will
call virDomainObjUpdateModificationImpact make the same AFFECT_LIVE flags
and !active check, so remove this duplicated check.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoconf: Combine if condition in virDomainObjUpdateModificationImpact
Nikolay Shirokovskiy [Wed, 24 Feb 2016 08:38:36 +0000 (11:38 +0300)]
conf: Combine if condition in virDomainObjUpdateModificationImpact

Prior to commit id '3d021381' virDomainObjUpdateModificationImpact was
part of virDomainLiveConfigHelperMethod and the *flags if condition
VIR_DOMAIN_AFFECT_CONFIG checked the ->persistent boolean and made the
virDomainObjGetPersistentDef call.

Since the functions were split the ->persistent check is all that remained
and thus could be combined into one if statement.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoqemu: enalbe hotplugging of macvtap device with multiqueue
Shanzhi Yu [Fri, 26 Feb 2016 07:02:46 +0000 (15:02 +0800)]
qemu: enalbe hotplugging of macvtap device with multiqueue

in commit 81a110, multiqueue for macvtap is enabled but forget
to support hotplugging enabled

Signed-off-by: Shanzhi Yu <shyu@redhat.com>
9 years agodocs: Clarify interface/target/@dev docs
Jiri Denemark [Tue, 1 Mar 2016 11:47:50 +0000 (12:47 +0100)]
docs: Clarify interface/target/@dev docs

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Don't always wait for SPICE to finish migration
Jiri Denemark [Mon, 29 Feb 2016 12:18:13 +0000 (13:18 +0100)]
qemu: Don't always wait for SPICE to finish migration

When SPICE graphics is configured for a domain but we did not ask the
client to switch to the destination, we should not wait for
SPICE_MIGRATE_COMPLETED event (which will never come).

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Don't try to fetch migration stats on destination
Jiri Denemark [Mon, 29 Feb 2016 11:34:08 +0000 (12:34 +0100)]
qemu: Don't try to fetch migration stats on destination

Migration statistics are not available on the destination host and
starting a query job during incoming migration is not allowed. Trying to
do that would result in

    Timed out during operation: cannot acquire state change lock (held
    by remoteDispatchDomainMigratePrepare3Params)

error. We should not even try to start the job.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoFix formatting in remote_protocol-structs
Jiri Denemark [Tue, 1 Mar 2016 14:57:20 +0000 (15:57 +0100)]
Fix formatting in remote_protocol-structs

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoutil: Fix build without polkit
Jiri Denemark [Tue, 1 Mar 2016 14:51:37 +0000 (15:51 +0100)]
util: Fix build without polkit

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoImplement handling of per-domain bandwidth settings
Alexander Burluka [Tue, 16 Feb 2016 13:43:38 +0000 (16:43 +0300)]
Implement handling of per-domain bandwidth settings

Signed-off-by: Alexander Burluka <aburluka@virtuozzo.com>
9 years agoImplement qemuSetupGlobalCpuCgroup
Alexander Burluka [Tue, 16 Feb 2016 13:43:37 +0000 (16:43 +0300)]
Implement qemuSetupGlobalCpuCgroup

This functions setups per-domain cpu bandwidth parameters

Signed-off-by: Alexander Burluka <aburluka@virtuozzo.com>
9 years agoAdd global_period and global_quota XML validation test
Alexander Burluka [Tue, 16 Feb 2016 13:43:36 +0000 (16:43 +0300)]
Add global_period and global_quota XML validation test

Signed-off-by: Alexander Burluka <aburluka@virtuozzo.com>
9 years agoAdd error checking on global quota and period
Alexander Burluka [Tue, 16 Feb 2016 13:43:35 +0000 (16:43 +0300)]
Add error checking on global quota and period

Signed-off-by: Alexander Burluka <aburluka@virtuozzo.com>
9 years agoAdd global quota parameter necessary definitions
Alexander Burluka [Tue, 16 Feb 2016 13:43:34 +0000 (16:43 +0300)]
Add global quota parameter necessary definitions

This parameter controls the maximum bandwidth to be used
within a period for whole domain.

Signed-off-by: Alexander Burluka <aburluka@virtuozzo.com>
9 years agoAdd global period definitions
Alexander Burluka [Tue, 16 Feb 2016 13:43:33 +0000 (16:43 +0300)]
Add global period definitions

This parameter represents top level period cgroup
that limits whole domain enforcement period for a quota

Signed-off-by: Alexander Burluka <aburluka@virtuozzo.com>
9 years agovz: implement connection close notification
Nikolay Shirokovskiy [Wed, 17 Feb 2016 12:15:03 +0000 (15:15 +0300)]
vz: implement connection close notification

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agodaemon: add connection close rpc
Nikolay Shirokovskiy [Wed, 17 Feb 2016 12:15:02 +0000 (15:15 +0300)]
daemon: add connection close rpc

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agoremote: factor out feature checks on connection open
Nikolay Shirokovskiy [Wed, 17 Feb 2016 12:15:01 +0000 (15:15 +0300)]
remote: factor out feature checks on connection open

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agoclose callback: move it to driver
Nikolay Shirokovskiy [Tue, 1 Mar 2016 14:17:38 +0000 (14:17 +0000)]
close callback: move it to driver

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agovirConnectCloseCallbackDataDispose: remove unnecessary locks
Nikolay Shirokovskiy [Wed, 17 Feb 2016 12:14:59 +0000 (15:14 +0300)]
virConnectCloseCallbackDataDispose: remove unnecessary locks

We don't need locks in dispose functions as they can only
be run in one thread for given object.

9 years agoclose callback API: remove unnecessary locks
Nikolay Shirokovskiy [Wed, 17 Feb 2016 12:14:58 +0000 (15:14 +0300)]
close callback API: remove unnecessary locks

closeCallback pointer is immutable (set on connection object creation)
and self-locking.

9 years agovirConnectCloseCallbackData: factor out callback disarming
Nikolay Shirokovskiy [Wed, 17 Feb 2016 12:14:57 +0000 (15:14 +0300)]
virConnectCloseCallbackData: factor out callback disarming

9 years agoclose callback: make unregister clean after connect close event
Nikolay Shirokovskiy [Wed, 17 Feb 2016 12:14:56 +0000 (15:14 +0300)]
close callback: make unregister clean after connect close event

If connect close is fired then following unregister will fail
as we set callback to NULL and thus callback equality checking
will fail.

Callback is set to NULL to make it fired only one time probabaly.
Instead lets use connection equality to NULL to check if callback
is already fired.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agovirConnectCloseCallbackData: fix connection object refcount
Nikolay Shirokovskiy [Wed, 17 Feb 2016 12:14:55 +0000 (15:14 +0300)]
virConnectCloseCallbackData: fix connection object refcount

We have reference to connection object in virConnectCloseCallbackData
object thus we have to refcount it. Obviously we have problems
in dispose and call functions. Let's fix it.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agofactor out virConnectCloseCallbackDataPtr methods
Nikolay Shirokovskiy [Wed, 17 Feb 2016 12:14:54 +0000 (15:14 +0300)]
factor out virConnectCloseCallbackDataPtr methods

Make register and unregister functions return void because
we can check the state of callback object beforehand via
virConnectCloseCallbackDataGetCallback. This can be done
without race conditions if we use higher level locks for registering
and unregistering. The fact they return void simplifies
task of consistent registering/unregistering.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
9 years agoqemu_cgroup: use virCgroupAddTask instead of virCgroupMoveTask
Henning Schild [Fri, 26 Feb 2016 15:34:24 +0000 (16:34 +0100)]
qemu_cgroup: use virCgroupAddTask instead of virCgroupMoveTask

qemuProcessSetupEmulator runs at a point in time where there is only
the qemu main thread. Use virCgroupAddTask to put just that one task
into the emulator cgroup. That patch makes virCgroupMoveTask and
virCgroupAddTaskStrController obsolete.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
9 years agoqemu_cgroup: put qemu right into emulator sub-cgroup
Henning Schild [Fri, 26 Feb 2016 15:34:23 +0000 (16:34 +0100)]
qemu_cgroup: put qemu right into emulator sub-cgroup

Move qemuProcessSetupEmulator up under qemuSetupCgroup. That way
we move the one main thread right into the emulator cgroup, instead
of moving multiple threads later on. And we do not actually want any
threads running in the parent cgroups (cpu cpuacct cpuset).

Signed-off-by: Henning Schild <henning.schild@siemens.com>
9 years agoqemu: process: Move emulator thread setting code into one function
Peter Krempa [Wed, 24 Feb 2016 13:45:44 +0000 (14:45 +0100)]
qemu: process: Move emulator thread setting code into one function

Similarly to the refactors to iothreads and vcpus, move the code that
initializes the emulator thread settings into single function.

9 years agoqemu: introduce vram64 attribute for QXL video device
Pavel Hrdina [Tue, 23 Feb 2016 16:04:19 +0000 (17:04 +0100)]
qemu: introduce vram64 attribute for QXL video device

This attribute is used to extend secondary PCI bar and expose it to the
guest as 64bit memory.  It works like this: attribute vram is there to
set size of secondary PCI bar and guest sees it as 32bit memory,
attribute vram64 can extend this secondary PCI bar.  If both attributes
are used, guest sees two memory bars, both address the same memory, with
the difference that the 32bit bar can address only the first part of the
whole memory.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agoqemu_capabilities: introduce QEMU_CAPS_QXL(_VGA)_VRAM64
Pavel Hrdina [Tue, 1 Mar 2016 12:46:37 +0000 (13:46 +0100)]
qemu_capabilities: introduce QEMU_CAPS_QXL(_VGA)_VRAM64

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agodocs/formatdomain: rewrite video documentation
Pavel Hrdina [Mon, 22 Feb 2016 11:41:06 +0000 (12:41 +0100)]
docs/formatdomain: rewrite video documentation

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agodomain_conf: always set primary video device as primary
Pavel Hrdina [Tue, 23 Feb 2016 12:00:24 +0000 (13:00 +0100)]
domain_conf: always set primary video device as primary

We always place primary video device at first place, to make it easier
to create a qemu command or format an xml, but we should also set the
primary boolean for primary video device to 'true'.

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