]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
8 years agoqemu_conf: Add param memory_backing_dir
Jaroslav Safka [Thu, 2 Feb 2017 13:27:31 +0000 (13:27 +0000)] 
qemu_conf: Add param memory_backing_dir

Add new parameter memory_backing_dir where files will be stored when memoryBacking
source is selected as file.

Value is stored inside char* memoryBackingDir

8 years agoqemu, conf: Rename virNumaMemAccess to virDomainMemoryAccess
Jaroslav Safka [Thu, 2 Feb 2017 13:27:30 +0000 (13:27 +0000)] 
qemu, conf: Rename virNumaMemAccess to virDomainMemoryAccess

Rename to avoid duplicate code. Because virDomainMemoryAccess will be
used in memorybacking for setting default behaviour.

NOTE: The enum cannot be moved to qemu/domain_conf because of headers
dependency

8 years agocpu: fix typo: rename __kvm_hv_spinlock to __kvm_hv_spinlocks
Maxim Nestratov [Tue, 31 Jan 2017 14:12:13 +0000 (17:12 +0300)] 
cpu: fix typo: rename __kvm_hv_spinlock to __kvm_hv_spinlocks

Strings associated with virDomainHyperv values in domain_conf.c are used to
construct HyperV CPU features names to be compared with names defined in
cpu_x86_data.h and the names for HyperV "spinlocks" feature don't match.
This leads to a misleading warning:
"host doesn't support hyperv 'spinlocks' feature" even when it's supported.
Let's fix it and rename along with it VIR_CPU_x86_KVM_HV_SPINLOCK to
VIR_CPU_x86_KVM_HV_SPINLOCKS.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agoqemu_command: Fix check for gluster disks
Jiri Denemark [Thu, 9 Feb 2017 10:16:19 +0000 (11:16 +0100)] 
qemu_command: Fix check for gluster disks

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu_blockjob: Avoid dereferencing NULL on OOM
Jiri Denemark [Thu, 9 Feb 2017 09:49:23 +0000 (10:49 +0100)] 
qemu_blockjob: Avoid dereferencing NULL on OOM

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_x86: Fix memory leak in virCPUx86Translate
Jiri Denemark [Thu, 9 Feb 2017 08:25:51 +0000 (09:25 +0100)] 
cpu_x86: Fix memory leak in virCPUx86Translate

virCPUDefStealModel is called with keepVendor == true which means the
cpu structure will keep its original vendor/vendor_id values. Thus it
makes no sense to copy them to the translated definition as they won't
be used there anyway. Except that the translated->vendor pointer might
get lost in x86Decode.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agovz: cleanup: remove unused constant
Maxim Nestratov [Wed, 8 Feb 2017 14:19:59 +0000 (17:19 +0300)] 
vz: cleanup: remove unused constant

PARALLELS_STATISTICS_DROP_COUNT isn't used anymore

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: fix event handle leak in prlsdkHandlePerfEvent
Maxim Nestratov [Wed, 8 Feb 2017 14:14:12 +0000 (17:14 +0300)] 
vz: fix event handle leak in prlsdkHandlePerfEvent

When we happen to lose a domain but still get a performance event
for it, we should also free the event handle.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: fix handle leak in prlsdkHandleVmStateEvent
Maxim Nestratov [Wed, 8 Feb 2017 14:09:57 +0000 (17:09 +0300)] 
vz: fix handle leak in prlsdkHandleVmStateEvent

Every successful call of PrlEvent_GetParamByName allocates a handle,
which has to be freed.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agoqemu_security: Introduce ImageLabel APIs
Michal Privoznik [Fri, 3 Feb 2017 16:09:33 +0000 (17:09 +0100)] 
qemu_security: Introduce ImageLabel APIs

Just like we need wrappers over other virSecurityManager APIs, we
need one for virSecurityManagerSetImageLabel and
virSecurityManagerRestoreImageLabel. Otherwise we might end up
relabelling device in wrong namespace.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agolibxl: use init and dispose functions with libxl_physinfo
Jim Fehlig [Wed, 1 Feb 2017 03:07:30 +0000 (20:07 -0700)] 
libxl: use init and dispose functions with libxl_physinfo

The typical pattern when calling libxl functions that populate a
structure is

  libxl_foo foo;
  libxl_foo_init(&foo);
  libxl_get_foo(ctx, &foo);
  ...
  libxl_foo_dispose(&foo);

Fix several instances of libxl_physinfo missing the init and
dispose calls.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agolibxl: honor autoballoon setting in libxl.conf
Jim Fehlig [Mon, 30 Jan 2017 18:43:15 +0000 (11:43 -0700)] 
libxl: honor autoballoon setting in libxl.conf

libxlGetAutoballoonConf is supposed to honor user-specified
autoballoon setting in libxl.conf. As written, the user-specified
setting could be overwritten by the subsequent logic to check
dom0_mem parameter. If user-specified setting is present and
correct, accept it. Only fallback to checking Xen dom0_mem
command line parameter if user-specfied setting is not present.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
8 years agoxenconfig: fix xml to xl.cfg conversion with no graphics
Joao Martins [Wed, 8 Feb 2017 12:32:36 +0000 (12:32 +0000)] 
xenconfig: fix xml to xl.cfg conversion with no graphics

If no graphics element is in XML xenFormatXLSpice will access
graphics without checking it has one in the first place, leading to a
segmentation fault.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
8 years agoqemuDomainNamespaceSetupDisk: Simplify disk check
Michal Privoznik [Fri, 3 Feb 2017 16:23:10 +0000 (17:23 +0100)] 
qemuDomainNamespaceSetupDisk: Simplify disk check

