]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
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.

8 years agoconfigure: fix indentation in TLS priority result
Boris Fiuczynski [Tue, 24 Jan 2017 15:53:41 +0000 (16:53 +0100)]
configure: fix indentation in TLS priority result

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agoutil: Forbid resetting non-endpoint devices
Shivaprasad G Bhat [Mon, 23 Jan 2017 13:37:10 +0000 (19:07 +0530)]
util: Forbid resetting non-endpoint devices

It is destructive to attempt reset on a pci- or cardbus-bridge, the
host can crash.  The bridges won't contain any guest data and neither
they can be passed through using vfio/stub.  So, no point in allowing a
reset on them.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
8 years agoutil: Forbid assigning a pci-bridge to a guest
Shivaprasad G Bhat [Mon, 23 Jan 2017 13:36:29 +0000 (19:06 +0530)]
util: Forbid assigning a pci-bridge to a guest

Non-endpoint devices like pci-bridges cannot be assigned to guests.
Prevent such attempts.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
8 years agoutil: Fix typo in previous commit
John Ferlan [Sat, 21 Jan 2017 17:46:09 +0000 (12:46 -0500)]
util: Fix typo in previous commit

Should be Unlock not Lock... Bad fingers.

8 years agoutil: unlock closeCallbacks if get callbacks for connect fail
Wang King [Tue, 10 Jan 2017 06:23:49 +0000 (14:23 +0800)]
util: unlock closeCallbacks if get callbacks for connect fail

Avoid return with the closeCallbacks locked when get callbacks list for connect fail.

Signed-off-by: Wang King <king.wang@huawei.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu_domain: add timestamp in tainting of guests log
Chen Hanxiao [Fri, 20 Jan 2017 08:46:02 +0000 (16:46 +0800)]
qemu_domain: add timestamp in tainting of guests log

We lacked of timestamp in tainting of guests log,
which bring troubles for finding guest issues:
such as whether a guest powerdown caused by qemu-monitor-command
or others issues inside guests.
If we had timestamp in tainting of guests log,
it would be helpful when checking guest's /var/log/messages.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
8 years agovirDomainHostdevSubsysSCSIVHostDefParseXML: Don't leak @protocol
Michal Privoznik [Fri, 20 Jan 2017 14:52:08 +0000 (15:52 +0100)]
virDomainHostdevSubsysSCSIVHostDefParseXML: Don't leak @protocol

==24748== 12 bytes in 2 blocks are definitely lost in loss record 25 of 84
==24748==    at 0x4C2BF80: malloc (vg_replace_malloc.c:296)
==24748==    by 0x1A1E1E78: xmlStrndup (in /usr/lib64/libxml2.so.2.9.4)
==24748==    by 0x18D0495F: virXMLPropString (virxml.c:506)
==24748==    by 0x18D1FB3E: virDomainHostdevSubsysSCSIVHostDefParseXML (domain_conf.c:6280)
==24748==    by 0x18D20350: virDomainHostdevDefParseXMLSubsys (domain_conf.c:6450)
==24748==    by 0x18D34E7D: virDomainHostdevDefParseXML (domain_conf.c:13218)
==24748==    by 0x18D42598: virDomainDefParseXML (domain_conf.c:17745)
==24748==    by 0x18D440A9: virDomainDefParseNode (domain_conf.c:18236)
==24748==    by 0x18D43EFA: virDomainDefParse (domain_conf.c:18180)
==24748==    by 0x18D43FA0: virDomainDefParseFile (domain_conf.c:18206)
==24748==    by 0x44EDA1: testCompareDomXML2XMLFiles (testutils.c:1140)
==24748==    by 0x4365F8: testXML2XMLActive (qemuxml2xmltest.c:59)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Reset hostModelInfo in virQEMUCapsReset
Jiri Denemark [Wed, 18 Jan 2017 11:49:33 +0000 (12:49 +0100)]
qemu: Reset hostModelInfo in virQEMUCapsReset

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: set default vhost-user ifname
Michal Privoznik [Thu, 22 Dec 2016 09:33:28 +0000 (10:33 +0100)]
qemu: set default vhost-user ifname

Based on work of Mehdi Abaakouk <sileht@sileht.net>.

When parsing vhost-user interface XML and no ifname is found we
can try to fill it in in post parse callback. The way this works
is we try to make up interface name from given socket path and
then ask openvswitch whether it knows the interface.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: hotplug: Properly emit "DEVICE_DELETED" event when unplugging memory
Peter Krempa [Fri, 20 Jan 2017 13:24:35 +0000 (14:24 +0100)]
qemu: hotplug: Properly emit "DEVICE_DELETED" event when unplugging memory

The event needs to be emitted after the last monitor call, so that it's
not possible to find the device in the XML accidentally while the vm
object is unlocked.

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

