]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
9 years agoconf: Pass private data to Parse function of XML options
Martin Kletzander [Fri, 24 Jul 2015 17:35:00 +0000 (19:35 +0200)] 
conf: Pass private data to Parse function of XML options

This needs a reorder of XML option definitions.  It might come in handy
one day.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 7c8028cda95c3af388f7485e682ed07629bb9e7a)

9 years agoqemu: Fix segfault when parsing private domain data
Martin Kletzander [Thu, 13 Aug 2015 08:03:12 +0000 (10:03 +0200)] 
qemu: Fix segfault when parsing private domain data

When parsing private domain data, there are two paths that are flawed.
They are both error paths, just from different parts of the function.
One of them can call free() on an uninitialized pointer.  Initialization
to NULL is enough here.  The other one is a bit trickier to explain, but
as easy as the first one to fix.  We create capabilities, parse them and
then assign them into the private data pointer inside the domain object.
If, however, we get to fail from now on, the error path calls unrefs the
capabilities and then, when the domain object is being cleaned,
qemuDomainObjPrivateFree() tries to unref them as well.  That causes a
segfault.  Settin the pointer to NULL upon successful addition to the
private data is enough.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 92ddffdbd3c91d99f8f7ed9b661388a2c5d36cc2)

9 years agodomain: Fix crash if trying to live update disk <serial>
Cole Robinson [Mon, 10 Aug 2015 23:01:43 +0000 (19:01 -0400)] 
domain: Fix crash if trying to live update disk <serial>

If you pass <disk><serial> XML to UpdateDevice, and the original device
didn't have a <serial> block, libvirtd crashes trying to read the original
NULL serial string.

Use _NULLABLE string comparisons to avoid the crash. A couple other
properties needed the change too.

(cherry picked from commit c7790408d7e16b1ad00a690433d9310f104994f7)

9 years agovirNetSocketCheckProtocols: handle EAI_NONAME as IPv6 unavailable
Guido Günther [Tue, 11 Aug 2015 09:49:18 +0000 (11:49 +0200)] 
virNetSocketCheckProtocols: handle EAI_NONAME as IPv6 unavailable

When running the test suite using "unshare -n" we might have IPv6 but no
configured addresses. Due to AI_ADDRCONFIG getaddrinfo then fails with
EAI_NONAME which we should then treat as IPv6 unavailable.

(cherry picked from commit fbb27088eec1b54fcd5a0950b11c31d27a2598d4)

9 years agoutil: don't overwrite stack when getting ethtool gfeatures
Laine Stump [Tue, 11 Aug 2015 17:45:46 +0000 (13:45 -0400)] 
util: don't overwrite stack when getting ethtool gfeatures

This fixes the crash described here:

 https://www.redhat.com/archives/libvir-list/2015-August/msg00162.html

In short, we were calling ioctl(SIOCETHTOOL) pointing to a too-short
object that was a local on the stack, resulting in the memory past the
end of the object being overwritten. This was because the struct used
by the ETHTOOL_GFEATURES command of SIOCETHTOOL ends with a 0-length
array, but we were telling ethtool that it could use 2 elements on the
array.

The fix is to allocate the necessary memory with VIR_ALLOC_VAR(),
including the extra length needed for a 2 element array at the end.

(cherry picked from commit bfaaa2b681018f3705bae17c001700a03f67d7c4)

9 years agoconf: Don't try formating non-existing addresses
Martin Kletzander [Tue, 11 Aug 2015 13:09:29 +0000 (15:09 +0200)] 
conf: Don't try formating non-existing addresses

Commit a6f9af8292b6 added checking for address colisions between
starting and ending addresses of forwarding addresses, but forgot that
there might be no addresses set at all.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 1f24c1494a85d663fa36047922a7974a292a46a7)

9 years agoadmin: Drop 'internal.h' include from libvirt-admin.h
Erik Skultety [Mon, 10 Aug 2015 12:02:32 +0000 (14:02 +0200)] 
admin: Drop 'internal.h' include from libvirt-admin.h

This is a public library, it shouldn't include anything that is
internal. Including the library in it's current state to an example
application fails the preprocessor phase.

(cherry picked from commit eefec56b478e53f06c389ee75a21066b17606163)

9 years agoqemu: fail on attempts to use <filterref> for non-tap network connections
Laine Stump [Mon, 10 Aug 2015 06:05:29 +0000 (02:05 -0400)] 
qemu: fail on attempts to use <filterref> for non-tap network connections

nwfilter uses iptables and ebtables, which only work properly on
tap-based network connections (*not* on macvtap, for example), but we
just ignore any <filterref> elements for other types of networks,
potentially giving users a false sense of security.

This patch checks the network type and fails/logs an error if any
domain <interface> has a <filterref> when the connection isn't using a
tap device.

This resolves:

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

(cherry picked from commit f4f1d18dc464a4fd436ce9cdd18d6f06fa7494e5)

9 years agonetwork: validate network NAT range
Laine Stump [Sat, 8 Aug 2015 21:46:41 +0000 (17:46 -0400)] 
network: validate network NAT range

This patch modifies virSocketAddrGetRange() to function properly when
the containing network/prefix of the address range isn't known, for
example in the case of the NAT range of a virtual network (since it is
a range of addresses on the *host*, not within the network itself). We
then take advantage of this new functionality to validate the NAT
range of a virtual network.

Extra test cases are also added to verify that virSocketAddrGetRange()
works properly in both positive and negative cases when the network
pointer is NULL.

This is the *real* fix for:

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

Commits 1e334a and 48e8b9 had earlier been pushed as fixes for that
bug, but I had neglected to read the report carefully, so instead of
fixing validation for the NAT range, I had fixed validation for the
DHCP range. sigh.

(cherry picked from commit a6f9af8292b6462e509892b3a16acbcaaef61e4e)

9 years agovirNetDevBandwidthParseRate: Reject negative values
Michal Privoznik [Fri, 7 Aug 2015 15:03:12 +0000 (17:03 +0200)] 
virNetDevBandwidthParseRate: Reject negative values

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

The following XML really does not make any sense:

<inbound average="-1" burst="-2" peak="-3" floor="-4"/>

There can't be a negative packet rate. Well, so far we haven't
assigned any meaning to it. So reject it unless users harm themselves,
because otherwise we turn the negative numbers into really big values.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 2a5d3f227df7be78449792103e0101a4b859c49b)

9 years agonetwork: verify proper address family in updates to <host> and <range>
Laine Stump [Mon, 19 Jan 2015 22:04:01 +0000 (17:04 -0500)] 
network: verify proper address family in updates to <host> and <range>

By specifying parentIndex in a call to virNetworkUpdate(), it was
possible to direct libvirt to add a dhcp range or static host of a
non-matching address family to the <dhcp> element of an <ip>. For
example, given:

 <ip address='192.168.122.1' netmask='255.255.255.0'/>
 <ip family='ipv6' address='2001:db6:ca3:45::1' prefix='64'/>

you could provide a static host entry with an IPv4 address, and
specify that it be added to the 2nd <ip> element (index 1):

  virsh net-update default add ip-dhcp-host --parent-index 1 \
  '<host mac="52:54:00:00:00:01" ip="192.168.122.45"/>'

