]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/log
people/liuw/libxenctrl-split/libvirt.git
9 years agoconf: Add ioeventfd option for controllers
Martin Kletzander [Fri, 24 Jul 2015 13:49:35 +0000 (15:49 +0200)]
conf: Add ioeventfd option for controllers

This will be used with a virtio-scsi controller later on.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
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>
9 years agoqemuMonitorOpenInternal: remove redundant code
Cao jin [Thu, 23 Jul 2015 10:16:31 +0000 (18:16 +0800)]
qemuMonitorOpenInternal: remove redundant code

There's no need to set mon->fd to a dummy value since
it's initialized to proper value just a few lines below.

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
9 years agorpc: Remove keepalive_required option
Martin Kletzander [Mon, 20 Jul 2015 12:51:24 +0000 (14:51 +0200)]
rpc: Remove keepalive_required option

Since its introduction in 2011 (particularly in commit f4324e329275),
the option doesn't work.  It just effectively disables all incoming
connections.  That's because the client private data that contain the
'keepalive_supported' boolean, are initialized to zeroes so the bool is
false and the only other place where the bool is used is when checking
whether the client supports keepalive.  Thus, according to the server,
no client supports keepalive.

Removing this instead of fixing it is better because a) apparently
nobody ever tried it since 2011 (4 years without one month) and b) we
cannot know whether the client supports keepalive until we get a ping or
pong keepalive packet.  And that won't happen until after we dispatched
the ConnectOpen call.

Another two reasons would be c) the keepalive_required was tracked on
the server level, but keepalive_supported was in private data of the
client as well as the check that was made in the remote layer, thus
making all other instances of virNetServer miss this feature unless they
all implemented it for themselves and d) we can always add it back in
case there is a request and a use-case for it.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agofix typo in comments
Cao jin [Mon, 10 Aug 2015 07:31:45 +0000 (15:31 +0800)]
fix typo in comments

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
9 years agovirDomainCoreDumpWithFormat: Mention enum for @dumpformat
Michal Privoznik [Sat, 8 Aug 2015 12:06:41 +0000 (14:06 +0200)]
virDomainCoreDumpWithFormat: Mention enum for @dumpformat

So the API takes @dumpformat argument. This is what makes it special
when compared to virDomainCoreDump. The argument is there so that
users can choose the format of resulting core dump file. And to ease
them the choosing process we even have an enum with supported values
across all the hypervisors. But we don't mention the enum in  the
function description anywhere. Fix it!

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
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

9 years agoqemu: support new pci controller model "pcie-switch-downstream-port"
Laine Stump [Wed, 17 Jun 2015 21:48:28 +0000 (17:48 -0400)]
qemu: support new pci controller model "pcie-switch-downstream-port"

This is backed by the qemu device xio3130-downstream. It can only be
connected to a pcie-switch-upstream-port (x3130-upstream) on the
upstream side.

9 years agoconf: new pcie-controller model "pcie-switch-downstream-port"
Laine Stump [Wed, 17 Jun 2015 19:27:40 +0000 (15:27 -0400)]
conf: new pcie-controller model "pcie-switch-downstream-port"

This controller can be connected only to a port on a
pcie-switch-upstream-port. It provides a single hotpluggable port that
will accept any PCI or PCIe device, as well as any device requiring a
pcie-*-port (the only current example of such a device is the
pcie-switch-upstream-port).

9 years agoqemu: add capabilities bit for device xio3130-downstream
Laine Stump [Wed, 17 Jun 2015 18:24:29 +0000 (14:24 -0400)]
qemu: add capabilities bit for device xio3130-downstream

The downstream ports of an x3130-upstream switch can each have one of
these plugged into them (and that is the only place they can be
connected). Each xio3130-downstream provides a single PCIe port that
can have PCI or PCIe devices hotplugged into it. Apparently an entire
set of x3130-upstream + several xio3130-downstreams can be hotplugged
as a unit, but it's not clear to me yet how that would be done, since
qemu only allows attaching a single device at a time.

This device will be used to implement the
"pcie-switch-downstream-port" model of pci controller.

9 years agoqemu: support new pci controller model "pcie-switch-upstream-port"
Laine Stump [Tue, 16 Jun 2015 19:09:07 +0000 (15:09 -0400)]
qemu: support new pci controller model "pcie-switch-upstream-port"

