]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
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>
9 years agovirsh: Add support for text based polkit authentication
John Ferlan [Tue, 9 Feb 2016 19:08:42 +0000 (14:08 -0500)]
virsh: Add support for text based polkit authentication

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

When the login session doesn't have an ssh -X type display agent in
order for libvirtd to run the polkit session authentication, attempts
to run 'virsh -c qemu:///system list' from an unauthorized user (or one
that isn't part of the libvirt /etc/group) will fail with the following
error from libvirtd:

error: authentication unavailable: no polkit agent available to
       authenticate action 'org.libvirt.unix.manage'

In order to handle the local authentication, we will use the new
virPolkitAgentCreate API in order to create a text based authentication
agent for our non readonly session to authenticate with.

The new code will execute in a loop allowing 5 failures to authenticate
before failing out.

With this patch in place, the following occurs:

$ virsh -c qemu:///system list
==== AUTHENTICATING FOR org.libvirt.unix.manage ===
System policy prevents management of local virtualized systems
Authenticating as: Some User (SUser)
Password:
==== AUTHENTICATION COMPLETE ===
 Id    Name                           State
 ----------------------------------------------------
  1     somedomain                     running

$

9 years agoutil: Introduce API's for Polkit text authentication
John Ferlan [Tue, 9 Feb 2016 15:09:44 +0000 (10:09 -0500)]
util: Introduce API's for Polkit text authentication

Introduce virPolkitAgentCreate and virPolkitAgentDestroy

virPolkitAgentCreate will run the polkit pkttyagent image as an asynchronous
command in order to handle the local agent authentication via stdin/stdout.
The code makes use of the pkttyagent --notify-fd mechanism to let it know
when the agent is successfully registered.

virPolkitAgentDestroy will close the command effectively reaping our
child process

9 years agopolkit: Adjust message when authentication agent isn't found
John Ferlan [Thu, 14 Jan 2016 19:34:28 +0000 (14:34 -0500)]
polkit: Adjust message when authentication agent isn't found

When there isn't a ssh -X type session running and a user has not
been added to the libvirt group, attempts to run 'virsh -c qemu:///system'
commands from an otherwise unprivileged user will fail with rather
generic or opaque error message:

    "error: authentication failed: no agent is available to authenticate"

This patch will adjust the error code and message to help reflect the
situation that the problem is the requested mechanism is UNAVAILABLE and
a slightly more descriptive error. The result on a failure then becomes:

    "error: authentication unavailable: no polkit agent available to
            authenticate action 'org.libvirt.unix.manage'"

A bit more history on this - at one time a failure generated the
following type message when running the 'pkcheck' as a subprocess:

"error: authentication failed: polkit\56retains_authorization_after_challenge=1
Authorization requires authentication but no agent is available."

but, a patch was generated to adjust the error message to help provide
more details about what failed. This was pushed as commit id '96a108c99'.
That patch prepended a "polkit: " to the output. It really didn't solve
the problem, but gave a hint.

After some time it was deemed using DBus API calls directly was a
better way to go (since pkcheck calls them anyway). So, commit id
'1b854c76' (more or less) copied the code from remoteDispatchAuthPolkit
and adjusted it. Then commit id 'c7542573' adjusted the remote.c
code to call the new API (virPolkitCheckAuth). Finally, commit id
'308c0c5a' altered the code to call DBus APIs directly. In doing
so, it reverted the failing error message to the generic message
that would have been received from DBus anyway.

9 years agosecret: Rename loadSecrets
John Ferlan [Thu, 25 Feb 2016 11:47:59 +0000 (06:47 -0500)]
secret: Rename loadSecrets

Rename to secretLoadAllConfigs and add the 'driver->configDir' as
a parameter.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agosecret: Introduce secretAssignDef
John Ferlan [Wed, 24 Feb 2016 15:52:30 +0000 (10:52 -0500)]
secret: Introduce secretAssignDef

This new API will allocate the secret, assign the def pointer, and
insert the secret onto the passed list. Whether that's the temporary
list in loadSecrets which gets loaded into the driver list or driver
list during secretDefineXML.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agosecret: Introduce listUnlinkSecret
John Ferlan [Wed, 24 Feb 2016 15:57:28 +0000 (10:57 -0500)]
secret: Introduce listUnlinkSecret

Add a temporary helper to search for a specific secret by address
on the list and remove it if it's found. The following patch will
introduce a common allocation and listInsert helper. That means
error paths of the routines calling would need a way to remove the
secret off the list.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agosecret: Create a 'base64File' in virSecretObj
John Ferlan [Wed, 24 Feb 2016 01:14:04 +0000 (20:14 -0500)]
secret: Create a 'base64File' in virSecretObj

This patch removes need for secretBase64Path and secretComputePath. Similar
to the configFile, create an entry for base64File, which will be generated
as the driver->configDir, the UUID value, plus the ".base" suffix. Rather
than generating on the fly, store this in the virSecretObj.

The buildup of the pathname done in loadSecrets where the failure to build
is ignored which is no different than the failure to generate the name
in secretLoadValue which would have been ignored in the failure path
after secretLoad.

This also removes the need for secretComputPath and secretBase64Path.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agosecret: Create a 'configFile' in virSecretObj
John Ferlan [Wed, 24 Feb 2016 00:04:32 +0000 (19:04 -0500)]
secret: Create a 'configFile' in virSecretObj

This patch removes the need for secretXMLPath. Instead save 'path' during
loadSecret as 'configFile'. The secretXMLPath is nothing more than an
open coded virFileBuildPath.  All that code did was concantenate the
driver->configDir, the UUID of the secret, and the ".xml" suffix to form
the configFile name which we now will generate and save instead.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agosecret: Adjust logic to build file path in secretLoad
John Ferlan [Tue, 23 Feb 2016 23:51:21 +0000 (18:51 -0500)]
secret: Adjust logic to build file path in secretLoad

The 'secretLoad' was essentially open coding virFileBuildPath.

Adjust the logic to have the caller build the path and pass it. The net
sum of ignoring the virFileBuildPath failure is the same as before where
the failure to virAsprintf the path would have been ignored anyway in
the secretLoad error path.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agosecret: Rename directory to configDir
John Ferlan [Tue, 23 Feb 2016 23:27:21 +0000 (18:27 -0500)]
secret: Rename directory to configDir

This follows other drivers usage model.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agosecret: Use 'secret' instead of 's' for variable name
John Ferlan [Tue, 23 Feb 2016 23:01:11 +0000 (18:01 -0500)]
secret: Use 'secret' instead of 's' for variable name

Remove one letter variable.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agosecret: Rename virSecretObjPtr 'entry' to 'secret'
John Ferlan [Tue, 23 Feb 2016 23:16:21 +0000 (18:16 -0500)]
secret: Rename virSecretObjPtr 'entry' to 'secret'

Just renaming the variable in secretConnectListAllSecrets.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agosecret: Remove local virSecretPtr 'secret'
John Ferlan [Tue, 23 Feb 2016 23:14:31 +0000 (18:14 -0500)]
secret: Remove local virSecretPtr 'secret'

Remove the need for the local 'secret' in secretConnectListAllSecrets.
A subsequent patch will rename the ObjPtr entry to secret.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agosecret: Rename virSecretEntry
John Ferlan [Tue, 23 Feb 2016 22:40:37 +0000 (17:40 -0500)]
secret: Rename virSecretEntry

Rename to virSecretObj - preparation for future patch, but also follows
similar code in other drivers.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agosecret: Use virFileRewrite instead of replaceFile
John Ferlan [Tue, 23 Feb 2016 18:53:32 +0000 (13:53 -0500)]
secret: Use virFileRewrite instead of replaceFile

Use the common API instead of essentially open coding same functionality.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agosecret: Various formatting cleanups
John Ferlan [Tue, 23 Feb 2016 18:44:12 +0000 (13:44 -0500)]
secret: Various formatting cleanups

Rather than having it interspersed with other changes, do it once.

Remove a couple ^L, 1 argument per line for functions, less than 80 chars
per line, use of spacing between logical groups of code, use of one line
if statements when doing fetch followed by comparison, use direct return
when no cleanup to be done.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agovircgroup: one central point for adding tasks to cgroups
Henning Schild [Fri, 26 Feb 2016 15:34:22 +0000 (16:34 +0100)]
vircgroup: one central point for adding tasks to cgroups

Use virCgroupAddTaskController in virCgroupAddTask so we have one
single point where we add tasks to cgroups.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
9 years agoqemu: Allow setting pinning of emulator/iohtread with automatic placement
Peter Krempa [Wed, 24 Feb 2016 13:40:51 +0000 (14:40 +0100)]
qemu: Allow setting pinning of emulator/iohtread with automatic placement

We honour the placement bitmaps when starting up, so there's no point in
having this check. Additionally the check was buggy since it checked
vm->def all the time even if the user requested to modify the persistent
definition which had different configuration.

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

9 years agoqemu: add spice opengl support
Marc-André Lureau [Fri, 19 Feb 2016 14:30:15 +0000 (15:30 +0100)]
qemu: add spice opengl support

Add Spice graphics gl attribute. qemu 2.6 should have -spice gl=on argument to
enable opengl rendering context (patches on the ML). This is necessary to
actually enable virgl rendering.

Add a qemuxml2argv test for virtio-gpu + spice with virgl.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoPost-release version bump to 1.3.3
Michal Privoznik [Tue, 1 Mar 2016 08:34:01 +0000 (09:34 +0100)]
Post-release version bump to 1.3.3

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: Shorten per-domain directory names
Martin Kletzander [Fri, 26 Feb 2016 08:15:55 +0000 (09:15 +0100)]
qemu: Shorten per-domain directory names

Per-domain directories were introduced in order to be able to
completely separate security labels for each domain (commit
f1f68ca33433825ce0deed2d96f1990200bc6618).  However when the domain
name is long (let's say a ridiculous 110 characters), we cannot
connect to the monitor socket because on length of UNIX socket address
is limited.  In order to get around this, let's shorten it in similar
fashion and in order to avoid conflicts, throw in an ID there as well.
Also save that into the status XML and load the old status XMLs
properly (to clean up after older domains).  That way we can change it
in the future.

The shortening can be seen in qemuxml2argv tests, for example in the
hugepages-pages2 case.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoRelease of libvirt-1.3.2
Daniel Veillard [Tue, 1 Mar 2016 03:23:10 +0000 (11:23 +0800)]
Release of libvirt-1.3.2

* docs/news.html.in libvirt.spec.in: update for release
* po/*.po*: regenerated

9 years agodocs: mention ZFS on Linux support osstest/frozen/xen-4.4-testing
Roman Bogorodskiy [Sat, 27 Feb 2016 02:39:50 +0000 (05:39 +0300)]
docs: mention ZFS on Linux support

9 years agostorage: Fix error path in storagePoolDefineXML
John Ferlan [Thu, 25 Feb 2016 20:47:56 +0000 (15:47 -0500)]
storage: Fix error path in storagePoolDefineXML

Found by inspection - after calling virStoragePoolObjAssignDef the
pool is part of the driver->pools.objs list and the failure path
for the virStoragePoolObjSaveDef will use virStoragePoolObjRemove
to remove the pool from the objs list which will unlock and free
the pool pointer (as pools->objs[i] during the loop). Since the call
doesn't clear the pool address from the callee, we need to set it
to NULL; otherwise, the virStoragePoolObjUnlock in the cleanup: code
will fail miserably.

9 years agostorage: Fix error path in virStoragePoolObjLoad
John Ferlan [Thu, 25 Feb 2016 20:24:27 +0000 (15:24 -0500)]
storage: Fix error path in virStoragePoolObjLoad

While reviewing how storage driver used ObjListPtr's for reference
in some recent secret driver patches to use the same mechanism, I came
across an instance where the wrong API was called for error paths after
successfully allocating the storage pool pointer and inserting into
the driver pool list.

The path is after virStoragePoolObjAssignDef succeeds - the 'def' passed
in is assigned to pool->def (or newDef) so it shouldn't be the only thing
deleted. The pool is now part of driver->pools.objs, so it would need to
be removed (as happens in the storagePoolCreateXML error paths).

Rather than calling virStoragePoolDefFree to free the def which is now
assigned to the pool, call virStoragePoolObjRemove to ensure the pool
element is removed from the driver list and that anything stored in pool
is properly handled by virStoragePoolObjFree including the call to
virStoragePoolDefFree for the pool->{def|newDef} element.

9 years agodocs: formatdomain: Document "spice" as a valid value for <graphics type=..>
Richard W.M. Jones [Fri, 26 Feb 2016 10:00:28 +0000 (10:00 +0000)]
docs: formatdomain: Document "spice" as a valid value for <graphics type=..>

Trivial documentation fix.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
9 years agovirsh: reject migration with both --live and --offline
Nitesh Konkar [Fri, 26 Feb 2016 11:38:23 +0000 (12:38 +0100)]
virsh: reject migration with both --live and --offline

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
9 years agoqemu: error out on missing machine type in configs
Ján Tomko [Thu, 25 Feb 2016 15:21:41 +0000 (16:21 +0100)]
qemu: error out on missing machine type in configs

Commit f1a89a8 allowed parsing configs from /etc/libvirt
without validating the emulator capabilities.

Check for the presence of a machine type in the qemu driver's
post parse function instead of crashing.

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

9 years agotests: add parseFlags to qemuxml2argvtest
Ján Tomko [Thu, 25 Feb 2016 15:21:13 +0000 (16:21 +0100)]
tests: add parseFlags to qemuxml2argvtest