]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
11 years agoqemu: Avoid leaking uri in qemuMigrationPrepareDirect
Jiri Denemark [Tue, 18 Jun 2013 11:38:55 +0000 (13:38 +0200)]
qemu: Avoid leaking uri in qemuMigrationPrepareDirect

11 years agoqemu_migration: Move waiting for SPICE migration
Michal Privoznik [Mon, 10 Jun 2013 13:35:03 +0000 (15:35 +0200)]
qemu_migration: Move waiting for SPICE migration

Currently, we wait for SPICE to migrate in the very same loop where we
wait for qemu to migrate. This has a disadvantage of slowing seamless
migration down. One one hand, we should not kill the domain until all
SPICE data has been migrated.  On the other hand, there is no need to
wait in the very same loop and hence slowing down 'cont' on the
destination. For instance, if users are watching a movie, they can
experience the movie to be stopped for a couple of seconds, as
processors are not running nor on src nor on dst as libvirt waits for
SPICE to migrate. We should move the waiting phase to migration CONFIRM
phase.

11 years agospec: Enable KVM support on ARM
Cole Robinson [Mon, 17 Jun 2013 16:19:46 +0000 (12:19 -0400)]
spec: Enable KVM support on ARM

F20/rawhide has support for this.

From: Peter Robinson <pbrobinson@gmail.com>

11 years agovirsh: Support SCSI_GENERIC cap flag for nodedev-list
Osier Yang [Mon, 3 Jun 2013 10:05:35 +0000 (18:05 +0800)]
virsh: Support SCSI_GENERIC cap flag for nodedev-list

Document for nodedev-list is also updated.

11 years agonodedev: Support SCSI_GENERIC cap flag for listAllNodeDevices
Osier Yang [Mon, 3 Jun 2013 10:05:34 +0000 (18:05 +0800)]
nodedev: Support SCSI_GENERIC cap flag for listAllNodeDevices

11 years agonodedev_hal: Enumerate scsi generic device
Osier Yang [Mon, 3 Jun 2013 10:05:33 +0000 (18:05 +0800)]
nodedev_hal: Enumerate scsi generic device

The xml outputed by HAL backend for scsi generic device:

<device>
  <name>pci_8086_2922_scsi_host_scsi_device_lun0_scsi_generic</name>
  <path>/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0</path>
  <parent>pci_8086_2922_scsi_host_scsi_device_lun0</parent>
  <capability type='scsi_generic'>
    <char>/dev/sg0</char>
  </capability>
</device>

11 years agonodedev_udev: Enumerate scsi generic device
Osier Yang [Mon, 3 Jun 2013 10:05:32 +0000 (18:05 +0800)]
nodedev_udev: Enumerate scsi generic device

Since scsi generic device doesn't have DEVTYPE property set, the
only way to know if it's a  scsi generic device or not is to read
the "SUBSYSTEM" property.

The XML of the scsi generic device will be like:

<device>
  <name>scsi_generic_sg0</name>
  <path>/sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/scsi_generic/sg0</path>
  <parent>scsi_0_0_0_0</parent>
  <capability type='scsi_generic'>
    <char>/dev/sg0</char>
  </capability>
</device>

11 years agoqemu: set QEMU_CAPS_DEVICE_VIDEO_PRIMARY cap flag in QMP detection
Guannan Ren [Tue, 18 Jun 2013 06:09:20 +0000 (14:09 +0800)]
qemu: set QEMU_CAPS_DEVICE_VIDEO_PRIMARY cap flag in QMP detection

When qemu >= 1.20, it is safe to use -device for primary video
device as described in 4c993d8ab.
So, we are missing the cap flag in QMP capabilities detection, this
flag can be initialized safely in virQEMUCapsInitQMPBasic.

11 years agonodedev_udev: changes missed by commit 1aa0ba3cef
Osier Yang [Tue, 18 Jun 2013 08:39:24 +0000 (16:39 +0800)]
nodedev_udev: changes missed by commit 1aa0ba3cef

11 years agonodedev_udev: Refactor udevGetDeviceType
Osier Yang [Mon, 3 Jun 2013 10:05:31 +0000 (18:05 +0800)]
nodedev_udev: Refactor udevGetDeviceType

Checking if the "devtype" is NULL along with each "if" statements
is bad. It wastes the performance, and also not good for reading.
And also when the "devtype" is NULL, the logic is also not clear.

This reorgnizes the logic of with "if...else" and a bunch of "else if".

Other changes:
   * Change the function style.
   * Remove the useless debug statement.
   * Get rid of the goto
   * New helper udevDeviceHasProperty to simplify the logic for checking
     if a property is existing for the device.
   * Add comment to clarify "PCI devices don't set the DEVTYPE property"
   * s/sysfs path/sysfs name/, as udev_device_get_sysname returns the
     name instead of the full path. E.g. "sg0"
   * Refactor the comment for setting VIR_NODE_DEV_CAP_NET cap type
     a bit.

11 years agonodedev: Expose sysfs path of device
Osier Yang [Mon, 3 Jun 2013 10:05:30 +0000 (18:05 +0800)]
nodedev: Expose sysfs path of device

The name format is constructed by libvirt, it's not that clear to
get what the device's sysfs path should be. This exposes the device's
sysfs path by a new tag <path>.

Since the sysfspath is filled during enumerating the devices by
either udev or HAL. It's an output-only tag.