this is backed by the qemu device x3130-upstream. It can only plug
into a pcie-root-port or pcie-switch-downstream-port.

9 years agoconf: new pci controller model "pcie-switch-upstream-port"
Laine Stump [Tue, 16 Jun 2015 19:00:44 +0000 (15:00 -0400)]
conf: new pci controller model "pcie-switch-upstream-port"

This controller can be connected only to a pcie-root-port or a
pcie-switch-downstream-port (which will be added in a later patch),
which is the reason for the new connect type
VIR_PCI_CONNECT_TYPE_PCIE_PORT. A pcie-switch-upstream-port provides
32 ports (slot=0 to slot=31) on the downstream side, which can only
have pci controllers of model "pcie-switch-downstream-port" plugged
into them, which is the reason for the other new connect type
VIR_PCI_CONNECT_TYPE_PCIE_SWITCH.

9 years agoqemu: add capabilities bit for device x3130-upstream
Laine Stump [Tue, 16 Jun 2015 18:54:21 +0000 (14:54 -0400)]
qemu: add capabilities bit for device x3130-upstream

This is the upstream part of a PCIe switch. It connects to a PCIe port
(but not PCI) on the upstream side, and can have up to 31
xio3130-downstream controllers (but no other types of devices)
connected to its downstream side.

This device will be used to implement the "pcie-switch-upstream-port"
model of pci controller.

9 years agoqemu: support new pci controller model "pcie-root-port"
Laine Stump [Wed, 17 Jun 2015 17:27:57 +0000 (13:27 -0400)]
qemu: support new pci controller model "pcie-root-port"

This is backed by the qemu device ioh3420.

chassis and port from the <target> subelement are used to store/set the
respective qemu device options for the ioh3420. Currently, chassis is
set to be the index of the controller, and port is set to
"(slot << 3) + function" (per suggestion from Alex Williamson).

9 years agoconf: new pci controller model "pcie-root-port"
Laine Stump [Wed, 17 Jun 2015 17:21:16 +0000 (13:21 -0400)]
conf: new pci controller model "pcie-root-port"

This controller can be connected (at domain startup time only - not
hotpluggable) only to a port on the pcie root complex ("pcie-root" in
libvirt config), hence the new connect type
VIR_PCI_CONNECT_TYPE_PCIE_ROOT. It provides a hotpluggable port that
will accept any PCI or PCIe device.

New attributes must be added to the controller <target> subelement for
this - chassis and port are guest-visible option values that will be
set by libvirt with values derived from the controller's index and pci
address information.

9 years agoqemu: add capabilities bit for device ioh3420
Laine Stump [Wed, 17 Jun 2015 17:13:28 +0000 (13:13 -0400)]
qemu: add capabilities bit for device ioh3420

This is a PCIE "root port". It connects only to a port of the
integrated pcie.0 bus of a Q35 machine (can't be hotplugged), and
provides a single PCIe port that can have PCI or PCIe devices
hotplugged into it.

This device will be used to implement the "pcie-root-port" model of
pci controller.

9 years agoqemu: implement <target chassisNr='n'/> subelement/attribute of <controller>
Laine Stump [Wed, 15 Jul 2015 19:16:14 +0000 (15:16 -0400)]
qemu: implement <target chassisNr='n'/> subelement/attribute of <controller>

This uses the new subelement/attribute in two ways:

1) If a "pci-bridge" pci controller has no chassisNr attribute, it
will automatically be set to the controller's index as soon as the
controller's PCI address is known (during
qemuDomainAssignPCIAddresses()).

2) when creating the commandline for a pci-bridge device, chassisNr
will be used to set qemu's chassis_nr option (rather than the previous
practice of hard-coding it to the controller's index).

9 years agoconf: add new <target> subelement with chassisNr attribute to <controller>
Laine Stump [Wed, 1 Jul 2015 16:47:55 +0000 (12:47 -0400)]
conf: add new <target> subelement with chassisNr attribute to <controller>

There are some configuration options to some types of pci controllers
that are currently automatically derived from other parts of the
controller's configuration. For example, in qemu a pci-bridge
controller has an option that is called "chassis_nr"; up until now
libvirt has always set chassis_nr to the index of the pci-bridge. So
this:

  <controller type='pci' model='pci-bridge' index='2'/>

