]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/log
people/liuw/libxenctrl-split/libvirt.git
9 years agoqemu: Reuse virBitmapToDataBuf in qemuDomainGetEmulatorPinInfo
Peter Krempa [Fri, 29 May 2015 11:52:29 +0000 (13:52 +0200)]
qemu: Reuse virBitmapToDataBuf in qemuDomainGetEmulatorPinInfo

9 years agoqemu: Use virBitmapToDataBuf in qemuDomainGetVcpuPinInfo
Peter Krempa [Fri, 22 May 2015 09:07:21 +0000 (11:07 +0200)]
qemu: Use virBitmapToDataBuf in qemuDomainGetVcpuPinInfo

Reuse the function so that we can get rid of a lot of temporary
allocations.

9 years agoutil: bitmap: Add virBitmapToDataBuf that does not allocate the buffer
Peter Krempa [Thu, 21 May 2015 16:25:36 +0000 (18:25 +0200)]
util: bitmap: Add virBitmapToDataBuf that does not allocate the buffer

Since some functions can be optimized by reusing the buffers that they
already have instead of allocating and copying new ones, lets split
virBitmapToData to two functions where one only converts the data and
the second one is a wrapper that allocates the buffer if necessary.

9 years agoconf: Move pinning information definition closer to the usage place
Peter Krempa [Thu, 21 May 2015 14:16:15 +0000 (16:16 +0200)]
conf: Move pinning information definition closer to the usage place

9 years agoconf: Refactor emulatorpin handling
Peter Krempa [Thu, 21 May 2015 12:55:18 +0000 (14:55 +0200)]
conf: Refactor emulatorpin handling

Store the emulator pinning cpu mask as a pure virBitmap rather than the
virDomainPinDef since it stores only the bitmap and refactor
qemuDomainPinEmulator to do the same operations in a much saner way.

As a side effect virDomainEmulatorPinAdd and virDomainEmulatorPinDel can
be removed since they don't add any value.

9 years agoqemu: Fix possible crash in qemuProcessSetVcpuAffinities
Peter Krempa [Thu, 28 May 2015 14:22:13 +0000 (16:22 +0200)]
qemu: Fix possible crash in qemuProcessSetVcpuAffinities

In case when <vcpu ... cpuset=""> is not specified, the vcpupin array is
not guaranteed to be allocated to def->vcpus. This would cause a crash
for TCG since it does not report thread IDs for vCPUs.

9 years agoparallels: set virtType depending on driver name
Maxim Nestratov [Tue, 26 May 2015 17:12:00 +0000 (20:12 +0300)]
parallels: set virtType depending on driver name

We remember driver name in a new field 'drivername' within
private parallels connection structure. When a new domain
is defined we use this name to set corresponding virtType.
We set VIR_DOMAIN_VIRT_VZ for 'vz' driver and
VIR_DOMAIN_VIRT_PARALLELS for 'Parallels'.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: recommend to connect to vz:///system when connection fails
Maxim Nestratov [Tue, 26 May 2015 17:12:00 +0000 (20:12 +0300)]
parallels: recommend to connect to vz:///system when connection fails

Though parallels:///system is still accepted we will encourage users
to use vz:///system instead.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: increment the number of connection drivers
Maxim Nestratov [Tue, 26 May 2015 17:12:00 +0000 (20:12 +0300)]
parallels: increment the number of connection drivers

We need to do this because we have just added a vz driver.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: add a new vz connection driver and hypervisor structures
Maxim Nestratov [Tue, 26 May 2015 17:12:00 +0000 (20:12 +0300)]
parallels: add a new vz connection driver and hypervisor structures

We add this connection driver just as an exact copy with different
name to keep backward compatibility.
Vz stands for Virtuozzo, which is a new name of Parallels Cloud Server.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: accept vz as a driver uri and name
Maxim Nestratov [Tue, 26 May 2015 17:12:00 +0000 (20:12 +0300)]
parallels: accept vz as a driver uri and name

If 'parallels:///system' uri is specified then connection is made to
'Parallels' driver and domain type will be VIR_DOMAIN_VIRT_PARALLELS.
In case of 'vz:///system' connection is established to 'vz' driver
and domain type will be VIR_DOMAIN_VIRT_VZ.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: add new guest capabilities assigned to vz driver
Maxim Nestratov [Tue, 26 May 2015 17:12:00 +0000 (20:12 +0300)]
parallels: add new guest capabilities assigned to vz driver

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: use newly introduced VIR_DOMAIN_VIRT_VZ
Maxim Nestratov [Tue, 26 May 2015 17:12:00 +0000 (20:12 +0300)]
parallels: use newly introduced VIR_DOMAIN_VIRT_VZ

As soon as we keep backward compatibility we treat this constant
as synonym to VIR_DOMAIN_VIRT_PARALLELS.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: introduce vz driver constant and string
Maxim Nestratov [Tue, 26 May 2015 17:12:00 +0000 (20:12 +0300)]
parallels: introduce vz driver constant and string

This new name and constant will be used as substitutions for parallels driver one.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoqemu: Do not release device address on successful RNG attach
Luyao Huang [Sun, 31 May 2015 11:29:46 +0000 (19:29 +0800)]
qemu: Do not release device address on successful RNG attach

Commit id '980b265d' neglected to check for a successful status when
deciding whether to release the device address for the RNG attach thus
the address would be released even though the device was added.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
9 years agoqemu: Need to return status of RNG device removal
Luyao Huang [Sun, 31 May 2015 13:27:25 +0000 (21:27 +0800)]
qemu: Need to return status of RNG device removal

Commit id '862473fa' neglected to return the status from the
qemuDomainRemoveRNGDevice call in qemuDomainRemoveDevice causing
the function to always fail when receiving an RNG device unplug
event. Additionally the domain status/state would not be updated
in the processDeviceDeletedEvent path.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
9 years agoaudit: Audit number of iothreads at domain startup
Luyao Huang [Sun, 31 May 2015 14:07:58 +0000 (22:07 +0800)]
audit: Audit number of iothreads at domain startup

If the domain has IOThreads defined, then audit the number started
at domain startup time.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
9 years agobuild: silence ar warnings on rawhide
Eric Blake [Tue, 2 Jun 2015 15:17:43 +0000 (09:17 -0600)]
build: silence ar warnings on rawhide