Firstly, instead of checking for next->path the
virStorageSourceIsEmpty() function should be used which also
takes disk type into account.
Secondly, not every disk source passed has the correct type set
(due to our laziness). Therefore, instead of checking for
virStorageSourceIsBlockLocal() and also S_ISBLK() the former can
be refined to just virStorageSourceIsLocalStorage().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuDomainDiskChainElement{Prepare,Revoke}: manage /dev entry
Michal Privoznik [Fri, 3 Feb 2017 16:01:31 +0000 (17:01 +0100)] 
qemuDomainDiskChainElement{Prepare,Revoke}: manage /dev entry

Again, one missed bit. This time without this commit there is no
/dev entry  in the namespace of the qemu process when doing disk
snapshots or block-copy.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuDomainNamespace{Setup,Teardown}Disk: Don't pass pointer to full disk
Michal Privoznik [Fri, 3 Feb 2017 14:53:28 +0000 (15:53 +0100)] 
qemuDomainNamespace{Setup,Teardown}Disk: Don't pass pointer to full disk

These functions do not need to see the whole virDomainDiskDef.
Moreover, they are going to be called from places where we don't
have access to the full disk definition. Sticking with
virStorageSource is more than enough.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuDomainNamespaceSetupDisk: Drop useless @src variable
Michal Privoznik [Sat, 4 Feb 2017 17:02:07 +0000 (18:02 +0100)] 
qemuDomainNamespaceSetupDisk: Drop useless @src variable

Since its introduction in 81df21507bef9 this variable was never
used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu_domain: Don't pass virDomainDeviceDefPtr to ns helpers
Michal Privoznik [Fri, 3 Feb 2017 14:37:41 +0000 (15:37 +0100)] 
qemu_domain: Don't pass virDomainDeviceDefPtr to ns helpers

There is no need for this. None of the namespace helpers uses it.
Historically it was used when calling secdriver APIs, but we
don't to that anymore.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu_security: Drop qemuSecuritySetRestoreAllLabelData struct
Michal Privoznik [Mon, 6 Feb 2017 06:46:00 +0000 (07:46 +0100)] 
qemu_security: Drop qemuSecuritySetRestoreAllLabelData struct

This struct is unused after 095f042ed68b01.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuDomainAttachSCSIVHostDevice: manage /dev entry
Michal Privoznik [Sat, 4 Feb 2017 17:54:10 +0000 (18:54 +0100)] 
qemuDomainAttachSCSIVHostDevice: manage /dev entry

Again, one missed bit. This time without this commit there is no
/dev entry in the namespace of the qemu process when attaching
vhost SCSI device.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuDomainAttachSCSIVHostDevice: Prefer qemuSecurity wrappers
Michal Privoznik [Tue, 7 Feb 2017 14:56:23 +0000 (15:56 +0100)] 
qemuDomainAttachSCSIVHostDevice: Prefer qemuSecurity wrappers

Since we have qemuSecurity wrappers over
virSecurityManagerSetHostdevLabel and
virSecurityManagerRestoreHostdevLabel we ought to use them
instead of calling secdriver APIs directly.  Without those
wrappers the labelling won't be done in the correct namespace
and thus won't apply to the nodes seen by qemu itself.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: propagate bridge MTU into qemu "host_mtu" option
Laine Stump [Fri, 3 Feb 2017 16:55:20 +0000 (11:55 -0500)] 
qemu: propagate bridge MTU into qemu "host_mtu" option

libvirt was able to set the host_mtu option when an MTU was explicitly
given in the interface config (with <mtu size='n'/>), set the MTU of a
libvirt network in the network config (with the same named
subelement), and would automatically set the MTU of any tap device to
the MTU of the network.

This patch ties that all together (for networks based on tap devices
and either Linux host bridges or OVS bridges) by learning the MTU of
the network (i.e. the bridge) during qemuInterfaceBridgeConnect(), and
returning that value so that it can then be passed to
qemuBuildNicDevStr(); qemuBuildNicDevStr() then sets host_mtu in the
interface's commandline options.

The result is that a higher MTU for all guests connecting to a
particular network will be plumbed top to bottom by simply changing
the MTU of the network (in libvirt's config for libvirt-managed
networks, or directly on the bridge device for simple host bridges or
OVS bridges managed outside of libvirt).

One question I have about this - it occurred to me that in the case of
migrating a guest from a host with an older libvirt to one with a
newer libvirt, the guest may have *not* had the host_mtu option on the
older machine, but *will* have it on the newer machine. I'm curious if
this could lead to incompatibilities between source and destination (I
guess it all depends on whether or not the setting of host_mtu has a
practical effect on a guest that is already running - Maxime?)

Likewise, we could run into problems when migrating from a newer
libvirt to older libvirt - The guest would have been told of the
higher MTU on the newer libvirt, then migrated to a host that didn't
understand <mtu size='blah'/>. (If this really is a problem, it would
be a problem with or without the current patch).

8 years agonetwork: honor mtu setting when creating network
Laine Stump [Mon, 23 Jan 2017 02:33:07 +0000 (21:33 -0500)] 
network: honor mtu setting when creating network

This resolves: https://bugzilla.redhat.com/1224348

8 years agoconf: support configuring mtu size in a virtual network
Laine Stump [Mon, 23 Jan 2017 02:23:48 +0000 (21:23 -0500)] 
conf: support configuring mtu size in a virtual network

Example:

  <network>
     ...
     <mtu size='9000'/>
     ...

If mtu is unset, it's assumed that we want the default for whatever is
the underlying transport (usually this is 1500).

This setting isn't yet wired in, so it will have no effect.