will always result in:

  -device pci-bridge,chassis_nr=2,...

on the qemu commandline. In the future we may decide there is a better
way to derive that option, but even in that case we will need for
existing domains to retain the same chassis_nr they were using in the
past - that is something that is visible to the guest so it is part of
the guest ABI and changing it would lead to problems for migrating
guests (or just guests with very picky OSes).

The <target> subelement has been added as a place to put the new
"chassisNr" attribute that will be filled in by libvirt when it
auto-generates the chassisNr; it will be saved in the config, then
reused any time the domain is started:

  <controller type='pci' model='pci-bridge' index='2'>
    <model type='pci-bridge'/>
    <target chassisNr='2'/>
  </controller>

The one oddity of all this is that if the controller configuration
is changed (for example to change the index or the pci address
where the controller is plugged in), the items in <target> will
*not* be re-generated, which might lead to conflict. I can't
really see any way around this, but fortunately if there is a
material conflict qemu will let us know and we will pass that on
to the user.

9 years agoqemu: implement <model> subelement to <controller>
Laine Stump [Thu, 25 Jun 2015 19:37:33 +0000 (15:37 -0400)]
qemu: implement <model> subelement to <controller>

This patch provides qemu support for the contents of <model> in
<controller> for the two existing PCI controller types that need it
(i.e. the two controller types that are backed by a device that must
be specified on the qemu commandline):

1) pci-bridge - sets <model> name attribute default as "pci-bridge"

2) dmi-to-pci-bridge - sets <model> name attribute default as
   "i82801b11-bridge".

These both match current hardcoded practice.

The defaults are set at the end of qemuDomainAssignPCIAddresses().
This can't be done earlier because some of the options that will be
autogenerated need full PCI address info for the controller, and
because qemuDomainAssignPCIAddresses() might create extra controllers
which would need default settings added, and that hasn't yet been done
at the time the PostParse callbacks are being run.
qemuDomainAssignPCIAddresses() is still called prior to the XML being
written to disk, though, so the autogenerated defaults are persistent.

qemu capabilities bits aren't checked when the domain is defined, but
rather when the commandline is actually created (so the domain can
possibly be defined on a host that doesn't yet have support for the
given device, or a host different from the one where it will
eventually be run). When the commandline is being generated we compare
the modelName to known qemu device names implementing the given type
of controller, and check the capabilities bit for that device.

9 years agoconf: add new <model> subelement with name attribute to <controller>
Laine Stump [Thu, 25 Jun 2015 17:30:23 +0000 (13:30 -0400)]
conf: add new <model> subelement with name attribute to <controller>

This new subelement is used in PCI controllers: the toplevel
*attribute* "model" of a controller denotes what kind of PCI
controller is being described, e.g. a "dmi-to-pci-bridge",
"pci-bridge", or "pci-root". But in the future there will be different
implementations of some of those types of PCI controllers, which
behave similarly from libvirt's point of view (and so should have the
same model), but use a different device in qemu (and present
themselves as a different piece of hardware in the guest). In an ideal
world we (i.e. "I") would have thought of that back when the pci
controllers were added, and used some sort of type/class/model
notation (where class was used in the way we are now using model, and
model was used for the actual manufacturer's model number of a
particular family of PCI controller), but that opportunity is long
past, so as an alternative, this patch allows selecting a particular
implementation of a pci controller with the "name" attribute of the
<model> subelement, e.g.:

  <controller type='pci' model='dmi-to-pci-bridge' index='1'>
    <model name='i82801b11-bridge'/>
  </controller>

In this case, "dmi-to-pci-bridge" is the kind of controller (one that
has a single PCIe port upstream, and 32 standard PCI ports downstream,
which are not hotpluggable), and the qemu device to be used to
implement this kind of controller is named "i82801b11-bridge".

Implementing the above now will allow us in the future to add a new
kind of dmi-to-pci-bridge that doesn't use qemu's i82801b11-bridge
device, but instead uses something else (which doesn't yet exist, but
qemu people have been discussing it), all without breaking existing
configs.

