1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-08-22 01:50:06 +03:00

Compare commits

...

641 Commits

Author SHA1 Message Date
034d322978 Release of libvirt-1.1.0
* configure.ac docs/news.html.in libvirt.spec.in: updated for the release
* po/*.po*: updated localizations and regenerated
2013-07-01 17:22:49 +08:00
244e0b8cf1 Crash of libvirtd by unprivileged user in virConnectListAllInterfaces
On Thu, Jun 27, 2013 at 03:56:42PM +0100, Daniel P. Berrange wrote:
> Hi Security Team,
>
> I've discovered a way for an unprivileged user with a readonly connection
> to libvirtd, to crash the daemon.

Ok, the final patch for this is issue will be the simpler variant that
Eric suggested

The embargo can be considered to be lifted on Monday July 1st, at
0900 UTC

The following is the GIT change that DV or myself will apply to libvirt
GIT master immediately before the 1.1.0 release:

>From 177b4165c531a4b3ba7f6ab6aa41dca9ceb0b8cf Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <berrange@redhat.com>
Date: Fri, 28 Jun 2013 10:48:37 +0100
Subject: [PATCH] CVE-2013-2218: Fix crash listing network interfaces with
 filters

The virConnectListAllInterfaces method has a double-free of the
'struct netcf_if' object when any of the filtering flags cause
an interface to be skipped over. For example when running the
command 'virsh iface-list --inactive'

This is a regression introduced in release 1.0.6 by

  commit 7ac2c4fe62
  Author: Guannan Ren <gren@redhat.com>
  Date:   Tue May 21 21:29:38 2013 +0800

    interface: list all interfaces with flags == 0

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-07-01 15:05:24 +08:00
2c2525ab6a pci: initialize virtual_functions array pointer to avoid segfault
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=971325

The problem was that if virPCIGetVirtualFunctions was given the name
of a non-existent interface, it would return to its caller without
initializing the pointer to the array of virtual functions to NULL,
and the caller (virNetDevGetVirtualFunctions) would try to VIR_FREE()
the invalid pointer.

The final error message before the crash would be:

 virPCIGetVirtualFunctions:2088 :
  Failed to open dir '/sys/class/net/eth2/device':
  No such file or directory

In this patch I move the initialization in virPCIGetVirtualFunctions()
to the begining of the function, and also do an explicit
initialization in virNetDevGetVirtualFunctions, just in case someone
in the future adds code into that function prior to the call to
virPCIGetVirtualFunctions.
2013-07-01 00:26:33 -04:00
374c5e4f73 node device driver: update driver name during dumpxml
This fixes:

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

The node device driver was written with the assumption that udev would
use a "change" event to notify libvirt of any change to device status
(including the name of the driver it was bound to). It turns out this
is not the case (see Comment 4 of BZ 979290). That means that a
dumpxml for a device would always show whatever driver happened to be
bound at the time libvirt was started (when the node device cache was
built).

There was already code in the driver (for the benefit of the HAL
backend) that updated the driver name from sysfs each time a device's
info was retrieved from the cache. This patch just enables that manual
update for the udev backend as well.
2013-07-01 00:25:21 -04:00
49e6a16f82 Document security reporting & handling process
Historically security issues in libvirt have been primarily
triaged & fixed by the Red Hat libvirt members & Red Hat
security team, who then usually notify other vendors via
appropriate channels. There have been a number of times
when vendors have not been properly notified ahead of
announcement. It has also disadvantaged community members
who have to backport fixes to releases for which there are
no current libvirt stable branches.

To address this, we want to make the libvirt security process
entirely community focused / driven. To this end I have setup
a new email address "libvirt-security@redhat.com" for end
users to report bugs which have (possible) security implications.

This email addr is backed by an invitation only, private
archive, mailing list. The intent is for the list membership
to comprise a subset of the libvirt core team, along with any
vendor security team engineers who wish to participate in a
responsible disclosure process for libvirt. Members of the
list will be responsible for analysing the problem to determine
if a security issue exists and then issue fixes for all current
official stable branches & git master.

I am proposing the following libvirt core team people as
members of the security team / list (all cc'd):

   Daniel Berrange (Red Hat)
   Eric Blake (Red Hat)
   Jiri Denemar (Red Hat)
   Daniel Veillard (Red Hat)
   Jim Fehlig (SUSE)
   Doug Goldstein (Gentoo)
   Guido Günther (Debian)

We don't have anyone from Ubuntu on the libvirt core team.
Serge Hallyn is the most frequent submitter of patches from
Ubuntu in recent history, so I'd like to invite him to join.
Alternatively, Serge, feel free to suggest someone else to
represent Ubuntu's interests.

If any other vendors/distros have security people who are
responsible for dealing with libvirt security issues, and
want to join to get early disclosure of issues, they can
suggest people. Existing security team members will vet /
approve such requests to ensure they are genuine.

Anyone on the team / list will be **required** to honour any
embargo period agreed between members for non-public issues
that are reported. The aim will be to have a maximum 2 week
embargo period in the common case, extendable to 1 month if
there is sufficient justification made. If anyone feels they
are unable to follow such an embargo process for whatever
reason, please decline membership of the security list/team.

The patch which follows puts up some docs on the website
about all of this....

Document how to report security bugs and the process that
will be used for addressing them.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-07-01 11:08:58 +08:00
3a214482ec spec: require xen-devel for libxl driver
When using 'rpmbuild --define "_without_xen 1"', but on a new enough
Fedora where %{with_libxl} still gets set to 1 by default, the
build dependencies were incomplete, which could result in 'make rpm'
failing because ./configure failed to build the libxl driver.

* libvirt.spec.in (BuildRequires): Fix xen-devel condition.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-06-29 14:56:05 -06:00
79e9a2247a Resolve valgrind errors for nodedev cap parsing
There were two errors, one as a direct result of commit id '8807b285'
and the other from cut-n-paste

TEST: nodedevxml2xmltest
      ..............                           14  OK
==25735== 3 bytes in 1 blocks are definitely lost in loss record 1 of 24
==25735==    at 0x4A0887C: malloc (vg_replace_malloc.c:270)
==25735==    by 0x344D2AF275: xmlStrndup (in /usr/lib64/libxml2.so.2.9.1)
==25735==    by 0x4D0C767: virNodeDeviceDefParseNode (node_device_conf.c:997)
==25735==    by 0x4D0D3D2: virNodeDeviceDefParse (node_device_conf.c:1337)
==25735==    by 0x401CA4: testCompareXMLToXMLHelper (nodedevxml2xmltest.c:28)
==25735==    by 0x402B2F: virtTestRun (testutils.c:158)
==25735==    by 0x401B27: mymain (nodedevxml2xmltest.c:81)
==25735==    by 0x40316A: virtTestMain (testutils.c:722)
==25735==    by 0x37C1021A04: (below main) (libc-start.c:225)
==25735==
==25735== 16 bytes in 1 blocks are definitely lost in loss record 10 of 24
==25735==    at 0x4A08A6E: realloc (vg_replace_malloc.c:662)
==25735==    by 0x4C7385E: virReallocN (viralloc.c:184)
==25735==    by 0x4C73906: virExpandN (viralloc.c:214)
==25735==    by 0x4C73B4A: virInsertElementsN (viralloc.c:324)
==25735==    by 0x4D0C84C: virNodeDeviceDefParseNode (node_device_conf.c:1026)
==25735==    by 0x4D0D3D2: virNodeDeviceDefParse (node_device_conf.c:1337)
==25735==    by 0x401CA4: testCompareXMLToXMLHelper (nodedevxml2xmltest.c:28)
==25735==    by 0x402B2F: virtTestRun (testutils.c:158)
==25735==    by 0x401B27: mymain (nodedevxml2xmltest.c:81)
==25735==    by 0x40316A: virtTestMain (testutils.c:722)
==25735==    by 0x37C1021A04: (below main) (libc-start.c:225)
==25735==
PASS: nodedevxml2xmltest

The first error was resolved by adding a missing VIR_FREE(numberStr); in
the new function virNodeDevCapPciDevIommuGroupParseXML().

The second error was a bit more opaque as the error was a result of copying
the free methodolgy of the existing code in virNodeDevCapsDefFree(). The code
would free each of the entries in the array, but not the memory for the
array itself.  Added the necessary VIR_FREE(data->pci_dev.iommuGroupDevices)
and while at it added the missing VIR_FREE(data->pci_dev.virtual_functions)
although there wasn't a test that tripped across it (thus it's been lurking
since commit id 'a010165d').
2013-06-29 05:54:12 -04:00
ba6e187f1e Resolve valgrind error in remoteConfigGetStringList()
Commit id 'ed3bac71' introduced the following:

TEST: libvirtdconftest
      ........................................ 40  OK
==25875== 690 (480 direct, 210 indirect) bytes in 30 blocks are definitely lost in loss record 18 of 24
==25875==    at 0x4A06B6F: calloc (vg_replace_malloc.c:593)
==25875==    by 0x4C737DF: virAllocN (viralloc.c:152)
==25875==    by 0x403BC8: remoteConfigGetStringList (libvirtd-config.c:74)
==25875==    by 0x4042CF: daemonConfigLoadOptions (libvirtd-config.c:382)
==25875==    by 0x4052F5: daemonConfigLoadData (libvirtd-config.c:479)
==25875==    by 0x40222C: testCorrupt (libvirtdconftest.c:112)
==25875==    by 0x40321F: virtTestRun (testutils.c:158)
==25875==    by 0x401FEE: mymain (libvirtdconftest.c:228)
==25875==    by 0x40385A: virtTestMain (testutils.c:722)
==25875==    by 0x37C1021A04: (below main) (libc-start.c:225)
==25875==
PASS: libvirtdconftest
2013-06-29 05:54:11 -04:00
164d46e8ba Resolve valgrind error in virStorageBackendCreateQemuImgCmd()
Commit id '53d5967c' introduced the following:

TEST: storagevolxml2argvtest
      ..............                           14  OK
==25636== 358 (264 direct, 94 indirect) bytes in 1 blocks are definitely lost in loss record 67 of 75
==25636==    at 0x4A06B6F: calloc (vg_replace_malloc.c:593)
==25636==    by 0x4C95791: virAlloc (viralloc.c:124)
==25636==    by 0x4CA0BB4: virCommandNewArgs (vircommand.c:805)
==25636==    by 0x4CA0C88: virCommandNew (vircommand.c:789)
==25636==    by 0x408602: virStorageBackendCreateQemuImgCmd (storage_backend.c:849)
==25636==    by 0x405427: testCompareXMLToArgvHelper (storagevolxml2argvtest.c:61)
==25636==    by 0x4064DF: virtTestRun (testutils.c:158)
==25636==    by 0x40516F: mymain (storagevolxml2argvtest.c:195)
==25636==    by 0x406B1A: virtTestMain (testutils.c:722)
==25636==    by 0x37C1021A04: (below main) (libc-start.c:225)
==25636==
PASS: storagevolxml2argvtest
2013-06-29 05:54:11 -04:00
babb57aa85 Resolve valgrind error in virNetDevVlanParse()
Commit '861d4056' introduced the following:

TEST: networkxml2xmltest
      ..................                       18  OK
==25504== 7 bytes in 1 blocks are definitely lost in loss record 5 of 23
==25504==    at 0x4A0887C: malloc (vg_replace_malloc.c:270)
==25504==    by 0x37C1085D71: strdup (strdup.c:42)
==25504==    by 0x4CB835F: virStrdup (virstring.c:546)
==25504==    by 0x4CC5179: virXPathString (virxml.c:90)
==25504==    by 0x4CC75C2: virNetDevVlanParse (netdev_vlan_conf.c:78)
==25504==    by 0x4CF928A: virNetworkPortGroupParseXML (network_conf.c:1555)
==25504==    by 0x4CFE385: virNetworkDefParseXML (network_conf.c:2049)
==25504==    by 0x4D0113B: virNetworkDefParseNode (network_conf.c:2273)
==25504==    by 0x4D01254: virNetworkDefParse (network_conf.c:2234)
==25504==    by 0x401E80: testCompareXMLToXMLHelper (networkxml2xmltest.c:32)
==25504==    by 0x402D4F: virtTestRun (testutils.c:158)
==25504==    by 0x401CE9: mymain (networkxml2xmltest.c:110)
==25504==
PASS: networkxml2xmltest

Also changed the label from error to cleanup and adjusted code since it's
all one exit path
2013-06-29 05:54:11 -04:00
dc8614d7ed doc: Fix reference to #elementsUSB
aae0fc2a92 removed the #elementsUSB anchor
but did not update the links to point to the new section #elementsHostDev.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2013-06-28 15:59:47 -04:00
002c8af9f0 Conditionalize use of IF_MAXUNIT in virnetdevtap.c
The IF_MAXUNIT macro is not present on all BSDs, so
make its use conditional, to avoid breaking OS-X.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-28 15:17:41 +01:00
1a3eaa80a4 Replace use of 'in_addr_t' with 'struct in_addr'
The 'in_addr_t' typedef is not present in Mingw64 headers.
Instead we can use the more portable 'struct in_addr' and
then access its 's_addr' field.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-28 13:39:08 +01:00
027a7707be Allow RO connections to interface udev backend
The udev based interface backend did not allow querying data over a
read-only connection which is different than how the netcf backend
operates. This brings the behavior inline with the default, netcf
backend.
2013-06-28 07:26:04 -05:00
3913a5f12a build: Fix VPATH build for access/*
VPATH build failed for the generated access driver files.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2013-06-28 12:45:21 +02:00
3c0d5e224c Fix vPort management: FC vHBA creation
When creating a virtual FC HBA with virsh/libvirt API, an error message
will be returned: "error: Node device not found",
also the 'nodedev-dumpxml' shows wrong information of wwpn & wwnn
for the new created device.

Signed-off-by: xschen@tnsoft.com.cn

This reverts f90af69 which switched wwpn & wwwn in the wrong place.

https://www.kernel.org/doc/Documentation/scsi/scsi_fc_transport.txt
2013-06-28 12:13:28 +02:00
a757822233 util: fix build error on non-Linux systems
Building on FreeBSD had this linker error:

/work/a/ports/devel/libvirt/work/libvirt-1.1.0/src/.libs/libvirt.so:
   undefined reference to `virPCIDeviceAddressParse'

This was caused by the new use of virPCIDeviceAddressParse in a
portion of virpci.c that wasn't linux-only (in commit 72c029d8). The
problem was that virPCIDeviceAddressParse had originally been defined
inside #ifdef _linux (because it was only used by another function
that was inside the same ifdef).

The solution is to move it out to the part of virpci.c that is
compiled on all platforms.

(Because the portion that was "moved" was 40-50 lines, but only moved
up by 15 lines, the diff for the patch is less than non-informative -
rather than showing that part that I moved, it shows the bit that was
previously before the moved part, and now sits *after* it.)
2013-06-28 04:09:42 -04:00
b291a00aca conf: Swap order of AddImplicitControllers and DomainDefPostParse
Implicit controllers may be dependent on device definitions altered
in a post-parse callback. Specifically, if a console device is
defined without the target type, the type will be set in QEMU's
callback. In the case of s390, this is virtio, which requires
an implicit virtio-serial controller.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2013-06-28 09:52:00 +02:00
38dc212296 S390: Testcase for console default target type (virtio)
For s390 the default console target type is virtio. This also requires
that an implicit virtio-serial controller is instantiated.
This testcase verifies that the target type of virtio is correctly set
in the generated XML if no target element was given and that the
corresponding virtio-serial element is generated too.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2013-06-28 09:52:00 +02:00
f542a0dead virsh: Add parenthesis into virsh nodedev-detach help 2013-06-27 17:42:51 +02:00
658c932ab4 bridge: don't crash on bandwidth unplug with no bandwidth
If networkUnplugBandwidth is called on a network which has
no bandwidth defined, print a warning instead of crashing.

This can happen when destroying a domain with bandwidth if
bandwidth was removed from the network after the domain was
started.

https://bugzilla.redhat.com/show_bug.cgi?id=975359
2013-06-27 12:11:42 +02:00
8807b28559 nodedev: add iommuGroup to node device object
This includes adding it to the nodedev parser and formatter, docs, and
test.

An example of the new iommuGroup element that is a part of the output
from "virsh nodedev-dumpxml" (virNodeDeviceGetXMLDesc()):

  <device>
    <name>pci_0000_02_00_1</name>
    <capability type='pci'>
    ...
      <iommuGroup number='12'>
        <address domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
        <address domain='0x0000' bus='0x02' slot='0x00' function='0x1'/>
      </iommuGroup>
    </capability>
  </device>
2013-06-26 14:10:56 -04:00
72c029d883 pci: new iommu_group functions
Any device which belongs to an "IOMMU group" (used by vfio) will
have links to all devices of its group listed in
/sys/bus/pci/$device/iommu_group/devices;
/sys/bus/pci/$device/iommu_group is actually a link to
/sys/kernel/iommu_groups/$n, where $n is the group number (there
will be a corresponding device node at /dev/vfio/$n once the
devices are bound to the vfio-pci driver)

The following functions are added:

virPCIDeviceGetIOMMUGroupList

  Gets a virPCIDeviceList with one virPCIDeviceList for each device
  in the same IOMMU group as the provided virPCIDevice (a copy of the
  original device object is included in the list.

virPCIDeviceAddressIOMMUGroupIterate

  Calls the function @actor once for each device in the group that
  contains the given virPCIDeviceAddress.

virPCIDeviceAddressGetIOMMUGroupAddresses

  Fills in a virPCIDeviceAddressPtr * with an array of
  virPCIDeviceAddress, one for each device in the iommu group of the
  provided virPCIDeviceAddress (including a copy of the original).

virPCIDeviceAddressGetIOMMUGroupNum

  Returns the group number as an int (a valid group number will always
  be 0 or greater).  If there is no iommu_group link in the device's
  directory (usually indicating that vfio isn't loaded), -2 will be
  returned. On any real error, -1 will be returned.
2013-06-26 14:10:09 -04:00
5bc8ecb8d1 Plug leak in virCgroupMoveTask
We only break out of the while loop if *content is an empty string.
However the buffer has been allocated to BUFSIZ + 1 (8193 in my case),
but it gets overwritten in the next for iteration.

Move VIR_FREE right before we overwrite it to avoid the leak.

==5777== 16,386 bytes in 2 blocks are definitely lost in loss record 1,022 of 1,027
==5777==    by 0x5296E28: virReallocN (viralloc.c:184)
==5777==    by 0x52B0C66: virFileReadLimFD (virfile.c:1137)
==5777==    by 0x52B0E1A: virFileReadAll (virfile.c:1199)
==5777==    by 0x529B092: virCgroupGetValueStr (vircgroup.c:534)
==5777==    by 0x529AF64: virCgroupMoveTask (vircgroup.c:1079)

Introduced by 83e4c77.

https://bugzilla.redhat.com/show_bug.cgi?id=978352
2013-06-26 15:38:01 +02:00
306c49ffd5 Fix invalid read in virCgroupGetValueStr
Don't check for '\n' at the end of file if zero bytes were read.

Found by valgrind:
==404== Invalid read of size 1
==404==    at 0x529B09F: virCgroupGetValueStr (vircgroup.c:540)
==404==    by 0x529AF64: virCgroupMoveTask (vircgroup.c:1079)
==404==    by 0x1EB475: qemuSetupCgroupForEmulator (qemu_cgroup.c:1061)
==404==    by 0x1D9489: qemuProcessStart (qemu_process.c:3801)
==404==    by 0x18557E: qemuDomainObjStart (qemu_driver.c:5787)
==404==    by 0x190FA4: qemuDomainCreateWithFlags (qemu_driver.c:5839)

Introduced by 0d0b409.

https://bugzilla.redhat.com/show_bug.cgi?id=978356
2013-06-26 15:05:43 +02:00
7070a572aa Fix sample TPM XML
Fix an error in the sample TPM XML.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2013-06-26 08:29:08 -04:00
4b42e3b97f network: allow <vlan> in type='hostdev' networks
Although SRIOV network cards support setting a vlan tag on their
virtual functions, and although setting this vlan tag via a <vlan>
element in a domain's <interface> works, setting a vlan tag for these
devices in a <network> definition, or in a network <portgroup>
definition is also supposed to work (and the comment that validates
<vlan> usage even says that!). However, the check to allow it only
checked for an openvswitch network, so attempts to add <vlan> to a
network of type='hostdev' would fail.
2013-06-26 03:25:19 -04:00
ab0c8df0b1 docs: correct and update network vlan example
Somehow I put an example of a domain interface with a <vlan> element
into the network documentation.

This patch replaces that with an example of a network definition that
has a vlan element with trunk='yes', multiple tags, and even the new
nativeMode attribute. It also includes a <portgroup> that has a vlan
defined.
2013-06-26 02:21:23 -04:00
ec30f0f7bf test: include qemuhotplugtest data files in source rpm
commit 0fc12bca added a new test called qemuhotplugtest which has
several data files in tests/qemuhotplugtestdata, but didn't add that
directory to EXTRA_DIST in the tests Makefile.am, so the make check
done during a make rpm was failing due to missing data files.
2013-06-26 01:48:01 -04:00
a47b9e879c qemu: fix infinite loop in OOM error path
A loop in qemuPrepareHostdevPCIDevices() intended to cycle through all
the objects on the list pcidevs was doing "while (listcount > 0)", but
nothing in the body of the loop was reducing the size of the list - it
was instead removing items from a *different* list. It has now been
safely changed to a for() loop.
2013-06-25 18:24:56 -04:00
b2a2d00f57 pci: fix dangling pointer in qemuDomainReAttachHostdevDevices
(This isn't as bad as it sounds - it's only a problem in case of an
OOM error.)

qemuGetActivePciHostDeviceList() had been creating a list that
contained pointers to objects that were also on the activePciHostdevs
list. In case of an OOM error, this newly created list would be
virObjectUnref'ed, which would cause everything on the list to be
freed. But all of those objects would still be on the
activePciHostdevs list, which could have very bad consequences if that
list was ever again accessed.

The solution used here is to populate the new list with *copies* of
the objects from the original list. It turns out that on return from
qemuGetActivePciHostDeviceList(), the caller would almost immediately
go through all the device objects and "steal" them (i.e. remove the
pointer from the list but not delete it) all from either one list or
the other; we now instead just *delete* (remove from the list and
free) each device from one list or the other, so in the end we have
the same state.
2013-06-25 18:24:50 -04:00
2a2739a866 pci: eliminate leak in OOM condition
The "fix" I pushed a few commits ago would still leak a virPCIDevice
in case of an OOM error. Although it's inconsequential in practice,
this patch satisfies my OCD.
2013-06-25 18:24:43 -04:00
0e89a543be pci: virPCIDeviceListAddCopy API
Make a copy of the device and add the copy to the
list. (virPCIDeviceListAdd() adds the original object to the list
instead).
2013-06-25 18:11:10 -04:00
6e8003ad30 pci: update stubDriver name in virPCIDeviceBindToStub
If the device is bound to a stub driver different from what is saved
in the virPCIDevice's stubDriver attribute, update it.
2013-06-25 18:10:25 -04:00
c13dddaf3e pci: eliminate repetitive path constructions in virPCIDeviceBindToStub
The same strings were being re-created multiple times just to save
declaring a new variable. In the meantime, the use of the generic
variable names led to confusion when trying to follow the code. This
patch creates strings for:

 stubDriverName  (was called "driver" in original args)
 stubDriverPath  ("/sys/bus/pci/drivers/${stubDriverName}")
 driverLink      ("${device}/driver")
 oldDriverName   (the final component of path linked to by
                  "${device}/driver")
 oldDriverPath   ("/sys/bus/pci/drivers/${oldDriverName}")

then re-uses them as necessary.
2013-06-25 18:08:56 -04:00
31a4a679b3 pci: rename virPCIParseDeviceAddress and make it public
This function has utility outside of virpci.c, so make it public.

Also the name didn't fit convention, so change it to
virPCIDeviceAddressParse.
2013-06-25 18:07:38 -04:00
1d829e1306 pci: rename virPCIDeviceGetVFIOGroupDev to virPCIDeviceGetIOMMUGroupDev
I realized after the fact that it's probably better in the long run to
give this function a name that matches the name of the link used in
sysfs to hold the group (iommu_group).

I'm changing it now because I'm about to add several more functions
that deal with iommu groups.
2013-06-25 18:07:38 -04:00
ee1d1f3b54 pci: eliminate unused driver arg from virPCIDeviceDetach
The driver arg to virPCIDeviceDetach is no longer used (the name of the stub driver is now set in the virPCIDevice object, and virPCIDeviceDetach retrieves it from there). Remove it.
2013-06-25 18:03:52 -04:00
003118deb4 util: fix bug found by Coverity
Commit 861d40565 added code (my personal change to "clean up" the
submitter's code, *not* the fault of the submitter) that dereferenced
virtVlan without first checking for NULL. This patch fixes that and,
as part of the fix, cleans up some unnecessary obtuseness.
2013-06-25 14:57:24 -04:00
0fc12bca08 tests: Introduce qemuhotplugtest
As my punishment for the break in 7f15ebc7 (fixed in 752596b5dd) I'm
introducing this test to make sure it won't happen again. Currently,
only test for <graphics/> is supported.
2013-06-25 17:00:56 +02:00
d2664daf1b qemu: Implement support for VIR_MIGRATE_PARAM_GRAPHICS_URI 2013-06-25 16:41:58 +02:00
35461438cb Implement extensible migration APIs in qemu driver 2013-06-25 16:41:58 +02:00
1004d6323a qemu: Move internals of Confirm phase to qemu_migration.c 2013-06-25 16:41:57 +02:00
ecd811310c qemu: Move common parts of Prepare phase to qemu_migration.c 2013-06-25 16:41:57 +02:00
d3ce7363f3 qemu: Move internals of Begin phase to qemu_migration.c 2013-06-25 16:41:57 +02:00
83b43717a6 Fix possible NULL dereference during migration 2013-06-25 16:10:09 +02:00
11a5c957f4 Use 1.1.0 everywhere in the documentation
Since we already have the v1.1.0-rc1 tag in git.
2013-06-25 15:37:31 +02:00
1e3a252974 virsh: edit: don't leak XML string on reedit or redefine
Free the old XML strings before overwriting them if the user
has chosen to reedit the file or force the redefinition.

Found by Alex Jia trying to reproduce another bug:
https://bugzilla.redhat.com/show_bug.cgi?id=977430#c3
2013-06-25 15:37:20 +02:00
f3d08aa0ba Fix units in virNetDevBridgeSetSTPDelay on BSD
virNetDevBridgeSetSTPDelay accepts delay in milliseconds,
but BSD implementation was expecting seconds. Therefore,
it was working correctly only with delay == 0.
2013-06-25 13:13:46 +01:00
0c737dfb44 Add polkit policy for API checks to rpm spec 2013-06-25 13:44:47 +02:00
861d40565e Configure native vlan modes on Open vSwitch ports
This patch adds functionality to allow libvirt to configure the
'native-tagged' and 'native-untagged' modes on openvswitch networks.

Signed-off-by: Laine Stump <laine@redhat.com>
2013-06-25 00:22:36 -04:00
1eeab6e6de qemu: don't reset PCI devices being assigned with VFIO
I just learned that VFIO resets PCI devices when they are assigned to
guests / returned to the host, so it is redundant for libvirt to reset
the devices. This patch inhibits calling virPCIDeviceReset to devices
that will be/were assigned using VFIO.
2013-06-24 23:07:07 -04:00
4669543cb8 Introduce VIR_MIGRATE_PARAM_GRAPHICS_URI parameter
The parameter specifies connection parameters to use for migrating
client's connection to domain's graphical console.
2013-06-25 01:33:47 +02:00
bdb6578a42 virsh: Use extensible migration APIs 2013-06-25 01:31:07 +02:00
6f4c6af6ed python: Add bindings for extensible migration APIs
The patch implements wrappers for virDomainMigrate3 and
virDomainMigrateToURI3.
2013-06-25 01:28:39 +02:00
4bf62f44a9 Extensible migration APIs
This patch introduces two new APIs virDomainMigrate3 and
virDomainMigrateToURI3 that may be used in place of their older
variants. These new APIs take optional migration parameters (such as
bandwidth, domain XML, ...) in an array of virTypedParameters, which
makes adding new parameters easier as there's no need to introduce new
APIs whenever a new migration parameter needs to be added. Both APIs are
backward compatible and will automatically use older migration calls in
case the new calls are not supported as long as the typed parameters
array does not contain any parameter which was not supported by the
older calls.
2013-06-25 01:24:53 +02:00
35820ad543 Adapt virDomainMigratePeer2Peer for extensible migration APIs 2013-06-25 01:21:16 +02:00
fa8b7c6aed Adapt virDomainMigrateVersion3 for extensible migration APIs 2013-06-25 01:18:13 +02:00
cca4d10d82 Implement extensible migration APIs in remote driver 2013-06-25 01:16:15 +02:00
c0762b6518 New internal migration APIs with extensible parameters
This patch implements extensible variants of all internal migration APIs
used for v3 migration.
2013-06-25 01:13:16 +02:00
81709832ab Introduce migration parameters
To be used by new migration APIs with extensible set of parameters.
2013-06-25 00:38:25 +02:00
d0d5acb511 Introduce virTypedParamsCopy internal API 2013-06-25 00:38:25 +02:00
173a14ec0b Log input type parameters in API entry points 2013-06-25 00:38:25 +02:00
fefb0d5464 Introduce VIR_TYPED_PARAMS_DEBUG macro for dumping typed params
All APIs that take typed parameters are only using params address in
their entry point debug messages. With the new VIR_TYPED_PARAMS_DEBUG
macro, all functions can easily log all individual typed parameters
passed to them.
2013-06-25 00:38:24 +02:00
8a7f1166e1 Introduce virTypedParamsReplaceString internal API 2013-06-25 00:38:24 +02:00
637a7c865a Introduce virTypedParamsCheck internal API
This API is useful for checking whether only a specific subset of
supported typed parameters were passed.
2013-06-25 00:38:24 +02:00
40369ea674 util: Emit proper error code in virTypedParamsValidate
When unsupported parameter is passed to virTypedParamsValidate,
VIR_ERR_ARGUMENT_UNSUPPORTED should be returned rather than
VIR_ERR_INVALID_ARG, which is more appropriate for supported parameters
used incorrectly.
2013-06-25 00:38:24 +02:00
c40ed4168a Rename virTypedParameterArrayValidate as virTypedParamsValidate 2013-06-25 00:38:24 +02:00
2ebd847924 build: Fix check-aclrules in VPATH build 2013-06-25 00:38:23 +02:00
9b4a666608 pci: make virPCIDeviceDetach consistent in behavior
virPCIDeviceDetach would previously sometimes consume the input device
object (to put it on the inactive list) and sometimes not. Avoiding
memory leaks required checking beforehand to see if the device was
already on the list, and freeing the device object in the caller only
if there wasn't already an identical object on the inactive list.

This patch makes it consistent - virPCIDeviceDetach will *never*
consume the input virPCIDevice object; if it needs to put one on the
inactive list, it will create a copy and put *that* on the list. This
way the caller knows that it is always their responsibility to free
the device object they created.
2013-06-24 17:35:13 -04:00
f962e8b603 pci: eliminate memory leak in virPCIDeviceReattach
virPCIDeviceReattach was making the assumption that the dev object
given to it was one and the same with the dev object on the
inactiveDevs list. If that had been the case, it would not need to
free the dev object it removed from the inactive list, because the
caller of virPCIDeviceReattach always frees the dev object that it
passes in. Since the dev object passed in is *never* the same object
that's on the list (it is a different object with the same name and
attributes, created just for the purpose of searching for the actual
object), simply doing a "ListSteal" to remove the object from the list
results in one leaked object; we need to actually free the object
after removing it from the list.
2013-06-24 17:35:01 -04:00
50a8d85035 pci: new utility functions
* virPCIDeviceFindByIDs - find a device on a list w/o creating an object
    This makes searching for an existing device on a list lighter weight.

* virPCIDeviceCopy - make a copy of an existing virPCIDevice object.

* virPCIDeviceGetDriverPathAndName - construct new strings containing
    1) the name of the driver bound to this device.
    2) the full path to the sysfs config for that driver.
    (This code was lifted from virPCIDeviceUnbindFromStub, and replaced
    there with a call to this new function).
2013-06-24 17:33:38 -04:00
53e52b4ac3 pci: change stubDriver from const char* to char*
Previously stubDriver was always set from a string literal, so it was
okay to use a const char * that wasn't freed when the virPCIDevice was
freed. This will not be the case in the near future, so it is now a
char* that is allocated in virPCIDeviceSetStubDriver() and freed
during virPCIDeviceFree().
2013-06-24 17:33:29 -04:00
d80d0d5d40 syntax: virPCIDeviceFree is also a NOP for NULL args
add it to the syntax-check list and fix the one offending caller.
2013-06-24 17:33:23 -04:00
c302130277 libxl: support qdisk backend
libxl supports the LIBXL_DISK_BACKEND_QDISK disk backend, where qemu
is used to provide the disk backend.  This patch simply maps the
existing <driver name='qemu'/> to LIBXL_DISK_BACKEND_QDISK.
2013-06-24 09:10:14 -06:00
05bcf6f06d libxl: Fix disk format error message
Specifying an unsupported disk format with the tap driver resulted in
a less than helpful error message

error: Failed to start domain test-hvm
error: internal error libxenlight does not support disk driver qed

Change the message to state that the qed format is not supported by
the tap driver, e.g.

error: Failed to start domain test-hvm
error: internal error libxenlight does not support disk format qed
with disk driver tap

While at it, check for unsupported formats in the other driver
backends.
2013-06-24 09:10:14 -06:00
684ce8300e Add validation that all APIs contain ACL checks
Add a script which parses the driver API code and validates
that every API registered in a virNNNDriverPtr table contains
an ACL check matching the API name.

NB this currently whitelists a few xen driver functions
which are temporarily lacking in access control checks.
The xen driver is considered insecure until these are
fixed.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-24 15:47:31 +01:00
5de708c1b9 Set process ID in system identity
When creating a virIdentityPtr for the system identity, include
the current process ID as an attribute.
2013-06-24 15:39:56 +01:00
15af5e5f70 Add ACL checks into the secrets driver
Insert calls to the ACL checking APIs in all secrets driver
entrypoints.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-24 15:25:44 +01:00
1eca3f5bdf Add ACL checks into the nwfilter driver
Insert calls to the ACL checking APIs in all nwfilter driver
entrypoints.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-24 15:25:44 +01:00
20d8e1f1d7 Add ACL checks into the node device driver
Insert calls to the ACL checking APIs in all node device
driver entrypoints.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-24 15:25:44 +01:00
a7147bc68e Add ACL checks into the interface driver
Insert calls to the ACL checking APIs in all interface
driver entrypoints.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-24 15:25:44 +01:00
453da48b12 Add ACL checks into the network driver
Insert calls to the ACL checking APIs in all network driver
entrypoints.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-24 15:25:44 +01:00
c930410beb Add ACL checks into the storage driver
Insert calls to the ACL checking APIs in all storage driver
entrypoints.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-24 15:25:44 +01:00
f5e007c353 Add ACL checks into the libxl driver
Insert calls to the ACL checking APIs in all libxl driver
entrypoints.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-24 15:25:44 +01:00
cffe870c24 Add ACL checks into the Xen driver
Insert calls to the ACL checking APIs in all Xen driver
entrypoints.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-24 15:25:43 +01:00
d78277f934 Add ACL checks into the UML driver
Insert calls to the ACL checking APIs in all UML driver
entrypoints.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-24 15:25:43 +01:00
279866d550 Add ACL checks into the LXC driver
Insert calls to the ACL checking APIs in all LXC driver
entrypoints.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-24 15:25:43 +01:00
abf75aea24 Add ACL checks into the QEMU driver
Insert calls to the ACL checking APIs in all QEMU driver
entrypoints.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-24 15:25:43 +01:00
686026225e Auto-generate helpers for checking access control rules
Extend the 'gendispatch.pl' script to be able to generate
three new types of file.

- 'aclheader' - defines signatures of helper APIs for
  doing authorization checks. There is one helper API
  for each API requiring an auth check. Any @acl
  annotations result in a method being generated with
  a suffix of 'EnsureACL'. If the ACL check requires
  examination of flags, an extra 'flags' param will be
  present. Some examples

  extern int virConnectBaselineCPUEnsureACL(void);
  extern int virConnectDomainEventDeregisterEnsureACL(virDomainDefPtr domain);
  extern int virDomainAttachDeviceFlagsEnsureACL(virDomainDefPtr domain, unsigned int flags);

  Any @aclfilter annotations resuilt in a method being
  generated with a suffix of 'CheckACL'.

  extern int virConnectListAllDomainsCheckACL(virDomainDefPtr domain);

  These are used for filtering individual objects from APIs
  which return a list of objects

- 'aclbody' - defines the actual implementation of the
  methods described above. This calls into the access
  manager APIs. A complex example:

    /* Returns: -1 on error (denied==error), 0 on allowed */
    int virDomainAttachDeviceFlagsEnsureACL(virConnectPtr conn,
                                            virDomainDefPtr domain,
                                            unsigned int flags)
    {
        virAccessManagerPtr mgr;
        int rv;

        if (!(mgr = virAccessManagerGetDefault()))
            return -1;

        if ((rv = virAccessManagerCheckDomain(mgr,
                                              conn->driver->name,
                                              domain,
                                              VIR_ACCESS_PERM_DOMAIN_WRITE)) <= 0) {
            virObjectUnref(mgr);
            if (rv == 0)
                virReportError(VIR_ERR_ACCESS_DENIED, NULL);
            return -1;
        }
        if (((flags & (VIR_DOMAIN_AFFECT_CONFIG|VIR_DOMAIN_AFFECT_LIVE)) == 0) &&
            (rv = virAccessManagerCheckDomain(mgr,
                                              conn->driver->name,
                                              domain,
                                              VIR_ACCESS_PERM_DOMAIN_SAVE)) <= 0) {
            virObjectUnref(mgr);
            if (rv == 0)
                virReportError(VIR_ERR_ACCESS_DENIED, NULL);
            return -1;
        }
        if (((flags & (VIR_DOMAIN_AFFECT_CONFIG)) == (VIR_DOMAIN_AFFECT_CONFIG)) &&
            (rv = virAccessManagerCheckDomain(mgr,
                                              conn->driver->name,
                                              domain,
                                              VIR_ACCESS_PERM_DOMAIN_SAVE)) <= 0) {
            virObjectUnref(mgr);
            if (rv == 0)
                virReportError(VIR_ERR_ACCESS_DENIED, NULL);
            return -1;
        }
        virObjectUnref(mgr);
        return 0;
    }

- 'aclsyms' - generates a linker script to export the
   APIs to drivers. Some examples

  virConnectBaselineCPUEnsureACL;
  virConnectCompareCPUEnsureACL;

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-24 15:25:19 +01:00
e341435e50 Add ACL annotations to all RPC messages
Introduce annotations to all RPC messages to declare what
access control checks are required. There are two new
annotations defined:

 @acl: <object>:<permission>
 @acl: <object>:<permission>:<flagname>

  Declare the access control requirements for the API. May be repeated
  multiple times, if multiple rules are required.

    <object> is one of 'connect', 'domain', 'network', 'storagepool',
             'interface', 'nodedev', 'secret'.
    <permission> is one of the permissions in access/viraccessperm.h
    <flagname> indicates the rule only applies if the named flag
    is set in the API call

 @aclfilter: <object>:<permission>

  Declare an access control filter that will be applied to a list
  of objects being returned by an API. This allows the returned
  list to be filtered to only show those the user has permissions
  against

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-24 15:24:36 +01:00
b904bba7f4 Add a policy kit access control driver
Add an access control driver that uses the pkcheck command
to check authorization requests. This is fairly inefficient,
particularly for cases where an API returns a list of objects
and needs to check permission for each object.

It would be desirable to use the polkit API but this links
to glib with abort-on-OOM behaviour, so can't be used. The
other alternative is to speak to dbus directly

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-24 15:24:36 +01:00
ed3bac713c Setup default access control manager in libvirtd
Add a new 'access_drivers' config parameter to the libvirtd.conf
configuration file. This allows admins to setup the default
access control drivers to use for API authorization. The same
driver is to be used by all internal drivers & APIs

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-24 15:24:36 +01:00
ba7b867b46 Set conn->driver before running driver connectOpen method
The access control checks in the 'connectOpen' driver method
will require 'conn->driver' to be non-NULL. Set this before
running the 'connectOpen' method and NULL-ify it again on
failure.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-24 15:24:36 +01:00
a93cd08fd5 Define basic internal API for access control
This patch introduces the virAccessManagerPtr class as the
interface between virtualization drivers and the access
control drivers. The viraccessperm.h file defines the
various permissions that will be used for each type of object
libvirt manages

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-06-24 15:24:36 +01:00
d3c8788492 qemu: check if block I/O limits fit into long long
We can only pass values up to LLONG_MAX through JSON
and QEMU checks if the int64_t number is not negative
at startup since 1.5.0.

https://bugzilla.redhat.com/show_bug.cgi?id=974010
2013-06-24 14:18:14 +02:00
7a99eb912f Get rid of useless VIR_STORAGE_FILE_FEATURE_NONE
It's not used anywhere except for the switch in
virStorageBackendCreateQemuImgOpts, where leaving it in causes
a dead code coverity warning and omitting it breaks compilation
because of unhandled enum value.

Introduced by 6298f74.
2013-06-24 08:44:46 +02:00
695593fe00 netdev: accept NULL in virNetDevSetupControl
Commit b9c6b073 dropped the version of virNetDevSetupControl
that didn't check for NULL arguments, but we call it like that
in virNetDevBridgeDelete.
2013-06-21 20:22:07 +02:00
3a3b8f6956 xen: Implement virConnectGetSysinfo
virConnectGetSysinfo was never implemented in the legacy xen driver.
This patch provides an implementation based on the qemu driver.
2013-06-21 10:42:24 -06:00
fdc10e8d80 libxl: Implement virConnectGetSysinfo
virConnectGetSysinfo was never implemented in the libxl driver.
This patch provides an implementation based on the qemu driver.
2013-06-21 10:42:24 -06:00
ba64b97134 libxl: Allow libxl to set NIC devid
libxl contains logic to determine an appropriate devid for new devices
that do not specify one in their configuration.  For all device types
except NICs, the libxl driver allows libxl to determine devid.  Do the
same for NICs.
2013-06-21 10:16:47 -06:00
6298f74d9a storage: add support for creating qcow2 images with extensions
Add -o compat= and -o lazy_refcounts options for qemu-img.
2013-06-21 13:25:30 +02:00
31d42506fb conf: add features to volume target XML
Add <features> and <compat> elements to volume target XML.

<compat> is a string which for qcow2 represents the QEMU version
it should be compatible with. Valid values are 0.10 and 1.1.
1.1 is implicit if the <features> element is present, otherwise
qemu-img default is used. 0.10 can be specified to explicitly
create older images after the qemu-img default changes.

<features> contains optional features, so far
<lazy_refcounts/> is available, which enables caching of reference
counters, improving performance for snapshots.
2013-06-21 13:25:30 +02:00
a1ee8e18c9 util: add support for qcow2v3 image detection
Detect qcow2 images with version 3 in the image header as
VIR_STORAGE_FILE_QCOW2.

These images have a feature bitfield, with just one feature supported
so far: lazy_refcounts.

The header length changed too, moving the location of the backing
format name.
2013-06-21 13:25:29 +02:00
19f75d5eeb qemu: add hv_vapic and hv_spinlocks support
XML:
<features>
  <hyperv>
    <vapic state='on'/>
    <spinlocks state='on' retries='4096'/>
  </hyperv>
</features>

results in the following QEMU command line:
qemu -cpu <cpu_model>,hv_vapic,hv_spinlocks=0x1000

https://bugzilla.redhat.com/show_bug.cgi?id=784836
2013-06-21 13:24:44 +02:00
800b51d7b0 conf: add vapic and spinlocks to hyperv features
Add new CPU features for HyperV:
vapic for virtual APIC support
spinlocks for setting spinlock support

<features>
  <hyperv>
    <vapic state='on'/>
    <spinlocks state='on' retries='4096'/>
  </hyperv>
</features>

https://bugzilla.redhat.com/show_bug.cgi?id=784836
2013-06-21 12:33:46 +02:00
ce2400676d BSD: implement bridge add/remove port and set STP 2013-06-21 10:23:28 +02:00
b9c6b073e6 BSD: implement virNetDevBridgeCreate() and virNetDevBridgeDelete()
Implementation uses SIOCIFCREATE2 and SIOCIFDESTROY ioctls.
Also, drop static virNetDevSetupControl() as we have
public one avialable now.
2013-06-21 10:23:28 +02:00
9b8ee6d0f2 conf: Requires either uuid or usage of secret
As the RNG schema for disk auth secret implies, it requires either
"uuid" or "usage":

  <define name='diskAuthSecret'>
    <element name='secret'>
      <attribute name='type'>
        <choice>
          <value>ceph</value>
          <value>iscsi</value>
        </choice>
      </attribute>
      <choice>
        <attribute name='uuid'>
          <ref name="UUID"/>
        </attribute>
        <attribute name='usage'>
          <ref name='genericName'/>
        </attribute>
      </choice>
    </element>
  </define>
2013-06-21 09:41:48 +02:00
adb7b0b562 qemu: Make probing for commands declarative 2013-06-21 09:32:42 +02:00
61a2841493 qemu: Make probing for events declarative 2013-06-21 09:32:42 +02:00
24d0e67aba build: Fix build with -Werror
Commit 752596b5 broke the build with -Werror

qemu/qemu_hotplug.c: In function 'qemuDomainChangeGraphics':
qemu/qemu_hotplug.c:1980:39: error: declaration of 'listen' shadows a
  global declaration [-Werror=shadow]

Fix with s/listen/newlisten/
2013-06-20 12:59:19 -06:00
2bdf548f5f network: increase max number of routes
This fixes the problem reported in:

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

When checking for a collision of a new libvirt network's subnet with
any existing routes, we read all of /proc/net/route into memory, then
parse all the entries. The function that we use to read this file
requires a "maximum length" parameter, which had previously been set
to 64*1024. As each line in /proc/net/route is 128 bytes, this would
allow for a maximum of 512 entries in the routing table.

This patch increases that number to 128 * 100000, which allows for
100,000 routing table entries. This means that it's possible that 12MB
would be allocated, but that would only happen if there really were
100,000 route table entries on the system, it's only held for a very
short time.

Since there is no method of specifying and unlimited max (and that
would create a potential denial of service anyway) hopefully this
limit is large enough to accomodate everyone.
2013-06-20 14:23:36 -04:00
855f3a2e22 libxl: support paused domain restore in virDomainRestoreFlags
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2013-06-20 12:13:14 -06:00
752596b5dd qemuDomainChangeGraphics: Check listen address change by listen type
Currently, we have a bug when updating a graphics device. A graphics device can
have a listen address set. This address is either defined by user (in which case
it's type is VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) or it can be inherited
from a network (in which case it's type is
VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK). However, in both cases we have a
listen address to process (e.g. during migration, as I've tried to fix in
7f15ebc7).
Later, when a user tries to update the graphics device (e.g. set a password),
we check if listen addresses match the original as qemu doesn't know how to
change listen address yet. Hence, users are required to not change the listen
address. The implementation then just dumps listen addresses and compare them.
Previously, while dumping the listen addresses, NULL was returned for NETWORK.
After my patch, this is no longer true, and we get a listen address for olddev
even if it is a type of NETWORK. So we have a real string on one side, the NULL
from user's XML on the other side and hence we think user wants to change the
listen address and we refuse it.

Therefore, we must take the type of listen address into account as well.
2013-06-20 19:41:53 +02:00
c3358d14d9 libxl: initialize device structures
Do not leave uninitialized variables, not all parameters are set in
libxlMake*.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2013-06-20 10:06:54 -06:00
7ed47d16dd libxl: populate xenstore memory entries at startup, handle dom0_mem
libxl uses some xenstore entries for hints in memory management
(especially when starting new domain). This includes dom0 memory limit
and Xen free memory margin, based on current system state. Entries are
created at first function usage, so force such call at daemon startup,
which most likely will be before any domain startup.
Also prevent automatic memory management if dom0_mem= option passed to
xen hypervisor - it is known to be incompatible with autoballoon.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2013-06-19 16:23:40 -06:00
38ada092d1 lxc: Resolve issue with GetScheduler APIs for non running domain
As a consequence of the cgroup layout changes from commit 'cfed9ad4', the
lxcDomainGetSchedulerParameters[Flags]()' and lxcGetSchedulerType() APIs
failed to return data for a non running domain.  This can be seen through
a 'virsh schedinfo <domain>' command which returns:

Scheduler      : Unknown
error: Requested operation is not valid: cgroup CPU controller is not mounted

Prior to that change a non running domain would return:

Scheduler      : posix
cpu_shares     : 0
vcpu_period    : 0
vcpu_quota     : 0
emulator_period: 0
emulator_quota : 0

This patch will restore the capability to return configuration only data
for a non running domain regardless of whether cgroups are available.
2013-06-19 15:01:48 -04:00
b237545341 qemu: Resolve issue with GetScheduler APIs for non running domain
As a consequence of the cgroup layout changes from commit '632f78ca', the
qemuDomainGetSchedulerParameters[Flags]()' and qemuGetSchedulerType() APIs
failed to return data for a non running domain.  This can be seen through
a 'virsh schedinfo <domain>' command which returns:

Scheduler      : Unknown
error: Requested operation is not valid: cgroup CPU controller is not mounted

Prior to that change a non running domain would return:

Scheduler      : posix
cpu_shares     : 0
vcpu_period    : 0
vcpu_quota     : 0
emulator_period: 0
emulator_quota : 0

This patch will restore the capability to return configuration only data
for a non running domain regardless of whether cgroups are available.
2013-06-19 15:01:48 -04:00
75c787326d conf: split out snapshot disk XML formatting
Just to reduce the indentation levels. Remove the unneeded
NULL check for disk->file, as virBufferEscapeString doesn't
print anything with NULL arguments.
2013-06-19 15:12:12 +02:00
53d5967c25 storage: rework qemu-img command line generation
Split out option string generation to make adding new options easier
and simplify the code.
2013-06-19 15:12:12 +02:00
d0d0413e48 util: switch virBufferTrim to void
We don't care whether the trim was succesful or not anywhere
except the tests.

Switch it to void and set the buffer error on wrong usage.
2013-06-19 09:21:09 +02:00
5379bb0f33 migration: Don't propagate VIR_MIGRATE_ABORT_ON_ERROR
This flag is meant for errors happening on the source of the migration
and isn't used on the destination. To allow better migration
compatibility, don't propagate it to the destination.
2013-06-18 14:52:26 +02:00
cf6d56ac43 migration: Make erroring out on I/O error controllable by flag
Paolo Bonzini pointed out that it's actually possible to migrate a qemu
instance that was paused due to I/O error and it will be able to work on
the destination if the storage is accessible.

This patch introduces flag VIR_MIGRATE_ABORT_ON_ERROR that cancels the
migration in case an I/O error happens while it's being performed and
allows migration without this flag. This flag can be possibly used for
other error reasons that may be introduced in the future.
2013-06-18 14:52:26 +02:00
ddf8ad82eb qemu: Avoid leaking uri in qemuMigrationPrepareDirect 2013-06-18 14:49:20 +02:00
9da7b11bcd 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.
2013-06-18 14:32:52 +02:00
ce672cde62 spec: Enable KVM support on ARM
F20/rawhide has support for this.

From: Peter Robinson <pbrobinson@gmail.com>
2013-06-18 07:33:23 -04:00
9046b80d2d virsh: Support SCSI_GENERIC cap flag for nodedev-list
Document for nodedev-list is also updated.
2013-06-18 17:20:28 +08:00
4a7b3e58bd nodedev: Support SCSI_GENERIC cap flag for listAllNodeDevices 2013-06-18 17:20:03 +08:00
dd451f3aac 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>
2013-06-18 17:17:11 +08:00
92fd4c09a4 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>
2013-06-18 17:17:06 +08:00
0ad9025ef4 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.
2013-06-18 16:57:48 +08:00
bf5fbf8f94 nodedev_udev: changes missed by commit 1aa0ba3cef 2013-06-18 16:39:24 +08:00
1aa0ba3cef 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.
2013-06-18 16:32:14 +08:00
c4a4603de5 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.
2013-06-18 16:31:07 +08:00
b5c5f236bb 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.
2013-06-16 14:33:44 -05:00
847e1cd1f8 BSD: implement virNetDevTapCreate() and virNetDevTapDelete()
Implementation uses SIOCIFCREATE2 and SIOCIFDESTROY ioctls.
2013-06-14 16:44:31 +02:00
9614d70b0c Make virNetDevSetupControl() public.
This method is useful not only in virnetdev.c.
2013-06-14 16:14:58 +02:00
0f81bdb2f7 portability: use net/if.h instead of linux/if.h 2013-06-14 15:43:24 +02:00
f753dd62f9 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
2013-06-14 13:17:27 +02:00
1133404c73 LXC: s/chroot/chdir in lxcContainerPivotRoot()
...fixes a trivial copy&paste error.

Signed-off-by: Richard Weinberger <richard@nod.at>
2013-06-14 11:24:41 +02:00
7710d236b2 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 22d81ceb46
2013-06-14 10:41:29 +02:00
22d81ceb46 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.
2013-06-14 08:04:40 +02:00
d58ce13612 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>
2013-06-13 16:12:39 -06:00
2903197539 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>
2013-06-13 15:22:11 -06:00
07966f6a8b 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
2013-06-13 16:58:30 +02:00
f2eaef3f0e configure: Remove unused brctl check
brctl isn't used anywhere AFAICT
2013-06-12 11:50:06 -04:00
e1f31f5ae1 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.
2013-06-12 08:42:15 -06:00
47d14c3791 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".
2013-06-12 08:42:15 -06:00
12edde5cbb schema: simplify RNG pattern, remove superfluous <optional> 2013-06-12 16:14:44 +02:00
371c15517c 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
2013-06-12 11:08:45 +02:00
cbb3b71d3f libvirt_private.syms: add virProcessGetStartTime
https://bugzilla.redhat.com/show_bug.cgi?id=973543
2013-06-12 10:13:29 +02:00
5f719f217e 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.
2013-06-11 14:52:26 +02:00
caa467db62 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.
2013-06-11 14:52:26 +02:00
6546017c50 qemu_migrate: Dispose listen address if set from config
https://bugzilla.redhat.com/show_bug.cgi?id=971485

As of d7f9d82753 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.
2013-06-11 14:11:46 +02:00
9313a6a7fc qemu: Fix memory leak in Prepare phase
Avoid leaking virDomainDef if Prepare phase fails before it gets to
qemuMigrationPrepareAny.
2013-06-11 13:27:52 +02:00
0b466db29b selinux: assume 's0' if the range is empty
This fixes a crash:
https://bugzilla.redhat.com/show_bug.cgi?id=969878
2013-06-11 13:13:43 +02:00
e4f6fb04b7 storage_backend: Drop unused code
This has been disabled for years
2013-06-10 11:10:31 -04:00
7793d2a83e virSocketAddrIsWildcard: Use IN6_IS_ADDR_UNSPECIFIED correctly
The IN6_IS_ADDR_UNSPECIFIED macro expects pointer to sin6_addr element
instead of s6_addr element.
2013-06-10 14:48:08 +02:00
78cbff0ff2 storage: fix description of versionOffset 2013-06-10 11:44:31 +02:00
c2093b2aba Fix commit 29c1e913e4
This patch fixes changes done in commit 29c1e913e4
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.
2013-06-10 09:52:49 +02:00
db459dbdb9 spec: Drop Requires: vbox
Since this package isn't provided by any stock RH based distro. The
upstream RPMs are called VirtualBox anyways.
2013-06-08 18:32:59 -04:00
68eea85021 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>
2013-06-07 17:59:54 +01:00
e463f4de77 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.
2013-06-07 17:45:53 +02:00
cdd823c073 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++) {
             ^
2013-06-07 16:42:24 +02:00
c12b2be516 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.
2013-06-07 16:19:20 +02:00
d47eff88fe qemu: Implement support for VIR_DOMAIN_VCPU_AGENT in qemuDomainSetVcpusFlags
This patch adds support for agent-based cpu disabling and enabling to
qemuDomainSetVcpusFlags() API.
2013-06-07 15:58:25 +02:00
c6afcb052c 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.
2013-06-07 15:58:25 +02:00
29c1e913e4 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.
2013-06-07 15:58:25 +02:00
3099c063e3 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.
2013-06-07 15:58:24 +02:00
82e119f5cd qemu: Use bool instead of int in qemuMonitorSetCPU APIs
The 'online' parameter has only two possible values. Use a bool for it.
2013-06-07 15:57:03 +02:00
36e073ad9e virsh-domain-monitor: Remove ATTRIBUTE_UNUSED from a argument
The "cmd" argument in cmdList is now used. Unmark it as unused.
2013-06-07 15:57:03 +02:00
ab7110bff6 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>
2013-06-07 14:47:45 +01:00
b72ba1da36 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.
2013-06-07 15:27:17 +02:00
688994364f virsocket: Introduce virSocketAddrIsWildcard
This internal API checks, if passed address is a wildcard address.
2013-06-07 15:21:57 +02:00
cbdb3c7326 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
2013-06-07 15:16:04 +02:00
e31b5cf393 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'/>
2013-06-07 14:45:08 +08:00
d60570b315 qemu: simplify CPU command line parsing
Use virStringSplit. Change the 'error' label to 'cleanup' to prevent
memory leaks on error.
2013-06-06 17:30:08 +02:00
5debc7224a qemu: change two-state int parameters to bool 2013-06-06 17:22:53 +02:00
817a67b925 nwfilter: change two-state int parameters to bool 2013-06-06 17:22:53 +02:00
85f9178160 Remove redundant two-state integers 2013-06-06 17:22:53 +02:00
e557766c3b Replace two-state local integers with bool
Found with 'git grep "= 1"'.
2013-06-06 17:22:53 +02:00
b0c3ee0c85 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.
2013-06-06 12:41:17 +02:00
5d39a491ff 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.
2013-06-06 12:11:30 +02:00
e5fa9db17e 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.
2013-06-06 08:31:09 +02:00
e90a3598c7 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>
2013-06-05 20:38:31 -06:00
922ebe4ead 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>
2013-06-05 14:02:20 +01:00
61e672b23e 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>
2013-06-05 14:01:54 +01:00
77e7f69c3b 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
2013-06-05 14:43:36 +02:00
1d12ca3977 storage: Clean up function header and reflow error message
Comply with the coding standard and save a few lines.
2013-06-05 14:43:16 +02:00
b922c3d51a 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.
2013-06-05 14:43:16 +02:00
1add9c78da 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>
2013-06-05 05:53:25 -06:00
8da9516a84 qemu: Abstract code for the cpu controller setting into a helper 2013-06-05 19:25:48 +08:00
38b90e4df3 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.
2013-06-05 18:40:43 +08:00
aa2a4cff7c 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.
2013-06-05 18:35:55 +08:00
70fe129546 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
2013-06-05 10:17:28 +02:00
ed91e32b08 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(...);
 }
2013-06-05 10:37:45 +08:00
0ec376c20a 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.
2013-06-04 14:50:20 -04:00
7a5ac83520 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.
2013-06-04 09:45:06 -06:00
3452400673 docs: add spaces to formatstorage.html
Let the pool types breathe.
2013-06-04 15:56:44 +02:00
232240d095 virsh: Allow attach-disk to specify disk wwn
Commit 6e73850b01 support to set wwn for disks, but it was not
exposed to attach-disk.
2013-06-04 19:56:07 +08:00
a83b77dd73 tests: fix typo in securityselinuxtest 2013-06-04 13:17:30 +02:00
634096536c 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.
2013-06-04 10:16:02 +02:00
0eb2f8aa90 libvirt-qemu: Dispatch errors from virDomainQemuAgentCommand()
The original implementation didn't follow the established pattern and
did not dispatch errors in case of failure.
2013-06-03 17:25:33 +02:00
6e5b36d5d2 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.
2013-06-03 17:25:27 +02:00
08f1c0a9ae 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.
2013-06-03 17:25:26 +02:00
cdd642ba5e 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.
2013-06-03 17:07:13 +02:00
3b50a711f0 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.
2013-06-03 15:15:44 +02:00
a923865a0e virsh iface-bridge: Ignore delay if stp is turned off
Delay only makes sense with STP enabled.
2013-06-03 15:15:44 +02:00
4db39e3fee 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.
2013-06-03 15:15:44 +02:00
33e300229c virsh-domain: Add --live, --config, --current logic to cmdAttachInterface
Use the approach established in commit
69ce3ffa8d to improve this function too.
2013-06-03 14:23:02 +02:00
37772499e0 virsh-domain: Add --live, --config, --current logic to cmdAttachDisk
Use the approach established in commit
69ce3ffa8d to improve this function too.
2013-06-03 14:23:02 +02:00
f81c95b31f virsh-domain: Add --live, --config, --current logic to cmdAttachDevice
Use the approach established in commit
69ce3ffa8d to improve this function too.
2013-06-03 14:23:01 +02:00
de68895902 use virBitmapFree instead of VIR_FREE for cpumask
Found by 'git grep FREE.*cpumask' after looking at 31f1f6b.
2013-06-03 14:11:22 +02:00
dc0c791569 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
2013-06-03 13:56:08 +02:00
4497ef50dc 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
2013-06-03 12:09:56 +02:00
622aaa0ac2 Storage: Fix the indention of rbd test file 2013-06-03 11:20:01 +08:00
620c470aff 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.
2013-06-03 11:03:56 +08:00
cdb9789559 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.
2013-06-01 10:00:23 +08:00
2ea45647bc 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.)
2013-05-31 14:57:55 -04:00
aeef20e94b vbox: define DYNLIB_NAME for kFreeBSD
Similar to what Eric did for Cygwin it helps at least to compile
without --without-vbox
2013-05-31 19:49:13 +02:00
3d2b971518 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>
2013-05-31 11:35:34 -06:00
a261996255 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>
2013-05-31 10:51:33 -06:00
fae2505eee Document that runtime changes may be lost after S4 suspend 2013-05-31 18:03:20 +02:00
2136327e23 qemu: escape literal IPv6 address in NBD migration
A literal IPv6 must be escaped, otherwise migration fails with:
unable to execute QEMU command 'drive-mirror': address resolution failed
for f0::0d:5901: Servname not supported for ai_socktype
since QEMU treats everything after the first ':' as the port.
2013-05-31 17:21:10 +02:00
64919d978e Check for existence of interface prior to setting terminate flag
https://bugzilla.redhat.com/show_bug.cgi?id=903480

During domain destruction it's possible that the learnIPAddressThread has
already removed the interface prior to the teardown filter path being run.
The teardown code would only be telling the thread to terminate.
2013-05-31 10:43:29 -04:00
2f3e7f1e36 Resolve memory leak found by valgrind
Commit '6afdfc8e' adjusted the exit and error paths to go through the error
and cleanup labels, but neglected to remove the return ret prior to cleanup.
Also noted the 'type' xml string fetch was never checked for NULL which
could lead to some interesting results.
2013-05-31 10:38:15 -04:00
177046753f qemu: snapshot: Don't kill access to disk if snapshot creation fails
If snapshot creation failed for example due to invalid use of the
"REUSE_EXTERNAL" flag, libvirt killed access to the original image file
instead of the new image file. On machines with selinux this kills the
whole VM as the selinux context is enforced immediately.

* qemu_driver.c:qemuDomainSnapshotUndoSingleDiskActive():
    - Kill access to the new image file instead of the old one.

Partially resolves: https://bugzilla.redhat.com/show_bug.cgi?id=906639
2013-05-31 15:41:59 +02:00
6c23d60961 qemu: Fix damaged whitespace
After deleting "WithDriver" from the async job function the code was
unaligned.
2013-05-31 15:35:37 +02:00
eb5fe55634 Properly indent function's opening bracket 2013-05-31 14:45:24 +02:00
db23257523 build: use correct rpc.h for virtlockd
Commit d671121d was incomplete; I hit another compile fail on
cygwin not finding the correct rpc/rpc.h.

* src/Makefile.am (virtlockd_CFLAGS): Add XDR_CFLAGS.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-30 15:49:40 -06:00
9fda950f5c build: work around cygwin header bug
A bug in Cygwin [1] and poor error messages from gcc [2] lead
to this confusing compilation error:

qemu/qemu_monitor.c:418:9: error: passing argument 2 of 'sendmsg' from incmpatible pointer type
/usr/include/sys/socket.h:42:11: note: expected 'const struct msghdr *' but argument is of type 'struct msghdr *'

[1] http://cygwin.com/ml/cygwin/2013-05/msg00451.html
[2] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57475

* src/qemu/qemu_monitor.c (includes): Include <sys/socket.h>
before <sys/un.h>.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-30 14:51:58 -06:00
f43bb1dc20 build: cast [ug]id_t when printing
This is a recurring problem for cygwin :)
For example, see commit 23a4df88.

qemu/qemu_driver.c: In function 'qemuStateInitialize':
qemu/qemu_driver.c:691:13: error: format '%d' expects type 'int', but argument 8 has type 'uid_t' [-Wformat]

* src/qemu/qemu_driver.c (qemuStateInitialize): Add casts.
* daemon/remote.c (remoteDispatchAuthList): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-30 10:36:16 -06:00
19a7f9fffb build: port qemu to cygwin
A cygwin build of the qemu driver fails with:

qemu/qemu_process.c: In function 'qemuPrepareCpumap':
qemu/qemu_process.c:1803:31: error: 'CPU_SETSIZE' undeclared (first use in this function)

CPU_SETSIZE is a Linux extension in <sched.h>; a bit more portable
is using sysconf if _SC_NPROCESSORS_CONF is defined (several platforms
have it, including Cygwin).  Ultimately, I would have preferred to
use gnulib's 'nproc' module, but it is currently under an incompatible
license.

* src/qemu/qemu_conf.h (QEMUD_CPUMASK_LEN): Provide definition on
cygwin.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-30 06:39:27 -06:00
d671121ddc build: use correct rpc.h for lockd
On cygwin, the build failed with:

In file included from ./rpc/virnetmessage.h:24:0,
                 from ./rpc/virnetclient.h:29,
                 from locking/lock_driver_lockd.c:31:
./rpc/virnetprotocol.h:9:21: fatal error: rpc/rpc.h: No such file or directory

* src/Makefile.am (lockd_la_CFLAGS): Add XDR_CFLAGS.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-29 19:52:58 -06:00
1be3dfdfa7 build: work around broken sasl header
Compilation on cygwin failed due to a bug in the sasl headers
present on that platform (libsasl2-devel 2.1.26):

In file included from rpc/virnetserverclient.c:27:0:
/usr/include/sasl/sasl.h:230:38: error: expected declaration specifiers or '...' before 'size_t'

Upstream is aware of their bug:
https://bugzilla.cyrusimap.org/show_bug.cgi?id=3759

* src/rpc/virnetserverclient.c (includes): Ensure size_t is
defined before using sasl.h.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-29 14:07:53 -06:00
1cd97c7ab4 build: fix typo in earlier commit
Bummer, I committed, then fixed a typo, then tested, and forgot to
amend the commit before pushing 7d21d6b6.

* src/rpc/virnettlscontext.c (includes): Use correct spelling.
2013-05-29 11:08:14 -06:00
5e1de4fcdd virsh: migrate: Don't disallow --p2p and --migrateuri
Because it's a valid combination. p2p still uses a separate channel
for qemu migration, so there's value in letting the user specify a manual
migrate URI for overriding auto-port, or libvirt's FQDN lookup.

What _isn't_ allowed is --migrateuri and TUNNELLED, since there is
no separate migration channel. Disallow that instead
2013-05-29 12:31:00 -04:00
98bbda00cf qemu: migration: error if tunnelled + storage specified
Since as the code indicates it doesn't work yet, so let's be
explicit about it.
2013-05-29 12:31:00 -04:00
5751fc4f4e qemu: migration: Improve p2p error if we can't open conn
By actually showing the Open() error to the user
2013-05-29 12:31:00 -04:00
fd8fa33b54 build: fix build without libvirtd
Building when configured --with-libvirtd=no fails with:

In file included from ../src/qemu/qemu_command.h:30:0,
                 from testutilsqemu.h:4,
                 from networkxml2xmltest.c:14:
../src/qemu/qemu_conf.h:175:5: error: expected specifier-qualifier-list before 'virStateInhibitCallback'

* src/libvirt_internal.h (virStateInhibitCallback): Move outside
of conditional.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-29 09:08:42 -06:00
7d21d6b697 build: fix build with newer gnutls
Building with gnutls 3.2.0 (such as shipped with current cygwin) fails
with:

rpc/virnettlscontext.c: In function 'virNetTLSSessionGetKeySize':
rpc/virnettlscontext.c:1358:5: error: implicit declaration of function 'gnutls_cipher_get_key_size' [-Wimplicit-function-declaration]

Yeah, it's stupid that gnutls broke API by moving their declaration
into a new header without including that header from the old one,
but it's easy enough to work around, all without breaking on gnutls
1.4.1 (hello RHEL 5) that lacked the new header.

* configure.ac (gnutls): Check for <gnutls/crypto.h>.
* src/rpc/virnettlscontext.c (includes): Include additional header.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-29 08:52:42 -06:00
6c89768da4 storage_conf: Use uid_t/gid_t instead of int to cast the value
And error out if the casted value is not same with the original
one, which prevents the bug on platform(s) where uid_t/gid_t
has different size with long.
2013-05-29 18:19:19 +08:00
ec2b81c68b storage_conf: Improve error messages
virStoragePoolDefParseSource:
  * Better error message

virStoragePoolObjLoad:
  * Break the line line
2013-05-29 18:08:42 +08:00
1c6fe3fa3a storage_conf: Use NULLSTR instead 2013-05-29 18:06:11 +08:00
107130cc71 storage_conf: Improve the memory deallocation of virStorageVolDefParseXML
Changes:
  * Add a new goto label "error"
  * Free the strings at "cleanup"
  * Remove the unnecessary frees
2013-05-29 18:05:55 +08:00
6afdfc8e13 storage_conf: Improve the memory deallocation of pool def parsing
Changes:
    * Free all the strings at "cleanup", instead of freeing them
      in the middle
    * Remove xmlFree
    * s/tmppath/target_path/, to make it more sensible
    * Add new goto label "error"
2013-05-29 18:04:33 +08:00
d10cfaec3b qemuOpenVhostNet: Decrease vhostfdSize on open failure
Currently, if there's an error opening /dev/vhost-net (e.g. because
it doesn't exist) but it's not required we proceed with vhostfd array
filled with -1 and vhostfdSize unchanged. Later, when constructing
the qemu command line only non-negative items within vhostfd array
are taken into account. This means, vhostfdSize may be greater than
the actual count of non-negative items in vhostfd array. This results
in improper command line arguments being generated, e.g.:

-netdev tap,fd=21,id=hostnet0,vhost=on,vhostfd=(null)
2013-05-29 09:20:04 +02:00
f6817c70b4 build: fix build with older gcc
gcc 4.1.2 (hello, RHEL 5!) fails to build on 32-bit platforms with:

conf/domain_conf.c: In function 'virDomainDefParseXML':
conf/domain_conf.c:10581: warning: integer constant is too large for 'long' type

Problem introduced in commit f8e3221f9.

* src/conf/domain_conf.c (virDomainDefParseXML): Mark large constants.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-28 17:34:50 -06:00
327d4db83e build: drop unused variable
Compilation for mingw failed:

../../src/util/virutil.c: In function 'virGetWin32DirectoryRoot':
../../src/util/virutil.c:1094:9: error: unused variable 'ret' [-Werror=unused-variable]

* src/util/virutil.c (virGetWin32DirectoryRoot): Silence compiler
warning.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-28 17:11:48 -06:00
0c8926daf9 syntax: fix broken error message in previous patch
Osier Yang pointed out that I introduced a syntax error in my
syntax check (I really shouldn't make last-minute changes without
testing them....).

/bin/sh: -c: line 2: syntax error near unexpected token `;'
/bin/sh: -c: line 2: `  { echo 'maint.mk: incorrect whitespace, see HACKING for rules' 2>&; \'
make: *** [bracket-spacing-check] Error 1

* cfg.mk (bracket-spacing-check): Fix copy-and-paste error.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-28 09:52:03 -06:00
406d8a9809 qemu: Don't report error on successful media eject
If we are just ejecting media, ret == -1 even after the retry loop
determines that the tray is open, as requested. This means media
disconnect always report's error.

Fix it, and fix some other mini issues:

- Don't overwrite the 'eject' error message if the retry loop fails
- Move the retries decrement inside the loop, otherwise the final loop
  might succeed, yet retries == 0 and we will raise error
- Setting ret = -1 in the disk->src check is unneeded
- Fix comment typos

cc: mprivozn@redhat.com
2013-05-28 11:45:19 -04:00
134e685b1d syntax-check: mandate space after mid-line semicolon
Enforce the style cleanup in the previous patch.

* build-aux/bracket-spacing.pl: Enforce trailing spacing.
* cfg.mk (bracket-spacing-check): Tweak error wording.
* docs/hacking.html.in: Document the rule.
* HACKING: Regenerate.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-28 08:26:05 -06:00
146ba114a5 syntax: prefer space after semicolon in for loop
I noticed several unusual spacings in for loops, and decided to
fix them up.  See the next commit for the syntax check that found
all of these.

* examples/domsuspend/suspend.c (main): Fix spacing.
* python/libvirt-override.c: Likewise.
* src/conf/interface_conf.c: Likewise.
* src/security/virt-aa-helper.c: Likewise.
* src/util/virconf.c: Likewise.
* src/util/virhook.c: Likewise.
* src/util/virlog.c: Likewise.
* src/util/virsocketaddr.c: Likewise.
* src/util/virsysinfo.c: Likewise.
* src/util/viruuid.c: Likewise.
* src/vbox/vbox_tmpl.c: Likewise.
* src/xen/xen_hypervisor.c: Likewise.
* tools/virsh-domain-monitor.c (vshDomainStateToString): Drop
default case, to let compiler check us.
* tools/virsh-domain.c (vshDomainVcpuStateToString): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-28 07:56:07 -06:00
2da3bc646e util: fix the VIR_STRDUP when src is NULL
When src is NULL, VIR_STRDUP will return 0 directly.
This patch will set dest to NULL before VIR_STRDUP return.

Example:
[root@yds-pc libvirt]# virsh
Welcome to virsh, the virtualization interactive terminal.

Type: 'help' for help with commands
'quit' to quit

virsh # connect
error: Failed to connect to the hypervisor
error: internal error Unable to parse URI �N�*

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-28 05:57:01 -06:00
c6f2523fb1 qemu: Fix build without gnutls
"error" label in qemuMigrationCookieGraphicsAlloc is now used
unconditionally thanks to VIR_STRDUP.
2013-05-27 10:19:36 +02:00
2697c8a116 qemu: save domain state to XML after reboot
Currently qemuDomainReboot() does reboot in two phases:
qemuMonitorSystemPowerdown() and qemuProcessFakeReboot().

qemuMonitorSystemPowerdown() shutdowns the domain and saves domain
state/reason as VIR_DOMAIN_SHUTDOWN_UNKNOWN.

qemuProcessFakeReboot() sets domain state/reason to
VIR_DOMAIN_RESUMED_UNPAUSED but does not save domain state changes.

Subsequent restart of libvirtd leads to restoring domain state/reason to
saved that is VIR_DOMAIN_SHUTDOWN_UNKNOWN and to automatic shutdown of
the domain. This commit adds virDomainSaveStatus() into
qemuProcessFakeReboot() to avoid unexpected shutdowns.
2013-05-24 15:29:22 -06:00
befc36a81d esx: Fix dynamic VI object type detection
VI objects support inheritance with subtype polymorphism. For example the
FileInfo object type is extended by FloppyImageFileInfo, FolderFileInfo
etc. Then SearchDatastore_Task returns an array of FileInfo objects and
depending on the represented file the FileInfo is actually a FolderFileInfo
or FloppyImageFileInfo etc. The actual type information is stored as XML
attribute that allows clients such as libvirt to distinguish between the
actual types. esxVI_GetActualObjectType is used to extract the actual type.

I assumed that this mechanism would be used for all VI object types that
have subtypes. But this is not the case. It seems only to be used for types
that are actually used as generic base type such as FileInfo. But it is not
used for types that got extended later such as ElementDescription that was
extended by ExtendedElementDescription (added in vSphere API 4.0) or that
are not meant to be used with subtype polymorphism.

This breaks the deserialization of types that contain ElementDescription
properties such as PerfCounterInfo or ChoiceOption, because the code
expects an ElementDescription object to have an XML attribute named type
that is not present, since ExtendedElementDescription was added to the
esx_vi_generator.input in commit 60f0f55ee4.
This in turn break virtual machine question handling and auto answering.

Fix this by using the base type if no XML type attribute is present.
2013-05-24 21:31:42 +02:00
831909a94e spec: Build vbox packages only for x86 architectures
Commit 6ab6bc19f0 has introduced separate
daemon/driver packages for vbox. These should only be built for x86
architectures which is done hereby.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2013-05-24 10:11:00 -06:00
fb6a05e75d security_dac: Fix the coding style
Pushed under trivial rule.
2013-05-24 23:33:09 +08:00
0fc5d09cbb Adapt to new VIR_STRNDUP behavior
With previous patch, we accept negative value as length of string to
duplicate. So there is no need to pass strlen(src) in case we want to do
duplicate the whole string.
2013-05-24 17:00:39 +02:00
c93571968b virStrndup: Accept negative values as string length
It may shorten the code a bit as the following pattern:

  VIR_STRNDUP(dst, src, cond ? n : strlen(src))

is used on several places among our code. However, we can
move the strlen into virStrndup and thus write just:

  VIR_STRNDUP(dst, src, cond ? n : -1)
2013-05-24 16:59:30 +02:00
267915ee69 storage_conf: Fix the error type
s/VIR_ERR_INTERNAL_ERROR/VIR_ERR_XML_ERROR/.
2013-05-24 22:34:16 +08:00
3c37730efc storage_conf: Put "%s" at the same line with error type
Trivial, but it allows the "error message" to have more spaces.
2013-05-24 22:34:03 +08:00
0175f03cde storage_conf: Use xmlStrEqual instead of STREQ
And improve the error message
2013-05-24 22:33:50 +08:00
7ae5999fa3 storage_conf: Remove the useless casting 2013-05-24 22:33:35 +08:00
61c6227341 storage_conf: Don't leak "uuid" in virStoragePoolDefParseAuthCephx
Any string returned from virXPathString should be freed.
2013-05-24 22:33:23 +08:00
49598fab61 storage_conf: Fix the wrong error message
It's for parsing "login" attribute of "auth".
2013-05-24 22:33:07 +08:00
711ca22a20 syntax-check: ignore all quoted strings in bracket-spacing
Ignore strings with an escaped double quote too.

This removes the need for special handling of quotes in the
semicolon check.
2013-05-24 15:57:45 +02:00
b9c4bd0c07 nwfilter: Remove error report in virNWFilterDHCPSnoopEnd
Remove error reporting when calling the virNWFilterDHCPSnoopEnd
function with an interface for which no thread is snooping traffic.

Document the usage of this function.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2013-05-24 08:01:03 -04:00
5af3ce8277 Fix blkdeviotune for shutoff domain
Function qemuDomainSetBlockIoTune() was checking QEMU capabilities
even when !(flags & VIR_DOMAIN_AFFECT_LIVE) and the domain was
shutoff, resulting in the following problem:

 virsh # domstate asdf; blkdeviotune asdf vda --write-bytes-sec 100
 shut off

 error: Unable to change block I/O throttle
 error: unsupported configuration: block I/O throttling not supported with this QEMU binary

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=965016
2013-05-24 13:29:20 +02:00
eb21408f44 cgroups: Do not enforce nonexistent controllers
Currently, the controllers argument to virCgroupDetect acts both as
a result filter and a required controller specification, which is
a bit overloaded. If both functionalities are needed, it would be
better to have them seperated into a filter and a requirement mask.
The only situation where it is used today is to ensure that only
CPU related controllers are used for the VCPU directories. But here
we clearly do not want to enforce the existence of cpu, cpuacct and
specifically not cpuset at the same time.
This commit changes the semantics of controllers to "filter only".
Should a required mask ever be needed, more work will have to be done.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2013-05-24 12:11:24 +02:00
2a3a725c33 virsh: Fix regression of vol-resize
Introduced by commit 1daa4ba33a. vshCommandOptStringReq returns
0 on *success* or the option is not required && not present, both
are right result. Error out when returning 0 is not correct.
the caller, it doesn't have to check wether it
2013-05-24 16:55:39 +08:00
d1527ba5d7 Introduce syntax-check rule to prefer VIR_STRDUP over strdup 2013-05-24 10:13:02 +02:00
528f420e03 Adapt to VIR_STRDUP and VIR_STRNDUP in tools/virsh.c 2013-05-24 10:10:03 +02:00
f48ba88b35 Adapt to VIR_STRDUP and VIR_STRNDUP in src/util/* 2013-05-24 10:10:03 +02:00
eb8e5e8774 Adapt to VIR_STRDUP and VIR_STRNDUP in src/util/vircgroup.c
This commit is separate due to unusual paradigm compared to the
most source files.
2013-05-24 10:10:03 +02:00
b43bb98a31 virCgroupAddTaskStrController: s/-1/-ENOMEM/
Within whole vircgroup.c we 'return -errno', e.g. 'return -ENOMEM'.
However, in this specific function virCgroupAddTaskStrController
we weren't returning -ENOMEM but -1 despite fact that later in
the function we are returning one of errno values indeed.
2013-05-24 10:03:22 +02:00
677981d1be xen: Resolve Coverity FORWARD_NULL issue
Commit '18b14012' refactored the Xen code resulting in a Coverity
warning about possible NULL reference if the path where the XM driver
takes puts the def on it's list.  Moved/duplicated the virGetDomain()
call to pacify the possible NULL deref.
2013-05-23 19:19:21 -04:00
e4de214b38 docs: domain: /dev/urandom isn't a valid rng patch
Only /dev/random and /dev/hwrng are accepted, list them explicitly.
2013-05-23 14:37:08 -04:00
23195651f5 conf: add missing OOM errors 2013-05-23 18:56:36 +02:00
2326006410 qemu: fix NBD migration to hosts with IPv6 enabled
Since f03dcc5 we use [::] as the listening address both on qemu
command line in -incoming and in nbd-server-start QMP command.
However the latter requires just :: without the braces.
2013-05-23 17:55:34 +02:00
a32b41746c conf: fix use after free in virChrdevOpen
Don't free the stream on error if we've successfully added it
to the hash table, since it will be freed by virChrdevHashEntryFree
callback.

Preserve the error message before calling virStreamFree, since it
resets the error.

Introduced by 4716138, crashing since 6921892.

Reported by Sergey Fionov on libvir-list.
2013-05-23 17:55:34 +02:00
a551e9e1fc Adapt to VIR_STRDUP and VIR_STRNDUP in src/xenxs/* 2013-05-23 17:29:49 +02:00
63ee3b664d Adapt to VIR_STRDUP and VIR_STRNDUP in src/xenapi/* 2013-05-23 17:29:49 +02:00
5162a07651 Adapt to VIR_STRDUP and VIR_STRNDUP in src/xen/* 2013-05-23 17:29:49 +02:00
ed2193b16b virNetMessageSaveError: Fix copy and paste error
Previously, we were freeing verr fields instead of rerr which we've
allocated just a line above.
2013-05-23 16:00:56 +02:00
e3d1f6aa7c virNWFilterHashTablePut: Free the correct variable
In bf1fe848 I've introduced 'newName' variable to substitute the old
'const char *name' as previously we had an ugly code there:

  name = strdup(name);

However, some parts of the function were not updated, so they were still
calling VIR_FREE(name) instead of VIR_FREE(newName).
2013-05-23 15:58:41 +02:00
4f3729f812 umlConnectTapDevice: initialize tapfd variable
There is possibility to jump to 'cleanup' label without tapfd variable
being initialized. In the label, VIR_FORCE_CLOSE(tapfd) is called which
can have fatal consequences.
2013-05-23 15:22:35 +02:00
03d813bbcd remote: fix dom->id after virDomainCreateWithFlags
The same issue as (already fixed) in virDomainCreate -
REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS doesn't return new domain ID, only
-1 on error or 0 on success.

Besides this one fix it is more general problem - local domain object
ID can desynchronize with the real one, for example in case of another
client creates/destroys domain in the meantime. Perhaps virDomainGetID
should be called remotely (with all performance implications...)? Or
some event-based notification used?

Signed-off-by: Marek Marczykowski <marmarek@invisiblethingslab.com>
2013-05-23 15:07:16 +02:00
4756228247 Fix the build failure
Commit 16251193af forgot to include "virstring.h". Pushed under
build-breaker rule.
2013-05-23 19:58:28 +08:00
0a24028f11 virsh: Fix virDomainFree for NULL domain in blkdeviotune 2013-05-23 13:02:19 +02:00
aaa42912ae Adapt to VIR_STRDUP and VIR_STRNDUP in src/security/* 2013-05-23 09:56:38 +02:00
16251193af Adapt to VIR_STRDUP and VIR_STRNDUP in src/rpc/* 2013-05-23 09:56:38 +02:00
d2846c25bd Adapt to VIR_STRDUP and VIR_STRNDUP in src/remote/* 2013-05-23 09:56:38 +02:00
a88fb3009f Adapt to VIR_STRDUP and VIR_STRNDUP in src/qemu/* 2013-05-23 09:56:38 +02:00
c0955c3206 virsh: omit OPTION section in 'virsh help' if no option exists
Don't print 'OPTION' if there's no options. Just behaves as DESCRIPTION
does.
This mostly affects 'interface' command group.

Signed-off-by: Zhang Xiaohe <zhangxh@cn.fujitsu.com>
Reported-by: Li Yang <liyang.fnst@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-22 16:17:24 -06:00
6ac6f59c98 Change virConnectDomainEventGraphicsCallback signature
For future work we need _virDomainEventGraphicsAddress and
_virDomainEventGraphicsSubjectIdentity members to be char * not const
char *. We are strdup()-ing them anyway, so they should have been char *
anyway (from const correctness POV). However, we don't want users to
change passed values, so we need to make the callback's argument const.

Although this is an API change (not ABI though), real callers won't be
impacted. Why?
 1. these callback members are read-only, so it is less likely that
someone is trying to assign into the struct members.
 2. The only way to register a virConnectDomainEventGraphicsCallback is
to cast it through a call to virConnectDomainEventRegisterAny.  That is,
even if the user's callback function leaves out the const, we never use
the typedef as the direct type of any API parameter.  Since they are
already casting their function pointer into a munged type before
registering it, their code will continue to compile.
2013-05-22 18:53:59 +02:00
1f5deed9b6 Adapt to VIR_STRDUP and VIR_STRNDUP in src/openvz/* 2013-05-22 18:53:59 +02:00
bf1fe848c7 Adapt to VIR_STRDUP and VIR_STRNDUP in src/conf/* 2013-05-22 18:53:59 +02:00
25a2d944df virNetDevTapCreate: Fail on systems not supporting IFF_MULTI_QUEUE
In my previous patches I enabled the IFF_MULTI_QUEUE flag every
time the user requested multiqueue TAP device. However, this
works only at runtime. During build time the flag may be
undeclared.
2013-05-22 18:32:27 +02:00
03eb06632a qemu: Enable multiqueue network 2013-05-22 17:34:02 +02:00
1f24f68225 qemu: Adapt qemuBuildInterfaceCommandLine to to multiqueue net
In order to learn libvirt multiqueue several things must be done:

1) The '/dev/net/tun' device needs to be opened multiple times with
IFF_MULTI_QUEUE flag passed to ioctl(fd, TUNSETIFF, &ifr);

2) Similarly, '/dev/vhost-net' must be opened as many times as in 1)
in order to keep 1:1 ratio recommended by qemu and kernel folks.

3) The command line construction code needs to switch from 'fd=X' to
'fds=X:Y:...:Z' and from 'vhostfd=X' to 'vhostfds=X:Y:...:Z'.

4) The monitor handling code needs to learn to pass multiple FDs.
2013-05-22 17:24:27 +02:00
565c07f171 qemu: Move interface cmd line construction into a separate function
Currently, we have one huge function to construct qemu command line.
This is very ineffective esp. if there's a fault somewhere.
2013-05-22 17:05:36 +02:00
7e744f8199 Introduce /domain/devices/interface/driver/@queues attribute
This attribute is going to represent number of queues for
multique vhost network interface. This commit implements XML
extension part of the feature and add one test as well. For now,
we can only do xml2xml test as qemu command line generation code
is not adapted yet.
2013-05-22 16:31:27 +02:00
3c53984412 qemu: add ', share=<policy>' to qemu commandline
example: qemu ${otherargs} \
             -vnc 127.0.0.1:0,share=allow-exclusive
2013-05-22 19:18:48 +08:00
2a58d07654 conf: add 'sharePolicy' attribute to graphics element for vnc
-vnc :5900,share=allow-exclusive
allows clients to ask for exclusive access which is
implemented by dropping other connections Connecting
multiple clients in parallel requires all clients asking
for a shared session (vncviewer: -shared switch)

 -vnc :5900,share=force-shared
disables exclusive client access.  Useful for shared
desktop sessions, where you don't want someone forgetting
specify -shared disconnect everybody else.

 -vnc :5900,share=ignore
completely ignores the shared flag and allows everybody
connect unconditionally
2013-05-22 19:18:43 +08:00
d377d02dc4 qemu: new vnc display sharing policy caps flag
QEMU_CAPS_VNC_SHARE_POLICY (qemu >= 1.1)
2013-05-22 19:18:37 +08:00
1c65362f11 vbox: fix VIR_STRDUP value check
In my review of 31532ca I missed the fact that VIR_STRDUP
now returns 1 on success, and 0 if the source was NULL.

(This still doesn't add proper OOM error handling.)
2013-05-22 07:24:14 +02:00
ba0880b25c syntax-check: Add the rule to forbid whitespace before ";"
Only a few cases are allowed:

1) The expression is empty for "for" loop, E.g.

  for (i = 0; ; i++)

2) An empty statement

  while (write(statuswrite, &status, 1) == -1 &&
         errno == EINTR)
      ; /* empty */

3) ";" is inside double-quote, I.e, as part of const string. E.g.

  vshPrint(ctl, "a ; b ; cd;\n");

The "for" loop in src/rpc/virnettlscontext.c is the special case,
1) applies for it, so change it together in this patch.
2013-05-22 13:16:03 +08:00
1f49c0e138 nwfilter: Change the comment style
The more common habit is to add the comment after the statements.
2013-05-22 13:15:57 +08:00
1f9dcbc7f1 Fix the syntax-check failure
Introduced by commit 7ac2c4fe62, pushed under build-breaker rule.
2013-05-22 13:14:31 +08:00
7ac2c4fe62 interface: list all interfaces with flags == 0
virConnectListAllInterfaces should support to list all of
interfaces when the value of flags is 0. The behaviour is
consistent with other virConnectListAll* APIs
2013-05-22 09:50:34 +08:00
83e4c77547 cgroup: be robust against cgroup movement races
https://bugzilla.redhat.com/show_bug.cgi?id=965169 documents a
problem starting domains when cgroups are enabled; I was able
to reliably reproduce the race about 5% of the time when I added
hooks to domain startup by 3 seconds (as that seemed to be about
the length of time that qemu created and then closed a temporary
thread, probably related to aio handling of initially opening
a disk image).  The problem has existed since we introduced
virCgroupMoveTask in commit 9102829 (v0.10.0).

There are some inherent TOCTTOU races when moving tasks between
kernel cgroups, precisely because threads can be created or
completed in the window between when we read a thread id from the
source and when we write to the destination.  As the goal of
virCgroupMoveTask is merely to move ALL tasks into the new
cgroup, it is sufficient to iterate until no more threads are
being created in the old group, and ignoring any threads that
die before we can move them.

It would be nicer to start the threads in the right cgroup to
begin with, but by default, all child threads are created in
the same cgroup as their parent, and we don't want vcpu child
threads in the emulator cgroup, so I don't see any good way
of avoiding the move.  It would also be nice if the kernel were
to implement something like rename() as a way to atomically move
a group of threads from one cgroup to another, instead of forcing
a window where we have to read and parse the source, then format
and write back into the destination.

* src/util/vircgroup.c (virCgroupAddTaskStrController): Ignore
ESRCH, because a thread ended between read and write attempts.
(virCgroupMoveTask): Loop until all threads have moved.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-21 11:33:56 -06:00
63411259bb src/*.[ch]: Remove the whitespace before ";" 2013-05-21 23:41:45 +08:00
45ca0b8785 src/locking: Remove the whitespace before ";" 2013-05-21 23:41:45 +08:00
ea4e554038 python: Remove the whitespace before ";" 2013-05-21 23:41:45 +08:00
6da965692c examples: Remove the whitespace before ';' 2013-05-21 23:41:45 +08:00
1ea88abd7e src/lxc: Remove the whitespace before ";" 2013-05-21 23:41:45 +08:00
77e2d3777d src/remote: Remove the whitespace before ";" 2013-05-21 23:41:45 +08:00
13dbad4053 src/rpc: Remove the whitespace before ";" 2013-05-21 23:41:45 +08:00
3fcc1df2f8 src/utils: Remove the whitespace before ";" 2013-05-21 23:41:45 +08:00
bb3ea8416b tests/: Remove the whitespace before ";" 2013-05-21 23:41:45 +08:00
e25ca77303 daemon: Remove the whitespace before ";" 2013-05-21 23:41:45 +08:00
c96f6ae845 tools: Remove the whitespace before ";" 2013-05-21 23:41:45 +08:00
f0e752a438 src/storage: Remove the whitespace before ';' 2013-05-21 23:41:44 +08:00
3de80af28a src/security: Remove the whitespace before ';' 2013-05-21 23:41:44 +08:00
0c38d36dcf src/xen: Remove the whitespace before ';' 2013-05-21 23:41:44 +08:00
9b32d2dba0 src/vmware: Remove the whitespace before ';' 2013-05-21 23:41:44 +08:00
66194f71df src/qemu: Remove the whitespace before ';' 2013-05-21 23:41:44 +08:00
f1b3930c85 src/interface: Remove the whitespace before ';' 2013-05-21 23:41:44 +08:00
e6d0168c3a src/parallels: Remove the whitespace before ';' 2013-05-21 23:41:44 +08:00
f23c87a711 src/uml: Remove the whitespace before ';' 2013-05-21 23:41:44 +08:00
ba38541567 src/openvz: Remove the whitespace before ';' 2013-05-21 23:41:44 +08:00
4346d37cb7 src/node_device: Remove the whitespace before ';' 2013-05-21 23:41:44 +08:00
c2e284ef66 src/phyp: Remove the whitespace before ';' 2013-05-21 23:41:44 +08:00
610ae59fcc src/nwfilter: Remove the whitespace before ';' 2013-05-21 23:41:44 +08:00
7b2014a644 src/xenxs: Remove the whitespace before ';' 2013-05-21 23:41:44 +08:00
7fba1f7cdd src/vbox: Remove the whitespace before ';' 2013-05-21 23:41:44 +08:00
eda9fa64a5 src/test: Remove the whitespace before ';' 2013-05-21 23:41:44 +08:00
8980613491 src/conf: Remove the whitespace before ';' 2013-05-21 23:41:44 +08:00
67a407e08b src/libxl: Remove the whitespace before ';' 2013-05-21 23:41:43 +08:00
5f48ddafbe src/network: Remove the whitespace before ';' 2013-05-21 23:41:43 +08:00
fa9b8b046f Convert Xen domain core dump driver methods to use virDomainDefPtr
Introduce use of a virDomainDefPtr in the domain coredump
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-21 16:11:39 +01:00
89d819f285 Convert Xen domain stats/peek driver methods to use virDomainDefPtr
Introduce use of a virDomainDefPtr in the domain stats &
peek APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-21 16:11:39 +01:00
f6e95ac0d9 Convert Xen domain scheduler driver methods to use virDomainDefPtr
Introduce use of a virDomainDefPtr in the domain scheduler
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-21 16:11:39 +01:00
d305e8691e Convert Xen domain autostart driver methods to use virDomainDefPtr
Introduce use of a virDomainDefPtr in the domain autostart
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-21 16:11:39 +01:00
21213a4b13 Convert Xen domain device hotplug driver methods to use virDomainDefPtr
Introduce use of a virDomainDefPtr in the domain hotplug
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-21 16:11:39 +01:00
95e18efddd Convert Xen domain VCPU driver methods to use virDomainDefPtr
Introduce use of a virDomainDefPtr in the domain VCPU
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-21 16:11:39 +01:00
18b14012e4 Convert Xen domain create/define/getxml/migration APIs to use virDomainDefPtr
Introduce use of a virDomainDefPtr in the domain create, migrate,
getxml, & define APIs to simplify introduction of ACL security
checks. The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-21 16:11:38 +01:00
0a6fc8ab09 Convert Xen domain managed save driver methods to use virDomainDefPtr
Introduce use of a virDomainDefPtr in the domain save
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-21 16:11:38 +01:00
249fbea03d Convert Xen domain property driver methods to use virDomainDefPtr
Introduce use of a virDomainDefPtr in the domain property
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-21 16:11:38 +01:00
f547c520bf Convert Xen domain lifecycle driver methods to use virDomainDefPtr
Introduce use of a virDomainDefPtr in the domain lifecycle
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-21 16:11:38 +01:00
5ed5783bc7 Convert Xen domain lookup driver methods to use virDomainDefPtr
Introduce use of a virDomainDefPtr in the domain lookup
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-21 16:11:38 +01:00
58f8e0cd58 qemu: Don't remove the "return 0"
Commit f60a50c795 intended to remove the warning only, but not with
the "return 0" together.
2013-05-21 23:08:57 +08:00
995bf76d17 shunloadtest: Resolve Coverity CHECKED_RETURN error
The shunloadStart function didn't check the status of virInitialize which
was flagged by Coverity.  Adjust the function and shunloadtest in order
to handle the situation.
2013-05-21 09:22:21 -04:00
01757a46ee xencapstest: Resolve Coverity CHECKED_RETURN error
The return from virInitialize() needs to be checked.
2013-05-21 09:22:21 -04:00
ceae74608c qemu: fix a typo in qemuAddSharedDevice 2013-05-21 18:38:57 +08:00
41c89669b0 docs: formatdomain: fix links in the table of contents 2013-05-21 10:55:42 +02:00
543af79a14 qemuDomainChangeEjectableMedia: Unlock domain while waiting for event
In 84c59ffa I've tried to fix changing ejectable media process. The
process should go like this:

1) we need to call 'eject' on the monitor
2) we should wait for 'DEVICE_TRAY_MOVED' event
3) now we can issue 'change' command

However, while waiting in step 2) the domain monitor was locked. So
even if qemu reported the desired event, the proper callback was not
called immediately. The monitor handling code needs to lock the
monitor in order to read the event. So that's the first lock we must
not hold while waiting. The second one is the domain lock. When
monitor handling code reads an event, the appropriate callback is
called then. The first thing that each callback does is locking the
corresponding domain as a domain or its device is about to change
state. So we need to unlock both monitor and VM lock. Well, holding
any lock while sleep()-ing is not the best thing to do anyway.
2013-05-21 10:42:21 +02:00
f5bf1f3a00 esx: Replace almost all esxVI_String_DeepCopyValue vith VIR_STRDUP 2013-05-21 00:19:37 +02:00
63a2e0b295 vmware: Restore OOM error reporting in vmwareCopyVMXFileName
Got lost in commit e6ab100980.
2013-05-21 00:19:10 +02:00
0e55024e7b maint: enforce correct copyright usage
To ensure we don't regress and cause the need for further
cleanups, add a 'make syntax-check' rule that ensures new
files have proper copyright contents.

* cfg.mk (sc_copyright_address): Rename...
(sc_copyright_usage): ...and enhance.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-20 14:50:12 -06:00
043af8aca4 maint: refer to correct license file
Now that COPYING no longer contains the text of the LGPL,
modify the LGPLv2-only files from vbox to call out the
correct file.

* src/vbox/vbox_CAPI_v2_2.h: Refer to correct file.
* src/vbox/vbox_CAPI_v3_0.h: Likewise.
* src/vbox/vbox_CAPI_v3_1.h: Likewise.
* src/vbox/vbox_CAPI_v3_2.h: Likewise.
* src/vbox/vbox_CAPI_v4_0.h: Likewise.
* src/vbox/vbox_CAPI_v4_1.h: Likewise.
* src/vbox/vbox_V2_2.c: Likewise.
* src/vbox/vbox_V3_0.c: Likewise.
* src/vbox/vbox_V3_1.c: Likewise.
* src/vbox/vbox_XPCOMCGlue.c: Likewise.
* src/vbox/vbox_XPCOMCGlue.h: Likewise.
* src/vbox/vbox_driver.c: Likewise.
* src/vbox/vbox_driver.h: Likewise.
* src/vbox/vbox_tmpl.c: Likewise.
* src/vbox/vbox_V3_2.c: Copy license notice from vbox_V3_1.c.
* src/vbox/vbox_V4_0.c: Likewise.
* src/vbox/vbox_V4_1.c: Likewise.
* src/vbox/README: Mention copyright issues; this particular
file contains no code and therefore does not need LGPL.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-20 14:32:11 -06:00
de483052a2 maint: follow recommended practice for using LGPL
https://www.gnu.org/licenses/gpl-howto.html states:

You should also include a copy of the license itself somewhere in the
distribution of your program. All programs, whether they are released
under the GPL or LGPL, should include the text version of the GPL. In
GNU programs the license is usually in a file called COPYING.

If you are releasing your program under the LGPL, you should also
include the text version of the LGPL, usually in a file called
COPYING.LESSER. Please note that, since the LGPL is a set of
additional permissions on top of the GPL, it's important to include
both licenses so users have all the materials they need to understand
their rights.

* configure.ac (COPYING): No more games with non-git file.
* COPYING: New file, copied from gnulib.
* COPYING.LIB: Rename...
* COPYING.LESSER: ...to this.
* .gitignore: Track licenses in git.
* cfg.mk (exclude_file_name_regexp--sc_copyright_address): Tweak
rule.
* libvirt.spec.in (daemon, client, python): Reflect rename.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-20 14:15:21 -06:00
d7f53c7b97 maint: use LGPL correctly
Several files called out COPYING or COPYING.LIB instead of using
the normal boilerplate.  It's especially important that we don't
call out COPYING from an LGPL file, since COPYING is traditionally
used for the GPL.  A few files were lacking copyright altogether.

* src/rpc/gendispatch.pl: Add missing copyright.
* Makefile.nonreentrant: Likewise.
* src/check-symfile.pl: Likewise.
* src/check-symsorting.pl: Likewise.
* src/driver.h: Likewise.
* src/internal.h: Likewise.
* tools/libvirt-guests.sh.in: Likewise.
* tools/virt-pki-validate.in: Mention copyright in comment, not just code.
* tools/virt-sanlock-cleanup.in: Likewise.
* src/rpc/genprotocol.pl: Spell out license terms.
* src/xen/xend_internal.h: Likewise.
* src/xen/xend_internal.c: Likewise.
* Makefile.am: Likewise.
* daemon/Makefile.am: Likewise.
* docs/Makefile.am: Likewise.
* docs/schemas/Makefile.am: Likewise.
* examples/apparmor/Makefile.am: Likewise.
* examples/domain-events/events-c/Makefile.am: Likewise.
* examples/dominfo/Makefile.am: Likewise.
* examples/domsuspend/Makefile.am: Likewise.
* examples/hellolibvirt/Makefile.am: Likewise.
* examples/openauth/Makefile.am: Likewise.
* examples/python/Makefile.am: Likewise.
* examples/systemtap/Makefile.am: Likewise.
* examples/xml/nwfilter/Makefile.am: Likewise.
* gnulib/lib/Makefile.am: Likewise.
* gnulib/tests/Makefile.am: Likewise.
* include/Makefile.am: Likewise.
* include/libvirt/Makefile.am: Likewise.
* python/Makefile.am: Likewise.
* python/tests/Makefile.am: Likewise.
* src/Makefile.am: Likewise.
* tests/Makefile.am: Likewise.
* tools/Makefile.am: Likewise.
* configure.ac: Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-20 14:03:48 -06:00
7adfda0d6d LXC: move the comments to the proper place
The comments is for virLXCControllerSetupPrivateNS.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
2013-05-20 12:45:02 -06:00
2a3466fafb LXC: fix memory leak in virLXCControllerSetupDevPTS
We forgot to free the mount_options.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
2013-05-20 12:45:02 -06:00
eae1c286a1 LXC: remove unnecessary check on root filesystem
After commit c131525bec
"Auto-add a root <filesystem> element to LXC containers on startup"
for libvirt lxc, root must be existent.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
2013-05-20 12:45:01 -06:00
d8b3130664 openvzDomainSetNetwork: use virCommand
Currently, the openvzDomainSetNetwork function constructs an
array of strings representing a command line for VZCTL binary.
This is a overkill since our virCommand APIs can cover all the
functionality. Moreover, the function is not following our
structure where return value is set to -1 initially, and after
all operations succeeded then it is set to zero.
2013-05-20 18:55:29 +02:00
3a6204cbbd qemu: Add callback struct for qemuBuildCommandLine
Since 0d70656afd, it starts to access the sysfs files to build
the qemu command line (by virSCSIDeviceGetSgName, which is to find
out the scsi generic device name by adpater🚌target:unit), there
is no way to work around, qemu wants to see the scsi generic device
like "/dev/sg6" anyway.

And there might be other places which need to access sysfs files
when building qemu command line in future.

Instead of increasing the arguments of qemuBuildCommandLine, this
introduces a new callback for qemuBuildCommandLine, and thus tests
can register their own callbacks for sysfs test input files accessing.

* src/qemu/qemu_command.h: (New callback struct
                            qemuBuildCommandLineCallbacks;
                            extern buildCommandLineCallbacks)
* src/qemu/qemu_command.c: (wire up the callback struct)
* src/qemu/qemu_driver.c: (Use the new syntax of qemuBuildCommandLine)
* src/qemu/qemu_hotplug.c: Likewise
* src/qemu/qemu_process.c: Likewise
* tests/testutilsqemu.[ch]: (Helper testSCSIDeviceGetSgName;
                             callback struct testCallbacks;)
* tests/qemuxml2argvtest.c: (Use testCallbacks)
* src/tests/qemuxmlnstest.c: (Like above)
2013-05-20 20:14:19 +08:00
8b7b43a1d4 storage_conf: Improve the coding style in storage_conf.h
Changes:
  * Remove useless comments
  * Remove useless blank lines
  * If the struct member is a enum type, comment it like
    /* enum fooBar */
  * Break the long lines
  * Prefer the common function style for the inline function
2013-05-20 20:01:23 +08:00
76359ee505 storage_conf: Fix indentions in storage_conf.c
Uses the 4 spaces for indention.
2013-05-20 20:00:19 +08:00
c8a3cf89f3 storage_conf: Fix the coding stype in storage_conf.c
Changes:
  * Remove the useless space in "for" statement (e.g.
    for (i = 0 ; i < something ; i++)

  * Change the function's style to:
    void
    foo(bar)
    {
        printf("foo is not bar\n");
    }

  * Don't lose "{}" for "if...else" branches if one of the branch
    has more than one line block. Example of the old ones:
    if (a) {
        printf("a is not funny");
    } else
        printf("a is funny");

  * Remove the 1 space before "goto" label.

  * Remove the useless blank line(s)

  * Add blank line if it can make the code more clear to eyes.
2013-05-20 19:59:18 +08:00
479d5991cd qemu: Abstract code for cpuset controller setting into a helper 2013-05-20 19:57:00 +08:00
9f2455d359 qemu: Abstract code for devices controller setting into a helper 2013-05-20 19:52:35 +08:00
f60a50c795 qemu: Abstract code for memory controller setting into a helper 2013-05-20 19:39:54 +08:00
2fd16df7b5 qemu: Abstract the code for blkio controller setting into a helper 2013-05-20 19:24:45 +08:00
9bf5246f97 esx: Fix error reporting in esxVI_LookupManagedObjectHelper
As the name parameter can be NULL the error message can only contain it
conditionally.
2013-05-17 20:14:27 +02:00
ec04914c47 Add missing c-ctype.h to virfile.c
The virfile.c file uses c_isalpha on Win32 platforms, so must
include c-ctype.h

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-17 17:09:29 +01:00
6ab6bc19f0 Add libvirt-daemon-vbox & libvirt-daemon-driver-vbox RPMs
Now the VirtualBox driver is a loadable module, it needs
to live in its own sub-RPM

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-17 17:09:29 +01:00
34d63dd750 Include GNULIB mkdtemp module
The mkdtemp function is missing on mingw platforms. It is
used in various Linux specific places in libvirt, but
recently became used in fdstreamtest.c which is cross
platform. Thus the GNULIB mkdtemp module should be used
to provide mkdtemp.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-17 17:09:29 +01:00
3e5752747c Set PKG_CONFIG_LIBDIR in autobuild.sh
If PKG_CONFIG_LIBDIR is not set when doing mingw32/64 builds,
then pkg-config may silently fallback to native versions of
libraries, with predictably bad results. Setting PKG_CONFIG_LIBDIR
forces it to only consider the mingw32/64 libraries.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-17 17:09:29 +01:00
0d09854c10 docs: add another user
Described here:
https://www.redhat.com/archives/libvir-list/2013-May/msg01329.html

* docs/apps.html.in: Mention Cracow Cloud One.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-17 09:18:14 -06:00
6459af6a43 qemu: report useful error failling to destroy domain gracefully
Resolves:https://bugzilla.redhat.com/show_bug.cgi?id=927620

 #kill -STOP `pidof qemu-kvm`
 #virsh destroy $guest --graceful
 error: Failed to destroy domain testVM
 error: An error occurred, but the cause is unknown

With --graceful, SIGTERM always is emitted to kill driver
process, but it won't success till burning out waiting time
in case of process being stopped.
But domain destroy without --graceful can work, SIGKILL will
be emitted to the stopped process after 10 secs which always
kills a process even one that is currently stopped.
So report an error after burning out waiting time in this case.
2013-05-17 22:22:46 +08:00
6aa4fc656d qemu: Check conflicts for shared scsi host device
Just like previous patches, this changes qemuCheckSharedDisk
into qemuCheckSharedDevice, which takes a virDomainDeviceDefPtr
argument instead.
2013-05-17 19:26:33 +08:00
4fb50623a7 test: fix VPATH fchosttest failure
Running make check in a VPATH configured build directory fails
in fchosttest as the test data files are searched for relative to
the current working directory.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2013-05-17 12:09:52 +02:00
63ea1e5432 Re-add selinux/selinux.h to lxc_container.c
Re-add the selinux header to lxc_container.c since other
functions now use it, beyond the patch that was just
reverted.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-17 10:59:25 +01:00
c2cf5f1c2a Fix failure to detect missing cgroup partitions
Change bbe97ae968 caused the
QEMU driver to ignore ENOENT errors from cgroups, in order
to cope with missing /proc/cgroups. This is not good though
because many other things can cause ENOENT and should not
be ignored. The callers expect to see ENXIO when cgroups
are not present, so adjust the code to report that errno
when /proc/cgroups is missing

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-17 10:25:15 +01:00
7bebd88871 Revert "Change label of fusefs mounted at /proc/meminfo in lxc containers"
This reverts commit 940c6f1085.
2013-05-17 10:22:54 +01:00
a2619bb1ff libxl: fix leaking libxl events
libxl expects the event handler to free the event passed to it.  From
libxl_event.h:

   event becomes owned by the application and must be freed, either
   by event_occurs or later
2013-05-17 02:35:56 -06:00
43b0ff5b1e libxl: fix build with Xen4.3
Xen 4.3 fixes a mistake in the libxl event handler signature where the
event owned by the application was defined as const.  Detect this and
define the libvirt libxl event handler signature appropriately.
2013-05-17 02:31:14 -06:00
25b98d31ec schema: make source optional in volume XML
We don't parse it anyway.

https://bugzilla.redhat.com/show_bug.cgi?id=893273
2013-05-17 08:35:08 +02:00
a07b88ee03 schema: require target path in storage pool xml
Make target path mandatory for pool types that require target,
since we refuse to parse a target without a path.

https://bugzilla.redhat.com/show_bug.cgi?id=893273
2013-05-17 08:33:22 +02:00
9049d6a8c7 qemu: Change values of disk discard
QEMU might support more values for "-drive discard", so using Bi-state
values (on/off) for it doesn't make sense.

"on" maps to "unmap", "off" maps to "ignore":

<...>
@var{discard} is one of "ignore" (or "off") or "unmap" (or "on") and
controls whether @dfn{discard} (also known as @dfn{trim} or @dfn{unmap})
requests are ignored or passed to the filesystem.  Some machine types
may not support discard requests.
</...>
2013-05-17 13:03:25 +08:00
fd74f74fe6 qemu: Implement support for locking domain's memory pages 2013-05-16 23:21:58 +02:00
555866389c Add support for locking domain's memory pages
The following XML configuration can be used to request all domain's
memory pages to be kept locked in host's memory (i.e., domain's memory
pages will not be swapped out):

      <memoryBacking>
        <locked/>
      </memoryBacking>
2013-05-16 23:03:08 +02:00
4734f1f53b Fix build with VirtualBox
Commit ba5f3c7c moved vbox driver into libvirtd but forgot to adapt
daemon's Makefile.am.
2013-05-16 23:01:43 +02:00
0471637d56 qemu: Fix cgroup handling when setting VCPU BW
Commit 632f78c introduced a regression which causes schedinfo being
unable to set some parameters.  When migrating to priv->cgroup there
was missing variable left out and due to passed NULL to underlying
function, the setting failed.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=963592
2013-05-16 22:13:29 +02:00
a842df78ea qemu: Set unpriv_sgio for scsi host device 2013-05-17 01:00:01 +08:00
0453bcdfc3 qemu: Refactor qemuSetUnprivSGIO to support scsi host device
Just like what previous patches do, it refactors qemuSetUnprivSGIO
to take the virDomainDeviceDefPtr as argument instead.
2013-05-17 00:57:01 +08:00
99fdd434bc qemu: Move qemuSetUnprivSGIO into qemu_conf.c
unpriv_sgio setting is tight with the shared device helpers, let's
put them together in qemu_conf.c
2013-05-17 00:51:58 +08:00
6765316093 conf: Introduce sgio for hostdev
"sgio" is only valid for scsi host device.
2013-05-17 00:46:44 +08:00
ead4391562 Rename virDomainDiskSGIO to virDomainDeviceSGIO
SCSI host device will also support "sgio", and perhaps we could
use "sgio" in other places too in future, renaming the enum to
reuse.
2013-05-17 00:43:38 +08:00
1d94b3e760 qemu: Manage shared device entry for scsi host device
This adds the shared device entry when starting domain (more
exactly, when preparing host devices), and remove the entry
when destroying domain (when reattaching host devices).
2013-05-17 00:34:29 +08:00
aeda1ff12d qemu: Refactor the helpers to track shared scsi host device
This changes the helpers qemu{Add,Remove}SharedDisk into
qemu{Add,Remove}SharedDevice, as most of the code in the helpers
can be reused for scsi host device.

To track the shared scsi host device, first it finds out the
device path (e.g. /dev/s[dr]*) which is mapped to the sg device,
and use device ID of the found device path (/dev/s[dr]*) as the
hash key. This is because of the device ID is not unique between
between /dev/s[dr]* and /dev/sg*, e.g.

% sg_map
/dev/sg0  /dev/sda
/dev/sg1  /dev/sr0

% ls -l /dev/sda
brw-rw----. 1 root disk 8, 0 May  2 19:26 /dev/sda

%ls -l /dev/sg0
crw-rw----. 1 root disk 21, 0 May  2 19:26 /dev/sg0
2013-05-17 00:32:09 +08:00
28d3ad952f utils: Add a helper to get the device name that sg device mapped to
E.g.

% sg_map
/dev/sg0  /dev/sda
/dev/sg1  /dev/sr0

What the helper gets for /dev/sg0 is /dev/sda, it will be used by
later patch.
2013-05-16 23:50:00 +08:00
539d0e19fd qemu: Rename qemu_driver->sharedDisks to qemu_driver->sharedDevices
"Shared disk" is not only the thing we should care about after "scsi
hostdev" is introduced. A same scsi device can be used as "disk" for
one domain, and as "scsi hostdev" for another domain at the same time.
That's why this patch renames qemu_driver->sharedDisks. Related functions
and structs are also renamed.
2013-05-16 23:48:27 +08:00
f2c1d9a804 conf: Introduce <shareable> for hostdev
Unlike disk device, the scsi-generic always writethrough the data,
so no need to introduce a "cache" tag, and set "cache=off".
2013-05-16 23:41:25 +08:00
95c6cc344b Don't mount selinux fs in LXC if selinux is disabled
Before trying to mount the selinux filesystem in a container
use is_selinux_enabled() to check if the machine actually
has selinux support (eg not booted with selinux=0)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-16 16:28:53 +01:00
ba5f3c7c8e Move VirtualBox driver into libvirtd
Change the build process & driver initialization so that the
VirtualBox driver is built into libvirtd, instead of libvirt.so
This change avoids the VirtualBox GPLv2-only license causing
compatibility problems with libvirt.so which is under the
GPLv2-or-later license.

NB this change prevents use of the VirtualBox driver on the
Windows platform, until such time as libvirtd can be made
to work there.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-16 16:28:53 +01:00
d7d7581b03 Fix LXC startup when /var/run is an absolute symlink
During startup, the LXC driver uses paths such as

  /.oldroot/var/run/libvirt/lxc/...

to access directories from the previous root filesystem
after doing a pivot_root(). Unfortunately if /var/run
is an absolute symlink to /run, instead of a relative
symlink to ../run, these paths break.

At least one Linux distro is known to use an absolute
symlink for /var/run, so workaround this, by resolving
all symlinks before doing the pivot_root().

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-16 16:28:53 +01:00
e3b40bec42 conf: Fix the bug of disk->copy_on_read formating
The reason for it's not exposed for such long time is that the
enums for VirtioEventIdx and CopyOnReadType have same enum values
and Correspondingstrings. This fixes the bug and adds test.
2013-05-16 23:07:51 +08:00
d3842cb4e4 datatypes: fix virGetStoragePool's comment 2013-05-16 16:26:21 +02:00
ca697e90d5 daemon: fix leak after listing all volumes
CVE-2013-1962

remoteDispatchStoragePoolListAllVolumes wasn't freeing the pool.
The pool also held a reference to the connection, preventing it from
getting freed and closing the netcf interface driver, which held two
sockets open.
2013-05-16 15:59:37 +02:00
9684bb11fd qemu: Fix crash in migration of graphics-less guests.
Commit 7f15ebc7a2 introduced a bug
happening when guests without a <graphics> element are migrated.
The initialization of listenAddress happens unconditionally
from the cookie even if the cookie->graphics pointer was NULL.
Moved the initialization to where it is safe.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2013-05-16 15:48:34 +02:00
e13e548fc2 build: Fix check-driverimpls in VPATH
DRIVER_SOURCE_FILES mixes files with absolute path (inherited from
REMOTE_DRIVER_GENERATED) with file paths that are relative to srcdir but
check-driverimpls.pl needs full paths.
2013-05-16 15:45:43 +02:00
c431f06587 util: Fix build without devmapper
stdlib.h header file needed for getenv was only transitively included
through libdevmapper.h.
2013-05-16 12:15:38 +02:00
41beacd925 Expand documentation for LXC driver
Update the LXC driver documentation to describe the way
containers are setup by default. Also describe the common
virsh commands for managing containers and a little about
the security. Placeholders for docs about configuring
containers still to be filled in.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-16 10:11:14 +01:00
a3f600f908 conf: Improve the coding style
Add spaces around "<<", and remove the useless blank-line.
2013-05-16 11:11:17 +08:00
504b4a8dae string: test VIR_STRDUP
The surest way to avoid regressions is to test documented behavior :)

* tests/virstringtest.c (testStrdup): New test case.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-15 19:28:00 -06:00
36c0a791e6 virsh: lookup interface by name or mac other than one by one
Use virMacAddrParse() to distinguish interface name from interface
mac address.
2013-05-16 09:12:44 +08:00
a6a04ea47a nwfilter: check for inverted ctdir
Linux netfilter at some point (Linux 2.6.39) inverted the meaning of the
'--ctdir reply' and newer netfilter implementations now expect
'--ctdir original' instead and vice-versa.
We check for the kernel version and assume that all Linux kernels with version
2.6.39 have the newer inverted logic.

Any distro backporting the Linux kernel patch that inverts the --ctdir logic
(Linux commit 96120d86f) must also backport this patch for Linux and
adapt the kernel version being tested for.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2013-05-15 21:02:11 -04:00
cc7cd6232e FreeBSD: disable buggy -fstack-protector-all
FreeBSD ships an old gcc 4.2.1 which generates
bogus code, e.g. getsockopt() call returns
struct xucred with bogus values, which doesn't even
allow to connect to libvirtd:

error: Failed to find group record for gid '1284660778': No error: 0

So roll back to just -fstack-protector on FreeBSD.
2013-05-15 15:20:52 -06:00
a2c37618d3 Adjust improperly formatted <sysinfo> uuid
If the <sysinfo> system table 'uuid' field is improperly formatted,
then qemu will fail to start the guest with the error:

virsh start dom
error: Failed to start domain dom
error: internal error process exited while connecting to monitor: Invalid SMBIOS UUID string

This was because the parsing rules were lax with respect to allowing extraneous
spaces and dashes in the provided UUID.  As long as there were 32 hexavalues
that matched the UUID for the domain the string was accepted. However startup
failed because the string format wasn't correct. This patch will adjust the
string format so that when it's presented to the driver it's in the expected
format.

Added a test for uuid comparison within sysinfo.
2013-05-15 12:05:22 -04:00
21540f5ee3 Validate the bios_date format for <sysinfo>
Add incorrectly formatted bios_date validation test
2013-05-15 12:05:22 -04:00
14b3cac5bc docs: Fix/update syntax in Sysinfo/SMBIOS description 2013-05-15 12:05:22 -04:00
940c6f1085 Change label of fusefs mounted at /proc/meminfo in lxc containers
We do not want to allow contained applications to be able to read fusefs_t.
So we want /proc/meminfo label to match the system default proc_t.

Fix checking of error codes
2013-05-15 17:39:22 +02:00
7bb7510de7 Remove obsolete skipRoot flag in LXC driver
The lxcContainerMountAllFS method had a 'bool skipRoot'
flag to control whether it mounts the / filesystem. Since
removal of the non-pivot root container setup codepaths,
this flag is obsolete as the only caller always passes
'true'.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-15 17:29:35 +02:00
31453a837b Stop passing around old root directory prefix
Many methods accept a string parameter specifying the
old root directory prefix. Since removal of the non-pivot
root container setup codepaths, this parameter is obsolete
in many methods where the callers always pass "/.oldroot".

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-15 17:29:35 +02:00
37cebfec92 Remove obsolete pivotRoot flag in LXC driver
The lxcContainerMountBasicFS method had a 'bool pivotRoot'
flag to control whether it mounted a private /dev. Since
removal of the non-pivot root container setup codepaths,
this flag is obsolete as the only caller always passes
'true'.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-15 17:29:35 +02:00
9a8f39d097 storage: Ensure 'qemu-img resize' size arg is a 512 multiple
qemu-img resize will fail with "The new size must be a multiple of 512"
if libvirt doesn't round it first.
This fixes rhbz#951495

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2013-05-15 13:45:51 +02:00
a7c4202cdd qemu: Support discard for disk
QEMU introduced "discard" option for drive since commit a9384aff53,

<...>
@var{discard} is one of "ignore" (or "off") or "unmap" (or "on") and
controls whether @dfn{discard} (also known as @dfn{trim} or @dfn{unmap})
requests are ignored or passed to the filesystem.  Some machine types
may not support discard requests.
</...>

This patch exposes the support in libvirt.

QEMU supported "discard" for "-drive" since v1.5.0-rc0:

% git tag --contains a9384aff53
contains
v1.5.0-rc0
v1.5.0-rc1

So this only detects the capability bit using virQEMUCapsProbeQMPCommandLine.
2013-05-15 19:01:00 +08:00
f60bd7c7a7 docs: Update formatdomain for lifecycle events 2013-05-15 06:27:17 -04:00
efdcc92faa Handle the domain event 'on_reboot' and 'on_poweroff' settings 2013-05-15 06:25:41 -04:00
f612664baa Adjust comments to describe on_poweroff and on_reboot action 2013-05-15 06:25:36 -04:00
0e034efaf9 Adjust usage of qemu -no-reboot and -no-shutdown options
During building of the qemu command line determine whether to add/use the
'-no-reboot' option only if each of the 'on' events want to to destroy
the domain; otherwise, use the '-no-shutdown' option.

Prior to this change both could be on the command line, which while allowed
could be construed as a conflict.
2013-05-15 06:19:32 -04:00
85ec7ff6fd qemu: Add VNC WebSocket support
Adding a VNC WebSocket support for QEMU driver.  This functionality is
in upstream qemu from commit described as v1.3.0-982-g7536ee4, so the
capability is being recognized based on QEMU version for now.
2013-05-15 09:48:05 +02:00
f1ad8d2079 Add VNC WebSocket support
Adding support for new attribute 'websocket' in the '<graphics>'
element, the attribute value is the port to listen on with '-1'
meaning auto-allocation, '0' meaning no websockets.
2013-05-15 09:38:56 +02:00
5606c7a867 tests: Sort the EXTRA_DIST list
Commit 1cc8259bfe fixes the build failure, but forgot to keep the
list alphanumeric sorted.
2013-05-15 11:34:27 +08:00
77b54b9661 qemu: New XML to disable memory merge at guest startup
QEMU introduced command line "-mem-merge=on|off" (defaults to on) to
enable/disable the memory merge (KSM) at guest startup. This exposes
it by new XML:
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>

The XML tag is same with what we used internally for old RHEL.
2013-05-15 11:25:45 +08:00
d12bbd6a7d qemu: detect -machine mem-merge capability
* src/qemu/qemu_capabilities.h: New capability bit.
* src/qemu/qemu_capabilities.c (virQEMUCapsProbeQMPCommandLine): New
function, based on qemuMonitorGetCommandLineOptionParameters, which was
introduced by commit bd56d0d813; use it to set new capability bit.
(virQEMUCapsInitQMP): Use new function.
2013-05-15 11:25:42 +08:00
9615ca59c6 spec: fix outdated comment
https://bugzilla.redhat.com/show_bug.cgi?id=963016 points out that
we don't use initscripts by default on Fedora any more.

* libvirt.spec.in (Requires): Better explanation of gettext.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-14 21:07:40 -06:00
8639bc5db4 Rename rbd-invalid.xml to rbd-no-colon.xml
Files ending in -invalid.xml are expected to violate the
XML schema check. The RBD file does not so must have a
different filename.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-14 20:09:48 +01:00
1cc8259bfe tests: Add fchostdata in EXTRA_DIST
Pushed under build-breaker rule.
2013-05-15 01:18:26 +08:00
b77737372d virsh: Pretty the output of qemu-agent-command
This adds a new option "--pretty" for qemu-agent-command, to
pretty-format the returned JSON string.
2013-05-15 01:02:25 +08:00
8b9eb14a6d virsh: Use vshPrint instead of printf 2013-05-15 01:02:18 +08:00
84d9142495 Fix invalid argument reference in virnetdev.h
Commit ccff335f added ATTRIBUTE_NONNULL for an attribute which is not
a pointer and made files including virnetdev.h not compilable, so fix
that.
2013-05-14 18:27:51 +02:00
2a2bc1517a Forbid use of ':' in RBD pool names
The QEMU command line syntax for RBD disks is

   file=rbd:pool/image:opt1=val1:opt2=val2...

There is no way to escape the ':' if it appears in the
pool or image name. Thus it must be explicitly forbidden
if it occurs in the libvirt XML. People are known to
be abusing the lack of escaping in current libvirt to
pass arbitrary args to QEMU.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-14 15:02:42 +01:00
71b54636f0 Don't duplicate compiler warning flags when linking
Automake already passes all CFLAGS to the linker too, so it
is not necessary to set WARN_LDFLAGS in addition to the
WARN_CFLAGS variable.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-14 15:02:37 +01:00
421846e4a3 Only pass -export-dynamic to linker, not compiler
Clang does not like the -export-dynamic flag. The compiler does
not need it in the first place, so we can avoid the problem by
only setting it for the linker

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-14 15:00:22 +01:00
c163410044 Correctly detect warning flags with clang
Clang will happily claim to support any warning flags
unless the -Werror and -Wunknown-warning-option flags
are set. Thus we need to make sure these are set when
testing for clags.

We must also set the clang specific warning flags
-Wno-unused-command-line-argument to avoid a warning
from the ssp-buffer-size flag when linking .o files.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-14 15:00:22 +01:00
7d73b11427 Ignore cast alignment warnings in inotify code for Xen.
The inotify Xen code causes a cast alignment warning, but this
is harmless since the kernel inotify interface will ensure
sufficient alignment of the inotify structs in the buffer being
read

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-14 15:00:22 +01:00
78cff68ca3 Workaround issue with clang and inline functions with static vars
Clang does not like it when you pass a static variable to an
inline function

 vircgroupmock.c:462:22: error: static variable 'fakesysfsdir' is
  used in an inline function with external linkage [-Werror,-Wstatic-in-inline]

Just make the var non-static to avoid this

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-14 15:00:22 +01:00
c43b685a1d Ensure consistent enablement of gcc 'diagnostic' pragma
The virt-compile-warnings.m4 file would do an explicit
check for whether the compile could use the 'diagnostic'
pragma push/pop feature. The src/internal.h file would
then only enable it for GCC >= 4.6

This breaks with clang which supports the pragma but
does not claim GCC 4.6 compat. Export a variable from
the m4 check to the header file so they are consistent.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-14 15:00:22 +01:00
5fd6ae3f2e docs: Fix the wrong links in secret documentation
docs/formatsecret.html.in: (s/domain\.html/formatdomain\.html/g)
2013-05-14 21:49:36 +08:00
3f85bfdf9e docs: Add the missed usage type 'iscsi'
Pushed under trivial rule.
2013-05-14 21:42:51 +08:00
0b923ba3c8 qemu: fix bad free
Commit bd56d0d8 could lead to freeing an uninitialized pointer:

qemu/qemu_monitor_json.c: In function 'qemuMonitorJSONGetCommandLineOptionParameters':
qemu/qemu_monitor_json.c:4284: warning: 'cmd' may be used uninitialized in this function

* src/qemu/qemu_monitor_json.c
(qemuMonitorJSONGetCommandLineOptionParameters): Initialize variable.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-13 16:48:55 -06:00
bf87b99d72 build: avoid gcrypt deprecation warnings
When combining old gcc (4.2.1) and new gcrypt (1.5.2), such as
when using the Ports repository on FreeBSD, the build fails with:

  CC       libvirt_driver_la-libvirt.lo
cc1: warnings being treated as errors
In file included from libvirt.c:58:
/usr/local/include/gcrypt.h:1336: warning: 'gcry_ac_io_mode_t' is deprecated [-Wdeprecated-declarations]

Relevant part of gcrypt.h:
1333 typedef struct gcry_ac_io
1334 {
1335   /* This is an INTERNAL structure, do NOT use manually.  */
1336   gcry_ac_io_mode_t mode _GCRY_ATTR_INTERNAL;
1337   gcry_ac_io_type_t type _GCRY_ATTR_INTERNAL;
1338   union

The sad part is that we aren't even using the deprecated symbols - their
mere inclusion in the installed header is provoking the problems.  It
looks like newer gcc is a bit more tolerant (that is, this is a
shortcoming of FreeBSD's use of an older compiler).

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-13 16:07:26 -06:00
bd56d0d813 qemu: query command line options in QMP
Ever since the conversion to using only QMP for probing features
of qemu 1.2 and newer, we have been unable to detect features
that are added only by additional command line options.  For
example, we'd like to know if '-machine mem-merge=on' (added
in qemu 1.5) is present.  To do this, we will take advantage
of qemu 1.5's query-command-line-parameters QMP call [1].

This patch wires up the framework for probing the command results;
if the QMP command is missing, or if a particular command line
option does not output any parameters (for example, -net uses
a polymorphic parser, which showed up as no parameters as of qemu
1.5), we silently treat that command as having no results.

[1] https://lists.gnu.org/archive/html/qemu-devel/2013-04/msg05180.html

* src/qemu/qemu_monitor.h (qemuMonitorGetOptions)
(qemuMonitorSetOptions)
(qemuMonitorGetCommandLineOptionParameters): New functions.
* src/qemu/qemu_monitor_json.h
(qemuMonitorJSONGetCommandLineOptionParameters): Likewise.
* src/qemu/qemu_monitor.c (_qemuMonitor): Add cache field.
(qemuMonitorDispose): Clean it.
(qemuMonitorGetCommandLineOptionParameters): Implement new function.
* src/qemu/qemu_monitor_json.c
(qemuMonitorJSONGetCommandLineOptionParameters): Likewise.
(testQemuMonitorJSONGetCommandLineParameters): Test it.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-13 15:15:54 -06:00
082274ea41 qemu: simplify string cleanup
No need to open code a string list cleanup, if we are nice
to the caller by guaranteeing a NULL-terminated result.

* src/qemu/qemu_monitor_json.c (qemuMonitorJSONGetCPUDefinitions)
(qemuMonitorJSONGetCommands, qemuMonitorJSONGetEvents)
(qemuMonitorJSONGetObjectTypes, qemuMonitorJSONGetObjectProps):
Use simpler cleanup.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-13 15:15:54 -06:00
764bb5e5aa qemu: use bool in monitor struct
Follows on the heels of other bool cleanups, such as commit 93002b98.

* src/qemu/qemu_monitor.h (qemuMonitorOpen, qemuMonitorOpenFD):
Update json parameter type.
* src/qemu/qemu_monitor.c (qemuMonitorOpen, qemuMonitorOpenFD):
Likewise.
(_qemuMonitor): Adjust field type.
* src/qemu/qemu_domain.h (_qemuDomainObjPrivate): Likewise.
* src/qemu/qemu_domain.c (qemuDomainObjPrivateXMLParse): Adjust
client.
* src/qemu/qemu_process.c (qemuProcessStart): Likewise.
* tests/qemumonitortestutils.c (qemuMonitorTestNew): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-13 15:15:54 -06:00
547a7c778a json: support removing a value from an object
In an upcoming patch, I need the way to safely transfer a nested
virJSON object out of its parent container for independent use,
even after the parent is freed.

* src/util/virjson.h (virJSONValueObjectRemoveKey): New function.
(_virJSONObject, _virJSONArray): Use correct type.
* src/util/virjson.c (virJSONValueObjectRemoveKey): Implement it.
* src/libvirt_private.syms (virjson.h): Export it.
* tests/jsontest.c (mymain): Test it.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-13 15:15:54 -06:00
ccff335f83 Support for static routes on a virtual bridge
network: static route support for <network>

This patch adds the <route> subelement of <network> to define a static
route.  the address and prefix (or netmask) attribute identify the
destination network, and the gateway attribute specifies the next hop
address (which must be directly reachable from the containing
<network>) which is to receive the packets destined for
"address/(prefix|netmask)".

These attributes are translated into an "ip route add" command that is
executed when the network is started. The command used is of the
following form:

  ip route add <address>/<prefix> via <gateway> \
               dev <virbr-bridge> proto static metric <metric>

Tests are done to validate that the input data are correct.  For
example, for a static route ip definition, the address must be a
network address and not a host address.  Additional checks are added
to ensure that the specified gateway is directly reachable via this
network (i.e. that the gateway IP address is in the same subnet as one
of the IP's defined for the network).

prefix='0' is supported for both family='ipv4' address='0.0.0.0'
netmask='0.0.0.0' or prefix='0', and for family='ipv6' address='::',
prefix=0', although care should be taken to not override a desired
system default route.

Anytime an attempt is made to define a static route which *exactly*
duplicates an existing static route (for example, address=::,
prefix=0, metric=1), the following error message will be sent to
syslog:

    RTNETLINK answers: File exists

This can be overridden by decreasing the metric value for the route
that should be preferred, or increasing the metric for the route that
shouldn't be preferred (and is thus in place only in anticipation that
the preferred route may be removed in the future).  Caution should be
used when manipulating route metrics, especially for a default route.

Note: The use of the command-line interface should be replaced by
direct use of libnl so that error conditions can be handled better.  But,
that is being left as an exercise for another day.

Signed-off-by: Gene Czarcinski <gene@czarc.net>
Signed-off-by: Laine Stump <laine@laine.org>
2013-05-13 16:14:40 -04:00
84f3777a79 build: avoid shadowed variable in fdstreamtest
On RHEL 6.4 (gcc 4.4.7), I got:

fdstreamtest.c: In function 'testFDStreamReadCommon':
fdstreamtest.c:44: error: declaration of 'tmpfile' shadows a global declaration [-Wshadow]

* tests/fdstreamtest.c (testFDStreamReadCommon)
(testFDStreamWriteCommon): Rename 'tmpfile' variable.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-13 13:38:18 -06:00
3407e3b3a2 Don't overwrite useful message when creating macvlan fails
Currently we report a bogus error message when macvlan
creation fails:

error: Failed to start domain migtest
error: operation failed: Unable to create macvlan device

With this removed, we see the real error:

error: Failed to start domain migtest
error: Unable to get index for interface p31p1: No such device

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-13 17:32:55 +01:00
8845d8dfa3 Remove & ban use of select() for waiting for I/O
Use of the select() system call is inherantly dangerous since
applications will hit a buffer overrun if any FD number exceeds
the size of the select set size (typically 1024). Replace the
two uses of select() with poll() and use cfg.mk to ban any
future use of select().

NB: This changes the phyp driver so that it uses an infinite
timeout, instead of busy-waiting for 1ms at a time.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-13 17:32:43 +01:00
8f76ad9992 qemu: Add hotplug support for scsi host device
This adds both attachment and detachment support for scsi host
device.

Signed-off-by: Han Cheng <hanc.fnst@cn.fujitsu.com>
Signed-off-by: Osier Yang <jyang@redhat>
2013-05-14 00:12:42 +08:00
bbe97ae968 Fix starting domains when kernel has no cgroups support
Found that I was unable to start existing domains after updating
to a kernel with no cgroups support

  # zgrep CGROUP /proc/config.gz
  # CONFIG_CGROUPS is not set
  # virsh start test
  error: Failed to start domain test
  error: Unable to initialize /machine cgroup: Cannot allocate memory

virCgroupPartitionNeedsEscaping() correctly returns errno (ENOENT) when
attempting to open /proc/cgroups on such a system, but it was being
dropped in virCgroupSetPartitionSuffix().

Change virCgroupSetPartitionSuffix() to propagate errors returned by
its callees.  Also check for ENOENT in qemuInitCgroup() when determining
if cgroups support is available.
2013-05-13 09:27:46 -06:00
a011479d47 .gitignore: add fchosttest 2013-05-13 17:16:54 +02:00
7d763acaf2 qemu: Refactor helpers for USB device attachment
It's better to put the usb related codes into qemuDomainAttachHostUsbDevice
instead of qemuDomainAttachHostDevice.

And in the old qemuDomainAttachHostDevice, just stealing the "usb" from
driver->activeUsbHostdevs leaks the memory.
2013-05-13 21:51:55 +08:00
0ced83dcfb Escaping leading '.' in cgroup names
Escaping a leading '.' with '_' in the cgroup names

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-13 14:28:46 +01:00
ea74c07636 qemu: Introduce activeScsiHostdevs list for scsi host devices
Although virtio-scsi supports SCSI PR (Persistent Reservations),
the device on host may do not support it. To avoid losing data,
Just like PCI and USB pass through devices, only one live guest
is allowed per SCSI host pass through device."

Signed-off-by: Han Cheng <hanc.fnst@cn.fujitsu.com>
2013-05-13 21:26:06 +08:00
31532cabe8 Adapt to VIR_STRDUP and VIR_STRNDUP in src/vbox/* 2013-05-13 14:50:03 +02:00
6b5f12c805 Support NBD backed disks/filesystems in LXC driver
The LXC driver can already configure <disk> or <filesystem>
devices to use the loop device. This extends it to also allow
for use of the NBD device, to support non-raw formats.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-13 13:15:19 +01:00
13579d4544 Add 'nbd' as a valid filesystem driver type
The <filesystem> element can now accept a <driver type='nbd'/>
as an alternative to 'loop'. The benefit of NBD is support
for non-raw disk image formats.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-13 13:15:19 +01:00
8aabd597b3 Add a helper API for setting up a NBD device with qemu-nbd
Add a virFileNBDDeviceAssociate method, which given a filename
will setup a NBD device, using qemu-nbd as the server.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-13 13:15:19 +01:00
1eeff53d7d Fix error handling of readdir() in virFileLoopDeviceOpen
To correctly handle errors from readdir() you must set 'errno'
to zero before invoking it & check its value afterwards to
distinguish error from EOF.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-13 13:15:19 +01:00
c8fa7e8c55 Re-arrange code setting up ifs/disk loop devices for LXC
The current code for setting up loop devices to LXC disks first
does a switch() based on the disk format, then looks at the
disk driver name. Reverse this so it first looks at the driver
name, and then the disk format. This is more useful since the
list of supported disk formats depends on what driver is used.

The code for setting loop devices for LXC fs entries also needs
to have the same logic added, now the XML schema supports this.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-13 13:15:19 +01:00
ada14b86cc Add support for storage format in FS <driver>
Extend the <driver> element in filesystem devices to
allow a storage format to be set. The new attribute
uses 'format' to reflect the storage format. This is
different from the <driver> element in disk devices
which use 'type' to reflect the storage format. This
is because the 'type' attribute on filesystem devices
is already used for the driver backend, for which the
disk devices use the 'name' attribute. Arggggh.

Anyway for disks we have

   <driver name="qemu" type="raw"/>

And for filesystems this change means we now have

   <driver type="loop" format="raw"/>

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-13 13:15:19 +01:00
23fbda20a7 security_apparmor.c: Include virscsi.h
After introducing AppArmorSetSecuritySCSILabel() in 2691cd5f
we are using virSCSIDevicePtr type without proper include.
2013-05-13 14:01:14 +02:00
2691cd5fe8 security: Manage the security label for scsi host device
To not introduce more redundant code, helpers are added for
both "selinux", "dac", and "apparmor" backends.

Signed-off-by: Han Cheng <hanc.fnst@cn.fujitsu.com>
Signed-off-by: Osier Yang <jyang@redhat>

v2.5 - v3:
  * Splitted from 8/10 of v2.5
  * Don't forget the other backends (DAC, and apparmor)
2013-05-13 19:08:40 +08:00
6eb42e38e8 qemu: Allow the scsi-generic device in cgroup
This adds the scsi-generic device into the device controller's
whitelist, so that it's allowed to used by the qemu process.

Signed-off-by: Han Cheng <hanc.fnst@cn.fujitsu.com>
Signed-off-by: Osier Yang <jyang@redhat.com>
2013-05-13 19:08:34 +08:00
bab6ee6b30 qemu: Support bootindex for scsi host device 2013-05-13 19:08:32 +08:00
486a86eb18 Add docs about cgroups layout and usage
Describe the new cgroups layout, how to customize placement
of guests and what virsh commands are used to access the
parameters.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-13 12:04:42 +01:00
f4bb7b4807 Introduce <readonly> for hostdev
Since it's generic enough to be used by other types in future, I
put it in <hostdev> as sub-element, though now it's only used by
scsi host device.
2013-05-13 19:02:40 +08:00
dcd632af72 rng: Interleave hostdev elements 2013-05-13 18:51:16 +08:00
0d70656afd qemu: Build qemu command line for scsi host device
Except the scsi host device's controller is "lsilogic", mapping
between the libvirt attributes and scsi-generic properties is:

  libvirt     qemu
-----------------------------------------
  controller  bus ($libvirt_controller.0)
  bus         channel
  target      scsi-id
  unit        lun

For scsi host device with "lsilogic" controller, the mapping is:
('target (libvirt)' must be 0, as it's not used; 'unit (libvirt)
must <= 7).

  libvirt            qemu
----------------------------------------------------------
  controller && bus  bus ($libvirt_controller.$libvirt_bus)
  unit               scsi-id

It's not good to hardcode/hard-check limits of these attributes,
and even worse, these limits are not documented, one has to find
out by either testing or reading the qemu code, I'm looking forward
to qemu expose limits like these one day). For example, exposing
"max_target", "max_lun" for megasas:

static const struct SCSIBusInfo megasas_scsi_info = {
    .tcq = true,
    .max_target = MFI_MAX_LD,
    .max_lun = 255,

    .transfer_data = megasas_xfer_complete,
    .get_sg_list = megasas_get_sg_list,
    .complete = megasas_command_complete,
    .cancel = megasas_command_cancel,
};

Example of the qemu command line (lsilogic controller):

  -drive file=/dev/sg2,if=none,id=drive-hostdev-scsi_host7-0-0-0 \
  -device scsi-generic,bus=scsi0.0,scsi-id=8,\
  drive=drive-hostdev-scsi_host7-0-0-0,id=hostdev-scsi_host7-0-0-0

Example of the qemu command line (virtio-scsi controller):

  -drive file=/dev/sg2,if=none,id=drive-hostdev-scsi_host7-0-0-0 \
  -device scsi-generic,bus=scsi0.0,channel=0,scsi-id=128,lun=128,\
  drive=drive-hostdev-scsi_host7-0-0-0,id=hostdev-scsi_host7-0-0-0

Signed-off-by: Han Cheng <hanc.fnst@cn.fujitsu.com>
Signed-off-by: Osier Yang <jyang@redhat.com>
2013-05-13 18:50:16 +08:00
7486584c9f utils: util functions for scsi hostdev
This patch adds util functions for scsi hostdev.

Signed-off-by: Han Cheng <hanc.fnst@cn.fujitsu.com>
Signed-off-by: Osier Yang <jyang@redhat.com>
2013-05-13 18:40:50 +08:00
b238c0bec1 qemu: New cap flags for scsi-generic
Adding two cap flags for scsi-generic:
  QEMU_CAPS_SCSI_GENERIC
  QEMU_CAPS_SCSI_GENERIC_BOOTINDEX

Signed-off-by: Han Cheng <hanc.fnst@cn.fujitsu.com>
Signed-off-by: Osier Yang <jyang@redhat.com>
2013-05-13 18:30:26 +08:00
9677ff08ce node_device: Clean up unused macros
All of these macros are now unused, so remove.
2013-05-13 18:29:02 +08:00
5c811dcec5 conf: Generic XMLs for scsi hostdev
An example of the scsi hostdev XML:

    <hostdev mode='subsystem' type='scsi'>
      <source>
        <adapter name='scsi_host0'/>
        <address bus='0' target='0' unit='0'/>
      </source>
      <address type='drive' controller='0' bus='0' target='4' unit='8'/>
    </hostdev>

Controller is implicitly added for scsi hostdev, though the scsi
controller's model defaults to "lsilogic", which might be not what
the user wants (same problem exists for virtio-scsi disk). It's
the existing problem, will be addressed later.

The device address must be specified manually. Later patch will let
libvirt generate it automatically.

This only introduces the generic XMLs for scsi hostdev, later patches
will add other elements, e.g. <readonly>, <shareable>.

Signed-off-by: Han Cheng <hanc.fnst@cn.fujitsu.com>
Signed-off-by: Osier Yang <jyang@redhat.com>
2013-05-13 18:23:50 +08:00
9706d85fe9 tests: Add tests for fc_host
Since the NPIV machine is not easy to get, it's very likely to
introduce regressions when doing changes on the existing code.
This patch dumps part of the sysfs files (the necessary ones)
of fc_host as test input data, to test the related util functions.
It could be extended for more fc_host related testing in future.
2013-05-13 17:24:18 +08:00
b7ab719528 util: Honor the passed sysfs_prefix
The helper works for default sysfs_prefix, but for user specified
prefix, it doesn't work. (Detected when writing test cases. A later
patch will add the test cases for fc_host).
2013-05-13 17:19:54 +08:00
1a59ae919d util: Update the comment for virGetFCHostNameByWWN
The returned result is something like "host5" acutally.
2013-05-13 17:18:52 +08:00
c56c273be6 util: Change virIsCapable* to return bool
Function name with "aIsB" generally means its return value is
in Bi-state (true/false).
2013-05-13 17:17:26 +08:00
b595588fef util: Don't miss the slash in constructed path
In case of the caller can pass a "prefix" (or "sysfs_prefix")
without the trailing slash, and Unix-Like system always eats
up the redundant "slash" in the filepath, let's add it explicitly.
2013-05-13 17:14:51 +08:00
e106c0112a util: Fix regression introduced by commit 4360a09844
Which refactored the old code, and introduced new helper
virIsCapableVport, but the path for checking with access() is not
correctly constructed.
2013-05-13 17:12:55 +08:00
b76284afb1 util: Fix regression of wwn reading
Introduced by commit 244ce462e2, which refactored the helper for wwn
reading, however, it forgot to change the old "strndup" and "sizeof(buf)",
"sizeof(buf)" operates on the fixed length array ("buf") in the old code,
but now "buf" is a pointer.

Before the fix:

% virsh nodedev-dumpxml scsi_host5
<device>
  <name>scsi_host5</name>
  <parent>pci_0000_04_00_1</parent>
  <capability type='scsi_host'>
    <host>5</host>
    <capability type='fc_host'>
      <wwnn>2001001b</wwnn>
      <wwpn>2101001b</wwpn>
      <fabric_wwn>2001000d</fabric_wwn>
    </capability>
  </capability>
</device>

With the fix:

% virsh nodedev-dumpxml scsi_host5
<device>
  <name>scsi_host5</name>
  <parent>pci_0000_04_00_1</parent>
  <capability type='scsi_host'>
    <host>5</host>
    <capability type='fc_host'>
      <wwnn>0x2001001b32a9da4e</wwnn>
      <wwpn>0x2101001b32a9da4e</wwpn>
      <fabric_wwn>0x2001000dec9877c1</fabric_wwn>
    </capability>
  </capability>
</device>
2013-05-13 17:10:59 +08:00
d34ef01779 build: fix use of mmap
Commit bfe7721d introduced a regression, but only on platforms
like FreeBSD that lack posix_fallocate and where mmap serves as
a nice fallback for safezero.

util/virfile.c: In function 'safezero':
util/virfile.c:837: error: 'PROT_READ' undeclared (first use in this function)

* src/util/virutil.c (includes): Move use of <sys/mman.h>...
* src/util/virfile.c (includes): ...to the file that uses mmap.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-10 20:52:57 -06:00
12bd22c70d build: update to latest gnulib, for syntax-check
This picks up a fix for a syntax-check weakness mentioned here:
https://www.redhat.com/archives/libvir-list/2013-May/msg00811.html

* .gnulib: Update to latest, for maint.mk improvement.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-10 20:52:57 -06:00
0902f696a9 Update hellolibvirt to demo virGetLastErrorMessage()
Update the hellolibvirt example program to demonstrate use of
the virGetLastErrorMessage() API for quick error reporting

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-10 19:57:18 +01:00
31989e66c6 Add a test case for the fdstream file read/write code
Add a test case which exercises the virFDStreamOpenFile
and virFDStreamCreateFile methods. Ensure that both the
synchronous and non-blocking iohelper code paths work.
This validates the regression recently fixed which
broke reading in non-blocking mode

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-10 19:57:18 +01:00
8ab7d8ee40 Allow the iohelper path to be customized by test programs
Currently the fdstream function hardcodes the location
of the iohelper to LIBEXECDIR "/libvirt_iohelper". This
is not convenient when trying to write test cases which
use this code. Add a virFDStreamSetIOHelper method to
allow the test cases to point to the location of the
un-installed iohelper binary.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-10 19:57:18 +01:00
69c6a58a1d Add a virGetLastErrorMessage() function
Apps using libvirt will often have code like

   if (virXXXX() < 0) {
      virErrorPtr err = virGetLastError();
      fprintf(stderr, "Something failed: %s\n",
              err && err->message ? err->message :
              "unknown error");
      return -1;
   }

Checking for a NULL error object or message leads to very
verbose code. A virGetLastErrorMessage() helper from libvirt
can simplify this to

   if (virXXXX() < 0) {
      fprintf(stderr, "Something failed: %s\n",
              virGetLastErrorMessage());
      return -1;
   }

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-10 19:57:18 +01:00
a2214c5257 Fix iohelper usage with streams opened for read
In b2878ed860 we added the O_NOCTTY
flag when opening files in the stream code. Unfortunately a later
piece of code was comparing the flags == O_RDONLY, without masking
out the non-access mode flags. This broke the iohelper when used
with streams for read, since it caused us to attach the stream
output pipe to the stream input FD instead of output FD :-(

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-10 19:57:18 +01:00
f493d83fbd Cope with missing swap cgroup controls
It is possible to build a kernel without swap cgroup controls
present. This causes a fatal error when querying memory
parameters. Treat missing swap controls as meaning "unlimited".
The fatal error remains if the user tries to actually change
the limit.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-10 19:57:18 +01:00
95934171fb portability: fix virNetDevSetMAC and virNetDevExists on BSD
- provide virNetDevSetMAC() implementation based on SIOCSIFLLADDR
  ioctl.
- adjust virNetDevExists() to check for ENXIO error because
  FreeBSD throws it when device doesn't exist

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-10 11:13:21 -06:00
bfe7721d50 util: move virFile* functions from virutil.c to virfile.c
These all existed before virfile.c was created, and for some reason
weren't moved.

This is mostly straightfoward, although the syntax rule prohibiting
write() had to be changed to have an exception for virfile.c instead
of virutil.c.

This movement pointed out that there is a function called
virBuildPath(), and another almost identical function called
virFileBuildPath(). They really should be a single function, which
I'll take care of as soon as I figure out what the arglist should look
like.
2013-05-10 13:09:30 -04:00
a2c1bedbd8 util: fix virFileOpenAs return value and resulting error logs
This resolves:

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

The first problem was that virFileOpenAs was returning fd (-1) in one
of the error cases rather than ret (-errno), so the caller thought
that the error was EPERM rather than ENOENT.

The second problem was that some log messages in the general purpose
qemuOpenFile() function would always say "Failed to create" even if
the caller hadn't included O_CREAT (i.e. they were trying to open an
existing file).

This fixes virFileOpenAs to jump down to the error return (which
returns ret instead of fd) in the previously mentioned incorrect
failure case of virFileOpenAs(), removes all error logging from
virFileOpenAs() (since the callers report it), and modifies
qemuOpenFile to appropriately use "open" or "create" in its log
messages.

NB: I seriously considered removing logging from all callers of
virFileOpenAs(), but there is at least one case where the caller
doesn't want virFileOpenAs() to log any errors, because it's just
going to try again (qemuOpenFile()). We can't simply make a silent
variation of virFileOpenAs() though, because qemuOpenFile() can't make
the decision about whether or not it wants to retry until after
virFileOpenAs() has already returned an error code.

Likewise, I also considered changing virFileOpenAs() to return -1 with
errno set on return, and may still do that, but only as a separate
patch, as it obscures the intent of this patch too much.
2013-05-10 13:09:25 -04:00
7ca784c4a5 Build breaker - requires VIR_FROM_THIS 2013-05-10 08:52:43 -04:00
c03ae95289 Adapt to VIR_STRDUP and VIR_STRNDUP in src/test/* 2013-05-10 13:45:48 +02:00
3cef9f6adb virGetStorageVol: Don't ignore NULL pool name
The function takes pool name as argument. However,
it is not acceptable for it to be NULL. Hence, we
should check it and report error in case it is.
2013-05-10 12:05:28 +02:00
4960022a17 Adapt to VIR_STRDUP and VIR_STRNDUP in src/* 2013-05-10 11:54:29 +02:00
e60b9783e1 Adapt to VIR_STRDUP and VIR_STRNDUP in tests/* 2013-05-10 11:54:29 +02:00
aaf8114d56 Adapt to VIR_STRDUP and VIR_STRNDUP in src/storage/* 2013-05-10 11:54:29 +02:00
854b91cd9f dom event example: Add error check to impl call
Added error checking to virEventRegisterDefaultImpl call for consistency.
2013-05-10 11:21:08 +02:00
90ebc54e9d dom event example: init before register event impl
In the domain-events example C code virEventRegisterDefaultImpl was being
called before virConnectOpen without first calling virInitialize. While this
code worked, it is incorrect. Adding a call to g_string_new prior to the call
to virEventRegisterDefaultImpl would cause the code to break. This fix will
help avoid unintentional misue of the API.

Relates to: Ret Hat Bugzilla - Bug 961155
2013-05-10 11:21:08 +02:00
353871b22a conf: Fix typo in error message in ABI stability check
s/vpu/vCPU/
2013-05-10 09:54:56 +02:00
1d21b884a3 tests: use portable shell code
'make check' fails since commit 470d5c46 on any system with dash
as /bin/sh, because '<<<' is a bash extension.  For example:

nwfilterschematest: 23: /home/eblake/libvirt/tests/schematestutils.sh: Syntax error: redirection unexpected

Also, there is no need to spawn a grep process when shell globbing
can do the same.

* tests/schematestutils.sh: Replace bashism and subprocess with a
faster and portable construct.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-09 11:46:45 -06:00
0454a7cd3d Replace 'goto clean' with 'goto cleanup' in apparmor code
Some of the apparmor code files did not follow the normal
goto label naming pratices

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 17:18:44 +01:00
c6c1e0074b Replace list of driver source files with variables
Update the DRIVER_SOURCE_FILES variable to reference the
other various XXX_SOURCES variables, instead of duplicating
the filename lists. This results in a bunch of extra files
being processed, but the test scripts can easily skip those

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 17:13:28 +01:00
b9c1315f48 Fix naming of methods in ESX storage backends to follow public APIs
The previous update of method naming missed the ESX storage
backend files. Update them is that the driver impl methods
follow the naming of the public API but with s/vir/esx/

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 17:13:27 +01:00
4e6b73d239 Skip virNWFilterTechDriver when validating API naming
The virNWFilterTechDriver struct is an internal only driver
API with no public API equivalent. It should be skipped by
the 'check-driverimpls' test case

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 17:09:59 +01:00
dc34fc16be Replace 'goto cleanup' with 'goto error' in udev interface driver
Some methods in the udev interface driver used 'cleanup' as the
label for separate error codepaths. Change these to use 'error'
as required by coding standards

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 17:09:12 +01:00
5af5c28bbb Replace 'goto err' with 'goto cleanup' in udev interface driver
The udev interface driver did not follow standard naming
convention for goto labels.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 17:02:24 +01:00
7c5752dd57 Disable some URI tests on older libxml2
Older versions of libxml2 could not correctly parse certain
URIs. This causes test failures. There's nothing libvirt can
do about this, so disable the problem tests on old libxml2
versions

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 17:02:18 +01:00
6e09e7de89 Fix build of python bindings on Python 2.4
The PyDict_Next method on Python <= 2.4 used 'int' instead
of "Py_ssize_t" for the 'pos' parameter

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 17:02:11 +01:00
442eb2ba29 build: fix build with old polkit0
Commit 979e9c56 missed one case of providing the timestamp
parameter to virNetServerClientGetUNIXIdentity() when WITH_POLKIT0
is defined.
2013-05-09 09:53:42 -06:00
1d96440a06 conf: don't crash on a tpm device with no backends
Print an error instead of crashing when a TPM device without
a backend is specified.

Add a test for tpm device with no backend, which should fail
with a parse error.

https://bugzilla.redhat.com/show_bug.cgi?id=961252
2013-05-09 14:25:11 +02:00
470d5c4654 tests: files named '.*-invalid.xml' should fail validation
Currently, using an invalid XML in tests fails, because
the schema test expects all of them to be valid.

Treat files with -invalid.xml suffix as invalid and expect
them to fail validation.
2013-05-09 14:25:11 +02:00
c075f89fa2 don't mention disk controllers in generic controller errors
The controller element supports non-disk controller types too.

https://bugzilla.redhat.com/show_bug.cgi?id=960958
2013-05-09 14:25:11 +02:00
413274f63b iscsi: don't leak portal string when starting a pool 2013-05-09 14:25:11 +02:00
eed1de14b5 Simplify the Xen domain stats/peek / node memory driver methods
Make the Xen domain stats / peek and node memory driver
methods unconditionally call the sub-drivers which are
guaranteed to be open.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:20 +01:00
7329f91f26 Simplify the Xen domain autostart driver method
Unconditionally call into the XenD or XM drivers for autostart
handling, since they are guaranteed to be open
2013-05-09 13:16:20 +01:00
a8f3222a40 Simplify the Xen domain scheduler parameter driver methods
Make the Xen domain scheduler parameter methods directly
call into XenD or Xen hypervisor drivers

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:20 +01:00
758aea3098 Simplify the Xen domain attach/dettach driver methods
Make the domain attach/dettach driver methods directly call
into either the XenD or XM drivers

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:20 +01:00
6e66100155 Simplify the Xen domain define/undefine driver methods
Make the domain define/undefine driver methods directly call
into either the XenD or XM drivers

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:20 +01:00
2fc0660848 Simplify the Xen domain start driver method
Directly call either the XenD or XM driver when starting
a persistent domain

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:20 +01:00
f53ffba6aa Simplify the Xen driver define domain driver methods
Directly call either XenD or the XM driver for handling
domain define operations.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:20 +01:00
69b8c55714 Simplify the Xen domain migration driver methods
All the migration code is done by the XenD subdriver which
can be assumed to always be present

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:20 +01:00
970092dcde Simplify the Xen domain get XML driver method
The xenUnifiedDomainGetXMLDesc driver can assume that
the XM and XenD drivers are always present

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:20 +01:00
7c21e500a4 Simplify the Xen domain VCPU driver methods
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:20 +01:00
48610ebecc Simplify the Xen domain save/restore driver methods
Unconditionally call the XenD APIs for save/restore, since that
driver will always be open.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:20 +01:00
b5961c53d9 Simplify the Xen domain get info/state driver methods
Make the xenUnifiedDomainGetInfo and xenUnifiedDomainGetState drivers
call the correct sub-driver APIs directly.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:20 +01:00
7a8029582f Simplify the Xen domain get/set (max) memory driver methods
Simplify the Xen memory limit driver methods to directly call
the most appropriate sub-driver

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:20 +01:00
bedfaa58b6 Remove Xen get hostname driver method
The xenGetHostname entry point in the xenUnifiedDriver table
was unused.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:19 +01:00
846576eb38 Simplify the Xen domain get OS type driver method
Make xenUnifiedDomainGetOSType directly call either the
xenHypervisorDomainGetOSType or xenDaemonDomainGetOSType
method depending on whether the domain is active or not.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:19 +01:00
13c9ef29c0 Simplify the Xen domain destroy driver method
Unconditionally call the xenDaemonDomainDestroyFlags API
since the XenD driver is always available.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:19 +01:00
6d0d1ecce9 Simplify the Xen domain shutdown/reboot driver methods
Make the xenUnifiedDomainShutdownFlags and xenUnifiedDomainReboot
driver methods unconditionally call the XenD APIs for shutdown
and reboot. Delete the unreachable impls in the XenStore driver.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:19 +01:00
0f62113d8a Simplify the Xen domain suspend/resume driver methods
Update xenUnifiedDomainSuspend and xenUnifiedDomainResume to
unconditionally invoke the XenD APIs for suspend/resume. Delete
the impls in the hypervisor driver which was unreachable.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:19 +01:00
aead5166a5 Simplify the Xen domain is persistent driver method
Unconditionally call xenDaemonLookupByUUID, since the XenD
driver must always be present.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:19 +01:00
e920c5b6c9 Simplify the Xen domain lookup driver methods
Unconditionally invoke the xenHypervisorLookupDomainByID,
xenHypervisorLookupDomainByUUID or xenDaemonLookupByName
for looking up domains. Fallback to xenXMDomainLookupByUUID
and xenXMDomainLookupByName for legacy XenD without inactive
domain support

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:19 +01:00
0177d11074 Simplify the Xen domain create driver method
Unconditionally call xenDaemonCreateXML in the
xenUnifiedDomainCreateXML driver, since the XenD
driver is always present.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:19 +01:00
ef3f38bed7 Simplify the Xen count/list domains driver methods
The XenStore driver is mandatory, so it can be used unconditonally
for the xenUnifiedConnectListDomains & xenUnifiedConnectNumOfDomains
drivers. Delete the unused XenD and Hypervisor driver code for
listing / counting domains

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:19 +01:00
17f9852734 Simplify the Xen get max vcpus / node get info driver methods
Unconditionally call into xenHypervisorGetMaxVcpus and
xenDaemonNodeGetInfo respectively, since those drivers
are both mandatory

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:19 +01:00
dfda6e1161 Simplify the Xen get version driver method
The hypervisor driver is mandatory, so the the call to
xenHypervisorGetVersion must always succeed. Thus there
is no need to ever run xenDaemonGetVersion

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:19 +01:00
1cdc465e0e Simplify the Xen get type driver method
There is no point iterating over sub-drivers since the user
would not have a virConnectPtr instance at all if opening
the drivers failed. Just return 'Xen' immediately.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:19 +01:00
61b7a872cc Simplify opening of Xen drivers
Since the Xen driver was changed to only execute inside libvirtd,
there is no scenario in which it will be opened from a non-privileged
context. Thus all the code dealing with opening the sub-drivers can
be simplified to assume that they are always privileged.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:19 +01:00
71d7b20b3b Remove pointless GET_PRIVATE macro from Xen driver
The Xen driver uses a macro GET_PRIVATE as a supposed shorthand
for 'xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) (conn)->privateData'.
It does not in fact save any lines of code, and obscures what is
happening. Remove it, since it adds no value.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:19 +01:00
8b7cb0025b Remove VIR_CONNECT_RO checks from xen drivers
Some of the Xen sub-drivers have checks against the
VIR_CONNECT_RO flag. This is not required, since such
checks are done at the top level before the driver
methods are invoked

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:19 +01:00
a855556f88 Remove xen driver checks for priv->handle < 0
The Xen hypervisor driver checks for 'priv->handle < 0' and
returns -1, but without raising any error. Fortunately this
code will never be executed, since the main Xen driver always
checks 'priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]' prior
to invoking any hypervisor API. Just remove the redundant
checks for priv->handle

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 13:16:19 +01:00
ab2a3d01e5 Adapt to VIR_STRDUP and VIR_STRNDUP in src/vmx/* 2013-05-09 14:08:54 +02:00
e6ab100980 Adapt to VIR_STRDUP and VIR_STRNDUP in src/vmware/* 2013-05-09 14:08:54 +02:00
4a22990dfd Adapt to VIR_STRDUP and VIR_STRNDUP in src/uml/* 2013-05-09 14:08:54 +02:00
296d319f05 Adapt to VIR_STRDUP and VIR_STRNDUP in src/secret/* 2013-05-09 14:08:54 +02:00
a39875b7f8 Adapt to VIR_STRDUP and VIR_STRNDUP in src/phyp/* 2013-05-09 14:01:37 +02:00
b3c649ac5e Adapt to VIR_STRDUP and VIR_STRNDUP in src/parallels/* 2013-05-09 14:01:37 +02:00
0ca51d5c9f Adapt to VIR_STRDUP and VIR_STRNDUP in src/nwfilter/* 2013-05-09 14:01:37 +02:00
e3221e6421 Adapt to VIR_STRDUP and VIR_STRNDUP in src/interface/* 2013-05-09 14:01:30 +02:00
be2636fd0b Adapt to VIR_STRDUP and VIR_STRNDUP in src/node_device/* 2013-05-09 14:00:45 +02:00
6b936bd79c Adapt to VIR_STRDUP and VIR_STRNDUP in src/network/* 2013-05-09 14:00:45 +02:00
a96d7f3c8f Adapt to VIR_STRDUP and VIR_STRNDUP in src/lxc/* 2013-05-09 14:00:45 +02:00
f75ed996e7 Adapt to VIR_STRDUP and VIR_STRNDUP in src/locking/* 2013-05-09 14:00:45 +02:00
08152a6982 Adapt to VIR_STRDUP and VIR_STRNDUP in src/libxl/* 2013-05-09 14:00:45 +02:00
544cb4375f Adapt to VIR_STRDUP and VIR_STRNDUP in src/hyperv/* 2013-05-09 14:00:45 +02:00
a315f866e2 Adapt to VIR_STRDUP and VIR_STRNDUP in src/esx/* 2013-05-09 14:00:45 +02:00
0d013184d1 Adapt to VIR_STRDUP and VIR_STRNDUP in src/cpu/* 2013-05-09 14:00:44 +02:00
df5c9e6984 Delete udevFreeIfaceDef function in udev interface driver
The udevFreeIfaceDef function in the udev interface driver
just duplicates code from virInterfaceDefFree. Delete it
and call the standard API instead.

Fix the udevGetIfaceDefVlan method so that it doesn't
store pointers to the middle of a malloc'd memory
area.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-09 12:34:26 +01:00
946c9f75d0 libvirt.c: Fix the indention
Pushed under trivial rule
2013-05-09 18:50:22 +08:00
a503433c30 conf: Remove the unrelated comment
Pushed under trivial rule.
2013-05-09 11:04:32 +08:00
3dfc2b71aa maint: update to latest gnulib
Among others, this fixes a cosmetic bug where bootstrap stated:

./bootstrap: Bootstrapping from checked-out http://libvirt.org sources...

instead of the intended:

./bootstrap: Bootstrapping from checked-out libvirt sources...

* .gnulib: Update to latest, for bootstrap improvement.
* bootstrap: Resync from gnulib.
2013-05-08 14:54:04 -06:00
55b46920bb virsh: Resolve Coverity 'MISSING_BREAK'
Recent commit '53531e16' resulted in a new Coverity warning regarding
a missing break in the ':' options processing. Adjust the commit to
avoid the issue.
2013-05-08 06:16:53 -04:00
649ecb704f lxc: Coverity false positive USE_AFTER_FREE 2013-05-08 06:16:53 -04:00
a605b7e041 Unmerge attach/update/modify device APIs in drivers
The LXC, QEMU, and LibXL drivers have all merged their handling of
the attach/update/modify device APIs into one large

  'xxxxDomainModifyDeviceFlags'

which then does a 'switch()' based on the actual API being invoked.
While this saves some lines of code, it is not really all that
significant in the context of the driver API impls as a whole.

This merger of the handling of different APIs creates pain when
wanting to automated analysis of the code and do things which
are specific to individual APIs. The slight duplication of code
from unmerged the API impls, is preferrable to allow for easier
automated analysis.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-08 10:47:48 +01:00
449e6b1b58 Pull parsing of migration xml up into QEMU driver APIs
Currently the parsing of XML is pushed down into the various
migration helper APIs. This makes it difficult to insert the
correct access control checks, since one helper API services
many public APIs. Pull the parsing of XML up to the top level
of the QEMU driver APIs
2013-05-08 10:47:48 +01:00
03a600368e Don't allow renaming of domains by the backdoor
Several APIs allow for custom XML to be passed in. This is
checked for ABI stability, which will ensure the UUID is
not being changed. There isn't validation that the name
did not change though. This could allow renaming of guests
via the backdoor, which in turn could allow for bypassing
access control restrictions based on names.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-08 10:47:47 +01:00
142e6e2784 Fix naming of some node device APIs
In renaming driver API implementations to match the
public API naming scheme, a few cases in the node
device driver were missed.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-08 10:47:47 +01:00
4a044d0256 Separate internal node suspend APIs from public API
The individual hypervisor drivers were directly referencing
APIs in virnodesuspend.c in their virDriverPtr struct. Separate
these methods, so there is always a wrapper in the hypervisor
driver. This allows the unused virConnectPtr args to be removed
from the virnodesuspend.c file. Again this will ensure that
ACL checks will only be performed on invocations that are
directly associated with public API usage.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-08 10:47:47 +01:00
1c6d4ca557 Separate internal node device APIs from public API
The individual hypervisor drivers were directly referencing
APIs in src/nodeinfo.c in their virDriverPtr struct. Separate
these methods, so there is always a wrapper in the hypervisor
driver. This allows the unused virConnectPtr args to be
removed from the nodeinfo.c file. Again this will ensure that
ACL checks will only be performed on invocations that are
directly associated with public API usage.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-08 10:47:47 +01:00
ead630319d Separate virGetHostname() API contract from driver APIs
Currently the virGetHostname() API has a bogus virConnectPtr
parameter. This is because virtualization drivers directly
reference this API in their virDriverPtr tables, tieing its
API design to the public virConnectGetHostname API design.

This also causes problems for access control checks since
these must only be done for invocations from the public
API, not internal invocation.

Remove the bogus virConnectPtr parameter, and make each
hypervisor driver provide a dedicated function for the
driver API impl. This will allow access control checks
to be easily inserted later.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-08 10:47:47 +01:00
979e9c56a7 Include process start time when doing polkit checks
Since PIDs can be reused, polkit prefers to be given
a (PID,start time) pair. If given a PID on its own,
it will attempt to lookup the start time in /proc/pid/stat,
though this is subject to races.

It is safer if the client app resolves the PID start
time itself, because as long as the app has the client
socket open, the client PID won't be reused.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-08 10:47:45 +01:00
b1d753fe40 Rename "security context" to "selinux context"
There are various methods named "virXXXXSecurityContext",
which are specific to SELinux. Rename them all to
"virXXXXSELinuxContext". They will still raise errors at
runtime if SELinux is not compiled in

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-08 10:21:01 +01:00
8f7a1ac810 Fix possible undefined value in check-symsorting.pl
It is possible for $line to be undefined at first used, if
the symfile doesn't have a section prefix (which is the case
for auto-generated symfiles).

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-08 10:21:01 +01:00
59750ed6ea storage: Skip inactive lv volumes
If the volume is of a clustered volume group, and not active, the
related pool APIs fails on opening /dev/vg/lv. If the volume is
suspended, it hangs on open(2) the volume.

Though the best solution is to expose the volume status in volume
XML, and even better to provide API to activate/deactivate the volume,
but it's not the work I want to touch currently. Volume status in
other status is just fine to skip.

About the 5th field of lv_attr (from man lvs[8])
<quote>
 5 State: (a)ctive, (s)uspended, (I)nvalid snapshot, invalid
   (S)uspended snapshot, snapshot (m)erge failed,suspended
   snapshot (M)erge failed, mapped (d)evice present without
   tables,  mapped device present with (i)nactive table
</quote>
2013-05-08 12:12:14 +08:00
6b74a9f5d9 string: make VIR_STRDUP easier to use
While reviewing proposed VIR_STRDUP conversions, I've already noticed
several places that do:

if (str && VIR_STRDUP(dest, str) < 0)

which can be simplified by allowing str to be NULL (something that
strdup() doesn't allow).  Meanwhile, code that wants to ensure a
non-NULL dest regardless of the source can check for <= 0.

Also, make it part of the VIR_STRDUP contract that macro arguments
are evaluated exactly once.

* src/util/virstring.h (VIR_STRDUP, VIR_STRDUP_QUIET, VIR_STRNDUP)
(VIR_STRNDUP_QUIET): Improve contract.
* src/util/virstring.c (virStrdup, virStrndup): Change return
conventions.
* docs/hacking.html.in: Document this.
* HACKING: Regenerate.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-07 13:21:31 -06:00
ddcfc5492a alloc: make VIR_APPEND_ELEMENT safer
VIR_APPEND_ELEMENT(array, size, elem) was not safe if the expression
for 'size' had side effects.  While no one in the current code base
was trying to pass side effects, we might as well be robust and
explicitly document our intentions.

* src/util/viralloc.c (virInsertElementsN): Add special case.
* src/util/viralloc.h (VIR_APPEND_ELEMENT): Use it.
(VIR_ALLOC, VIR_ALLOC_N, VIR_REALLOC_N, VIR_EXPAND_N)
(VIR_RESIZE_N, VIR_SHRINK_N, VIR_INSERT_ELEMENT)
(VIR_DELETE_ELEMENT, VIR_ALLOC_VAR, VIR_FREE): Document
which macros are safe in the presence of side effects.
* docs/hacking.html.in: Document this.
* HACKING: Regenerate.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-07 13:21:31 -06:00
605a077244 syntax-check: forbid virBufferAsprintf with string literals 2013-05-07 17:49:59 +02:00
dcea5a492f get rid of virBufferAsprintf where possible
Use virBufferAddLit or virBufferAddChar instead.
2013-05-07 17:38:58 +02:00
8cd40e7e0d qemu: allocate network connections sooner during domain startup
VFIO device assignment requires a cgroup ACL to be setup for access to
the /dev/vfio/nn "group" device for any devices that will be assigned
to a guest. In the case of a host device that is allocated from a
pool, it was being allocated during qemuBuildCommandLine(), which is
called by qemuProcessStart() *after* the all-encompassing
qemuSetupCgroup() was called, meaning that the standard Cgroup ACL
setup wasn't creating ACLs for these devices allocated from pools.

One possible solution was to manually add a single ACL down inside
qemuBuildCommandLine() when networkAllocateActualDevice() is called,
but that has two problems: 1) the function that adds the cgroup ACL
requires a virDomainObjPtr, which isn't available in
qemuBuildCommandLine(), and 2) we really shouldn't be doing network
device setup inside qemuBuildCommandLine() anyway.

Instead, I've created a new function called
qemuNetworkPrepareDevices() which is called just before
qemuPrepareHostDevices() during qemuProcessStart() (explanation of
ordering in the comments), i.e. well before the call to
qemuSetupCgroup(). To minimize code churn in a patch that will be
backported to 1.0.5-maint, qemuNetworkPrepareDevices only does
networkAllocateActualDevice() and the bare amount of setup required
for type='hostdev network devices, but it eventually should do *all*
device setup for guest network devices.

Note that some of the code that was previously needed in
qemuBuildCommandLine() is no longer required when
networkAllocateActualDevice() is called earlier:

 * qemuAssignDeviceHostdevAlias() is already done further down in
   qemuProcessStart().

 * qemuPrepareHostdevPCIDevices() is called by
   qemuPrepareHostDevices() which is called after
   qemuNetworkPrepareDevices() in qemuProcessStart().

As hinted above, this new function should be moved into a separate
qemu_network.c (or similarly named) file along with
qemuPhysIfaceConnect(), qemuNetworkIfaceConnect(), and
qemuOpenVhostNet(), and expanded to call those functions as well, then
the nnets loop in qemuBuildCommandLine() should be reduced to only
build the commandline string (which itself can be in a separate
qemuInterfaceBuilldCommandLine() function as suggested by
Michal). However, this will require storing away an array of tapfd and
vhostfd that are needed for the commandline, so I would rather do that
in a separate patch and leave this patch at the minimum to fix the
bug.
2013-05-07 11:36:43 -04:00
039e30805c Ensure stub todo.html.in file is HTML5
If no todo.cfg is present, make sure the stub is in HTML5
format and clearly states that the config was not available

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-07 15:45:50 +01:00
c5e8343a25 Point users to Virt-Viewer MSI installers for Windows builds
The Windows port page currently links to pre-built libvirt
DLLs for release 0.8.8 which are 2 years old now. Until we
can reliably produce official Windows installers, point
people to the virt-viewer MSI installers instead which
include the libvirt DLLs.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-07 15:29:37 +01:00
bde1731613 qemu: Enable the capability bit for -no-kvm-pit-reinjection on x86 only
On architectures not supporting the Intel specific programmable interval
timer, like e.g. S390, starting a domain with a clock definition containing
a pit timer results in the error "Option no-kvm-pit-reinjection not supported
for this target".

By moving the capability enablement for -no-kvm-pit-reinjection from the
InitQMPBasic section into the x86_64 and i686 only enablement section all
other architectures are no longer automatically enabled. In addition
architecture related capabilities enablements have refactored into a new
architecture bound capabilities initialization function.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2013-05-07 14:42:40 +02:00
e914dcfdaa rpc: message related sizes enlarged
We have seen an issue on s390x platform where domain XMLs larger than 1MB
were used. The define command was finished successfully. The dumpxml command
was not successful (i.e. could not encode message payload).

Enlarged message related sizes (e.g. maximum string size, message size, etc.)
to handle larger system configurations used on s390x platform.

To improve handling of the RPC message size the allocation during encode process
is changed to a dynamic one (i.e. starting with 64kB initial size and increasing
that size in steps up to 16MB if the payload data is larger).

Signed-off-by: Daniel Hansel <daniel.hansel@linux.vnet.ibm.com>
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2013-05-07 13:29:58 +02:00
5e7b0e8757 Fix namespace bugs in API docs, todo page & hv support page
The XSL for generating the API docs was missing the HTML5
namespace declarations. The todo and hvsupport scripts were
also missing the HTML5 doctype / namespace declaration.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-07 11:19:04 +01:00
246d0068ac qemu: Do fake auto-allocation of ports when generating native command
When attempting to generate the native command line from an XML file
that uses graphics port auto allocation, the generated commandline
wouldn't be valid.

This patch adds fake autoallocation of ports as done when starting the
actual machine.
2013-05-06 22:13:22 +02:00
a2584d58f6 spec: proper soft static allocation of qemu uid
https://bugzilla.redhat.com/show_bug.cgi?id=924501 tracks a
problem that occurs if uid 107 is already in use at the time
libvirt is first installed.  In response that problem, Fedora
packaging guidelines were recently updated.  This fixes the
spec file to comply with the new guidelines:
https://fedoraproject.org/wiki/Packaging:UsersAndGroups

* libvirt.spec.in (daemon): Follow updated Fedora guidelines.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-06 14:05:05 -06:00
c21c38d71b build: clean up stray files found by 'make distcheck'
'make distcheck' complained:

ERROR: files left in build directory after distclean:
./python/libvirt.pyc
./tests/commandhelper.log

Problems introduced in commits f015495 and 25ea8e4 (both v1.0.3).

* tests/commandtest.c (test21): Check (and clean) log file.
* tests/commanddata/test21.log: New file.
* python/Makefile.am (CLEANFILES): Clean up compiled python files.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-06 14:01:08 -06:00
ed11ab93fa build: always include libvirt_lxc.syms in tarball
On a mingw build, 'make distcheck' fails with:

  GEN      libvirt_qemu.def
make[3]: *** No rule to make target `../../src/libvirt_lxc.syms', needed by `libvirt_lxc.def'.  Stop.

I traced it to a missing entry in EXTRA_DIST.  But rather than keep
the entire list in sync, it is easier to list the three syms files
that drive .so files directly, and then reuse existing makefile
variables for the remaining files (that is, I validated that all
remaining files are added to SYM_FILES, possibly via USED_SYM_FILES,
according to makefile conditionals).

Problem introduced in commit 3d1596b (v1.0.2).

* src/Makefile.am (EXTRA_DIST): Ensure all syms files are shipped.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-06 13:59:48 -06:00
a54434f4ba Adapt to VIR_STRDUP and VIR_STRNDUP in daemon/* 2013-05-05 12:17:12 +02:00
c3abb5c459 virstring: Introduce VIR_STRDUP and VIR_STRNDUP
The code adaptation is not done right now, but in subsequent patches.
Hence I am not implementing syntax-check rule as it would break
compilation. Developers are strongly advised to use these new macros.
They are similar to VIR_ALLOC() logic: VIR_STRDUP(dst, src) returns zero
on success, -1 otherwise. In case you don't want to report OOM error,
use the _QUIET variant of a macro.
2013-05-05 12:08:54 +02:00
b1434b36b1 Fix a few more docs XSL bugs related to the TOC
Add missing 'html:' namespace prefix to a few more XSL
rules for generating the table of contents links

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-03 20:57:24 +01:00
52ba0f6e1c qemu: fix stupid typos in VFIO cgroup setup/teardown
I must have looked at this a couple dozen times before I noticed it
had "!=" instead of "==". Not doing this setup prevented qemu from
doing anything with the vfio group device.
2013-05-03 14:32:54 -04:00
7ee85c9900 Fix docs generator regression in previous commit
The previous commit failed to update the XSL to take account
of fact that in XHTML mode the elements need namespace
prefixes. This caused every web page to be blank!
2013-05-03 16:58:46 +01:00
f2f9742d4d Fix multiple formatting problems in HTML docs
The rule generating the HTML docs passing the --html flag
to xsltproc. This makes it use the legacy HTML parser, which
either ignores or tries to fix all sorts of broken XML tags.
There's no reason why we should be writing broken XML in
the first place, so removing --html and adding the XHTML
doctype to all files forces us to create good XML.

This adds the XHTML doc type and fixes many, many XML tag
problems it exposes.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-03 15:56:15 +01:00
58662f4416 Make detect_scsi_host_caps a function on all architectures
In the non linux case some callers like gather_scsi_host_caps needed the
return code of -1 while others like update_caps needed an empty
statement (to avoid a "statement without effect" warning). This is much
simpler solved by using a function instead of a define.
2013-05-03 16:40:21 +02:00
b562d7b7e4 Fixup rpcgen code on kFreeBSD too
since it uses glibc's rpcgen.
2013-05-03 16:40:21 +02:00
d80b5b7f86 Ignore 'uri' parameter in lockd driver
A 'uri' parameter was added for the benefit of sanlock. This
causes a warning in the lockd driver though

2013-05-03 13:20:35.347+0000: 28403: error : virLockManagerLockDaemonNew:482 : internal error Unexpected parameter uri for object

Ignore this parameter, since lockd does not require it and it
is harmless if not used.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-03 15:36:15 +01:00
2ffd87d820 network: fix network driver startup for qemu:///session
This should resolve https://bugzilla.redhat.com/show_bug.cgi?id=958907

Recent new addition of code to read/write active network state to the
NETWORK_STATE_DIR in the network driver broke startup for
qemu:///session. The network driver had several state file paths
hardcoded to /var, which could never possibly work in session mode.

This patch modifies *all* state files to use a variable string that is
set differently according to whether or not we're running
privileged. (It turns out that logDir was never used, so it's been
completely eliminated.)

There are very definitely other problems preventing dnsmasq and radvd
from running in non-privileged mode, but it's more consistent to have
the directories used by them be determined in the same fashion.

NB: I've noted before that the network driver is storing its state
(including dnsmasq and radvd state) in /var/lib, while qemu stores its
state in /var/run. It would probably have been better if the two
matched, but it's been this way for a long time, and changing it would
break running installations during an upgrade, so it's best to just
leave it as it is.
2013-05-03 10:17:29 -04:00
848a08bc94 Fix warning about unsupported cookie flags in QEMU driver
The QEMU migration code unconditionally sets the 'persistent'
cookie flag on the source host. The dest host, however, only
allows it during parsing if VIR_MIGRATE_PERSIST_DEST was
set. Make the source host only set it if this flag is
present.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-03 14:06:15 +01:00
8dc93ffadc Fix release of resources with lockd plugin
The lockd plugin for the lock manager was not correctly
handling the release of resource locks. This meant that
during migration, or when pausing a VM, the locks would
not get released. This in turn made it impossible to
resume the domain, or finish migration
2013-05-03 14:06:15 +01:00
d6670a64e1 Fix F_DUPFD_CLOEXEC operation args
The F_DUPFD_CLOEXEC operation with fcntl() expects a single
int argument, specifying the minimum FD number for the newly
dup'd file descriptor. We were not specifying that causing
random stack data to be accessed as the FD number. Sometimes
that worked, sometimes it didn't.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-03 14:06:15 +01:00
22d12905e6 build: avoid non-portable cast of pthread_t
POSIX says pthread_t is opaque.  We can't guarantee if it is scaler
or a pointer, nor what size it is; and BSD differs from Linux.
We've also had reports of gcc complaining on attempts to cast it,
if we use a cast to the wrong type (for example, pointers have to be
cast to void* or intptr_t before being narrowed; while casting a
function return of scalar pthread_t to void* triggers a different
warning).

Give up on casts, and use unions to get at decent bits instead.  And
rather than futz around with figuring which 32 bits of a potentially
64-bit pointer are most likely to be unique, convert the rest of
the code base to use 64-bit values when using a debug id.

Based on a report by Guido Günther against kFreeBSD, but with a
fix that doesn't regress commit 4d970fd29 for FreeBSD.

* src/util/virthreadpthread.c (virThreadSelfID, virThreadID): Use
union to get at a decent bit representation of thread_t bits.
* src/util/virthread.h (virThreadSelfID, virThreadID): Alter
signature.
* src/util/virthreadwin32.c (virThreadSelfID, virThreadID):
Likewise.
* src/qemu/qemu_domain.h (qemuDomainJobObj): Alter type of owner.
* src/qemu/qemu_domain.c (qemuDomainObjTransferJob)
(qemuDomainObjSetJobPhase, qemuDomainObjReleaseAsyncJob)
(qemuDomainObjBeginNestedJob, qemuDomainObjBeginJobInternal): Fix
clients.
* src/util/virlog.c (virLogFormatString): Likewise.
* src/util/vireventpoll.c (virEventPollInterruptLocked):
Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-03 06:30:22 -06:00
9eafa25116 build: fix make rpm failure
Commit 297c99a accidentally put a { where a ( belonged, causing make
rpm to fail.
2013-05-03 07:52:22 -04:00
329b7602a1 More paranoid initialization of 'nparams' variable in dispatch code
Since the 'nparams' variable passed to virTypedParametersFree is
supposed to represent the size of the 'params' array, it is bad
practice to initialize it to a non-zero value, until the array
has been allocated.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-03 10:29:07 +01:00
31dbbb667f Fix potential use of undefined variable in remote dispatch code
If an early dispatch check caused a jump to the 'cleanup' branch
then virTypeParamsFree() would be called with an uninitialized
'nparams' variable. Fortunately 'params' is initialized to NULL,
so the uninitialized 'nparams' variable would not be used.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-03 10:29:07 +01:00
377ac10c8f Remove redundant () in expression
The use of () in a simple boolean comparison was not
required

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-03 10:29:07 +01:00
5c1678ab2c Fix format string handling in network driver
The call to virReportError conditionally switched between
two format strings, with different numbers of placeholders.
This meant the format string with no placeholders was not
protected by a "%s".

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-03 10:29:07 +01:00
bb5cd56445 docs: fix 'since' for socket path generation
Commit 297c99a says it works from 1.0.5 but it only got pushed
after the 1.0.5 release.
2013-05-03 09:24:00 +02:00
4ffb52acb7 esx: Reduce code duplication in generator 2013-05-03 00:17:46 +02:00
ce45c761d0 build: Fix build when WITH_HAL is defined
Commit 7c9a2d88 missed inclusion of virstring.h in a few places
when WITH_HAL is defined, causing build failures.
2013-05-02 16:00:07 -06:00
4f8e2bacc5 build: fix mingw build of vbox
More fallout from commit 7c9a2d88 dropping too many headers.  Fixes:

In file included from ../../src/vbox/vbox_glue.c:26:0:
../../src/vbox/vbox_MSCOMGlue.c: In function 'vboxLookupVersionInRegistry':
../../src/vbox/vbox_MSCOMGlue.c:435:5: error: implicit declaration of function 'virParseVersionString' [-Werror=implicit-function-declaration]
...
../../src/vbox/vbox_driver.c: In function 'vboxConnectOpen':
../../src/vbox/vbox_driver.c:147:5: error: implicit declaration of function 'getuid' [-Werror=implicit-function-declaration]
../../src/vbox/vbox_driver.c:147:5: error: nested extern declaration of 'getuid' [-Werror=nested-externs]

* src/vbox/vbox_MSCOMGlue.c (includes): Add missing includes.
* src/vbox/vbox_driver.c (includes): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-02 15:53:27 -06:00
05f79a3894 build: fix mingw build of virprocess.c
Commit 776d49f4 added a static function that is only called
conditionally; leading to this compile error on mingw:

  CC       libvirt_util_la-virprocess.lo
../../src/util/virprocess.c:624:26: error: 'struct rlimit' declared inside parameter list [-Werror]
../../src/util/virprocess.c:624:26: error: its scope is only this definition or declaration, which is probably not what you want [-Werror]
../../src/util/virprocess.c:622:1: error: 'virProcessPrLimit' defined but not used [-Werror=unused-function]

* src/util/virprocess.c (virProcessPrLimit): Only declare
virProcessPrLimit when used.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-02 15:46:19 -06:00
348ac06133 build: fix FreeBSD build
Commit 7c9a2d88 cleaned up too many headers; FreeBSD builds
failed due to:

util/virutil.c:556: warning: implicit declaration of function 'canonicalize_file_name'

(Not sure which Linux header leaked this declaration, but gnulib
only guarantees it in stdlib.h)

libvirt.c:956: warning: implicit declaration of function 'virGetUserConfigDirectory'

(Here, a build on Linux was picking up virutil.h indirectly via
one of the conditional driver headers, where that driver was not
being built on my FreeBSD setup)

* src/util/virutil.c (includes): Need <stdlib.h> for
canonicalize_file_name.
* src/libvirt.c (includes): Use "virutil.h" unconditionally,
rather than relying on conditional indirect inclusion.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-02 15:41:21 -06:00
25ae3d3015 build: avoid useless virAsprintf
virAsprintf(&foo, "%s", bar) is wasteful compared to
foo = strdup(bar) (or eventually, VIR_STRDUP(foo, bar),
but one thing at a time...).

Noticed while reviewing Laine's attempt to clean up broken
qemu:///session.

* cfg.mk (sc_prohibit_asprintf): Enhance rule.
* src/esx/esx_storage_backend_vmfs.c
(esxStorageBackendVMFSVolumeLookupByKey): Fix offender.
* src/network/bridge_driver.c (networkStateInitialize): Likewise.
* src/nwfilter/nwfilter_dhcpsnoop.c (virNWFilterSnoopDHCPOpen):
Likewise.
* src/storage/storage_backend_sheepdog.c
(virStorageBackendSheepdogRefreshVol): Likewise.
* src/util/vircgroup.c (virCgroupAddTaskStrController): Likewise.
* src/util/virdnsmasq.c (addnhostsAdd): Likewise.
* src/xen/block_stats.c (xenLinuxDomainDeviceID): Likewise.
* src/xen/xen_driver.c (xenUnifiedConnectOpen): Likewise.
* tools/virsh.c (vshGetTypedParamValue): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-02 13:35:26 -06:00
5a3487dadb build: always include sanitytest in tarball
The libvirt 1.0.5 tarball is missing a file which renders 'make
check' broken; first reported on list by Guido Günther.

* python/Makefile.am (EXTRA_DIST): Hoist sanitytest.py out of
HAVE_PYTHON conditional.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-05-02 12:00:08 -06:00
cc8f9e677c util: fix compile errors caused by moving string functions
commit 7c9a2d8 missed adding in a few #include "virstring.h"s, causing
builds to fail.
2013-05-02 13:27:19 -04:00
7c9a2d88cd virutil: Move string related functions to virstring.c
The source code base needs to be adapted as well. Some files
include virutil.h just for the string related functions (here,
the include is substituted to match the new file), some include
virutil.h without any need (here, the include is removed), and
some require both.
2013-05-02 16:56:55 +02:00
297c99a567 qemu: Generate agent socket path if missing
It's not desired to force users imagine path for a socket they
are not even supposed to connect to. On the other hand, we
already have a release where the qemu agent socket path is
exposed to XML, so we cannot silently drop it from there.
The new path is generated in form:

$LOCALSTATEDIR/lib/libvirt/qemu/channel/target/$domain.$name

for qemu system mode, and

$XDG_CONFIG_HOME/qemu/lib/channel/target/$domain.$name

for qemu session mode.
2013-05-02 16:40:24 +02:00
ca75c44310 virInitctlRequest: unbreak make syntax check
introduced by dcf97846d5

To trigger this cppi needs to be installed.
2013-05-02 10:20:33 +02:00
a1365d7351 virInitctlRequest: unbreak make syntax check
introduced by dcf97846d5
2013-05-02 09:22:41 +02:00
723 changed files with 715754 additions and 622207 deletions

14
.gitignore vendored
View File

@ -28,7 +28,6 @@
.sc-start-sc_*
/ABOUT-NLS
/AUTHORS
/COPYING
/ChangeLog
/GNUmakefile
/INSTALL
@ -104,10 +103,20 @@
/run
/sc_*
/src/.*.stamp
/src/access/org.libvirt.api.policy
/src/access/viraccessapicheck.c
/src/access/viraccessapicheck.h
/src/access/viraccessapichecklxc.c
/src/access/viraccessapichecklxc.h
/src/access/viraccessapicheckqemu.c
/src/access/viraccessapicheckqemu.h
/src/esx/*.generated.*
/src/hyperv/*.generated.*
/src/libvirt*.def
/src/libvirt.syms
/src/libvirt_access.syms
/src/libvirt_access_lxc.syms
/src/libvirt_access_qemu.syms
/src/libvirt_*.stp
/src/libvirt_*helper
/src/libvirt_*probes.h
@ -144,6 +153,8 @@
/tests/domainsnapshotxml2xmltest
/tests/esxutilstest
/tests/eventtest
/tests/fchosttest
/tests/fdstreamtest
/tests/hashtest
/tests/jsontest
/tests/libvirtdconftest
@ -156,6 +167,7 @@
/tests/openvzutilstest
/tests/qemuargv2xmltest
/tests/qemuhelptest
/tests/qemuhotplugtest
/tests/qemumonitorjsontest
/tests/qemumonitortest
/tests/qemuxmlnstest

Submodule .gnulib updated: 92f3a4c8e5...a363f4ed4a

339
COPYING Normal file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

41
HACKING
View File

@ -318,6 +318,29 @@ immediately prior to any closing bracket. E.g.
int foo(int wizz); // Good
Semicolons
==========
Semicolons should never have a space beforehand. Inside the condition of a
"for" loop, there should always be a space or line break after each semicolon,
except for the special case of an infinite loop (although more infinite loops
use "while"). While not enforced, loop counters generally use post-increment.
for (i = 0 ;i < limit ; ++i) { // Bad
for (i = 0; i < limit; i++) { // Good
for (;;) { // ok
while (1) { // Better
Empty loop bodies are better represented with curly braces and a comment,
although use of a semicolon is not currently rejected.
while ((rc = waitpid(pid, &st, 0) == -1) &&
errno == EINTR); // ok
while ((rc = waitpid(pid, &st, 0) == -1) &&
errno == EINTR) { // Better
/* nothing */
}
Curly braces
============
Omit the curly braces around an "if", "while", "for" etc. body only when that
@ -418,6 +441,11 @@ But if negating a complex condition is too ugly, then at least add braces:
Preprocessor
============
Macros defined with an ALL_CAPS name should generally be assumed to be unsafe
with regards to arguments with side-effects (that is, MAX(a++, b--) might
increment a or decrement b too many or too few times). Exceptions to this rule
are explicitly documented for macros in viralloc.h and virstring.h.
For variadic macros, stick with C99 syntax:
#define vshPrint(_ctl, ...) fprintf(stdout, __VA_ARGS__)
@ -501,7 +529,7 @@ Low level memory management
Use of the malloc/free/realloc/calloc APIs is deprecated in the libvirt
codebase, because they encourage a number of serious coding bugs and do not
enable compile time verification of checks for NULL. Instead of these
routines, use the macros from memory.h.
routines, use the macros from viralloc.h.
- To allocate a single object:
@ -719,6 +747,17 @@ sizeof(dest) returns something meaningful). Note that this is a macro, so
arguments could be evaluated more than once. This is equivalent to
virStrncpy(dest, src, strlen(src), sizeof(dest)).
VIR_STRDUP(char *dst, const char *src);
VIR_STRNDUP(char *dst, const char *src, size_t n);
You should avoid using strdup or strndup directly as they do not report
out-of-memory error, and do not allow a NULL source. Use VIR_STRDUP or
VIR_STRNDUP macros instead, which return 0 for NULL source, 1 for successful
copy, and -1 for allocation failure with the error already reported. In very
specific cases, when you don't want to report the out-of-memory error, you can
use VIR_STRDUP_QUIET or VIR_STRNDUP_QUIET, but such usage is very rare and
usually considered a flaw.
Variable length string buffer
=============================

View File

@ -1,7 +1,20 @@
## Process this file with automake to produce Makefile.in
## Copyright (C) 2005-2012 Red Hat, Inc.
## See COPYING.LIB for the License of this software
## Copyright (C) 2005-2013 Red Hat, Inc.
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
##
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public
## License along with this library. If not, see
## <http://www.gnu.org/licenses/>.
LCOV = lcov
GENHTML = genhtml

View File

@ -1,3 +1,18 @@
## Copyright (C) 2009-2010, 2013 Red Hat, Inc.
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
##
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public
## License along with this library. If not, see
## <http://www.gnu.org/licenses/>.
#
# Generated by running the following on Fedora 9:

View File

@ -69,6 +69,7 @@ fi
if test -x /usr/bin/i686-w64-mingw32-gcc ; then
make distclean
PKG_CONFIG_LIBDIR="/usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/i686-w64-mingw32/sys-root/mingw/share/pkgconfig" \
PKG_CONFIG_PATH="$AUTOBUILD_INSTALL_ROOT/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig" \
CC="i686-w64-mingw32-gcc" \
../configure \
@ -88,6 +89,7 @@ fi
if test -x /usr/bin/x86_64-w64-mingw32-gcc ; then
make distclean
PKG_CONFIG_LIBDIR="/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/x86_64-w64-mingw32/sys-root/mingw/share/pkgconfig" \
PKG_CONFIG_PATH="$AUTOBUILD_INSTALL_ROOT/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig" \
CC="x86_64-w64-mingw32-gcc" \
../configure \

View File

@ -1,6 +1,6 @@
#! /bin/sh
# Print a version string.
scriptversion=2013-03-08.16; # UTC
scriptversion=2013-05-08.20; # UTC
# Bootstrap this package from checked-out sources.
@ -140,20 +140,21 @@ po_download_command_format2=\
"wget --mirror -nd -q -np -A.po -P '%s' \
http://translationproject.org/latest/%s/"
# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
# fall back to the package name (1st argument with munging)
extract_package_name='
/^AC_INIT(/{
/.*,.*,.*, */{
s///
s/[][]//g
s/)$//
/^AC_INIT(\[*/{
s///
/^[^,]*,[^,]*,[^,]*,[ []*\([^][ ,)]\)/{
s//\1/
s/[],)].*//
p
q
}
s/AC_INIT(\[*//
s/]*,.*//
s/[],)].*//
s/^GNU //
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
s/[^A-Za-z0-9_]/-/g
s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g
p
}
'

View File

@ -71,6 +71,7 @@ listen
localeconv
maintainer-makefile
manywarnings
mkdtemp
mkostemp
mkostemps
mktempd

View File

@ -1,6 +1,7 @@
#!/usr/bin/perl
#
# bracket-spacing.pl: Report any usage of 'function (..args..)'
# Also check for other syntax issues, such as correct use of ';'
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@ -31,8 +32,11 @@ foreach my $file (@ARGV) {
while (defined (my $line = <FILE>)) {
my $data = $line;
# Kill any quoted strongs
$data =~ s,".*?","XXX",g;
# Kill any quoted ; or "
$data =~ s,'[";]','X',g;
# Kill any quoted strings
$data =~ s,"([^\\\"]|\\.)*","XXX",g;
# Kill any C++ style comments
$data =~ s,//.*$,//,;
@ -109,6 +113,30 @@ foreach my $file (@ARGV) {
$ret = 1;
last;
}
# Forbid whitespace before ";". Things like below are allowed:
#
# 1) The expression is empty for "for" loop. E.g.
# for (i = 0; ; i++)
#
# 2) An empty statement. E.g.
# while (write(statuswrite, &status, 1) == -1 &&
# errno == EINTR)
# ;
#
while ($data =~ /[^;\s]\s+;/) {
print "$file:$.: $line";
$ret = 1;
last;
}
# Require EOL, macro line continuation, or whitespace after ";".
# Allow "for (;;)" as an exception.
while ($data =~ /;[^ \\\n;)]/) {
print "$file:$.: $line";
$ret = 1;
last;
}
}
close FILE;
}

69
cfg.mk
View File

@ -165,6 +165,7 @@ useless_free_options = \
--name=virNodeDeviceObjFree \
--name=virObjectUnref \
--name=virObjectFreeCallback \
--name=virPCIDeviceFree \
--name=virSecretDefFree \
--name=virStorageEncryptionFree \
--name=virStorageEncryptionSecretFree \
@ -378,10 +379,19 @@ sc_prohibit_strtol:
$(_sc_search_regexp)
# Use virAsprintf rather than as'printf since *strp is undefined on error.
# But for plain %s, virAsprintf is overkill compared to strdup.
sc_prohibit_asprintf:
@prohibit='\<v?a[s]printf\>' \
halt='use virAsprintf, not as'printf \
$(_sc_search_regexp)
@prohibit='virAsprintf.*, *"%s",' \
halt='use VIR_STRDUP instead of virAsprintf with "%s"' \
$(_sc_search_regexp)
sc_prohibit_strdup:
@prohibit='\<strn?dup\> *\(' \
halt='use VIR_STRDUP, not strdup' \
$(_sc_search_regexp)
# Prefer virSetUIDGID.
sc_prohibit_setuid:
@ -440,6 +450,11 @@ sc_prohibit_nonreentrant:
done ; \
exit $$fail
sc_prohibit_select:
@prohibit="\\<select *\\(" \
halt="use poll(), not se""lect()" \
$(_sc_search_regexp)
# Prohibit the inclusion of <ctype.h>.
sc_prohibit_ctype_h:
@prohibit='^# *include *<ctype\.h>' \
@ -486,6 +501,11 @@ sc_prohibit_virBufferAdd_with_string_literal:
halt='use virBufferAddLit, not virBufferAdd, with a string literal' \
$(_sc_search_regexp)
sc_prohibit_virBufferAsprintf_with_string_literal:
@prohibit='\<virBufferAsprintf *\([^,]+, *"([^%"\]|\\.|%%)*"\)' \
halt='use virBufferAddLit, not virBufferAsprintf, with a string literal' \
$(_sc_search_regexp)
# Not only do they fail to deal well with ipv6, but the gethostby*
# functions are also not thread-safe.
sc_prohibit_gethostby:
@ -668,11 +688,22 @@ sc_copyright_format:
$(_sc_search_regexp)
# Prefer the new URL listing over the old street address listing when
# calling out where to get a copy of the [L]GPL.
sc_copyright_address:
# calling out where to get a copy of the [L]GPL. Also, while we have
# to ship COPYING (GPL) alongside COPYING.LESSER (LGPL), we want any
# source file that calls out a top-level file to call out the LGPL
# version. Note that our typical copyright boilerplate refers to the
# license by name, not by reference to a top-level file.
sc_copyright_usage:
@prohibit=Boston,' MA' \
halt='Point to <http://www.gnu.org/licenses/>, not an address' \
$(_sc_search_regexp)
@require='COPYING\.LESSER' \
containing='COPYING' \
halt='Refer to COPYING.LESSER for LGPL' \
$(_sc_search_regexp)
@prohibit='COPYING\.LIB' \
halt='Refer to COPYING.LESSER for LGPL' \
$(_sc_search_regexp)
# Some functions/macros produce messages intended solely for developers
# and maintainers. Do not mark them for translation.
@ -749,7 +780,7 @@ sc_prohibit_duplicate_header:
}' $$i || fail=1; \
done; \
if test $$fail -eq 1; then \
{ echo "$(ME)": avoid duplicate headers >&2; exit 1; } \
{ echo '$(ME): avoid duplicate headers' 1>&2; exit 1; } \
fi;
# Don't include "libvirt/*.h" in "" form.
@ -767,6 +798,15 @@ sc_prohibit_include_public_headers_brackets:
halt='Do not include libvirt/*.h in internal source' \
$(_sc_search_regexp)
# <config.h> is only needed in .c files; .h files do not need it since
# .c files must include config.h before any other .h.
sc_prohibit_config_h_in_headers:
@prohibit='^# *include\>.*config\.h' \
in_vc_files='\.h$$' \
halt='headers should not include <config.h>' \
$(_sc_search_regexp)
# We don't use this feature of maint.mk.
prev_version_file = /dev/null
@ -815,7 +855,8 @@ syntax-check: $(top_srcdir)/HACKING bracket-spacing-check
bracket-spacing-check:
$(AM_V_GEN)files=`$(VC_LIST) | grep '\.c$$'`; \
$(PERL) $(top_srcdir)/build-aux/bracket-spacing.pl $$files || \
(echo $(ME): incorrect whitespace around brackets, see HACKING for rules && exit 1)
{ echo '$(ME): incorrect whitespace, see HACKING for rules' 1>&2; \
exit 1; }
# sc_po_check can fail if generated files are not built first
sc_po_check: \
@ -832,15 +873,15 @@ $(srcdir)/src/remote/remote_client_bodies.h: $(srcdir)/src/remote/remote_protoco
# List all syntax-check exemptions:
exclude_file_name_regexp--sc_avoid_strcase = ^tools/virsh\.h$$
_src1=libvirt|fdstream|qemu/qemu_monitor|util/(vircommand|virutil)|xen/xend_internal|rpc/virnetsocket|lxc/lxc_controller|locking/lock_daemon
_src1=libvirt|fdstream|qemu/qemu_monitor|util/(vircommand|virfile)|xen/xend_internal|rpc/virnetsocket|lxc/lxc_controller|locking/lock_daemon
_test1=shunloadtest|virnettlscontexttest|vircgroupmock
exclude_file_name_regexp--sc_avoid_write = \
^(src/($(_src1))|daemon/libvirtd|tools/console|tests/($(_test1)))\.c$$
exclude_file_name_regexp--sc_bindtextdomain = ^(tests|examples)/
exclude_file_name_regexp--sc_copyright_address = \
^COPYING\.LIB$$
exclude_file_name_regexp--sc_copyright_usage = \
^COPYING(|\.LESSER)$$
exclude_file_name_regexp--sc_flags_usage = ^(docs/|src/util/virnetdevtap\.c$$|tests/vircgroupmock\.c$$)
@ -858,7 +899,10 @@ exclude_file_name_regexp--sc_prohibit_always_true_header_tests = \
^python/(libvirt-(lxc-|qemu-)?override|typewrappers)\.c$$
exclude_file_name_regexp--sc_prohibit_asprintf = \
^(bootstrap.conf$$|src/util/virutil\.c$$|examples/domain-events/events-c/event-test\.c$$|tests/vircgroupmock\.c$$)
^(bootstrap.conf$$|src/util/virstring\.c$$|examples/domain-events/events-c/event-test\.c$$|tests/vircgroupmock\.c$$)
exclude_file_name_regexp--sc_prohibit_strdup = \
^(docs/|examples/|python/|src/util/virstring\.c$$)
exclude_file_name_regexp--sc_prohibit_close = \
(\.p[yl]$$|^docs/|^(src/util/virfile\.c|src/libvirt\.c|tests/vircgroupmock\.c)$$)
@ -892,7 +936,7 @@ exclude_file_name_regexp--sc_prohibit_setuid = ^src/util/virutil\.c$$
exclude_file_name_regexp--sc_prohibit_sprintf = \
^(docs/hacking\.html\.in)|(examples/systemtap/.*stp)|(src/dtrace2systemtap\.pl)|(src/rpc/gensystemtap\.pl)$$
exclude_file_name_regexp--sc_prohibit_strncpy = ^src/util/virutil\.c$$
exclude_file_name_regexp--sc_prohibit_strncpy = ^src/util/virstring\.c$$
exclude_file_name_regexp--sc_prohibit_strtol = \
^src/(util/virsexpr|(vbox|xen|xenxs)/.*)\.c$$
@ -903,10 +947,11 @@ exclude_file_name_regexp--sc_prohibit_xmlURI = ^src/util/viruri\.c$$
exclude_file_name_regexp--sc_prohibit_return_as_function = \.py$$
_virsh_includes=(edit|domain-monitor|domain|volume|pool|network|interface|nwfilter|secret|snapshot|host|nodedev)
exclude_file_name_regexp--sc_require_config_h = ^(examples/|tools/virsh-$(_virsh_includes)\.c$$)
exclude_file_name_regexp--sc_require_config_h = \
^(examples/|tools/virsh-edit\.c$$)
exclude_file_name_regexp--sc_require_config_h_first = ^(examples/|tools/virsh-$(_virsh_includes)\.c$$)
exclude_file_name_regexp--sc_require_config_h_first = \
^(examples/|tools/virsh-edit\.c$$)
exclude_file_name_regexp--sc_trailing_blank = \
(/qemuhelpdata/|/sysinfodata/.*\.data|\.(fig|gif|ico|png)$$)

View File

@ -1,9 +1,22 @@
dnl Process this file with autoconf to produce a configure script.
dnl Copyright (C) 2005-2013 Red Hat, Inc.
dnl See COPYING.LIB for the License of this software
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
dnl License as published by the Free Software Foundation; either
dnl version 2.1 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library. If not, see
dnl <http://www.gnu.org/licenses/>.
AC_INIT([libvirt], [1.0.5], [libvir-list@redhat.com], [], [http://libvirt.org])
AC_INIT([libvirt], [1.1.0], [libvir-list@redhat.com], [], [http://libvirt.org])
AC_CONFIG_SRCDIR([src/libvirt.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h])
@ -305,8 +318,6 @@ AC_PATH_PROG([DNSMASQ], [dnsmasq], [dnsmasq],
[/sbin:/usr/sbin:/usr/local/sbin:$PATH])
AC_PATH_PROG([RADVD], [radvd], [radvd],
[/sbin:/usr/sbin:/usr/local/sbin:$PATH])
AC_PATH_PROG([BRCTL], [brctl], [brctl],
[/sbin:/usr/sbin:/usr/local/sbin:$PATH])
AC_PATH_PROG([TC], [tc], [tc],
[/sbin:/usr/sbin:/usr/local/sbin:$PATH])
AC_PATH_PROG([UDEVADM], [udevadm], [],
@ -1090,6 +1101,15 @@ if test "x$with_gnutls" != "xno"; then
dnl it explicitly for the calls to gcry_control/check_version
GNUTLS_LIBS="$GNUTLS_LIBS -lgcrypt"
dnl We're not using gcrypt deprecated features so define
dnl GCRYPT_NO_DEPRECATED to avoid deprecated warnings
GNUTLS_CFLAGS="$GNUTLS_CFLAGS -DGCRYPT_NO_DEPRECATED"
dnl gnutls 3.x moved some declarations to a new header
AC_CHECK_HEADERS([gnutls/crypto.h], [], [], [[
#include <gnutls/gnutls.h>
]])
with_gnutls=yes
fi
@ -2154,7 +2174,7 @@ if test "$with_driver_modules" = "yes" || test "$with_driver_modules" = "check";
fi
if test "$with_driver_modules" = "yes" ; then
DRIVER_MODULE_CFLAGS="-export-dynamic"
DRIVER_MODULE_LDFLAGS="-export-dynamic"
case $ac_cv_search_dlopen in
no*) DRIVER_MODULE_LIBS= ;;
*) DRIVER_MODULE_LIBS=$ac_cv_search_dlopen ;;
@ -2162,7 +2182,7 @@ if test "$with_driver_modules" = "yes" ; then
AC_DEFINE_UNQUOTED([WITH_DRIVER_MODULES], 1, [whether to build drivers as modules])
fi
AM_CONDITIONAL([WITH_DRIVER_MODULES], [test "$with_driver_modules" != "no"])
AC_SUBST([DRIVER_MODULE_CFLAGS])
AC_SUBST([DRIVER_MODULE_LDFLAGS])
AC_SUBST([DRIVER_MODULE_LIBS])
@ -2371,13 +2391,24 @@ AC_CHECK_MEMBERS([struct ifreq.ifr_newname,
[#include <sys/socket.h>
#include <net/if.h>
])
# Check for BSD approach for setting MAC addr
AC_CHECK_DECLS([link_addr],
[], [],
[#include <sys/types.h>
#include <sys/socket.h>
#include <net/if_dl.h>
])
# Only COPYING.LIB is under version control, yet COPYING
# is included as part of the distribution tarball.
# Copy one to the other, but only if this is a srcdir-build.
# You are unlikely to be doing distribution-related things in a non-srcdir build
test "x$srcdir" = x. && ! test -f COPYING &&
cp -f COPYING.LIB COPYING
# Check for BSD approach for bridge management
AC_CHECK_DECLS([BRDGSFD, BRDGADD, BRDGDEL],
[AC_DEFINE([HAVE_BSD_BRIDGE_MGMT],
[1],
[whether BSD style bridge management is available])],
[],
[#include <net/if.h>
#include <net/ethernet.h>
#include <net/if_bridgevar.h>
])
# Detect when running under the clang static analyzer's scan-build driver
# or Coverity-prevent's cov-build. Define STATIC_ANALYSIS accordingly.

View File

@ -1,7 +1,20 @@
## Process this file with automake to produce Makefile.in
## Copyright (C) 2005-2013 Red Hat, Inc.
## See COPYING.LIB for the License of this software
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
##
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public
## License along with this library. If not, see
## <http://www.gnu.org/licenses/>.
INCLUDES = \
-I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib \
@ -11,6 +24,7 @@ INCLUDES = \
-I$(top_srcdir)/src/conf \
-I$(top_srcdir)/src/rpc \
-I$(top_srcdir)/src/remote \
-I$(top_srcdir)/src/access \
$(GETTEXT_CPPFLAGS)
CLEANFILES =
@ -111,7 +125,6 @@ libvirtd_CFLAGS = \
-DQEMUD_PID_FILE="\"$(QEMUD_PID_FILE)\""
libvirtd_LDFLAGS = \
$(WARN_LDFLAGS) \
$(PIE_LDFLAGS) \
$(RELRO_LDFLAGS) \
$(COVERAGE_LDFLAGS)
@ -156,6 +169,10 @@ if WITH_UML
libvirtd_LDADD += ../src/libvirt_driver_uml.la
endif
if WITH_VBOX
libvirtd_LDADD += ../src/libvirt_driver_vbox.la
endif
if WITH_STORAGE
libvirtd_LDADD += ../src/libvirt_driver_storage.la
endif

View File

@ -32,6 +32,8 @@
#include "configmake.h"
#include "remote/remote_protocol.h"
#include "remote/remote_driver.h"
#include "virstring.h"
#include "virutil.h"
#define VIR_FROM_THIS VIR_FROM_CONF
@ -57,15 +59,11 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
key);
return -1;
}
list[0] = strdup(p->str);
list[1] = NULL;
if (list[0] == NULL) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("failed to allocate memory for %s config list value"),
key);
if (VIR_STRDUP(list[0], p->str) < 0) {
VIR_FREE(list);
return -1;
}
list[1] = NULL;
break;
case VIR_CONF_LIST: {
@ -88,15 +86,11 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
VIR_FREE(list);
return -1;
}
list[i] = strdup(pp->str);
if (list[i] == NULL) {
if (VIR_STRDUP(list[i], pp->str) < 0) {
int j;
for (j = 0 ; j < i ; j++)
for (j = 0; j < i; j++)
VIR_FREE(list[j]);
VIR_FREE(list);
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("failed to allocate memory for %s config list value"),
key);
return -1;
}
@ -134,8 +128,8 @@ checkType(virConfValuePtr p, const char *filename,
}
/* If there is no config data for the key, #var_name, then do nothing.
If there is valid data of type VIR_CONF_STRING, and strdup succeeds,
store the result in var_name. Otherwise, (i.e. invalid type, or strdup
If there is valid data of type VIR_CONF_STRING, and VIR_STRDUP succeeds,
store the result in var_name. Otherwise, (i.e. invalid type, or VIR_STRDUP
failure), give a diagnostic and "goto" the cleanup-and-fail label. */
#define GET_CONF_STR(conf, filename, var_name) \
do { \
@ -144,10 +138,8 @@ checkType(virConfValuePtr p, const char *filename,
if (checkType(p, filename, #var_name, VIR_CONF_STRING) < 0) \
goto error; \
VIR_FREE(data->var_name); \
if (!(data->var_name = strdup(p->str))) { \
virReportOOMError(); \
if (VIR_STRDUP(data->var_name, p->str) < 0) \
goto error; \
} \
} \
} while (0)
@ -198,8 +190,8 @@ int
daemonConfigFilePath(bool privileged, char **configfile)
{
if (privileged) {
if (!(*configfile = strdup(SYSCONFDIR "/libvirt/libvirtd.conf")))
goto no_memory;
if (VIR_STRDUP(*configfile, SYSCONFDIR "/libvirt/libvirtd.conf") < 0)
goto error;
} else {
char *configdir = NULL;
@ -236,10 +228,9 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
data->listen_tls = 1;
data->listen_tcp = 0;
if (!(data->tls_port = strdup(LIBVIRTD_TLS_PORT)))
goto no_memory;
if (!(data->tcp_port = strdup(LIBVIRTD_TCP_PORT)))
goto no_memory;
if (VIR_STRDUP(data->tls_port, LIBVIRTD_TLS_PORT) < 0 ||
VIR_STRDUP(data->tcp_port, LIBVIRTD_TCP_PORT) < 0)
goto error;
/* Only default to PolicyKit if running as root */
#if WITH_POLKIT
@ -254,14 +245,10 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
}
#endif
if (data->auth_unix_rw == REMOTE_AUTH_POLKIT)
data->unix_sock_rw_perms = strdup("0777"); /* Allow world */
else
data->unix_sock_rw_perms = strdup("0700"); /* Allow user only */
data->unix_sock_ro_perms = strdup("0777"); /* Always allow world */
if (!data->unix_sock_ro_perms ||
!data->unix_sock_rw_perms)
goto no_memory;
if (VIR_STRDUP(data->unix_sock_rw_perms,
data->auth_unix_rw == REMOTE_AUTH_POLKIT ? "0777" : "0700") < 0 ||
VIR_STRDUP(data->unix_sock_ro_perms, "0777") < 0)
goto error;
#if WITH_SASL
data->auth_tcp = REMOTE_AUTH_SASL;
@ -290,13 +277,13 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
data->keepalive_count = 5;
data->keepalive_required = 0;
localhost = virGetHostname(NULL);
localhost = virGetHostname();
if (localhost == NULL) {
/* we couldn't resolve the hostname; assume that we are
* running in disconnected operation, and report a less
* useful Avahi string
*/
ret = virAsprintf(&data->mdns_name, "Virtualization Host");
ret = VIR_STRDUP(data->mdns_name, "Virtualization Host");
} else {
char *tmp;
/* Extract the host part of the potentially FQDN */
@ -313,6 +300,7 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
no_memory:
virReportOOMError();
error:
daemonConfigFree(data);
return NULL;
}
@ -328,6 +316,12 @@ daemonConfigFree(struct daemonConfig *data)
VIR_FREE(data->listen_addr);
VIR_FREE(data->tls_port);
VIR_FREE(data->tcp_port);
tmp = data->access_drivers;
while (tmp && *tmp) {
VIR_FREE(*tmp);
tmp++;
}
VIR_FREE(data->access_drivers);
VIR_FREE(data->unix_sock_ro_perms);
VIR_FREE(data->unix_sock_rw_perms);
@ -380,10 +374,8 @@ daemonConfigLoadOptions(struct daemonConfig *data,
*/
if (data->auth_unix_rw == REMOTE_AUTH_POLKIT) {
VIR_FREE(data->unix_sock_rw_perms);
if (!(data->unix_sock_rw_perms = strdup("0777"))) {
virReportOOMError();
if (VIR_STRDUP(data->unix_sock_rw_perms, "0777") < 0)
goto error;
}
}
#endif
if (remoteConfigGetAuth(conf, "auth_unix_ro", &data->auth_unix_ro, filename) < 0)
@ -393,6 +385,10 @@ daemonConfigLoadOptions(struct daemonConfig *data,
if (remoteConfigGetAuth(conf, "auth_tls", &data->auth_tls, filename) < 0)
goto error;
if (remoteConfigGetStringList(conf, "access_drivers",
&data->access_drivers, filename) < 0)
goto error;
GET_CONF_STR(conf, filename, unix_sock_group);
GET_CONF_STR(conf, filename, unix_sock_ro_perms);
GET_CONF_STR(conf, filename, unix_sock_rw_perms);

View File

@ -45,6 +45,8 @@ struct daemonConfig {
int auth_tcp;
int auth_tls;
char **access_drivers;
int mdns_adv;
char *mdns_name;

View File

@ -51,6 +51,7 @@ module Libvirtd =
| bool_entry "tls_no_sanity_certificate"
| str_array_entry "tls_allowed_dn_list"
| str_array_entry "sasl_allowed_username_list"
| str_array_entry "access_drivers"
let processing_entry = int_entry "min_workers"
| int_entry "max_workers"

View File

@ -43,7 +43,6 @@
#include "libvirtd.h"
#include "libvirtd-config.h"
#include "virutil.h"
#include "viruuid.h"
#include "remote_driver.h"
#include "viralloc.h"
@ -53,7 +52,9 @@
#include "remote.h"
#include "virhook.h"
#include "viraudit.h"
#include "virstring.h"
#include "locking/lock_manager.h"
#include "viraccessmanager.h"
#ifdef WITH_DRIVER_MODULES
# include "driver.h"
@ -73,6 +74,9 @@
# ifdef WITH_UML
# include "uml/uml_driver.h"
# endif
# ifdef WITH_VBOX
# include "vbox/vbox_driver.h"
# endif
# ifdef WITH_NETWORK
# include "network/bridge_driver.h"
# endif
@ -241,8 +245,8 @@ daemonPidFilePath(bool privileged,
char **pidfile)
{
if (privileged) {
if (!(*pidfile = strdup(LOCALSTATEDIR "/run/libvirtd.pid")))
goto no_memory;
if (VIR_STRDUP(*pidfile, LOCALSTATEDIR "/run/libvirtd.pid") < 0)
goto error;
} else {
char *rundir = NULL;
mode_t old_umask;
@ -287,10 +291,9 @@ daemonUnixSocketPaths(struct daemonConfig *config,
goto no_memory;
} else {
if (privileged) {
if (!(*sockfile = strdup(LOCALSTATEDIR "/run/libvirt/libvirt-sock")))
goto no_memory;
if (!(*rosockfile = strdup(LOCALSTATEDIR "/run/libvirt/libvirt-sock-ro")))
goto no_memory;
if (VIR_STRDUP(*sockfile, LOCALSTATEDIR "/run/libvirt/libvirt-sock") < 0 ||
VIR_STRDUP(*rosockfile, LOCALSTATEDIR "/run/libvirt/libvirt-sock-ro") < 0)
goto error;
} else {
char *rundir = NULL;
mode_t old_umask;
@ -401,6 +404,9 @@ static void daemonInitialize(void)
# ifdef WITH_UML
virDriverLoadModule("uml");
# endif
# ifdef WITH_VBOX
virDriverLoadModule("vbox");
# endif
#else
# ifdef WITH_NETWORK
networkRegister();
@ -435,6 +441,9 @@ static void daemonInitialize(void)
# ifdef WITH_UML
umlRegister();
# endif
# ifdef WITH_VBOX
vboxRegister();
# endif
#endif
}
@ -720,6 +729,26 @@ error:
}
static int
daemonSetupAccessManager(struct daemonConfig *config)
{
virAccessManagerPtr mgr;
const char *none[] = { "none", NULL };
const char **driver = (const char **)config->access_drivers;
if (!driver ||
!driver[0])
driver = none;
if (!(mgr = virAccessManagerNewStack(driver)))
return -1;
virAccessManagerSetDefault(mgr);
virObjectUnref(mgr);
return 0;
}
/* Display version information. */
static void
daemonVersion(const char *argv0)
@ -864,6 +893,9 @@ handleSystemMessageFunc(DBusConnection *connection ATTRIBUTE_UNUSED,
static void daemonRunStateInit(void *opaque)
{
virNetServerPtr srv = opaque;
virIdentityPtr sysident = virIdentityGetSystem();
virIdentitySetCurrent(sysident);
/* Since driver initialization can take time inhibit daemon shutdown until
we're done so clients get a chance to connect */
@ -906,6 +938,8 @@ static void daemonRunStateInit(void *opaque)
cleanup:
daemonInhibitCallback(false, srv);
virObjectUnref(srv);
virObjectUnref(sysident);
virIdentitySetCurrent(NULL);
}
static int daemonStateInit(virNetServerPtr srv)
@ -961,7 +995,8 @@ static int migrateProfile(void)
config_home = getenv("XDG_CONFIG_HOME");
if (config_home && config_home[0] != '\0') {
xdg_dir = strdup(config_home);
if (VIR_STRDUP(xdg_dir, config_home) < 0)
goto cleanup;
} else {
if (virAsprintf(&xdg_dir, "%s/.config", home) < 0) {
goto cleanup;
@ -1172,7 +1207,7 @@ int main(int argc, char **argv) {
case 'p':
VIR_FREE(pid_file);
if (!(pid_file = strdup(optarg))) {
if (VIR_STRDUP_QUIET(pid_file, optarg) < 0) {
VIR_ERROR(_("Can't allocate memory"));
exit(EXIT_FAILURE);
}
@ -1180,7 +1215,7 @@ int main(int argc, char **argv) {
case 'f':
VIR_FREE(remote_config_file);
if (!(remote_config_file = strdup(optarg))) {
if (VIR_STRDUP_QUIET(remote_config_file, optarg) < 0) {
VIR_ERROR(_("Can't allocate memory"));
exit(EXIT_FAILURE);
}
@ -1251,6 +1286,11 @@ int main(int argc, char **argv) {
exit(EXIT_FAILURE);
}
if (daemonSetupAccessManager(config) < 0) {
VIR_ERROR(_("Can't initialize access manager"));
exit(EXIT_FAILURE);
}
if (!pid_file &&
daemonPidFilePath(privileged,
&pid_file) < 0) {
@ -1287,7 +1327,10 @@ int main(int argc, char **argv) {
/* Ensure the rundir exists (on tmpfs on some systems) */
if (privileged) {
run_dir = strdup(LOCALSTATEDIR "/run/libvirt");
if (VIR_STRDUP_QUIET(run_dir, LOCALSTATEDIR "/run/libvirt") < 0) {
VIR_ERROR(_("Can't allocate memory"));
goto cleanup;
}
} else {
run_dir = virGetUserRuntimeDirectory();
@ -1296,11 +1339,6 @@ int main(int argc, char **argv) {
goto cleanup;
}
}
if (!run_dir) {
virReportOOMError();
goto cleanup;
}
if (privileged)
old_umask = umask(022);
else

View File

@ -155,6 +155,15 @@
#auth_tls = "none"
# Change the API access control scheme
#
# By default an authenticated user is allowed access
# to all APIs. Access drivers can place restrictions
# on this. By default the 'nop' driver is enabled,
# meaning no access control checks are done once a
# client has authenticated with libvirtd
#
#access_drivers = [ "polkit" ]
#################################################################
#

View File

@ -1,7 +1,7 @@
/*
* libvirtd.h: daemon data structure definitions
*
* Copyright (C) 2006-2012 Red Hat, Inc.
* Copyright (C) 2006-2013 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@ -27,8 +27,6 @@
# define VIR_ENUM_SENTINELS
# include <config.h>
# include <rpc/types.h>
# include <rpc/xdr.h>
# include "remote_protocol.h"

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,9 @@ module Test_libvirtd =
{ "auth_unix_rw" = "none" }
{ "auth_tcp" = "sasl" }
{ "auth_tls" = "none" }
{ "access_drivers"
{ "1" = "polkit" }
}
{ "key_file" = "/etc/pki/libvirt/private/serverkey.pem" }
{ "cert_file" = "/etc/pki/libvirt/servercert.pem" }
{ "ca_file" = "/etc/pki/CA/cacert.pem" }

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>404 page not found</h1>

View File

@ -1,7 +1,20 @@
## Process this file with automake to produce Makefile.in
## Copyright (C) 2005-2012 Red Hat, Inc.
## See COPYING.LIB for the License of this software
## Copyright (C) 2005-2013 Red Hat, Inc.
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
##
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public
## License along with this library. If not, see
## <http://www.gnu.org/licenses/>.
SUBDIRS= schemas
@ -149,7 +162,7 @@ todo.html.in: todo.pl
|| { rm $@ && exit 1; }; \
else \
echo "Stubbing $@"; \
echo "<html><body><h1>Todo list</h1></body></html>" > $@ ; \
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\"><body><h1>Todo list unavailable: no config file</h1></body></html>" > $@ ; \
fi
todo:
@ -171,7 +184,7 @@ internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in
echo "Generating $@"; \
$(MKDIR_P) internals; \
name=`echo $@ | sed -e 's/.tmp//'`; \
$(XSLTPROC) --stringparam pagename $$name --nonet --html \
$(XSLTPROC) --stringparam pagename $$name --nonet \
$(top_srcdir)/docs/subsite.xsl $< > $@ \
|| { rm $@ && exit 1; }; fi
@ -179,7 +192,7 @@ internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in
@if [ -x $(XSLTPROC) ] ; then \
echo "Generating $@"; \
name=`echo $@ | sed -e 's/.tmp//'`; \
$(XSLTPROC) --stringparam pagename $$name --nonet --html \
$(XSLTPROC) --stringparam pagename $$name --nonet \
$(top_srcdir)/docs/site.xsl $< > $@ \
|| { rm $@ && exit 1; }; fi
@ -196,7 +209,7 @@ internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in
%.php.tmp: %.php.in site.xsl page.xsl sitemap.html.in
@if [ -x $(XSLTPROC) ] ; then \
echo "Generating $@"; \
$(XSLTPROC) --stringparam pagename $(@:.tmp=) --nonet --html \
$(XSLTPROC) --stringparam pagename $(@:.tmp=) --nonet \
$(top_srcdir)/docs/site.xsl $< > $@ \
|| { rm $@ && exit 1; }; fi

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>The libvirt API concepts</h1>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Implementing a new API in Libvirt</h1>

View File

@ -64,9 +64,18 @@ ignored_functions = {
"virDomainMigrateConfirm3": "private function for migration",
"virDomainMigratePrepareTunnel3": "private function for tunnelled migration",
"DllMain": "specific function for Win32",
"virTypedParameterArrayValidate": "internal function in virtypedparam.c",
"virTypedParamsValidate": "internal function in virtypedparam.c",
"virTypedParameterAssign": "internal function in virtypedparam.c",
"virTypedParameterAssignFromStr": "internal function in virtypedparam.c",
"virTypedParameterToString": "internal function in virtypedparam.c",
"virTypedParamsCheck": "internal function in virtypedparam.c",
"virTypedParamsCopy": "internal function in virtypedparam.c",
"virDomainMigrateBegin3Params": "private function for migration",
"virDomainMigrateFinish3Params": "private function for migration",
"virDomainMigratePerform3Params": "private function for migration",
"virDomainMigratePrepare3Params": "private function for migration",
"virDomainMigrateConfirm3Params": "private function for migration",
"virDomainMigratePrepareTunnel3Params": "private function for tunnelled migration",
}
ignored_macros = {

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Applications using <strong>libvirt</strong></h1>
@ -202,6 +204,13 @@
<h2><a name="iaas">Infrastructure as a Service (IaaS)</a></h2>
<dl>
<dt><a href="http://cc1.ifj.edu.pl">Cracow Cloud One</a></dt>
<dd>The CC1 system provides a complete solution for Private
Cloud Computing. An intuitive web access interface with an
administration module and simple installation procedure make
it easy to benefit from private Cloud Computing technology.
</dd>
<dt><a href="http://www.emotivecloud.net">EMOTIVE Cloud</a></dt>
<dd>The EMOTIVE (Elastic Management Of Tasks In Virtualized
Environments) middleware allows executing tasks and providing
@ -340,6 +349,7 @@
<li>Shows you Systems Inventory (based on Facter) and
provides real time information about hosts status based on
Puppet reports.</li>
</ul>
</dd>
</dl>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Domain management architecture</h1>
</body>

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1 >libvirt architecture</h1>

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Network management architecture</h1>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Node device management architecture</h1>
</body>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Storage management architecture</h1>

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1 >Authentication &amp; access control</h1>
<p>

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1 >Bindings for other languages</h1>

View File

@ -1,11 +1,24 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Bug reporting</h1>
<ul id="toc"></ul>
<h2><a name="security">Security Issues</a></h2>
<p>
If you think that an issue with libvirt may have security
implications, <strong>please do not</strong> publically
report it in the bug tracker, mailing lists, or irc. Libvirt
has <a href="securityprocess.html">a dedicated process for handling (potential) security issues</a>
that should be used instead. So if your issue has security
implications, ignore the rest of this page and follow the
<a href="securityprocess.html">security process</a> instead.
</p>
<h2><a name="bugzilla">Bug Tracking</a></h2>
<p>

285
docs/cgroups.html.in Normal file
View File

@ -0,0 +1,285 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Control Groups Resource Management</h1>
<ul id="toc"></ul>
<p>
The QEMU and LXC drivers make use of the Linux "Control Groups" facility
for applying resource management to their virtual machines and containers.
</p>
<h2><a name="requiredControllers">Required controllers</a></h2>
<p>
The control groups filesystem supports multiple "controllers". By default
the init system (such as systemd) should mount all controllers compiled
into the kernel at <code>/sys/fs/cgroup/$CONTROLLER-NAME</code>. Libvirt
will never attempt to mount any controllers itself, merely detect where
they are mounted.
</p>
<p>
The QEMU driver is capable of using the <code>cpuset</code>,
<code>cpu</code>, <code>memory</code>, <code>blkio</code> and
<code>devices</code> controllers. None of them are compulsory.
If any controller is not mounted, the resource management APIs
which use it will cease to operate. It is possible to explicitly
turn off use of a controller, even when mounted, via the
<code>/etc/libvirt/qemu.conf</code> configuration file.
</p>
<p>
The LXC driver is capable of using the <code>cpuset</code>,
<code>cpu</code>, <code>cpuset</code>, <code>freezer</code>,
<code>memory</code>, <code>blkio</code> and <code>devices</code>
controllers. The <code>cpuset</code>, <code>devices</code>
and <code>memory</code> controllers are compulsory. Without
them mounted, no containers can be started. If any of the
other controllers are not mounted, the resource management APIs
which use them will cease to operate.
</p>
<h2><a name="currentLayout">Current cgroups layout</a></h2>
<p>
As of libvirt 1.0.5 or later, the cgroups layout created by libvirt has been
simplified, in order to facilitate the setup of resource control policies by
administrators / management applications. The layout is based on the concepts of
"partitions" and "consumers". Each virtual machine or container is a consumer,
and has a corresponding cgroup named <code>$VMNAME.libvirt-{qemu,lxc}</code>.
Each consumer is associated with exactly one partition, which also have a
corresponding cgroup usually named <code>$PARTNAME.partition</code>. The
exceptions to this naming rule are the three top level default partitions,
named <code>/system</code> (for system services), <code>/user</code> (for
user login sessions) and <code>/machine</code> (for virtual machines and
containers). By default every consumer will of course be associated with
the <code>/machine</code> partition. This leads to a hierarchy that looks
like
</p>
<pre>
$ROOT
|
+- system
| |
| +- libvirtd.service
|
+- machine
|
+- vm1.libvirt-qemu
| |
| +- emulator
| +- vcpu0
| +- vcpu1
|
+- vm2.libvirt-qemu
| |
| +- emulator
| +- vcpu0
| +- vcpu1
|
+- vm3.libvirt-qemu
| |
| +- emulator
| +- vcpu0
| +- vcpu1
|
+- container1.libvirt-lxc
|
+- container2.libvirt-lxc
|
+- container3.libvirt-lxc
</pre>
<p>
The default cgroups layout ensures that, when there is contention for
CPU time, it is shared equally between system services, user sessions
and virtual machines / containers. This prevents virtual machines from
locking the administrator out of the host, or impacting execution of
system services. Conversely, when there is no contention from
system services / user sessions, it is possible for virtual machines
to fully utilize the host CPUs.
</p>
<h2><a name="customPartiton">Using custom partitions</a></h2>
<p>
If there is a need to apply resource constraints to groups of
virtual machines or containers, then the single default
partition <code>/machine</code> may not be sufficiently
flexible. The administrator may wish to sub-divide the
default partition, for example into "testing" and "production"
partitions, and then assign each guest to a specific
sub-partition. This is achieved via a small element addition
to the guest domain XML config, just below the main <code>domain</code>
element
</p>
<pre>
...
&lt;resource&gt;
&lt;partition&gt;/machine/production&lt;/partition&gt;
&lt;/resource&gt;
...
</pre>
<p>
Libvirt will not auto-create the cgroups directory to back
this partition. In the future, libvirt / virsh will provide
APIs / commands to create custom partitions, but currently
this is left as an exercise for the administrator. For
example, given the XML config above, the admin would need
to create a cgroup named '/machine/production.partition'
</p>
<pre>
# cd /sys/fs/cgroup
# for i in blkio cpu,cpuacct cpuset devices freezer memory net_cls perf_event
do
mkdir $i/machine/production.partition
done
# for i in cpuset.cpus cpuset.mems
do
cat cpuset/machine/$i > cpuset/machine/production.partition/$i
done
</pre>
<p>
<strong>Note:</strong> the cgroups directory created as a ".partition"
suffix, but the XML config does not require this suffix.
</p>
<p>
<strong>Note:</strong> the ability to place guests in custom
partitions is only available with libvirt &gt;= 1.0.5, using
the new cgroup layout. The legacy cgroups layout described
later did not support customization per guest.
</p>
<h2><a name="resourceAPIs">Resource management APIs/commands</a></h2>
<p>
Since libvirt aims to provide an API which is portable across
hypervisors, the concept of cgroups is not exposed directly
in the API or XML configuration. It is considered to be an
internal implementation detail. Instead libvirt provides a
set of APIs for applying resource controls, which are then
mapped to corresponding cgroup tunables
</p>
<h3>Scheduler tuning</h3>
<p>
Parameters from the "cpu" controller are exposed via the
<code>schedinfo</code> command in virsh.
</p>
<pre>
# virsh schedinfo demo
Scheduler : posix
cpu_shares : 1024
vcpu_period : 100000
vcpu_quota : -1
emulator_period: 100000
emulator_quota : -1</pre>
<h3>Block I/O tuning</h3>
<p>
Parameters from the "blkio" controller are exposed via the
<code>bkliotune</code> command in virsh.
</p>
<pre>
# virsh blkiotune demo
weight : 500
device_weight : </pre>
<h3>Memory tuning</h3>
<p>
Parameters from the "memory" controller are exposed via the
<code>memtune</code> command in virsh.
</p>
<pre>
# virsh memtune demo
hard_limit : 580192
soft_limit : unlimited
swap_hard_limit: unlimited
</pre>
<h3>Network tuning</h3>
<p>
The <code>net_cls</code> is not currently used. Instead traffic
filter policies are set directly against individual virtual
network interfaces.
</p>
<h2><a name="legacyLayout">Legacy cgroups layout</a></h2>
<p>
Prior to libvirt 1.0.5, the cgroups layout created by libvirt was different
from that described above, and did not allow for administrator customization.
Libvirt used a fixed, 3-level hierarchy <code>libvirt/{qemu,lxc}/$VMNAME</code>
which was rooted at the point in the hierarchy where libvirtd itself was
located. So if libvirtd was placed at <code>/system/libvirtd.service</code>
by systemd, the groups for each virtual machine / container would be located
at <code>/system/libvirtd.service/libvirt/{qemu,lxc}/$VMNAME</code>. In addition
to this, the QEMU drivers further child groups for each vCPU thread and the
emulator thread(s). This leads to a hierarchy that looked like
</p>
<pre>
$ROOT
|
+- system
|
+- libvirtd.service
|
+- libvirt
|
+- qemu
| |
| +- vm1
| | |
| | +- emulator
| | +- vcpu0
| | +- vcpu1
| |
| +- vm2
| | |
| | +- emulator
| | +- vcpu0
| | +- vcpu1
| |
| +- vm3
| |
| +- emulator
| +- vcpu0
| +- vcpu1
|
+- lxc
|
+- container1
|
+- container2
|
+- container3
</pre>
<p>
Although current releases are much improved, historically the use of deep
hierarchies has had a significant negative impact on the kernel scalability.
The legacy libvirt cgroups layout highlighted these problems, to the detriment
of the performance of virtual machines and containers.
</p>
</body>
</html>

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1><a name="installation">libvirt Installation</a></h1>

View File

@ -1,10 +1,23 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Contacting the development team</h1>
<ul id="toc"></ul>
<h2><a name="security">Security Issues</a></h2>
<p>
If you think that an issue with libvirt may have security
implications, <strong>please do not</strong> publically
report it in the bug tracker, mailing lists, or irc. Libvirt
has <a href="securityprocess.html">a dedicated process for handling (potential) security issues</a>
that should be used instead. So if your issue has security
implications, ignore the rest of this page and follow the
<a href="securityprocess.html">security process</a> instead.
</p>
<h2><a name="email">Mailing lists</a></h2>
<p>

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>C# API bindings</h1>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Deployment</h1>

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>libvirt Application Development Guide</h1>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Documentation</h1>
</body>

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Downloads</h1>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Internal drivers</h1>

View File

@ -1,4 +1,7 @@
<html><body>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>VMware ESX hypervisor driver</h1>
<ul id="toc"></ul>
<p>

View File

@ -1,4 +1,7 @@
<html><body>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Microsoft Hyper-V hypervisor driver</h1>
<ul id="toc"></ul>
<p>

View File

@ -1,49 +1,102 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>LXC container driver</h1>
<ul id="toc"></ul>
<p>
The libvirt LXC driver manages "Linux Containers". Containers are sets of processes
with private namespaces which can (but don't always) look like separate machines, but
do not have their own OS. Here are two example configurations. The first is a very
light-weight "application container" which does not have its own root image.
The libvirt LXC driver manages "Linux Containers". At their simplest, containers
can just be thought of as a collection of processes, separated from the main
host processes via a set of resource namespaces and constrained via control
groups resource tunables. The libvirt LXC driver has no dependency on the LXC
userspace tools hosted on sourceforge.net. It directly utilizes the relevant
kernel features to build the container environment. This allows for sharing
of many libvirt technologies across both the QEMU/KVM and LXC drivers. In
particular sVirt for mandatory access control, auditing of operations,
integration with control groups and many other features.
</p>
<h2><a name="project">Project Links</a></h2>
<ul>
<li>
The <a href="http://lxc.sourceforge.net/">LXC</a> Linux
container system
</li>
</ul>
<h2>Cgroups Requirements</h2>
<h2><a name="cgroups">Control groups Requirements</a></h2>
<p>
The libvirt LXC driver requires that certain cgroups controllers are
mounted on the host OS. The minimum required controllers are 'cpuacct',
'memory' and 'devices', while recommended extra controllers are
'cpu', 'freezer' and 'blkio'. The /etc/cgconfig.conf &amp; cgconfig
init service used to mount cgroups at host boot time. To manually
mount them use:
In order to control the resource usage of processes inside containers, the
libvirt LXC driver requires that certain cgroups controllers are mounted on
the host OS. The minimum required controllers are 'cpuacct', 'memory' and
'devices', while recommended extra controllers are 'cpu', 'freezer' and
'blkio'. Libvirt will not mount the cgroups filesystem itself, leaving
this up to the init system to take care of. Systemd will do the right thing
in this respect, while for other init systems the <code>cgconfig</code>
init service will be required. For further information, consult the general
libvirt <a href="cgroups.html">cgroups documentation</a>.
</p>
<h2><a name="namespaces">Namespace requirements</a></h2>
<p>
In order to separate processes inside a container from those in the
primary "host" OS environment, the libvirt LXC driver requires that
certain kernel namespaces are compiled in. Libvirt currently requires
the 'mount', 'ipc', 'pid', and 'uts' namespaces to be available. If
separate network interfaces are desired, then the 'net' namespace is
required. In the near future, the 'user' namespace will optionally be
supported.
</p>
<p>
<strong>NOTE: In the absence of support for the 'user' namespace,
processes inside containers cannot be securely isolated from host
process without the use of a mandatory access control technology
such as SELinux or AppArmor.</strong>
</p>
<h2><a name="init">Default container setup</a></h2>
<h3><a name="cliargs">Command line arguments</a></h3>
<p>
When the container "init" process is started, it will typically
not be given any command line arguments (eg the equivalent of
the bootloader args visible in <code>/proc/cmdline</code>). If
any arguments are desired, then must be explicitly set in the
container XML configuration via one or more <code>initarg</code>
elements. For example, to run <code>systemd --unit emergency.service</code>
would use the following XML
</p>
<pre>
# mount -t cgroup cgroup /dev/cgroup -o cpuacct,memory,devices,cpu,freezer,blkio
&lt;os&gt;
&lt;type arch='x86_64'&gt;exe&lt;/type&gt;
&lt;init&gt;/bin/systemd&lt;/init&gt;
&lt;initarg&gt;--unit&lt;/initarg&gt;
&lt;initarg&gt;emergency.service&lt;/initarg&gt;
&lt;/os&gt;
</pre>
<p>
NB, the blkio controller in some kernels will not allow creation of nested
sub-directories which will prevent correct operation of the libvirt LXC
driver. On such kernels, it may be necessary to unmount the blkio controller.
</p>
<h2>Environment setup for the container init</h2>
<h3><a name="envvars">Environment variables</a></h3>
<p>
When the container "init" process is started, it will be given several useful
environment variables.
environment variables. The following standard environment variables are mandated
by <a href="http://www.freedesktop.org/wiki/Software/systemd/ContainerInterface">systemd container interface</a>
to be provided by all container technologies on Linux.
</p>
<dl>
<dt>container</dt>
<dd>The fixed string <code>libvirt-lxc</code> to identify libvirt as the creator</dd>
<dt>container_uuid</dt>
<dd>The UUID assigned to the container by libvirt</dd>
<dt>PATH</dt>
<dd>The fixed string <code>/bin:/usr/bin</code></dd>
<dt>TERM</dt>
<dd>The fixed string <code>linux</code></dd>
</dl>
<p>
In addition to the standard variables, the following libvirt specific
environment variables are also provided
</p>
<dl>
@ -52,9 +105,152 @@ environment variables.
<dt>LIBVIRT_LXC_UUID</dt>
<dd>The UUID assigned to the container by libvirt</dd>
<dt>LIBVIRT_LXC_CMDLINE</dt>
<dd>The unparsed command line arguments specified in the container configuration</dd>
<dd>The unparsed command line arguments specified in the container configuration.
Use of this is discouraged, in favour of passing arguments directly to the
container init process via the <code>initarg</code> config element.</dd>
</dl>
<h3><a name="fsmounts">Filesystem mounts</a></h3>
<p>
In the absence of any explicit configuration, the container will
inherit the host OS filesystem mounts. A number of mount points will
be made read only, or re-mounted with new instances to provide
container specific data. The following special mounts are setup
by libvirt
</p>
<ul>
<li><code>/dev</code> a new "tmpfs" pre-populated with authorized device nodes</li>
<li><code>/dev/pts</code> a new private "devpts" instance for console devices</li>
<li><code>/sys</code> the host "sysfs" instance remounted read-only</li>
<li><code>/proc</code> a new instance of the "proc" filesystem</li>
<li><code>/proc/sys</code> the host "/proc/sys" bind-mounted read-only</li>
<li><code>/sys/fs/selinux</code> the host "selinux" instance remounted read-only</li>
<li><code>/sys/fs/cgroup/NNNN</code> the host cgroups controllers bind-mounted to
only expose the sub-tree associated with the container</li>
<li><code>/proc/meminfo</code> a FUSE backed file reflecting memory limits of the container</li>
</ul>
<h3><a name="devnodes">Device nodes</a></h3>
<p>
The container init process will be started with <code>CAP_MKNOD</code>
capability removed and blocked from re-acquiring it. As such it will
not be able to create any device nodes in <code>/dev</code> or anywhere
else in its filesystems. Libvirt itself will take care of pre-populating
the <code>/dev</code> filesystem with any devices that the container
is authorized to use. The current devices that will be made available
to all containers are
</p>
<ul>
<li><code>/dev/zero</code></li>
<li><code>/dev/null</code></li>
<li><code>/dev/full</code></li>
<li><code>/dev/random</code></li>
<li><code>/dev/urandom</code></li>
<li><code>/dev/stdin</code> symlinked to <code>/proc/self/fd/0</code></li>
<li><code>/dev/stdout</code> symlinked to <code>/proc/self/fd/1</code></li>
<li><code>/dev/stderr</code> symlinked to <code>/proc/self/fd/2</code></li>
<li><code>/dev/fd</code> symlinked to <code>/proc/self/fd</code></li>
<li><code>/dev/ptmx</code> symlinked to <code>/dev/pts/ptmx</code></li>
<li><code>/dev/console</code> symlinked to <code>/dev/pts/0</code></li>
</ul>
<p>
In addition, for every console defined in the guest configuration,
a symlink will be created from <code>/dev/ttyN</code> symlinked to
the corresponding <code>/dev/pts/M</code> pseudo TTY device. The
first console will be <code>/dev/tty1</code>, with further consoles
numbered incrementally from there.
</p>
<p>
Further block or character devices will be made available to containers
depending on their configuration.
</p>
<!--
<h2>Container configuration</h2>
<h3>Init process</h3>
<h3>Console devices</h3>
<h3>Filesystem devices</h3>
<h3>Disk devices</h3>
<h3>Block devices</h3>
<h3>USB devices</h3>
<h3>Character devices</h3>
<h3>Network devices</h3>
-->
<h2>Container security</h2>
<h3>sVirt SELinux</h3>
<p>
In the absence of the "user" namespace being used, containers cannot
be considered secure against exploits of the host OS. The sVirt SELinux
driver provides a way to secure containers even when the "user" namespace
is not used. The cost is that writing a policy to allow execution of
arbitrary OS is not practical. The SELinux sVirt policy is typically
tailored to work with an simpler application confinement use case,
as provided by the "libvirt-sandbox" project.
</p>
<h3>Auditing</h3>
<p>
The LXC driver is integrated with libvirt's auditing subsystem, which
causes audit messages to be logged whenever there is an operation
performed against a container which has impact on host resources.
So for example, start/stop, device hotplug will all log audit messages
providing details about what action occurred and any resources
associated with it. There are the following 3 types of audit messages
</p>
<ul>
<li><code>VIRT_MACHINE_ID</code> - details of the SELinux process and
image security labels assigned to the container.</li>
<li><code>VIRT_CONTROL</code> - details of an action / operation
performed against a container. There are the following types of
operation
<ul>
<li><code>op=start</code> - a container has been started. Provides
the machine name, uuid and PID of the <code>libvirt_lxc</code>
controller process</li>
<li><code>op=init</code> - the init PID of the container has been
started. Provides the machine name, uuid and PID of the
<code>libvirt_lxc</code> controller process and PID of the
init process (in the host PID namespace)</li>
<li><code>op=stop</code> - a container has been stopped. Provides
the machine name, uuid</li>
</ul>
</li>
<li><code>VIRT_RESOURCE</code> - details of a host resource
associated with a container action.</li>
</ul>
<h3>Device access</h3>
<p>
All containers are launched with the CAP_MKNOD capability cleared
and removed from the bounding set. Libvirt will ensure that the
/dev filesystem is pre-populated with all devices that a container
is allowed to use. In addition, the cgroup "device" controller is
configured to block read/write/mknod from all devices except those
that a container is authorized to use.
</p>
<h2><a name="exconfig">Example configurations</a></h2>
<h3>Example config version 1</h3>
<p></p>
@ -119,21 +315,158 @@ debootstrap, whatever) under /opt/vm-1-root:
&lt;/domain&gt;
</pre>
<h2><a name="usage">Container usage / management</a></h2>
<p>
In both cases, you can define and start a container using:</p>
<pre>
virsh --connect lxc:/// define v1.xml
virsh --connect lxc:/// start vm1
</pre>
and then get a console using:
<pre>
virsh --connect lxc:/// console vm1
</pre>
<p>Now doing 'ps -ef' will only show processes in the container, for
instance. You can undefine it using
As with any libvirt virtualization driver, LXC containers can be
managed via a wide variety of libvirt based tools. At the lowest
level the <code>virsh</code> command can be used to perform many
tasks, by passing the <code>-c lxc:///</code> argument. As an
alternative to repeating the URI with every command, the <code>LIBVIRT_DEFAULT_URI</code>
environment variable can be set to <code>lxc:///</code>. The
examples that follow outline some common operations with virsh
and LXC. For further details about usage of virsh consult its
manual page.
</p>
<h3><a name="usageSave">Defining (saving) container configuration></a></h3>
<p>
The <code>virsh define</code> command takes an XML configuration
document and loads it into libvirt, saving the configuration on disk
</p>
<pre>
virsh --connect lxc:/// undefine vm1
# virsh -c lxc:/// define myguest.xml
</pre>
<h3><a name="usageView">Viewing container configuration</a></h3>
<p>
The <code>virsh dumpxml</code> command can be used to view the
current XML configuration of a container. By default the XML
output reflects the current state of the container. If the
container is running, it is possible to explicitly request the
persistent configuration, instead of the current live configuration
using the <code>--inactive</code> flag
</p>
<pre>
# virsh -c lxc:/// dumpxml myguest
</pre>
<h3><a name="usageStart">Starting containers</a></h3>
<p>
The <code>virsh start</code> command can be used to start a
container from a previously defined persistent configuration
</p>
<pre>
# virsh -c lxc:/// start myguest
</pre>
<p>
It is also possible to start so called "transient" containers,
which do not require a persistent configuration to be saved
by libvirt, using the <code>virsh create</code> command.
</p>
<pre>
# virsh -c lxc:/// create myguest.xml
</pre>
<h3><a name="usageStop">Stopping containers</a></h3>
<p>
The <code>virsh shutdown</code> command can be used
to request a graceful shutdown of the container. By default
this command will first attempt to send a message to the
init process via the <code>/dev/initctl</code> device node.
If no such device node exists, then it will send SIGTERM
to PID 1 inside the container.
</p>
<pre>
# virsh -c lxc:/// shutdown myguest
</pre>
<p>
If the container does not respond to the graceful shutdown
request, it can be forceably stopped using the <code>virsh destroy</code>
</p>
<pre>
# virsh -c lxc:/// destroy myguest
</pre>
<h3><a name="usageReboot">Rebooting a container</a></h3>
<p>
The <code>virsh reboot</code> command can be used
to request a graceful shutdown of the container. By default
this command will first attempt to send a message to the
init process via the <code>/dev/initctl</code> device node.
If no such device node exists, then it will send SIGHUP
to PID 1 inside the container.
</p>
<pre>
# virsh -c lxc:/// reboot myguest
</pre>
<h3><a name="usageDelete">Undefining (deleting) a container configuration</a></h3>
<p>
The <code>virsh undefine</code> command can be used to delete the
persistent configuration of a container. If the guest is currently
running, this will turn it into a "transient" guest.
</p>
<pre>
# virsh -c lxc:/// undefine myguest
</pre>
<h3><a name="usageConnect">Connecting to a container console</a></h3>
<p>
The <code>virsh console</code> command can be used to connect
to the text console associated with a container. If the container
has been configured with multiple console devices, then the
<code>--devname</code> argument can be used to choose the
console to connect to
</p>
<pre>
# virsh -c lxc:/// console myguest
</pre>
<h3><a name="usageEnter">Running commands in a container</a></h3>
<p>
The <code>virsh lxc-enter-namespace</code> command can be used
to enter the namespaces and security context of a container
and then execute an arbitrary command.
</p>
<pre>
# virsh -c lxc:/// lxc-enter-namespace myguest -- /bin/ls -al /dev
</pre>
<h3><a name="usageTop">Monitoring container utilization</a></h3>
<p>
The <code>virt-top</code> command can be used to monitor the
activity and resource utilization of all containers on a
host
</p>
<pre>
# virt-top -c lxc:///
</pre>
</body>
</html>

View File

@ -1,4 +1,6 @@
<html> <!-- -*- html -*- -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>OpenVZ container driver</h1>

View File

@ -1,4 +1,7 @@
<html><body>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Parallels Cloud Server driver</h1>
<ul id="toc"></ul>
<p>

View File

@ -1,4 +1,7 @@
<html><body>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>IBM PowerVM hypervisor driver (phyp)</h1>
<ul id="toc"></ul>
<p>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>KVM/QEMU hypervisor driver</h1>
@ -17,6 +19,7 @@
<li>
The <a href="http://www.linux-kvm.org/">KVM</a> Linux
hypervisor
</li>
<li>
The <a href="http://wiki.qemu.org/Index.html">QEMU</a> emulator
</li>
@ -557,6 +560,7 @@ $ virsh domxml-to-native qemu-argv demo.xml
possible to add an element <code>&lt;qemu:commandline&gt;</code>
under <code>driver</code>, with the following sub-elements
repeated as often as needed:
</p>
<dl>
<dt><code>qemu:arg</code></dt>
<dd>Add an additional command-line argument to the qemu
@ -569,7 +573,6 @@ $ virsh domxml-to-native qemu-argv demo.xml
pair recorded in the attributes <code>name</code>
and optional <code>value</code>.</dd>
</dl>
<p>Example:</p><pre>
&lt;domain type='qemu' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'&gt;
&lt;name&gt;QEmu-fedora-i686&lt;/name&gt;

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Remote management driver</h1>
</body>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Test "mock" driver</h1>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>User Mode Linux driver</h1>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>VirtualBox hypervisor driver</h1>
<p>
@ -29,6 +31,18 @@ vbox+tcp://user@example.com/session (remote access, SASl/Kerberos)
vbox+ssh://user@example.com/session (remote access, SSH tunnelled)
</pre>
<p>
<strong>NOTE: as of libvirt 1.0.6, the VirtualBox driver will always
run inside the libvirtd daemon, instead of being built-in to the
libvirt.so library directly. This change was required due to the
fact that VirtualBox code is LGPLv2-only licensed, which is not
compatible with the libvirt.so license of LGPLv2-or-later. The
daemon will be auto-started when the first connection to VirtualBox
is requested. This change also means that it will not be possible
to use VirtualBox URIs on the Windows platform, until additional
work is completed to get the libvirtd daemon working there.</strong>
</p>
<h2><a name="xmlconfig">Example domain XML config</a></h2>
<pre>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>VMware Workstation / Player hypervisors driver</h1>
<p>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Xen hypervisor driver</h1>

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1 >Handling of errors</h1>
<p>The main goals of libvirt when it comes to error handling are:</p>

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1 >Firewall and network filtering in libvirt</h1>
<p>There are three pieces of libvirt functionality which do network

View File

@ -1,4 +1,5 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1 >XML Format</h1>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Driver capabilities XML format</h1>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Domain XML format</h1>
@ -144,7 +146,7 @@
configure in the desired way, which is why per-device boot elements
(see <a href="#elementsDisks">disks</a>,
<a href="#elementsNICS">network interfaces</a>, and
<a href="#elementsUSB">USB and PCI devices</a> sections below) were
<a href="#elementsHostDev">USB and PCI devices</a> sections below) were
introduced and they are the preferred way providing full control over
booting order. The <code>boot</code> element and per-device boot
elements are mutually exclusive. <span class="since">Since 0.1.3,
@ -182,6 +184,7 @@
again in case the boot fails (according to BIOS). The value is
in milliseconds with maximum of <code>65535</code> and special
value <code>-1</code> disables the reboot.
</dd>
</dl>
<h4><a name="elementsOSBootloader">Host bootloader</a></h4>
@ -305,7 +308,8 @@
&lt;/bios&gt;
&lt;system&gt;
&lt;entry name='manufacturer'&gt;Fedora&lt;/entry&gt;
&lt;entry name='vendor'&gt;Virt-Manager&lt;/entry&gt;
&lt;entry name='product'&gt;Virt-Manager&lt;/entry&gt;
&lt;entry name='version'&gt;0.9.4&lt;/entry&gt;
&lt;/system&gt;
&lt;/sysinfo&gt;
...</pre>
@ -329,17 +333,49 @@
<dl>
<dt><code>bios</code></dt>
<dd>
This is block 0 of SMBIOS, with entry names drawn from
"vendor", "version", "date", and "release".
This is block 0 of SMBIOS, with entry names drawn from:
<dl>
<dt><code>vendor</code></dt>
<dd>BIOS Vendor's Name</dd>
<dt><code>version</code></dt>
<dd>BIOS Version</dd>
<dt><code>date</code></dt>
<dd>BIOS release date. If supplied, is in either mm/dd/yy or
mm/dd/yyyy format. If the year portion of the string is
two digits, the year is assumed to be 19yy.</dd>
<dt><code>release</code></dt>
<dd>System BIOS Major and Minor release number values
concatenated together as one string separated by
a period, for example, 10.22.</dd>
</dl>
</dd>
<dt><code>system</code></dt>
<dd>
This is block 1 of SMBIOS, with entry names drawn from
"manufacturer", "product", "version", "serial", "uuid",
"sku", and "family". If a "uuid" entry is provided
alongside a
top-level <a href="#elementsMetadata"><code>uuid</code>
element</a>, the two values must match.
This is block 1 of SMBIOS, with entry names drawn from:
<dl>
<dt><code>manufacturer</code></dt>
<dd>Manufacturer of BIOS</dd>
<dt><code>product</code></dt>
<dd>Product Name</dd>
<dt><code>version</code></dt>
<dd>Version of the product</dd>
<dt><code>serial</code></dt>
<dd>Serial number</dd>
<dt><code>uuid</code></dt>
<dd>Universal Unique ID number. If this entry is provided
alongside a top-level
<a href="#elementsMetadata"><code>uuid</code></a> element,
then the two values must match.</dd>
<dt><code>sku</code></dt>
<dd>SKU number to identify a particular configuration.</dd>
<dt><code>family</code></dt>
<dd>Identify the family a particular computer belongs to.</dd>
</dl>
NB: Incorrectly supplied entries in either the <code>bios</code>
or <code>system</code> blocks will be ignored without error.
Other than <code>uuid</code> validation and <code>date</code>
format checking, all values are passed as strings to the
hypervisor driver.
</dd>
</dl>
</dd>
@ -558,17 +594,29 @@
...
&lt;memoryBacking&gt;
&lt;hugepages/&gt;
&lt;nosharepages/&gt;
&lt;locked/&gt;
&lt;/memoryBacking&gt;
...
&lt;/domain&gt;
</pre>
<p>The optional <code>memoryBacking</code> element may contain several
elements that influence how virtual memory pages are backed by host
pages.</p>
<dl>
<dt><code>memoryBacking</code></dt>
<dd>The optional <code>memoryBacking</code> element, may have an
<code>hugepages</code> element set within it. This tells the
hypervisor that the guest should have its memory allocated using
hugepages instead of the normal native page size.</dd>
<dt><code>hugepages</code></dt>
<dd>This tells the hypervisor that the guest should have its memory
allocated using hugepages instead of the normal native page size.</dd>
<dt><code>nosharepages</code></dt>
<dd>Instructs hypervisor to disable shared pages (memory merge, KSM) for
this domain. <span class="since">Since 1.0.6</span></dd>
<dt><code>locked</code></dt>
<dd>When set and supported by the hypervisor, memory pages belonging
to the domain will be locked in host's memory and the host will not
be allowed to swap them out.
<span class="since">Since 1.0.6</span></dd>
</dl>
@ -641,6 +689,7 @@
how to tune the performance of a NUMA host via controlling NUMA policy
for domain process. NB, only supported by QEMU driver.
<span class='since'>Since 0.9.3</span>
</dd>
<dt><code>memory</code></dt>
<dd>
The optional <code>memory</code> element specifies how to allocate memory
@ -957,7 +1006,13 @@
<p>
It is sometimes necessary to override the default actions taken
on various events.
on various events. Not all hypervisors support all events and actions.
The actions may be taken as a result of calls to libvirt APIs
<code class='docref'>virDomainReboot</code>,
<code class='docref'>virDomainShutdown</code>, or
<code class='docref'>virDomainShutdownFlags</code>.
Using <code>virsh reboot</code> or <code>virsh shutdown</code> would
also trigger the event.
</p>
<pre>
@ -994,20 +1049,29 @@
<dl>
<dt><code>destroy</code></dt>
<dd>The domain will be terminated completely and all resources
released</dd>
released.</dd>
<dt><code>restart</code></dt>
<dd>The domain will be terminated, and then restarted with
the same configuration</dd>
<dd>The domain will be terminated and then restarted with
the same configuration.</dd>
<dt><code>preserve</code></dt>
<dd>The domain will be terminated, and its resource preserved
<dd>The domain will be terminated and its resource preserved
to allow analysis.</dd>
<dt><code>rename-restart</code></dt>
<dd>The domain will be terminated, and then restarted with
a new name</dd>
<dd>The domain will be terminated and then restarted with
a new name.</dd>
</dl>
<p>
on_crash supports these additional
QEMU/KVM supports the <code>on_poweroff</code> and <code>on_reboot</code>
events handling the <code>destroy</code> and <code>restart</code> actions.
The <code>preserve</code> action for an <code>on_reboot</code> event
is treated as a <code>destroy</code> and the <code>rename-restart</code>
action for an <code>on_poweroff</code> event is treated as a
<code>restart</code> event.
</p>
<p>
The <code>on_crash</code> event supports these additional
actions <span class="since">since 0.8.4</span>.
</p>
@ -1083,6 +1147,8 @@
&lt;privnet/&gt;
&lt;hyperv&gt;
&lt;relaxed state='on'/&gt;
&lt;vapic state='on'/&gt;
&lt;spinlocks state='on' retries='4096'&lt;/spinlocks&gt;
&lt;/hyperv&gt;
&lt;/features&gt;
@ -1133,14 +1199,27 @@
<th>Feature</th>
<th>Description</th>
<th>Value</th>
<th>Since</th>
</tr>
<tr>
<td>relaxed</td>
<td>Relax contstraints on timers</td>
<td> on, off</td>
<td><span class="since">1.0.0 (QEMU only)</span></td>
</tr>
<tr>
<td>vapic</td>
<td>Enable virtual APIC</td>
<td>on, off</td>
<td><span class="since">1.1.0 (QEMU only)</span></td>
</tr>
<tr>
<td>spinlocks</td>
<td>Enable spinlock support</td>
<td>on, off; retries - at least 4095</td>
<td><span class="since">1.1.0 (QEMU only)</span></td>
</tr>
</table>
<span class="since">Since 1.0.0 (QEMU only)</span>
</dd>
</dl>
@ -1588,6 +1667,7 @@
<dd>The optional <code>write_iops_sec</code> element is the
write I/O operations per second.</dd>
</dl>
</dd>
<dt><code>driver</code></dt>
<dd>
The optional driver element allows specifying further details
@ -1676,6 +1756,14 @@
network. By default copy-on-read is off.
<span class='since'>Since 0.9.10 (QEMU and KVM only)</span>
</li>
<li>
The optional <code>discard</code> attribute controls whether
to discard (also known as "trim" or "unmap") requests are
ignored or passed to the filesystem. The value can be either
"unmap" (allow the discard request to be passed) or "ignore"
(ignore the discard request).
<span class='since'>Since 1.0.6 (QEMU and KVM only)</span>
</li>
</ul>
</dd>
<dt><code>boot</code></dt>
@ -1847,11 +1935,13 @@
OS. For Linux this would be the value returned by the
BLKSSZGET ioctl and describes the smallest units for disk
I/O.
</dd>
<dt><code>physical_block_size</code></dt>
<dd>The physical block size the disk will report to the guest
OS. For Linux this would be the value returned by the
BLKPBSZGET ioctl and describes the disk's hardware sector
size which can be relevant for the alignment of disk data.
</dd>
</dl>
</dd>
</dl>
@ -1876,6 +1966,13 @@
&lt;target dir='/import/from/host'/&gt;
&lt;readonly/&gt;
&lt;/filesystem&gt;
&lt;filesystem type='file' accessmode='passthrough'&gt;
&lt;driver name='loop' type='raw'/&gt;
&lt;driver type='path' wrpolicy='immediate'/&gt;
&lt;source file='/export/to/guest.img'/&gt;
&lt;target dir='/import/from/host'/&gt;
&lt;readonly/&gt;
&lt;/filesystem&gt;
...
&lt;/devices&gt;
...</pre>
@ -1967,6 +2064,24 @@
</dd>
<dt><code>driver</code></dt>
<dd>
The optional driver element allows specifying further details
related to the hypervisor driver used to provide the filesystem.
<span class="since">Since 1.0.6</span>
<ul>
<li>
If the hypervisor supports multiple backend drivers, then
the <code>type</code> attribute selects the primary
backend driver name, while the <code>format</code>
attribute provides the format type. For example, LXC
supports a type of "loop", with a format of "raw" or
"nbd" with any format. QEMU supports a type of "path"
or "handle", but no formats.
</li>
</ul>
</dd>
<dt><code>source</code></dt>
<dd>
The resource on the host that is being accessed in the guest. The
@ -2067,6 +2182,7 @@
additional attributes: <code>bus</code> (a 2-digit bus
number), and <code>slot</code> attribute (a 2-digit slot
within the bus). <span class="since">Since 0.8.8.</span>
</dd>
<dt><code>type='usb'</code></dt>
<dd>USB addresses have the following additional
attributes: <code>bus</code> (a hex value between 0 and 0xfff,
@ -2249,13 +2365,13 @@
<h4><a name="elementsHostDev">Host device assignment</a></h4>
<h5><a href="elementsHostDevSubsys">USB / PCI devices</a></h5>
<h5><a name="elementsHostDevSubsys">USB / PCI / SCSI devices</a></h5>
<p>
USB and PCI devices attached to the host can be passed through
USB, PCI and SCSI devices attached to the host can be passed through
to the guest using the <code>hostdev</code> element.
<span class="since">since after 0.4.4 for USB and 0.6.0 for PCI
(KVM only)</span>:
<span class="since">since after 0.4.4 for USB, 0.6.0 for PCI(KVM only)
and 1.0.6 for SCSI(KVM only)</span>:
</p>
<pre>
@ -2284,14 +2400,31 @@
&lt;rom bar='on' file='/etc/fake/boot.bin'/&gt;
&lt;/hostdev&gt;
&lt;/devices&gt;
...</pre>
<p>or:</p>
<pre>
...
&lt;devices&gt;
&lt;hostdev mode='subsystem' type='scsi'&gt;
&lt;source&gt;
&lt;adapter name='scsi_host0'/&gt;
&lt;address type='scsi' bus='0' target='0' unit='0'/&gt;
&lt;/source&gt;
&lt;readonly/&gt;
&lt;address type='drive' controller='0' bus='0' target='0' unit='0'/&gt;
&lt;/hostdev&gt;
&lt;/devices&gt;
...</pre>
<dl>
<dt><code>hostdev</code></dt>
<dd>The <code>hostdev</code> element is the main container for describing
host devices. For usb device passthrough <code>mode</code> is always
"subsystem" and <code>type</code> is "usb" for a USB device and "pci"
for a PCI device. When <code>managed</code> is "yes" for a PCI
"subsystem" and <code>type</code> is "usb" for a USB device, "pci"
for a PCI device and "scsi" for a SCSI device. When
<code>managed</code> is "yes" for a PCI
device, it is detached from the host before being passed on to
the guest, and reattached to the host after the guest exits.
If <code>managed</code> is omitted or "no", and for USB
@ -2301,13 +2434,21 @@
hot-plugging the device,
and <code>virNodeDeviceReAttach</code> (or <code>virsh
nodedev-reattach</code>) after hot-unplug or stopping the
guest.</dd>
guest. For SCSI device, user is responsible to make sure the device
is not used by host.
The optional <code>sgio</code> (<span class="since">since 1.0.6</span>)
attribute indicates whether the kernel will filter unprivileged
SG_IO commands for the disk, valid settings are "filtered" or
"unfiltered". Defaults to "filtered".
</dd>
<dt><code>source</code></dt>
<dd>The source element describes the device as seen from the host.
The USB device can either be addressed by vendor / product id using the
<code>vendor</code> and <code>product</code> elements or by the device's
address on the hosts using the <code>address</code> element. PCI devices
on the other hand can only be described by their <code>address</code>.
SCSI devices are described by both the <code>adapter</code> and
<code>address</code> elements.
<span class="since">Since 1.0.0</span>, the <code>source</code> element
of USB devices may contain <code>startupPolicy</code> attribute which can
@ -2342,6 +2483,7 @@
<a href="#elementsOSBIOS">BIOS bootloader</a> section.
<span class="since">Since 0.8.8</span> for PCI devices,
<span class="since">Since 1.0.1</span> for USB devices.
</dd>
<dt><code>rom</code></dt>
<dd>The <code>rom</code> element is used to change how a PCI
device's ROM is presented to the guest. The optional <code>bar</code>
@ -2386,10 +2528,20 @@
could be changed in the future with no impact to domains that
don't specify anything.
</dd>
<dt><code>readonly</code></dt>
<dd>Indicates that the device is readonly, only supported by SCSI host
device now. <span class="since">Since 1.0.6 (QEMU and KVM only)</span>
</dd>
<dt><code>shareable</code></dt>
<dd>If present, this indicates the device is expected to be shared
between domains (assuming the hypervisor and OS support this).
Only supported by SCSI host device.
<span class="since">Since 1.0.6</span>
</dd>
</dl>
<h5><a href="elementsHostDevCaps">Block / character devices</a></h5>
<h5><a name="elementsHostDevCaps">Block / character devices</a></h5>
<p>
Block / character devices from the host can be passed through
@ -3128,7 +3280,7 @@ qemu-kvm -net nic,model=? /dev/null
&lt;source network='default'/&gt;
&lt;target dev='vnet1'/&gt;
&lt;model type='virtio'/&gt;
<b>&lt;driver name='vhost' txmode='iothread' ioeventfd='on' event_idx='off'/&gt;</b>
<b>&lt;driver name='vhost' txmode='iothread' ioeventfd='on' event_idx='off' queues='5'/&gt;</b>
&lt;/interface&gt;
&lt;/devices&gt;
...</pre>
@ -3222,6 +3374,16 @@ qemu-kvm -net nic,model=? /dev/null
<b>In general you should leave this option alone, unless you
are very certain you know what you are doing.</b>
</dd>
<dt><code>queues</code></dt>
<dd>
The optional <code>queues</code> attribute controls the number of
queues to be used for the<a href="http://www.linux-kvm.org/page/Multiqueue">
Multiqueue virtio-net</a> feature. If the interface has <code>&lt;model
type='virtio'/&gt;</code>, multiple packet processing queues can be
created; each queue will potentially be handled by a different
processor, resulting in much higher throughput.
<span class="since">Since 1.0.6 (QEMU and KVM only)</span>
</dd>
</dl>
<h5><a name="elementsNICSTargetOverride">Overriding the target element</a></h5>
@ -3361,6 +3523,13 @@ qemu-kvm -net nic,model=? /dev/null
&lt;parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/&gt;
&lt;/virtualport&gt;
&lt;/interface&gt;
&lt;interface type='bridge'&gt;
<b>&lt;vlan trunk='yes'&gt;</b>
<b>&lt;tag id='42'/&gt;</b>
<b>&lt;tag id='123' nativeMode='untagged'/&gt;</b>
<b>&lt;/vlan&gt;</b>
...
&lt;/interface&gt;
&lt;devices&gt;
...</pre>
@ -3387,6 +3556,15 @@ qemu-kvm -net nic,model=? /dev/null
vlan element.
</p>
<p>
For network connections using openvswitch it is possible to
configure the 'native-tagged' and 'native-untagged' vlan modes
<span class="since">Since 1.1.0.</span> This uses the optional
<code>nativeMode</code> attribute on the <code>&lt;tag&gt;</code>
element: <code>nativeMode</code> may be set to 'tagged' or
'untagged'. The id atribute of the element sets the native vlan.
</p>
<h5><a name="elementLink">Modifying virtual link state</a></h5>
<pre>
...
@ -3484,7 +3662,7 @@ qemu-kvm -net nic,model=? /dev/null
...
&lt;devices&gt;
&lt;graphics type='sdl' display=':0.0'/&gt;
&lt;graphics type='vnc' port='5904'&gt;
&lt;graphics type='vnc' port='5904' sharePolicy='allow-exclusive'&gt;
&lt;listen type='address' address='1.2.3.4'/&gt;
&lt;/graphics&gt;
&lt;graphics type='rdp' autoport='yes' multiUser='yes' /&gt;
@ -3527,10 +3705,25 @@ qemu-kvm -net nic,model=? /dev/null
allows control of connected client during password changes.
VNC accepts <code>keep</code> value only.
<span class="since">since 0.9.3</span>
NB, this may not be supported by all hypervisors.<br/> <br/>
NB, this may not be supported by all hypervisors.<br/>
The optional <code>sharePolicy</code> attribute specifies vnc server
display sharing policy. "allow-exclusive" allows clients to ask
for exclusive access by dropping other connections. Connecting
multiple clients in parallel requires all clients asking for a
shared session (vncviewer: -Shared switch). This is the default
value. "force-shared" disables exclusive client access, every
connection has to specify -Shared switch for vncviewer. "ignore"
welcomes every connection unconditionally
<span class="since">since 1.0.6</span>. <br/> <br/>
Rather than using listen/port, QEMU supports a
<code>socket</code> attribute for listening on a unix
domain socket path.<span class="since">Since 0.8.8</span>
For VNC WebSocket functionality, <code>websocket</code>
attribute may be used to specify port to listen on (with
-1 meaning auto-allocation and <code>autoport</code>
having no effect due to security reasons).
<span class="since">Since 1.0.6</span>
</dd>
<dt><code>"spice"</code></dt>
<dd>
@ -3999,8 +4192,13 @@ qemu-kvm -net nic,model=? /dev/null
then libvirt can interact with a guest agent installed in the
guest, for actions such as guest shutdown or file system quiescing.
<span class="since">Since 0.7.7, guest agent interaction
since 0.9.10</span></dd>
since 0.9.10</span> Moreover, <span class="since">since 1.0.6</span>
it is possible to have source path auto generated for virtio unix channels.
This is very useful in case of a qemu guest agent, where users don't
usually care about the source path since it's libvirt who talks to
the guest agent. In case users want to utilize this feature, they should
leave <code>&lt;source&gt;</code> element out.
</dd>
<dt><code>spicevmc</code></dt>
<dd>Paravirtualized SPICE channel. The domain must also have a
SPICE server as a <a href="#elementsGraphics">graphics
@ -4499,7 +4697,7 @@ qemu-kvm -net nic,model=? /dev/null
<dd>
<p>
This backend type expects a non-blocking character device as input.
Examples of such devices are /dev/random and /dev/urandom. The file
The only accepted paths are /dev/random and /dev/hwrng. The file
name is specified as contents of the <code>backend</code> element.
When no file name is specified the hypervisor default is used.
</p>
@ -4537,7 +4735,7 @@ qemu-kvm -net nic,model=? /dev/null
&lt;devices&gt;
&lt;tpm model='tpm-tis'&gt;
&lt;backend type='passthrough'&gt;
&lt;backend path='/dev/tpm0'/&gt;
&lt;device path='/dev/tpm0'/&gt;
&lt;/backend&gt;
&lt;/tpm&gt;
&lt;/devices&gt;
@ -4559,7 +4757,7 @@ qemu-kvm -net nic,model=? /dev/null
TPM device. The following types are supported:
</p>
<ul>
<li>'passthrough' &mdash; use the host's TPM device.
<li>'passthrough' &mdash; use the host's TPM device.</li>
</ul>
</dd>
<dt><code>backend type='passthrough'</code></dt>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Network XML format</h1>
@ -432,20 +434,24 @@
<h5><a name="elementVlanTag">Setting VLAN tag (on supported network types only)</a></h5>
<pre>
...
&lt;devices&gt;
&lt;interface type='bridge'&gt;
<b>&lt;vlan trunk='yes'&gt;</b>
<b>&lt;tag id='42'/&gt;</b>
<b>&lt;tag id='47'/&gt;</b>
<b>&lt;/vlan&gt;</b>
&lt;source bridge='ovsbr0'/&gt;
&lt;virtualport type='openvswitch'&gt;
&lt;parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/&gt;
&lt;/virtualport&gt;
&lt;/interface&gt;
&lt;devices&gt;
...</pre>
&lt;network&gt;
&lt;name&gt;ovs-net&lt;/name&gt;
&lt;forward mode='bridge'/&gt;
&lt;bridge name='ovsbr0'/&gt;
&lt;virtualport type='openvswitch'&gt;
&lt;parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/&gt;
&lt;/virtualport&gt;
<b>&lt;vlan trunk='yes'&gt;</b>
<b>&lt;tag id='42' nativeMode='untagged'/&gt;</b>
<b>&lt;tag id='47'/&gt;</b>
<b>&lt;/vlan&gt;</b>
&lt;portgroup name='dontpanic'&gt;
<b>&lt;vlan&gt;</b>
<b>&lt;tag id='42'/&gt;</b>
<b>&lt;/vlan&gt;</b>
&lt;/portgroup&gt;
&lt;/network&gt;
</pre>
<p>
If (and only if) the network type supports vlan tagging
@ -466,6 +472,14 @@
is desired, the optional attribute <code>trunk='yes'</code> can
be added to the vlan element.
</p>
<p>
For network connections using openvswitch it is possible to
configure the 'native-tagged' and 'native-untagged' vlan modes
<span class="since">Since 1.1.0</span>. This uses the optional
<code>nativeMode</code> attribute on the <code>&lt;tag&gt;</code>
element: <code>nativeMode</code> may be set to 'tagged' or
'untagged'. The id atribute of the element sets the native vlan.
</p>
<p>
<code>&lt;vlan&gt;</code> elements can also be specified in
a <code>&lt;portgroup&gt;</code> element, as well as directly in
@ -544,6 +558,62 @@
starting.
</p>
<h5><a name="elementsStaticroute">Static Routes</a></h5>
<p>
Static route definitions are used to provide routing information
to the virtualization host for networks which are not directly
reachable from the virtualization host, but *are* reachable from
a guest domain that is itself reachable from the
host <span class="since">since 1.0.6</span>.
</p>
<p>
As shown in <a href="formatnetwork.html#examplesNoGateway">this
example</a>, it is possible to define a virtual network
interface with no IPv4 or IPv6 addresses. Such networks are
useful to provide host connectivity to networks which are only
reachable via a guest. A guest with connectivity both to the
guest-only network and to another network that is directly
reachable from the host can act as a gateway between the
networks. A static route added to the "host-visible" network
definition provides the routing information so that IP packets
can be sent from the virtualization host to guests on the hidden
network.
</p>
<p>
Here is a fragment of a definition which shows the static
route specification as well as the IPv4 and IPv6 definitions
for network addresses which are referred to in the
<code>gateway</code> gateway address specifications. Note
that the third static route specification includes the
<code>metric</code> attribute specification with a value of 2.
This particular route would *not* be preferred if there was
another existing rout on the system with the same address and
prefix but with a lower value for the metric. If there is a
route in the host system configuration that should be overriden
by a route in a virtual network whenever the virtual network is
running, the configuration for the system-defined route should
be modified to have a higher metric, and the route on the
virtual network given a lower metric (for example, the default
metric of "1").
</p>
<pre>
...
&lt;ip address="192.168.122.1" netmask="255.255.255.0"&gt;
&lt;dhcp&gt;
&lt;range start="192.168.122.128" end="192.168.122.254" /&gt;
&lt;/dhcp&gt;
&lt;/ip&gt;
&lt;route address="192.168.222.0" prefix="24" gateway="192.168.122.2" /&gt;
&lt;ip family="ipv6" address="2001:db8:ca2:2::1" prefix="64" /&gt;
&lt;route family="ipv6" address="2001:db8:ca2:3::" prefix="64" gateway="2001:db8:ca2:2::2"/&gt;
&lt;route family="ipv6" address="2001:db9:4:1::" prefix="64" gateway="2001:db8:ca2:2::3" metric='2'&gt;
&lt;/route&gt;
...
</pre>
<h3><a name="elementsAddress">Addressing</a></h3>
<p>
@ -575,6 +645,7 @@
&lt;/dhcp&gt;
&lt;/ip&gt;
&lt;ip family="ipv6" address="2001:db8:ca2:2::1" prefix="64" /&gt;
&lt;route family="ipv6" address="2001:db9:ca1:1::" prefix="64" gateway="2001:db8:ca2:2::2" /&gt;
&lt;/network&gt;</pre>
<dl>
@ -824,6 +895,33 @@
&lt;/ip&gt;
&lt;/network&gt;</pre>
<p>
Below is yet another IPv6 variation. This variation has only
IPv6 defined with DHCPv6 on the primary IPv6 network. A static
link if defined for a second IPv6 network which will not be
directly visible on the bridge interface but there will be a
static route defined for this network via the specified
gateway. Note that the gateway address must be directly
reachable via (on the same subnet as) one of the &lt;ip&gt;
addresses defined for this &lt;network&gt;.
<span class="since">Since 1.0.6</span>
</p>
<pre>
&lt;network&gt;
&lt;name&gt;net7&lt;/name&gt;
&lt;bridge name="virbr7" /&gt;
&lt;forward mode="route"/&gt;
&lt;ip family="ipv6" address="2001:db8:ca2:7::1" prefix="64" &gt;
&lt;dhcp&gt;
&lt;range start="2001:db8:ca2:7::100" end="2001:db8:ca2::1ff" /&gt;
&lt;host id="0:4:7e:7d:f0:7d:a8:bc:c5:d2:13:32:11:ed:16:ea:84:63" name="lucas" ip="2001:db8:ca2:2:3::4" /&gt;
&lt;/dhcp&gt;
&lt;/ip&gt;
&lt;route family="ipv6" address="2001:db8:ca2:8::" prefix="64" gateway="2001:db8:ca2:7::4" &gt;
&lt;/route&gt;
&lt;/network&gt;</pre>
<h3><a name="examplesPrivate">Isolated network config</a></h3>
<p>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Node devices XML format</h1>
@ -11,7 +13,7 @@
prefix <code>virNodeDevice</code>, which deal with management of
host devices that can be handed to guests via passthrough as
&lt;hostdev&gt; elements
in <a href="formatdomain.html#elementsUSB">the domain XML</a>.
in <a href="formatdomain.html#elementsHostDev">the domain XML</a>.
These devices are represented as a hierarchy, where a device on
a bus has a parent of the bus controller device; the root of the
hierarchy is the node named "computer".
@ -78,6 +80,36 @@
<dd>Vendor details from the device ROM, including an
attribute <code>id</code> with the hexadecimal vendor
id, and an optional text name of that vendor.</dd>
<dt><code>iommuGroup</code></dt>
<dd>
This optional element describes the "IOMMU group" this
device belongs to. If the element exists, it has a
mandatory <code>number</code> attribute which tells
the group number used for management of the group (all
devices in group "n" will be found in
"/sys/kernel/iommu_groups/n"). It will also have a
list of <code>address</code> subelements, each
containing the PCI address of a device in the same
group. The toplevel device will itself be included in
this list.
</dd>
<dt><code>capability</code></dt>
<dd>
This optional element can occur multiple times. If it
exists, it has a mandatory <code>type</code> attribute
which will be set to
either <code>physical_function</code>
or <code>virtual_functions</code>. If the type
is <code>physical_function</code>, there will be a
single <code>address</code> subelement which contains
the PCI address of the SRIOV Physical Function (PF)
that is the parent of this device (and this device is,
by implication, an SRIOV Virtual Function (VF)). If
the type is <code>virtual_functions</code>, then this
device is an SRIOV PF, and the capability element will
have a list of <code>address</code> subelements, one
for each VF on this PF.
</dd>
</dl>
</dd>
<dt><code>usb_device</code></dt>
@ -230,7 +262,38 @@
&lt;address&gt;00:27:13:6a:fe:00&lt;/address&gt;
&lt;capability type='80203'/&gt;
&lt;/capability&gt;
&lt;/device&gt;</pre>
&lt;/device&gt;
&lt;device&gt;
&lt;name&gt;pci_0000_02_00_0&lt;/name&gt;
&lt;path&gt;/sys/devices/pci0000:00/0000:00:04.0/0000:02:00.0&lt;/path&gt;
&lt;parent&gt;pci_0000_00_04_0&lt;/parent&gt;
&lt;driver&gt;
&lt;name&gt;igb&lt;/name&gt;
&lt;/driver&gt;
&lt;capability type='pci'&gt;
&lt;domain&gt;0&lt;/domain&gt;
&lt;bus&gt;2&lt;/bus&gt;
&lt;slot&gt;0&lt;/slot&gt;
&lt;function&gt;0&lt;/function&gt;
&lt;product id='0x10c9'&gt;82576 Gigabit Network Connection&lt;/product&gt;
&lt;vendor id='0x8086'&gt;Intel Corporation&lt;/vendor&gt;
&lt;capability type='virt_functions'&gt;
&lt;address domain='0x0000' bus='0x02' slot='0x10' function='0x0'/&gt;
&lt;address domain='0x0000' bus='0x02' slot='0x10' function='0x2'/&gt;
&lt;address domain='0x0000' bus='0x02' slot='0x10' function='0x4'/&gt;
&lt;address domain='0x0000' bus='0x02' slot='0x10' function='0x6'/&gt;
&lt;address domain='0x0000' bus='0x02' slot='0x11' function='0x0'/&gt;
&lt;address domain='0x0000' bus='0x02' slot='0x11' function='0x2'/&gt;
&lt;address domain='0x0000' bus='0x02' slot='0x11' function='0x4'/&gt;
&lt;/capability&gt;
&lt;iommuGroup number='12'&gt;
&lt;address domain='0x0000' bus='0x02' slot='0x00' function='0x0'/&gt;
&lt;address domain='0x0000' bus='0x02' slot='0x00' function='0x1'/&gt;
&lt;/iommuGroup&gt;
&lt;/capability&gt;
&lt;/device&gt;
</pre>
</body>
</html>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Network Filters</h1>
@ -113,7 +115,7 @@
<p>
Filtering rules are organized in filter chains. These chains can be
thought of as having a tree structure with packet
filtering rules as entries in individual chains (branches). <br>
filtering rules as entries in individual chains (branches). <br/>
Packets start their filter evaluation in the <code>root</code> chain
and can then continue their evaluation in other chains, return from
those chains back into the <code>root</code> chain or be
@ -227,7 +229,7 @@
<p>
A chain with a lower priority value is accessed before one with a
higher value.
<br><br>
<br/>
<span class="since">Since 0.9.8</span> the above listed chains
can be assigned custom priorities by writing a value in the
range [-1000, 1000] into the priority (XML) attribute in the filter
@ -370,7 +372,7 @@
<p>
Further, the notation of $VARIABLE is short-hand for $VARIABLE[@0]. The
former notation always assumes the iterator with Id '0'.
<p>
</p>
<h3><a name="nwfelemsRulesAdvIPAddrDetection">Automatic IP address detection</a></h3>
<p>
@ -394,7 +396,7 @@
When a VM is migrated to another host or resumed after a suspend operation,
the first packet sent by the VM will again determine the IP address it can
use on a particular interface.
<br/><br>
<br/>
A value of <code>dhcp</code> specifies that libvirt should only honor DHCP
server-assigned addresses with valid leases. This method supports the detection
and usage of multiple IP address per interface.
@ -567,7 +569,7 @@
(matching the rule passes this filter, but returns control to
the calling filter for further
analysis) <span class="since">(since 0.9.7)</span>,
or <code>continue<code> (matching the rule goes on to the next
or <code>continue</code> (matching the rule goes on to the next
rule for further analysis) <span class="since">(since
0.9.7)</span>.
</li>
@ -585,7 +587,7 @@
<span class="since">Since 0.9.8</span> this has been extended to cover
the range of -1000 to 1000. If this attribute is not
provided, priority 500 will automatically be assigned.
<br>
<br/>
Note that filtering rules in the <code>root</code> chain are sorted
with filters connected to the <code>root</code> chain following
their priorities. This allows to interleave filtering rules with

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Secret XML format</h1>
@ -39,8 +41,8 @@
<dd>
Specifies what this secret is used for. A mandatory
<code>type</code> attribute specifies the usage category, currently
only <code>volume</code> and <code>ceph</code> are defined.
Specific usage categories are described below.
only <code>volume</code>, <code>ceph</code> and <code>iscsi</code>
are defined. Specific usage categories are described below.
</dd>
</dl>
@ -62,7 +64,7 @@
a single <code>name</code> element that specifies a usage name
for the secret. The Ceph secret can then be used by UUID or by
this usage name via the <code>&lt;auth&gt;</code> element of
a <a href="domain.html#elementsDisks">disk
a <a href="formatdomain.html#elementsDisks">disk
device</a>. <span class="since">Since 0.9.7</span>.
</p>
@ -74,7 +76,7 @@
a single <code>target</code> element that specifies a usage name
for the secret. The iSCSI secret can then be used by UUID or by
this usage name via the <code>&lt;auth&gt;</code> element of
a <a href="domain.html#elementsDisks">disk
a <a href="formatdomain.html#elementsDisks">disk
device</a>. <span class="since">Since 1.0.4</span>.
</p>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Snapshot XML format</h1>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Storage pool and volume XML format</h1>
@ -15,9 +17,9 @@
<p>
The top level tag for a storage pool document is 'pool'. It has
a single attribute <code>type</code>, which is one of <code>dir</code>,
<code>fs</code>,<code>netfs</code>,<code>disk</code>,<code>iscsi</code>,
<code>logical</code>. This corresponds to the storage backend drivers
listed further along in this document.
<code>fs</code>, <code>netfs</code>, <code>disk</code>,
<code>iscsi</code>, <code>logical</code>. This corresponds to the
storage backend drivers listed further along in this document.
The storage pool XML format is available <span class="since">since 0.4.1</span>
</p>
<h3><a name="StoragePoolFirst">General metadata</a></h3>
@ -332,6 +334,10 @@
&lt;mode&gt;0744&lt;/mode&gt;
&lt;label&gt;virt_image_t&lt;/label&gt;
&lt;/permissions&gt;
&lt;compat&gt;1.1&lt;/compat&gt;
&lt;features&gt;
&lt;lazy_refcounts/&gt;
&lt;/features&gt;
&lt;/target&gt;</pre>
<dl>
@ -360,6 +366,22 @@
contains the MAC (eg SELinux) label string.
<span class="since">Since 0.4.1</span>
</dd>
<dt><code>compat</code></dt>
<dd>Specify compatibility level. So far, this is only used for
<code>type='qcow2'</code> volumes. Valid values are <code>0.10</code>
and <code>1.1</code> so far, specifying QEMU version the images should
be compatible with. If the <code>feature</code> element is present,
1.1 is used. If omitted, qemu-img default is used.
<span class="since">Since 1.1.0</span>
</dd>
<dt><code>features</code></dt>
<dd>Format-specific features. Only used for <code>qcow2</code> now.
Valid sub-elements are:
<ul>
<li><code>&lt;lazy_refcounts/&gt;</code> - allow delayed reference
counter updates. <span class="since">Since 1.1.0</span></li>
</ul>
</dd>
</dl>
<h3><a name="StorageVolBacking">Backing store elements</a></h3>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Storage volume encryption XML format</h1>

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Terminology and goals</h1>
<p>To avoid ambiguity about the terms used, here are the definitions

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Contributor guidelines</h1>
@ -375,6 +377,35 @@
int foo(int wizz); // Good
</pre>
<h2><a name="semicolon">Semicolons</a></h2>
<p>
Semicolons should never have a space beforehand. Inside the
condition of a <code>for</code> loop, there should always be a
space or line break after each semicolon, except for the special
case of an infinite loop (although more infinite loops
use <code>while</code>). While not enforced, loop counters
generally use post-increment.
</p>
<pre>
for (i = 0 ;i &lt; limit ; ++i) { // Bad
for (i = 0; i &lt; limit; i++) { // Good
for (;;) { // ok
while (1) { // Better
</pre>
<p>
Empty loop bodies are better represented with curly braces and a
comment, although use of a semicolon is not currently rejected.
</p>
<pre>
while ((rc = waitpid(pid, &amp;st, 0) == -1) &amp;&amp;
errno == EINTR); // ok
while ((rc = waitpid(pid, &amp;st, 0) == -1) &amp;&amp;
errno == EINTR) { // Better
/* nothing */
}
</pre>
<h2><a name="curly_braces">Curly braces</a></h2>
<p>
@ -517,6 +548,13 @@
<h2><a name="preprocessor">Preprocessor</a></h2>
<p>Macros defined with an ALL_CAPS name should generally be
assumed to be unsafe with regards to arguments with side-effects
(that is, MAX(a++, b--) might increment a or decrement b too
many or too few times). Exceptions to this rule are explicitly
documented for macros in viralloc.h and virstring.h.
</p>
<p>
For variadic macros, stick with C99 syntax:
</p>
@ -614,7 +652,7 @@
Use of the malloc/free/realloc/calloc APIs is deprecated in the libvirt
codebase, because they encourage a number of serious coding bugs and do
not enable compile time verification of checks for NULL. Instead of these
routines, use the macros from memory.h.
routines, use the macros from viralloc.h.
</p>
<ul>
@ -853,6 +891,21 @@
virStrncpy(dest, src, strlen(src), sizeof(dest)).
</p>
<pre>
VIR_STRDUP(char *dst, const char *src);
VIR_STRNDUP(char *dst, const char *src, size_t n);
</pre>
<p>
You should avoid using strdup or strndup directly as they do not report
out-of-memory error, and do not allow a NULL source. Use
VIR_STRDUP or VIR_STRNDUP macros instead, which return 0 for
NULL source, 1 for successful copy, and -1 for allocation
failure with the error already reported. In very
specific cases, when you don't want to report the out-of-memory error, you
can use VIR_STRDUP_QUIET or VIR_STRNDUP_QUIET, but such usage is very rare
and usually considered a flaw.
</p>
<h2><a name="strbuf">Variable length string buffer</a></h2>
<p>

View File

@ -1,5 +1,7 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:stylesheet version="1.0"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="no"/>
@ -21,8 +23,8 @@
<!-- resolve b/i/code tags in a first pass, because they interfere with line
wrapping in the second pass -->
<xsl:template match="b">*<xsl:apply-templates/>*</xsl:template>
<xsl:template match="i">'<xsl:apply-templates/>'</xsl:template>
<xsl:template match="code">"<xsl:apply-templates/>"</xsl:template>
<xsl:template match="html:b">*<xsl:apply-templates/>*</xsl:template>
<xsl:template match="html:i">'<xsl:apply-templates/>'</xsl:template>
<xsl:template match="html:code">"<xsl:apply-templates/>"</xsl:template>
</xsl:stylesheet>

View File

@ -1,5 +1,7 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:stylesheet version="1.0"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="wrapstring.xsl"/>
@ -30,7 +32,7 @@ from docs/hacking.html.in!
<!-- title -->
<xsl:template match="h1">
<xsl:template match="html:h1">
<xsl:text> </xsl:text>
<xsl:value-of select="normalize-space(.)"/>
<xsl:text>
@ -65,14 +67,14 @@ from docs/hacking.html.in!
<xsl:template match="h2">
<xsl:template match="html:h2">
<xsl:value-of select="$newline"/>
<xsl:call-template name="underline"/>
</xsl:template>
<xsl:template match="h3">
<xsl:template match="html:h3">
<xsl:call-template name="underline">
<xsl:with-param name="char" select="'-'"/>
</xsl:call-template>
@ -91,13 +93,13 @@ from docs/hacking.html.in!
<xsl:template match="ol|ul|p">
<xsl:template match="html:ol|html:ul|html:p">
<xsl:apply-templates/><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/>
</xsl:template>
<xsl:template match="ol/li">
<xsl:template match="html:ol/html:li">
<xsl:choose>
<xsl:when test=".//node()[position()=last()]/self::pre">(<xsl:value-of select="position()"/>) <xsl:apply-templates/>
</xsl:when>
@ -109,23 +111,23 @@ from docs/hacking.html.in!
<xsl:template match="ul/li">- <xsl:apply-templates/><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/>
<xsl:template match="html:ul/html:li">- <xsl:apply-templates/><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/>
</xsl:template>
<xsl:template match="li/ul/li">-- <xsl:apply-templates/><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/>
<xsl:template match="html:li/html:ul/html:li">-- <xsl:apply-templates/><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/>
</xsl:template>
<!-- add newline before nested <ul> -->
<xsl:template match="li/ul"><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/><xsl:apply-templates/>
<xsl:template match="html:li/html:ul"><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/><xsl:apply-templates/>
</xsl:template>
<xsl:template match="pre">
<xsl:template match="html:pre">
<xsl:choose>
<xsl:when test="starts-with(.,'&#xA;')"><xsl:value-of select="substring(.,2)"/><xsl:value-of select="$newline"/>
</xsl:when>
@ -137,7 +139,7 @@ from docs/hacking.html.in!
<xsl:template match="a">
<xsl:template match="html:a">
<xsl:value-of select="$newline"/><xsl:value-of select="$newline"/>
<xsl:text> </xsl:text><xsl:apply-templates/>
<xsl:value-of select="$newline"/>

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Hooks for specific system management</h1>

View File

@ -169,6 +169,13 @@ $apis{virDomainMigratePerform3} = "0.9.2";
$apis{virDomainMigrateFinish3} = "0.9.2";
$apis{virDomainMigrateConfirm3} = "0.9.2";
$apis{virDomainMigrateBegin3Params} = "1.1.0";
$apis{virDomainMigratePrepare3Params} = "1.1.0";
$apis{virDomainMigratePrepareTunnel3Params} = "1.1.0";
$apis{virDomainMigratePerform3Params} = "1.1.0";
$apis{virDomainMigrateFinish3Params} = "1.1.0";
$apis{virDomainMigrateConfirm3Params} = "1.1.0";
# Now we want to get the mapping between public APIs
@ -341,7 +348,9 @@ foreach my $drv (keys %{$groups{"virDriver"}->{drivers}}) {
# Finally we generate the HTML file with the tables
print <<EOF;
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>libvirt API support matrix</title>
</head>

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>The virtualization API</h1>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>libvirt internals</h1>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Spawning processes / commands from libvirt drivers</h1>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Resource Lock Manager</h1>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>libvirt RPC infrastructure</h1>
@ -152,6 +154,7 @@
<li>continue: for streams this indicates that further data packets
will be following</li>
</ol>
</dd>
</dl>
<h3><a href="protocolpayload">Packet payload</a></h3>

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Architecture</h1>
<p>Libvirt is a C toolkit manage the virtualization capabilities

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Java API bindings</h1>

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Virtual machine disk locking</h1>

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1 >Logging in the library and the daemon</h1>
<p>Libvirt includes logging facilities starting from version 0.6.0,

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Guest migration</h1>
@ -30,7 +32,7 @@
</p>
<p>
<img class="diagram" src="migration-native.png" alt="Migration native path">
<img class="diagram" src="migration-native.png" alt="Migration native path"/>
</p>
<h3><a name="transporttunnel">libvirt tunnelled transport</a></h3>
@ -48,7 +50,7 @@
</p>
<p>
<img class="diagram" src="migration-tunnel.png" alt="Migration tunnel path">
<img class="diagram" src="migration-tunnel.png" alt="Migration tunnel path"/>
</p>
<h2><a name="flow">Communication control paths/flows</a></h2>
@ -75,7 +77,7 @@
</p>
<p>
<img class="diagram" src="migration-managed-direct.png" alt="Migration direct, managed">
<img class="diagram" src="migration-managed-direct.png" alt="Migration direct, managed"/>
</p>
@ -97,7 +99,7 @@
</p>
<p>
<img class="diagram" src="migration-managed-p2p.png" alt="Migration peer-to-peer">
<img class="diagram" src="migration-managed-p2p.png" alt="Migration peer-to-peer"/>
</p>
@ -113,7 +115,7 @@
</p>
<p>
<img class="diagram" src="migration-unmanaged-direct.png" alt="Migration direct, unmanaged">
<img class="diagram" src="migration-unmanaged-direct.png" alt="Migration direct, unmanaged"/>
</p>

View File

@ -6,6 +6,8 @@
Daniel Veillard
-->
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
xmlns:str="http://exslt.org/strings"

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
@ -8,6 +9,691 @@
<p>Here is the list of official releases, it is also possible to just use the <a href="downloads.html">GIT version or snapshot</a>, contact the mailing list
and check the <a href="http://libvirt.org/git/?p=libvirt.git;a=log">GIT log</a> to gauge progress.</p>
<h3>1.1.0: July 1 2013</h3>
<ul>
<li>Features:<br/>
Extensible migration APIs (Jiri Denemark),<br/>
Add a policy kit access control driver (Daniel P. Berrange),<br/>
various improvements in the Xen driver (Jim Fehlig and Marek Marczykowski-Górecki),<br/>
improve networking support on BSD (Roman Bogorodskiy),<br/>
agent based vCPU hotplug support (Peter Krempa)<br/>
</li>
<li>Security:<br/>
CVE-2013-2218: Fix crash listing network interfaces with filters (Daniel P. Berrange)<br/>
</li>
<li>Documentation:<br/>
Document security reporting &amp; handling process (Daniel P. Berrange),<br/>
Fix reference to #elementsUSB (Philipp Hahn),<br/>
Fix sample TPM XML (Stefan Berger),<br/>
correct and update network vlan example (Laine Stump),<br/>
add spaces to formatstorage.html (Ján Tomko)<br/>
</li>
<li>Portability:<br/>
spec: require xen-devel for libxl driver (Eric Blake),<br/>
Conditionalize use of IF_MAXUNIT in virnetdevtap.c (Daniel P. Berrange),<br/>
Replace use of 'in_addr_t' with 'struct in_addr' (Daniel P. Berrange),<br/>
build: Fix VPATH build for access/* (Viktor Mihajlovski),<br/>
util: fix build error on non-Linux systems (Laine Stump),<br/>
conf: Swap order of AddImplicitControllers and DomainDefPostParse (Viktor Mihajlovski),<br/>
S390: Testcase for console default target type (virtio) (Viktor Mihajlovski),<br/>
Fix units in virNetDevBridgeSetSTPDelay on BSD (Roman Bogorodskiy),<br/>
build: Fix check-aclrules in VPATH build (Jiri Denemark),<br/>
build: Fix build with -Werror (Jim Fehlig),<br/>
use net/if.h instead of linux/if.h (Roman Bogorodskiy),<br/>
build: fix build without posix_fallocate (Eric Blake),<br/>
spec: Explicitly require libgcrypt-devel (Jiri Denemark)<br/>
</li>
<li>Bug Fixes:<br/>
pci: initialize virtual_functions array pointer to avoid segfault (Laine Stump),<br/>
node device driver: update driver name during dumpxml (Laine Stump),<br/>
Resolve valgrind errors for nodedev cap parsing (John Ferlan),<br/>
Resolve valgrind error in remoteConfigGetStringList() (John Ferlan),<br/>
Resolve valgrind error in virStorageBackendCreateQemuImgCmd() (John Ferlan),<br/>
Resolve valgrind error in virNetDevVlanParse() (John Ferlan),<br/>
Fix vPort management: FC vHBA creation (Dennis Chen),<br/>
bridge: don't crash on bandwidth unplug with no bandwidth (Ján Tomko),<br/>
Plug leak in virCgroupMoveTask (Ján Tomko),<br/>
Fix invalid read in virCgroupGetValueStr (Ján Tomko),<br/>
qemu: fix infinite loop in OOM error path (Laine Stump),<br/>
pci: fix dangling pointer in qemuDomainReAttachHostdevDevices (Laine Stump),<br/>
pci: eliminate leak in OOM condition (Laine Stump),<br/>
util: fix bug found by Coverity (Laine Stump),<br/>
Fix possible NULL dereference during migration (Jiri Denemark),<br/>
virsh: edit: don't leak XML string on reedit or redefine (Ján Tomko),<br/>
qemu: don't reset PCI devices being assigned with VFIO (Laine Stump),<br/>
pci: eliminate memory leak in virPCIDeviceReattach (Laine Stump),<br/>
qemu: check if block I/O limits fit into long long (Ján Tomko),<br/>
network: increase max number of routes (Laine Stump),<br/>
lxc: Resolve issue with GetScheduler APIs for non running domain (John Ferlan),<br/>
qemu: Resolve issue with GetScheduler APIs for non running domain (John Ferlan),<br/>
qemu: Avoid leaking uri in qemuMigrationPrepareDirect (Jiri Denemark),<br/>
udev: fix crash in libudev logging (Ján Tomko),<br/>
remote: Fix client crash when URI path is empty when using ssh (Peter Krempa),<br/>
remote: Forbid default "/session" connections when using ssh transport (Peter Krempa),<br/>
nodedev: fix vport detection for FC HBA (Ján Tomko),<br/>
qemu: Fix memory leak in Prepare phase (Jiri Denemark),<br/>
virSocketAddrIsWildcard: Use IN6_IS_ADDR_UNSPECIFIED correctly (Michal Privoznik),<br/>
Fix ordering of file open in virProcessGetNamespaces (Richard Weinberger),<br/>
qemuDomainGetVcpusFlags: Initialize ncpuinfo (Michal Privoznik),<br/>
virtlockd: fix socket path (Ján Tomko),<br/>
nwfilter: grab driver lock earlier during init (bz96649) (Stefan Berger),<br/>
Fix a invalid usage of virDomainNetDef in OpenVZ driver (Alvaro Polo),<br/>
use virBitmapFree instead of VIR_FREE for cpumask (Ján Tomko),<br/>
usb: don't spoil decimal addresses (Martin Kletzander)<br/>
</li>
<li>Improvements:<br/>
Allow RO connections to interface udev backend (Doug Goldstein),<br/>
virsh: Add parenthesis into virsh nodedev-detach help (xuzhang),<br/>
nodedev: add iommuGroup to node device object (Laine Stump),<br/>
pci: new iommu_group functions (Laine Stump),<br/>
network: allow &lt;vlan&gt; in type='hostdev' networks (Laine Stump),<br/>
test: include qemuhotplugtest data files in source rpm (Laine Stump),<br/>
pci: virPCIDeviceListAddCopy API (Laine Stump),<br/>
pci: update stubDriver name in virPCIDeviceBindToStub (Laine Stump),<br/>
pci: eliminate repetitive path constructions in virPCIDeviceBindToStub (Laine Stump),<br/>
pci: rename virPCIParseDeviceAddress and make it public (Laine Stump),<br/>
pci: rename virPCIDeviceGetVFIOGroupDev to virPCIDeviceGetIOMMUGroupDev (Laine Stump),<br/>
pci: eliminate unused driver arg from virPCIDeviceDetach (Laine Stump),<br/>
tests: Introduce qemuhotplugtest (Michal Privoznik),<br/>
qemu: Implement support for VIR_MIGRATE_PARAM_GRAPHICS_URI (Jiri Denemark),<br/>
Implement extensible migration APIs in qemu driver (Jiri Denemark),<br/>
qemu: Move internals of Confirm phase to qemu_migration.c (Jiri Denemark),<br/>
qemu: Move common parts of Prepare phase to qemu_migration.c (Jiri Denemark),<br/>
qemu: Move internals of Begin phase to qemu_migration.c (Jiri Denemark),<br/>
Use 1.1.0 everywhere in the documentation (Ján Tomko),<br/>
Add polkit policy for API checks to rpm spec (Daniel Veillard),<br/>
Configure native vlan modes on Open vSwitch ports (james robson),<br/>
Introduce VIR_MIGRATE_PARAM_GRAPHICS_URI parameter (Jiri Denemark),<br/>
virsh: Use extensible migration APIs (Jiri Denemark),<br/>
python: Add bindings for extensible migration APIs (Jiri Denemark),<br/>
Adapt virDomainMigratePeer2Peer for extensible migration APIs (Jiri Denemark),<br/>
Adapt virDomainMigrateVersion3 for extensible migration APIs (Jiri Denemark),<br/>
Implement extensible migration APIs in remote driver (Jiri Denemark),<br/>
New internal migration APIs with extensible parameters (Jiri Denemark),<br/>
Introduce migration parameters (Jiri Denemark),<br/>
Introduce virTypedParamsCopy internal API (Jiri Denemark),<br/>
Log input type parameters in API entry points (Jiri Denemark),<br/>
Introduce VIR_TYPED_PARAMS_DEBUG macro for dumping typed params (Jiri Denemark),<br/>
Introduce virTypedParamsReplaceString internal API (Jiri Denemark),<br/>
Introduce virTypedParamsCheck internal API (Jiri Denemark),<br/>
util: Emit proper error code in virTypedParamsValidate (Jiri Denemark),<br/>
Rename virTypedParameterArrayValidate as virTypedParamsValidate (Jiri Denemark),<br/>
pci: make virPCIDeviceDetach consistent in behavior (Laine Stump),<br/>
pci: new utility functions (Laine Stump),<br/>
pci: change stubDriver from const char* to char* (Laine Stump),<br/>
syntax: virPCIDeviceFree is also a NOP for NULL args (Laine Stump),<br/>
libxl: support qdisk backend (Jim Fehlig),<br/>
libxl: Fix disk format error message (Jim Fehlig),<br/>
Add validation that all APIs contain ACL checks (Daniel P. Berrange),<br/>
Set process ID in system identity (Daniel P. Berrange),<br/>
Add ACL checks into the secrets driver (Daniel P. Berrange),<br/>
Add ACL checks into the nwfilter driver (Daniel P. Berrange),<br/>
Add ACL checks into the node device driver (Daniel P. Berrange),<br/>
Add ACL checks into the interface driver (Daniel P. Berrange),<br/>
Add ACL checks into the network driver (Daniel P. Berrange),<br/>
Add ACL checks into the storage driver (Daniel P. Berrange),<br/>
Add ACL checks into the libxl driver (Daniel P. Berrange),<br/>
Add ACL checks into the Xen driver (Daniel P. Berrange),<br/>
Add ACL checks into the UML driver (Daniel P. Berrange),<br/>
Add ACL checks into the LXC driver (Daniel P. Berrange),<br/>
Add ACL checks into the QEMU driver (Daniel P. Berrange),<br/>
Auto-generate helpers for checking access control rules (Daniel P. Berrange),<br/>
Add ACL annotations to all RPC messages (Daniel P. Berrange),<br/>
Setup default access control manager in libvirtd (Daniel P. Berrange),<br/>
Set conn-&gt;driver before running driver connectOpen method (Daniel P. Berrange),<br/>
Define basic internal API for access control (Daniel P. Berrange),<br/>
netdev: accept NULL in virNetDevSetupControl (Ján Tomko),<br/>
xen: Implement virConnectGetSysinfo (Jim Fehlig),<br/>
libxl: Implement virConnectGetSysinfo (Jim Fehlig),<br/>
libxl: Allow libxl to set NIC devid (Jim Fehlig),<br/>
storage: add support for creating qcow2 images with extensions (Ján Tomko),<br/>
conf: add features to volume target XML (Ján Tomko),<br/>
util: add support for qcow2v3 image detection (Ján Tomko),<br/>
qemu: add hv_vapic and hv_spinlocks support (Ján Tomko),<br/>
conf: add vapic and spinlocks to hyperv features (Ján Tomko),<br/>
BSD: implement bridge add/remove port and set STP (Roman Bogorodskiy),<br/>
BSD: implement virNetDevBridgeCreate() and virNetDevBridgeDelete() (Roman Bogorodskiy),<br/>
conf: Requires either uuid or usage of secret (Osier Yang),<br/>
qemu: Make probing for commands declarative (Jiri Denemark),<br/>
qemu: Make probing for events declarative (Jiri Denemark),<br/>
libxl: support paused domain restore in virDomainRestoreFlags (Marek Marczykowski-Górecki),<br/>
qemuDomainChangeGraphics: Check listen address change by listen type (Michal Privoznik),<br/>
libxl: initialize device structures (Marek Marczykowski-Górecki),<br/>
libxl: populate xenstore memory entries at startup, handle dom0_mem (Marek Marczykowski-Górecki),<br/>
conf: split out snapshot disk XML formatting (Ján Tomko),<br/>
storage: rework qemu-img command line generation (Ján Tomko),<br/>
util: switch virBufferTrim to void (Ján Tomko),<br/>
migration: Don't propagate VIR_MIGRATE_ABORT_ON_ERROR (Peter Krempa),<br/>
migration: Make erroring out on I/O error controllable by flag (Peter Krempa),<br/>
qemu_migration: Move waiting for SPICE migration (Michal Privoznik),<br/>
spec: Enable KVM support on ARM (Cole Robinson),<br/>
virsh: Support SCSI_GENERIC cap flag for nodedev-list (Osier Yang),<br/>
nodedev: Support SCSI_GENERIC cap flag for listAllNodeDevices (Osier Yang),<br/>
nodedev_hal: Enumerate scsi generic device (Osier Yang),<br/>
nodedev_udev: Enumerate scsi generic device (Osier Yang),<br/>
qemu: set QEMU_CAPS_DEVICE_VIDEO_PRIMARY cap flag in QMP detection (Guannan Ren),<br/>
nodedev_udev: changes missed by commit 1aa0ba3cef (Osier Yang),<br/>
nodedev_udev: Refactor udevGetDeviceType (Osier Yang),<br/>
nodedev: Expose sysfs path of device (Osier Yang),<br/>
Move virGetUserEnt() to where its needed (Doug Goldstein),<br/>
BSD: implement virNetDevTapCreate() and virNetDevTapDelete() (Roman Bogorodskiy),<br/>
Make virNetDevSetupControl() public. (Roman Bogorodskiy),<br/>
LXC: s/chroot/chdir in lxcContainerPivotRoot() (Richard Weinberger),<br/>
Implement dispose method for libxlDomainObjPrivate (Frediano Ziglio),<br/>
libxl: allow only 'ethernet' and 'bridge' interfaces, allow script there (Marek Marczykowski-Górecki),<br/>
qemu: allow restore with non-migratable XML input (Ján Tomko),<br/>
libxl: set bootloader for PV domains if not specified (Jim Fehlig),<br/>
libxl: Report connect type as Xen (Jim Fehlig),<br/>
schema: simplify RNG pattern, remove superfluous &lt;optional&gt; (Claudio Bley),<br/>
libvirt_private.syms: add virProcessGetStartTime (Ján Tomko),<br/>
qemu: Forbid migration of machines with I/O errors (Peter Krempa),<br/>
qemu: Cancel migration if guest encoutners I/O error while migrating (Peter Krempa),<br/>
qemu_migrate: Dispose listen address if set from config (Michal Privoznik),<br/>
selinux: assume 's0' if the range is empty (Ján Tomko),<br/>
storage: fix description of versionOffset (Martin Kletzander),<br/>
spec: Drop Requires: vbox (Cole Robinson),<br/>
Prefer VIR_STRDUP over virAsprintf(&amp;dst, "%s", str) (Michal Privoznik),<br/>
qemu: Implement new QMP command for cpu hotplug (Peter Krempa),<br/>
qemu: Implement support for VIR_DOMAIN_VCPU_AGENT in qemuDomainSetVcpusFlags (Peter Krempa),<br/>
qemu: Implement request of vCPU state using the guest agent (Peter Krempa),<br/>
API: Introduce VIR_DOMAIN_VCPU_AGENT, for agent based CPU hot(un)plug (Peter Krempa),<br/>
qemu_agent: Introduce helpers for agent based CPU hot(un)plug (Peter Krempa),<br/>
qemu: Use bool instead of int in qemuMonitorSetCPU APIs (Peter Krempa),<br/>
virsh-domain-monitor: Remove ATTRIBUTE_UNUSED from a argument (Peter Krempa),<br/>
Add support for VirtualBox 4.2 APIs (ryan woodsmall),<br/>
qemuDomainMigrateGraphicsRelocate: Use then new virSocketAddrIsWildcard (Michal Privoznik),<br/>
virsocket: Introduce virSocketAddrIsWildcard (Michal Privoznik),<br/>
iscsi: pass hostnames to iscsiadm instead of resolving them (Ján Tomko),<br/>
qemu: Report the offset from host UTC for RTC_CHANGE event (Osier Yang),<br/>
qemu: simplify CPU command line parsing (Ján Tomko),<br/>
qemu: change two-state int parameters to bool (Ján Tomko),<br/>
nwfilter: change two-state int parameters to bool (Ján Tomko),<br/>
Remove redundant two-state integers (Ján Tomko),<br/>
Replace two-state local integers with bool (Ján Tomko),<br/>
storage: Avoid unnecessary ternary operators and refactor the code (Peter Krempa),<br/>
openvz: Fix code coverage issue in OpenVZ driver (Alvaro Polo),<br/>
qemu: Reformat listen address prior to checking (Michal Privoznik),<br/>
Ensure non-root can read /proc/meminfo file in LXC containers (Daniel P. Berrange),<br/>
storage: Provide better error message if metadata pre-alloc is unsupported (Peter Krempa),<br/>
storage: Clean up function header and reflow error message (Peter Krempa),<br/>
storagevolxml2argvtest: Report better error messages on test failure (Peter Krempa),<br/>
maint: don't use config.h in .h files (Eric Blake),<br/>
qemu: Abstract code for the cpu controller setting into a helper (Osier Yang),<br/>
storage: Forbid to shrink the vol's capacity if no --shrink is specified (Osier Yang),<br/>
storage: Support preallocate the new capacity for vol-resize (Osier Yang),<br/>
snapshot: remove mutually exclusive memory and disk-only duplicate check (Guannan Ren),<br/>
virsh: Allow attach-disk to specify disk wwn (Osier Yang),<br/>
tests: fix typo in securityselinuxtest (Ján Tomko),<br/>
virsh: Obey pool-or-uuid spec when creating volumes (Jiri Denemark),<br/>
libvirt-qemu: Dispatch errors from virDomainQemuAgentCommand() (Peter Krempa),<br/>
qemu: Properly report guest agent errors on command passthrough (Peter Krempa),<br/>
virsh-domain: Report errors and don't deref NULL in qemu-agent-command (Peter Krempa),<br/>
RPC: Support up to 16384 cpus on the host and 4096 in the guest (Peter Krempa),<br/>
virsh iface-bridge: Ignore delay if stp is turned off (Jiri Denemark),<br/>
Fix warning about using an uninitialized next_unit value (Jiri Denemark),<br/>
virsh-domain: Add --live, --config, --current logic to cmdAttachInterface (Peter Krempa),<br/>
virsh-domain: Add --live, --config, --current logic to cmdAttachDisk (Peter Krempa),<br/>
virsh-domain: Add --live, --config, --current logic to cmdAttachDevice (Peter Krempa)<br/>
</li>
<li>Cleanups:<br/>
Get rid of useless VIR_STORAGE_FILE_FEATURE_NONE (Ján Tomko),<br/>
configure: Remove unused brctl check (Cole Robinson),<br/>
storage_backend: Drop unused code (Cole Robinson),<br/>
Remove legacy code for single-instance devpts filesystem (Daniel P. Berrange)<br/>
</li>
</ul>
<h3>1.0.6: June 3 2013</h3>
<ul>
<li>Features:<br/>
Move VirtualBox driver into libvirtd (Daniel P. Berrange),<br/>
Support for static routes on a virtual bridge (Gene Czarcinski),<br/>
Various improvement for hostdev SCSI support (Osier Yang and Han Cheng),<br/>
Switch to VIR_STRDUP and VIR_STRNDUP (Michal Privoznik),<br/>
Various cleanups and improvement in Xen and LXC drivers (Daniel P. Berrange)<br/>
</li>
<li>Documentation:<br/>
Document that runtime changes may be lost after S4 suspend (Jiri Denemark),<br/>
domain: /dev/urandom isn't a valid rng patch (Cole Robinson),<br/>
formatdomain: fix links in the table of contents (Ján Tomko),<br/>
add another user (Eric Blake),<br/>
datatypes: fix virGetStoragePool's comment (Ján Tomko),<br/>
Expand documentation for LXC driver (Daniel P. Berrange),<br/>
Fix/update syntax in Sysinfo/SMBIOS description (John Ferlan),<br/>
Update formatdomain for lifecycle events (John Ferlan),<br/>
Fix the wrong links in secret documentation (Osier Yang),<br/>
Add the missed usage type 'iscsi' (Osier Yang),<br/>
Add docs about cgroups layout and usage (Daniel P. Berrange),<br/>
Point users to Virt-Viewer MSI installers for Windows builds (Daniel P. Berrange),<br/>
Fix namespace bugs in API docs, todo page &amp; hv support page (Daniel P. Berrange),<br/>
Fix a few more docs XSL bugs related to the TOC (Daniel P. Berrange),<br/>
Fix docs generator regression in previous commit (Daniel P. Berrange),<br/>
Fix multiple formatting problems in HTML docs (Daniel P. Berrange),<br/>
fix 'since' for socket path generation (Ján Tomko)<br/>
</li>
<li>Portability:<br/>
vbox: define DYNLIB_NAME for kFreeBSD (Guido Günther),<br/>
build: skip qemu in tests when !WITH_QEMU (Eric Blake),<br/>
build: use correct rpc.h for virtlockd (Eric Blake),<br/>
build: work around cygwin header bug (Eric Blake),<br/>
build: cast [ug]id_t when printing (Eric Blake),<br/>
build: port qemu to cygwin (Eric Blake),<br/>
build: use correct rpc.h for lockd (Eric Blake),<br/>
build: work around broken sasl header (Eric Blake),<br/>
build: fix build without libvirtd (Eric Blake),<br/>
build: fix build with newer gnutls (Eric Blake),<br/>
build: fix build with older gcc (Eric Blake),<br/>
qemu: Fix build without gnutls (Jiri Denemark),<br/>
spec: Build vbox packages only for x86 architectures (Viktor Mihajlovski),<br/>
Add missing c-ctype.h to virfile.c (Daniel P. Berrange),<br/>
test: fix VPATH fchosttest failure (Viktor Mihajlovski),<br/>
libxl: fix build with Xen4.3 (Jim Fehlig),<br/>
build: Fix check-driverimpls in VPATH (Jiri Denemark),<br/>
util: Fix build without devmapper (Jiri Denemark),<br/>
FreeBSD: disable buggy -fstack-protector-all (Roman Bogorodskiy),<br/>
build: avoid gcrypt deprecation warnings (Roman Bogorodskiy),<br/>
build: avoid shadowed variable in fdstreamtest (Eric Blake),<br/>
fix virNetDevSetMAC and virNetDevExists on BSD (Roman Bogorodskiy),<br/>
Disable some URI tests on older libxml2 (Daniel P. Berrange),<br/>
Fix build of python bindings on Python 2.4 (Daniel P. Berrange),<br/>
build: fix build with old polkit0 (Jim Fehlig),<br/>
Fixup rpcgen code on kFreeBSD too (Guido Günther),<br/>
build: avoid non-portable cast of pthread_t (Eric Blake),<br/>
build: Fix build when WITH_HAL is defined (Jim Fehlig),<br/>
build: fix mingw build of vbox (Eric Blake),<br/>
build: fix mingw build of virprocess.c (Eric Blake)<br/>
</li>
<li>Bug Fixes:<br/>
conf: Generate address for scsi host device automatically (Osier Yang),<br/>
qemu: prevent termination of guests w/hostdev on driver reconnect (Laine Stump),<br/>
qemu: escape literal IPv6 address in NBD migration (Ján Tomko),<br/>
Check for existence of interface prior to setting terminate flag (John Ferlan),<br/>
Resolve memory leak found by valgrind (John Ferlan),<br/>
qemu: snapshot: Don't kill access to disk if snapshot creation fails (Peter Krempa),<br/>
virsh: migrate: Don't disallow --p2p and --migrateuri (Cole Robinson),<br/>
qemu: Don't report error on successful media eject (Cole Robinson),<br/>
qemu: save domain state to XML after reboot (Sergey Fionov),<br/>
esx: Fix dynamic VI object type detection (Matthias Bolte),<br/>
storage_conf: Don't leak "uuid" in virStoragePoolDefParseAuthCephx (Osier Yang),<br/>
storage_conf: Fix the wrong error message (Osier Yang),<br/>
Fix blkdeviotune for shutoff domain (Martin Kletzander),<br/>
virsh: Fix regression of vol-resize (Osier Yang),<br/>
xen: Resolve Coverity FORWARD_NULL issue (John Ferlan),<br/>
qemu: fix NBD migration to hosts with IPv6 enabled (Ján Tomko),<br/>
conf: fix use after free in virChrdevOpen (Ján Tomko),<br/>
virNetMessageSaveError: Fix copy and paste error (Michal Privoznik),<br/>
virNWFilterHashTablePut: Free the correct variable (Michal Privoznik),<br/>
umlConnectTapDevice: initialize tapfd variable (Michal Privoznik),<br/>
remote: fix dom-&gt;id after virDomainCreateWithFlags (Marek Marczykowski),<br/>
virsh: Fix virDomainFree for NULL domain in blkdeviotune (Martin Kletzander),<br/>
virNetDevTapCreate: Fail on systems not supporting IFF_MULTI_QUEUE (Michal Privoznik),<br/>
cgroup: be robust against cgroup movement races (Eric Blake),<br/>
shunloadtest: Resolve Coverity CHECKED_RETURN error (John Ferlan),<br/>
xencapstest: Resolve Coverity CHECKED_RETURN error (John Ferlan),<br/>
qemu: fix a typo in qemuAddSharedDevice (Guannan Ren),<br/>
qemuDomainChangeEjectableMedia: Unlock domain while waiting for event (Michal Privoznik),<br/>
LXC: fix memory leak in virLXCControllerSetupDevPTS (Gao feng),<br/>
LXC: remove unnecessary check on root filesystem (Gao feng),<br/>
esx: Fix error reporting in esxVI_LookupManagedObjectHelper (Matthias Bolte),<br/>
Fix failure to detect missing cgroup partitions (Daniel P. Berrange),<br/>
libxl: fix leaking libxl events (Jim Fehlig),<br/>
qemu: Fix cgroup handling when setting VCPU BW (Martin Kletzander),<br/>
Don't mount selinux fs in LXC if selinux is disabled (Daniel P. Berrange),<br/>
Fix LXC startup when /var/run is an absolute symlink (Daniel P. Berrange),<br/>
conf: Fix the bug of disk-&gt;copy_on_read formating (Osier Yang),<br/>
daemon: fix leak after listing all volumes (Ján Tomko),<br/>
qemu: Fix crash in migration of graphics-less guests. (Viktor Mihajlovski),<br/>
Adjust improperly formatted &lt;sysinfo&gt; uuid (John Ferlan),<br/>
storage: Ensure 'qemu-img resize' size arg is a 512 multiple (Christophe Fergeau),<br/>
spec: fix outdated comment (Eric Blake),<br/>
Forbid use of ':' in RBD pool names (Daniel P. Berrange),<br/>
qemu: fix bad free (Eric Blake),<br/>
Fix starting domains when kernel has no cgroups support (Jim Fehlig),<br/>
Fix error handling of readdir() in virFileLoopDeviceOpen (Daniel P. Berrange),<br/>
util: Fix regression introduced by commit 4360a098441 (Osier Yang),<br/>
util: Fix regression of wwn reading (Osier Yang),<br/>
build: fix use of mmap (Eric Blake),<br/>
conf: don't crash on a tpm device with no backends (Ján Tomko),<br/>
don't mention disk controllers in generic controller errors (Ján Tomko),<br/>
iscsi: don't leak portal string when starting a pool (Ján Tomko),<br/>
virsh: Resolve Coverity 'MISSING_BREAK' (John Ferlan),<br/>
lxc: Coverity false positive USE_AFTER_FREE (John Ferlan),<br/>
Don't allow renaming of domains by the backdoor (Daniel P. Berrange),<br/>
qemu: fix stupid typos in VFIO cgroup setup/teardown (Laine Stump),<br/>
Ignore 'uri' parameter in lockd driver (Daniel P. Berrange),<br/>
network: fix network driver startup for qemu:///session (Laine Stump),<br/>
Fix warning about unsupported cookie flags in QEMU driver (Daniel P. Berrange),<br/>
Fix release of resources with lockd plugin (Daniel P. Berrange),<br/>
Fix F_DUPFD_CLOEXEC operation args (Daniel P. Berrange),<br/>
build: fix make rpm failure (Laine Stump),<br/>
Fix potential use of undefined variable in remote dispatch code (Daniel P. Berrange),<br/>
virInitctlRequest: unbreak make syntax check (Guido Günther),<br/>
virInitctlRequest: unbreak make syntax check (Guido Günther)<br/>
</li>
<li>Improvements:<br/>
nodedev_hal: Modernize the function's style (Osier Yang),<br/>
Introduce virFilePrintf() as a portable fprintf() (Daniel P. Berrange),<br/>
qemu: migration: error if tunnelled + storage specified (Cole Robinson),<br/>
qemu: migration: Improve p2p error if we can't open conn (Cole Robinson),<br/>
storage_conf: Use uid_t/gid_t instead of int to cast the value (Osier Yang),<br/>
storage_conf: Improve error messages (Osier Yang),<br/>
storage_conf: Use NULLSTR instead (Osier Yang),<br/>
storage_conf: Improve the memory deallocation of virStorageVolDefParseXML (Osier Yang),<br/>
storage_conf: Improve the memory deallocation of pool def parsing (Osier Yang),<br/>
syntax: fix broken error message in previous patch (Eric Blake),<br/>
util: fix the VIR_STRDUP when src is NULL (yangdongsheng),<br/>
Adapt to new VIR_STRNDUP behavior (Michal Privoznik),<br/>
virStrndup: Accept negative values as string length (Michal Privoznik),<br/>
storage_conf: Fix the error type (Osier Yang),<br/>
storage_conf: Put "%s" at the same line with error type (Osier Yang),<br/>
storage_conf: Use xmlStrEqual instead of STREQ (Osier Yang),<br/>
storage_conf: Remove the useless casting (Osier Yang),<br/>
syntax-check: ignore all quoted strings in bracket-spacing (Ján Tomko),<br/>
nwfilter: Remove error report in virNWFilterDHCPSnoopEnd (Stefan Berger),<br/>
cgroups: Do not enforce nonexistent controllers (Viktor Mihajlovski),<br/>
Introduce syntax-check rule to prefer VIR_STRDUP over strdup (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in tools/virsh.c (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/util/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/util/vircgroup.c (Michal Privoznik),<br/>
virCgroupAddTaskStrController: s/-1/-ENOMEM/ (Michal Privoznik),<br/>
conf: add missing OOM errors (Ján Tomko),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/xenxs/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/xenapi/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/xen/* (Michal Privoznik),<br/>
Fix the build failure (Osier Yang),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/security/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/rpc/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/remote/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/qemu/* (Michal Privoznik),<br/>
virsh: omit OPTION section in 'virsh help' if no option exists (Zhang Xiaohe),<br/>
Change virConnectDomainEventGraphicsCallback signature (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/openvz/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/conf/* (Michal Privoznik),<br/>
qemu: Enable multiqueue network (Michal Privoznik),<br/>
qemu: Adapt qemuBuildInterfaceCommandLine to to multiqueue net (Michal Privoznik),<br/>
qemu: Move interface cmd line construction into a separate function (Michal Privoznik),<br/>
Introduce /domain/devices/interface/driver/@queues attribute (Michal Privoznik),<br/>
qemu: add ', share=&lt;policy&gt;' to qemu commandline (Guannan Ren),<br/>
conf: add 'sharePolicy' attribute to graphics element for vnc (Guannan Ren),<br/>
qemu: new vnc display sharing policy caps flag (Guannan Ren),<br/>
vbox: fix VIR_STRDUP value check (Ján Tomko),<br/>
syntax-check: Add the rule to forbid whitespace before ";" (Osier Yang),<br/>
Fix the syntax-check failure (Osier Yang),<br/>
interface: list all interfaces with flags == 0 (Guannan Ren),<br/>
Convert Xen domain core dump driver methods to use virDomainDefPtr (Daniel P. Berrange),<br/>
Convert Xen domain stats/peek driver methods to use virDomainDefPtr (Daniel P. Berrange),<br/>
Convert Xen domain scheduler driver methods to use virDomainDefPtr (Daniel P. Berrange),<br/>
Convert Xen domain autostart driver methods to use virDomainDefPtr (Daniel P. Berrange),<br/>
Convert Xen domain device hotplug driver methods to use virDomainDefPtr (Daniel P. Berrange),<br/>
Convert Xen domain VCPU driver methods to use virDomainDefPtr (Daniel P. Berrange),<br/>
Convert Xen domain create/define/getxml/migration APIs to use virDomainDefPtr (Daniel P. Berrange),<br/>
Convert Xen domain managed save driver methods to use virDomainDefPtr (Daniel P. Berrange),<br/>
Convert Xen domain property driver methods to use virDomainDefPtr (Daniel P. Berrange),<br/>
Convert Xen domain lifecycle driver methods to use virDomainDefPtr (Daniel P. Berrange),<br/>
Convert Xen domain lookup driver methods to use virDomainDefPtr (Daniel P. Berrange),<br/>
qemu: Don't remove the "return 0" (Osier Yang),<br/>
esx: Replace almost all esxVI_String_DeepCopyValue vith VIR_STRDUP (Matthias Bolte),<br/>
vmware: Restore OOM error reporting in vmwareCopyVMXFileName (Matthias Bolte),<br/>
maint: enforce correct copyright usage (Eric Blake),<br/>
maint: refer to correct license file (Eric Blake),<br/>
maint: follow recommended practice for using LGPL (Eric Blake),<br/>
maint: use LGPL correctly (Eric Blake),<br/>
openvzDomainSetNetwork: use virCommand (Michal Privoznik),<br/>
qemu: Add callback struct for qemuBuildCommandLine (Osier Yang),<br/>
storage_conf: Improve the coding style in storage_conf.h (Osier Yang),<br/>
storage_conf: Fix indentions in storage_conf.c (Osier Yang),<br/>
storage_conf: Fix the coding stype in storage_conf.c (Osier Yang),<br/>
qemu: Abstract code for cpuset controller setting into a helper (Osier Yang),<br/>
qemu: Abstract code for devices controller setting into a helper (Osier Yang),<br/>
qemu: Abstract code for memory controller setting into a helper (Osier Yang),<br/>
qemu: Abstract the code for blkio controller setting into a helper (Osier Yang),<br/>
Add libvirt-daemon-vbox &amp; libvirt-daemon-driver-vbox RPMs (Daniel P. Berrange),<br/>
Include GNULIB mkdtemp module (Daniel P. Berrange),<br/>
Set PKG_CONFIG_LIBDIR in autobuild.sh (Daniel P. Berrange),<br/>
qemu: report useful error failling to destroy domain gracefully (Guannan Ren),<br/>
qemu: Check conflicts for shared scsi host device (Osier Yang),<br/>
Re-add selinux/selinux.h to lxc_container.c (Daniel P. Berrange),<br/>
schema: make source optional in volume XML (Ján Tomko),<br/>
schema: require target path in storage pool xml (Ján Tomko),<br/>
qemu: Change values of disk discard (Osier Yang),<br/>
qemu: Implement support for locking domain's memory pages (Jiri Denemark),<br/>
Add support for locking domain's memory pages (Jiri Denemark),<br/>
Fix build with VirtualBox (Jiri Denemark),<br/>
qemu: Set unpriv_sgio for scsi host device (Osier Yang),<br/>
qemu: Refactor qemuSetUnprivSGIO to support scsi host device (Osier Yang),<br/>
qemu: Move qemuSetUnprivSGIO into qemu_conf.c (Osier Yang),<br/>
conf: Introduce sgio for hostdev (Osier Yang),<br/>
Rename virDomainDiskSGIO to virDomainDeviceSGIO (Osier Yang),<br/>
qemu: Manage shared device entry for scsi host device (Osier Yang),<br/>
qemu: Refactor the helpers to track shared scsi host device (Osier Yang),<br/>
utils: Add a helper to get the device name that sg device mapped to (Osier Yang),<br/>
qemu: Rename qemu_driver-&gt;sharedDisks to qemu_driver->sharedDevices (Osier Yang),<br/>
conf: Introduce &lt;shareable&gt; for hostdev (Osier Yang),<br/>
string: test VIR_STRDUP (Eric Blake),<br/>
virsh: lookup interface by name or mac other than one by one (Guannan Ren),<br/>
nwfilter: check for inverted ctdir (Stefan Berger),<br/>
Validate the bios_date format for &lt;sysinfo&gt; (John Ferlan),<br/>
Remove obsolete skipRoot flag in LXC driver (Daniel P. Berrange),<br/>
Stop passing around old root directory prefix (Daniel P. Berrange),<br/>
Remove obsolete pivotRoot flag in LXC driver (Daniel P. Berrange),<br/>
qemu: Support discard for disk (Osier Yang),<br/>
Handle the domain event 'on_reboot' and 'on_poweroff' settings (John Ferlan),<br/>
Adjust comments to describe on_poweroff and on_reboot action (John Ferlan),<br/>
Adjust usage of qemu -no-reboot and -no-shutdown options (John Ferlan),<br/>
qemu: Add VNC WebSocket support (Martin Kletzander),<br/>
Add VNC WebSocket support (Martin Kletzander),<br/>
qemu: New XML to disable memory merge at guest startup (Osier Yang),<br/>
qemu: detect -machine mem-merge capability (Eric Blake),<br/>
Rename rbd-invalid.xml to rbd-no-colon.xml (Daniel P. Berrange),<br/>
tests: Add fchostdata in EXTRA_DIST (Osier Yang),<br/>
virsh: Pretty the output of qemu-agent-command (Osier Yang),<br/>
virsh: Use vshPrint instead of printf (Osier Yang),<br/>
Fix invalid argument reference in virnetdev.h (Martin Kletzander),<br/>
Don't duplicate compiler warning flags when linking (Daniel P. Berrange),<br/>
Only pass -export-dynamic to linker, not compiler (Daniel P. Berrange),<br/>
Correctly detect warning flags with clang (Daniel P. Berrange),<br/>
Ignore cast alignment warnings in inotify code for Xen. (Daniel P. Berrange),<br/>
Workaround issue with clang and inline functions with static vars (Daniel P. Berrange),<br/>
Ensure consistent enablement of gcc 'diagnostic' pragma (Daniel P. Berrange),<br/>
qemu: query command line options in QMP (Eric Blake),<br/>
qemu: simplify string cleanup (Eric Blake),<br/>
qemu: use bool in monitor struct (Eric Blake),<br/>
json: support removing a value from an object (Eric Blake),<br/>
Don't overwrite useful message when creating macvlan fails (Daniel P. Berrange),<br/>
Remove &amp; ban use of select() for waiting for I/O (Daniel P. Berrange),<br/>
qemu: Add hotplug support for scsi host device (Han Cheng),<br/>
.gitignore: add fchosttest (Ján Tomko),<br/>
qemu: Refactor helpers for USB device attachment (Osier Yang),<br/>
Escaping leading '.' in cgroup names (Daniel P. Berrange),<br/>
qemu: Introduce activeScsiHostdevs list for scsi host devices (Han Cheng),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/vbox/* (Michal Privoznik),<br/>
Support NBD backed disks/filesystems in LXC driver (Daniel P. Berrange),<br/>
Add 'nbd' as a valid filesystem driver type (Daniel P. Berrange),<br/>
Add a helper API for setting up a NBD device with qemu-nbd (Daniel P. Berrange),<br/>
Re-arrange code setting up ifs/disk loop devices for LXC (Daniel P. Berrange),<br/>
Add support for storage format in FS &lt;driver&gt; (Daniel P. Berrange),<br/>
security_apparmor.c: Include virscsi.h (Michal Privoznik),<br/>
security: Manage the security label for scsi host device (Osier Yang),<br/>
qemu: Allow the scsi-generic device in cgroup (Han Cheng),<br/>
qemu: Support bootindex for scsi host device (Osier Yang),<br/>
Introduce &lt;readonly&gt; for hostdev (Osier Yang),<br/>
rng: Interleave hostdev elements (Osier Yang),<br/>
qemu: Build qemu command line for scsi host device (Han Cheng),<br/>
utils: util functions for scsi hostdev (Han Cheng),<br/>
qemu: New cap flags for scsi-generic (Han Cheng),<br/>
node_device: Clean up unused macros (Osier Yang),<br/>
conf: Generic XMLs for scsi hostdev (Han Cheng),<br/>
tests: Add tests for fc_host (Osier Yang),<br/>
util: Honor the passed sysfs_prefix (Osier Yang),<br/>
util: Update the comment for virGetFCHostNameByWWN (Osier Yang),<br/>
util: Change virIsCapable* to return bool (Osier Yang),<br/>
util: Don't miss the slash in constructed path (Osier Yang),<br/>
build: update to latest gnulib, for syntax-check (Eric Blake),<br/>
Update hellolibvirt to demo virGetLastErrorMessage() (Daniel P. Berrange),<br/>
Add a test case for the fdstream file read/write code (Daniel P. Berrange),<br/>
Allow the iohelper path to be customized by test programs (Daniel P. Berrange),<br/>
Add a virGetLastErrorMessage() function (Daniel P. Berrange),<br/>
Fix iohelper usage with streams opened for read (Daniel P. Berrange),<br/>
Cope with missing swap cgroup controls (Daniel P. Berrange),<br/>
util: move virFile* functions from virutil.c to virfile.c (Laine Stump),<br/>
util: fix virFileOpenAs return value and resulting error logs (Laine Stump),<br/>
Build breaker - requires VIR_FROM_THIS (John Ferlan),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/test/* (Michal Privoznik),<br/>
virGetStorageVol: Don't ignore NULL pool name (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in tests/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/storage/* (Michal Privoznik),<br/>
dom event example: Add error check to impl call (Jesse J. Cook),<br/>
dom event example: init before register event impl (Jesse J. Cook),<br/>
conf: Fix typo in error message in ABI stability check (Peter Krempa),<br/>
tests: use portable shell code (Eric Blake),<br/>
Replace 'goto clean' with 'goto cleanup' in apparmor code (Daniel P. Berrange),<br/>
Replace list of driver source files with variables (Daniel P. Berrange),<br/>
Fix naming of methods in ESX storage backends to follow public APIs (Daniel P. Berrange),<br/>
Skip virNWFilterTechDriver when validating API naming (Daniel P. Berrange),<br/>
Replace 'goto cleanup' with 'goto error' in udev interface driver (Daniel P. Berrange),<br/>
Replace 'goto err' with 'goto cleanup' in udev interface driver (Daniel P. Berrange),<br/>
tests: files named '.*-invalid.xml' should fail validation (Ján Tomko),<br/>
Simplify the Xen domain stats/peek / node memory driver methods (Daniel P. Berrange),<br/>
Simplify the Xen domain autostart driver method (Daniel P. Berrange),<br/>
Simplify the Xen domain scheduler parameter driver methods (Daniel P. Berrange),<br/>
Simplify the Xen domain attach/dettach driver methods (Daniel P. Berrange),<br/>
Simplify the Xen domain define/undefine driver methods (Daniel P. Berrange),<br/>
Simplify the Xen domain start driver method (Daniel P. Berrange),<br/>
Simplify the Xen driver define domain driver methods (Daniel P. Berrange),<br/>
Simplify the Xen domain migration driver methods (Daniel P. Berrange),<br/>
Simplify the Xen domain get XML driver method (Daniel P. Berrange),<br/>
Simplify the Xen domain VCPU driver methods (Daniel P. Berrange),<br/>
Simplify the Xen domain save/restore driver methods (Daniel P. Berrange),<br/>
Simplify the Xen domain get info/state driver methods (Daniel P. Berrange),<br/>
Simplify the Xen domain get/set (max) memory driver methods (Daniel P. Berrange),<br/>
Remove Xen get hostname driver method (Daniel P. Berrange),<br/>
Simplify the Xen domain get OS type driver method (Daniel P. Berrange),<br/>
Simplify the Xen domain destroy driver method (Daniel P. Berrange),<br/>
Simplify the Xen domain shutdown/reboot driver methods (Daniel P. Berrange),<br/>
Simplify the Xen domain suspend/resume driver methods (Daniel P. Berrange),<br/>
Simplify the Xen domain is persistent driver method (Daniel P. Berrange),<br/>
Simplify the Xen domain lookup driver methods (Daniel P. Berrange),<br/>
Simplify the Xen domain create driver method (Daniel P. Berrange),<br/>
Simplify the Xen count/list domains driver methods (Daniel P. Berrange),<br/>
Simplify the Xen get max vcpus / node get info driver methods (Daniel P. Berrange),<br/>
Simplify the Xen get version driver method (Daniel P. Berrange),<br/>
Simplify the Xen get type driver method (Daniel P. Berrange),<br/>
Simplify opening of Xen drivers (Daniel P. Berrange),<br/>
Remove pointless GET_PRIVATE macro from Xen driver (Daniel P. Berrange),<br/>
Remove VIR_CONNECT_RO checks from xen drivers (Daniel P. Berrange),<br/>
Remove xen driver checks for priv-&gt;handle &lt; 0 (Daniel P. Berrange),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/vmx/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/vmware/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/uml/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/secret/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/phyp/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/parallels/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/nwfilter/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/interface/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/node_device/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/network/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/lxc/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/locking/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/libxl/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/hyperv/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/esx/* (Michal Privoznik),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in src/cpu/* (Michal Privoznik),<br/>
Delete udevFreeIfaceDef function in udev interface driver (Daniel P. Berrange),<br/>
maint: update to latest gnulib (Eric Blake),<br/>
Unmerge attach/update/modify device APIs in drivers (Daniel P. Berrange),<br/>
Pull parsing of migration xml up into QEMU driver APIs (Daniel P. Berrange),<br/>
Fix naming of some node device APIs (Daniel P. Berrange),<br/>
Separate internal node suspend APIs from public API (Daniel P. Berrange),<br/>
Separate internal node device APIs from public API (Daniel P. Berrange),<br/>
Separate virGetHostname() API contract from driver APIs (Daniel P. Berrange),<br/>
Include process start time when doing polkit checks (Daniel P. Berrange),<br/>
Rename "security context" to "selinux context" (Daniel P. Berrange),<br/>
Fix possible undefined value in check-symsorting.pl (Daniel P. Berrange),<br/>
storage: Skip inactive lv volumes (Osier Yang),<br/>
string: make VIR_STRDUP easier to use (Eric Blake),<br/>
alloc: make VIR_APPEND_ELEMENT safer (Eric Blake),<br/>
syntax-check: forbid virBufferAsprintf with string literals (Ján Tomko),<br/>
get rid of virBufferAsprintf where possible (Ján Tomko),<br/>
qemu: allocate network connections sooner during domain startup (Laine Stump),<br/>
Ensure stub todo.html.in file is HTML5 (Daniel P. Berrange),<br/>
qemu: Enable the capability bit for -no-kvm-pit-reinjection on x86 only (Boris Fiuczynski),<br/>
rpc: message related sizes enlarged (Daniel Hansel),<br/>
qemu: Do fake auto-allocation of ports when generating native command (Peter Krempa),<br/>
spec: proper soft static allocation of qemu uid (Eric Blake),<br/>
build: always include libvirt_lxc.syms in tarball (Eric Blake),<br/>
Adapt to VIR_STRDUP and VIR_STRNDUP in daemon/* (Michal Privoznik),<br/>
virstring: Introduce VIR_STRDUP and VIR_STRNDUP (Michal Privoznik),<br/>
Make detect_scsi_host_caps a function on all architectures (Guido Günther),<br/>
More paranoid initialization of 'nparams' variable in dispatch code (Daniel P. Berrange),<br/>
Fix format string handling in network driver (Daniel P. Berrange),<br/>
esx: Reduce code duplication in generator (Matthias Bolte),<br/>
build: avoid useless virAsprintf (Eric Blake),<br/>
build: always include sanitytest in tarball (Eric Blake),<br/>
util: fix compile errors caused by moving string functions (Laine Stump),<br/>
virutil: Move string related functions to virstring.c (Michal Privoznik),<br/>
qemu: Generate agent socket path if missing (Michal Privoznik),<br/>
build: fix FreeBSD build (Eric Blake)<br/>
</li>
<li>Cleanups:<br/>
Storage: Fix the indention of rbd test file (Osier Yang),<br/>
qemu: Fix damaged whitespace (Peter Krempa),<br/>
Properly indent function's opening bracket (Martin Kletzander),<br/>
build: fix typo in earlier commit (Eric Blake),<br/>
build: drop unused variable (Eric Blake),<br/>
syntax-check: mandate space after mid-line semicolon (Eric Blake),<br/>
syntax: prefer space after semicolon in for loop (Eric Blake),<br/>
security_dac: Fix the coding style (Osier Yang),<br/>
nwfilter: Change the comment style (Osier Yang),<br/>
src/*.[ch]: Remove the whitespace before ";" (Osier Yang),<br/>
src/locking: Remove the whitespace before ";" (Osier Yang),<br/>
python: Remove the whitespace before ";" (Osier Yang),<br/>
examples: Remove the whitespace before ';' (Osier Yang),<br/>
src/lxc: Remove the whitespace before ";" (Osier Yang),<br/>
src/remote: Remove the whitespace before ";" (Osier Yang),<br/>
src/rpc: Remove the whitespace before ";" (Osier Yang),<br/>
src/utils: Remove the whitespace before ";" (Osier Yang),<br/>
tests/: Remove the whitespace before ";" (Osier Yang),<br/>
daemon: Remove the whitespace before ";" (Osier Yang),<br/>
tools: Remove the whitespace before ";" (Osier Yang),<br/>
src/storage: Remove the whitespace before ';' (Osier Yang),<br/>
src/security: Remove the whitespace before ';' (Osier Yang),<br/>
src/xen: Remove the whitespace before ';' (Osier Yang),<br/>
src/vmware: Remove the whitespace before ';' (Osier Yang),<br/>
src/qemu: Remove the whitespace before ';' (Osier Yang),<br/>
src/interface: Remove the whitespace before ';' (Osier Yang),<br/>
src/parallels: Remove the whitespace before ';' (Osier Yang),<br/>
src/uml: Remove the whitespace before ';' (Osier Yang),<br/>
src/openvz: Remove the whitespace before ';' (Osier Yang),<br/>
src/node_device: Remove the whitespace before ';' (Osier Yang),<br/>
src/phyp: Remove the whitespace before ';' (Osier Yang),<br/>
src/nwfilter: Remove the whitespace before ';' (Osier Yang),<br/>
src/xenxs: Remove the whitespace before ';' (Osier Yang),<br/>
src/vbox: Remove the whitespace before ';' (Osier Yang),<br/>
src/test: Remove the whitespace before ';' (Osier Yang),<br/>
src/conf: Remove the whitespace before ';' (Osier Yang),<br/>
src/libxl: Remove the whitespace before ';' (Osier Yang),<br/>
src/network: Remove the whitespace before ';' (Osier Yang),<br/>
LXC: move the comments to the proper place (Gao feng),<br/>
conf: Improve the coding style (Osier Yang),<br/>
tests: Sort the EXTRA_DIST list (Osier Yang),<br/>
libvirt.c: Fix the indention (Osier Yang),<br/>
conf: Remove the unrelated comment (Osier Yang),<br/>
build: clean up stray files found by 'make distcheck' (Eric Blake),<br/>
Remove redundant () in expression (Daniel P. Berrange)<br/>
</li>
</ul>
<h3>1.0.5: May 2 2013</h3>
<ul>
<li>Features:<br/>

View File

@ -1,14 +1,16 @@
<?xml version="1.0"?>
<xsl:stylesheet
xmlns="http://www.w3.org/1999/xhtml"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
exclude-result-prefixes="xsl exsl"
exclude-result-prefixes="xsl exsl html"
version="1.0">
<!-- The sitemap.html.in page contains the master navigation structure -->
<xsl:variable name="sitemap" select="document('sitemap.html.in')/html/body/div[@id='sitemap']"/>
<xsl:variable name="sitemap" select="document('sitemap.html.in')/html:html/html:body/html:div[@id='sitemap']"/>
<xsl:template match="code[@class='docref']" mode="content">
<xsl:template match="html:code[@class='docref']" mode="content">
<xsl:variable name="name"><xsl:value-of select="."/></xsl:variable>
<a href="html/libvirt-libvirt.html#{$name}"><code><xsl:value-of select="$name"/></code></a>
</xsl:template>
@ -20,17 +22,17 @@
</xsl:template>
<xsl:template match="ul[@id='toc']" mode="content">
<xsl:template match="html:ul[@id='toc']" mode="content">
<xsl:call-template name="toc"/>
</xsl:template>
<!-- This processes the sitemap to form a context sensitive
navigation menu for the current page -->
<xsl:template match="ul" mode="menu">
<xsl:template match="html:ul" mode="menu">
<xsl:param name="pagename"/>
<xsl:param name="level"/>
<ul class="{concat('l', $level)}">
<xsl:for-each select="li">
<xsl:for-each select="html:li">
<!-- The extra div tag here works around an IE6 whitespace collapsing problem -->
<li><div>
<!-- A menu is active if there is an 'a' tag with
@ -38,7 +40,7 @@
or a child menu -->
<xsl:variable name="class">
<xsl:choose>
<xsl:when test="count(.//a[@href = $pagename]) > 0">
<xsl:when test="count(.//html:a[@href = $pagename]) > 0">
<xsl:text>active</xsl:text>
</xsl:when>
<xsl:otherwise>
@ -51,21 +53,21 @@
the immediate 'a' tag has href matching the
current pagename -->
<xsl:choose>
<xsl:when test="$pagename = a/@href">
<span class="{$class}"><xsl:value-of select="a"/></span>
<xsl:when test="$pagename = html:a/@href">
<span class="{$class}"><xsl:value-of select="html:a"/></span>
</xsl:when>
<xsl:when test="starts-with(a/@href, 'http://wiki.libvirt.org')">
<a title="{./span}" class="{$class}" href="{a/@href}"><xsl:value-of select="a"/></a>
<xsl:when test="starts-with(html:a/@href, 'http://wiki.libvirt.org')">
<a title="{./html:span}" class="{$class}" href="{html:a/@href}"><xsl:value-of select="html:a"/></a>
</xsl:when>
<xsl:otherwise>
<a title="{./span}" class="{$class}" href="{concat($href_base, a/@href)}"><xsl:value-of select="a"/></a>
<a title="{./html:span}" class="{$class}" href="{concat($href_base, html:a/@href)}"><xsl:value-of select="html:a"/></a>
</xsl:otherwise>
</xsl:choose>
<!-- A sub-menu should only be expanded it contains
an 'a' tag with href matching this pagename -->
<xsl:if test="count(.//a[@href = $pagename]) > 0">
<xsl:apply-templates select="ul" mode="menu">
<xsl:if test="count(.//html:a[@href = $pagename]) > 0">
<xsl:apply-templates select="html:ul" mode="menu">
<xsl:with-param name="pagename" select="$pagename"/>
<xsl:with-param name="level" select="$level + 1"/>
</xsl:apply-templates>
@ -77,33 +79,33 @@
<xsl:template name="toc">
<ul>
<xsl:for-each select="/html/body/h2[count(a) = 1]">
<xsl:for-each select="/html:html/html:body/html:h2[count(html:a) = 1]">
<xsl:variable name="thish2" select="."/>
<li>
<a href="#{a/@name}"><xsl:value-of select="a/text()"/></a>
<xsl:if test="count(./following-sibling::h3[preceding-sibling::h2[1] = $thish2 and count(a) = 1]) > 0">
<a href="#{html:a/@name}"><xsl:value-of select="html:a/text()"/></a>
<xsl:if test="count(./following-sibling::html:h3[preceding-sibling::html:h2[1] = $thish2 and count(html:a) = 1]) > 0">
<ul>
<xsl:for-each select="./following-sibling::h3[preceding-sibling::h2[1] = $thish2 and count(a) = 1]">
<xsl:for-each select="./following-sibling::html:h3[preceding-sibling::html:h2[1] = $thish2 and count(html:a) = 1]">
<xsl:variable name="thish3" select="."/>
<li>
<a href="#{a/@name}"><xsl:value-of select="a/text()"/></a>
<xsl:if test="count(./following-sibling::h4[preceding-sibling::h3[1] = $thish3 and count(a) = 1]) > 0">
<a href="#{html:a/@name}"><xsl:value-of select="html:a/text()"/></a>
<xsl:if test="count(./following-sibling::html:h4[preceding-sibling::html:h3[1] = $thish3 and count(html:a) = 1]) > 0">
<ul>
<xsl:for-each select="./following-sibling::h4[preceding-sibling::h3[1] = $thish3 and count(a) = 1]">
<xsl:for-each select="./following-sibling::html:h4[preceding-sibling::html:h3[1] = $thish3 and count(html:a) = 1]">
<xsl:variable name="thish4" select="."/>
<li>
<a href="#{a/@name}"><xsl:value-of select="a/text()"/></a>
<xsl:if test="count(./following-sibling::h5[preceding-sibling::h4[1] = $thish4 and count(a) = 1]) > 0">
<a href="#{html:a/@name}"><xsl:value-of select="html:a/text()"/></a>
<xsl:if test="count(./following-sibling::html:h5[preceding-sibling::html:h4[1] = $thish4 and count(html:a) = 1]) > 0">
<ul>
<xsl:for-each select="./following-sibling::h5[preceding-sibling::h4[1] = $thish4 and count(a) = 1]">
<xsl:for-each select="./following-sibling::html:h5[preceding-sibling::html:h4[1] = $thish4 and count(html:a) = 1]">
<xsl:variable name="thish5" select="."/>
<li>
<a href="#{a/@name}"><xsl:value-of select="a/text()"/></a>
<xsl:if test="count(./following-sibling::h6[preceding-sibling::h5[1] = $thish5 and count(a) = 1]) > 0">
<a href="#{html:a/@name}"><xsl:value-of select="html:a/text()"/></a>
<xsl:if test="count(./following-sibling::html:h6[preceding-sibling::html:h5[1] = $thish5 and count(html:a) = 1]) > 0">
<ul>
<xsl:for-each select="./following-sibling::h6[preceding-sibling::h5[1] = $thish5 and count(a) = 1]">
<xsl:for-each select="./following-sibling::html:h6[preceding-sibling::html:h5[1] = $thish5 and count(html:a) = 1]">
<li>
<a href="#{a/@name}"><xsl:value-of select="a/text()"/></a>
<a href="#{html:a/@name}"><xsl:value-of select="html:a/text()"/></a>
</li>
</xsl:for-each>
</ul>
@ -136,7 +138,7 @@
<head>
<link rel="stylesheet" type="text/css" href="{$href_base}main.css"/>
<link rel="SHORTCUT ICON" href="{$href_base}32favicon.png"/>
<title>libvirt: <xsl:value-of select="html/body/h1"/></title>
<title>libvirt: <xsl:value-of select="html:html/html:body/html:h1"/></title>
<meta name="description" content="libvirt, virtualization, virtualization API"/>
</head>
<body>
@ -153,13 +155,13 @@
</div>
<div id="body">
<div id="menu">
<xsl:apply-templates select="exsl:node-set($sitemap)/ul" mode="menu">
<xsl:apply-templates select="exsl:node-set($sitemap)/html:ul" mode="menu">
<xsl:with-param name="pagename" select="$pagename"/>
<xsl:with-param name="level" select="0"/>
</xsl:apply-templates>
</div>
<div id="content">
<xsl:apply-templates select="/html/body/*" mode="content"/>
<xsl:apply-templates select="/html:html/html:body/*" mode="content"/>
</div>
</div>
<div id="footer">

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Pending patches needing review</h1>
<p> A list of pending patches needing review upstream is available

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>PHP API bindings</h1>

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Python API bindings</h1>

View File

@ -1,4 +1,6 @@
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Related links</h1>

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1 >Remote support</h1>
<p>

View File

@ -1,5 +1,18 @@
## Copyright (C) 2005-2011 Red Hat, Inc.
## See COPYING.LIB for the License of this software
## Copyright (C) 2005-2011, 2013 Red Hat, Inc.
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
##
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public
## License along with this library. If not, see
## <http://www.gnu.org/licenses/>.
schemadir = $(pkgdatadir)/schemas
schema_DATA = \
@ -15,6 +28,7 @@ schema_DATA = \
nwfilter.rng \
secret.rng \
storageencryption.rng \
storagefilefeatures.rng \
storagepool.rng \
storagevol.rng

View File

@ -243,11 +243,9 @@
<optional>
<ref name="osbootkernel"/>
</optional>
<optional>
<zeroOrMore>
<ref name="osbootdev"/>
</zeroOrMore>
</optional>
<zeroOrMore>
<ref name="osbootdev"/>
</zeroOrMore>
<optional>
<element name="bootmenu">
<attribute name="enable">
@ -490,11 +488,23 @@
</optional>
<optional>
<element name="memoryBacking">
<optional>
<element name="hugepages">
<empty/>
</element>
</optional>
<interleave>
<optional>
<element name="hugepages">
<empty/>
</element>
</optional>
<optional>
<element name="nosharepages">
<empty/>
</element>
</optional>
<optional>
<element name="locked">
<empty/>
</element>
</optional>
</interleave>
</element>
</optional>
@ -888,7 +898,7 @@
<define name="diskspec">
<interleave>
<optional>
<ref name="driver"/>
<ref name="diskDriver"/>
</optional>
<optional>
<ref name='diskMirror'/>
@ -1270,7 +1280,7 @@
<!--
Disk may use a special driver for access.
-->
<define name="driver">
<define name="diskDriver">
<element name="driver">
<choice>
<group>
@ -1304,6 +1314,9 @@
<optional>
<ref name="copy_on_read"/>
</optional>
<optional>
<ref name="discard"/>
</optional>
<empty/>
</element>
</define>
@ -1314,13 +1327,13 @@
<optional>
<attribute name='type'>
<choice>
<ref name='diskFormat'/>
<ref name='storageFormat'/>
<value>aio</value> <!-- back-compat for 'raw' -->
</choice>
</attribute>
</optional>
</define>
<define name='diskFormat'>
<define name='storageFormat'>
<choice>
<value>raw</value>
<value>dir</value>
@ -1399,6 +1412,14 @@
<value>off</value>
</choice>
</attribute>
</define>
<define name="discard">
<attribute name='discard'>
<choice>
<value>unmap</value>
<value>ignore</value>
</choice>
</attribute>
</define>
<define name="controller">
<element name="controller">
@ -1518,6 +1539,9 @@
<attribute name="type">
<value>file</value>
</attribute>
<optional>
<ref name="fsDriver"/>
</optional>
<interleave>
<element name="source">
<attribute name="file">
@ -1531,6 +1555,9 @@
<attribute name="type">
<value>block</value>
</attribute>
<optional>
<ref name="fsDriver"/>
</optional>
<interleave>
<element name="source">
<attribute name="dev">
@ -1547,6 +1574,9 @@
<value>mount</value>
</attribute>
</optional>
<optional>
<ref name="fsDriver"/>
</optional>
<interleave>
<element name="source">
<attribute name="dir">
@ -1554,22 +1584,6 @@
</attribute>
<empty/>
</element>
<optional>
<element name="driver">
<attribute name="type">
<choice>
<value>path</value>
<value>handle</value>
</choice>
</attribute>
<optional>
<attribute name="wrpolicy">
<value>immediate</value>
</attribute>
</optional>
<empty/>
</element>
</optional>
</interleave>
</group>
<group>
@ -1578,6 +1592,9 @@
<value>bind</value>
</attribute>
</optional>
<optional>
<ref name="fsDriver"/>
</optional>
<interleave>
<element name="source">
<attribute name="dir">
@ -1591,6 +1608,9 @@
<attribute name="type">
<value>template</value>
</attribute>
<optional>
<ref name="fsDriver"/>
</optional>
<interleave>
<element name="source">
<attribute name="name">
@ -1604,6 +1624,9 @@
<attribute name="type">
<value>ram</value>
</attribute>
<optional>
<ref name="fsDriver"/>
</optional>
<interleave>
<element name="source">
<attribute name="usage">
@ -1661,6 +1684,36 @@
</interleave>
</element>
</define>
<define name="fsDriver">
<element name="driver">
<!-- Annoying inconsistency. 'disk' uses 'name'
for this kind of info, and 'type' for the
storage format. We need the latter too, so
had to invent a new attribute name -->
<optional>
<attribute name="type">
<choice>
<value>path</value>
<value>handle</value>
<value>loop</value>
<value>nbd</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="format">
<ref name="storageFormat"/>
</attribute>
</optional>
<optional>
<attribute name="wrpolicy">
<value>immediate</value>
</attribute>
</optional>
<empty/>
</element>
</define>
<!--
An interface description can either be of type bridge in which case
it will use a bridging source, or of type ethernet which uses a device
@ -1957,6 +2010,11 @@
</choice>
</attribute>
</optional>
<optional>
<attribute name='queues'>
<ref name="positiveInteger"/>
</attribute>
</optional>
<optional>
<attribute name="txmode">
<choice>
@ -2070,11 +2128,25 @@
</choice>
</attribute>
</optional>
<optional>
<attribute name="websocket">
<ref name="PortNumber"/>
</attribute>
</optional>
<optional>
<attribute name="listen">
<ref name="addrIPorName"/>
</attribute>
</optional>
<optional>
<attribute name='sharePolicy'>
<choice>
<value>allow-exclusive</value>
<value>force-shared</value>
<value>ignore</value>
</choice>
</attribute>
</optional>
</group>
<group>
<optional>
@ -3054,26 +3126,38 @@
<define name="hostdev">
<element name="hostdev">
<choice>
<group>
<ref name="hostdevsubsys"/>
</group>
<group>
<ref name="hostdevcaps"/>
</group>
</choice>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="deviceBoot"/>
</optional>
<optional>
<ref name="rom"/>
</optional>
<optional>
<ref name="address"/>
</optional>
<interleave>
<choice>
<group>
<ref name="hostdevsubsys"/>
</group>
<group>
<ref name="hostdevcaps"/>
</group>
</choice>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="deviceBoot"/>
</optional>
<optional>
<ref name="rom"/>
</optional>
<optional>
<ref name="address"/>
</optional>
<optional>
<element name="readonly">
<empty/>
</element>
</optional>
<optional>
<element name="shareable">
<empty/>
</element>
</optional>
</interleave>
</element>
</define>
@ -3094,6 +3178,7 @@
<choice>
<ref name="hostdevsubsyspci"/>
<ref name="hostdevsubsysusb"/>
<ref name="hostdevsubsysscsi"/>
</choice>
</define>
@ -3162,6 +3247,28 @@
</element>
</define>
<define name="hostdevsubsysscsi">
<attribute name="type">
<value>scsi</value>
</attribute>
<optional>
<attribute name="sgio">
<choice>
<value>filtered</value>
<value>unfiltered</value>
</choice>
</attribute>
</optional>
<element name="source">
<interleave>
<ref name="sourceinfoadapter"/>
<element name="address">
<ref name="scsiaddress"/>
</element>
</interleave>
</element>
</define>
<define name="hostdevcapsstorage">
<attribute name="type">
<value>storage</value>
@ -3217,6 +3324,17 @@
</attribute>
</element>
</define>
<define name="scsiaddress">
<attribute name="bus">
<ref name="driveBus"/>
</attribute>
<attribute name="target">
<ref name="driveTarget"/>
</attribute>
<attribute name="unit">
<ref name="driveUnit"/>
</attribute>
</define>
<define name="usbportaddress">
<attribute name="bus">
<ref name="usbAddr"/>
@ -3805,7 +3923,7 @@
</attribute>
<optional>
<attribute name='format'>
<ref name='diskFormat'/>
<ref name='storageFormat'/>
</attribute>
</optional>
<optional>
@ -3897,6 +4015,19 @@
<ref name="hypervtristate"/>
</element>
</optional>
<optional>
<element name="vapic">
<ref name="hypervtristate"/>
</element>
</optional>
<optional>
<element name="spinlocks">
<ref name="hypervtristate"/>
<attribute name="retries">
<data type="integer"/>
</attribute>
</element>
</optional>
</interleave>
</element>
</define>

View File

@ -128,7 +128,7 @@
<element name='driver'>
<optional>
<attribute name='type'>
<ref name='diskFormat'/>
<ref name='storageFormat'/>
</attribute>
</optional>
<empty/>

View File

@ -316,6 +316,28 @@
</optional>
</element>
</zeroOrMore>
<!-- <route> element -->
<zeroOrMore>
<!-- The (static) route element specifies a network address and gateway
address to access that network. Both the network address and
the gateway address must be specified. -->
<element name="route">
<optional>
<attribute name="family"><ref name="addr-family"/></attribute>
</optional>
<attribute name="address"><ref name="ipAddr"/></attribute>
<optional>
<choice>
<attribute name="netmask"><ref name="ipv4Addr"/></attribute>
<attribute name="prefix"><ref name="ipPrefix"/></attribute>
</choice>
</optional>
<attribute name="gateway"><ref name="ipAddr"/></attribute>
<optional>
<attribute name="metric"><ref name="unsignedInt"/></attribute>
</optional>
</element>
</zeroOrMore>
</interleave>
</element>
</define>

View File

@ -204,6 +204,14 @@
<param name="maxInclusive">4095</param>
</data>
</attribute>
<optional>
<attribute name="nativeMode">
<choice>
<value>tagged</value>
<value>untagged</value>
</choice>
</attribute>
</optional>
<empty/>
</element>
</oneOrMore>

View File

@ -144,6 +144,17 @@
</element>
</optional>
<optional>
<element name='iommuGroup'>
<attribute name='number'>
<ref name='unsignedInt'/>
</attribute>
<oneOrMore>
<ref name='address'/>
</oneOrMore>
</element>
</optional>
</define>
<define name='capusbdev'>

Some files were not shown because too many files have changed in this diff Show More