11 years agoMove virGetUserEnt() to where its needed
Doug Goldstein [Sun, 16 Jun 2013 19:33:44 +0000 (14:33 -0500)]
Move virGetUserEnt() to where its needed

In the first if case, virGetUserEnt() isn't necessary so don't bother
calling it before determining we need it.

11 years agoBSD: implement virNetDevTapCreate() and virNetDevTapDelete()
Roman Bogorodskiy [Thu, 13 Jun 2013 06:26:21 +0000 (10:26 +0400)]
BSD: implement virNetDevTapCreate() and virNetDevTapDelete()

Implementation uses SIOCIFCREATE2 and SIOCIFDESTROY ioctls.

11 years agoMake virNetDevSetupControl() public.
Roman Bogorodskiy [Thu, 13 Jun 2013 06:26:20 +0000 (10:26 +0400)]
Make virNetDevSetupControl() public.

This method is useful not only in virnetdev.c.

11 years agoportability: use net/if.h instead of linux/if.h
Roman Bogorodskiy [Thu, 13 Jun 2013 06:26:22 +0000 (10:26 +0400)]
portability: use net/if.h instead of linux/if.h

11 years agoudev: fix crash in libudev logging
Ján Tomko [Fri, 7 Jun 2013 09:55:27 +0000 (11:55 +0200)]
udev: fix crash in libudev logging

Call virLogVMessage instead of virLogMessage, since libudev
called us with a va_list object, not a list of arguments.

Honor message priority and strip the trailing newline.

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

11 years agoLXC: s/chroot/chdir in lxcContainerPivotRoot()
Richard Weinberger [Fri, 14 Jun 2013 06:57:55 +0000 (08:57 +0200)]
LXC: s/chroot/chdir in lxcContainerPivotRoot()

...fixes a trivial copy&paste error.

Signed-off-by: Richard Weinberger <richard@nod.at>
11 years agoremote: Fix client crash when URI path is empty when using ssh
Peter Krempa [Fri, 14 Jun 2013 08:41:29 +0000 (10:41 +0200)]
remote: Fix client crash when URI path is empty when using ssh

The parsed path in the URI may be NULL resulting into:

  $ virsh -c qemu+ssh:// list
  Segmentation fault (core dumped)

Introduced by 22d81ceb46ea4b83ad817c29b2b04df27a09c671

11 years agoremote: Forbid default "/session" connections when using ssh transport
Peter Krempa [Mon, 10 Jun 2013 12:41:22 +0000 (14:41 +0200)]
remote: Forbid default "/session" connections when using ssh transport

Without the socket path explicitly specified, the remote driver tried to
connect to the "/system" instance socket even if "/session" was
specified in the uri. With this patch this configuration now produces an
error.

It is still possible to initiate a session connection with specifying
the path to the socket manually and also manually starting the session
daemon. This was also possible prior to this patch,

This is a minimal fix. We may decide to support remote session
connections using ssh but this will require changes to the remote driver
code so this fix shouldn't cause regressions in the case we decide to do
that.

11 years agoImplement dispose method for libxlDomainObjPrivate
Frediano Ziglio [Thu, 13 Jun 2013 15:35:11 +0000 (16:35 +0100)]
Implement dispose method for libxlDomainObjPrivate

When creating a timer/event handler reference counting is used. So it could
be possible (in theory) that libxlDomainObjPrivateFree is called with
reference counting >1. The problem is that libxlDomainObjPrivateFree leave
the object in an invalid state with ctx freed (but still having dandling
pointer). This can lead timer/event handler to core.

This patch implements a dispose method for libxlDomainObjPrivate, and moves
freeing the libxl ctx to the dispose method, ensuring the ctx is valid while
the object's reference count is > 0.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
11 years agolibxl: allow only 'ethernet' and 'bridge' interfaces, allow script there
Marek Marczykowski-Górecki [Thu, 13 Jun 2013 01:54:03 +0000 (03:54 +0200)]
libxl: allow only 'ethernet' and 'bridge' interfaces, allow script there

Actually only those interface types are handled correctly so reject
others instead of ignoring settings (i.e. treating as bridge/ethernet
anyway).
Also allow <script/> in 'ethernet' (which should be the only
script-allowing type). Keep <script/> allowed in bridge to be compatible
with legacy 'xen' driver.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
11 years agoqemu: allow restore with non-migratable XML input
Ján Tomko [Tue, 11 Jun 2013 13:03:17 +0000 (15:03 +0200)]
qemu: allow restore with non-migratable XML input

Convert input XML to migratable before using it in
qemuDomainSaveImageOpen.

XML in the save image is migratable, i.e. doesn't contain implicit
controllers. If these controllers were in a non-default order in the
input XML, the ABI check would fail. Removing and re-adding these
controllers fixes it.

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

11 years agoconfigure: Remove unused brctl check
Cole Robinson [Tue, 11 Jun 2013 21:47:24 +0000 (17:47 -0400)]
configure: Remove unused brctl check

brctl isn't used anywhere AFAICT

11 years agolibxl: set bootloader for PV domains if not specified
Jim Fehlig [Fri, 17 May 2013 15:30:08 +0000 (09:30 -0600)]
libxl: set bootloader for PV domains if not specified

The legacy xen toolstack will set pygrub as the bootloader if not
specified.  For compatibility, do the same in the libxl driver
iff not using direct kernel boot.

11 years agolibxl: Report connect type as Xen
Jim Fehlig [Fri, 17 May 2013 15:17:03 +0000 (09:17 -0600)]
libxl: Report connect type as Xen