(note that for the existing "pci-bridge" type of PCI controller, both
the model attribute and <model> name are 'pci-bridge'. This is just a
coincidence, since it turns out that in this case the device name in
qemu really is a generic 'pci-bridge' rather than being the name of
some real-world chip)

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

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>
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>
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

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>
9 years agoqemuDomainDefPostParse: Adjust indent
Michal Privoznik [Thu, 6 Aug 2015 13:33:01 +0000 (15:33 +0200)]
qemuDomainDefPostParse: Adjust indent

While reviewing e8d551725 I've noticed a few unaligned lines.
Fix this.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agobootstrap: Don't require python-config
Michal Privoznik [Mon, 29 Jun 2015 11:43:51 +0000 (13:43 +0200)]
bootstrap: Don't require python-config

We've split the python bindings a long time ago. However,
we are still requiring python-config (as an obfuscation to
python-devel). This does not make any sense. The only thing
we need is python, not python-devel.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: Allow to plug virtio-net-pci into PCIe slot
Pavel Fedin [Fri, 17 Jul 2015 11:27:47 +0000 (14:27 +0300)]
qemu: Allow to plug virtio-net-pci into PCIe slot

virtio-net-pci adapter is capable to use irqfd with vhost-net only in MSI-X
mode, which appears to be available only on PCIe bus, at least on ARM

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
9 years agoqemu: Build correct command line for PCI NICs on ARM
Pavel Fedin [Fri, 17 Jul 2015 11:27:46 +0000 (14:27 +0300)]
qemu: Build correct command line for PCI NICs on ARM

Legacy -net option works correctly only with embedded device models, which
do not require any bus specification. Therefore, we should use -device for
PCI hardware

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
9 years agoqemu: Add PCI-Express root to ARM virt machine
Pavel Fedin [Fri, 17 Jul 2015 11:27:45 +0000 (14:27 +0300)]
qemu: Add PCI-Express root to ARM virt machine

Here we assume that if qemu supports generic PCI host controller,
it is a part of virt machine and can be used for adding PCI devices.

In qemu this is actually a PCIe bus, so we also declare multibus
capability so that 0'th bus is specified to qemu correctly as 'pcie.0'

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: Introduce QEMU_CAPS_OBJECT_GPEX
Pavel Fedin [Fri, 17 Jul 2015 11:27:44 +0000 (14:27 +0300)]
qemu: Introduce QEMU_CAPS_OBJECT_GPEX

This capability specifies that qemu can implement generic PCI host
controller. It is often used for virtual environments, including ARM.

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
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

9 years agocpu: Indentation changes in the ppc64 driver
Andrea Bolognani [Mon, 20 Jul 2015 13:20:20 +0000 (15:20 +0200)]
cpu: Indentation changes in the ppc64 driver

9 years agocpu: Rename {powerpc,ppc} => ppc64 (internal symbols)
Andrea Bolognani [Mon, 20 Jul 2015 13:13:02 +0000 (15:13 +0200)]
cpu: Rename {powerpc,ppc} => ppc64 (internal symbols)

Update the names of the symbols used internally by the driver.

No functional changes.

9 years agocpu: Rename {powerpc,ppc} => ppc64 (exported symbols)
Andrea Bolognani [Mon, 20 Jul 2015 12:35:22 +0000 (14:35 +0200)]
cpu: Rename {powerpc,ppc} => ppc64 (exported symbols)

Only the symbols exported by the driver have been updated;
the driver implementation itself still uses the old names
internally.

No functional changes.

9 years agocpu: Rename {powerpc,ppc} => ppc64 (filesystem)
Andrea Bolognani [Mon, 20 Jul 2015 12:17:52 +0000 (14:17 +0200)]
cpu: Rename {powerpc,ppc} => ppc64 (filesystem)

The driver only supports VIR_ARCH_PPC64 and VIR_ARCH_PPC64LE.

Just shuffling files around and updating the build system
accordingly. No functional changes.

9 years agoconf: Resolve Coverity FORWARD_NULL
John Ferlan [Tue, 4 Aug 2015 10:50:29 +0000 (06:50 -0400)]
conf: Resolve Coverity FORWARD_NULL

The recent changes to perform SCSI device address checks during the
post parse callbacks ran afoul of the Coverity checker since the changes
assumed that the 'xmlopt' parameter to virDomainDeviceDefPostParse
would be non NULL (commit id 'ca2cf74e87'); however, what was missed
is there was an "if (xmlopt &&" check being made, so Coverity believed
that it could be possible for a NULL 'xmlopt'.