This would be happily added with no error (and no concern of any
possible future consequences).

This patch checks that any dhcp range or host element being added to a
network ip's <dhcp> subelement has addresses of the same family as the
ip element they are being added to.

This resolves:

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

(cherry picked from commit 6a21bc119e37bafcbe5cfd13e57080d651296b43)

9 years agoconf: more useful error message when pci function is out of range
Laine Stump [Wed, 22 Jul 2015 15:59:00 +0000 (11:59 -0400)] 
conf: more useful error message when pci function is out of range

If a pci address had a function number out of range, the error message
would be:

  Insufficient specification for PCI address

which is logged by virDevicePCIAddressParseXML() after
virDevicePCIAddressIsValid returns a failure.

This patch enhances virDevicePCIAddressIsValid() to optionally report
the error itself (since it is the place that decides which part of the
address is "invalid"), and uses that feature when calling from
virDevicePCIAddressParseXML(), so that the error will be more useful,
e.g.:

  Invalid PCI address function=0x8, must be <= 7

Previously, virDevicePCIAddressIsValid didn't check for the
theoretical limits of domain or bus, only for slot or function. While
adding log messages, we also correct that ommission. (The RNG for PCI
addresses already enforces this limit, which by the way means that we
can't add any negative tests for this - as far as I know our
domainschematest has no provisions for passing XML that is supposed to
fail).

Note that virDevicePCIAddressIsValid() can only check against the
absolute maximum attribute values for *any* possible PCI controller,
not for the actual maximums of the specific controller that this
device is attaching to; fortunately there is later more specific
validation for guest-side PCI addresses when building the set of
assigned PCI addresses. For host-side PCI addresses (e.g. for
<hostdev> and for network device pools), we rely on the error that
will be logged when it is found that the device doesn't actually
exist.

This resolves:

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

(cherry picked from commit f8fe8f03455783afcd62d79db7ce4120f514c629)

9 years agovirDomainDefParseXML: Check for malicious cpu ids in <numa/>
Michal Privoznik [Fri, 7 Aug 2015 14:36:38 +0000 (16:36 +0200)] 
virDomainDefParseXML: Check for malicious cpu ids in <numa/>

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

Some users think this is a good idea:

      <vcpu placement='static'>4</vcpu>
      <cpu mode='host-model'>
        <model fallback='allow'/>
        <numa>
          <cell id='0' cpus='0-1' memory='1048576' unit='KiB'/>
          <cell id='1' cpus='9-10' memory='2097152' unit='KiB'/>
        </numa>
      </cpu>

It's not. Lets therefore introduce a check and discourage them in
doing so.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 82af954c527e88111b05d50953b80eb4afde4d9a)

9 years agonuma_conf: Introduce virDomainNumaGetMaxCPUID
Michal Privoznik [Fri, 7 Aug 2015 14:31:57 +0000 (16:31 +0200)] 
numa_conf: Introduce virDomainNumaGetMaxCPUID

This function should return the greatest CPU number set in
/domain/cpu/numa/cell/@cpus. The idea is that we should compare
the returned value against /domain/vcpu value. Yes, there exist
users who think the following is a good idea:

  <vcpu placement='static'>4</vcpu>
  <cpu mode='host-model'>
    <model fallback='allow'/>
    <numa>
      <cell id='0' cpus='0-1' memory='1048576' unit='KiB'/>
      <cell id='1' cpus='9-10' memory='2097152' unit='KiB'/>
    </numa>
  </cpu>

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 8f2535dec1fdd969e86aa39c8a2583c723341733)

9 years agoAllow vfio hotplug of a device to the domain which owns the iommu
Shivaprasad G Bhat [Tue, 14 Jul 2015 11:56:33 +0000 (17:26 +0530)] 
Allow vfio hotplug of a device to the domain which owns the iommu

The commit 7e72de4 didn't consider the hotplug scenarios. The patch addresses
the hotplug case whereby if atleast one of the pci function is owned by a
guest, the hotplug of other functions/devices in the same iommu group to the
same guest goes through successfully.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
(cherry picked from commit e3810db34f1acb74dfcfd69219930e23a30284f6)

9 years agoqemu: Forbid image pre-creation for non-shared storage migration
Peter Krempa [Tue, 4 Aug 2015 08:12:30 +0000 (10:12 +0200)] 
qemu: Forbid image pre-creation for non-shared storage migration

Libvirt doesn't reliably know the location of the backing chain when
pre-creating images for non-shared migration. This isn't a problem for
full copy, but incremental copy requires the information.

Forbid pre-creating the image in cases where incremental migration is
required. This limitation can perhaps be lifted once libvirt will fully
support loading of backing chain information from the XML.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1249587
(cherry picked from commit 6da3b694cca436fcc38247aff9d1ce8e955292a8)

9 years agovirsh: fix domfsinfo output in quiet mode
Luyao Huang [Wed, 5 Aug 2015 03:17:22 +0000 (11:17 +0800)] 
virsh: fix domfsinfo output in quiet mode

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

When run domfsinfo in quiet mode, we cannot get any
useful information (just get \n), this is because
we didn't use vshPrint to print useful information.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
(cherry picked from commit ee6160b549568133d904aa27a553d66f0b0c01d3)

9 years agotests: extend workaround for gnutls private key loading failure
Daniel P. Berrange [Tue, 4 Aug 2015 11:26:15 +0000 (12:26 +0100)] 
tests: extend workaround for gnutls private key loading failure

In gnutls 3.4.3 there is a regression in the loading of private
keys via gnutls_x509_privkey_import. We already have a workaround
to deal with failures on older gnutls, but the error code that
the new gnutls returns is different. Extend the workaround so that
is checks for GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE too.

See also gnutls https://bugzilla.redhat.com/show_bug.cgi?id=1250020

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 3433180ec89195aef3c434d8c8d44d55b0bd6466)

9 years agoqemu: fix some api cannot work when disable cpuset in conf
Luyao Huang [Mon, 20 Jul 2015 09:18:37 +0000 (17:18 +0800)] 
qemu: fix some api cannot work when disable cpuset in conf

If cpuset is disabled or not available, it libvirt must not use it.
Mainly for actions that do not need it and can use sched_setaffinity()
or numa_membind() instead, because they will fail without good reason.

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

Signed-off-by: Luyao Huang <lhuang@redhat.com>
(cherry picked from commit 1439eb32afc9f97378d1d121c0b5c80d2f84896c)

9 years agostorage: only run safezero if allocation is > 0
Guido Günther [Sun, 23 Aug 2015 20:03:54 +0000 (22:03 +0200)] 
storage: only run safezero if allocation is > 0

While a zero allocation in safezero should be fine it isn't when we use
posix_fallocate which returns EINVAL on a zero allocation.

While we could skip the zero allocation in safezero_posix_fallocate it's
an optimization to do it for all allocations.

This fixes vm installation via virtinst for me which otherwise aborts
like:

   Starting install...
   Retrieving file linux...               | 5.9 MB     00:01 ...
   Retrieving file initrd.gz...           |  29 MB     00:07 ...
   ERROR    Couldn't create storage volume 'virtinst-linux.sBgds4': 'cannot fill file '/var/lib/libvirt/boot/virtinst-linux.sBgds4': Invalid argument'