This partially resolves: https://bugzilla.redhat.com/1224348

8 years agoutil: add MTU arg to virNetDevTapCreateInBridgePort()
Laine Stump [Mon, 23 Jan 2017 01:41:03 +0000 (20:41 -0500)] 
util: add MTU arg to virNetDevTapCreateInBridgePort()

virNetDevTapCreateInBridgePort() has always set the new tap device to
the current MTU of the bridge it's being attached to. There is one
case where we will want to set the new tap device to a different
(usually larger) MTU - if that's done with the very first device added
to the bridge, the bridge's MTU will be set to the device's MTU. This
patch allows for that possibility by adding "int mtu" to the arg list
for virNetDevTapCreateInBridgePort(), but all callers are sending -1,
so it doesn't yet have any effect.

Since the requested MTU isn't necessarily what is used in the end (for
example, if there is no MTU requested, the tap device will be set to
the current MTU of the bridge), and the hypervisor may want to know
the actual MTU used, we also return the actual MTU to the caller (if
actualMTU is non-NULL).

8 years agoqemu: Forbid <memoryBacking><locked> without <memtune><hard_limit>
Andrea Bolognani [Mon, 6 Feb 2017 16:54:49 +0000 (17:54 +0100)] 
qemu: Forbid <memoryBacking><locked> without <memtune><hard_limit>

In order for memory locking to work, the hard limit on memory
locking (and usage) has to be set appropriately by the user.

The documentation mentions the requirement already: with this
patch, it's going to be enforced by runtime checks as well,
by forbidding a non-compliant guest from being defined as well
as edited and started.

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

8 years agodocs: mention bhyve SATA address changes in news.xml
Roman Bogorodskiy [Sun, 5 Feb 2017 12:51:47 +0000 (16:51 +0400)] 
docs: mention bhyve SATA address changes in news.xml

8 years agobhyve: fix virtio disk addresses
Roman Bogorodskiy [Wed, 1 Feb 2017 16:19:31 +0000 (20:19 +0400)] 
bhyve: fix virtio disk addresses

Like it usually happens, I fixed one thing and broke another:
in 803966c76 address allocation was fixed for SATA disks, but
broke that for virtio disks, because it dropped disk address
assignment completely. It's not needed for SATA disks anymore,
but still needed for the virtio ones.

Bring that back and add a couple of tests to make sure it won't
happen again.

8 years agoqemuDomainAttachDeviceMknod: Don't loop endlessly
Michal Privoznik [Thu, 19 Jan 2017 16:19:19 +0000 (17:19 +0100)] 
qemuDomainAttachDeviceMknod: Don't loop endlessly

When working with symlinks it is fairly easy to get into a loop.
Don't.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuDomainAttachDeviceMknod: Deal with symlinks
Michal Privoznik [Thu, 19 Jan 2017 16:02:54 +0000 (17:02 +0100)] 
qemuDomainAttachDeviceMknod: Deal with symlinks

Similarly to one of the previous commits, we need to deal
properly with symlinks in hotplug case too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuDomainCreateDevice: Don't loop endlessly
Michal Privoznik [Thu, 19 Jan 2017 07:30:09 +0000 (08:30 +0100)] 
qemuDomainCreateDevice: Don't loop endlessly

When working with symlinks it is fairly easy to get into a loop.
Don't.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuDomainCreateDevice: Properly deal with symlinks
Michal Privoznik [Wed, 18 Jan 2017 18:58:02 +0000 (19:58 +0100)] 
qemuDomainCreateDevice: Properly deal with symlinks

Imagine you have a disk with the following source set up:

/dev/disk/by-uuid/$uuid (symlink to) -> /dev/sda

After cbc45525cb21 the transitive end of the symlink chain is
created (/dev/sda), but we need to create any item in chain too.
Others might rely on that.
In this case, /dev/disk/by-uuid/$uuid comes from domain XML thus
it is this path that secdriver tries to relabel. Not the resolved
one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuDomain{Attach,Detach}Device NS helpers: Don't relabel devices
Michal Privoznik [Thu, 19 Jan 2017 16:03:31 +0000 (17:03 +0100)] 
qemuDomain{Attach,Detach}Device NS helpers: Don't relabel devices

After previous commit this has become redundant step.
Also setting up devices in namespace and setting their label
later on are two different steps and should be not done at once.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu_security: Use more transactions
Michal Privoznik [Wed, 18 Jan 2017 08:50:14 +0000 (09:50 +0100)] 
qemu_security: Use more transactions

The idea is to move all the seclabel setting to security driver.
Having the relabel code spread all over the place looks very
messy.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuSecurityRestoreAllLabel: Don't use transactions
Michal Privoznik [Fri, 20 Jan 2017 09:06:39 +0000 (10:06 +0100)] 
qemuSecurityRestoreAllLabel: Don't use transactions

Because of the nature of security driver transactions, it is
impossible to use them properly. The thing is, transactions enter
the domain namespace and commit all the seclabel changes.
However, in RestoreAllLabel() this is impossible - the qemu
process, the only process running in the namespace, is gone. And
thus is the namespace. Therefore we shouldn't use the transactions
as there is no namespace to enter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemuDomainPrepareDisk: Fix ordering
Michal Privoznik [Thu, 19 Jan 2017 16:04:15 +0000 (17:04 +0100)] 
qemuDomainPrepareDisk: Fix ordering

The current ordering is as follows:
1) set label
2) create the device in namespace
3) allow device in the cgroup

While this might work for now, it will definitely not work if the
security driver would use transactions as in that case there
would be no device to relabel in the domain namespace as the
device is created in the second step.
Swap steps 1) and 2) to allow security driver to use more
transactions.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoutil: Introduce virFileReadLink
Michal Privoznik [Wed, 18 Jan 2017 17:35:31 +0000 (18:35 +0100)] 
util: Introduce virFileReadLink