Checking the various calling paths seemingly disproves that. If called
from virDomainDeviceDefParse, there were two other possible calls that
would end up dereffing, so that path could not be NULL. If called via
virDomainDefPostParseDeviceIterator via virDomainDefPostParse there
are two callers (virDomainDefParseXML and qemuParseCommandLine)
which deref xmlopt either directly or through another call.

So I'm removing the check for non-NULL xmlopt.

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>
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>
9 years agoconf: Allow error reporting in virDomainDiskSourceIsBlockType
John Ferlan [Sat, 18 Jul 2015 11:34:34 +0000 (07:34 -0400)]
conf: Allow error reporting in virDomainDiskSourceIsBlockType

Rather than provide a somewhat generic error message when the API
returns false, allow the caller to supply a "report = true" option
in order to cause virReportError's to describe which of the 3 paths
that can cause failure.

Some callers don't care about what caused the failure, they just want
to have a true/false - for those, calling with report = false should
be sufficient.

9 years agodocs: Add Fibre Channel NPIV supported option for volume lun config
John Ferlan [Sat, 18 Jul 2015 11:25:06 +0000 (07:25 -0400)]
docs: Add Fibre Channel NPIV supported option for volume lun config

"Further" clarification (and testing) shows that using a SCSI Fibre
Channel NPIV device/lun from a storage pool as a <disk type='volume'
device'lun'> will work. So just add that to the allowable options

Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1230179

9 years agoAvoid starting a PowerPC VM with floppy disk
Kothapally Madhu Pavan [Thu, 30 Jul 2015 11:55:36 +0000 (07:55 -0400)]
Avoid starting a PowerPC VM with floppy disk

PowerPC pseries based VMs do not support a floppy disk controller.
This prohibits libvirt from creating qemu command with floppy device.

Signed-off-by: Kothapally Madhu Pavan <kmp@linux.vnet.ibm.com>
https://bugzilla.redhat.com/show_bug.cgi?id=1180486

Signed-off-by: Ján Tomko <jtomko@redhat.com>
9 years agoCaps: Disable floppy disk for PowerPC VM
Kothapally Madhu Pavan [Thu, 30 Jul 2015 11:54:26 +0000 (07:54 -0400)]
Caps: Disable floppy disk for PowerPC VM

PowerPC pseries based VMs do not support a floppy disk controller.
This prohibits libvirt from adding floppy disk for a PowerPC pseries VM.

Signed-off-by: Kothapally Madhu Pavan <kmp@linux.vnet.ibm.com>
9 years agoconf: Change when virDomainDiskDefAssignAddress is called
John Ferlan [Wed, 22 Jul 2015 13:54:55 +0000 (09:54 -0400)]
conf: Change when virDomainDiskDefAssignAddress is called

Rather than calling virDomainDiskDefAssignAddress during the parsing of
the XML, moving the setting of disk addresses into the domain/device post
processing.

Commit id '37588b25' which introduced VIR_DOMAIN_DEF_PARSE_DISK_SOURCE
in order to avoid generating the address which wasn't required will not
be affected by this as all it cared about was processing the source XML.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoconf: Remove unused param from virDomainHostdevDefParseXML
John Ferlan [Wed, 22 Jul 2015 01:59:37 +0000 (21:59 -0400)]
conf: Remove unused param from virDomainHostdevDefParseXML

Remove unused xmlopt param

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoconf: Change when virDomainHostdevAssignAddress is called
John Ferlan [Fri, 19 Jun 2015 18:23:13 +0000 (14:23 -0400)]
conf: Change when virDomainHostdevAssignAddress is called

Rather than calling virDomainHostdevAssignAddress during the parsing
of the XML, move the setting of a default hostdev address to domain/
device post processing.

Since the parse code no longer generates an address, we can remove
the virDomainDefMaybeAddHostdevSCSIcontroller since the call to
virDomainHostdevAssignAddress will attempt to add the controllers
that were not already defined in the XML.

This patch will also enforce that the address type is type 'drive'
when a SCSI subsystem <hostdev> element is provided with an <address>.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoconf: Try controller add when searching hostdev bus for unit
John Ferlan [Wed, 22 Jul 2015 12:09:23 +0000 (08:09 -0400)]
conf: Try controller add when searching hostdev bus for unit