Newer binutils 'ar' has added an option 'D' for deterministic
builds, and at least on rawhide, this option is enabled by default.
But it conflicts with the 'u' optimization where the linker only
modifies libraries based on file timestamps, but can result in
different library ordering based on which files were touched last.
Thus, it results in some noisy compilation, for every CCLD line:

  CCLD     libvirt_driver_qemu_impl.la
  ar: `u' modifier ignored since `D' is the default (see `U')

Upstream automake has decided that defaulting ARFLAGS to 'cru' is
no longer beneficial, and that switching the default to 'cr' will
both silence the noise and not penalize modern build systems.

https://lists.gnu.org/archive/html/automake-patches/2015-06/msg00000.html

But rather than wait for newer automake to propagate to all systems
that already have newer binutils, we might as well just use the new
default ourselves, even on older platforms.

* configure.ac: Default AR[_]FLAGS to 'cr', not 'cru'.

Signed-off-by: Eric Blake <eblake@redhat.com>
9 years agoutil: report all address range errors in virSocketAddrGetRange()
Laine Stump [Tue, 26 May 2015 19:44:24 +0000 (15:44 -0400)]
util: report all address range errors in virSocketAddrGetRange()

There are now many more reasons that virSocketAddrGetRange() could
fail, so it is much more informative to report the error there instead
of in the caller. (one of the two callers was previously assuming
success, which is almost surely safe based on the parsing that has
already happened to the config by that time, but it still is nicer to
account for an error "just in case")

Part of fix for: https://bugzilla.redhat.com/show_bug.cgi?id=985653

9 years agonetwork: cleanup range loop in networkDnsmasqConfContents
Laine Stump [Tue, 26 May 2015 19:32:59 +0000 (15:32 -0400)]
network: cleanup range loop in networkDnsmasqConfContents

This loop had automatic variable definitions mixed with code. This
patch moves the definitions to the top of the function and puts
cleanup for them at the bottom. No functional change.

Part of fix for: https://bugzilla.redhat.com/show_bug.cgi?id=985653

9 years agonetwork: validate DHCP ranges are completely within defined network
Laine Stump [Fri, 22 May 2015 21:32:02 +0000 (17:32 -0400)]
network: validate DHCP ranges are completely within defined network