We will need to traverse the symlinks one step at the time.
Therefore we need to see where a symlink is pointing to.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirProcessRunInMountNamespace: Report errors from child
Michal Privoznik [Wed, 18 Jan 2017 09:56:14 +0000 (10:56 +0100)] 
virProcessRunInMountNamespace: Report errors from child

The comment to the function states that the errors from the child
process are reported. Well, the error buffer is filled with
possible error messages. But then it is thrown away. Among with
important error message from the child process.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoxenFormatXLDisk: Don't leak @target
Michal Privoznik [Sat, 4 Feb 2017 08:25:32 +0000 (09:25 +0100)] 
xenFormatXLDisk: Don't leak @target

==11260== 1,006 bytes in 1 blocks are definitely lost in loss record 106 of 111
==11260==    at 0x4C2AE5F: malloc (vg_replace_malloc.c:297)
==11260==    by 0x4C2BDFF: realloc (vg_replace_malloc.c:693)
==11260==    by 0x4EA430B: virReallocN (viralloc.c:245)
==11260==    by 0x4EA7C52: virBufferGrow (virbuffer.c:130)
==11260==    by 0x4EA7D28: virBufferAdd (virbuffer.c:165)
==11260==    by 0x4EA8E10: virBufferStrcat (virbuffer.c:718)
==11260==    by 0x42D263: xenFormatXLDiskSrcNet (xen_xl.c:960)
==11260==    by 0x42D4EB: xenFormatXLDiskSrc (xen_xl.c:1015)
==11260==    by 0x42D870: xenFormatXLDisk (xen_xl.c:1101)
==11260==    by 0x42DA89: xenFormatXLDomainDisks (xen_xl.c:1148)
==11260==    by 0x42EAF8: xenFormatXL (xen_xl.c:1558)
==11260==    by 0x40E85F: testCompareParseXML (xlconfigtest.c:105)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoutil: Fix domain object leaks on closecallbacks
John Ferlan [Sat, 21 Jan 2017 17:59:14 +0000 (12:59 -0500)] 
util: Fix domain object leaks on closecallbacks

Originally/discovered proposed by "Wang King <king.wang@huawei.com>"

When the virCloseCallbacksSet is first called, it increments the refcnt
on the domain object to ensure it doesn't get deleted before the callback
is called. The refcnt would be decremented in virCloseCallbacksUnset once
the entry is removed from the closeCallbacks has table.

When (mostly) normal shutdown occurs, the qemuProcessStop will end up
calling qemuProcessAutoDestroyRemove and will remove the callback from
the list and hash table normally and decrement the refcnt.

However, when qemuConnectClose calls virCloseCallbacksRun, it will scan
the (locked) closeCallbacks list for matching domain and callback function.
If an entry is found, it will be removed from the closeCallbacks list and
placed into a lookaside list to be processed when the closeCallbacks lock
is dropped. The callback function (e.g. qemuProcessAutoDestroy) is called
and will run qemuProcessStop. That code will fail to find the callback
in the list when qemuProcessAutoDestroyRemove is called and thus not decrement
the domain refcnt. Instead since the entry isn't found the code will just
return (mostly) harmlessly.

This patch will resolve the issue by taking another ref during the
search UUID process during virCloseCallackRun, decrementing the refcnt
taken by virCloseCallbacksSet, calling the callback routine and returning
overwriting the vm (since it could return NULL). Finally, it will call the
virDomainObjEndAPI to lower the refcnt and remove the lock taken during
the search UUID processing. This may cause the vm to be destroyed.

8 years agovirtlockd: fix systemd unit file dependancies
Daniel P. Berrange [Tue, 17 Jan 2017 15:45:57 +0000 (15:45 +0000)] 
virtlockd: fix systemd unit file dependancies

After deploying virtlogd by default we identified a number of
mistakes in the systemd unit file. virtlockd's relationship
to libvirtd is the same as virtlogd, so we must apply the
same unit file fixes to virtlockd

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoHACKING: Update after recent change of the html file
Peter Krempa [Fri, 3 Feb 2017 15:27:32 +0000 (16:27 +0100)] 
HACKING: Update after recent change of the html file

8 years agodocs: Release notes should be updated in a separate commit
Andrea Bolognani [Fri, 3 Feb 2017 09:19:12 +0000 (10:19 +0100)] 
docs: Release notes should be updated in a separate commit

Updating docs/news.xml in the same commit that performs the
documented change makes backports needlessly complicated,
both for mainteinance branches and downstream distributions,
because it introduces additional potential for merge
conflicts.

Document in the contributor guidelines that the release notes
should be updated in a separate commit instead, so that it's
easy to backport just the code change.

8 years agolibxl: fix dom0 autoballooning with Xen 4.8
Jim Fehlig [Tue, 17 Jan 2017 22:11:32 +0000 (15:11 -0700)] 
libxl: fix dom0 autoballooning with Xen 4.8

xen.git commit 57f8b13c changed several of the libxl memory
get/set functions to take 64 bit parameters. The libvirt
libxl driver still uses uint32_t variables for these various
parameters, which is particularly problematic for the
libxl_set_memory_target() function.