8 years agobhyve: fix interface type handling for argv2xml
Roman Bogorodskiy [Fri, 6 Jan 2017 17:06:23 +0000 (21:06 +0400)]
bhyve: fix interface type handling for argv2xml

When generating a domain XML from native command (i.e. via
the connectDomainXMLFromNative call), we should use
interface type 'bridge' rather than 'ethernet' because we only
support bridges at this point.

As we don't have bridge name explicitly specified on the command line,
just use 'virbr0' as a default.

8 years agonss: Remove RES_USE_INET6 usage
Andrea Bolognani [Wed, 18 Jan 2017 17:30:18 +0000 (18:30 +0100)]
nss: Remove RES_USE_INET6 usage

The recent deprecation in glibc (commit b76e065991ec) means the
module will fail to build entirely:

  nss/libvirt_nss.c: In function '_nss_libvirt_gethostbyname_r':
  nss/libvirt_nss.c:363:13: error: RES_USE_INET6 is deprecated [-Werror]
     int af = ((_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This resolver option was removed shortly after being introduced,
and application using it are already broken anyway.

8 years agostorage: avoid use of undefined GLUSTER_CLI variable
Daniel P. Berrange [Thu, 19 Jan 2017 10:27:11 +0000 (10:27 +0000)]
storage: avoid use of undefined GLUSTER_CLI variable

Previous commit tried to change configure logic such that the
GLUSTER_CLI parameter would always be set:

  commit 9e97c8c0f0f3921d06bac2b92cd094a41373f748
  Author: Peter Krempa <pkrempa@redhat.com>
  Date:   Mon Jan 9 15:56:12 2017 +0100

    storage: gluster: Remove build-time dependency on the 'gluster' cli tool

This missed the fact that the AC_PATH_PROG call was itself inside an 'if'
conditional that would not be called in with_storage_gluster was false. As
a result, GLUSTER_CLI was still conditionally defined.

Just kill the GLUSTER_CLI parameter and AC_PATH_PROG call entirely and pass a
bare "gluster" string to virFindFileInPath instead.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agoqemu: catch failure of drive_add
Daniel P. Berrange [Tue, 17 Jan 2017 16:14:11 +0000 (16:14 +0000)]
qemu: catch failure of drive_add

Previously when QEMU failed "drive_add" due to an error opening
a file it would report

  "could not open disk image"

These days though, QEMU reports

  "Could not open '/tmp/virtd-test_e3hnhh5/disk1.qcow2': Permission denied"

which we were not detecting as an error condition.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
8 years agostorage: sheepdog: Split out functions required for tests
Peter Krempa [Mon, 16 Jan 2017 12:41:18 +0000 (13:41 +0100)]
storage: sheepdog: Split out functions required for tests

Separate the headers so that functions only required for testing of the
sheepdog backend are separated into their own file.

8 years agostorage: scsi: Remove private constants from header
Peter Krempa [Fri, 13 Jan 2017 16:52:41 +0000 (17:52 +0100)]
storage: scsi: Remove private constants from header

They are used only in the SCSI backend driver so there's no need to
pollute the headers.

8 years agostorage: scsi: Fix build if SCSI backend is disabled but iSCSI is enabled
Peter Krempa [Fri, 13 Jan 2017 16:48:00 +0000 (17:48 +0100)]
storage: scsi: Fix build if SCSI backend is disabled but iSCSI is enabled

The iSCSI backend driver was using stuff from the SCSI driver without
making sure that it's compiled in. Move the common code into the
storage_util.c since it does not contain any specific code.

8 years agostorage: fs: Compile file backends even if filesystem support is disabled
Peter Krempa [Fri, 13 Jan 2017 15:59:30 +0000 (16:59 +0100)]
storage: fs: Compile file backends even if filesystem support is disabled

The file backend code was mistakenly put into #if WITH_STORAGE_FS. This
is not necessary since all the backends just access files on disk, and
thus the code for WITH_STORAGE_DIR is sufficient to compile everything.

8 years agostorage: Split utility functions from storage_backend.(ch)
Peter Krempa [Wed, 11 Jan 2017 17:04:15 +0000 (18:04 +0100)]
storage: Split utility functions from storage_backend.(ch)

The file became a garbage dump for all kinds of utility functions over
time. Move them to a separate file so that the files can become a clean
interface for the storage backends.

8 years agostorage: Remove common code from specific driver backend
Peter Krempa [Thu, 12 Jan 2017 12:25:45 +0000 (13:25 +0100)]
storage: Remove common code from specific driver backend

The storage driver helper functions that deal with parted were put into
the disk backend code but are used commonly across.

8 years agotests: fix compilation of shunloadtest
Jim Fehlig [Mon, 16 Jan 2017 17:58:00 +0000 (10:58 -0700)]
tests: fix compilation of shunloadtest

While local builds succeed fine, a build worker building in a
chroot environment is encountering the following error with
libvirt 3.0.0 release candidates

[  162s] shunloadtest.o: In function `main':
[  162s] /home/abuild/rpmbuild/BUILD/libvirt-3.0.0/tests/shunloadtest.c:110: undefined reference to `dlopen'
[  162s] /home/abuild/rpmbuild/BUILD/libvirt-3.0.0/tests/shunloadtest.c:114: undefined reference to `dlsym'
[  162s] /home/abuild/rpmbuild/BUILD/libvirt-3.0.0/tests/shunloadtest.c:133: undefined reference to `dlclose'
[  162s] /home/abuild/rpmbuild/BUILD/libvirt-3.0.0/tests/shunloadtest.c:111: undefined reference to `dlerror'
[  162s] /home/abuild/rpmbuild/BUILD/libvirt-3.0.0/tests/shunloadtest.c:115: undefined reference to `dlerror'
[  162s] /home/abuild/rpmbuild/BUILD/libvirt-3.0.0/tests/shunloadtest.c:116: undefined reference to `dlclose'

Fix by appending DLOPEN_LIBS to shunloadtest_LDADD.

8 years agodocs: Add news.xml entry for pool --uuid and --name adjustments
John Ferlan [Wed, 18 Jan 2017 14:16:35 +0000 (09:16 -0500)]
docs: Add news.xml entry for pool --uuid and --name adjustments

8 years agovirsh: pool-list: allow both --uuid and --name in one cmd
Chen Hanxiao [Fri, 6 Jan 2017 14:42:53 +0000 (22:42 +0800)]
virsh: pool-list: allow both --uuid and --name in one cmd

This patch will allow --uuid and --name in one cmd.
The pool's UUID and name will be printed side by side.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
8 years agovirsh: pool-list: introduce --name for printing pool's name only
Chen Hanxiao [Fri, 6 Jan 2017 14:42:52 +0000 (22:42 +0800)]
virsh: pool-list: introduce --name for printing pool's name only

This patch will introduce option --name.
If specified, only name of pools will be printed out.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
8 years agovirsh: pool-list: introduce --uuid for printing pool's UUID only
Chen Hanxiao [Fri, 6 Jan 2017 14:42:51 +0000 (22:42 +0800)]
virsh: pool-list: introduce --uuid for printing pool's UUID only

This patch will introduce option --uuid.
If specified, only UUID of pools will be printed out.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
8 years agonodedev: Fabric name must not be required for fc_host capability
Boris Fiuczynski [Mon, 16 Jan 2017 13:27:34 +0000 (14:27 +0100)]
nodedev: Fabric name must not be required for fc_host capability

fabric_name is one of many fc_host attributes in Linux that is optional
and left to the low-level driver to decide if it is implemented.
The zfcp device driver does not provide a fabric name for an fcp host.

This patch removes the requirement for a fabric name by making it optional.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agoutil: add file exists check in virReadFCHost
Boris Fiuczynski [Mon, 16 Jan 2017 13:27:33 +0000 (14:27 +0100)]
util: add file exists check in virReadFCHost

File open errors are prevented by a file exists check before
virFileReadAll is called since all callers of the virReadFCHost
method handle errors themselves based on the NULL return anyway.
Also included is a minor spelling correction in a comment.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
8 years agodisk: Fixup error handling path for devmapper when part_separator='yes'
John Ferlan [Tue, 15 Nov 2016 19:37:01 +0000 (14:37 -0500)]
disk: Fixup error handling path for devmapper when part_separator='yes'

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

If libvirt_parthelper is erroneously told to append the partition
separator 'p' onto the generated output for a disk pool using device
mapper that has 'user_friendly_names' set to true, then the error
recovery path will fail to find volume resulting in the pool being
in an unusable state.

So, augment the documentation to provide the better hint that the
part_separator='yes' should be set when user_friendly_names are not
being used. Additionally, once we're in the error path where the
returned name doesn't match the expected partition name try to see
if the reason is because the 'p' was erroneosly added. If so alter
the about to be removed vol->target.path so that the DiskDeleteVol
code can find the partition that was created and remove it.

8 years agostorage: Allow probe of volume capacity for BLOCK type
John Ferlan [Tue, 6 Dec 2016 23:37:46 +0000 (18:37 -0500)]
storage: Allow probe of volume capacity for BLOCK type

If the voldef type is VIR_STORAGE_VOL_BLOCK, then as long as the
format is known, let's allow the probe to happen - gets a truer value
and the same probe/update would be allowed for the same volume defined
in a domain.