Currently, the libxl driver reports a connection type of "xenlight".
To be compatible with the legacy Xen driver, it should return "Xen".

Note: I noticed this while testing the libxl driver on OpenStack.
After switching my Xen compute nodes to use the libxl stack, I
could no longer launch instances on those nodes since
hypervisor_type was reported as "xenlight" instead of "xen".

11 years agoschema: simplify RNG pattern, remove superfluous <optional>
Claudio Bley [Wed, 12 Jun 2013 10:14:31 +0000 (12:14 +0200)]
schema: simplify RNG pattern, remove superfluous <optional>

11 years agonodedev: fix vport detection for FC HBA
Ján Tomko [Wed, 12 Jun 2013 08:30:13 +0000 (10:30 +0200)]
nodedev: fix vport detection for FC HBA

Use the host number as the host number when constructing the sysfs path
instead of the variable we are trying to fill.

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

11 years agolibvirt_private.syms: add virProcessGetStartTime
Ján Tomko [Wed, 12 Jun 2013 08:13:29 +0000 (10:13 +0200)]
libvirt_private.syms: add virProcessGetStartTime

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

11 years agoqemu: Forbid migration of machines with I/O errors
Peter Krempa [Mon, 10 Jun 2013 14:30:48 +0000 (16:30 +0200)]
qemu: Forbid migration of machines with I/O errors

Such machine can't be successuflly migrated unles the I/O error has
recovered and might lead to data corruption. Forbid this kind of
migration.

11 years agoqemu: Cancel migration if guest encoutners I/O error while migrating
Peter Krempa [Mon, 10 Jun 2013 14:05:45 +0000 (16:05 +0200)]
qemu: Cancel migration if guest encoutners I/O error while migrating

During a live migration the guest may receive a disk access I/O error.
In this state the guest is unable to continue running on a remote host
after migration as some state may be present in the kernel and not
migrated.

With this patch, the migration is canceled in such case so it can either
continue on the source if the I/O issues are recovered or has to be
destroyed anyways.

11 years agoqemu_migrate: Dispose listen address if set from config
Michal Privoznik [Mon, 10 Jun 2013 15:51:46 +0000 (17:51 +0200)]
qemu_migrate: Dispose listen address if set from config

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

As of d7f9d827531bc843b7c5aa9d3e8c08738a1de248 we copy the listen
address from the qemu.conf config file in case none has been provided
via XML. But later, when migrating, we should not include such listen
address in the migratable XML as it is something autogenerated, not
requested by user. Moreover, the binding to the listen address will
likely fail, unless the address is '0.0.0.0' or its IPv6 equivalent.
This patch introduces a new boolean attribute to virDomainGraphicsListenDef
to distinguish autofilled listen addresses. However, we must keep the
attribute over libvirtd restarts, so it must be kept within status XML.

11 years agoqemu: Fix memory leak in Prepare phase
Jiri Denemark [Fri, 7 Jun 2013 12:12:28 +0000 (14:12 +0200)]
qemu: Fix memory leak in Prepare phase

Avoid leaking virDomainDef if Prepare phase fails before it gets to
qemuMigrationPrepareAny.

11 years agoselinux: assume 's0' if the range is empty
Ján Tomko [Mon, 10 Jun 2013 12:37:40 +0000 (14:37 +0200)]
selinux: assume 's0' if the range is empty

This fixes a crash:
https://bugzilla.redhat.com/show_bug.cgi?id=969878

11 years agostorage_backend: Drop unused code
Cole Robinson [Mon, 10 Jun 2013 15:10:31 +0000 (11:10 -0400)]
storage_backend: Drop unused code

This has been disabled for years

11 years agovirSocketAddrIsWildcard: Use IN6_IS_ADDR_UNSPECIFIED correctly
Michal Privoznik [Mon, 10 Jun 2013 12:11:37 +0000 (14:11 +0200)]
virSocketAddrIsWildcard: Use IN6_IS_ADDR_UNSPECIFIED correctly

The IN6_IS_ADDR_UNSPECIFIED macro expects pointer to sin6_addr element
instead of s6_addr element.

11 years agostorage: fix description of versionOffset
Martin Kletzander [Mon, 10 Jun 2013 09:44:31 +0000 (11:44 +0200)]
storage: fix description of versionOffset

11 years agoFix commit 29c1e913e459058c12d02b3f4b767b3dd428a498
Peter Krempa [Fri, 7 Jun 2013 15:12:47 +0000 (17:12 +0200)]
Fix commit 29c1e913e459058c12d02b3f4b767b3dd428a498

This patch fixes changes done in commit 29c1e913e459058c12d02b3f4b767b3
that was pushed without implementing review feedback.

The flag introduced by the patch is changed to VIR_DOMAIN_VCPU_GUEST and
documentation makes the difference between regular hotplug and this new
functionality more explicit.

The virsh options that enable the use of the new flag are changed to
"--guest" and the documentation is fixed too.

11 years agospec: Drop Requires: vbox
Cole Robinson [Thu, 6 Jun 2013 17:54:17 +0000 (13:54 -0400)]
spec: Drop Requires: vbox

Since this package isn't provided by any stock RH based distro. The
upstream RPMs are called VirtualBox anyways.

11 years agoFix ordering of file open in virProcessGetNamespaces
Richard Weinberger [Fri, 7 Jun 2013 16:30:09 +0000 (17:30 +0100)]
Fix ordering of file open in virProcessGetNamespaces