virSocketAddrGetRange() has been updated to take the network address
and prefix, and now checks that both the start and end of the range
are within that network, thus validating that the entire range of
addresses is in the network. For IPv4, it also checks that ranges to
not start with the "network address" of the subnet, nor end with the
broadcast address of the subnet (this check doesn't apply to IPv6,
since IPv6 doesn't have a broadcast or network address)

Negative tests have been added to the network update and socket tests
to verify that bad ranges properly generate an error.

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

9 years agotest: fix IP address range failure test
Laine Stump [Mon, 1 Jun 2015 16:18:01 +0000 (12:18 -0400)]
test: fix IP address range failure test

This was revealed when I made a cut-paste mistake in an upgrade to
virSocketAddrGetRange(), leading to failure to check for the end
address being outside of the defined network, but a negative test case
that should have caught the error instead returned success.

The problem was that testRange in sockettest.c was written so that
when it expected a failure, even an "unexpected success" would be
considered as an "expected failure" because of the way the check in
testRange was done. testRange had this:

 if (gotsize < 0 || gotsize != size) {
     return pass ? -1 : 0;
 } else {
     return pass ? 0 : -1;
 }

but all the tests that expected a failure give "-1" as the expected
size. So in a case where we expect a failure, we would have pass ==
false and size == -1. If virSocketAddrGetRange() was incorrectly
*successful* (returned some positive number), then "gotsize != size"
would be, e.g. "276 != -1", so we would take the if clause and, since
pass == false, we would return 0 (success i.e. expected failure).

The solution is that in the case where we expect failure, we should
just ignore size - virSocketAddrGetRange() must return -1 in order for
us to report "expected failure == success".

Part of fix for: https://bugzilla.redhat.com/show_bug.cgi?id=985653

9 years agoSimplify virNodeCountThreadSiblings
Ján Tomko [Tue, 2 Jun 2015 12:29:54 +0000 (14:29 +0200)]
Simplify virNodeCountThreadSiblings

Use a for loop instead of while.

Do not opencode c_isxdigit and virHexToBin.

9 years agoReport errors in virNodeCountThreadSiblings
Ján Tomko [Tue, 2 Jun 2015 12:24:03 +0000 (14:24 +0200)]
Report errors in virNodeCountThreadSiblings

Use virFileReadAll which reports an error when the file is larger
than the specified maximum.

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

9 years agovirsh: Move error messages inside vshCommandOpt*() functions
Andrea Bolognani [Tue, 2 Jun 2015 09:17:29 +0000 (11:17 +0200)]
virsh: Move error messages inside vshCommandOpt*() functions

9 years agovirsh: Pass vshControl to all vshCommandOpt*() calls
Andrea Bolognani [Tue, 2 Jun 2015 09:17:28 +0000 (11:17 +0200)]
virsh: Pass vshControl to all vshCommandOpt*() calls

This will allow us to use vshError() to report errors from inside
vshCommandOpt*(), instead of replicating the same logic and error
messages all over the place.

We also have more context inside the vshCommandOpt*() functions,
for example the actual value used on the command line, which means
we can produce more detailed error messages.

vshCommandOptBool() is the exception here, because it's explicitly
designed not to report any error.

9 years agovirsh: Make vshCommandOptScaledInt() use vshCommandOpt()
Andrea Bolognani [Tue, 2 Jun 2015 09:17:27 +0000 (11:17 +0200)]
virsh: Make vshCommandOptScaledInt() use vshCommandOpt()

This aligns it to the other vshCommandOpt*() functions.

9 years agovirsh: Improve vshCommandOptTimeoutToMs()
Andrea Bolognani [Tue, 2 Jun 2015 09:17:26 +0000 (11:17 +0200)]
virsh: Improve vshCommandOptTimeoutToMs()

Use vshCommandOptUInt() instead of parsing the value as a signed
integer and checking whether it's positive afterwards.

Improve comments as well.

9 years agovirsh: Use standard error messages in vshCommandOptTimeoutToMs()
Andrea Bolognani [Tue, 2 Jun 2015 09:17:25 +0000 (11:17 +0200)]
virsh: Use standard error messages in vshCommandOptTimeoutToMs()

I missed this in the first time around, thanks Michal for noticing.

9 years agotests: Add a bunch of new tests to virsh-optparse
Andrea Bolognani [Tue, 2 Jun 2015 09:17:24 +0000 (11:17 +0200)]
tests: Add a bunch of new tests to virsh-optparse

The new tests deal with numeric options of three kinds: regular,
scaled and timeouts. For each, both valid and invalid inputs
are provided, hopefully covering all cases: this should allow us
to avoid regressions when changing the relevant code in virsh.

9 years agostorage: RBD: do not return error when deleting non-existent volume
Erik Skultety [Thu, 28 May 2015 15:14:47 +0000 (17:14 +0200)]
storage: RBD: do not return error when deleting non-existent volume

RBD API returns negative value of errno, in that case we can silently
ignore if RBD tries to delete a non-existent volume, just like FS
backend does.

9 years agostorage: Don't update volume objs list before we successfully create one
Erik Skultety [Thu, 28 May 2015 15:00:01 +0000 (17:00 +0200)]
storage: Don't update volume objs list before we successfully create one

We do update pool volume object list before we actually create any
volume. If buildVol fails, we then try to delete the volume in the
storage as well as remove it from our structures. The problem is, that
any backend that supports both buildVol and deleteVol would fail in this
case which is completely unnecessary. This patch causes the update to
take place after we know a volume has been created successfully, thus no
removal in case of a buildVol failure is necessary.

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

9 years agonwfilter: Fix sscanf off-by-one error in virNWFilterSnoopLeaseFileLoad
Erik Skultety [Tue, 2 Jun 2015 07:25:04 +0000 (09:25 +0200)]
nwfilter: Fix sscanf off-by-one error in virNWFilterSnoopLeaseFileLoad

We allocate 16 bytes for IPv4 address and 55 bytes for interface
key, therefore we should read up to 15/54 bytes and let the last byte
reserved for terminating null byte in sscanf.

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

9 years agoutil: process: @pid in virProcessSetAffinity's BSD impl is not unused
Peter Krempa [Tue, 2 Jun 2015 06:36:21 +0000 (08:36 +0200)]
util: process: @pid in virProcessSetAffinity's BSD impl is not unused

9 years agomaint: update to latest gnulib
Eric Blake [Tue, 26 May 2015 23:34:10 +0000 (17:34 -0600)]
maint: update to latest gnulib

Incorporates fixes for cross-compiling to mingw on rawhide, where
gcc 5.1 changes detection of how to properly determine PRIdMAX.
Also picks up some improvements for compilation on Mac OS X.

* .gnulib: Update to latest, for at least mingw.

Signed-off-by: Eric Blake <eblake@redhat.com>
9 years agospec: fixes for recently introduced libxl conf files
Jim Fehlig [Fri, 1 May 2015 18:39:30 +0000 (12:39 -0600)]
spec: fixes for recently introduced libxl conf files

Commit 198cc1d3 introduced libxl-lockd and libxl-sanlock config
files but forgot to add them to the spec file.  Follow-up commit
62b18d98 added the files to daemon-driver-libxl, but missed adding
them to the daemon package when configuring libvirt
--without-driver-modules.  In addition, commit 62b18d98 added
libxl-sanlock to daemon-driver-libxl, but it should be included
in lock-sanlock when libvirt is configured --with-sanlock.

9 years agolibxl: load on FreeBSD
Roman Bogorodskiy [Sun, 24 May 2015 15:42:41 +0000 (18:42 +0300)]
libxl: load on FreeBSD

The libxl tries to check if it's running in dom0 by parsing
/proc/xen/capabilities and if that fails it doesn't load.

There's no procfs interface in Xen on FreeBSD, so this check always
fails.

In addition to checking procfs, check if /dev/xen/xenstored, that's enough to
check if we're running in dom0 in FreeBSD case.

9 years agovirsh: make negative values with vol-resize more convenient
Ján Tomko [Wed, 27 May 2015 14:46:01 +0000 (16:46 +0200)]
virsh: make negative values with vol-resize more convenient

When shrinking a volume by a certain size, instead of typing
  vol-resize volume 1G --delta --shrink
we allow the convience of specifying a negative value:
  vol-resize volume -1G --delta --shrink
getting the same results with one more character.

A negative value only makes sense as a delta. Imply the
--delta parameter if the value is negative.

Still require --shrink, because the operation is potentially
destructive.

9 years agoqemu: Automatically add <panic> element for pSeries guests.
Andrea Bolognani [Thu, 28 May 2015 14:39:13 +0000 (16:39 +0200)]
qemu: Automatically add <panic> element for pSeries guests.

The guest firmware provides the same functionality as the pvpanic
device, and the relevant element should always be present in the
domain XML to reflect this fact, so add it after parsing the
definition if it wasn't there already.

9 years agoqemu: Allow panic device for pSeries guests
Andrea Bolognani [Thu, 28 May 2015 14:39:12 +0000 (16:39 +0200)]
qemu: Allow panic device for pSeries guests

The guest firmware provides the same functionality as the pvpanic
device, which is not available in QEMU on pSeries, so the domain
XML should be allowed to contain the <panic> element.

On the other hand, unlike the pvpanic device, the guest firmware
can't be configured, so report an error if an address has been
provided in the XML.

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

9 years agoqemu: Improve error message for missing QEMU_CAPS_DEVICE_PANIC.
Andrea Bolognani [Thu, 28 May 2015 14:39:11 +0000 (16:39 +0200)]
qemu: Improve error message for missing QEMU_CAPS_DEVICE_PANIC.

9 years agovirsh: Fix printing of XML for pool-create-as
John Ferlan [Thu, 28 May 2015 18:29:19 +0000 (14:29 -0400)]
virsh: Fix printing of XML for pool-create-as

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

commit id 'bd00e00e' neglected to add the new adapter source options
into the if condition that allowed printing the <source> XML fields.
The <adapter type='fc_host'.../> doesn't require other options in order
to be complete.

9 years agoPost-release version bump to 1.2.17
Daniel P. Berrange [Mon, 1 Jun 2015 09:27:12 +0000 (10:27 +0100)]
Post-release version bump to 1.2.17

9 years agoRelease of libvirt-1.2.16
Daniel Veillard [Mon, 1 Jun 2015 02:30:29 +0000 (10:30 +0800)]
Release of libvirt-1.2.16

- docs/news.html.in libvirt.spec.in: update for the release
- po/*.po*: regenerate

9 years agoAllocate priv->vioserialaddrs unconditionally
Ján Tomko [Fri, 29 May 2015 13:03:24 +0000 (15:03 +0200)]
Allocate priv->vioserialaddrs unconditionally

When attempting to hotplug a virtio-serial console to a domain
that had no virtio-serial controllers (not even those that
are added by libvirt when some devices need them) at daemon startup,
report a user-friendly error:

error: Failed to attach device from console.xml
error: internal error: no virtio-serial controllers are available

instead of crashing the daemon:

Process terminating with default action of signal 11 (SIGSEGV): dumping core
 Access not within mapped region at address 0x8
   at 0x531028F: virDomainVirtioSerialAddrNext (domain_addr.c:916)
   by 0x531028F: virDomainVirtioSerialAddrAssign (domain_addr.c:1029)
   by 0x1CBF68: qemuDomainAttachChrDevice (qemu_hotplug.c:1565)
   by 0x1BCD5E: qemuDomainAttachDeviceLive (qemu_driver.c:7997)
   by 0x1BCD5E: qemuDomainAttachDeviceFlags (qemu_driver.c:8743)

Introduced in v1.2.14-30-g5903378.

9 years agoProperly free the xmlDocPtr when loading pool state
Ján Tomko [Fri, 29 May 2015 13:06:14 +0000 (15:06 +0200)]
Properly free the xmlDocPtr when loading pool state

Use xmlFreeDoc instead of plain xmlFree.

4 bytes in 1 blocks are definitely lost in loss record 9 of 1,084
    at 0x4C29F80: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x70730D6: xmlStrndup (in /usr/lib64/libxml2.so.2.9.2)
    by 0x701E3DC: xmlNewDoc (in /usr/lib64/libxml2.so.2.9.2)
    by 0x70C39F8: xmlSAX2StartDocument (in /usr/lib64/libxml2.so.2.9.2)
    by 0x7017245: xmlParseDocument (in /usr/lib64/libxml2.so.2.9.2)
    by 0x7017606: xmlDoRead (in /usr/lib64/libxml2.so.2.9.2)
    by 0x5309DAD: virXMLParseHelper (virxml.c:742)
    by 0x5367584: virStoragePoolLoadState (storage_conf.c:1863)

9 years agolibxl: support QXL video device
Jim Fehlig [Wed, 29 Apr 2015 16:50:33 +0000 (10:50 -0600)]
libxl: support QXL video device

libxl recently gained support for QXL video device.  Support
it in the libxl driver too.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agolibxl: support SPICE graphics for HVM domains
Jim Fehlig [Mon, 27 Apr 2015 22:27:52 +0000 (16:27 -0600)]
libxl: support SPICE graphics for HVM domains

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agolibxl: change reservedVNCPorts to reservedGraphicsPorts
Jim Fehlig [Tue, 28 Apr 2015 00:53:04 +0000 (18:53 -0600)]
libxl: change reservedVNCPorts to reservedGraphicsPorts

A later change will use the PortAllocator for SPICE too.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agolibxl: populate build_info vfb in separate function
Jim Fehlig [Mon, 27 Apr 2015 18:32:55 +0000 (12:32 -0600)]
libxl: populate build_info vfb in separate function

For HVM domains, vfb info must be populated in the libxl_domain_build_info
struct.  Currently this is done in the libxlMakeVfbList function, but IMO
it would be cleaner to populate the build_info vfb in a separate
libxlMakeBuildInfoVfb function.  libxlMakeVfbList would then handle only
vfb devices, simiar to the other libxlMake<device>List functions.

A future patch will extend libxlMakeBuildInfoVfb to support SPICE.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agostorage: Fix problem with disk backend pool allocation calculation
John Ferlan [Fri, 22 May 2015 01:10:56 +0000 (21:10 -0400)]
storage: Fix problem with disk backend pool allocation calculation

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

The disk pool recalculates the pool allocation, capacity, and available
values each time through processing a newly created disk partition. This
created an issue with the allocation setting since the code used is shared
with the refresh path. Each path calls virStorageBackendDiskReadPartitions
which initializes the pool values and then processes the partition table
from the 'libvirt_parthelper' utility output with the only difference being
create passes a specific volume to be processed while refresh pass a NULL
indicating to process all volumes. That passed volume is check during the
virStorageBackendDiskMakeVol call to see if the current partition described
by the volume key already exists. If it exists, then no adjustments are
made to the allocation and the next entry in the output is checked.

For the create path this resulted in only the most recently created
partition size would be accounted for in the 'allocation' setting. This
patch thus checks whether the incoming volume is NULL before clearing
the pool allocation value.

9 years agostorage: Don't adjust pool alloc/avail values for disk backend
John Ferlan [Tue, 26 May 2015 13:23:28 +0000 (09:23 -0400)]
storage: Don't adjust pool alloc/avail values for disk backend

Commit id '2ac0e647' for https://bugzilla.redhat.com/show_bug.cgi?id=1206521
was meant to be a generic check for the CreateVol, CreateVolFrom, and
DeleteVol paths to check if the storage backend's changed the pool's view
of allocation or available values.

Unfortunately as it turns out this caused a side effect when the disk backend
created an extended partition there would be no actual storage removed from
the pool, thus the changes would not find any change in allocation or
available and incorrectly update the pool values using the size of the
extended partition. A subsequent refresh of the pool would reset the
values appropriately.

This patch modifies those checks in order to specifically not update the
pool allocation and available for only the disk backend rather than be
generic before and after checks.

9 years agoRevert "storage: Don't duplicate efforts of backend driver"
John Ferlan [Tue, 26 May 2015 15:08:41 +0000 (11:08 -0400)]
Revert "storage: Don't duplicate efforts of backend driver"

This reverts commit 2ac0e647bdd33d93a374e7ef3eadf2a253c7bf79.

9 years agodebug: assure NULLSTR() around all %s args in debug at top of public APIs
Laine Stump [Wed, 27 May 2015 17:44:21 +0000 (13:44 -0400)]
debug: assure NULLSTR() around all %s args in debug at top of public APIs

There are also a couple that were very uninformatively just logging
the value of the pointer rather than the string itself:

* the "name" arg to virNodeDeviceLookupByName()
* wwnn and wwpn args to virNodeDeviceLookupSCSIHostByWWN()

All char*'s that make sense should now have their contents logged
rather than the pointer, and all %s args should now be inside
NULLSTR().

9 years agonode_device: more informative error log when device isn't found
Laine Stump [Wed, 27 May 2015 17:59:57 +0000 (13:59 -0400)]
node_device: more informative error log when device isn't found

In a couple of cases, the node device driver (and the test node device
driver which likely copied it) was only logging "Node device not
found" when it couldn't find the requested device. This patch changes
those cases to log the name (and in the case when it's relevant, the
wwnn and wwpn) as well.

9 years agovirsh: Fix to list online cpus using virsh capabilities
Kothapally Madhu Pavan [Tue, 26 May 2015 16:40:34 +0000 (12:40 -0400)]
virsh: Fix to list online cpus using virsh capabilities

Virsh capabilities will list offline cpus as online when
libvirt is compiled with numactl option disabled. This
fix will list correct set of online cpus.

9 years agoFix the event name in vshEventTrayChangePrint
Ján Tomko [Thu, 28 May 2015 12:04:07 +0000 (14:04 +0200)]
Fix the event name in vshEventTrayChangePrint

https://bugzilla.redhat.com/show_bug.cgi?id=1206114#c5

Reported by: zhenfeng wang <zhwang@redhat.com>

9 years agoFix shrinking volumes with the delta flag
Ján Tomko [Wed, 27 May 2015 14:33:22 +0000 (16:33 +0200)]
Fix shrinking volumes with the delta flag

This never worked.

In 0.9.10 when this API was introduced, it was intended that
the SHRINK flag combined with DELTA would shrink the volume by
the specified capacity (to avoid passing negative numbers).
See commit 055bbf4.

When the SHRINK flag was finally implemented for the first backend
in 1.2.13 (commit aa9aa6a), it was only implemented for the absolute
values and with the delta flag the volume is always extended,
regardless of the SHRINK flag.

Treat the SHRINK flag as a minus sign when used together with DELTA,
to allow shrinking volumes as was documented in the API since 0.9.10.

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

9 years agoSimplify allocation check in storageVolResize
Ján Tomko [Wed, 27 May 2015 13:39:07 +0000 (15:39 +0200)]
Simplify allocation check in storageVolResize

Since shrinking a volume below existing allocation is not allowed,
it is not possible for a successful resize with VOL_RESIZE_ALLOCATE
to increase the pool's available value.

Even with the SHRINK flag it is possible to extend the current
allocation or even the capacity. Remove the overflow when
computing delta with this flag and do the check even if the
flag was specified.

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

9 years agoparallels: suppress console output from parallels SDK
Maxim Nestratov [Tue, 26 May 2015 14:57:00 +0000 (17:57 +0300)]
parallels: suppress console output from parallels SDK

It is necessary to have unpolluted screen when connecting to
parallels driver via virsh.
Otherwise a lot of unexpected output one will get on the console.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agointerface: don't error out if a bond has no interfaces
Lubomir Rintel [Wed, 27 May 2015 17:30:50 +0000 (19:30 +0200)]
interface: don't error out if a bond has no interfaces

It's not a problem at all and causes virt-manager to break down.

Note: netcf 0.2.8 and earlier generates invalid XML for a bond with no
interfaces anyway, so in that case this error in libvirt is never
reached since we fail earlier.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
9 years agoqemu: Limit rtc-reset-reinjection requirement to x86 only.
Andrea Bolognani [Tue, 26 May 2015 16:13:40 +0000 (18:13 +0200)]
qemu: Limit rtc-reset-reinjection requirement to x86 only.

The QMP command, like the interrupt reinjection logic it's connected
to, is only implemented in QEMU when TARGET_I386 is defined, so
checking for its availability on any other architecture is pointless.

On the other hand, when we're on x86, we shouldn still make sure that
rtc-reset-reinjection is available and refuse to set the time
otherwise.

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

9 years agostorage_fs: Create directory with UID if needed
Martin Kletzander [Wed, 27 May 2015 08:05:14 +0000 (10:05 +0200)]
storage_fs: Create directory with UID if needed

The code already exists there, it just modified different flags.  I just
noticed this when looking at the code.  This patch is better to view
with bigger context or '-W'.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agoutil: make it more robust to calculate timeout value
Zhang Bo [Mon, 25 May 2015 06:22:42 +0000 (14:22 +0800)]
util: make it more robust to calculate timeout value

When we change system clock to years ago, a certain CPU may use up 100% cputime.
The reason is that in function virEventPollCalculateTimeout(), we assign the
unsigned long long result to an INT variable,
        *timeout = then - now; // timeout is INT, and then/now are long long
        if (*timeout < 0)
            *timeout = 0;
there's a chance that variable @then minus variable @now may be a very large number
that overflows INT value expression, then *timeout will be negative and be assigned to 0.
Next the 'poll' in function virEventPollRunOnce() will get into an 'endless' while loop there.
thus, the cpu that virEventPollRunOnce() thread runs on will go up to 100%.

Although as we discussed before in https://www.redhat.com/archives/libvir-list/2015-May/msg00400.html
it should be prohibited to set-time while other applications are running, but it does
seems to have no harm to make the codes more robust.

Signed-off-by: Wang Yufei <james.wangyufei@huawei.com>
Signed-off-by: Zhang Bo <oscar.zhangbo@huawei.com>
9 years agozfs: fix storagepoolxml2xml test
Roman Bogorodskiy [Tue, 26 May 2015 04:28:43 +0000 (08:28 +0400)]
zfs: fix storagepoolxml2xml test

Commit 7c2d65d dropped setting default mode.

Update zfs tests accordingly.

9 years agoqemu: Fix compilation error when enum variable size differs from 'int'
Peter Krempa [Mon, 25 May 2015 15:14:57 +0000 (17:14 +0200)]
qemu: Fix compilation error when enum variable size differs from 'int'

Since commit bcd9a564b631aa virDomainNumatuneGetMode returns the value
via a pointer rather than in the return value. The change triggered
problems with platforms where the compiler decides to use a data type of
size different than integer at the point where we typecast it.

Work around the issue by using an intermediate variable of the correct
type that gets casted back by the default typecasting rules.

9 years agoutil: improve the sysinfo element XML format
Luyao Huang [Fri, 22 May 2015 09:26:28 +0000 (17:26 +0800)]
util: improve the sysinfo element XML format

If the <sysinfo type='smbios'...> ends up not formatting any sub-elements,
then rather than formatting as:

  <sysinfo type='smbios'>
  </sysinfo>

Just format it more cleanly as:

  <sysinfo type='smbios'/>

Signed-off-by: Luyao Huang <lhuang@redhat.com>
9 years agoconf: Avoid formatting empty redirfilter element
Luyao Huang [Fri, 22 May 2015 09:26:29 +0000 (17:26 +0800)]
conf: Avoid formatting empty redirfilter element

If the redirfilter has no usbdev sub-elements, then do not format anything
rather than formatting an empty pair of elements:

    <redirfilter>
    </redirfilter>

Signed-off-by: Luyao Huang <lhuang@redhat.com>
9 years agomaint: update to latest gnulib
Eric Blake [Tue, 26 May 2015 03:33:24 +0000 (21:33 -0600)]
maint: update to latest gnulib

Time to update to new gnulib before a release.

gcc 5.1 introduced a new -Wformat-signedness, and new gnulib now
turns it on by default.  However, it is still rather lame at the
moment, because it warns for enums, even though there is no way
to control the signeness of an enum which does not use any members
that are negative or larger than INT_MAX, and even though such an
enum would always print the same for both %d and %u:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66249

In file included from ../../src/util/virarch.c:26:0:
../../src/util/virarch.c: In function 'virArchFromHost':
../../src/util/virarch.c:180:15: error: format '%d' expects argument of type 'int', but argument 9 has type 'unsigned int' [-Werror=format=]
     VIR_DEBUG("Mapped %s to %d (%s)",

So this patch turns off the new warning as part of enabling all
other new gcc 5.1 warnings that gnulib now enables.

* .gnulib: Update to latest, in part for gcc 5.1 interaction.
* m4/virt-compile-warnings.m4: Ignore -Wformat-signedness, for now.

Signed-off-by: Eric Blake <eblake@redhat.com>
9 years agoqemu: Add libvirt version check to refresh capabilities algorithm
John Ferlan [Sat, 23 May 2015 14:19:20 +0000 (10:19 -0400)]
qemu: Add libvirt version check to refresh capabilities algorithm

Rather than an algorithm based solely on libvirtd ctime to refresh the
capabilities add the element of the libvirt build version into the equation.
Since that version wouldn't be there prior to this code being run - don't
fail on reading the capabilities if not found. In this case, the cache
will always be rebuilt when a new libvirt version is installed.

9 years agoqemu: Force capabilities cache refresh if libvirtd date is different
John Ferlan [Wed, 20 May 2015 12:05:17 +0000 (08:05 -0400)]
qemu: Force capabilities cache refresh if libvirtd date is different

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

Original commit id 'cbde3589' indicates that the cache file would be
discarded if either the QEMU binary or libvirtd 'ctime' changes; however,
the code only discarded if the QEMU binary time didn't match or if the
new libvirtd ctime was later than what created the cache file.

Since many factors come into play with 'ctime' adjustments (including
perhaps turning back the hands of time), change the logic to also force
a refresh if the ctime of libvirt is different than what's in the cache.

9 years agodocs: update github project name
Daniel P. Berrange [Tue, 26 May 2015 14:07:18 +0000 (15:07 +0100)]
docs: update github project name

The github project was renamed from libvirtproject to libvirt

9 years agoqemu: Resolve Coverity RESOURCE_LEAK
John Ferlan [Mon, 18 May 2015 13:16:53 +0000 (09:16 -0400)]
qemu: Resolve Coverity RESOURCE_LEAK

Recent changes to the -M/--machine processing code in qemuParseCommandLine
caused Coverity to determine there was a possible resource leak with how
the 'list' is managed. Rather than try to add virStringFreeList calls
everywhere - just promote list to the top of the variables and free it
within the error processing code. Also required a couple of other tweaks
in order to avoid double free's.

9 years agoconf: Resolve Coverity NEGATIVE_RETURNS
John Ferlan [Mon, 18 May 2015 12:42:46 +0000 (08:42 -0400)]
conf: Resolve Coverity NEGATIVE_RETURNS

Commit id '73eda710' added virDomainKeyWrapDefParseXML which uses
virXPathNodeSet, but does not handle a -1 return thus causing a possible
loop condition exit problem later when the return value is used.

Change the logic to return the value from virXPathNodeSet if <= 0

9 years agostorage: fs: Only force directory permissions if required
Cole Robinson [Mon, 27 Apr 2015 20:48:05 +0000 (16:48 -0400)]
storage: fs: Only force directory permissions if required

Only set directory permissions at pool build time, if:

- User explicitly requested a mode via the XML
- The directory needs to be created
- We need to do the crazy NFS root-squash workaround

This allows qemu:///session to call build on an existing directory
like /tmp.

9 years agoconf: storage: Don't emit empty <permissions> block
Cole Robinson [Thu, 21 May 2015 19:15:24 +0000 (15:15 -0400)]
conf: storage: Don't emit empty <permissions> block

9 years agostorage: conf: Don't set any default <mode> in the XML
Cole Robinson [Mon, 27 Apr 2015 20:48:05 +0000 (16:48 -0400)]
storage: conf: Don't set any default <mode> in the XML

The XML parser sets a default <mode> if none is explicitly passed in.
This is then used at pool/vol creation time, and unconditionally reported
in the XML.

The problem with this approach is that it's impossible for other code
to determine if the user explicitly requested a storage mode. There
are some cases where we want to make this distinction, but we currently
can't.

Handle <mode> parsing like we handle <owner>/<group>: if no value is
passed in, set it to -1, and adjust the internal consumers to handle
it.

9 years agodocs: formatstorage: Update <permissions> docs
Cole Robinson [Thu, 21 May 2015 19:29:39 +0000 (15:29 -0400)]
docs: formatstorage: Update <permissions> docs

- Don't redocument the permissions fields for backingstore, just point to
  the volume docs.
- Clarify that owner/group are inherited from the parent directory at
  volume create/pool build time.
- Clarify that <permissions> fields report runtime values too

9 years agoparallels: fix possible crash in case of errors in prlsdkLoadDomain
Maxim Nestratov [Thu, 21 May 2015 13:49:35 +0000 (16:49 +0300)]
parallels: fix possible crash in case of errors in prlsdkLoadDomain

Cleanup code in prlsdkLoadDomain doesn't take into account the fact
if private domain structure along with freeing function is assigned
or not. In case it is, we shouldn't call it manually because
virDomainObjListRemove calls it and frees pdom.
Also, allocated def structure should be freed only if it's not
assigned to domain. Otherwise it will be called twice: one time by
virDomainObjListRemove and the second by prlsdkLoadDomain itself.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agoparallels: move up updating parameter in prlsdkLoadDomain
Maxim Nestratov [Thu, 21 May 2015 13:49:34 +0000 (16:49 +0300)]
parallels: move up updating parameter in prlsdkLoadDomain

It is better to get all necessary parameters and check them on newly
created configuration before actually creating a domain with them or
applying them to an existing domain.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
9 years agovirsh: reject negative values for scaled integer
Pavel Hrdina [Fri, 22 May 2015 13:56:57 +0000 (15:56 +0200)]
virsh: reject negative values for scaled integer

Some virsh commands have a size parameter, which is handled as scaled
integer.  We don't have any *feature* that would allow to use '-1' as
maximum size, so it's safe to reject any negative values for those
commands.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
9 years agodocs: Document new RO repo mirrors
Michal Privoznik [Sat, 23 May 2015 05:48:37 +0000 (07:48 +0200)]
docs: Document new RO repo mirrors

In the upstream discussion on creating a github mirror [1], it turned
out that there are some read-only mirrors of our repository. Lets
advertise them on our downloads page. But do it wisely and discourage
people in sending a pull requests on GitHub.

1: https://www.redhat.com/archives/libvir-list/2015-May/msg00775.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agonetwork: Resolve Coverity FORWARD_NULL
John Ferlan [Wed, 13 May 2015 15:10:47 +0000 (11:10 -0400)]
network: Resolve Coverity FORWARD_NULL

To silence Coverity just add a 'p &&' in front of the check in
networkFindUnusedBridgeName after the strchr() call.  Even though
we know it's not possible to have strchr return NULL since the only
way into the function is if there is a '%' in def->bridge or it's NULL.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoconf: Resolve Coverity FORWARD_NULL
John Ferlan [Wed, 13 May 2015 10:50:48 +0000 (06:50 -0400)]
conf: Resolve Coverity FORWARD_NULL

Even though it's been pointed out they are false positives:

http://www.redhat.com/archives/libvir-list/2015-May/msg00301.html

and

http://www.redhat.com/archives/libvir-list/2015-May/msg00302.html

these still show up as Coverity issues. In order to silence Coverity
add an 'sa_assert' prior to check failure.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agostorage: Resolve Coverity FORWARD_NULL
John Ferlan [Wed, 13 May 2015 10:24:50 +0000 (06:24 -0400)]
storage: Resolve Coverity FORWARD_NULL

Coverity points out it's possible for one of the virCommand{Output|Error}*
API's to have not allocated 'output' and/or 'error' in which case the
strstr comparison will cause a NULL deref

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agozfs: fix storagepoolxml2xml test
Roman Bogorodskiy [Sat, 23 May 2015 19:46:35 +0000 (22:46 +0300)]
zfs: fix storagepoolxml2xml test

Commit c4d27bd dropped output of owner/group -1.

Update zfs tests accordingly.

9 years agobhyve: fix build with gcc48
Roman Bogorodskiy [Sat, 23 May 2015 16:56:43 +0000 (19:56 +0300)]
bhyve: fix build with gcc48

Build with gcc 4.8 fails with:

bhyve/bhyve_monitor.c: In function 'bhyveMonitorIO':
bhyve/bhyve_monitor.c:51:18: error: missing initializer for field 'tv_sec' of 'const struct timespec' [-Werror=missing-field-initializers]
     const struct timespec zerowait = {};

Explicitly initialize zerowait to fix the build.

9 years agoAdd missing XDR_FLAGS
Pavel Fedin [Thu, 21 May 2015 16:02:22 +0000 (19:02 +0300)]
Add missing XDR_FLAGS

Fixes build problems on x86_64-cygwin host for aarch64 target:
  CC       lxc/libvirt_driver_lxc_impl_la-lxc_monitor_protocol.lo
In file included from lxc/lxc_monitor_protocol.c:7:0:
lxc/lxc_monitor_protocol.h:9:21: fatal error: rpc/rpc.h: No such file or directory

  CC       rpc/libvirt_setuid_rpc_client_la-virnetmessage.lo
In file included from rpc/virnetmessage.h:24:0,
                 from rpc/virnetmessage.c:26:
rpc/virnetprotocol.h:9:21: fatal error: rpc/rpc.h: No such file or directory

  CC       lxc/libvirt_lxc-lxc_monitor_protocol.o
In file included from lxc/lxc_monitor_protocol.c:7:0:
lxc/lxc_monitor_protocol.h:9:21: fatal error: rpc/rpc.h: No such file or directory

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
9 years agoutil: better error message after failure to initialize firewall backend
Laine Stump [Thu, 21 May 2015 17:36:18 +0000 (13:36 -0400)]
util: better error message after failure to initialize firewall backend

If the firewalld backend wasn't available and libvirt decides to try
setting up a "direct" backend, it checks for the presence of iptables,
ip6tables, and ebtables. If they are not found, a message like this is logged:

  error : virFirewallValidateBackend:193 : direct firewall backend
          requested, but /usr/sbin/ip6tables is not available:
          No such file or directory

But then at a later time if an attempt is made to use the virFirewall
API, failure will be indicated with:

  error : virFirewallApply:936 : out of memory

This patch changes virFirewallApply to first check if a firewall
backend hadn't been successfully setup, and logs a slightly more
informative message in that case:

  error : virFirewallApply:940 : internal error:
          Failed to initialize a valid firewall backend

This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1223876

9 years agointerface: allow multiple IPv4 addresses + dhcp on a single interface
Laine Stump [Thu, 21 May 2015 15:26:52 +0000 (11:26 -0400)]
interface: allow multiple IPv4 addresses + dhcp on a single interface

As of netcf-0.2.8, netcf supports configuring multipl IPv4 addresses,
as well as simultaneously configuring dhcp and static IPv4 addresses,
on a single interface. This patch updates libvirt's interface.rng to
allow such configurations.

This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1223688

9 years agonetdev: fail when setting up an SRIOV VF if PF is offline
Laine Stump [Tue, 5 May 2015 22:27:47 +0000 (18:27 -0400)]
netdev: fail when setting up an SRIOV VF if PF is offline

If an SRIOV PF is offline, the kernel won't complain if you set the
mac address and vlan tag for a VF via this PF, and it will even let
you assign the VF to a guest using PCI device assignment or macvtap
passthrough. But in this case (the PF isn't online), the device won't
be usable in the guest.

Silently setting the PF online would solve the connectivity problem,
but as pointed out by Dan Berrange, when an interface is set online
with no associated config, the kernel will by default turn on IPv6
autoconf, which could create unexpected security problems for the
host. For this reason, this patch instead logs an error and fails the
operation.

This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=893738

Originally filed against RHEL6, but present in every version of
libvirt until today.

9 years agostorage: conf: Don't output owner/group -1
Cole Robinson [Tue, 5 May 2015 15:58:12 +0000 (11:58 -0400)]
storage: conf: Don't output owner/group -1

-1 is just an internal placeholder and is meaningless to output in the XML.

9 years agonode_device: fix libvirt build if WITH_HAL is defined
Maxim Nestratov [Thu, 21 May 2015 17:23:56 +0000 (20:23 +0300)]
node_device: fix libvirt build if WITH_HAL is defined

commit ffc40b63b50ecb changed uniond _virNodeDevCapData into a typedef
named virNodeDevCapData with a struct that contains the union as well
as a type enum. This change necessitated changing every reference to
"caps->type" into "caps->data.type", but the author of that patch
failed to test a build "WITH_HAL". This patch fixes the one place in
the hal backend that needed changing.

9 years agosysinfo: Fix reports on ARM
Michal Privoznik [Tue, 12 May 2015 16:21:18 +0000 (18:21 +0200)]
sysinfo: Fix reports on ARM

Due to a kernel commit (b4b8f770e), cpuinfo format has changed on
ARMs. Firstly, 'Processor: ...' may not be reported, it's
replaced by 'model name: ...'. Secondly, the "Processor" string
may occur in CPU name, e.g. 'ARMv7 Processor rev 5 (v7l)'.
Therefore, we must firstly look for 'model name' and then for
'Processor' if not found.
Moreover, lines in the cpuinfo file are shuffled, so we better
not manipulate the pointer to start of internal buffer as we may
lost some info.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemuDomainDetachChrDevice: Fix chardev hot-unplug
Michal Privoznik [Mon, 11 May 2015 15:05:21 +0000 (17:05 +0200)]
qemuDomainDetachChrDevice: Fix chardev hot-unplug

Not every chardev is plugged onto virtio-serial bus. However, the
code introduced in 89e991a2aa36b04 assumes that. Incorrectly.
With previous patches we have three options where a chardev can
be plugged: virtio-serial, USB and PCI. This commit fixes the
detach part. However, since we are not auto allocating USB
addresses yet, I'm just marking the place where appropriate code
should go.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemuDomainAttachChrDevice: Fix chardev hotplug
Michal Privoznik [Mon, 11 May 2015 13:20:54 +0000 (15:20 +0200)]
qemuDomainAttachChrDevice: Fix chardev hotplug

Not every chardev is plugged onto virtio-serial bus. However, the
code introduced in 89e991a2aa36b04 assumes that. Incorrectly.
With previous patches we have three options where a chardev can
be plugged: virtio-serial, USB and PCI. This commit fixes the
attach part.  However, since we are not auto allocating USB
addresses yet, I'm just marking the place where appropriate code
should go.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: Implement pci-serial
Michal Privoznik [Wed, 6 May 2015 15:50:03 +0000 (17:50 +0200)]
qemu: Implement pci-serial

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

Implementation is pretty straight-forward. Of course, not all qemus
out there supports the device, so new capability is introduced and
checked prior each use of the device.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoIntroduce pci-serial
Michal Privoznik [Wed, 6 May 2015 15:42:41 +0000 (17:42 +0200)]
Introduce pci-serial

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

Like usb-serial, the pci-serial device allows a serial device to be
attached to PCI bus. An example XML looks like this:

  <serial type='dev'>
    <source path='/dev/ttyS2'/>
    <target type='pci-serial' port='0'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
  </serial>

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoutil: Avoid shadow of 'ulong' in virMemoryMaxValue
Peter Krempa [Thu, 21 May 2015 14:50:19 +0000 (16:50 +0200)]
util: Avoid shadow of 'ulong' in virMemoryMaxValue

Old compilers whine:
src/util/virutil.c: In function 'virMemoryMaxValue':
src/util/virutil.c:2612: error: declaration of 'ulong' shadows a global declaration [-Wshadow]
/usr/include/sys/types.h:151: error: shadowed declaration is here [-Wshadow]

s/ulong/capped/ to work around the problem

9 years agoqemu: wire up virDomainSetUserPassword
Ján Tomko [Mon, 18 May 2015 10:42:07 +0000 (12:42 +0200)]
qemu: wire up virDomainSetUserPassword

Base-64 encode the password and pass it to the guest agent
via the 'guest-set-user-password' command.

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