If virDomainControllerSCSINextUnit failed to find a slot on the current
VIR_DOMAIN_CONTROLLER_TYPE_SCSI controller(s), try to add a new controller;
otherwise, there may be multiple unit=0 entries for the same "next"
controller.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoconf: Add check for host address type while checking in use
John Ferlan [Tue, 21 Jul 2015 21:00:00 +0000 (17:00 -0400)]
conf: Add check for host address type while checking in use

While searching the hostdevs the drive type can be either *_TYPE_DRIVE
or *_TYPE_NONE.  If the type is _TYPE_NONE on the first scsi_host, then
there is an erroneous "match" that the address already exists.

Although this works by chance currently because hostdev's are added one
at a time and 'nhostdevs' would be zero, thus returning false for the
first hostdev added, a future patch will move the hostdev address
assignment into post processing resulting in the bad match.

This code is only called by path's expecting either drive or none.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoconf: Add xmlopt to virDomainDeviceDefPostParseInternal
John Ferlan [Tue, 21 Jul 2015 18:59:21 +0000 (14:59 -0400)]
conf: Add xmlopt to virDomainDeviceDefPostParseInternal

Add the xmlopt parameter that was saved during virDomainDefPostParse
to the parameters. A future patch will use it.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoconf: Move hostdev and disk address validations
John Ferlan [Tue, 21 Jul 2015 19:15:30 +0000 (15:15 -0400)]
conf: Move hostdev and disk address validations

Move the functions above the post processing for upcoming patch

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoconf: Add 'bus' and 'target' to SCSI address conflict checks
John Ferlan [Fri, 19 Jun 2015 19:11:13 +0000 (15:11 -0400)]
conf: Add 'bus' and 'target' to SCSI address conflict checks

Modify virDomainDriveAddressIsUsedBy{Disk|Hostdev} and
virDomainSCSIDriveAddressIsUsed to take 'bus' and 'target'
parameters.  Will be used by future patches for more complete
address conflict checks

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoconf: Remove extraneous check in virDomainHostdevAssignAddress
John Ferlan [Thu, 16 Jul 2015 12:32:53 +0000 (08:32 -0400)]
conf: Remove extraneous check in virDomainHostdevAssignAddress

Since the only way virDomainHostdevAssignAddress can be called is from
within virDomainHostdevDefParseXML when hostdev->source.subsys.type is
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI, thus there's no need for redundancy.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agonodeinfo: Fix build failure when KVM headers are not available
Andrea Bolognani [Mon, 3 Aug 2015 15:02:39 +0000 (17:02 +0200)]
nodeinfo: Fix build failure when KVM headers are not available

Compiler error:

  ../../src/nodeinfo.c: In function 'nodeGetThreadsPerSubcore':
  ../../src/nodeinfo.c:2393: error: label 'out' defined but not used [-Wunused-label]
  ../../src/nodeinfo.c:2352: error: unused parameter 'arch' [-Wunused-parameter]

9 years agoqemu: Remove double unlock for domains
Martin Kletzander [Wed, 15 Jul 2015 07:07:50 +0000 (09:07 +0200)]
qemu: Remove double unlock for domains

The virDomainObjListRemove() function unlocks a domain that it's given
due to legacy code.  And because of that code, which should be
refactored, that last virObjectUnlock() cannot be just removed.  So
instead, lock it right back for qemu for now.  All calls to
qemuDomainRemoveInactive() are followed by code that unlocks the domain
again, plus the domain should be locked during qemuDomainObjEndJob(), so
the right place to lock it is right after virDomainObjListRemove().

The only place where this would cause a problem is the autodestroy
callback, so we need to get another reference there and uref+unlock it
afterwards.  Luckily, returning NULL from that function doesn't mean an
error, and only means that it doesn't need to be unlocked anymore.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agotests: Add subcores3 nodeinfo test
Andrea Bolognani [Mon, 27 Jul 2015 08:08:32 +0000 (10:08 +0200)]
tests: Add subcores3 nodeinfo test

This makes sure the subcore-unaware CPU counting logic is used
whenever the configuration is invalid.

9 years agotests: Add subcores2 nodeinfo test
Andrea Bolognani [Mon, 27 Jul 2015 08:08:31 +0000 (10:08 +0200)]
tests: Add subcores2 nodeinfo test