When dom0 autoballooning is enabled, libvirt (like xl) determines
the memory needed to start a domain and the memory available. If
memory available is less than memory needed, dom0 is ballooned
down by passing a negative value to libxl_set_memory_target()
'target_memkb' parameter. Prior to xen.git commit 57f8b13c,
'target_memkb' was an int32_t. Subtracting a larger uint32 from
a smaller uint32 and assigning it to int32 resulted in a negative
number. After commit 57f8b13c, the same subtraction is widened
to a int64, resulting in a large positive number. The simple
fix taken by this patch is to assign the difference of the
uint32 values to a temporary int32 variable, which is then
passed to 'target_memkb' parameter of libxl_set_memory_target().

Note that it is undesirable to change libvirt to use 64 bit
variables since it requires setting LIBXL_API_VERSION to 0x040800.
Currently libvirt supports LIBXL_API_VERSION >= 0x040400,
essentially Xen >= 4.4.

8 years agotests: qemuhotplug: Don't free the monitor object as part of @vm
Peter Krempa [Thu, 2 Feb 2017 15:42:18 +0000 (16:42 +0100)] 
tests: qemuhotplug: Don't free the monitor object as part of @vm

The test monitor should be freed separately so we need to remove the
pointer from the @vm object. This fixes a race condition crash in the
test introduced in commit a245abce43.

8 years agotests: qemuhotplug: Fix memory leaks after cpu hotplug testing patches
Peter Krempa [Thu, 2 Feb 2017 14:57:29 +0000 (15:57 +0100)] 
tests: qemuhotplug: Fix memory leaks after cpu hotplug testing patches

testQemuHotplugCpuDataFree leaked @data always and
testQemuHotplugCpuPrepare leaked @prefix on success

8 years agoqemu: Fix indentation in qemu_interface.h
Nitesh Konkar [Tue, 31 Jan 2017 16:35:51 +0000 (22:05 +0530)] 
qemu: Fix indentation in qemu_interface.h

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agoqemu: Don't lose group_name
Martin Kletzander [Tue, 24 Jan 2017 14:50:17 +0000 (15:50 +0100)] 
qemu: Don't lose group_name

Now that we have a function for properly assigning the blockdeviotune
info, let's use it instead of dropping the group name on every
assignment.  Otherwise it will not work with both --live and --config
options.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoconf: Add virDomainDiskSetBlockIOTune
Martin Kletzander [Mon, 30 Jan 2017 19:37:48 +0000 (20:37 +0100)] 
conf: Add virDomainDiskSetBlockIOTune

That function sets disk->blkdeviotune sensibly.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: Fix indentation in qemu_domain.h for RNG Namespaces
Martin Kletzander [Mon, 30 Jan 2017 19:38:03 +0000 (20:38 +0100)] 
qemu: Fix indentation in qemu_domain.h for RNG Namespaces

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agovz: change printing format specifier for network statistics
Maxim Nestratov [Tue, 29 Nov 2016 18:07:38 +0000 (21:07 +0300)] 
vz: change printing format specifier for network statistics

This is necessary to be able to get statistics for venet0 or
"host-routed" adapter, which has -1 index and thus, its statistics
is shown as "net.nic4294967295".

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
8 years agovz: support virDomainReset
Nikolay Shirokovskiy [Tue, 31 Jan 2017 07:44:13 +0000 (10:44 +0300)] 
vz: support virDomainReset

8 years agovz: support virDomainAbortJob
Nikolay Shirokovskiy [Tue, 31 Jan 2017 07:44:12 +0000 (10:44 +0300)] 
vz: support virDomainAbortJob

8 years agoqemu: Add enough USB hubs to accomodate all devices
Ján Tomko [Fri, 27 Jan 2017 13:06:29 +0000 (14:06 +0100)] 
qemu: Add enough USB hubs to accomodate all devices

Commit 815d98a started auto-adding one hub if there are more USB devices
than available USB ports.

This was a strange choice, since there might be even more devices.
Before USB address allocation was implemented in libvirt, QEMU
automatically added a new USB hub if the old one was full.

Adjust the logic to try adding as many hubs as will be needed
to plug in all the specified devices.

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

8 years agoconf: move VIR_DOMAIN_USB_HUB_PORTS to the header file
Ján Tomko [Fri, 27 Jan 2017 12:58:15 +0000 (13:58 +0100)] 
conf: move VIR_DOMAIN_USB_HUB_PORTS to the header file

For reusing in qemu_domain_address.c.

8 years agobhyve: add tests for SATA address allocation
Roman Bogorodskiy [Thu, 5 Jan 2017 14:38:20 +0000 (18:38 +0400)] 
bhyve: add tests for SATA address allocation

8 years agobhyve: fix SATA address allocation
Roman Bogorodskiy [Thu, 5 Jan 2017 12:51:25 +0000 (16:51 +0400)] 
bhyve: fix SATA address allocation

As bhyve for a long time didn't have a notion of the explicit SATA
controller and created a controller for each drive, the bhyve driver
in libvirt acted in a similar way and didn't care about the SATA
controllers and assigned PCI addresses to drives directly, as
the generated command will look like this anyway:

 2:0,ahci-hd,somedisk.img

This no longer makes sense because:

 1. After commit c07d1c1c4f it's not possible to assign
    PCI addresses to disks
 2. Bhyve now supports multiple disk drives for a controller,
    so it's going away from 1:1 controller:disk mapping, so
    the controller object starts to make more sense now