virProcessGetNamespaces() opens files in /proc/XXX/ns/ which will
later be passed to setns(). We have to make sure that the file
descriptors in the array are in the correct order. In particular
the 'user' namespace must be first otherwise setns() may fail
for other namespaces.

The order has been taken from util-linux's sys-utils/nsenter.c

Also we must ignore EINVAL in setns() which occurs if the
namespace associated with the fd, matches the calling process'
current namespace.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoPrefer VIR_STRDUP over virAsprintf(&dst, "%s", str)
Michal Privoznik [Fri, 7 Jun 2013 13:20:35 +0000 (15:20 +0200)]
Prefer VIR_STRDUP over virAsprintf(&dst, "%s", str)

There's no sense in using virAsprintf() just to duplicate a string.
We should use VIR_STRDUP which is designed just for that.

11 years agoqemuDomainGetVcpusFlags: Initialize ncpuinfo
Michal Privoznik [Fri, 7 Jun 2013 14:42:24 +0000 (16:42 +0200)]
qemuDomainGetVcpusFlags: Initialize ncpuinfo

Currently, there's a path to use the ncpuinfo variable uninitialized,
which leads to a compiler warning:

    qemu/qemu_driver.c: In function 'qemuDomainGetVcpusFlags':
    qemu/qemu_driver.c:4573:9: error: 'ncpuinfo' may be used
    uninitialized in this function [-Werror=maybe-uninitialized]
             for (i = 0; i < ncpuinfo; i++) {
             ^

11 years agoqemu: Implement new QMP command for cpu hotplug
Peter Krempa [Mon, 27 May 2013 14:08:30 +0000 (16:08 +0200)]
qemu: Implement new QMP command for cpu hotplug

This patch implements support for the "cpu-add" QMP command that plugs
CPUs into a live guest. The "cpu-add" command was introduced in QEMU
1.5. For the hotplug to work machine type "pc-i440fx-1.5" is required.

11 years agoqemu: Implement support for VIR_DOMAIN_VCPU_AGENT in qemuDomainSetVcpusFlags
Peter Krempa [Mon, 15 Apr 2013 15:02:06 +0000 (17:02 +0200)]
qemu: Implement support for VIR_DOMAIN_VCPU_AGENT in qemuDomainSetVcpusFlags

This patch adds support for agent-based cpu disabling and enabling to
qemuDomainSetVcpusFlags() API.

11 years agoqemu: Implement request of vCPU state using the guest agent
Peter Krempa [Mon, 15 Apr 2013 13:42:49 +0000 (15:42 +0200)]
qemu: Implement request of vCPU state using the guest agent

This patch implements the VIR_DOMAIN_VCPU_AGENT flag for the
qemuDomainGetVcpusFlags() libvirt API implementation.

11 years agoAPI: Introduce VIR_DOMAIN_VCPU_AGENT, for agent based CPU hot(un)plug
Peter Krempa [Fri, 12 Apr 2013 12:30:41 +0000 (14:30 +0200)]
API: Introduce VIR_DOMAIN_VCPU_AGENT, for agent based CPU hot(un)plug

This flag will allow to use qemu guest agent commands to disable
(offline) and enable (online) processors in a live guest that has the
guest agent running.

11 years agoqemu_agent: Introduce helpers for agent based CPU hot(un)plug
Peter Krempa [Fri, 12 Apr 2013 10:14:02 +0000 (12:14 +0200)]
qemu_agent: Introduce helpers for agent based CPU hot(un)plug

The qemu guest agent allows to online and offline CPUs from the
perspective of the guest. This patch adds helpers that call
'guest-get-vcpus' and 'guest-set-vcpus' guest agent functions and
convert the data for internal libvirt usage.

11 years agoqemu: Use bool instead of int in qemuMonitorSetCPU APIs
Peter Krempa [Mon, 27 May 2013 13:35:35 +0000 (15:35 +0200)]
qemu: Use bool instead of int in qemuMonitorSetCPU APIs

The 'online' parameter has only two possible values. Use a bool for it.

11 years agovirsh-domain-monitor: Remove ATTRIBUTE_UNUSED from a argument
Peter Krempa [Mon, 27 May 2013 10:08:00 +0000 (12:08 +0200)]
virsh-domain-monitor: Remove ATTRIBUTE_UNUSED from a argument

The "cmd" argument in cmdList is now used. Unmark it as unused.

11 years agoAdd support for VirtualBox 4.2 APIs
ryan woodsmall [Tue, 2 Oct 2012 09:00:54 +0000 (04:00 -0500)]
Add support for VirtualBox 4.2 APIs

A few things have changed in the VirtualBox API - some small
(capitalizations of things in function names like Ip to IP
and Dhcp to DHCP) and some much larger (FindMedium is superceded
by OpenMedium). The biggest change for the sake of this patch
is the signature of CreateMachine is quite a bit different. Using
the Oracle source as a guide, to spin up a VM with a given UUID,
it looks like a text flag has to be passed in a new argument to
CreateMachine. This flag is built in the VirtualBox 4.2 specific
ifdefs and is kind of ugly but works. Additionally, there is now
(unused) VM groups support in CreateMachine and the previous
'osTypeId' arg is currently set to nsnull as in the Oracle code.

The FindMedium to OpenMedium changes were more straightforward
and are pretty clear. The rest of the vbox template changes are
basically spelling/capitalization changes from the looks of things.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoqemuDomainMigrateGraphicsRelocate: Use then new virSocketAddrIsWildcard
Michal Privoznik [Thu, 6 Jun 2013 14:04:42 +0000 (16:04 +0200)]
qemuDomainMigrateGraphicsRelocate: Use then new virSocketAddrIsWildcard

Since we have the new internal API to check for wildcard address,
we can use it instead of parsing and formatting.

11 years agovirsocket: Introduce virSocketAddrIsWildcard
Michal Privoznik [Thu, 6 Jun 2013 13:50:01 +0000 (15:50 +0200)]
virsocket: Introduce virSocketAddrIsWildcard

This internal API checks, if passed address is a wildcard address.

11 years agoiscsi: pass hostnames to iscsiadm instead of resolving them
Ján Tomko [Thu, 6 Jun 2013 12:00:13 +0000 (14:00 +0200)]
iscsi: pass hostnames to iscsiadm instead of resolving them

iscsiadm now supports specifying hostnames in the portal argument [1]

Instead of resolving the hostname to a single IPv4 address, pass the
hostname to isciadm, allowing IPv6 targets to work.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=624437

11 years agoqemu: Report the offset from host UTC for RTC_CHANGE event
Osier Yang [Wed, 5 Jun 2013 10:32:59 +0000 (18:32 +0800)]
qemu: Report the offset from host UTC for RTC_CHANGE event

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

Though both libvirt and QEMU's document say RTC_CHANGE returns
the offset from the host UTC, qemu actually returns the offset
from the specified date instead when specific date is provided
(-rtc base=$date).

It's not safe for qemu to fix it in code, it worked like that
for 3 years, changing it now may break other QEMU use cases.
What qemu tries to do is to fix the document:

http://lists.gnu.org/archive/html/qemu-devel/2013-05/msg04782.html

And in libvirt side, instead of replying on the value from qemu,
this converts the offset returned from qemu to the offset from
host UTC, by:

  /*
   * a: the offset from qemu RTC_CHANGE event
   * b: The specified date (-rtc base=$date)
   * c: the host date when libvirt gets the RTC_CHANGE event
   * offset: What libvirt will report
   */

  offset = a + (b - c);

The specified date (-rtc base=$date) is recorded in clock's def as
an internal only member (may be useful to exposed outside?).

Internal only XML tag "basetime" is introduced to not lose the
guest's basetime after libvirt restarting/reloading:

<clock offset='variable' adjustment='304' basis='utc' basetime='1370423588'/>

11 years agoqemu: simplify CPU command line parsing
Ján Tomko [Thu, 2 May 2013 18:21:31 +0000 (20:21 +0200)]
qemu: simplify CPU command line parsing

Use virStringSplit. Change the 'error' label to 'cleanup' to prevent
memory leaks on error.

11 years agoqemu: change two-state int parameters to bool
Ján Tomko [Fri, 24 May 2013 10:47:17 +0000 (12:47 +0200)]
qemu: change two-state int parameters to bool

11 years agonwfilter: change two-state int parameters to bool
Ján Tomko [Fri, 24 May 2013 10:32:31 +0000 (12:32 +0200)]
nwfilter: change two-state int parameters to bool

11 years agoRemove redundant two-state integers
Ján Tomko [Fri, 24 May 2013 10:29:28 +0000 (12:29 +0200)]
Remove redundant two-state integers

11 years agoReplace two-state local integers with bool
Ján Tomko [Fri, 24 May 2013 10:14:02 +0000 (12:14 +0200)]
Replace two-state local integers with bool

Found with 'git grep "= 1"'.

11 years agostorage: Avoid unnecessary ternary operators and refactor the code
Peter Krempa [Wed, 5 Jun 2013 07:42:59 +0000 (09:42 +0200)]
storage: Avoid unnecessary ternary operators and refactor the code

Setting of local variables in virStorageBackendCreateQemuImgCmd was
unnecessarily cluttered with ternary operators and repeated testing of
of conditions.

This patch refactors the function to use if statements and improves
error reporting in case inputvol is specified but does not contain
target path. Previously we would complain about "unknown storage vol
type 0" instead of the actual problem.

11 years agoopenvz: Fix code coverage issue in OpenVZ driver
Alvaro Polo [Thu, 6 Jun 2013 07:53:54 +0000 (09:53 +0200)]
openvz: Fix code coverage issue in OpenVZ driver

After fixing an invalid usage of virDomainNetDef in OpenVZ driver,
a coverage issue appeared. This was caused by a still invalid usage
of net->data.ethernet.dev for non ethernet networking.

11 years agoqemu: Reformat listen address prior to checking
Michal Privoznik [Wed, 5 Jun 2013 15:05:50 +0000 (17:05 +0200)]
qemu: Reformat listen address prior to checking

Currently, a listen address for a SPICE server can be specified. Later,
when the domain is migrated, we need to relocate the graphics which
involves telling new destination to the SPICE server. However, we can't
just assume the listen address is the new location, because the listen
address can be ANYCAST (0.0.0.0 for IPv4, :: for IPv6). In which case,
we want to pass the remote hostname. But there are some troubles with
ANYCAST. In both IPv4 and IPv6 it has many ways for specifying such
address. For instance, in IPv4: 0, 0.0, 0.0.0, 0.0.0.0.  The number of
variations gets bigger in IPv6 world. Hence, in order to check for
ANYCAST address sanely, we should take the provided listen address,
parse it and format back in it's full form. Which is exactly what this
patch does.

11 years agobuild: fix build without posix_fallocate
Eric Blake [Thu, 6 Jun 2013 02:33:15 +0000 (20:33 -0600)]
build: fix build without posix_fallocate

Such as on FreeBSD.  Broken in commit aa2a4cff7.

* src/util/virstoragefile.c (virStorageFileResize): Add missing ';',
mark conditionally unused variables.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoEnsure non-root can read /proc/meminfo file in LXC containers
Daniel P. Berrange [Tue, 4 Jun 2013 16:37:03 +0000 (17:37 +0100)]
Ensure non-root can read /proc/meminfo file in LXC containers

By default files in a FUSE mount can only be accessed by the
user which created them, even if the file permissions would
otherwise allow it. To allow other users to access the FUSE
mount the 'allow_other' mount option must be used. This bug
prevented non-root users in an LXC container from reading
the /proc/meminfo file.

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

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRemove legacy code for single-instance devpts filesystem
Daniel P. Berrange [Tue, 4 Jun 2013 13:40:57 +0000 (14:40 +0100)]
Remove legacy code for single-instance devpts filesystem

Earlier commit f7e8653f dropped support for using LXC with
kernels having single-instance devpts filesystem from the
LXC controller. It forgot to remove the same code from the
LXC container setup.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agostorage: Provide better error message if metadata pre-alloc is unsupported
Peter Krempa [Wed, 5 Jun 2013 07:38:41 +0000 (09:38 +0200)]
storage: Provide better error message if metadata pre-alloc is unsupported

Instead of a unknown flag error report that metadata pre-allocation is
not supported with the requested volume creation method.

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

11 years agostorage: Clean up function header and reflow error message
Peter Krempa [Wed, 5 Jun 2013 07:41:38 +0000 (09:41 +0200)]
storage: Clean up function header and reflow error message

Comply with the coding standard and save a few lines.

11 years agostoragevolxml2argvtest: Report better error messages on test failure
Peter Krempa [Wed, 5 Jun 2013 08:49:15 +0000 (10:49 +0200)]
storagevolxml2argvtest: Report better error messages on test failure

If the creation of the commandline failed, libvirt always reported "out
of memory" from the virCommandToString function rather than the proper
error that happened in virStorageBackendCreateQemuImgCmd. Error out
earlier.

11 years agomaint: don't use config.h in .h files
Eric Blake [Fri, 31 May 2013 17:52:51 +0000 (11:52 -0600)]
maint: don't use config.h in .h files

Enforce the rule that .h files don't need to (redundantly)
include <config.h>.

* cfg.mk (sc_prohibit_config_h_in_headers): New rule.
(_virsh_includes): Delete; instead, inline a smaller number of
exclusions...
(exclude_file_name_regexp--sc_require_config_h)
(exclude_file_name_regexp--sc_require_config_h_first): ...here.
* daemon/libvirtd.h (includes): Fix offenders.
* src/driver.h (includes): Likewise.
* src/gnutls_1_0_compat.h (includes): Likewise.
* src/libxl/libxl_conf.h (includes): Likewise.
* src/libxl/libxl_driver.h (includes): Likewise.
* src/lxc/lxc_conf.h (includes): Likewise.
* src/lxc/lxc_driver.h (includes): Likewise.
* src/lxc/lxc_fuse.h (includes): Likewise.
* src/network/bridge_driver.h (includes): Likewise.
* src/phyp/phyp_driver.h (includes): Likewise.
* src/qemu/qemu_conf.h (includes): Likewise.
* src/util/virnetlink.h (includes): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoqemu: Abstract code for the cpu controller setting into a helper
Osier Yang [Fri, 24 May 2013 09:08:27 +0000 (17:08 +0800)]
qemu: Abstract code for the cpu controller setting into a helper

11 years agostorage: Forbid to shrink the vol's capacity if no --shrink is specified
Osier Yang [Fri, 31 May 2013 05:16:15 +0000 (13:16 +0800)]
storage: Forbid to shrink the vol's capacity if no --shrink is specified

As the document for "virsh-resize" says:
<...>
Attempts to shrink the volume will fail unless I<--shrink> is present;
</...>

This makes sense as it at least prevent the user shrinking the important
data of volume without a notice.

11 years agostorage: Support preallocate the new capacity for vol-resize
Osier Yang [Fri, 31 May 2013 05:16:14 +0000 (13:16 +0800)]
storage: Support preallocate the new capacity for vol-resize

The document for "vol-resize" says the new capacity will be sparse
unless "--allocate" is specified, however, the "--allocate" flag
is never implemented. This implements the "--allocate" flag for
fs backend's raw type volume, based on posix_fallocate and the
syscall SYS_fallocate.

11 years agovirtlockd: fix socket path
Ján Tomko [Tue, 4 Jun 2013 11:36:56 +0000 (13:36 +0200)]
virtlockd: fix socket path

Change the socket path to match the one used by lockd driver.

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

11 years agosnapshot: remove mutually exclusive memory and disk-only duplicate check
Guannan Ren [Tue, 4 Jun 2013 08:42:55 +0000 (16:42 +0800)]
snapshot: remove mutually exclusive memory and disk-only duplicate check

The work was done at the time of snapshot xmlstring parsing

 if (offline && def->memory &&
     def->memory != VIR_DOMAIN_SNAPSHOT_LOCATION_NONE) {
     virReportError(...);
 }

11 years agonwfilter: grab driver lock earlier during init (bz96649)
Stefan Berger [Tue, 4 Jun 2013 18:50:20 +0000 (14:50 -0400)]
nwfilter: grab driver lock earlier during init (bz96649)

This patch is in relation to Bug 966449:

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

This is a patch addressing the coredump.

Thread 1 must be calling  nwfilterDriverRemoveDBusMatches(). It does so with
nwfilterDriverLock held. In the patch below I am now moving the
nwfilterDriverLock(driverState) further up so that the initialization, which
seems to either take a long time or is entirely stuck, occurs with the lock
held and the shutdown cannot occur at the same time.

Remove the lock in virNWFilterDriverIsWatchingFirewallD to avoid
double-locking.

11 years agoFix a invalid usage of virDomainNetDef in OpenVZ driver
Alvaro Polo [Tue, 4 Jun 2013 07:44:32 +0000 (09:44 +0200)]
Fix a invalid usage of virDomainNetDef in OpenVZ driver

OpenVZ was accessing ethernet data to obtain the guest iface name
regardless the domain is configured to use ethernet or bridged
networking. This prevented the guest network interface to be rightly
named for bridged networking.

11 years agodocs: add spaces to formatstorage.html
Ján Tomko [Tue, 4 Jun 2013 13:20:51 +0000 (15:20 +0200)]
docs: add spaces to formatstorage.html

Let the pool types breathe.

11 years agovirsh: Allow attach-disk to specify disk wwn
Osier Yang [Tue, 4 Jun 2013 03:27:04 +0000 (11:27 +0800)]
virsh: Allow attach-disk to specify disk wwn

Commit 6e73850b01ee support to set wwn for disks, but it was not
exposed to attach-disk.

11 years agotests: fix typo in securityselinuxtest
Ján Tomko [Tue, 4 Jun 2013 11:01:03 +0000 (13:01 +0200)]
tests: fix typo in securityselinuxtest

11 years agovirsh: Obey pool-or-uuid spec when creating volumes
Jiri Denemark [Tue, 4 Jun 2013 08:16:02 +0000 (10:16 +0200)]
virsh: Obey pool-or-uuid spec when creating volumes

Our documentation says a pool may be referenced by its name or UUID
anywhere if it makes sense (pool-name and pool-uuid are the only
exceptions). However, vol-create and vol-create-as commands did not obey
this.

11 years agolibvirt-qemu: Dispatch errors from virDomainQemuAgentCommand()
Peter Krempa [Mon, 3 Jun 2013 14:12:52 +0000 (16:12 +0200)]
libvirt-qemu: Dispatch errors from virDomainQemuAgentCommand()

The original implementation didn't follow the established pattern and
did not dispatch errors in case of failure.

11 years agoqemu: Properly report guest agent errors on command passthrough
Peter Krempa [Mon, 3 Jun 2013 13:58:31 +0000 (15:58 +0200)]
qemu: Properly report guest agent errors on command passthrough

The code for arbitrary guest agent passthrough was horribly broken since
introduction. Fix it to correctly report errors.

11 years agovirsh-domain: Report errors and don't deref NULL in qemu-agent-command
Peter Krempa [Mon, 3 Jun 2013 13:42:26 +0000 (15:42 +0200)]
virsh-domain: Report errors and don't deref NULL in qemu-agent-command

Check the returned value for NULL and take the cleanup path
appropriately if the API fails.

11 years agoRPC: Support up to 16384 cpus on the host and 4096 in the guest
Peter Krempa [Tue, 28 May 2013 12:29:12 +0000 (14:29 +0200)]
RPC: Support up to 16384 cpus on the host and 4096 in the guest

The RPC limits for cpu maps didn't allow to use libvirt on ultra big
boxes. This patch increases size of the limits to support a maximum of
16384 cpus on the host with a maximum of 4096 cpus per guest.
The full cpu map of such a system takes 8 megabytes and the map for
vcpu pinning is 2 kilobytes long.

11 years agospec: Explicitly require libgcrypt-devel
Jiri Denemark [Mon, 3 Jun 2013 12:57:29 +0000 (14:57 +0200)]
spec: Explicitly require libgcrypt-devel

Our configure.ac says:

    Not all versions of gnutls include -lgcrypt, and so we add
    it explicitly for the calls to gcry_control/check_version

Thus we cannot rely on gnutls-devel to bring grcypt-devel as a
dependency.

11 years agovirsh iface-bridge: Ignore delay if stp is turned off
Jiri Denemark [Fri, 31 May 2013 23:28:36 +0000 (01:28 +0200)]
virsh iface-bridge: Ignore delay if stp is turned off

Delay only makes sense with STP enabled.

11 years agoFix warning about using an uninitialized next_unit value
Jiri Denemark [Mon, 3 Jun 2013 10:19:09 +0000 (12:19 +0200)]
Fix warning about using an uninitialized next_unit value

Using an uninitialized value and a bool saying if the value is valid may
confuse compilators.

11 years agovirsh-domain: Add --live, --config, --current logic to cmdAttachInterface
Peter Krempa [Tue, 28 May 2013 09:07:33 +0000 (11:07 +0200)]
virsh-domain: Add --live, --config, --current logic to cmdAttachInterface

Use the approach established in commit
69ce3ffa8d431e9810607c6e00b7cfcc481b491d to improve this function too.

11 years agovirsh-domain: Add --live, --config, --current logic to cmdAttachDisk
Peter Krempa [Tue, 28 May 2013 09:07:33 +0000 (11:07 +0200)]
virsh-domain: Add --live, --config, --current logic to cmdAttachDisk

Use the approach established in commit
69ce3ffa8d431e9810607c6e00b7cfcc481b491d to improve this function too.

11 years agovirsh-domain: Add --live, --config, --current logic to cmdAttachDevice
Peter Krempa [Tue, 28 May 2013 09:07:33 +0000 (11:07 +0200)]
virsh-domain: Add --live, --config, --current logic to cmdAttachDevice

Use the approach established in commit
69ce3ffa8d431e9810607c6e00b7cfcc481b491d to improve this function too.

11 years agouse virBitmapFree instead of VIR_FREE for cpumask
Ján Tomko [Sat, 1 Jun 2013 21:29:09 +0000 (23:29 +0200)]
use virBitmapFree instead of VIR_FREE for cpumask

Found by 'git grep FREE.*cpumask' after looking at 31f1f6b.

11 years agousb: don't spoil decimal addresses
Martin Kletzander [Fri, 31 May 2013 16:36:11 +0000 (18:36 +0200)]
usb: don't spoil decimal addresses

For USB devices, dev->name gets formated as %.3o:%.3o even though the
numbers are decimal.

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

11 years agoRelease of libvirt 1.0.6
Daniel Veillard [Mon, 3 Jun 2013 10:09:56 +0000 (12:09 +0200)]
Release of libvirt 1.0.6

* configure.ac docs/news.html.in libvirt.spec.in: update for the release
* po/*.po*: pull localization updates and regenerate the po

11 years agoStorage: Fix the indention of rbd test file
Osier Yang [Tue, 28 May 2013 06:39:42 +0000 (14:39 +0800)]
Storage: Fix the indention of rbd test file

11 years agonodedev_hal: Modernize the function's style
Osier Yang [Sat, 1 Jun 2013 02:52:17 +0000 (10:52 +0800)]
nodedev_hal: Modernize the function's style

Use style like:

void
foo (const char *name)
{
    printf("Hello, %s\n", name);
}

Later patches will clean up node_device_hal.c more.

11 years agoconf: Generate address for scsi host device automatically
Osier Yang [Fri, 31 May 2013 10:09:24 +0000 (18:09 +0800)]
conf: Generate address for scsi host device automatically

With unknown good reasons, the attribute "bus" of scsi device
address is always set to 0, same for attribute "target". (See
virDomainDiskDefAssignAddress).

Though we might need to change the algorithm to honor "bus"
and "target" too, that's a different issue. The address generator
for scsi host device in this patch just follows the unknown
good reasons, only considering the "controller" and "unit".
It walks through all scsi controllers and their units, to see
if the address $controller:0:0:$unit can be used (if not used
by any disk or scsi host device yet), if found one, it sits on
it, otherwise, it creates a new controller (actually the controller
is implicitly created by someone else), and sits on
$new_controller:0:0:0 instead.

11 years agoqemu: prevent termination of guests w/hostdev on driver reconnect
Laine Stump [Fri, 31 May 2013 18:30:09 +0000 (14:30 -0400)]
qemu: prevent termination of guests w/hostdev on driver reconnect

This should resolve:

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

The problem was that qemuUpdateActivePciHostdevs was returning 0
(success) when no hostdevs were present, but would otherwise return -1
(failure) even when it completed successfully. It is only called from
qemuProcessReconnect(), and when qemuProcessReconnect got back an
error, it would not only stop reconnecting, but would terminate the
guest qemu process "to remove danger of it ending up running twice if
user tries to start it again later".

(This bug was introduced in commit 011cf7ad, which was pushed between
v1.0.2 and v1.0.3, so all maintenance branches from v1.0.3 up to 1.0.5
will need this one line patch applied.)

11 years agovbox: define DYNLIB_NAME for kFreeBSD
Guido Günther [Thu, 30 May 2013 20:07:46 +0000 (22:07 +0200)]
vbox: define DYNLIB_NAME for kFreeBSD

Similar to what Eric did for Cygwin it helps at least to compile
without --without-vbox

11 years agobuild: skip qemu in tests when !WITH_QEMU
Eric Blake [Fri, 31 May 2013 16:47:22 +0000 (10:47 -0600)]
build: skip qemu in tests when !WITH_QEMU

A mingw build (where the qemu driver is not built, so WITH_QEMU
is undefined) failed with:

In file included from ../../src/qemu/qemu_command.h:30:0,
                 from ../../tests/testutilsqemu.h:4,
                 from ../../tests/networkxml2xmltest.c:14:
../../src/qemu/qemu_conf.h:53:4: error: #error "Port me"

But since testutilsqemu.c is already conditional, the header
should be likewise.

* tests/testutilsqemu.h: Make content conditional.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoIntroduce virFilePrintf() as a portable fprintf()
Daniel P. Berrange [Fri, 17 May 2013 14:11:24 +0000 (15:11 +0100)]
Introduce virFilePrintf() as a portable fprintf()

We can't use GNULIB's fprintf-posix due to licensing
incompatibilities. We do already have a portable
formatting via virAsprintf() which we got from GNULIB
though. We can use to create a virFilePrintf() function.

But really gnulib could just provide a 'fprintf'
module, that depended on just its 'asprintf' module.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoDocument that runtime changes may be lost after S4 suspend
Jiri Denemark [Fri, 31 May 2013 16:00:48 +0000 (18:00 +0200)]
Document that runtime changes may be lost after S4 suspend