This makes sure CPUs are counted correctly when some of the cores are
completely offline.

9 years agotests: Add subcores1 nodeinfo test
Andrea Bolognani [Mon, 27 Jul 2015 08:08:30 +0000 (10:08 +0200)]
tests: Add subcores1 nodeinfo test

This makes sure CPUs are counted correctly when using the default
configuration, that is, all primary threads are online and all
secondary threads are offline.

9 years agotests: Prepare for subcore tests
Shivaprasad G Bhat [Mon, 27 Jul 2015 08:08:29 +0000 (10:08 +0200)]
tests: Prepare for subcore tests

The nodeGetThreadsPerSubcore() function is mocked to return 8 for
ppc64 tests, which corresponds to the default subcore mode.

Update the expected output for the deconfigured-cpus nodeinfo
test to account for this change.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
9 years agonodeinfo: Fix output on PPC64 KVM hosts
Shivaprasad G Bhat [Thu, 30 Jul 2015 09:37:04 +0000 (11:37 +0200)]
nodeinfo: Fix output on PPC64 KVM hosts

The nodeinfo is reporting incorrect number of cpus and incorrect host
topology on PPC64 KVM hosts. The KVM hypervisor on PPC64 needs only
the primary thread in a core to be online, and the secondaries offlined.
While scheduling a guest in, the kvm scheduler wakes up the secondaries to
run in guest context.

The host scheduling of the guests happen at the core level(as only primary
thread is online). The kvm scheduler exploits as many threads of the core
as needed by guest. Further, starting POWER8, the processor allows splitting
a physical core into multiple subcores with 2 or 4 threads each. Again, only
the primary thread in a subcore is online in the host. The KVM-PPC
scheduler allows guests to exploit all the offline threads in the subcore,
by bringing them online when needed.
(Kernel patches on split-core http://www.spinics.net/lists/kvm-ppc/msg09121.html)

Recently with dynamic micro-threading changes in ppc-kvm, makes sure
to utilize all the offline cpus across guests, and across guests with
different cpu topologies.
(https://www.mail-archive.com/kvm@vger.kernel.org/msg115978.html)

Since the offline cpus are brought online in the guest context, it is safe
to count them as online. Nodeinfo today discounts these offline cpus from
cpu count/topology calclulation, and the nodeinfo output is not of any help
and the host appears overcommited when it is actually not.

The patch carefully counts those offline threads whose primary threads are
online. The host topology displayed by the nodeinfo is also fixed when the
host is in valid kvm state.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
9 years agorpc: Fix slow volume download (virsh vol-download)
Ossi Herrala [Mon, 20 Jul 2015 12:44:32 +0000 (12:44 +0000)]
rpc: Fix slow volume download (virsh vol-download)

Use I/O vector (iovec) instead of one huge memory buffer as suggested
in https://bugzilla.redhat.com/show_bug.cgi?id=1026137#c7. This avoids
doing memmove() to big buffers and performance doesn't degrade if
source (virNetClientStreamQueuePacket()) is faster than sink
(virNetClientStreamRecvPacket()).

Resolves: http://bugzilla.redhat.com/1026137

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoThere is no virDomainFindBy{ID, Name, UUID} anymore
Cao jin [Wed, 29 Jul 2015 09:11:20 +0000 (17:11 +0800)]
There is no virDomainFindBy{ID, Name, UUID} anymore

s/virDomainFindBy/virDomainObjListFindBy/

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
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>
9 years agoPost-release version bump to 1.2.19
Martin Kletzander [Mon, 3 Aug 2015 11:07:52 +0000 (13:07 +0200)]
Post-release version bump to 1.2.19

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoFix a trailing space in spec file
Daniel Veillard [Mon, 3 Aug 2015 09:43:34 +0000 (17:43 +0800)]
Fix a trailing space in spec file

9 years agoRelease of libvirt-1.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

9 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>
9 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>
9 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

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

9 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.

9 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.

9 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

9 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>
9 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>
9 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>
9 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>
9 years agoRenamed deconfigured-cpus to allow make dist
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

9 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().

9 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.

9 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.

9 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>
9 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>
9 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

9 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>
9 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>
9 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>
9 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.

9 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

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

9 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.

9 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.

9 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>
9 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>
9 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.

9 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.

9 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.

9 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.

9 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.

9 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.

9 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.