So, this patch does the following:

 - Assign PCI address to SATA controllers (previously we didn't do this)
 - Assign disk addresses instead of PCI addresses for disks. Now, when
   building a bhyve command, we take PCI address not from the disk
   itself but from its controller
 - Assign addresses at XML parsing time using the
   assignAddressesCallback. This is done mainly for being able to
   verify address allocation via xml2xml tests
 - Adjust existing bhyvexml2{xml,argv} tests to chase the new
   address allocation

This patch is largely based on work of Fabian Freyer.

8 years agobhyve: add virBhyveDriverCreateXMLConf
Roman Bogorodskiy [Thu, 5 Jan 2017 12:31:35 +0000 (16:31 +0400)] 
bhyve: add virBhyveDriverCreateXMLConf

Add virBhyveDriverCreateXMLConf, a simple wrapper around
virDomainXMLOptionNew that makes it easier to pass bhyveConnPtr
as a private data for parser. It will be used later for device
address allocation at parsing time.

Update consumers to use it instead of direct calls to
virDomainXMLOptionNew.

As we now have proper callbacks connected for the tests, update
test files accordingly to include the automatically generated
PCI root controller.

8 years agobhyve: detect 32 SATA devices per controller support
Fabian Freyer [Thu, 5 Jan 2017 12:21:52 +0000 (16:21 +0400)] 
bhyve: detect 32 SATA devices per controller support

Introduce a BHYVE_CAP_AHCI32SLOT capability that shows
if 32 devices per SATA controller are supported, and
a bhyveProbeCapsAHCI32Slot function that probes it.

8 years agovz: add state group to all domain stats
Nikolay Shirokovskiy [Mon, 12 Dec 2016 07:56:38 +0000 (10:56 +0300)] 
vz: add state group to all domain stats

8 years agovz: add balloon group to all domain stats
Nikolay Shirokovskiy [Mon, 12 Dec 2016 07:56:37 +0000 (10:56 +0300)] 
vz: add balloon group to all domain stats

8 years agovz: add vcpu group to all domain stats
Nikolay Shirokovskiy [Mon, 12 Dec 2016 07:56:36 +0000 (10:56 +0300)] 
vz: add vcpu group to all domain stats

8 years agovz: add net group to all domain stats
Nikolay Shirokovskiy [Mon, 12 Dec 2016 07:56:35 +0000 (10:56 +0300)] 
vz: add net group to all domain stats

8 years agovz: provide block stats for all domain stats
Nikolay Shirokovskiy [Mon, 12 Dec 2016 07:56:34 +0000 (10:56 +0300)] 
vz: provide block stats for all domain stats

8 years agovz: don't show bootorder for containers
Nikolay Shirokovskiy [Thu, 29 Dec 2016 09:58:34 +0000 (12:58 +0300)] 
vz: don't show bootorder for containers

Because this is invalid xml for containers. This patch almost
reverts 7eda8369, but still skips converting vz sdk bootorder
for containers to libvirt bootorder because we use boot order
in containers for quite different purpurse.

8 years agoqemu: assign USB addresses on redirdev hotplug too
Ján Tomko [Fri, 27 Jan 2017 14:26:13 +0000 (15:26 +0100)] 
qemu: assign USB addresses on redirdev hotplug too

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

8 years agoAdd libvirt-go-xml and libvirt-console-proxy to downloads
Daniel P. Berrange [Thu, 26 Jan 2017 15:43:39 +0000 (15:43 +0000)] 
Add libvirt-go-xml and libvirt-console-proxy to downloads

Add recently created modules to the download page list.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoqemuBuildChrChardevStr: Don't leak @charAlias
Michal Privoznik [Sun, 29 Jan 2017 11:15:28 +0000 (12:15 +0100)] 
qemuBuildChrChardevStr: Don't leak @charAlias

==12618== 110 bytes in 10 blocks are definitely lost in loss record 269 of 295
==12618==    at 0x4C2AE5F: malloc (vg_replace_malloc.c:297)
==12618==    by 0x1CFC6DD7: vasprintf (vasprintf.c:73)
==12618==    by 0x1912B2FC: virVasprintfInternal (virstring.c:551)
==12618==    by 0x1912B411: virAsprintfInternal (virstring.c:572)
==12618==    by 0x50B1FF: qemuAliasChardevFromDevAlias (qemu_alias.c:638)
==12618==    by 0x518CCE: qemuBuildChrChardevStr (qemu_command.c:4973)
==12618==    by 0x522DA0: qemuBuildShmemBackendChrStr (qemu_command.c:8674)
==12618==    by 0x523209: qemuBuildShmemCommandLine (qemu_command.c:8789)
==12618==    by 0x526135: qemuBuildCommandLine (qemu_command.c:9843)
==12618==    by 0x48B4BA: qemuProcessCreatePretendCmd (qemu_process.c:5897)
==12618==    by 0x4378C9: testCompareXMLToArgv (qemuxml2argvtest.c:498)
==12618==    by 0x44D5A6: virTestRun (testutils.c:180)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agospec: Enable qemu driver for RHEL-7 on aarch64
Jiri Denemark [Fri, 27 Jan 2017 17:47:26 +0000 (18:47 +0100)] 
spec: Enable qemu driver for RHEL-7 on aarch64

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Add better message for some invalid block I/O settings
Martin Kletzander [Tue, 24 Jan 2017 13:52:33 +0000 (14:52 +0100)] 
qemu: Add better message for some invalid block I/O settings

For example when both total_bytes_sec and total_bytes_sec_max are set,
but the former gets cleaned due to new call setting, let's say,
read_bytes_sec, we end up with this weird message for the command:

 $ virsh blkdeviotune fedora vda --read-bytes-sec 3000
 error: Unable to change block I/O throttle
 error: unsupported configuration: value 'total_bytes_sec_max' cannot be set if 'total_bytes_sec' is not set

So let's make it more descriptive.  This is how it looks after the change:

 $ virsh blkdeviotune fedora vda --read-bytes-sec 3000
 error: Unable to change block I/O throttle
 error: unsupported configuration: cannot reset 'total_bytes_sec' when 'total_bytes_sec_max' is set

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agovirsh: Use consistent naming for blkdeviotune options
Martin Kletzander [Wed, 25 Jan 2017 08:38:09 +0000 (09:38 +0100)] 
virsh: Use consistent naming for blkdeviotune options

All options started with underscores, but we switched them to dashes
later on, making the style consistent.  The latest addition, however,
did not respect that, so let's change that as well.  It is tempting to
just change the name instead of adding alias, especially since nobody
ever used it, which we know thanks to the fact that it didn't work.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agovirsh: Actually make blkdeviotune --group_name work
Martin Kletzander [Wed, 25 Jan 2017 08:35:47 +0000 (09:35 +0100)] 
virsh: Actually make blkdeviotune --group_name work

Function vshCommandOptStringReq() returns -1 on error and 0 on
success.  The code, however, used the 'group_name' variable only if it
returned 1 (never).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: Miscellaneous Block I/O tune cleanups
Martin Kletzander [Thu, 26 Jan 2017 14:13:27 +0000 (15:13 +0100)] 
qemu: Miscellaneous Block I/O tune cleanups

Well, just two.  One indentation and the usage of 'ret'.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: Only set group_name when actually requested
Martin Kletzander [Tue, 24 Jan 2017 14:50:00 +0000 (15:50 +0100)] 
qemu: Only set group_name when actually requested

We were setting it based on whether it was supported and that lead to
setting it to NULL, which our JSON code caught.  However it ended up
producing the following results:

 $ virsh blkdeviotune fedora vda --total-bytes-sec-max 2000
 error: Unable to change block I/O throttle
 error: internal error: argument key 'group' must not have null value

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agotests: storage: Fix storage xml2xml test for vstorage pool
Peter Krempa [Fri, 27 Jan 2017 09:39:53 +0000 (10:39 +0100)] 
tests: storage: Fix storage xml2xml test for vstorage pool

The input and output were the same, but the output file did not
correspond to what libvirt would output.

8 years agoconfigure: Fix copy-paste error in vstorage backend check
Peter Krempa [Fri, 27 Jan 2017 09:37:56 +0000 (10:37 +0100)] 
configure: Fix copy-paste error in vstorage backend check

The 'fs' backend m4 code was copied, but one of the condition were not
changed which resulted into:

configure:    Gluster: yes
configure:        ZFS: yes
configure: Virtuozzo storage: check

Make the code turn on the virtuozzo driver automatically if the tools
are found.

8 years agodomain_conf: vnc: preserve autoport value if no port was specified
Pavel Hrdina [Wed, 25 Jan 2017 16:42:07 +0000 (17:42 +0100)] 
domain_conf: vnc: preserve autoport value if no port was specified

The issue is that if this graphics definition is provided:

  <graphics type='vnc' port='0'/>

it's parsed as:

  <graphics type='vnc' autoport='no'>
    <listen type='address'/>
  </graphics>

but if the resulting XML is parsed again the output is:

  <graphics type='vnc' port='-1' autoport='yes'>
    <listen type='address'/>
  </graphics>

and this should not happen.  The XML have to always remain the same
after it was already parsed by libvirt.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agodoc: improve VNC/SPICE password documentation
Pavel Hrdina [Wed, 25 Jan 2017 09:49:16 +0000 (10:49 +0100)] 
doc: improve VNC/SPICE password documentation

If the passwd attribute is set to empty string it disables VNC/SPICE
access to the guest.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agovirsh: Fix manpage typo
Nitesh Konkar [Thu, 19 Jan 2017 04:58:44 +0000 (10:28 +0530)] 
virsh: Fix manpage typo

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agovirsh: Modify description for LIBVIRT_DEBUG=4 in manpage
Nitesh Konkar [Wed, 18 Jan 2017 07:05:35 +0000 (12:35 +0530)] 
virsh: Modify description for LIBVIRT_DEBUG=4 in manpage

As LIBVIRT_DEBUG=4 logs only error messages and there
are no levels above it, adjusting the description in
the man page accordingly.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agovirnettlssessiontest.c: fix grammar
Nitesh Konkar [Wed, 25 Jan 2017 09:12:38 +0000 (14:42 +0530)] 
virnettlssessiontest.c: fix grammar

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agoperf: Prevent enabling of already enabled perf event
Nitesh Konkar [Tue, 24 Jan 2017 09:12:03 +0000 (14:42 +0530)] 
perf: Prevent enabling of already enabled perf event

Currently, on every --enable perf_event command,
a new event->fd is created and counting of perf
event counter starts from zero and previous
event->fd is lost. This patch prevents this
behaviour.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agodocs: Reword virsh manpage for --uuid --name --details options
Nitesh Konkar [Sat, 21 Jan 2017 14:38:29 +0000 (20:08 +0530)] 
docs: Reword virsh manpage for --uuid --name --details options

This commit is similar to commit 0977ada8.The virsh manpage
lists options --uuid and --name as mutually exclusive if
option --details is specified when actually the option
--details is mutually exclusive and can't go with options
--uuid and/or --name. This patch rewords the virsh manpage
to state the correct meaning.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
8 years agovstorage: Fix build
Olga Krishtal [Thu, 26 Jan 2017 16:44:26 +0000 (19:44 +0300)] 
vstorage: Fix build

Needed storage_util.h - missed while merging '5f07c3c07' with
commit id '479a2f16'.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
8 years agostorage: Fix build due to recent storage backend code movement
John Ferlan [Thu, 26 Jan 2017 16:43:30 +0000 (11:43 -0500)] 
storage: Fix build due to recent storage backend code movement

Commit id '5f07c3c07' broke the freebsd build in the libvirt CI test
environment because the UMOUNT was not defined unless WITH_STORAGE_FS
is defined.

So remove the virStorageBackendUmountLocal from storage_util.c,h and
restore the code back in the storage_backend_fs.c and _vstorage.c
modules.

8 years agostorage: vstorage pool documentation and simple test
Olga Krishtal [Tue, 17 Jan 2017 14:10:59 +0000 (17:10 +0300)] 
storage: vstorage pool documentation and simple test

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
8 years agostorage: Introduce Virtuozzo vstorage pool and volume APIs
Olga Krishtal [Tue, 17 Jan 2017 14:10:57 +0000 (17:10 +0300)] 
storage: Introduce Virtuozzo vstorage pool and volume APIs

Added create/define/etc pool operations for vstorage backend.

Used the common/local pool API's from storage_util for operations
that are not specific to vstorage. In particular Refresh and Delete
Pool operations as well as all the Volume operations.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
8 years agostorage: Introduce Virtuozzo vstorage backend
Olga Krishtal [Tue, 17 Jan 2017 14:10:55 +0000 (17:10 +0300)] 
storage: Introduce Virtuozzo vstorage backend

Added general definitions for vstorage pool backend including
the build options to add --with-storage-vstorage checking.
In order to use vstorage as a backend for a storage pool
vstorage tools (vstorage and vstorage-mount) need to be installed.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
8 years agostorage: Create common file/dir volume backend helpers
John Ferlan [Sat, 21 Jan 2017 14:05:41 +0000 (09:05 -0500)] 
storage: Create common file/dir volume backend helpers

Move all the volume functions to storage_util to create local/common helpers
using the same naming syntax as the existing upload, download, and wipe
virStorageBackend*Local API's.

In the process of doing so, found more API's that can now become local
to storage_util. In order to distinguish between local/external - I
changed the names of the now local only ones from "virStorageBackend..."
to just "storageBackend..."

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agostorage: Create common file/dir pool backend helpers
John Ferlan [Wed, 18 Jan 2017 19:17:21 +0000 (14:17 -0500)] 
storage: Create common file/dir pool backend helpers

Move some pool functions to storage_util to create local/common helpers
using the same naming syntax as the existing upload, download, and wipe
virStorageBackend*Local API's.

In the process of doing so, found a few API's that can now become local
to storage_util. In order to distinguish between local/external - I
changed the names of the now local only ones from "virStorageBackend..."
to just "storageBackend..."

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agostorage: Move the virStorageBackendFileSystem{Start|Stop} API's
John Ferlan [Sat, 21 Jan 2017 16:47:23 +0000 (11:47 -0500)] 
storage: Move the virStorageBackendFileSystem{Start|Stop} API's

Just moving code around with minor adjustment to have the Stop
code combine with the Unmount code since all the Stop code did
was call the Unmount code.

8 years agoqemu: Implement mtu on interface
Michal Privoznik [Mon, 23 Jan 2017 13:33:20 +0000 (14:33 +0100)] 
qemu: Implement mtu on interface

Not only we should set the MTU on the host end of the device but
also let qemu know what MTU did we set.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agodomain_conf: Introduce <mtu/> to <interface/>
Michal Privoznik [Mon, 23 Jan 2017 13:32:13 +0000 (14:32 +0100)] 
domain_conf: Introduce <mtu/> to <interface/>

So far we allow to set MTU for libvirt networks. However, not all
domain interfaces have to be plugged into a libvirt network and
even if they are, they might want to have a different MTU (e.g.
for testing purposes).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirDomainNetDefParseXML: s/ret/rv/
Michal Privoznik [Mon, 23 Jan 2017 11:58:23 +0000 (12:58 +0100)] 
virDomainNetDefParseXML: s/ret/rv/

We use @ret to hold the actual return value of the function we
are currently in. To hold a return value of a function called we
use different variables: @rv, @rc, etc. Honour this naming
scheme in virDomainNetDefParseXML too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoformatnetwork.html.in: Fix #elementsNICS anchor
Michal Privoznik [Mon, 23 Jan 2017 11:24:37 +0000 (12:24 +0100)] 
formatnetwork.html.in: Fix #elementsNICS anchor

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoTHREADS.txt: fix typos
Chen Hanxiao [Wed, 25 Jan 2017 06:35:42 +0000 (14:35 +0800)] 
THREADS.txt: fix typos

s/wakup/wakeup

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
8 years agotests: add xlconfig tests for <timer> configurations
Jim Fehlig [Fri, 20 Jan 2017 00:19:18 +0000 (17:19 -0700)] 
tests: add xlconfig tests for <timer> configurations

8 years agoxenconfig: add support for more timers
Jim Fehlig [Thu, 19 Jan 2017 23:51:05 +0000 (16:51 -0700)] 
xenconfig: add support for more timers

Currently xenconfig only supports the hpet timer for HVM domains.
Include support for tsc timer for both PV and HVM domains.

8 years agolibxl: support emulate mode of tsc timer
Jim Fehlig [Thu, 19 Jan 2017 23:21:34 +0000 (16:21 -0700)] 
libxl: support emulate mode of tsc timer

While at it, use members of libxl_tsc_mode enum instead of literal
int values.

8 years agolibxl: fix timer configuration
Jim Fehlig [Mon, 16 Jan 2017 22:37:40 +0000 (15:37 -0700)] 
libxl: fix timer configuration

The current logic around configuring timers in libxl based on
virDomainDef object is a bit brain dead. Unsupported timers are
silently ignored and tsc is only recognized if it is the first
timer specified.

Change the logic to reject unsupported timers and honor the tsc
timer regardless of its order when multiple timers are specified.