The error was introduced by e30297b0 as spotted by Chunyan Liu

(cherry picked from commit 269d39afe5c59ecb3d3d64dba52f8cfa8d63d197)

9 years agoqemu: command: Report stderr from qemu-bridge-helper
Cole Robinson [Thu, 10 Sep 2015 16:35:00 +0000 (12:35 -0400)] 
qemu: command: Report stderr from qemu-bridge-helper

There's a couple reports of things failing in this area (bug 1259070),
but it's tough to tell what's going wrong without stderr from
qemu-bridge-helper. So let's report stderr in the error message

Couple new examples:

virbr0 is inactive:
internal error: /usr/libexec/qemu-bridge-helper --use-vnet --br=virbr0 --fd=21: failed to communicate with bridge helper: Transport endpoint is not connected
stderr=failed to get mtu of bridge `virbr0': No such device

bridge isn't on the ACL:
internal error: /usr/libexec/qemu-bridge-helper --use-vnet --br=br0 --fd=21: failed to communicate with bridge helper: Transport endpoint is not connected
stderr=access denied by acl file

(cherry picked from commit db35beaa1d276cc229dcbbc8460ce2fccdda5084)

9 years agoqemu: Fix reporting of physical capacity for block devices
Peter Krempa [Fri, 7 Aug 2015 09:01:49 +0000 (11:01 +0200)] 
qemu: Fix reporting of physical capacity for block devices

Qemu reports physical size 0 for block devices. As 15fa84acbb55ebfee6a4
changed the behavior of qemuDomainGetBlockInfo to just query the monitor
this created a regression since we didn't report the size correctly any
more.

This patch adds code to refresh the physical size of a block device by
opening it and seeking to the end and uses it both in
qemuDomainGetBlockInfo and also in qemuDomainGetStatsOneBlock that was
broken since it was introduced in this respect.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1250982
(cherry picked from commit 8dc27259255b79758367789ed272e909bdb56735)

9 years agoremoteClientCloseFunc: Don't mangle connection object refcount
Michal Privoznik [Thu, 3 Sep 2015 10:11:53 +0000 (12:11 +0200)] 
remoteClientCloseFunc: Don't mangle connection object refcount

Well, in 8ad126e6 we tried to fix a memory corruption problem.
However, the fix was not as good as it could be. I mean, the
commit has one line more than it should. I've noticed this output
just recently:

  # ./run valgrind --leak-check=full --show-reachable=yes ./tools/virsh domblklist gentoo
  ==17019== Memcheck, a memory error detector
  ==17019== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
  ==17019== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
  ==17019== Command: /home/zippy/work/libvirt/libvirt.git/tools/.libs/virsh domblklist gentoo
  ==17019==
  Target     Source
  ------------------------------------------------
  fda        /var/lib/libvirt/images/fd.img
  vda        /var/lib/libvirt/images/gentoo.qcow2
  hdc        /home/zippy/tmp/install-amd64-minimal-20150402.iso

  ==17019== Thread 2:
  ==17019== Invalid read of size 4
  ==17019==    at 0x4EFF5B4: virObjectUnref (virobject.c:258)
  ==17019==    by 0x5038CFF: remoteClientCloseFunc (remote_driver.c:552)
  ==17019==    by 0x5069D57: virNetClientCloseLocked (virnetclient.c:685)
  ==17019==    by 0x506C848: virNetClientIncomingEvent (virnetclient.c:1852)
  ==17019==    by 0x5082136: virNetSocketEventHandle (virnetsocket.c:1913)
  ==17019==    by 0x4ECD64E: virEventPollDispatchHandles (vireventpoll.c:509)
  ==17019==    by 0x4ECDE02: virEventPollRunOnce (vireventpoll.c:658)
  ==17019==    by 0x4ECBF00: virEventRunDefaultImpl (virevent.c:308)
  ==17019==    by 0x130386: vshEventLoop (vsh.c:1864)
  ==17019==    by 0x4F1EB07: virThreadHelper (virthread.c:206)
  ==17019==    by 0xA8462D3: start_thread (in /lib64/libpthread-2.20.so)
  ==17019==    by 0xAB441FC: clone (in /lib64/libc-2.20.so)
  ==17019==  Address 0x139023f4 is 4 bytes inside a block of size 240 free'd
  ==17019==    at 0x4C2B1F0: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==17019==    by 0x4EA8949: virFree (viralloc.c:582)
  ==17019==    by 0x4EFF6D0: virObjectUnref (virobject.c:273)
  ==17019==    by 0x4FE74D6: virConnectClose (libvirt.c:1390)
  ==17019==    by 0x13342A: virshDeinit (virsh.c:406)
  ==17019==    by 0x134A37: main (virsh.c:950)

The problem is, when registering remoteClientCloseFunc(), it's
conn->closeCallback which is ref'd. But in the function itself
it's conn->closeCallback->conn what is unref'd. This is causing
imbalance in reference counting. Moreover, there's no need for
the remote driver to increase/decrease conn refcount since it's
not used anywhere. It's just merely passed to client registered
callback. And for that purpose it's correctly ref'd in
virConnectRegisterCloseCallback() and then unref'd in
virConnectUnregisterCloseCallback().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit e68930077034f786e219bdb015f8880dbc5a246f)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agostorage: Correct the 'mode' check
John Ferlan [Mon, 24 Aug 2015 16:48:40 +0000 (12:48 -0400)] 
storage: Correct the 'mode' check

Commit id '7c2d65dde2' changed the default value of mode to be -1 if not
supplied in the XML, which should cause creation of the volume using the
default mode of VIR_STORAGE_DEFAULT_VOL_PERM_MODE; however, the check
made was whether mode was '0' or not to use default or provided value.

This patch fixes the issue to check if the 'mode' was provided in the XML
and use that value.

(cherry picked from commit 691dd388aee99f8b06177540303b690586d5f5b3)

9 years agostorage: Handle failure from refreshVol
John Ferlan [Mon, 24 Aug 2015 16:38:13 +0000 (12:38 -0400)] 
storage: Handle failure from refreshVol

Commit id '155ca616' added the 'refreshVol' API. In an NFS root-squash
environment it was possible that if the just created volume from XML wasn't
properly created with the right uid/gid and/or mode, then the followup
refreshVol will fail to open the volume in order to get the allocation/
capacity values. This would leave the volume still on the server and
cause a libvirtd crash because 'voldef' would be in the pool list, but
the cleanup code would free it.

(cherry picked from commit db9277a39bc364806e8d3e08a08fc128d59b7094)

9 years agovirfile: Introduce virFileUnlink
John Ferlan [Mon, 24 Aug 2015 21:00:02 +0000 (17:00 -0400)] 
virfile: Introduce virFileUnlink

In an NFS root-squashed environment the 'vol-delete' command will fail to
'unlink' the target volume since it was created under a different uid:gid.

This code continues the concepts introduced in virFileOpenForked and
virDirCreate[NoFork] with respect to running the unlink command under
the uid/gid of the child. Unlike the other two, don't retry on EACCES
(that's why we're here doing this now).

(cherry picked from commit 35847860f65f92e444db9730e00cdaef45198e0c)

9 years agoRevert "LXC: show used memory as 0 when domain is not active"
Jim Fehlig [Mon, 10 Aug 2015 18:49:55 +0000 (12:49 -0600)] 
Revert "LXC: show used memory as 0 when domain is not active"

This reverts commit 1ce7c1d20cfd5afb26d2dbc88201085d52415d0e,
which introduced a significant semantic change to the
virDomainGetInfo() API. Additionally, the change was only
made to 2 of the 15 virt drivers.

Conflicts:
src/qemu/qemu_driver.c

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
(cherry picked from commit 60acb38abbee1636a9cddf8d296f700d115c8f77)

10 years agoRelease of libvirt-1.2.18 v1.2.18
Daniel Veillard [Mon, 3 Aug 2015 09:36:39 +0000 (17:36 +0800)] 
Release of libvirt-1.2.18

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

10 years agoqemu: Do not reset labels when migration fails
Jiri Denemark [Thu, 30 Jul 2015 14:42:43 +0000 (16:42 +0200)] 
qemu: Do not reset labels when migration fails

When stopping a domain on the destination host after a failed migration,
we need to avoid reseting security labels since the domain is still
running on the source host. While we were correctly doing so in some
cases, there were still some paths which did this wrong.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoqemu: Properly check for incoming migration job
Jiri Denemark [Thu, 30 Jul 2015 13:53:41 +0000 (15:53 +0200)] 
qemu: Properly check for incoming migration job

In addition to checking the current asynchronous job
qemuMigrationJobIsActive reports an error if the current job does not
match the one we asked for. Let's just check the job directly since we
are not interested in the error in qemuProcessHandleMonitorEOF.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agoqemu: Reject migration with memory-hotplug if destination doesn't support it
Peter Krempa [Thu, 30 Jul 2015 13:27:07 +0000 (15:27 +0200)] 
qemu: Reject migration with memory-hotplug if destination doesn't support it

If destination libvirt doesn't support memory hotplug since all the
support was introduced by adding new elements the destination would
attempt to start qemu with an invalid configuration. The worse part is
that qemu might hang in such situation.

Fix this by sending a required migration feature called 'memory-hotplug'
to the destination. If the destination doesn't recognize it it will fail
the migration.

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

10 years agoFix syntax-check: missing "%s" v1.2.18-rc2
Cédric Bosdonnat [Thu, 30 Jul 2015 09:10:48 +0000 (11:10 +0200)] 
Fix syntax-check: missing "%s"

10 years agoLoad nbd module before running qemu-nbd
Cédric Bosdonnat [Mon, 20 Jul 2015 12:37:48 +0000 (14:37 +0200)] 
Load nbd module before running qemu-nbd

So far qemu-nbd is run even if the nbd kernel module isn't loaded. This
leads to errors when the user starts his lxc container while libvirt
could easily load the nbd module automatically.

10 years agoqemu: Adjust VM id allocation
Erik Skultety [Tue, 28 Jul 2015 15:33:53 +0000 (17:33 +0200)] 
qemu: Adjust VM id allocation

Our atomic increment (virAtomicIntInc) uses (if available) gcc
__sync_add_and_fetch builtin. In qemu driver though, we'd profit more
from __sync_fetch_and_add builtin. To keep it simplistic, this patch
adjusts qemu driver initialization rather than adding a new atomic
increment macro.

10 years agolxc: Don't accidentaly reset autostart flag in virLXCProcessCleanup
Peter Krempa [Tue, 28 Jul 2015 16:25:59 +0000 (18:25 +0200)] 
lxc: Don't accidentaly reset autostart flag in virLXCProcessCleanup

virDomainDeleteConfig is meant to delete the persistent config and thus
it resets vm->autostart. Copy parts of qemuProcessRemoveDomainStatus to
a new helper to avoid using the incorrect function.

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

10 years agoremote: fix typo in remoteDomainOpenGraphicsFD
Daniel P. Berrange [Mon, 27 Jul 2015 09:29:59 +0000 (10:29 +0100)] 
remote: fix typo in remoteDomainOpenGraphicsFD

The remoteDomainOpenGraphicsFD method was using the wrong RPC
arg struct remote_domain_open_graphics_args instead of
remote_domain_open_graphics_fd_args. Fortunately both structs
had identical contents so there was no functional bug, but to
avoid confusing future maintainers, we should fix it.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agoadmin: Tiny cleanups
Martin Kletzander [Wed, 22 Jul 2015 09:01:58 +0000 (11:01 +0200)] 
admin: Tiny cleanups

First hunk changes the use of srcdir to top_srcdir so it complies with
other rules in the Makefile.  Second one removes the need of
remote_protocol.h in admin_protocol.h as it was suggested and worked in,
but this one line was missed apparently.  Last one just removes the
'remote' naming from admin protocol specification, just so it's cleaner.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: Check for iotune_max support properly
Martin Kletzander [Mon, 27 Jul 2015 06:04:06 +0000 (08:04 +0200)] 
qemu: Check for iotune_max support properly

Commit d506a51aeb2a7a7b0c963f760e32b94376ea7173 meant to check for
QEMU_CAPS_DRIVE_IOTUNE_MAX, but checked for QEMU_CAPS_DRIVE_IOTUNE
instead.  That's clearly visible from the diff, but it got in.  Because
of that, we were supplying information unknown for QEMU if it wasn't new
enough and we couldn't even properly handle the error, leading to
"Unexpected error".  Also iops_size came at the same time with all the
other "_max" options, so check whether we're not setting that either if
QEMU_CAPS_DRIVE_IOTUNE_MAX is not supported.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agotests: Finish rename of the long nodeinfo test case
Martin Kletzander [Mon, 27 Jul 2015 06:22:24 +0000 (08:22 +0200)] 
tests: Finish rename of the long nodeinfo test case

Commit 2094d01e2f54e5774c0d0d380e83154b42ea65be forgot to rename two
more files.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoRenamed deconfigured-cpus to allow make dist v1.2.18-rc1
Daniel Veillard [Mon, 27 Jul 2015 02:17:05 +0000 (10:17 +0800)] 
Renamed deconfigured-cpus to allow make dist

Simplest was just to rename that extra long name and move files in git
accordingly

10 years agoconf: add virDomainControllerDefNew()
Laine Stump [Thu, 25 Jun 2015 16:55:12 +0000 (12:55 -0400)] 
conf: add virDomainControllerDefNew()

There are some non-0 default values in virDomainControllerDef (and
will soon be more) that are easier to not forget if the remembering is
done by a single initializer function (rather than inline code after
allocating the obejct with generic VIR_ALLOC().

10 years agoqemu: reorganize loop in qemuDomainAssignPCIAddresses
Laine Stump [Thu, 25 Jun 2015 16:02:32 +0000 (12:02 -0400)] 
qemu: reorganize loop in qemuDomainAssignPCIAddresses

This loop occurs just after we've assured that all devices that
require a PCI device have been assigned and all necessary PCI
controllers have been added. It is the perfect place to add other
potentially auto-generated PCI controller attributes that are
dependent on the controller's PCI address (upcoming patch).

There is a convenient loop through all controllers at the end of the
function, but the patch to add new functionality will be cleaner if we
first rearrange that loop a bit.

Note that the loop originally was accessing info.addr.pci.bus prior to
determining that the pci part of the object was valid. This isn't
dangerous in any way, but seemed a bit ugly, so I fixed it.

10 years agoconf: pay attention to bus minSlot/maxSlot when autoassigning PCI addresses
Laine Stump [Thu, 16 Jul 2015 20:28:47 +0000 (16:28 -0400)] 
conf: pay attention to bus minSlot/maxSlot when autoassigning PCI addresses

The function that auto-assigns PCI addresses was written with the
hardcoded assumptions that any PCI bus would have slots available
starting at 1 and ending at 31. This isn't true for many types of
controllers (some have a single slot/port at 0, some have slots/ports
from 0 to 31). This patch updates that function to remove the
hardcoded assumptions. It will properly find/assign addresses for
devices that can only connect to pcie-(root|downstream)-port (which
have minSlot/maxSlot of 0/0) or a pcie-switch-upstream-port (0/31).

It still will not auto-create a new bus of the proper kind for these
connections when one doesn't exist, that task is for another day.

10 years agotests: add vol-qcow2-zerocapacity test to storagevolxml2argvtest
Chris J Arges [Tue, 30 Jun 2015 20:19:04 +0000 (15:19 -0500)] 
tests: add vol-qcow2-zerocapacity test to storagevolxml2argvtest

Add a testcase for the previous change to ensure zero capacity volumes can be
defined without a backing store.

Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
10 years agostorage: allow zero capacity with non-backing file to be created
Chris J Arges [Tue, 30 Jun 2015 20:19:03 +0000 (15:19 -0500)] 
storage: allow zero capacity with non-backing file to be created

In commit 155ca616e, a change was introduced that no longer allowed defining
volumes via XML with a capacity of '0'. Because we check for info.size_arg
to be non-zero, this use-case fails. This patch allows info.size_arg to be
zero if no backing store is specified.

Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
10 years agonodeinfo: Check for SYSFS_INFINIBAND_DIR before open
John Ferlan [Thu, 23 Jul 2015 18:33:32 +0000 (14:33 -0400)] 
nodeinfo: Check for SYSFS_INFINIBAND_DIR before open

Commit id 'ac3ed2085' causes 'virsh nodedev-list --cap net' to fail
on any system without SYSFS_INFINIBAND_DIR (/sys/class/infiniband).

Rather than assume it's there and fail on the attempt to open the
non-existent directory, check if it's there - if not, return
success and move on. Also fix caller to check < 0 upon return.

As reported by Suren Hajyan <shajyan@redhat.com> from run of unit tests

10 years agofix typo in qemu_monitor
Cao jin [Fri, 24 Jul 2015 11:53:36 +0000 (19:53 +0800)] 
fix typo in qemu_monitor

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
10 years agoRevert "qemu: Use heads parameter for QXL driver"
Martin Kletzander [Wed, 22 Jul 2015 07:59:48 +0000 (09:59 +0200)] 
Revert "qemu: Use heads parameter for QXL driver"

This reverts commit 7b401c3bdacdf8367a0070e625d73eafb802045d.

Until libvirt is able to differentiate whether heads='1' is just a
leftover from previous libvirt or whether that's added by user on
purpose and also whether the domain was started with the support for
qxl's max_outputs, we cannot incorporate this patch into the tree
due to compatibility reasons.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agotest: introduce a function in test driver to check get vcpupin info
Luyao Huang [Tue, 14 Jul 2015 13:10:50 +0000 (21:10 +0800)] 
test: introduce a function in test driver to check get vcpupin info

As there is a regression in use vcpupin get info, introduce a new function
to test the virsh client.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
10 years agoconf: reorganize virNetworkDHCPDefParseXML
Laine Stump [Thu, 21 May 2015 19:51:02 +0000 (15:51 -0400)] 
conf: reorganize virNetworkDHCPDefParseXML

This makes the range and static host array management in
virNetworkDHCPDefParseXML() more similar to what is done in
virNetworkDefUpdateIPDHCPRange() and virNetworkDefUpdateIPDHCPHost() -
they use VIR_APPEND_ELEMENT rather than a combination of
VIR_REALLOC_N() and separate incrementing of the array size.

The one functional change here is that a memory leak of the contents
of the last (unsuccessful) virNetworkDHCPHostDef was previously leaked
in certain failure conditions, but it is now properly cleaned up.

10 years agonodeinfo: Check for errors when reading core_id
Andrea Bolognani [Thu, 23 Jul 2015 09:47:05 +0000 (11:47 +0200)] 
nodeinfo: Check for errors when reading core_id

10 years agodocs: bhyve: document clock configuration
Roman Bogorodskiy [Sun, 19 Jul 2015 08:20:36 +0000 (11:20 +0300)] 
docs: bhyve: document clock configuration

10 years agobhyve: add UTC clock support
Roman Bogorodskiy [Sun, 19 Jul 2015 08:20:35 +0000 (11:20 +0300)] 
bhyve: add UTC clock support

Bhyve as of r279225 (FreeBSD -CURRENT) or r284894 (FreeBSD 10-STABLE)
supports using UTC time offset via the '-u' argument to bhyve(8). By
default it's still using localtime.

Make the bhyve driver use UTC clock if it's requested by specifying
<clock offset='utc'> in domain XML and if the bhyve(8) binary supports
the '-u' flag.

10 years agonetdev: fix build on FreeBSD
Roman Bogorodskiy [Wed, 22 Jul 2015 15:24:34 +0000 (18:24 +0300)] 
netdev: fix build on FreeBSD

Commit ac3ed20 breaks build on FreeBSD with:

  CC       util/libvirt_util_la-virnetdev.lo
util/virnetdev.c:2967:1: error: unused function 'virNetDevRDMAFeature' [-Werror,-Wunused-function]
virNetDevRDMAFeature(const char *ifname,
^

So hide virNetDevRDMAFeature function under the #ifdef 'SIOCETHTOOL'
and 'HAVE_STRUCT_IFREQ' section.

Pushed under the build breaker rule.

10 years agoconfigure: clarify rationale for checking pkcheck
Daniel P. Berrange [Tue, 21 Jul 2015 16:52:03 +0000 (17:52 +0100)] 
configure: clarify rationale for checking pkcheck

We don't need pkcheck binary, but we must detect it in order
to see if we're preferring polkit-1 over polkit-0 when both
are installed. We should also check $with_dbus to see if we
have dbus-devel available, as that's required to talk to
polkit-1.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
10 years agoqemu: fix the error cover issue in SetMemoryParameters
Luyao Huang [Wed, 22 Jul 2015 07:35:14 +0000 (15:35 +0800)] 
qemu: fix the error cover issue in SetMemoryParameters

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

We won't return the errno after commit 0d7f45ae, and
the more clearly error will be set in the code in vircgroup*.
Also We will always report error "Operation not permitted",
because the return is -1.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
10 years agonodeinfo: Calculate present and online CPUs only once
Andrea Bolognani [Mon, 20 Jul 2015 16:37:30 +0000 (18:37 +0200)] 
nodeinfo: Calculate present and online CPUs only once

Move the calls to the respective functions from virNodeParseNode(),
which is executed once for every NUMA node, to
linuxNodeInfoCPUPopulate(), which is executed just once per host.

10 years agonodeinfo: Use a bitmap to keep track of node CPUs
Andrea Bolognani [Mon, 20 Jul 2015 16:37:29 +0000 (18:37 +0200)] 
nodeinfo: Use a bitmap to keep track of node CPUs

Keep track of what CPUs belong to the current node while walking
through the sysfs node entry, so we don't need to do it a second
time immediately afterwards.

This also allows us to loop through all CPUs that are part of a
node in guaranteed ascending order, which is something that is
required for some upcoming changes.

10 years agonodeinfo: Use nodeGetOnlineCPUBitmap() when parsing node
Andrea Bolognani [Mon, 20 Jul 2015 16:37:28 +0000 (18:37 +0200)] 
nodeinfo: Use nodeGetOnlineCPUBitmap() when parsing node

No need to look up the online status of each CPU separately when we
can get all the information in one go.

10 years agonodeinfo: Phase out cpu_set_t usage
Andrea Bolognani [Mon, 20 Jul 2015 16:37:27 +0000 (18:37 +0200)] 
nodeinfo: Phase out cpu_set_t usage

Swap out all instances of cpu_set_t and replace them with virBitmap,
which some of the code was already using anyway.

The changes are pretty mechanical, with one notable exception: an
assumption has been added on the max value we can run into while
reading either socket_it or core_id.

While this specific assumption was not in place before, we were
using cpu_set_t improperly by not making sure not to set any bit
past CPU_SETSIZE or explicitly allocating bigger bitmaps; in fact
the default size of a cpu_set_t, 1024, is way too low to run our
testsuite, which includes core_id values in the 2000s.

10 years agonodeinfo: Rename nodeGetCPUBitmap() to nodeGetOnlineCPUBitmap()
Andrea Bolognani [Mon, 20 Jul 2015 16:37:26 +0000 (18:37 +0200)] 
nodeinfo: Rename nodeGetCPUBitmap() to nodeGetOnlineCPUBitmap()

The new name makes it clear that the returned bitmap contains the
information about which CPUs are online, not eg. which CPUs are
present.

No behavioral change.

10 years agonodeinfo: Remove out parameter from nodeGetCPUBitmap()
Andrea Bolognani [Mon, 20 Jul 2015 16:37:25 +0000 (18:37 +0200)] 
nodeinfo: Remove out parameter from nodeGetCPUBitmap()

Not all users of this API will need the size of the returned
bitmap; those who do can simply call virBitmapSize() themselves.

10 years agonodeinfo: Add old kernel compatibility to nodeGetPresentCPUBitmap()
Andrea Bolognani [Mon, 20 Jul 2015 16:37:24 +0000 (18:37 +0200)] 
nodeinfo: Add old kernel compatibility to nodeGetPresentCPUBitmap()

If the cpu/present file is not available, we assume that the kernel
is too old to support non-consecutive CPU ids and return a bitmap
with all the bits set to represent this fact. This assumption is
already exploited in nodeGetCPUCount().

This means users of this API can expect the information to always
be available unless an error has occurred, and no longer need to
treat the NULL return value as a special case.

The error message has been updated as well.

10 years agonodeinfo: Rename linuxParseCPUmax() to linuxParseCPUCount()
Andrea Bolognani [Mon, 20 Jul 2015 16:37:23 +0000 (18:37 +0200)] 
nodeinfo: Rename linuxParseCPUmax() to linuxParseCPUCount()

The original name was confusing because the function returns the number
of CPUs, not the maximum CPU id. The comment above the function has
been updated to reflect this.

No behavioral changes.

10 years agonodeinfo: Introduce linuxGetCPUOnlinePath()
Andrea Bolognani [Mon, 20 Jul 2015 16:37:22 +0000 (18:37 +0200)] 
nodeinfo: Introduce linuxGetCPUOnlinePath()

10 years agonodeinfo: Introduce linuxGetCPUGlobalPath()
Andrea Bolognani [Mon, 20 Jul 2015 16:37:21 +0000 (18:37 +0200)] 
nodeinfo: Introduce linuxGetCPUGlobalPath()

This is just a more generic version of linuxGetCPUPresentPath(),
which is now implemented by calling the new function appropriately.

10 years agonodeinfo: Fix nodeGetCPUBitmap()'s fallback code path
Andrea Bolognani [Fri, 17 Jul 2015 16:12:50 +0000 (18:12 +0200)] 
nodeinfo: Fix nodeGetCPUBitmap()'s fallback code path

During the recent refactoring/cleanups, a bug has been introduced
that caused all CPUs to be reported as online unless the sysfs
cpu/present file was available.

This commit fixes the fallback code path by building the directory
path passed to virNodeGetCpuValue() correctly.

10 years agonodeinfo: Add nodeGetPresentCPUBitmap() to libvirt_private.syms
Andrea Bolognani [Fri, 17 Jul 2015 16:12:49 +0000 (18:12 +0200)] 
nodeinfo: Add nodeGetPresentCPUBitmap() to libvirt_private.syms

10 years agotests: Restore links in deconfigured-cpus nodeinfo test
Andrea Bolognani [Fri, 17 Jul 2015 16:12:48 +0000 (18:12 +0200)] 
tests: Restore links in deconfigured-cpus nodeinfo test

When cleaning up the data (taken from a running system) for inclusion
I went a little too far and deleted a bunch of links that should have
been left alone. The test worked despite this because it was going
through a fallback code path.

A few other files are affected as well: again, the data is taken from
a running system, so even thought we would probably be okay if we
just added the links, aligning everything is definitely safer.

10 years agocgroup: Drop resource partition from virSystemdMakeScopeName
Peter Krempa [Thu, 16 Jul 2015 13:35:05 +0000 (15:35 +0200)] 
cgroup: Drop resource partition from virSystemdMakeScopeName

The scope name, even according to our docs is
"machine-$DRIVER\x2d$VMNAME.scope" virSystemdMakeScopeName would use the
resource partition name instead of "machine-" if it was specified thus
creating invalid scope paths.

This makes libvirt drop cgroups for a VM that uses custom resource
partition upon reconnecting since the detected scope name would not
match the expected name generated by virSystemdMakeScopeName.

The error is exposed by the following log entry:

debug : virCgroupValidateMachineGroup:302 : Name 'machine-qemu\x2dtestvm.scope' for controller 'cpu' does not match 'testvm', 'testvm.libvirt-qemu' or 'machine-test-qemu\x2dtestvm.scope'

for a "/machine/test" resource and "testvm" vm.

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

10 years agospec: Fix polkit dep on F23
Cole Robinson [Tue, 14 Jul 2015 18:42:28 +0000 (14:42 -0400)] 
spec: Fix polkit dep on F23

As of fedora polkit-0.113-2, polkit-devel only pulls in polkit-libs, not
full polkit, but we need the latter for pkcheck otherwise our configure
test fails.

10 years agovirsh: Refactor block job waiting in cmdBlockCopy
Peter Krempa [Mon, 13 Jul 2015 15:04:49 +0000 (17:04 +0200)] 
virsh: Refactor block job waiting in cmdBlockCopy

Similarly to the refactor of cmdBlockCommit in a previous commit this
does the same change for cmdBlockCopy.

10 years agovirsh: Refactor block job waiting in cmdBlockCommit
Peter Krempa [Mon, 13 Jul 2015 15:04:49 +0000 (17:04 +0200)] 
virsh: Refactor block job waiting in cmdBlockCommit

Reuse the vshBlockJobWait infrastructure to refactor cmdBlockCommit to
use the common code. This additionally fixes a bug when working with
new qemus, where when doing an active commit with --pivot the pivoting
would fail, since qemu reaches 100% completion but the job doesn't
switch to synchronized phase right away.

10 years agovirsh: Refactor block job waiting in cmdBlockPull
Peter Krempa [Mon, 13 Jul 2015 15:04:49 +0000 (17:04 +0200)] 
virsh: Refactor block job waiting in cmdBlockPull

Introduce helper function that will provide logic for waiting for block
job completion so the 3 open coded places can be unified and improved.

This patch introduces the whole logic and uses it to fix
cmdBlockJobPull. The vshBlockJobWait function provides common logic for
block job waiting that should be robust enough to work across all
previous versions of libvirt. Since virsh allows passing user-provided
strings as paths of block devices we can't reliably use block job events
for detection of block job states so the function contains a great deal
of fallback logic.

10 years agoqemu: Update state of block job to READY only if it actually is ready
Peter Krempa [Wed, 15 Jul 2015 13:11:02 +0000 (15:11 +0200)] 
qemu: Update state of block job to READY only if it actually is ready

Few parts of the code looked at the current progress of and assumed that
a two phase blockjob is in the _READY state as soon as the progress
reached 100% (info.cur == info.end). In current versions of qemu this
assumption is invalid and qemu exposes a new flag 'ready' in the
query-block-jobs output that is set to true if the job is actually
finished.

This patch adds internal data handling for reading the 'ready' flag and
acting appropriately as long as the flag is present.

While this still doesn't fix the virsh client problem with two phase
block jobs and the --pivot option, it at least improves the error
message:

$ virsh blockcommit  --wait --verbose vm vda  --base vda[1] --active --pivot
Block commit: [100 %]error: failed to pivot job for disk vda
error: internal error: unable to execute QEMU command 'block-job-complete': The active block job for device 'drive-virtio-disk0' cannot be completed

to

$ virsh blockcommit  --wait --verbose VM vda  --base vda[1] --active --pivot
Block commit: [100 %]error: failed to pivot job for disk vda
error: block copy still active: disk 'vda' not ready for pivot yet

10 years agovirsh: Refactor argument handling in cmdBlockPull
Peter Krempa [Tue, 14 Jul 2015 10:56:27 +0000 (12:56 +0200)] 
virsh: Refactor argument handling in cmdBlockPull

Put all argument parsing together and refactor the argument checking
code.

10 years agovirsh: Refactor argument handling in cmdBlockCopy
Peter Krempa [Tue, 14 Jul 2015 10:56:27 +0000 (12:56 +0200)] 
virsh: Refactor argument handling in cmdBlockCopy

Put all argument parsing together and refactor the argument checking
code.

10 years agovirsh: Refactor argument checking in cmdBlockCommit
Peter Krempa [Mon, 13 Jul 2015 14:23:59 +0000 (16:23 +0200)] 
virsh: Refactor argument checking in cmdBlockCommit

Use the VSH_EXCLUSIVE_OPTIONS to exclude combinations of --pivot and
--keep-overlay and refactor the enforcing of the --wait option and other
flags that imply --wait.

10 years agovirsh: Kill blockJobImpl by moving the final impl into cmdBlockCommit
Peter Krempa [Thu, 30 Apr 2015 14:31:36 +0000 (16:31 +0200)] 
virsh: Kill blockJobImpl by moving the final impl into cmdBlockCommit

Final cleanup to get rid of the hub function.

10 years agovirsh: Split out block pull implementation from blockJobImpl
Peter Krempa [Thu, 30 Apr 2015 14:22:04 +0000 (16:22 +0200)] 
virsh: Split out block pull implementation from blockJobImpl

10 years agovirsh: block job: separate abort from blockJobImpl
Peter Krempa [Thu, 2 Apr 2015 12:55:09 +0000 (14:55 +0200)] 
virsh: block job: separate abort from blockJobImpl

10 years agovirsh: blockjob: Split out vshBlockJobSetSpeed from blockJobImpl
Peter Krempa [Wed, 1 Apr 2015 14:45:19 +0000 (16:45 +0200)] 
virsh: blockjob: Split out vshBlockJobSetSpeed from blockJobImpl

10 years agovirsh: cmdBlockJob: Switch to declarative flag interlocking
Peter Krempa [Wed, 1 Apr 2015 13:05:33 +0000 (15:05 +0200)] 
virsh: cmdBlockJob: Switch to declarative flag interlocking

Use the VSH_EXCLUSIVE_OPTIONS_VAR to interlock incompatible options.
Since a variable named 'abort' would conflict with older compilers use
VSH_EXCLUSIVE_OPTIONS for the --abort option.

10 years agovirsh: blockjob: Extract block job info code into a separate function
Peter Krempa [Wed, 1 Apr 2015 12:54:10 +0000 (14:54 +0200)] 
virsh: blockjob: Extract block job info code into a separate function

cmdBlockJob will be converted to a hub that will call into the
individual executor functions.

10 years agonodedev: add RDMA and tx-udp_tnl-segmentation NIC capabilities
Moshe Levi [Sun, 19 Jul 2015 10:11:07 +0000 (13:11 +0300)] 
nodedev: add RDMA and tx-udp_tnl-segmentation NIC capabilities

Adding functionality to libvirt that will allow
it query the interface for the availability of RDMA and
tx-udp_tnl-segmentation Offloading NIC capabilities

Here is an example of the feature XML definition:

<device>
<name>net_eth4_90_e2_ba_5e_a5_45</name>
  <path>/sys/devices/pci0000:00/0000:00:03.0/0000:08:00.1/net/eth4</path>
  <parent>pci_0000_08_00_1</parent>
  <capability type='net'>
    <interface>eth4</interface>
    <address>90:e2:ba:5e:a5:45</address>
    <link speed='10000' state='up'/>
    <feature name='rx'/>
    <feature name='tx'/>
    <feature name='sg'/>
    <feature name='tso'/>
    <feature name='gso'/>
    <feature name='gro'/>
    <feature name='rxvlan'/>
    <feature name='txvlan'/>
    <feature name='rxhash'/>
    <feature name='rdma'/>
    <feature name='txudptnl'/>
    <capability type='80203'/>
  </capability>
</device>

10 years agonodeinfo: fix build on FreeBSD
Roman Bogorodskiy [Fri, 17 Jul 2015 17:07:45 +0000 (20:07 +0300)] 
nodeinfo: fix build on FreeBSD

Currently, build fails on FreeBSD with:

  CC       libvirt_driver_la-nodeinfo.lo
nodeinfo.c:1941:56: error: use of undeclared identifier 'SYSFS_SYSTEM_PATH'
    const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SYSTEM_PATH;
                                                       ^
1 error generated.

This is caused by commit b97b3048 that added sysfs_prefix to
nodeCapsInitNUMA and used SYSFS_CPU_PATH.

Fix it by unconditionally defining SYSFS_CPU_PATH instead of defining it
under #ifdef __linux__.

10 years agoqemu: Reject updating unsupported disk information
Martin Kletzander [Thu, 9 Jul 2015 16:28:38 +0000 (18:28 +0200)] 
qemu: Reject updating unsupported disk information

If one calls update-device with information that is not updatable,
libvirt reports success even though no data were updated.  The example
used in the bug linked below uses updating device with <boot order='2'/>
which, in my opinion, is a valid thing to request from user's
perspective.  Mainly since we properly error out if user wants to update
such data on a network device for example.

And since there are many things that might happen (update-device on disk
basically knows just how to change removable media), check for what's
changing and moreover, since the function might be usable in other
drivers (updating only disk path is a valid possibility) let's abstract
it for any two disks.

We can't possibly check for everything since for many fields our code
does not properly differentiate between default and unspecified values.
Even though this could be changed, I don't feel like it's worth the
complexity so it's not the aim of this patch.

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

10 years agoEscape left brace as new perl suggests
Martin Kletzander [Tue, 14 Jul 2015 12:14:30 +0000 (14:14 +0200)] 
Escape left brace as new perl suggests

After upgrade to perl-5.22.0, it started complaining about one of our
scripts.  The thing is that even though it works, it wants all curly
brackets escaped properly.  The change is not functional, it merely gets
rid of the following error:

  Unescaped left brace in regex is deprecated, passed through in regex;
  marked by <-- HERE in m/^enum { <-- HERE / at -e line 3.

There is one more error like this that I'm getting, but it is because of
GNU automake bug #21001:

  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21001

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: Use heads parameter for QXL driver
Frediano Ziglio [Fri, 17 Jul 2015 08:29:44 +0000 (09:29 +0100)] 
qemu: Use heads parameter for QXL driver

Allows to specify maximum number of head to QXL driver.

Actually can be a compatiblity problem as heads in the XML configuration
was set by default to '1'.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
10 years agostorage: Fix pool building when directory already exists
Christophe Fergeau [Fri, 17 Jul 2015 08:02:20 +0000 (10:02 +0200)] 
storage: Fix pool building when directory already exists

Currently, when trying to virsh pool-define/virsh pool-build a new
'dir' pool, if the target directory already exists, virsh
pool-build/virStoragePoolBuild will error out. This is a change of
behaviour compared to eg libvirt 1.2.13

This is caused by the wrong type being used for the dir_create_flags
variable in virStorageBackendFileSystemBuild , it's defined as a bool
but is used as a flag bit field so should be unsigned int (this matches
the type virDirCreate expects for this variable).

This should fix https://bugzilla.gnome.org/show_bug.cgi?id=752417 (GNOME
Boxes) and https://bugzilla.redhat.com/show_bug.cgi?id=1244080
(downstream virt-manager).

10 years agorpc: ensure daemon is spawn even if dead socket exists
Daniel P. Berrange [Fri, 3 Jul 2015 15:51:56 +0000 (16:51 +0100)] 
rpc: ensure daemon is spawn even if dead socket exists

The auto-spawn code would originally attempt to spawn the
daemon for both ENOENT and ECONNREFUSED errors from connect().
The various refactorings eventually lost this so we only
spawn the daemon on ENOENT. The result is if the daemon exits
uncleanly, so that the socket is left in the filesystem, we
will never be able to auto-spawn the daemon again.

10 years agoviraccessperm.h: Fix some typos
Michal Privoznik [Fri, 17 Jul 2015 07:41:31 +0000 (09:41 +0200)] 
viraccessperm.h: Fix some typos

Like s/authoriation/authorization/ and s/requries/requires/

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agodocs: Document how libvirt handles companion controllers
Martin Kletzander [Mon, 13 Jul 2015 13:51:25 +0000 (15:51 +0200)] 
docs: Document how libvirt handles companion controllers

The information on companion controllers we give in our documentation is
rather sparse.  For example, it looks like any controller can be used as
a companion one.  Also, when using ich9-uhci2, for example, we are able
to set some sensible defaults, but it might get confusing for the user
as we don't do that for all controller models.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agorbd: Return error from rbd_create for message processing
John Ferlan [Thu, 16 Jul 2015 16:28:58 +0000 (12:28 -0400)] 
rbd: Return error from rbd_create for message processing

Resolving an error reporting bug introduced by commit id '761491e' which
just took the return of virStorageBackendRBDCreateImage and used it as
the basis for the message generated. This would generate EPERM regardless
of error seen.

10 years agorbd: Use RBD format 2 by default when creating images.
Wido den Hollander [Tue, 14 Jul 2015 08:15:26 +0000 (10:15 +0200)] 
rbd: Use RBD format 2 by default when creating images.

We used to look at the librbd code version and depending on that
we would invoke rbd_create3() or rbd_create().

Since librbd version 0.67.9 we can however tell RBD that it should
create rbd format 2 images even if we invoke rbd_create().

The less options we pass to librbd, the more we can lean on the sane
defaults it uses.

For rbd_create3() we had things like the stripe count and unit hardcoded
in libvirt and that might cause problems down the road.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
10 years agovirsh: Don't output node frequency if unknown
Martin Kletzander [Fri, 10 Jul 2015 09:05:07 +0000 (11:05 +0200)] 
virsh: Don't output node frequency if unknown

Commit ed8155eafbff5c5ca0bdfe84a8388f58b718c2f9 documented that
mhz field in virNodeInfo might be 0 if the frequency is unknown.  Modify
virsh to know about that.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agoqemu: Test for virtio-9p-ccw support
Boris Fiuczynski [Tue, 7 Jul 2015 15:30:43 +0000 (17:30 +0200)] 
qemu: Test for virtio-9p-ccw support

This patch adds a test for the qemu command line generation.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Jason J. Herne <jjherne@us.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com>
10 years agoqemu: Make virtio-9p-ccw the default for s390-ccw-virtio machines
Boris Fiuczynski [Tue, 7 Jul 2015 15:30:42 +0000 (17:30 +0200)] 
qemu: Make virtio-9p-ccw the default for s390-ccw-virtio machines

For s390-ccw-virtio machines the default bus type is set to ccw.
Specifing an address element allows to override the default.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Jason J. Herne <jjherne@us.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com>
10 years agoqemu: Support for virtio-9p-ccw
Boris Fiuczynski [Tue, 7 Jul 2015 15:30:41 +0000 (17:30 +0200)] 
qemu: Support for virtio-9p-ccw

Adding the recently in qemu added 9pfs support for virtio-ccw.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Jason J. Herne <jjherne@us.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com>
10 years agodaemonRunStateInit: Fix a typo on a comment
Michal Privoznik [Wed, 15 Jul 2015 12:25:30 +0000 (14:25 +0200)] 
daemonRunStateInit: Fix a typo on a comment

s/priviledged/privileged/

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>