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

Compare commits

...

811 Commits

Author SHA1 Message Date
9b889aacef Release of libvirt-0.9.1
* configure.ac libvirt.spec.in docs/news.html.in: update and document
  the release
* po/*.po*: update localizations for german, polish, spanish, ukrainian
  and vietnamese coming from transifex, regenerate
2011-05-05 11:25:13 +08:00
2ffa8b341c maint: detect clang 2.9
In Fedora 15, with clang 2.8, 'scan-build env' shows:
CCC_ANALYZER_ANALYSIS=-analyzer-check-objc-mem -analyzer-check-security-syntactic -analyzer-check-dead-stores -analyzer-check-objc-unused-ivars -analyzer-check-objc-methodsigs

But in rawhide, with clang 2.9, the same variable is set but
empty, implying the default set of analysis.  We still want
sa_assert defined in that case, to stop clang from hitting
false positives.

* configure.ac (STATIC_ANALYSIS): Detect clang even when the set
of analyses is the default.
2011-05-04 17:22:22 -06:00
4644f0b253 storage: avoid null deref and leak on failure
Detected by clang.  NULL deref added in commit 343a27a (Mar 11),
but leak of voldef present since commit 2cd9b2d (Apr 09).

* src/storage/storage_driver.c (storageVolumeCreateXML): Don't
leak voldef or dereference null volobj.
2011-05-04 15:01:13 -06:00
6eb3a1f4f7 esx: Disable performance counter queries in esxDomainGetInfo
The queried values aren't used yet.
2011-05-04 20:41:09 +02:00
62a6b7cc9b esx: Avoid null dereference on error in esxDomainGetInfo
Add missing early exits and convert error logging to proper API level
error reporting.

Centralize cleanup code for the PerfQuerySpec object.

Reported by Eric Blake, detected by clang.
2011-05-04 20:25:28 +02:00
85cb292681 remote: avoid null dereference on error
Clang found three instances of uninitialized use of nparams in
the cleanup path.  Unfortunately, one is a false positive: clang
couldn't see that ret->params.params_val is guaranteed to be
NULL unless allocated within a function, and that nparams is
guaranteed to be assigned prior to the allocation; hoisting the
assignment to nparams to be earlier in the function shuts up
that false positive.  But two of the reports also happened to
highlight a real bug - the error path can dereference NULL.

Regression introduced in commit 158ba873.

* daemon/remote.c (remoteDispatchDomainGetMemoryParameters)
(remoteDispatchDomainGetBlkioParameters): Don't clear fields if
array was not allocated.
(remoteDispatchDomainGetSchedulerParameters): Initialize nparams
earlier.
2011-05-04 10:55:29 -06:00
d0a8f99c75 esx: Remove dead store in esxUtil_ParseDatastorePath
The ++ on preliminaryFileName was a left over from a previous version
of this function that explicitly returned the filename and did a strdup
on preliminaryFileName afterwards.

As the filename isn't returned explicitly anymore remove the preliminary
variable for it and reuse the tmp variable instead.

Reported by Eric Blake, detected by clang.
2011-05-04 18:33:14 +02:00
29e131dec2 qemu: update qemuCgroupControllerActive signature
Clang warned about a dead assignment.  In the process, I noticed
that we are only using the function for a bool value.  I audited
all other callers in qemu_{migration,cgroup,driver,hotplug), and
all were making the call in a bool context.

Also, do bounds checking on the argument.

* src/qemu/qemu_cgroup.c (qemuSetupCgroup): Delete dead
assignment.
(qemuCgroupControllerActive): Change return type to bool.
* src/qemu/qemu_cgroup.h (qemuCgroupControllerActive): Likewise.
2011-05-04 09:35:47 -06:00
44aa49aefe util: remove dead assignment
Clang complained about this, and it was easy enough to fix.

* src/util/util.c (virFileOpenAs): Drop dead assignment.
2011-05-04 09:25:07 -06:00
32388f12d5 lxc: report correct error
Clang noticed a dead assignment, which turned out to be the use
of the wrong variable.  rc starts life as -1, and is only ever
assigned to 0 just before a successful cleanup.

* src/lxc/lxc_driver.c (lxcSetupInterfaces): Don't call
virReportSystemError(-1).
2011-05-04 09:24:09 -06:00
710f8811f5 libxl: avoid compiler warning
Detected by gcc:

libxl/libxl_driver.c: In function 'libxlDomainDestroy':
libxl/libxl_drier.c:1351:30: error: variable 'priv' set but not used [-Werror=unused-but-set-variable]

* src/libxl/libxl_driver.c (libxlDomainDestroy): Delete unused
variable.
2011-05-04 09:21:05 -06:00
5f929dd3aa qemu: remove dead assignment
Detected by clang.

* src/qemu/qemu_migration.c (qemuMigrationToFile): Nothing later
uses is_reg.
2011-05-04 09:14:13 -06:00
f72393fa97 storage: use virCommand to avoid compiler warning
clang didn't like the last increment to nargs.  But why even
track nargs ourselves, when virCommand does it for us?

* src/storage/storage_backend_iscsi.c
(virStorageBackendISCSIConnection): Switch to virCommand to avoid
a dead-store warning on nargs.
2011-05-04 08:54:20 -06:00
ead2b43357 cgroup: avoid leaking a file
Clang detected a dead store to rc.  It turns out that in fixing this,
I also found a FILE* leak.

This is a subtle change in behavior, although unlikely to hit.  The
pidfile is a kernel file, so we've probably got more serious problems
under foot if we fail to parse one.  However, the previous behavior
was that even if one pid file failed to parse, we tried others,
whereas now we give up on the first failure.  Either way, though,
the function returns -1, so the caller will know that something is
going wrong, and that not all pids were necessarily reaped.  Besides,
there were other instances already in the code where failure in the
inner loop aborted the outer loop.

* src/util/cgroup.c (virCgroupKillInternal): Abort rather than
resuming loop on fscanf failure, and cleanup file on error.
2011-05-04 08:38:27 -06:00
d8f7528157 qemu: silence clang false positives
Clang 2.8 wasn't quite able to follow that persistentDef was
assigned earlier if (flags & VIR_DOMAIN_MEM_CONFIG) is true.
Silence this false positive, to make clang analysis easier to use.

* src/qemu/qemu_driver.c (qemudDomainSetMemoryFlags): Add an
annotation to silence clang's claim of a NULL dereference.
2011-05-03 13:19:48 -06:00
44699b3283 virsh: avoid null pointer dereference
Clang detected that vol-download will call unlink(NULL) if there
is a parse error during option parsing.  Also, mingw doesn't like
unlinking an open file.

* tools/virsh.c (cmdVolDownload): Only unlink file if created.
2011-05-03 11:00:25 -06:00
1164e1a2da pci: fix null pointer dereference
Clang detected a null-pointer dereference regression, introduced
in commit 4e8969eb.  Without this patch, a device with
unbind_from_stub set to false would eventually try to call
virFileExists on uncomputed drvdir.

* src/util/pci.c (pciUnbindDeviceFromStub): Ensure drvdir is set
before use.
2011-05-03 10:59:57 -06:00
4d080ee403 qemu: avoid null pointer dereference
This code has had problems historically.  As originally
written, in commit 6bcf2501 (Jun 08), it could call unlink
on a random string, nuking an unrelated file.

Then commit 182a80b9 (Sep 09), the code was rewritten to
allocate tmp, with both a use-after-free bug and a chance to
call unlink(NULL).

Commit e206946 (Mar 11) fixed the use-after-free, but not the
NULL dereference.  Thanks to clang for catching this!

* src/qemu/qemu_driver.c (qemudDomainMemoryPeek): Don't call
unlink on NULL.
2011-05-03 10:59:55 -06:00
4b4e8b57c2 tests: avoid null pointer dereference
Unlikely to hit in real life, but clang noticed it.

* tests/commandtest.c (checkoutput, test4, test18): Avoid
unlink(NULL) on OOM.
2011-05-03 10:50:56 -06:00
6e177fa1b6 Revert "lxc: Do not try to reconnect inactive domain when do lxcStartup"
This reverts commit 0e7f7f8566.

From the mailing list:

> So, AFAICT, this patch means we will never reconnect to any LXC
> VMs now.
>
> The correct solution, is to refactor LXC driver startup to work
> the same way as the QEMU driver startup.
>
>   - Load all the live state XML files (to pick up running VMs)
>   - Reconnect to all VMs
>   - Load all the persistent config XML files (to pick up any additional
>     inactive guets)

But that solution is invasive enough to be post-0.9.1.
2011-05-03 10:07:48 -06:00
3109d2bffa tests: suppress more valgrind situations
* tests/.valgrind.supp: Consolidate bash suppressions.  Ignore
more libnl issues.
2011-05-03 08:03:39 -06:00
a2eab0033c Fix disability to run on systems with no PCI bus
The patch which moved libpciaccess initialization to one place caused
regression - we were not able to run on system with no PCI bus, like
s390(x).
2011-05-03 13:46:22 +02:00
0e7f7f8566 lxc: Do not try to reconnect inactive domain when do lxcStartup
Otherwise if there are inactive lxc domains, lxcStartup will
try to reconnect to sockets of these domains, which results in
errors in libvirtd log.
2011-05-03 14:48:03 +08:00
0620e83d10 tests: avoid compiler warning
../../tests/xmconfigtest.c: In function 'testCompareParseXML':
../../tests/xmconfigtest.c:49:19: error: 'conn' may be used uninitialized in this function [-Wuninitialized]

* tests/xmconfigtest.c (testCompareParseXML): Initialize variable.
2011-05-02 17:35:18 -06:00
b15a8a1bdf qemu: fix uninitialized variable warning
This commit fixes
qemu/qemu_driver.c: In function 'qemuDomainModifyDeviceFlags':
qemu/qemu_driver.c:4041:8: warning: 'ret' may be used uninitialized in this
function [-Wuninitialized]
qemu/qemu_driver.c:4013:9: note: 'ret' was declared here

The variable is set to -1 so that the error paths are taken when the code
to set it didn't get a chance to run. Without initializing it, we could
return some an undefined value from this function.

While I was at it, I made a trivial whitespace change in the same function
to improve readability.
2011-05-02 09:23:47 -06:00
170f2a8747 fix missing VLAN id for Qbg example
For IEEE 802.1Qbg, it is necessary to use a VLAN interface.
vepa itself does not require a VLAN interface.

Signed-off-by: Gerhard Stenzel <stenzel at de.ibm.com>
2011-05-02 09:13:54 -06:00
9ba4eb3c08 tests: Lower stack usage below 4096 bytes
Make virtTestLoadFile allocate the buffer to read the file into.

Fix logic error in virtTestLoadFile, stop reading on the first empty line.

Use virFileReadLimFD in virtTestCaptureProgramOutput to avoid manual
buffer handling.
2011-04-30 19:59:52 +02:00
88823ec90a tests: Update valgrind suppressions file 2011-04-30 19:33:58 +02:00
0431551435 virsh: fix regression in log to file
Commit 36deff04 introduced a regression due to which virsh is not able
to log to a file - msg_buf was changed from an array to a pointer
without corresponding change to usage of "sizeof()".

Fix regression in virsh logging

Signed-off-by: Supriya Kannery <supriyak@in.ibm.com>
2011-04-30 10:28:02 -06:00
0e7c7b8b32 nwfilter: Fix memory leak in the ebtables subdriver
Call shutdown functions for all subcomponents in nwfilterDriverShutdown.

Make sure that this shutdown functions can safely be called multiple times
and independent from the actual subcomponents state.
2011-04-30 17:37:54 +02:00
feecc9f395 qemu: Fix qemuDomainModifyDeviceFlags leaking the caps bitmap 2011-04-30 17:37:34 +02:00
9d50b323a9 Fix memory leak in __virExec
Commit e0d014f237 made binary potentially allocated on the heap.
It was freed in the parent in the error path, but not in the success path
that doesn't goto the cleanup label.

Found by 'make -C tests valgrind'.
2011-04-30 17:37:29 +02:00
701bee0193 hash: fix memory leak regression
Commit 1671d1d introduced a memory leak in virHashFree, and
wholesale table corruption in virHashRemoveSet (elements not
requested to be freed are lost).

* src/util/hash.c (virHashFree): Free bucket array.
(virHashRemoveSet): Don't lose elements.
* tests/hashtest.c (testHashCheckForEachCount): New method.
(testHashCheckCount): Expose the bug.
2011-04-29 14:26:40 -06:00
41a7835fa0 docs: Document <filesystem> device
Tried to dredge through old changelogs and commits to come up with it, so
may not be completely accurate.

v2:
Drop ambiguous 'containers'
Use same mail archive for all links
2011-04-29 14:35:23 -04:00
e39c46a5fd build: fix getcwd portability problems
* bootstrap.conf (gnulib_modules): Add getcwd-lgpl.
* tests/commandtest.c (checkoutput): Drop unused cwd.
* tests/commandhelper.c (main): Let getcwd malloc.
* tests/testutils.c (virTestMain): Likewise.
* tools/virsh.c (cmdPwd): Likewise.
(virshCmds): Expose cmdPwd and cmdCd on mingw.
2011-04-29 12:08:26 -06:00
20986e58aa tests: simplify common setup
A few of the tests were missing basic sanity checks, while most
of them were doing copy-and-paste initialization (in fact, some
of them pasted the argc > 1 check more than once!).  It's much
nicer to do things in one common place, and minimizes the size of
the next patch that fixes getcwd usage.

* tests/testutils.h (EXIT_AM_HARDFAIL): New define.
(progname, abs_srcdir): Define for all tests.
(VIRT_TEST_MAIN): Change callback signature.
* tests/testutils.c (virtTestMain): Do more common init.
* tests/commandtest.c (mymain): Simplify.
* tests/cputest.c (mymain): Likewise.
* tests/esxutilstest.c (mymain): Likewise.
* tests/eventtest.c (mymain): Likewise.
* tests/hashtest.c (mymain): Likewise.
* tests/networkxml2xmltest.c (mymain): Likewise.
* tests/nodedevxml2xmltest.c (myname): Likewise.
* tests/nodeinfotest.c (mymain): Likewise.
* tests/nwfilterxml2xmltest.c (mymain): Likewise.
* tests/qemuargv2xmltest.c (mymain): Likewise.
* tests/qemuhelptest.c (mymain): Likewise.
* tests/qemuxml2argvtest.c (mymain): Likewise.
* tests/qemuxml2xmltest.c (mymain): Likewise.
* tests/qparamtest.c (mymain): Likewise.
* tests/sexpr2xmltest.c (mymain): Likewise.
* tests/sockettest.c (mymain): Likewise.
* tests/statstest.c (mymain): Likewise.
* tests/storagepoolxml2xmltest.c (mymain): Likewise.
* tests/storagevolxml2xmltest.c (mymain): Likewise.
* tests/virbuftest.c (mymain): Likewise.
* tests/virshtest.c (mymain): Likewise.
* tests/vmx2xmltest.c (mymain): Likewise.
* tests/xencapstest.c (mymain): Likewise.
* tests/xmconfigtest.c (mymain): Likewise.
* tests/xml2sexprtest.c (mymain): Likewise.
* tests/xml2vmxtest.c (mymain): Likewise.
2011-04-29 10:21:20 -06:00
63956ca055 build: avoid test warnings on mingw
* .gnulib: Update to latest, for getaddrinfo fixes.
Reported by Matthias Bolte.
2011-04-29 09:06:12 -06:00
c63ec6e347 virsh: avoid compiler warning on mingw
We don't use gnulib's sanitizations for vfprintf, but vshDebug
was used with %zu, which means that it would fail on mingw.
Thank goodness the compiler indirectly caught this for us :)

virsh.c: In function 'vshDebug':
virsh.c:12105:5: warning: function might be possible candidate for
'ms_printf' format attribute [-Wmissing-format-attribute]

since mingw <stdio.h> hasn't yet added gcc attributes to vfprintf.

* tools/virsh.c (vshDebug): Avoid vfprintf.
(vshPrintExtra): Use lighter-weight fputs.
Reported by Matthias Bolte.
2011-04-28 15:09:08 -06:00
f37c29c8aa libvirt/qemu - support persistent update of disks
Support update of disks by MODIFY_CONFIG

This patch includes changes for qemu's disk to support
virDomainUpdateDeviceFlags() with VIR_DOMAIN_DEVICE_MODIFY_CONFIG.

This patch adds support for CDROM/foppy disk types.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

* src/qemu/qemu_driver.c
(qemuDomainUpdateDeviceConfig): support cdrom/floppy.
2011-04-28 14:59:06 -06:00
578391e1bc Xen: Do not generate net ifname if domain is inactive
V2: Use virAsprintf instead of snprintf/strdup

The xend driver will generate a virDomainNetDef ifname if one is not
specified in xend sexpr, even if domain is inactive.  The result is
network interface XML containing 'vif-1.Y' on dev attribute of target
element, e.g.

  <interface type='bridge'>
    <target dev='vif-1.0'/>
    ...

This patch changes the behavior to only generate the ifname if not
specified in xend sexpr *and* domain is not inactive (id != -1).
2011-04-28 14:54:06 -06:00
a88916665d xen: check if device is assigned to guest before reattaching
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=664059

Reattaching pci device back to host without destroying guest or
detaching device from guest would cause host to crash. This patch adds
a check before doing device reattach. If the device is being assigned
to guest, libvirt refuses to reattach device to host. The patch only
works for Xen, for it just checks xenstore to get pci device
information.

Signed-off-by: Yufang Zhang <yuzhang@redhat.com>
2011-04-28 14:45:31 -06:00
f7bd72fa26 network: fix return value of hostsFileWrite
The lone caller to hostsFileWrite (and the callers for at least 3
levels up the return stack) assume that the return value will be < 0
on failure. However, hostsFileWrite returns 0 on success, and a
positive errno on failure. This patch changes hostsFileWrite to return
-errno on failure.
2011-04-28 10:44:57 -04:00
a372c405b4 maint: fix comment typos
* src/esx/esx_driver.c: Fix spelling of 'relative'.
* src/util/util.c: Likewise.
2011-04-28 08:19:51 -06:00
3a55213252 build: Use pkg-config for libssh2 check
Currently the build fails if /usr/local/include does not exist since
its use is hardcoded in configure.ac
2011-04-28 14:26:24 +02:00
14c8dc841b build: Ignore old audit library
Check for audit_encode_nv_string in libaudit so that ancient audit
library is ignored rather than trying to compile with libaudit support
and failing.
2011-04-28 14:25:27 +02:00
32398e1282 util: Initialize hooks at daemon shutdown if no hooks defined
We support to initialize the hooks at daemon reload if there is no
hooks script is defined, we should also support initialize the hooks
at daemon shutdown if no hooks is defined.

To address bz: https://bugzilla.redhat.com/show_bug.cgi?id=688859
2011-04-28 14:48:26 +08:00
2225a49106 fix virsh's regression
This patch does the following things:
1. The return value of cmdSchedInfoUpdate() can be -1, 0 and 1. So the
   type of return value should be int not bool.(This function is not a
   entry of a virsh command, but the name of this function likes cmdXXX)

2. The type of cmdSchedinfo()'s, cmdFreecell()'s, cmdPoolList()'s and
   cmdVolList()'s return value is bool not int, so change the type of
   variable ret_val, func_ret and functionReturn.

3. Add a variable functionReturn for cmdMigrate(), cmdAttachInterface(),
   cmdDetachInterface(), cmdAttachDisk() and cmdDetachDisk() to save the
   return value.

4. Change the type of variable ret in the function cmdAttachDevice(),
   cmdDetachDevice(), cmdUpdateDevice(), cmdAttachInterface(),
   cmdDetachInterface(), cmdAttachDisk() and cmdDetachDisk() to int, as
   we use it to save the return value of virXXX() and the type of virXXX()'s
   return value is int not bool.

5. Do some cleanup when virBuff.error is 1.

The bug 1-4 were introduced by commit b56fa5bb.
2011-04-28 12:25:59 +08:00
ab9102c232 libvirt/qemu - support persistent attach/detach disks
Support changes of disks by MODIFY_CONFIG for qemu.

This patch includes patches for qemu's disk to support
virDomainAt(De)tachDeviceFlags with VIR_DOMAIN_DEVICE_MODIFY_CONFIG.

Other devices can be added incrementally.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

* /src/conf/domain_conf.c
(virDomainDiskIndexByName): returns array index of disk in vmdef.
(virDomainDiskRemoveByName): removes a disk which has the name in vmdef.
* src/qemu/qemu_driver.c
(qemuDomainAttachDeviceConfig): add support for Disks.
(qemuDomainDetachDeviceConfig): add support for Disks.
2011-04-27 21:46:35 -06:00
da1eba6bc8 libvirt/qemu - support persistent modification of devices
This patch adds functions for modify domain's persistent definition.
To do error recovery in easy way, we use a copy of vmdef and update it.

The whole sequence will be:

  make a copy of domain definition.

  if (flags & MODIFY_CONFIG)
      update copied domain definition
  if (flags & MODIF_LIVE)
      do hotplug.
  if (no error)
      save copied one to the file and update cached definition.
  else
      discard copied definition.

This patch is mixuture of Eric Blake's work and mine.
From: Eric Blake <eblake@redhat.com>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

(virDomainObjCopyPersistentDef): make a copy of persistent vm definition
(qemuDomainAttach/Detach/UpdateDeviceConfig) : callbacks. now empty
(qemuDomainModifyDeviceFlags): add support for MODIFY_CONFIG and MODIFY_CURRENT
2011-04-27 21:33:58 -06:00
8a6e30f124 build: fix 32-bit test failure
Same fix as commit 1fc288e1e2.

* tests/hashtest.c (testHashRemoveForEach): Use correct format.
2011-04-27 10:46:12 -06:00
1671d1dc78 util: Simplify hash implementation
So far first entries for each hash key are stored directly in the hash
table while other entries mapped to the same key are linked through
pointers. As a result of that, the code is cluttered with special
handling for the first items.

This patch makes all entries (even the first ones) linked through
pointers, which significantly simplifies the code and makes it more
maintainable.
2011-04-27 15:32:30 +02:00
91e12a5094 tests: More unit tests for internal hash APIs
This adds several tests for remaining hash APIs (custom
hasher/comparator functions are not covered yet, though).

All tests pass both before and after the "Simplify hash implementation".
2011-04-27 15:32:30 +02:00
53cb23f426 build: Fix problem of building Python bindings
If one specify "--with-python=yes" but no python-devel package
is installed, we ignore it with just a notice message, which
doesn't give clear guide to user.
2011-04-27 21:07:14 +08:00
968fd0111a release PCI address only when we have ensured it successfully
Steps to reproduce this bug:
1. # cat net.xml # 00:03.0 has been used
    <interface type='network'>
      <mac address='52:54:00:04:72:f3'/>
      <source network='default'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

2. # virsh attach-device vm1 net.xml
   error: Failed to attach device from net.xml
   error: internal error unable to reserve PCI address 0:0:3

3. # virsh attach-device vm1 net.xml
   error: Failed to attach device from net.xml
   error: internal error unable to execute QEMU command 'device_add': Device 'rtl8139' could not be initialized

The reason of this bug is that: we can not reserve PCI address 0:0:3 because it has
been used, but we release PCI address when we reserve it failed.
2011-04-27 20:12:14 +08:00
3c1326385a free memory properly in cleanup patch
virsh schedinfo inactive-domain will trigger the problem.
2011-04-27 20:12:14 +08:00
6fee3da262 free buf->content when vsnprintf() failed
When buf->error is 1, we do not return buf->content in the function
virBufferContentAndReset(). So we should free buf->content when
vsnprintf() failed.
2011-04-27 20:12:13 +08:00
4a9019afbb esx: Fix dynamic dispatch for CastFromAnyType functions
This was broken by the refactoring in ac1e6586ec. It resulted in a
segfault for 'virsh vol-dumpxml' and related volume functions.

Before the refactoring all users of the ESX_VI__TEMPLATE__DISPATCH
macro dispatched on the item type, as the item is the input to all those
functions.

Commit ac1e6586ec made the dynamically dispatched CastFromAnyType
functions use this macro too, but this functions dispatched on the
actual type of the AnyType object. The item is the output of the
CastFromAnyType functions.

This difference was missed in the refactoring, making CastFromAnyType
functions dereferencing the item pointer that is NULL at the time of
the dispatch.
2011-04-27 09:33:02 +02:00
3ba5d77f3c Move call to virReportOOMError into virFileBuildPath
Suggested by Daniel P. Berrange
2011-04-27 09:18:53 +02:00
59a5981dd3 build: use gnulib passfd for simpler SCM_RIGHTS code
* .gnulib: Update to latest for passfd fixes.
* bootstrap.conf (gnulib_modules): Add passfd.
* src/util/util.c (virFileOpenAs): Simplify.
2011-04-26 10:36:56 -06:00
1c84237852 qemu: Add flags checking in DomainCoreDump 2011-04-26 13:37:26 +02:00
d9b46a0d04 Make crash and live flags mutually exclusive in virDomainCoreDump
They don't make any sense when used together.
2011-04-26 13:37:21 +02:00
bf5e3f6598 Make sure DNSMASQ_STATE_DIR exists
otherwise the directory returned by networkDnsmasqLeaseFileName will not
be created if ipdef->nhosts == 0 in networkBuildDnsmasqArgv.
2011-04-25 23:41:57 +02:00
bf130d2c85 Fix small memory leaks in config parsing related functions
Found by 'make -C tests valgrind'.

xen_xm.c: Dummy allocation via virDomainChrDefNew is directly
overwritten and lost. Free 'script' in success path too.

vmx.c: Free virtualDev_string in success path too.

domain_conf.c: Free compression in success path too.
2011-04-25 19:08:53 +02:00
14a961ca73 Add virDomainEventRebootNew
This will be used in the ESX driver event handling.
2011-04-25 18:55:01 +02:00
90d761eeb2 build: make VIR_FREE do some type checking
We can exploit the fact that gcc warns about int-to-pointer conversion
in ternary cond?(void*):(int) in order to prevent future mistakes of
calling VIR_FREE on a scalar lvalue.  For example, between commits
158ba873 and 802e2df, we would have had this warning:

cc1: warnings being treated as errors
remote.c: In function 'remoteDispatchListNetworks':
remote.c:3684:70: error: pointer/integer type mismatch in conditional expression

There are still a number of places that malloc into a const char*;
while it would probably be worth scrubbing them to use char*
instead, that is a separate patch, so we have to cast away const
in VIR_FREE for now.

* src/util/memory.h (VIR_FREE): Make gcc warn about integers.
Iteratively developed from a patch by Christophe Fergeau.
2011-04-25 10:20:18 -06:00
99de59900a threads: add one-time initialization support
mingw lacks the counterpart to PTHREAD_MUTEX_INITIALIZER, so the
best we can do is portably expose once-only runtime initialization.

* src/util/threads.h (virOnceControlPtr): New opaque type.
(virOnceFunc): New callback type.
(virOnce): New prototype.
* src/util/threads-pthread.h (virOnceControl): Declare.
(VIR_ONCE_CONTROL_INITIALIZER): Define.
* src/util/threads-win32.h (virOnceControl)
(VIR_ONCE_CONTROL_INITIALIZER): Likewise.
* src/util/threads-pthread.c (virOnce): Implement in pthreads.
* src/util/threads-win32.c (virOnce): Implement in WIN32.
* src/libvirt_private.syms: Export it.
2011-04-25 08:53:09 -06:00
061956ccc7 esx: Add a wrapper for shared CURL handles
To be used to share a CURL handle between multiple threads in the
upcoming domain event support.
2011-04-24 11:33:47 +02:00
d21342af19 esx: Move CURL handling code to it's own type 2011-04-24 11:22:23 +02:00
802e2df9a3 daemon: Don't try to free an unsigned int in error paths 2011-04-22 19:02:40 +02:00
56eb2081f5 daemon: Honor error variable name change in the generator
Commit 36b652138b renamed err to rerr, do the same in the generator.
2011-04-22 19:02:35 +02:00
9b8543b6ad libvirt/qemu - clean up UpdateDevice for consolidation.
This patch strips reusable part of qemuDomainUpdateDeviceFlags()
and consolidate it to qemuDomainModifyDeviceFlags().
No functional changes.

* src/qemu/qemu_driver.c
(qemuDomainChangeDiskMediaLive) : pulled out code for updating disks.
(qemuDomainUpdateDeviceLive) : core of UpdateDevice, extracted from
UpdateDeviceFlags()
(qemuDomainModifyDeviceFlags): add support for updating device in live domain.
(qemuDomainUpdateDeviceFlags): reworked as a wrapper function of
qemuDomainModifyDeviceFlags()

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2011-04-21 15:49:57 -06:00
19ad136f60 libvirt/qemu - clean up At(De)tachDeviceFlags() for consolidation.
clean up At(De)tachDeviceFlags() for consolidation.

qemuDomainAttachDeviceFlags()/qemuDomainDetachFlags()/
qemuDomainUpdateDeviceFlags() has similar logics and copied codes.

This patch series tries to unify them to use shared code when it can.
At first, clean up At(De)tachDeviceFlags() and devide it into functions.

By this, this patch pulls out shared components between functions.
Based on patch series by Eric Blake, I added some modification as
switch-case with QEMU_DEVICE_ATTACH, QEMU_DEVICE_DETACH, QEMU_DEVICE_UPDATE

* src/qemu/qemu_driver.c
(qemuDomainAt(De)tachDeviceFlags) : pulled out to qemuDomainModifyDeviceFlags()
(qemuDomainModifyDeviceFlags) : implements generic code for modifying domain.
(qemuDomainAt(De)tachDeviceFlagsLive) : code for at(de)taching devices to
domain in line. no changes in logic from old code.
(qemuDomainAt(De)tachDeviceDiskLive) : for at(de)taching Disks.
(qemuDomainAt(De)tachDeviceControllerLive) : for at(de)taching Controllers

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2011-04-21 14:19:21 -06:00
2160116ff8 libvirt/qemu - Centralize device modification in the more flexible APIs
Centralize device modification in the more flexible APIs, to allow future
honoring of additional flags.  Explicitly reject the
VIR_DOMAIN_DEVICE_MODIFY_FORCE flag on attach/detach.

Based on Eric Blake<eblake@redhat.com>'s work.

* src/qemu/qemu_driver.c
(qemudDomainAttachDevice)(qemudDomainAttachDeviceFlags): Swap bodies,rename...
(qemudDomainDetachDevice, qemudDomainDetachDeviceFlags): Likewise.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2011-04-21 13:12:04 -06:00
eb954ede72 Add support for s390(x) cpu options parsing
Up to now we missed parser for cpuinfo on x390(x) machines. Those machines
have only 1 thread, core, socket. What is missing is information about
CPU frequency.
2011-04-21 10:50:17 -06:00
29fca78541 Fix QEMU tunnelled migration FD handling
The two ends of the pipe used for feeding QEMU tunnelled
migration data were interchanged, so QEMU got given the
"write" end instead of the "read" end.

The qemuMigrationPrepareTunnel method was also immediately
closing the "write" end of the pipe, so the stream failed
to actually write anything.

* src/qemu/qemu_migration.c: Swap tunnelled migration
  pipe FDs & don't close pipe given to stream
2011-04-21 17:27:53 +01:00
1fc288e1e2 build: fix 32-bit test failure
ARRAY_CARDINALITY is typed as size_t, not long; this matters on 32-bit
platforms:

hashtest.c: In function 'testHashRemoveForEach':
hashtest.c:114: error: format '%lu' expects type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat]

* tests/hashtest.c (testHashRemoveForEach): Use correct format.
2011-04-21 08:23:59 -06:00
068add8ea9 Remove artificial minimum limit for guest memory
Remove the artificial minimum of 4096 KB for guest memory. It's drivers'
job to set the limit if needed.
2011-04-21 12:06:41 +02:00
41461ff7f7 PHYP: Adding reboot domain function
Adding reboot <domain> function for pHyp driver.
2011-04-21 08:25:33 +02:00
4037f0257c build: fix syntax-check failure
* .mailmap: Add an alias for last commit.
2011-04-20 17:17:56 -06:00
2cb1d6f220 fix tunnelled migration's regression
If the migrateFrom is "stdio" not "stdin", qemuBuildCommandLine()
will convert it to exec:cat or fd:n.
2011-04-20 21:30:00 +08:00
973b681bdf nwfilter: no support for direct type of interface
Ebtables filtering doesn't work on macvtap device. Remove support for direct type of interface.
2011-04-19 16:23:59 -04:00
b56fa5bb37 virsh: nuke use of TRUE and FALSE
Gnulib already guarantees <stdbool.h>, so it is easier to just
use the standardized spellings.

* tools/virsh.c (vshCmdDef): Change callback to return real bool.
(__vshControl): Change several fields to bool.
(vshCommandOptBool): Change return type.
All callers updated.
* tools/Makefile.am (virsh-net-edit.c, virsh-pool-edit.c):
Likewise.
2011-04-19 08:16:14 -06:00
d2fd997ea6 qemu: fix the check of virDomainObjUnref()'s return value
If vm is unlocked in virDomainObjUnref(), the return value is 0, not less
than 0.
2011-04-19 21:46:09 +08:00
68c5b6fb2b Add cputune support to libxl driver
Here is a new version of this patch:
https://www.redhat.com/archives/libvir-list/2011-April/msg00337.html

v2:
  - store the cputune info for the whole runtime of the domain
  - remove cputune info when domain is destroyed

The nodeGetInfo code had to be moved into a helper
function to reuse it without a virConnectPtr.
2011-04-18 12:13:11 -06:00
78ef49eae3 Update and sort msg_gen_function list and mark unmarked messages
Inspired by Eric Blake
2011-04-18 19:05:15 +02:00
a35af32c1e phyp: another simplification
Rather than copying and pasting lots of code, factor it into a
single helper function.

This commit adds a warning if tighter integer parsing would fail
due to any stray bytes after the number, but should not change
any behavior other than the bug fix for phypNumDomainsGeneric
looking only at numeric lines.

* src/phyp/phyp_driver.c (phypExecInt): New function.
(phypGetVIOSPartitionID, phypNumDomainsGeneric, phypGetLparID)
(phypGetLparMem, phypGetLparCPUGeneric, phypGetRemoteSlot)
(phypGetVIOSNextSlotNumber, phypAttachDevice)
(phypGetStoragePoolSize, phypStoragePoolNumOfVolumes)
(phypNumOfStoragePools, phypInterfaceDestroy)
(phypInterfaceDefineXML, phypInterfaceLookupByName)
(phypInterfaceIsActive, phypNumOfInterfaces): Use it.
(phypNumDomainsGeneric): Correctly find numeric line.
2011-04-18 10:53:26 -06:00
d80740b3a4 maint: ignore built file
* .gitignore: Add exemption for hashtest.
2011-04-18 09:30:49 -06:00
ce3ae1b084 build: fix qemu build failure in previous patch
This last minute addition caused a build failure

cc1: warnings being treated as errors
qemu/qemu_process.c: In function 'qemuProcessHandleWatchdog':
qemu/qemu_process.c:436:34: error: ignoring return value of 'virDomainObjUnref', declared with attribute warn_unused_result [-Wunused-result]
make[3]: *** [libvirt_driver_qemu_la-qemu_process.lo] Error 1
2011-04-18 09:27:13 -06:00
bf4883caff Change some variable names to follow standard in daemon dispatcher
Replace some occurrances of

  virDomainPtr domain;
  virNetworkPtr network;

With

  virDomainPtr dom;
  virNetworkPtr net;

* daemon/remote.c: Fix variable naming to follow standard
2011-04-18 15:20:33 +01:00
05a6283c7a Write error check conditionals in more compact form for dispatcher
Replace cases of

     type = virConnectGetType(conn);
     if (type == NULL)
         goto cleanup;

With

     if (!(type = virConnectGetType(conn)))
         goto cleanup;

* daemon/remote.c: Write error checks in compat form
2011-04-18 15:20:33 +01:00
55c71a26af Remove curly braces on all single-line conditional jumps in dispatcher
Replace all occurrances of

   if (....) {
      goto cleanup;
   }

With

   if (.....)
      goto cleanup;

to save one line of code

* daemon/remote.c: Remove curly braces on single line conditionals
2011-04-18 15:20:33 +01:00
c19295e5ae Fix checking of return codes in dispatcher
The libvirt APIs reserve any negative value for indicating an
error. Thus checks

    if (virXXXX() == -1)

Should instead be

    if (virXXXX() < 0)

* daemon/remote.c: s/ == -1/ < 0/
2011-04-18 15:20:33 +01:00
158ba8730e Merge all returns paths from dispatcher into single path
The dispatcher functions have numerous places where they
return to the caller. This leads to duplicated cleanup
code, often resulting in memory leaks. It makes it harder
to ensure that errors are dispatched before freeing objects,
which may overwrite the original error.

The standard pattern is now

    remoteDispatchXXX(...) {
        int rv = -1;

        ....
        if (XXX < 0)
          goto cleanup;
        ...
        if (XXXX < 0)
          goto cleanup;
        ...

        rv = 0;
    cleanup:
        if (rv < 0)
           remoteDispatchError(rerr);
        ...free all other stuff..
        return rv;
    }

* daemon/remote.c: Centralize all cleanup paths
* daemon/stream.c: s/remoteDispatchConnError/remoteDispatchError/
* daemon/dispatch.c, daemon/dispatch.h: Replace
  remoteDispatchConnError with remoteDispatchError
  removing unused virConnectPtr
2011-04-18 15:20:33 +01:00
16d6b0d80a Experimental libvirtd upstart job
To install it, disable libvirtd sysv initscript:
    chkconfig libvirtd off
    service libvirtd stop

and enable libvirtd upstart job:
    cp  /usr/share/doc/libvirt-*/libvirtd.upstart \
        /etc/init/libvirtd.conf
    initctl reload-configuration
    initctl start libvirtd

Test:
    initctl status libvirtd
libvirtd start/running, process 3929
    killall -9 libvirtd
    initctl status libvirtd
libvirtd start/running, process 4047

I looked into the possibility to use the upstart script from Ubuntu or
at least getting inspiration from it but that's not possible. "expect
daemon" is a nice thing but it only works if the process is defined with
exec stanza instead of script ... no script. Unfortunately, with exec
stanza environment variables can only be set within upstart script
(i.e., configuration in /etc/sysconfig/libvirtd can't work). Hence, we
need to use script stanza, source sysconfig, and execute libvirtd
without --daemon. For similar reasons we can't use limit stanza and need
to handle DAEMON_COREFILE_LIMIT in job's script.
2011-04-18 11:38:30 +02:00
b060d2e5d4 enhance processWatchdogEvent()
This patch does the following two things:
1. hold an extra reference while handling watchdog event
   If the domain is not persistent, and qemu quits unexpectedly before
   calling processWatchdogEvent(), vm will be freed and the function
   processWatchdogEvent() will be dangerous.

2. unlock qemu driver and vm before returning from processWatchdogEvent()
   When the function processWatchdogEvent() failed, we only free wdEvent,
   but forget to unlock qemu driver and vm, free dumpfile.
2011-04-18 09:38:45 +08:00
847efb32de qemu: avoid qemu_driver being unlocked twice when virThreadPoolNew() failed
We do not lock qemu_driver when calling virThreadPoolNew(). If it failed,
we will unlock qemu_driver. It is dangerous.

We may use this pool during auto starting domains. So we must create it before
calling qemuAutostartDomains(). Otherwise, libvirtd will crash.
2011-04-18 09:38:45 +08:00
cf7124946a Fix two out-of-date comments in LVM backend 2011-04-17 08:37:31 +02:00
12459d1ea7 xen: Replace statsErrorFunc with a macro
Also mark error messages in block_stats.c for translation, add the
new macro to the msg_gen functions in cfg.mk and add block_stats.c
to po/POTFILES.in
2011-04-17 07:53:26 +02:00
60d769a13a Remove virConnectPtr from virRaiseErrorFull
And from all related macros and functions.
2011-04-17 07:22:23 +02:00
b0d28307c8 tests: Unit tests for internal hash APIs
This is a basic set of tests for testing removals of hash entries during
iteration.
2011-04-16 11:31:52 +02:00
ffbdf3e144 build: include esx_vi.generated.* into dist file
commit d4601696 introduces two more generated files: esx_vi.generated.h
and esx_vi.generated.h. But we do not include them into dist file.
It will break building if using dist file to build.
2011-04-16 07:09:51 +02:00
c2d92f6a9e tests: test recent virsh option parsing changes
* tests/virsh-optparse: New file.
* tests/Makefile.am (test_scripts): Use it.
2011-04-15 16:19:22 -06:00
b9973f526c virsh: fix regression in parsing optional integer
Regression introduced in 0.8.5, commit c1564268.  The command
'virsh freecell 0' quit working when it changed from an optional
string to an optional integer.

This patch introduces a slight change that specifying an option
twice is now detected as an error.  It also changes things so
that a command that has more than 1 required option will not
complain about missing options if one but not all of the options
were given in long format, as in 'virsh vol-create --pool p file',
as well as making positional parsing work for all optional
options (each positional argument is associated with the earliest
option that has not yet been seen by name).

Optional boolean options can appear before required argument
options, because they don't affect positional argument parsing,
and obviously a required boolean option makes no sense.

Technically, this patch renders VSH_OT_STRING and VSH_OT_DATA
redundant; but cleaning that up can be a separate patch.

No command should ever need more than 32 options, right? :)

* tools/virsh.c (vshCmddefGetData, vshCmddefGetOption)
(vshCommandCheckOpts): Alter parameters to use bitmaps.
(vshCmddefOptParse): New function.
(vshCommandParse): Update for better handling of positional
arguments.
(vshCmddefHelp): Allow unit tests to validate options.
2011-04-15 16:08:18 -06:00
6b75a1a5b0 virsh: list required options first
The current state of virsh parsing is that:

$ virsh vol-info /path/to/image
$ virsh vol-info --pool default /path/to/image
$ virsh vol-info --pool default --vol /path/to/image

all lookup the volume by path (technically, the last two also attempt
a name lookup within a pool, whereas the first skips that step, but
the end result is the same); meanwhile:

$ virsh vol-info default /path/to/image

complains about unexpected data.  Why?  Because the --pool option is
optional, so default was parsed as the --vol argument, and
/path/to/image.img doesn't match up with any remaining options that
require an argument.  For proof, note that:

$ virsh vol-info default --vol /path/to/image

complains about looking up 'default' - the parser mis-associated both
arguments with --vol.  Given the above, the only way to specify pool
is with an explicit "--pool" argument (you can't specify it
positionally).  However, named arguments can appear in any order, so:

$ virsh vol-info /path/to/image --pool default
$ virsh vol-info --vol /path/to/image --pool default

have also always worked.  Therefore, this patch has no functional
change on vol-info option parsing, but only on 'virsh help vol-info'
synopsis layout.  However, it also allows the next patch to 1) enforce
that required options are always first (without this patch, the next
patch would fail the testsuite), and 2) allow the user to omit the
"--pool" argument.  That is, the next patch makes it possible to do:

$ virsh vol-info /path/to/image default

which to date was not possible.

* tools/virsh.c (opts_vol_create_from, opts_vol_clone)
(opts_vol_upload, opts_vol_download, opts_vol_delete)
(opts_vol_wipe, opts_vol_info, opts_vol_dumpxml, opts_vol_key)
(opts_vol_path): List optional pool parameter after required
arguments.
2011-04-15 15:39:53 -06:00
0bd34a9dec phyp: avoid memory leaks in command values
* src/phyp/phyp_driver.c (phypExecBuffer): New function. Use it
throughout file for less code, and for plugging a few leaks.
2011-04-15 15:32:19 -06:00
a1b46e714a phyp: use consistent return string handling
Use the name 'ret' for all phypExec results, to make it easier
to wrap phypExec.  Don't allow a possibly NULL ret through printf.

* src/phyp/phyp_driver.c (phypBuildVolume, phypDestroyStoragePool)
(phypBuildStoragePool, phypBuildLpar): Avoid NULL dereference.
(phypInterfaceDestroy): Avoid redundant free.
(phypVolumeLookupByPath, phypVolumeGetPath): Use consistent
naming.
2011-04-15 15:26:27 -06:00
e00c892f0b phyp: prefer memcpy over memmove when legal
* src/phyp/phyp_driver.c (phypUUIDTable_AddLpar)
(phypGetLparUUID, phypGetStoragePoolUUID, phypVolumeGetXMLDesc)
(phypGetStoragePoolXMLDesc): Use faster method.
2011-04-15 15:26:27 -06:00
f61785225d phyp: use consistent style for labels
* src/phyp/phyp_driver.c: Match label style of rest of project.
(phypExec, phypUUIDTable_Pull): Drop an extra label.
2011-04-15 15:26:26 -06:00
444306d591 phyp: more return handling cleanup
* src/phyp/phyp_driver.c (phypInterfaceDestroy)
(phypInterfaceDefineXML, phypInterfaceLookupByName)
(phypInterfaceIsActive, phypListInterfaces, phypNumOfInterfaces):
Clean up return handling of recent additions.
2011-04-15 15:26:26 -06:00
8f03c6e869 phyp: avoid memory leak on failure
* src/phyp/phyp_driver.c (phypUUIDTable_Init): Avoid memory leak
on error.
2011-04-15 15:26:26 -06:00
ef6147c40e phyp: avoid a logic bug
Ever since commit ebc46f, the destroy function built two command
variants but only used one.  I went with the variant that matches
the idiom used in the counterpart of phypBuildStoragePool.

* src/phyp/phyp_driver.c (phypDestroyStoragePool): Avoid
clobbering cmd.  Fix error message typo.
2011-04-15 15:26:26 -06:00
dbe3bad987 maint: use lighter-weight function for straight appends
It costs quite a few processor cycles to go through printf parsing
just to determine that we only meant to append.

* src/xen/xend_internal.c (xend_op_ext): Consolidate multiple
printfs into one.
* src/qemu/qemu_command.c (qemuBuildWatchdogDevStr)
(qemuBuildUSBInputDevStr, qemuBuildSoundDevStr)
(qemuBuildSoundCodecStr, qemuBuildVideoDevStr): Likewise.
(qemuBuildCpuArgStr, qemuBuildCommandLine): Prefer virBufferAdd
over virBufferVsprintf for trivial appends.
* src/phyp/phyp_driver.c (phypExec, phypUUIDTable_Push)
(phypUUIDTable_Pull): Likewise.
* src/conf/nwfilter_conf.c (macProtocolIDFormatter)
(arpOpcodeFormatter, formatIPProtocolID, printStringItems)
(virNWFilterPrintStateMatchFlags, virNWIPAddressFormat)
(virNWFilterDefFormat): Likewise.
* src/security/virt-aa-helper.c (main): Likewise.
* src/util/sexpr.c (sexpr2string): Likewise.
* src/xenxs/xen_sxpr.c (xenFormatSxprChr): Likewise.
* src/xenxs/xen_xm.c (xenFormatXMDisk): Likewise.
2011-04-15 15:26:26 -06:00
1afaafe307 esx: Fix gcc 4.6 warning about initialized but unused variables
This warnings come from partly generated code. Therefore, the best
solution is to mark them as potentially being unused using the
ATTRIBUTE_UNUSED macro. This is suggested by the gcc documentation.

Reported by Christophe Fergeau
2011-04-15 12:31:38 -06:00
d934bd0a58 libvirt-guests: implement START_DELAY
Allow libvirt-guests to stage a delay between guest startups,
to avoid system load caused by back-to-back startup.
2011-04-15 11:15:06 -06:00
e692352689 maint: silence cppi warnings
* src/nodeinfo.c (linuxNodeInfoCPUPopulate): Fix indentation of
last patch.
2011-04-14 13:33:24 -06:00
020ad8d1a2 network: truncate bridges' dummy tap device names to IFNAMSIZ (15) chars
This patch addresses:

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

In order to give each libvirt-created bridge a fixed MAC address,
commit 5754dbd56d, added code to create
a dummy tap device with guaranteed lowest MAC address and attach it to
the bridge. This tap device was given the name "${bridgename}-nic".
However, an interface device name must be IFNAMSIZ (15) characters or
less, so a valid ${bridgename} such as "verylongname123" (15
characters) would lead to an invalid tap device name
("verylongname123-nic" - 19 characters), and that in turn led to a
failure to bring up the network.

The solution is to shorten the part of the original name used to
generate the tap device name. However, simply truncating it is
insufficient, because the last few characters of an interface name are
often a number used to indicate one of a list of several similar
devices (for example, "verylongname123", "verylongname124", etc) and
simple truncation would lead to duplicate names (eg "verlongnam-nic"
and "verylongnam-nic"). So instead we take the first 8 characters of
$bridgename ("verylong" in the example), add on the final 3 bytes
("123"), then add "-nic" (so "verylong123-nic").  Not pretty, but it
is much more likely to generate a unique name, and is reproducible
(unlike, say, a random number).
2011-04-14 15:24:17 -04:00
d21f9d5a64 ppc: Enable starting of Qemu VMs on ppc host
Due to differences in /proc/cpuinfo the parsing of the cpu data is
different between architectures. On PPC /proc/cpuinfo looks like this:

[original formatting with tabs]

processor    : 0
cpu          : PPC970MP, altivec supported
clock        : 2297.700000MHz
revision     : 1.1 (pvr 0044 0101)

processor    : 1
cpu          : PPC970MP, altivec supported
clock        : 2297.700000MHz
revision     : 1.1 (pvr 0044 0101)

[..]

timebase     : 14318000
platform     : pSeries
model        : IBM,8844-AC1
machine      : CHRP IBM,8844-AC1

The patch adapts the parsing of the data found in /proc/cpuinfo.

/sys/devices/system/cpu/cpuX/topology/physical_package_id also
always returns -1. Check for it on ppc and make it '0' if found negative.
2011-04-14 14:50:22 -04:00
cf2145d546 Migrate VMs between different-endianess hosts
This patch enables the migration of Qemu VMs between hosts of different endianess. I tested this by migrating a i686 VM between a x86 and ppc64 host.

I am converting the 'int's in the VM's state header to uint32_t assuming this doesn't break compatibility with existing deployments other than Linux.
2011-04-14 14:48:03 -04:00
c59f3d8de4 Fix gcc 4.6 warnings in vbox_tmpl.c 2011-04-14 19:23:30 +02:00
454e50beee Fix gcc 4.6 warnings
gcc 4.6 warns when a variable is initialized but isn't used afterwards:

vmware/vmware_driver.c:449:18: warning: variable 'vmxPath' set but not used [-Wunused-but-set-variable]

This patch fixes these warnings. There are still 2 offending files:

- vbox_tmpl.c: the variable is used inside an #ifdef and is assigned several
  times outside of #ifdef. Fixing the warning would have required wrapping
  all the assignment inside #ifdef which hurts readability.

vbox/vbox_tmpl.c: In function 'vboxAttachDrives':
vbox/vbox_tmpl.c:3918:22: warning: variable 'accessMode' set but not used [-Wunused-but-set-variable]

- esx_vi_types.generated.c: the name implies it's generated code and I
  didn't want to dive into the code generator

esx/esx_vi_types.generated.c: In function 'esxVI_FileQueryFlags_Free':
esx/esx_vi_types.generated.c:1203:3: warning: variable 'item' set but not used [-Wunused-but-set-variable]
2011-04-14 19:09:12 +02:00
2ac455c4d2 Introduce virDomainChrDefNew()
Make: passed
Make check: passed
Make syntax-check: passed

this is the commit to introduce the function to create new character
device definition for the domain as advised by Cole Robinson
<crobinso@redhat.com>.

The function is used on the relevant places and also new tests has
been added.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
2011-04-14 10:29:39 -06:00
abb1570eac Spice: support audio, images and stream compression
This extends the SPICE XML to allow variable compression settings for audio,
images and streaming:
    <graphics type='spice' port='5901' tlsPort='-1' autoport='yes'>
        <image compression='auto_glz'/>
        <jpeg compression='auto'/>
        <zlib compression='auto'/>
        <playback compression='on'/>
    </graphics>

All new elements are optional.
2011-04-14 10:23:59 -06:00
eed9d69e3c free cpumask of vcpupinDef
cpumask doesn't get freed when vcpupinDef being freed, this leaks
memory.
2011-04-14 09:47:10 -06:00
e63dfb8198 esx: Make the parsed URI part of the private connection data
This will be used to make esxVI_Context clonable.

Also move cleanup code for esxPrivate to esxFreePrivate().
2011-04-14 17:39:05 +02:00
991f97d827 esx: Mark error message in macros for translation 2011-04-14 17:35:11 +02:00
d460169610 esx: Extend VI generator to cover managed object types
Generate lookup functions for managed object types.
2011-04-14 17:14:21 +02:00
ac1e6586ec esx: Cleanup and refactor CastFromAnyType macros
Add CastFromAnyType functions for the String type.
2011-04-14 17:03:42 +02:00
a8ad5a40c6 esx: Cleanup VI generator code 2011-04-14 16:56:50 +02:00
2444c411ca network: Fix NULL dereference during error recovery
This fixes: https://bugzilla.redhat.com/show_bug.cgi?id=696660

While starting a network, if brSetForwardDelay() fails, we go to err1
where we want to access macTapIfName variable which was just
VIR_FREE'd a few lines above. Instead, keep macTapIfName until we are
certain of success.
2011-04-14 10:56:17 -04:00
1ef5a3d37e docs: Serial and parallel device target ports actually start from 0
Reported by Igor Galić
2011-04-14 16:36:25 +02:00
97263cb115 Add missing checks for QEMU domain state in tunables APIs
The methods qemuDomain{Get,Set}{Memory,Blkio,Scheduler}Parameters
all forgot to do a check on virDomainIsActive(), resulting in bogus
error messages from later parts of their impl

* src/qemu/qemu_driver.c: Add missing checks on virDomainIsActive()
2011-04-14 14:32:34 +01:00
28e938a9ec phyp: Fix too small buffer allocation in phypAttachDevice
sizeof(domain->name) is the wrong thing. Instead of using strdup here
rewrite escape_specialcharacters to allocate the buffer itself.

Add a contains_specialcharacters to be used in phypOpen, as phypOpen is
not interested in the escaped version.
2011-04-14 13:58:22 +02:00
e13e1f4f5d phyp: Don't overwrite error from virDomainDeviceDefParse by OOM error 2011-04-14 13:08:30 +02:00
e69aa73339 phyp: Don't try to use a string from a failed virAsprintf 2011-04-14 13:06:37 +02:00
d765a6f071 phyp: Reduce code duplication in error and success paths
Also fix memory leaks along the way in phypCreateServerSCSIAdapter and
phypAttachDevice.
2011-04-14 13:01:37 +02:00
444fd07a0a phyp: Remove stack allocating a 4kb volume key and fix related memory leaks
Don't pre-allocate 4kb per key, make phypVolumeGetKey allocate the memory.

Make phypBuildVolume return the volume key instead of using pre-allocated
memory to store it.

Also fix a memory leak in phypVolumeLookupByName when phypVolumeGetKey
fails. Fix another memory leak in phypVolumeLookupByPath in the success
path. Fix phypVolumeGetXMLDesc leaking voldef.key.
2011-04-14 12:54:36 +02:00
4bfab4a0d3 Remove C99 variable declare in PHYP network driver
Move the virInterfacePtr declaration to the top of the
function to avoid jump uninitialized variable warnings

* src/phyp/phyp_driver.c: Fix var declaration
2011-04-13 19:15:22 +01:00
d93ef4466b Replace REMOTE_DEBUG with VIR_DEBUG in daemon dispatcher
The daemon dispatcher code had an obsolete macro

  #define REMOTE_DEBUG(fmt, ...) VIR_DEBUG(fmt, __VA_ARGS__)

This can be trivially removed

* daemon/remote.c: s/REMOTE_DEBUG/VIR_DEBUG/
2011-04-13 19:01:24 +01:00
aaa6d7eb39 Add missing checks for whether the connection is open in dispatcher
Many functions did not check for whether a connection was
open. Replace the macro which obscures control flow, with
explicit checks, and ensure all dispatcher code has checks.

* daemon/remote.c: Add connection checks
2011-04-13 19:01:11 +01:00
36b652138b Standard on error variable name in libvirtd dispatcher
Some dispatcher methods have a parameter

            remote_error *err,

Instead of the more normal

            remote_error *rerr,

* daemon/remote.c: s/err/rerr/
2011-04-13 19:00:46 +01:00
8005048447 Remove all whitespace before function brackets in daemon dispatcher
A lot of code in libvirtd's dispatcher used the style

    dom = get_nonnull_domain (conn, args->dom);

Instead of the normal libvirt style

    dom = get_nonnull_domain(conn, args->dom);

* daemon/remote.c: Remove all whitelist before function brackets
2011-04-13 19:00:21 +01:00
67eecd1610 PHYP: Adding network interface
This is the implementation of the previous patch now using virInterface*
API. Ended up this patch got much more simpler, smaller and easier to
review. Here is some details:

  * MAC size and interface name are fixed due to specifications on HMC,
    both are created automatically and CAN'T be specified from user. They
    have the following format:

     * MAC: 122980003002
     * Interface name: U9124.720.067BE8B-V3-C0

  * I did replaced all the |grep|sed following the comments Eric Blake
    did on the last patch.

  * According to my last email, It's not possible to create a network
    interface without assigning it to a specific lpar. Then, I am using
    this very minimalistic XML file for testing:

     <interface type='ethernet' name='LPAR01'>
     </interface>

    In this file I am using "name" as the lpar name which I am going to
    assign the new network interface. I couldn't find a better way to
    refer to it. Comments are welcome.

  * Regarding the fact I am sleeping one second waiting for the HMC to
    complete creation of the interface, I don't have means to check
    if the whole process is done. All I do is execute a command, wait
    until is complete (which is not enough in this case) check
    the return and the exit status. The process of actually creating
    a networking interface seems to take a little longer than just the
    return of the ssh control.
2011-04-13 11:18:22 -06:00
30c551ab4e qemu: fix a dead-lock problem
In qemuDomainObjBeginJobWithDriver, when virCondWaitUntil timeouts,
the function tries to call qemuDriverLock with virDomainObj locked,
this causes the dead-lock problem. This patch fixes this.
2011-04-13 09:43:16 +08:00
5c53160a2f util: Fix crash when removing entries during hash iteration
Commit 9677cd33ee made it possible to
remove current entry when iterating through all hash entries. However,
it didn't properly handle a special case of removing first entry
assigned to a given key which contains several entries in its collision
list.
2011-04-12 19:18:08 +02:00
50e4b9195d Fix possible infinite loop in remote driver
When we take out completed calls from queue we might end up
in circular pointer. We don't want pointer to previous item
point to element taken out.
2011-04-12 09:18:40 -06:00
99fa30804b maint: fix grammar errors
Jim Meyering recently improved gnulib to catch various grammar
errors during 'make syntax-check'.

* .gnulib: Update to latest, for syntax-check improvements.
* include/libvirt/libvirt.h.in (virConnectAuthCallbackPtr): Use
cannot rather than two words.
* src/driver.c: Likewise.
* src/driver.h (VIR_SECRET_GET_VALUE_INTERNAL_CALL): Likewise.
* src/remote/remote_driver.c (initialize_gnutls): Likewise.
* src/util/pci.c (pciBindDeviceToStub): Likewise.
* src/storage/storage_backend.c (virStorageBackendCreateQemuImg):
Likewise.
(virStorageBackendUpdateVolTargetInfoFD): Avoid doubled word.
* docs/formatdomain.html.in: Likewise.
* src/qemu/qemu_process.c (qemuProcessStart): Likewise.
* cfg.mk (exclude_file_name_regexp--sc_prohibit_can_not)
(exclude_file_name_regexp--sc_prohibit_doubled_word): Exclude
existing translation problems.
2011-04-12 09:06:14 -06:00
0ddc8d0aeb docs: document freecell --all
Based on a smaller patch developed by Moritoshi Oshiro:
https://bugzilla.redhat.com/show_bug.cgi?id=693963

* tools/virsh.pod (freecell): Mention all, and clarify that
optional cellno requires --cellno.
2011-04-11 08:32:37 -06:00
6519b76000 xen: Remove PATH_MAX sized stack allocation from block stats code 2011-04-10 13:35:04 +02:00
0ad06c1116 setmaxmem: add the new options to "virsh setmaxmem" command
This patch adds the new options (--live, --config, and --current) to
"virsh setmaxmem" command. The behavior of above options is the same
as that of "virsh setmem".  When the --config option is specified, a
modification is effective for the persistent domain, while the --live
option is specified, a modification is effective for an active
domain. The --current option is specified, it affects a current
domain.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
2011-04-08 20:22:12 -06:00
c1795c5204 maxmem: implement virDomainSetMaxMemory API of the qemu driver
This patch implements the code to support virDomainSetMaxMemory API,
and to support VIR_DOMAIN_MEM_MAXIMUM flag in qemudDomainSetMemoryFlags function.
As a result, we can change the maximum memory size of inactive QEMU guests.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
2011-04-08 17:40:29 -06:00
e3b4ca21b2 maxmem: introduces VIR_DOMAIN_MEM_MAXIMUM flag
This patch introduces VIR_DOMAIN_MEM_MAXIMUM flag.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
2011-04-08 16:38:00 -06:00
ae25096692 docs: remove "returns" word from beginning of lines
Move "returns" keyword from beginning of API doc lines
when it does not describe return values.
Maybe the API doc extractor could be changed to look for
"returns: " to avoid such confusion.
2011-04-08 16:27:06 -06:00
6f171deacc build: really fix mingw startup
Aargh; commit 8ae5dfd still didn't fix the mingw problem, because
gnulib defined O_NONBLOCK to 0 for just mingw.  I've now fixed
that in gnulib, but we need the latest pipe2 for libvirt to work.

* .gnulib: Update to latest, for pipe2 fixes.
2011-04-08 13:00:09 -06:00
ece0b3ab7a build: fix mingw build
Commit 02c39a2 introduced a mingw build regression, due to a
regression in gnulib's areadlink module:

../../../gnulib/lib/careadlinkat.c: In function 'careadlinkat':
../../../gnulib/lib/careadlinkat.c:143:39: error: 'const struct allocator' has no member named 'malloc'

* .gnulib: Update to latest, for careadlinkat fix.
2011-04-08 09:08:53 -06:00
5bc22e129b docs: tweak virsh restore warning
* tools/virsh.pod: Fix grammar, and clarify wording.
* src/qemu/qemu_driver.c (qemudDomainObjStart): Drop redundant
condition.
2011-04-08 07:58:07 -06:00
2999bb06f3 do not build libvirt_iohelper when building without libvirtd
The libexec program libvirt_iohelper is only for libvirtd. If we build rpm
without libvirtd, we will receive the following messages:

Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/wency/rpmbuild/BUILDROOT/libvirt-0.9.0-1.el6.x86_64
error: Installed (but unpackaged) file(s) found:
   /usr/libexec/libvirt_iohelper
2011-04-08 21:52:46 +08:00
6ab24feb44 nwfilters: support for TCP flags evaluation
This patch adds support for the evaluation of TCP flags in nwfilters.

It adds documentation to the web page and extends the tests as well.
Also, the nwfilter schema is extended.

The following are some example for rules using the tcp flags:

<rule action='accept' direction='in'>
    <tcp state='NONE' flags='SYN/ALL' dsptportstart='80'/>
</rule>
<rule action='drop' direction='in'>
    <tcp state='NONE' flags='SYN/ALL'/>
</rule>
2011-04-07 20:13:38 -04:00
80427f1d87 setmem: add --current option to virsh setmem command
This patch adds the new option (--current) to the "virsh setmem" command.
When --current option is specified, it affects a "current" domain.
The word "current" denotes that if a domain is running, it affects
a running domain only; otherwise it affects a persistent domain.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
2011-04-07 17:19:46 -06:00
95298e2380 setmem: add VIR_DOMAIN_MEM_CURRENT support to qemu
This patch adds virDomainSetMemoryFlags(,,VIR_DOMAIN_MEM_CURRENT) support
code to qemu driver.

Also, change virDomainObjIsActive to return bool, given its usage.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
2011-04-07 17:13:56 -06:00
0f2e50be5f setmem: introduce VIR_DOMAIN_MEM_CURRENT flag
This patch introduces VIR_DOMAIN_MEM_CURRENT flag and
modifies virDomainSetMemoryFlags function to support it.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
2011-04-07 17:13:56 -06:00
f7e9b44812 build: Install libxenlight log dir
Add $localstatedir/log/libvirt/libxl when building libxenlight driver
2011-04-07 16:39:04 -06:00
74891d9488 setmaxmem: remove the code to invoke virDomainSetMemory in cmdSetmaxmem
When the new maximum memory size becomes less than the current memory size,
I think it is not the libvirt client but the each driver that decides the behavior
(reject the operation or shrink the current memory size).

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
2011-04-07 16:18:43 -06:00
8ae5df5d93 virsh: fix mingw startup
* .gnulib: Update to latest, for pipe2.
* bootstrap.conf (gnulib_modules): Add pipe2.
* src/util/event_poll.c (virEventPollInit): Use it, to avoid
problematic virSetCloseExec on mingw.
2011-04-07 15:13:24 -06:00
02c39a2f6d build: fix gitignore sorting
Make it so we don't have to 'git add -f' particular files like
po/POTFILES.in all the time (tested by fixing one of our
special-case files as part of the patch).

* .gnulib: Update to latest.
* bootstrap: Resync from coreutils.
* .gitignore: Sort whitelist entries correctly, including ignoring
files rather than directories.
* m4/virt-compile-warnings.m4: Convert tabs to space.
2011-04-07 15:03:53 -06:00
f25d064ead docs: add an IPv6 address to network XML examples
It was just pointed out that, although I added documentation for the
IPv6 additions to the network XML, I neglected to use those additions
in the examples. This patch adds an IPv6 address to each of the
examples except for the "default" network, since that is a faithful
reproduction of the default network config that's automatically
installed, which doesn't include any IPv6 address (for good reason -
because there is no such thing as IPv6 NAT, there is no one IPv6
address that would work for all installations).
2011-04-07 12:51:47 -04:00
a7a4414b75 Add domainSet/GetSchedulerParameters to libxl driver
Libxenlight currently only supports the credit scheduler.
Therefore setting or getting a parameter of other
schedulers raise an error (for now).
2011-04-07 10:23:19 -06:00
a73bbfc8be qemu: Remove the managed state file only if restoring succeeded
1) Both "qemuDomainStartWithFlags" and "qemuAutostartDomain" try to
restore the domain from managedsave'ed image if it exists (by
invoking "qemuDomainObjRestore"), but it unlinks the image even
if restoring fails, which causes data loss. (This problem exists
for "virsh managedsave dom; virsh start dom").

The fix for is to unlink the managed state file only if restoring
succeeded.

2) For "virsh save dom; virsh restore dom;", it can cause data
corruption if one reuse the saved state file for restoring. Add
doc to tell user about it.

3) In "qemuDomainObjStart", if "managed_save" is NULL, we shouldn't
fallback to start the domain, skipping it to cleanup as a incidental
fix. Discovered by Eric.
2011-04-07 16:58:26 +08:00
a4efb2e335 reattach pci devices when qemuPrepareHostdevPCIDevices() failed
Reattach all pci devices that we detached when qemuPrepareHostdevPCIDevices()
failed.
2011-04-07 13:09:46 +08:00
4e8969ebcf reattach pci device when pciBindDeviceToStub() failed
We should bind pci device to original driver when pciBindDeviceToStub() failed.
If the pci device is not bound to any driver before calling pciBindDeviceToStub(),
we should only unbind it from pci-stub. If it is bound to pci-stub, we should not
unbind it from pci-stub.
2011-04-07 13:09:46 +08:00
9121b1930f rename pciUnBindDeviceFromStub() to pciUnbindDeviceFromStub() and float it up
This patch do the following things:
1. rename the function as 'Unbind' is better than 'UnBind'.
2. pciUnbindDeviceFromStub() will be used in the function pciBindDeviceToStub() in
   next patch. Float it up, instead of having to have a forward declaration
2011-04-07 13:09:46 +08:00
115498597a remove devices from driver->activePciHostdevs when qemuPrepareHostdevPCIDevices() failed
We should not mark pci devices as active when qemuPrepareHostdevPCIDevices()
failed.
2011-04-07 13:09:45 +08:00
d5981f1caf pci: avoid invalid free, init path to NULL
This bug was introduce by commit 57162db8, and it will cause libvirtd crashed.
2011-04-07 13:09:39 +08:00
f6447e8a54 build: avoid compiler warning on cygwin
In file included from util/threads.c:31:
util/threads-pthread.c: In function 'virThreadSelfID':
util/threads-pthread.c:214: warning: cast from function call of type 'pthread_t' to non-matching type 'int' [-Wbad-function-cast]

* src/util/threads-pthread.c (virThreadSelfID) [!SYS_gettid]:
Add intermediate cast to silence gcc.
2011-04-06 17:07:23 -06:00
bf7f62519a Add domainIsUpdated to libxl driver 2011-04-06 15:31:04 -06:00
3df6fd706c Fix build for older gcc
With gcc 4.3.4 I'm seeing the following warning failure

cc1: warnings being treated as errors
cc1: error: -funit-at-a-time is required for inlining of functions
that are only called once [-Wdisabled-optimization]

Add -funit-at-a-time to WARN_CFLAGS.
2011-04-06 15:05:45 -06:00
2879582847 Change locking for udev monitor and callbacks
We're seeing bugs apparently resulting from thread unsafety of
libpciaccess, such as
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/726099
To prevent those, as suggested by danpb on irc, move the
nodeDeviceLock(driverState) higher into the callers.  In
particular:

  udevDeviceMonitorStartup should hold the lock while calling
  udevEnumerateDevices(), and udevEventHandleCallback should hold it
  over its entire execution.

It's not clear to me whether it is ok to hold the
nodeDeviceLock while taking the virNodeDeviceObjLock(dev) on a
device.  If not, then the lock will need to be dropped around
the calling of udevSetupSystemDev(), and udevAddOneDevice()
may not actually be safe to call from higher layers with the
driverstate lock held.

libvirt 0.8.8 with this patch on it seems to work fine for me.
Assuming it looks ok and I haven't done anything obviously dumb,
I'll ask the bug submitters to try this patch.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2011-04-06 10:20:47 -06:00
25b39315d6 tests: fix recent test failures
* tests/qemuxml2argvdata/qemuxml2argv-*.args: Reflect reserved VGA
port change.
2011-04-06 10:05:14 -06:00
87e78b2bc0 qemu: Support for overriding NPROC limit
This patch adds max_processes option to qemu.conf which can be used to
override system default limit on number of processes that are allowed to
be running for qemu user.
2011-04-06 12:08:59 +02:00
7b2cac1238 qemu: Always reserves slot 0x02 for primary VGA.
To address https://bugzilla.redhat.com/show_bug.cgi?id=692355

This fix is to reserve slot 0x02 for primary VGA even if there
is no "video" specified in domain XML to avoid the problem.
2011-04-06 14:22:54 +08:00
3eb869a04b libxl: avoid compiler warning
cc1: warnings being treated as errors
libxl/libxl_driver.c: In function 'libxlDomainSetVcpusFlags':
libxl/libxl_driver.c:1570:14: error: cast from function call of type 'double' to non-matching type 'unsigned int' [-Wbad-function-cast]
libxl/libxl_driver.c:1578:15: error: cast from function call of type 'double' to non-matching type 'unsigned int' [-Wbad-function-cast]

This was the only use of floor() and ceil(), and floating-point
is overkill for power-of-two manipulations.

* src/libxl/libxl_driver.c (libxlDomainSetVcpusFlags): Avoid -lm
for trivial computations.
2011-04-05 11:09:12 -06:00
a7e80bde11 Fix typo in systemtap tapset directory name
The systemtap directory for tapsets is called

  /usr/share/systemtap/tapset

Not

 /usr/share/systemtap/tapsets

* daemon/Makefile.am,libvirt.spec.in: s/tapsets/tapset/
2011-04-05 17:44:12 +01:00
dba5ba62bb Don't try to enable stack protector on Win32
The GCC Win32 compiler will claim to support -fstack-protector,
but if it actually gets triggered by a suitable code pattern,
linking will fail. Other non-Linux OS likely suffer the same
way with gcc.

* m4/virt-compile-warnings.m4: Only use stack protector when
  the build target is Linux.
2011-04-05 17:43:40 +01:00
5b099250e3 Avoid compiler warnings about int -> void * casts
GCC is a little confused about the cast of beginthread/beginthreadex
from unsigned long -> void *. Go via an intermediate variable avoids
the bogus warning, and makes the code a little cleaner

* src/util/threads-win32.c: Avoid compiler warning in cast
2011-04-05 17:43:33 +01:00
fdcd06ef71 Improve SCSI volume key generation
The SCSI volumes get a better 'key' field based on the fully
qualified volume path. All SCSI volumes have a unique serial
available in hardware which can be obtained by sending a
suitable SCSI command. Call out to udev's 'scsi_id' command
to fetch this value

* src/storage/storage_backend_scsi.c: Improve volume key
  field value stability and uniqueness
2011-04-05 16:04:22 +01:00
ef264e82ee qemu: Ignore unusable binaries
When initializing qemu guest capabilities, we should ignore qemu
binaries that we are not able to extract version/help info from since
they will be unusable for creating domains anyway. Ignoring them is also
much better than letting initialization of qemu driver fail.
2011-04-05 14:02:55 +02:00
69afdf14b8 qemu: Rewrite LOOKUP_PTYS macro into a function
The macro is huge and gives us nothing but headache when maintaining it.
2011-04-05 14:02:55 +02:00
a4e37ff1a3 Enable use of -Wold-style-definition compiler flag
A couple of functions were declared using the old style foo()
for no-parameters, instead of foo(void)

* src/xen/xen_hypervisor.c, tests/testutils.c: Replace () with (void)
  in some function declarations
* m4/virt-compile-warnings.m4: Enable -Wold-style-definition
2011-04-05 11:40:04 +01:00
329e9dc629 Enable use of -Wmissing-noreturn
* src/internal.h: Define a ATTRIBUTE_NO_RETURN annotation
* src/lxc/lxc_container.c: Annotate lxcContainerDummyChild
  with ATTRIBUTE_NO_RETURN
* tests/eventtest.c: Mark async thread as ATTRIBUTE_NO_RETURN
* m4/virt-compile-warnings.m4: Enable -Wmissing-noreturn
2011-04-05 11:39:58 +01:00
7d76d5d506 Enable -Wmissing-format-attribute warning
Add a couple of missing ATTRIBUTE_FMT_PRINTF annotations

* tools/virsh.c, tests/testutils.c: Add printf format attribute
* m4/virt-compile-warnings.m4: Enable -Wmissing-format-attribute
2011-04-05 11:39:52 +01:00
4825b521e2 Remove acinclude.m4 file
Split the bit acinclude.m4 file into smaller pieces named
as m4/virt-XXXXX.m4

* .gitignore: Ignore gettext related files
* acinclude.m4: Delete
* m4/virt-compile-warnings.m4: Checks for GCC compiler flags
* m4/virt-pkgconfig-back-compat.m4: Backcompat check for
  pkgconfig program
2011-04-05 11:39:44 +01:00
0e867555bd Use gnulib's manywarnings & warnings modules
Remove custom code for checking compiler warnings, using
gl_WARN_ADD instead. Don't list all flags ourselves, use
gnulib's gl_MANYWARN_ALL_GCC to get all possible GCC flags,
then turn off the ones we don't want yet.

* acinclude.m4: Rewrite to use gl_WARN_ADD and gl_MANYWARN_ALL_GCC
* bootstrap.conf: Add warnings & manywarnings
* configure.ac: Switch to gl_WARN_ADD
* m4/compiler-flags.m4: Obsoleted by gl_WARN_ADD
2011-04-05 11:39:35 +01:00
222402417d Remove possible uninitialized variable in openvz driver
* src/openvz/openvz_driver.c: Initialize saveptr variable
2011-04-05 10:54:59 +01:00
9e3550dc4e Use virBufferPtr for sexpr2string instead of manual buffer handling
Removes 4kb stack allocation in the XenD subdriver.
2011-04-05 09:14:59 +02:00
9faf3d084c xend: Remove 4kb stack allocation 2011-04-05 09:14:06 +02:00
3ac2a6f1b5 uml: Remove PATH_MAX sized stack allocation from /proc parsing code 2011-04-05 09:13:29 +02:00
cd708ef4ea storage: Remove PATH_MAX sized stack allocation from iSCSI backend 2011-04-05 09:12:46 +02:00
651a9529b2 qemu: Remove PATH_MAX sized stack allocation used in commandline building 2011-04-05 09:11:32 +02:00
25f85e4938 Remove PATH_MAX sized stack allocation from virFileOpenTtyAt 2011-04-05 09:10:32 +02:00
f044376530 openvz: Remove several larger stack allocations
Replace openvz_readline with getline in several places to get rid of stack
allocated buffers to hold lines.

openvzReadConfigParam allocates memory for return values instead of
expecting a preexisting buffer.
2011-04-05 09:09:38 +02:00
76f0ae3261 daemon: Remove 4kb stack allocation of security label 2011-04-05 09:08:58 +02:00
36deff0499 virsh: Remove two 4kb stack allocations 2011-04-05 09:07:40 +02:00
a16de3594f Use virFileAbsPath instead of manually creating the absolute path
Removes multiple 4kb stack allocations.

Removes TODO comments as suggested by Daniel P. Berrange.
2011-04-05 09:05:11 +02:00
1901d091f1 xenxs: Remove PATH_MAX sized stack allocation in XM script parsing 2011-04-05 09:01:37 +02:00
0e27b8a856 sasl: Remove stack allocated 8kb temporary buffers
Move the buffers to the heap allocated client/private data structs.
2011-04-05 08:55:27 +02:00
fb7f0051a2 qemu: Use heap allocated memory to read the monitor greeting
Removing a 4kb stack allocation.

Reduce stack buffer for virStrerror to the common 1kb instead of 4kb.
2011-04-05 08:55:27 +02:00
d1591ad50b phyp: Remove 16kb stack allocation
Allocate on the heap instead.
2011-04-05 08:55:27 +02:00
97176c6350 virt-aa-helper: Remove PATH_MAX sized stack allocations 2011-04-05 08:55:27 +02:00
859efe7f88 ebtables: Remove PATH_MAX sized stack allocation 2011-04-05 08:55:27 +02:00
57162db82c pci: Remove PATH_MAX sized stack allocations
Use virAsprintf instead of snprintf.
2011-04-05 08:55:27 +02:00
1573158190 Remove PATH_MAX sized stack allocations related to virFileBuildPath
Make virFileBuildPath operate on the heap instead of the stack. It
allocates a buffer instead of expecting a preexisting buffer.
2011-04-05 08:55:27 +02:00
bb3fa04183 vmx: Use case-insensitive compare functions for all content 2011-04-05 08:43:23 +02:00
81800ff647 vmx: Support persistent CPU shares 2011-04-05 08:40:57 +02:00
fb92307f0d Add autostart support to libxl driver
The domainSetAutostart function is nearly identical to the one from qemu.
2011-04-04 17:28:37 -06:00
33da939b0f Allow relative path for qemu backing file
This patch enables the relative backing file path support provided by
qemu-img create.

If a relative path is specified for the backing file, it is converted
to an absolute path using the storage pool path. The absolute path is
used to verify that the backing file exists. If the backing file exists,
the relative path is allowed and will be provided to qemu-img create.
2011-04-04 16:37:58 -06:00
0d166c6b7c build: detect potentential uninitialized variables
Even with -Wuninitialized (which is part of autobuild.sh
--enable-compile-warnings=error), gcc does NOT catch this
use of an uninitialized variable:

{
  if (cond)
    goto error;
  int a = 1;
error:
  printf("%d", a);
}

which prints 0 (supposing the stack started life wiped) if
cond was true.  Clang will catch it, but we don't use clang
as often.  Using gcc -Wjump-misses-init catches it, but also
gives false positives:

{
  if (cond)
    goto error;
  int a = 1;
  return a;
error:
  return 0;
}

Here, a was never used in the scope of the error block, so
declaring it after goto is technically fine (and clang agrees).
However, given that our HACKING already documents a preference
to C89 decl-before-statement, the false positive warning is
enough of a prod to comply with HACKING.

[Personally, I'd _really_ rather use C99 decl-after-statement
to minimize scope, but until gcc can efficiently and reliably
catch scoping and uninitialized usage bugs, I'll settle with
the compromise of enforcing a coding standard that happens to
reject false positives if it can also detect real bugs.]

* acinclude.m4 (LIBVIRT_COMPILE_WARNINGS): Add -Wjump-misses-init.
* src/util/util.c (__virExec): Adjust offenders.
* src/conf/domain_conf.c (virDomainTimerDefParseXML): Likewise.
* src/remote/remote_driver.c (doRemoteOpen): Likewise.
* src/phyp/phyp_driver.c (phypGetLparNAME, phypGetLparProfile)
(phypGetVIOSFreeSCSIAdapter, phypVolumeGetKey)
(phypGetStoragePoolDevice)
(phypVolumeGetPhysicalVolumeByStoragePool)
(phypVolumeGetPath): Likewise.
* src/vbox/vbox_tmpl.c (vboxNetworkUndefineDestroy)
(vboxNetworkCreate, vboxNetworkDumpXML)
(vboxNetworkDefineCreateXML): Likewise.
* src/xenapi/xenapi_driver.c (getCapsObject)
(xenapiDomainDumpXML): Likewise.
* src/xenapi/xenapi_utils.c (createVMRecordFromXml): Likewise.
* src/security/security_selinux.c (SELinuxGenNewContext):
Likewise.
* src/qemu/qemu_command.c (qemuBuildCommandLine): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainChangeEjectableMedia):
Likewise.
* src/qemu/qemu_process.c (qemuProcessWaitForMonitor): Likewise.
* src/qemu/qemu_monitor_text.c (qemuMonitorTextGetPtyPaths):
Likewise.
* src/qemu/qemu_driver.c (qemudDomainShutdown)
(qemudDomainBlockStats, qemudDomainMemoryPeek): Likewise.
* src/storage/storage_backend_iscsi.c
(virStorageBackendCreateIfaceIQN): Likewise.
* src/node_device/node_device_udev.c (udevProcessPCI): Likewise.
2011-04-04 11:26:29 -06:00
d17e438ad3 Release of libvirt-0.9.0
* configure.ac docs/news.html.in libvirt.spec.in: update for the release
* po/*.po*: update polish translation and regenerate
2011-04-04 20:15:45 +08:00
4a3976211d fix memory leak in qemuProcessHandleGraphics()
If strdup("x509dname") or strdup("saslUsername") success, but
strdup(x509dname) or strdup(saslUsername) failed, subject->nidentity
is not the num elements of subject->identities, and we will leak some
memory.
2011-04-03 09:13:53 +08:00
19f916a764 do not lock vm while allocating memory
There is no need to lock vm while allocating memory. If allocating
memory failed, we forgot to unlock vm.
2011-04-03 09:13:46 +08:00
d958874780 docs: fix typo
* docs/formatdomain.html.in: Fix KVM name.
2011-04-01 16:18:18 -06:00
b5ec89d955 docs: correct invalid xml
* docs/internals.html.in: Fix xml errors.
* docs/formatstorageencryption.html.in: Likewise.
* docs/drvesx.html.in: Likewise.
* docs/archnetwork.html.in: Likewise.
* docs/logging.html.in: Likewise.
* docs/drvvmware.html.in: Likewise.
* docs/api.html.in: Likewise.
* docs/formatnwfilter.html.in: Likewise.
* docs/formatdomain.html.in: Likewise.
* docs/windows.html.in: Likewise.
2011-04-01 16:03:11 -06:00
da3c471467 virsh: fix mingw failure on creating nonblocking pipe
* .gnulib: Update to latest, for nonblocking module.
* bootstrap.conf (gnulib_modules): Add nonblocking.
* src/util/util.c (virSetBlocking): Defer to gnulib.
2011-04-01 08:43:10 -06:00
03ede2f69d Fix libxl driver startup
When you happen to have a libvirtd binary compiled with the
libxenlight driver (say you have installed xen-4.1 libraries)
but not running a xen enabled system, then libvirtd fails to start.

The cause is that libxlStartup() returns -1 when failing to initialize
the library, and this propagates to virStateInitialize() which consider
this a failure. We should only exit libxlStartup with an error code
if something like an allocation error occurs, not if the driver failed
to initialize.

* src/libxl/libxl_driver.c: fix libxlStartup() to not return -1
  when failing to initialize the libxenlight library
2011-04-01 19:30:53 +08:00
1e8f20799c virsh: Fix documentation for memtune command
Commit 78ba748ef1 claims to fix
documentation for swap_hard_limit virsh memtune option but it only fixes
documentation in formatdomain.html and libvirt.h. This patch completes
the task by fixing "virsh help memtune" output and memtune section of
virsh man page.
2011-04-01 11:31:10 +02:00
d0bd206a61 Make check_fc_host() and check_vport_capable() usable as rvalues
as needed on non linux ports using HAL.
2011-04-01 11:23:51 +02:00
72ab0b6dc8 qemu: Ignore libvirt debug messages in qemu log
qemu driver uses a 4K buffer for reading qemu log file. This is enough
when only qemu's output is present in the log file. However, when
debugging messages are turned on, intermediate libvirt process fills the
log with a bunch of debugging messages before it executes qemu binary.
In such a case the buffer may become too small. However, we are not
really interested in libvirt messages so they can be filtered out from
the buffer.
2011-04-01 08:48:32 +02:00
0ca16a78af qemu: Fix improper logic of qemuCgroupSetup
It throws errors as long as the cgroup controller is not available,
regardless of whether we really want to use it to do setup or not,
which is not what we want, fixing it with throwing error when need
to use the controller.

And change "VIR_WARN" to "qemuReportError" for memory controller
incidentally.
2011-04-01 11:41:33 +08:00
e206946da7 free tmp after unlinking it
We create a temporary file to save memory, and we will remove it after reading
memory to buffer. But we free the variable that contains the temporary filename
before we remove it. So we should free tmp after unlinking it.
2011-04-01 12:15:21 +08:00
51434d3bef Fix several formatting mistakes in doc 2011-03-31 14:36:19 -06:00
e44e8e253c Remove iohelper on Win32 since it is not required
The iohelper binary is not required on Win32, although it compiles
without trouble. Simply remove it from the RPM.

* mingw32-libvirt.spec.in: Remove iohelper
2011-03-31 17:41:51 +01:00
242195425c Fix domain events C example on Win32
printf on Win32 does not necessarily support %lld and we don't
have GNULIBs wrapper for printf(). Switch to use asprintf() for
which we do have a gnulib wrapper with %lld support

* examples/domain-events/events-c/event-test.c: Fix formatting
  of %lld on Win32
* cfg.mk: Don't require use of virAsprintf since this is an
  example app for out of tree users to follow
2011-03-31 16:01:49 +01:00
6c9e89bbd2 maint: avoid locale-sensitivity in string case comparisons
strcase{cmp/str} have the drawback of being sensitive to the global
locale; this is unacceptable in a library setting.  Prefer a
hard-coded C locale alternative for all but virsh, which is user
facing and where the global locale isn't changing externally.

* .gnulib: Update to latest, for c-strcasestr change.
* bootstrap.conf (gnulib_modules): Drop strcasestr, add c-strcase
and c-strcasestr.
* cfg.mk (sc_avoid_strcase): New rule.
(exclude_file_name_regexp--sc_avoid_strcase): New exception.
* src/internal.h (STRCASEEQ, STRCASENEQ, STRCASEEQLEN)
(STRCASENEQLEN): Adjust offenders.
* src/qemu/qemu_monitor_text.c (qemuMonitorTextEjectMedia):
Likewise.
* tools/virsh.c (namesorter): Document exception.
2011-03-30 20:26:27 -06:00
06732e1a7d docs: mention C89 syntax preferences
* docs/hacking.html.in (Code formatting): Document that // comment
and declaration-after-statement are discouraged.
* HACKING: Regenerate.
2011-03-30 13:51:22 -06:00
e586f57487 qemu: Fix media eject with qemu-0.12.*
In qemu-0.12.* "device '...' is locked" message was changed to "Device
..." so libvirt was no longer detecting this as an error.
2011-03-30 20:43:55 +02:00
6c8f24751e The next release is 0.9.0 not 0.8.9
Fix this which went into documentation
2011-03-30 21:30:54 +08:00
0ecfa7f2e1 check whether qemuMonitorJSONHMP() failed
If qemu quited unexpectedly when we call qemuMonitorJSONHMP(),
libvirt will crash.
Steps to reproduce this bug:
1. use gdb to attach libvirtd, and set a breakpoint in the function
   qemuMonitorSetCapabilities()
2. start a vm
3. let the libvirtd to run until qemuMonitorJSONSetCapabilities() returns.
4. kill the qemu process
5. continue running libvirtd

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-03-30 16:32:22 +08:00
cc2424fc65 do not send monitor command after monitor meet error
If the monitor met a error, and we will call qemuProcessHandleMonitorEOF().
But we may try to send monitor command after qemuProcessHandleMonitorEOF()
returned. Then libvirtd will be blocked in qemuMonitorSend().

Steps to reproduce this bug:
1. use gdb to attach libvirtd, and set a breakpoint in the function
   qemuConnectMonitor()
2. start a vm
3. let the libvirtd to run until qemuMonitorOpen() returns.
4. kill the qemu process
5. continue running libvirtd

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-03-30 16:32:22 +08:00
025e199810 qemu: unlock qemu driver before return from domain save
qemuDriverUnlock() wasn't called on 2 exit paths
* src/qemu/qemu_driver.c: fix qemudDomainSave() to always unlock
  the driver before exiting on error
2011-03-30 10:34:16 +08:00
343a27aff8 extend logging to record configuration-related changes
Currently libvirt's default logging is limited and it is difficult to
determine what was happening when a proglem occurred (especially on a
machines where one don't know the detail.)  This patch helps to do that
by making additional logging available for the following events:

  creating/defining/undefining domains
  creating/defining/undefining/starting/stopping networks
  creating/defining/undefining/starting/stopping storage pools
  creating/defining/undefining/starting/stopping storage volumes.

* AUTHORS: add Naoya Horiguchi
* src/network/bridge_driver.c src/qemu/qemu_driver.c
  src/storage/storage_driver.c: provide more VIR_INFO logging
2011-03-30 09:19:47 +08:00
1613912dc2 Add libvirt_iohelper to spec file
The new iohelper binary was missing from the packaging spec
2011-03-30 08:54:23 +08:00
079ae9c7a1 cputune: New tests for cputune XML
v1 - v2:
  * Add missed tests/qemuxml2argvdata/qemuxml2argv-cputune.args
2011-03-29 22:13:46 +08:00
01692bb167 cputune: Support cputune for xend driver
Not sure if it's the correct way to add cputune xml for xend driver,
and besides, seems "xm driver" and "xen hypervisor" also support
vcpu affinity, do we need to add support for them too?
2011-03-29 22:13:46 +08:00
e98eb7f4a5 cputune: Support cputune for lxc driver
LXC driver doesn't support vcpu affinity yet, so just need
to modify it to support cpu shares.
2011-03-29 22:13:46 +08:00
1cc4d0259c cputune: Support cputune for qemu driver
When domain startup, setting cpu affinity and cpu shares according
to the cputune xml specified in domain xml.

Modify "qemudDomainPinVcpu" to update domain config for vcpupin,
and modify "qemuSetSchedulerParameters" to update domain config
for cpu shares.

v1 - v2:
   * Use "VIR_ALLOC_N" instead of "VIR_ALLOC_VAR"
   * But keep raising error when it fails on adding vcpupin xml
     entry, as I still don't have a better idea yet.
2011-03-29 22:13:46 +08:00
b8853925fa cputune: Implementations of parsing and formating cputune xml
Implementations of following functions:
  virDomainVcpupinIsDuplicate
  virDomainVcpupinFindByVcpu
  virDomainVcpupinAdd

Update "virDomainDefParseXML" to parse, and "virDomainDefFormatXML"
to build cputune xml, also implementations of new internal helper
functions.

v1 - v2:
  * Resolve potential crash bug of "virDomainVcpupinAdd"
2011-03-29 22:13:46 +08:00
853f0fdfd9 cputune: Add data structures presenting cputune XML
Also related new functions' declaration, and expose the new introduced
functions in libvirt_private.syms.

v1 - v2:
  Don't expose "virAllocVar" in libvirt_private.syms
2011-03-29 22:13:46 +08:00
6b3644202a cputune: Add document for cputune XML
v1 - v3:
  * More clear document for "cpu shares", adopted suggestions from
    Matthias Bottle and Daniel Veillard.
2011-03-29 22:13:45 +08:00
e3ea882821 cputune: Add XML schema for cputune xml
v1 - v2:
  * Remove upper limit of cpu shares. (Suggested by Matthias Bottle)
2011-03-29 22:13:45 +08:00
daa6aa687a qemu: fix regression with fd labeling on migration
My earlier testing for commit 34fa0de0 was done while starting
just-built libvirt from an unconfined_t shell, where the fds happened
to work when transferring to qemu.  But when installed and run under
virtd_t, failure to label the raw file (with no compression) or the
pipe (with compression) triggers SELinux failures when passing fds
over SCM_RIGHTS to svirt_t qemu.

* src/qemu/qemu_migration.c (qemuMigrationToFile): When passing
FDs, make sure they are labeled.
2011-03-29 07:12:29 -06:00
285e8a1769 qemu: improve error message on failed fd transfer
First fallout of fd: migration - it looks like SELinux enforcing
_does_ require fd labeling (running uninstalled libvirtd from an
unconstrained shell had no problems, but once faked out by doing
 chcon `stat -c %C /usr/sbin/libvirtd` daemon/libvirtd
 run_init $PWD/daemon/libvirtd
to run it with the same context as an init script service, and with
SELinux enforcing, I got a rather confusing failure:
error: Failed to save domain fedora_12 to fed12.img
error: internal error unable to send TAP file handle: No file descriptor supplied via SCM_RIGHTS

This fixes the error message, then I need to figure out a subsequent
patch that does the fsetfilecon() necessary to keep things happy.
It also appears that libvirtd hangs on a failed fd transfer; I don't
know if that needs an independent fix.

* src/qemu/qemu_monitor_text.c (qemuMonitorTextSendFileHandle):
Improve message, since TAP is no longer only client.
2011-03-29 07:12:29 -06:00
e54a2f9340 maint: ignore new built file
* .gitignore: Exclude libvirt_iohelper.
2011-03-29 07:12:29 -06:00
6ebcb0c777 Add domainSuspend/Resume to libxl driver
* src/libxl/libxl_driver.c: implements libxlDomainSuspend and
  libxlDomainResume
2011-03-29 20:57:02 +08:00
f367a1dfce Add domainGetOSType to libxl driver
* src/libxl/libxl_driver.c: implements libxlDomainGetOSType
2011-03-29 20:57:02 +08:00
d53bca4868 Add domainGetSchedulerType to libxl driver
* src/libxl/libxl_driver.c: implements libxlDomainGetSchedulerType
2011-03-29 20:57:02 +08:00
0244977180 Implements domainXMLTo/FromNative in libxl driver
* src/Makefile.am src/libvirt_private.syms configure.ac: share and
  reuse the sexpr routines from sexpr.h of the old xen driver
* src/libxl/libxl_driver.c: implements libxlDomainXMLFromNative and
  libxlDomainXMLToNative
2011-03-29 20:57:02 +08:00
3d6fe99c5c Add vcpu functions to libxl driver
Hook the virtual cpu functions to their libxenlight counterparts

* src/libxl/libxl_driver.c: implements libxlDomainSetVcpus,
  libxlDomainGetVcpus, libxlDomainSetVcpusFlags,
  libxlDomainGetVcpusFlags and libxlDomainPinVcpu
2011-03-29 20:57:02 +08:00
cbf2717cfd List authors in copyright headers
* src/libxl/libxl_conf.[ch] src/libxl/libxl_driver.[ch]: add authors
  after the licence template
2011-03-29 20:57:02 +08:00
68e1032378 Add event callbacks to libxl driver
* src/libxl/libxl_conf.h: add the necessary fields to the driver
  private structure
* src/libxl/libxl_driver.c: add lifecycle event support and entry
  points for event(de)register(any)
2011-03-29 20:57:02 +08:00
6d60ca5d58 Ignore return value of virDomainObjUnref
* src/libxl/libxl_driver.c: use ignore_value() in libxlDomainObjUnref
  and libxlCreateDomEvents
2011-03-29 20:57:02 +08:00
88416593e1 Fix infinite loop in daemon if client quits with multiple streams open
The daemon loops over the linked list of streams when a client
quits, closing any that the client hadn't already closed. Except
it didn't ever move to the next element in the list!

* daemon/stream.c: Fix loop over linked list of streams
2011-03-29 12:17:58 +01:00
230a5d8b4a Remote protocol support for storage vol upload/download APIs
* daemon/remote.c, src/remote/remote_driver.c: Implementation
  of storage vol upload/download APIs
* src/remote/remote_protocol.x: Wire protocol definition for
  upload/download
* daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h,
  daemon/remote_dispatch_table.h, src/remote/remote_protocol.h,
  src/remote/remote_protocol.c: Re-generate
2011-03-29 12:17:52 +01:00
925639627c Support volume data upload/download APIs in storage driver
Use generic FD streams to allow data upload/download to/from
any storage volume

* src/storage/storage_driver.c: Wire up upload/download APIs
2011-03-29 12:17:45 +01:00
6299ca71c4 Add vol-upload and vol-download commands to virsh
The new commands vol-upload and vol-download, allow a local file
to be transferred to/from a storage volume.

* tools/virsh.c: Add vol-upload and vol-download commands
* tools/virsh.pod: Document new commands
2011-03-29 12:17:38 +01:00
7300f68dff Add public APIs for storage volume upload/download
New APIs are added allowing streaming of content to/from
storage volumes.

* include/libvirt/libvirt.h.in: Add virStorageVolUpload and
  virStorageVolDownload APIs
* src/driver.h, src/libvirt.c, src/libvirt_public.syms: Stub
  code for new APIs
* src/storage/storage_driver.c, src/esx/esx_storage_driver.c:
  Add dummy entries in driver table for new APIs
2011-03-29 12:17:33 +01:00
e886237af5 Enhance the streams helper to support plain file I/O
The O_NONBLOCK flag doesn't work as desired on plain files
or block devices. Introduce an I/O helper program that does
the blocking I/O operations, communicating over a pipe that
can support O_NONBLOCK

* src/fdstream.c, src/fdstream.h: Add non-blocking I/O
  on plain files/block devices
* src/Makefile.am, src/util/iohelper.c: I/O helper program
* src/qemu/qemu_driver.c, src/lxc/lxc_driver.c,
  src/uml/uml_driver.c, src/xen/xen_driver.c: Update for
  streams API change
2011-03-29 12:17:28 +01:00
0c97e70b74 Update event loop example programs to demonstrate best practice
The example C event loop code is a nasty hack and not compliant
with the require API semantics. Delete this, so that developers
don't mistakenly copy it. Instead call the new public event loop
APIs.

Update the python event loop example, so that it can optionally
use the public event APIs, as an alternative to the pure python
code. The pure python event code is a good working example, so
don't delete it.

Also make the python example use a read only connection to avoid
authentication prompts

* examples/domain-events/events-c/event-test.c: Replace event
  loop code with use of public APIs
* examples/domain-events/events-python/event-test.py: Allow
  optional use of new public event APIs
2011-03-29 10:59:46 +01:00
83b77fa589 qemu: fix regression that hangs on save failure
Regression introduced in commit 6034ddd55.

* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Jump to correct
label.
2011-03-28 17:00:32 -06:00
16a4243c19 build: fix compilation on mingw
* src/util/command.c (virCommandAbort) [WIN32]: Provide stub.
Reported by Daniel P. Berrange's autobuilder.
2011-03-28 14:12:28 -06:00
15d757ac4e qemu: support fd: migration with compression
Spawn the compressor ourselves, instead of requiring the shell.

* src/qemu/qemu_migration.c (qemuMigrationToFile): Spawn
compression helper process when needed.
2011-03-28 10:26:33 -06:00
34fa0de05e qemu: skip granting access during fd migration
SELinux labeling and cgroup ACLs aren't required if we hand a
pre-opened fd to qemu.  All the more reason to love fd: migration.

* src/qemu/qemu_migration.c (qemuMigrationToFile): Skip steps
that are irrelevant in fd migration.
2011-03-28 10:26:33 -06:00
6034ddd559 qemu: consolidate migration to file code
This points out that core dumps (still) don't work for root-squash
NFS, since the fd is not opened correctly.  This patch should not
introduce any functionality change, it is just a refactoring to
avoid duplicated code.

* src/qemu/qemu_migration.h (qemuMigrationToFile): New prototype.
* src/qemu/qemu_migration.c (qemuMigrationToFile): New function.
* src/qemu/qemu_driver.c (qemudDomainSaveFlag, doCoreDump): Use
it.
2011-03-28 10:26:33 -06:00
80449b325e qemu: use common API for reading difficult files
Direct access to an open file is so much simpler than passing
everything through a pipe!

* src/qemu/qemu_driver.c (qemudOpenAsUID)
(qemudDomainSaveImageClose): Delete.
(qemudDomainSaveImageOpen): Rename...
(qemuDomainSaveImageOpen): ...and drop read_pid argument.  Use
virFileOpenAs instead of qemudOpenAsUID.
(qemudDomainSaveImageStartVM, qemudDomainRestore)
(qemudDomainObjRestore): Rename...
(qemuDomainSaveImageStartVM, qemuDomainRestore)
(qemDomainObjRestore): ...and simplify accordingly.
(qemudDomainObjStart, qemuDriver): Update callers.
2011-03-28 10:26:33 -06:00
1a369dfbe8 qemu, storage: improve type safety
* src/storage/storage_backend.c (createRawFileOpHook): Change
signature.
(struct createRawFileOpHookData): Delete unused struct.
(virStorageBackendCreateRaw): Adjust caller.
* src/qemu/qemu_driver.c (struct fileOpHookData): Delete unused
struct.
(qemudDomainSaveFileOpHook): Rename...
(qemuDomainSaveFileOpHook): ...and change signature.
(qemudDomainSaveFlag): Adjust caller.
2011-03-28 10:26:33 -06:00
fa3e1e35eb util: adjust indentation in previous patch
Separating the indentation from the real patch made review easier.

* src/util/util.c (virFileOpenAs): Whitespace changes.
2011-03-28 10:26:33 -06:00
1fdd50f999 util: rename virFileOperation to virFileOpenAs
This patch intentionally doesn't change indentation, in order to
make it easier to review the real changes.

* src/util/util.h (VIR_FILE_OP_RETURN_FD, virFileOperationHook):
Delete.
(virFileOperation): Rename...
(virFileOpenAs): ...and reduce parameters.
* src/util/util.c (virFileOperationNoFork, virFileOperation):
Rename and simplify.
* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Adjust caller.
* src/storage/storage_backend.c (virStorageBackendCreateRaw):
Likewise.
* src/libvirt_private.syms: Reflect rename.
2011-03-28 10:26:33 -06:00
fe303a4256 storage: simplify fd handling
* src/storage/storage_backend.c (virStorageBackendCreateRaw): Use
new virFileOperation flag.
2011-03-28 10:26:33 -06:00
3eede281eb qemu: simplify domain save fd handling
This makes root-squash NFS saves more efficient.

* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Use new
virFileOperation flag to open fd only once.
2011-03-28 10:26:33 -06:00
055d4ff87c util: use SCM_RIGHTS in virFileOperation when needed
Currently, the hook function in virFileOperation is extremely limited:
it must be async-signal-safe, and cannot modify any memory in the
parent process.  It is much handier to return a valid fd and operate
on it in the parent than to deal with hook restrictions.

* src/util/util.h (VIR_FILE_OP_RETURN_FD): New flag.
* src/util/util.c (virFileOperationNoFork, virFileOperation):
Honor new flag.
2011-03-28 10:26:33 -06:00
9497506fa0 qemu: allow simple domain save to use fd: protocol
This allows direct saves (no compression, no root-squash NFS) to use
the more efficient fd: migration, which in turn avoids a race where
qemu exec: migration can sometimes fail because qemu does a generic
waitpid() that conflicts with the pclose() used by exec:.  Further
patches will solve compression and root-squash NFS.

* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Use new function
when there is no compression.
2011-03-28 10:26:32 -06:00
d51023d4c2 qemu: fix restoring a compressed save image
Latent bug introduced in commit 2d6a581960 (Aug 2009), but not exposed
until commit 1859939a (Jan 2011).  Basically, when virExec creates a
pipe, it always marks libvirt's side as cloexec.  If libvirt then
wants to hand that pipe to another child process, things work great if
the fd is dup2()'d onto stdin or stdout (as with stdin: or exec:
migration), but if the pipe is instead used as-is (such as with fd:
migration) then qemu sees EBADF because the fd was closed at exec().

This is a minimal fix for the problem at hand; it is slightly racy,
but no more racy than the rest of libvirt fd handling, including the
case of uncompressed save images.  A more invasive fix, but ultimately
safer at avoiding leaking unintended fds, would be to _always and
atomically_ open all fds as cloexec in libvirt (thanks to primitives
like open(O_CLOEXEC), pipe2(), accept4(), ...), then teach virExec to
clear that bit for all fds explicitly marked to be handed to the child
only after forking.

* src/qemu/qemu_command.c (qemuBuildCommandLine): Clear cloexec
flag.
* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Tweak test.
2011-03-28 10:26:32 -06:00
296eb0bbe3 util: allow clearing cloexec bit
* src/util/util.h (virSetInherit): New prototype.
* src/util/util.c (virSetCloseExec): Move guts...
(virSetInherit): ...to new function, and allow clearing.
* src/libvirt_private.syms (util.h): Export it.
2011-03-28 10:26:32 -06:00
60dea30b7d logging: always NUL-terminate circular buffer
* src/util/logging.c (virLogStartup, virLogSetBufferSize):
Over-allocate, so that a debugger can just print the circular
buffer.  Suggested by Daniel Veillard.
2011-03-28 10:14:06 -06:00
009bd51b94 maint: use space, not tab, in remote_protocol-structs
* src/Makefile.am (remote_protocol-structs): Flatten tabs.
* src/remote_protocol-structs: Likewise.  Also add a hint to emacs
to make it easier to keep spaces in the file.
2011-03-28 10:10:04 -06:00
d0c7254bf1 tests: don't alter state in $HOME
Diego reported a bug where virsh tries to initialize a readline
history directory during 'make check' run as root, but fails
because /root was read-only.

It turns out that I could reproduce this as non-root, by using:

mv ~/.virsh{,.bak}
chmod a-w ~
make check -C tests TESTS=int-overflow
chmod u+w ~
mv ~/.virsh{.bak,}

* tests/int-overflow: Don't trigger interactive mode.
Reported by Diego Elio Pettenò.
2011-03-28 09:55:46 -06:00
ef701fd8cb docs: document recent hook additions
* src/qemu/qemu_process.c (qemuProcessStart, qemuProcessStop): Fix
typos.
* docs/hooks.html.in: Document 'prepare' and 'release' hooks.
2011-03-28 09:51:04 -06:00
96d567862a qemu: don't restore state label twice
Otherwise, if something like doStopVcpus fails after the first
restore, a second restore is attempted and throws a useless
warning.

* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Avoid second
restore of state label.
2011-03-28 09:10:09 -06:00
4591df766d Remove the Open Nebula driver
The Open Nebula driver has been unmaintained since it was first
introduced. The only commits have been for tree-wide cleanups.
It also has a major design flaw, in that it only knows about guests
that it has created itself, which makes it of very limited use.

Discussions wrt evolution of the VMWare ESX driver, concluded that
it should limit itself to single-node ESX operation and not try to
manage the multi-node architecture of VirtualCenter. Open Nebula
is a cluster like Virtual Center, not a single node system, so
the same reasoning applies.

The DeltaCloud project includes an Open Nebula driver and is a much
better fit architecturally, since it is explicitly targetting the
distributed multihost cluster scenario.

Thus this patch deletes the libvirt Open Nebula driver with the
recommendation that people use DeltaCloud for managing it instead.

* configure.ac: Remove probe for xmlrpc & --with-one arg
* daemon/Makefile.am, daemon/libvirtd.c, src/Makefile.am: Remove
  ONE driver build
* src/opennebula/one_client.c, src/opennebula/one_client.h,
  src/opennebula/one_conf.c, src/opennebula/one_conf.h,
  src/opennebula/one_driver.c, src/opennebula/one_driver.c: Delete
  files
* autobuild.sh, libvirt.spec.in, mingw32-libvirt.spec.in: Remove
  build rules for Open Nebula
* docs/drivers.html.in, docs/sitemap.html.in: Remove reference
  to OpenNebula
* docs/drvone.html.in: Delete file
2011-03-28 14:09:11 +01:00
ab8984e482 Fix syntax error in configure.ac
Which will lead "./configure --with-audit=yes" breaks.
2011-03-28 18:05:32 +08:00
191238e5be Update of localisations, switch to transifex
Last pull from i18n CVS, then push to transifex.net which is now
our localization upstream:

http://www.transifex.net/projects/p/libvirt/resource/strings/
2011-03-28 10:44:35 +08:00
50d8ad828d Update on the goal page
Some things to note in this patch:
   - we do extend libvirt scope beyond purely managing domains, there is
     already a number of blocks which are here as helpr functions to
     manage the resources on the host.
   - we are expanding in the direction of libvirt being sufficient to do
     most of the management on the Host (but within the limits of the need
     for virtualization, e.g. managing users on the host is out of scope)
   - we don't require anymore APIs to be supported by multiple
     hypervisors to get in, it's already the case in practice, but we
     should still make sure the semantic of those APIs are clear. We
     added quite a bit for QEmu, but for example I saw on IRC that VBox
     could emulate a network unplug/replug on a domain interface, and
     that would be a good addition even if a priori no other hypervisor
     supports it.
   - Make clear that all libvirt APIs are available remotely, which is
     key to use libvirt for building management tools.
   - link the goal page from the project main page

As for libvirt project directions, I think it just reflects the natural
evolution in the last couple of years. We are less hypervisor agnostic
and extending in the Host management. Clearly there is interest in
making sure libvirt is complete in term of features for the hypervisors
supported, especially the ones like KVM or LXC which don't really have
integrated management library.

* docs/goals.html.in: update the goals page
* docs/index.html.in: link it from the top page
2011-03-28 10:40:24 +08:00
4cb5044dcb remote: Don't leak gnutls session on negotiation error 2011-03-26 16:43:44 +01:00
42a0fc39c1 hooks: fix regression in previous patch
* src/util/hooks.c (virHookCheck): Missing hooks should just be
debug, not warn.
2011-03-25 15:15:11 -06:00
24da109573 Add missing { for qemudDomainInterfaceStats
Add missing open curly brace between function declaration of non-linux
variant of qemudDomainInterfaceStats() and its body.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2011-03-25 09:56:06 -06:00
b5a048ed68 build: shorten libxenlight summary for consistent alignment
* configure.ac: Use xenlight: rather than libxenlight: in summary.
Suggested by Daniel Veillard.
2011-03-25 09:06:18 -06:00
55cc591fc1 daemon: Avoid resetting errors before they are reported
Commit f44bfb7 was supposed to make sure no additional libvirt API (esp.
*Free) is called before remoteDispatchConnError() is called on error.
However, the patch missed two instances.
2011-03-25 15:05:35 +01:00
9ed545185f command: add virCommandAbort for cleanup paths
Sometimes, an asynchronous helper is started (such as a compressor
or iohelper program), but a later error means that we want to
abort that child.  Make this easier.

Note that since daemons and virCommandRunAsync can't mix, the only
time virCommandFree can reap a process is if someone did
virCommandRunAsync for a non-daemon and didn't stash the pid.

* src/util/command.h (virCommandAbort): New prototype.
* src/util/command.c (_virCommand): Add new field.
(virCommandRunAsync, virCommandWait): Track whether pid was used.
(virCommandFree): Reap child if caller did not request pid.
(virCommandAbort): New function.
* src/libvirt_private.syms (command.h): Export it.
* tests/commandtest.c (test19): New test.
2011-03-25 05:34:48 -06:00
4e808602f1 command: don't mix RunAsync and daemons
It doesn't make sense to run a daemon without synchronously
waiting for the child process to reply whether the daemon has
been kicked off and pidfile written yet.

* src/util/command.c (VIR_EXEC_RUN_SYNC): New constant.
(virCommandRun): Set temporary flag.
(virCommandRunAsync): Use it to prevent async runs of intermediate
child when spawning asynchronous daemon grandchild.
2011-03-25 05:34:48 -06:00
208a044a54 command: properly diagnose process exit via signal
Child processes don't always reach _exit(); if they die from a
signal, then any messages should still be accurate.  Most users
either expect a 0 status (thankfully, if status==0, then
WIFEXITED(status) is true and WEXITSTATUS(status)==0 for all
known platforms) or were filtering on WIFEXITED before printing
a status, but a few were missing this check.  Additionally,
nwfilter_ebiptables_driver was making an assumption that works
on Linux (where WEXITSTATUS shifts and WTERMSIG just masks)
but fails on other platforms (where WEXITSTATUS just masks and
WTERMSIG shifts).

* src/util/command.h (virCommandTranslateStatus): New helper.
* src/libvirt_private.syms (command.h): Export it.
* src/util/command.c (virCommandTranslateStatus): New function.
(virCommandWait): Use it to also diagnose status from signals.
* src/security/security_apparmor.c (load_profile): Likewise.
* src/storage/storage_backend.c
(virStorageBackendQEMUImgBackingFormat): Likewise.
* src/util/util.c (virExecDaemonize, virRunWithHook)
(virFileOperation, virDirCreate): Likewise.
* daemon/remote.c (remoteDispatchAuthPolkit): Likewise.
* src/nwfilter/nwfilter_ebiptables_driver.c (ebiptablesExecCLI):
Likewise.
2011-03-25 05:34:48 -06:00
6ef1f6c2a1 Add memory functions to libxl driver 2011-03-25 04:14:20 -06:00
c4dae2d9a8 fix the check of the output of monitor command 'device_add'
Hotpluging host usb device by text mode will fail, because the monitor
command 'device_add' outputs 'husb: using...' if it succeeds, but we
think the command should not output anything.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-03-25 12:38:34 +08:00
72d4ff5b7c build: enforce reference count checking
Add the compiler attribute to ensure we don't introduce any more
ref bugs like were just patched in commit 9741f34, then explicitly
mark the remaining places in code that are safe.

* src/qemu/qemu_monitor.h (qemuMonitorUnref): Mark
ATTRIBUTE_RETURN_CHECK.
* src/conf/domain_conf.h (virDomainObjUnref): Likewise.
* src/conf/domain_conf.c (virDomainObjParseXML)
(virDomainLoadStatus): Fix offenders.
* src/openvz/openvz_conf.c (openvzLoadDomains): Likewise.
* src/vmware/vmware_conf.c (vmwareLoadDomains): Likewise.
* src/qemu/qemu_domain.c (qemuDomainObjBeginJob)
(qemuDomainObjBeginJobWithDriver)
(qemuDomainObjExitRemoteWithDriver): Likewise.
* src/qemu/qemu_monitor.c (QEMU_MONITOR_CALLBACK): Likewise.
Suggested by Daniel P. Berrange.
2011-03-24 15:29:18 -06:00
391c397e48 maint: prohibit access(,X_OK)
This simplifies several callers that were repeating checks already
guaranteed by util.c, and makes other callers more robust to now
reject directories.  remote_driver.c was over-strict - access(,R_OK)
is only needed to execute a script file; a binary only needs
access(,X_OK) (besides, it's unusual to see a file with x but not
r permissions, whether script or binary).

* cfg.mk (sc_prohibit_access_xok): New syntax-check rule.
(exclude_file_name_regexp--sc_prohibit_access_xok): Exempt one use.
* src/network/bridge_driver.c (networkStartRadvd): Fix offenders.
* src/qemu/qemu_capabilities.c (qemuCapsProbeMachineTypes)
(qemuCapsInitGuest, qemuCapsInit, qemuCapsExtractVersionInfo):
Likewise.
* src/remote/remote_driver.c (remoteFindDaemonPath): Likewise.
* src/uml/uml_driver.c (umlStartVMDaemon): Likewise.
* src/util/hooks.c (virHookCheck): Likewise.
2011-03-24 15:18:44 -06:00
d1c8c8d438 Get cpu time and current memory balloon from libxl 2011-03-24 13:34:44 -06:00
f44bfb7fb9 Make error reporting in libvirtd thread safe
Bug https://bugzilla.redhat.com/show_bug.cgi?id=689374 reported libvirtd
crash during error dispatch.

The reason is that libvirtd uses remoteDispatchConnError() with non-NULL
conn parameter which means that virConnGetLastError() is used instead of
its thread safe replacement virGetLastError().

So when several libvirtd threads are reporting errors at the same time,
the errors can get mixed or corrupted or in case of bad luck libvirtd
itself crashes.

Since Daniel B. is going to rewrite this code from scratch on top of his
RPC infrastructure, I tried to come up with a minimal fix. Thus,
remoteDispatchConnError() now just ignores its conn argument and always
calls virGetLastError(). However, several callers had to be touched as
well, since no libvirt API is allowed to be called before dispatching
the error. Doing so would reset the error and we would have nothing to
dispatch. As a result of that, the code is not very nice but that
doesn't really make daemon/remote.c worse than it is now :-) And it will
all die soon, which is good.

The bug report also contains a reproducer in C which detects both mixed
up error messages and libvirtd crash. Before this patch, I was able to
crash libvirtd in about 20 seconds up to 3 minutes depending on number
of CPU cores (more is better) and luck.
2011-03-24 09:39:50 +01:00
9450a7cbef update domain status forcibly even if attach a device failed
Steps to reproduce this bug:
1. virsh attach-disk domain --source diskimage --target sdb --sourcetype file --driver qemu --subdriver qcow2
   error: Failed to attach disk
   error: operation failed: adding scsi-disk,bus=scsi0.0,scsi-id=1,drive=drive-scsi0-0-1,id=scsi0-0-1 device failed: Property 'scsi-disk.drive' can't find value 'drive-scsi0-0-1'
2. service libvirtd restart
   Stopping libvirtd daemon:                                  [  OK  ]
   Starting libvirtd daemon:                                  [  OK  ]
3. virsh attach-disk domain --source diskimage --target sdb --sourcetype file --driver qemu --subdriver raw
   error: Failed to attach disk
   error: operation failed: adding lsi,id=scsi0,bus=pci.0,addr=0x6 device failed: Duplicate ID 'scsi0' for device

The reason is that we create a new scsi controller but we do not update
/var/run/libvirt/qemu/domain.xml.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-03-24 15:26:28 +08:00
2d24037db0 build: nuke all .x-sc* files, and fix VPATH syntax-check
Not every day you see a patch that nukes 27 files!

* .gnulib: Update to latest, for maint.mk improvements
* bootstrap: Resync to gnulib.
* bootstrap.conf (ACLOCAL): Swap the secondary aclocal include
directory, now that bootstrap picks up gnulib/m4 instead of m4.
* Makefile.am (syntax_check_exceptions, EXTRA_DIST): No longer
worry about nuked files.
* cfg.mk (sc_x_sc_dist_check): Delete dead rule.
(VC_LIST_ALWAYS_EXCLUDE_REGEX): Add HACKING.
(exclude_file_name_regexp--sc_*): Inline and simplify contents...
* .x-sc_*: ...from here, then delete the files.
2011-03-23 15:51:32 -06:00
ee691d8433 command: reject pidfile on non-daemon
* src/util/command.c (virCommandRunAsync): Since virExec only
creates pidfiles for daemon, enforce this in virCommand.
2011-03-23 15:01:28 -06:00
e904ce3c47 domain_conf: drop unused ref-count in snapshot object
The ref count was assigned to 1 at creation, then never modified again
until it was decremented just before freeing the object.

* src/conf/domain_conf.h (_virDomainSnapshotObj): Delete unused
field.
(virDomainSnapshotObjUnref): Delete unused prototype.
* src/libvirt_private.syms: Likewise.
* src/conf/domain_conf.c (virDomainSnapshotObjNew)
(virDomainSnapshotObjListDataFree): Update users.
(virDomainSnapshotObjUnref): Delete.
2011-03-23 11:34:29 -06:00
206fc979b1 rpm: add missing dependencies
Among others, the missing radvd dependency showed up as:

error: Failed to start network ipv6net
error: Cannot find radvd - Possibly the package isn't installed: No such file
or directory

even when radvd was installed, because the RADVD preprocessor
symbol was missing at configure time.

* libvirt.spec.in (with_network): Add BuildRequires for radvd,
iptables, and ip6tables.
(BuildRequires): Add libxslt and augeas for docs and test.
(with_libvirtd): Add module-init-tools for modprobe.
(with_nwfilter): Add BuildRequires for ebtables.
(with_esx): Fix esx build on RHEL 5, thanks to curl-devel rename.
2011-03-23 11:16:49 -06:00
7ee06f334b rpm: separate runtime and build requirements
* libvirt.spec.in (Requires): Reorganize requirements a bit; no
functional change.
2011-03-23 11:03:23 -06:00
93e8b8778a util: Fix return value for virJSONValueFromString if it fails
Problem:
  "parser.head" is not NULL even if it's free'ed by "virJSONValueFree",
returning "parser.head" when "virJSONValueFromString" fails will cause
unexpected errors (libvirtd will crash sometimes), e.g.
  In function "qemuMonitorJSONArbitraryCommand":

        if (!(cmd = virJSONValueFromString(cmd_str)))
            goto cleanup;

        if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
            goto cleanup;

        ......

     cleanup:
        virJSONValueFree(cmd);

  It will continues to send command to monitor even if "virJSONValueFromString"
is failed, and more worse, it trys to free "cmd" again.

  Crash example:
{"error":{"class":"QMPBadInputObject","desc":"Expected 'execute' in QMP input","data":{"expected":"execute"}}}
{"error":{"class":"QMPBadInputObject","desc":"Expected 'execute' in QMP input","data":{"expected":"execute"}}}
error: server closed connection:
error: unable to connect to '/var/run/libvirt/libvirt-sock', libvirtd may need to be started: Connection refused
error: failed to connect to the hypervisor

  This fix is to:
    1) return NULL for failure of "virJSONValueFromString",
    2) and it seems "virJSONValueFree" uses incorrect loop index for type
       of "VIR_JSON_TYPE_OBJECT", fix it together.

* src/util/json.c
2011-03-23 22:57:44 +08:00
bcac844f4f Initialization error of qemuCgroupData in Qemu host usb hotplug
Steps to reproduce this bug:
# cat usb.xml
<hostdev mode='subsystem' type='usb'>
  <source>
    <address bus='0x001' device='0x003'/>
  </source>
</hostdev>
# virsh attach-device vm1 usb.xml
error: Failed to attach device from usb.xml
error: server closed connection:

The reason of this bug is that we set data.cgroup to NULL, and this will cause
libvirtd crashed.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-03-23 22:10:14 +08:00
18d68462e3 qemu: simplify monitor callbacks
A future patch will change reference counting idioms; consolidating
this pattern now makes the next patch smaller (touch only the new
macro rather than every caller).

* src/qemu/qemu_monitor.c (QEMU_MONITOR_CALLBACK): New helper.
(qemuMonitorGetDiskSecret, qemuMonitorEmitShutdown)
(qemuMonitorEmitReset, qemuMonitorEmitPowerdown)
(qemuMonitorEmitStop, qemuMonitorEmitRTCChange)
(qemuMonitorEmitWatchdog, qemuMonitorEmitIOError)
(qemuMonitorEmitGraphics): Use it to reduce duplication.
2011-03-22 17:16:08 -06:00
6afa49a987 build: fix missing initializer
Commit cb4aba9b6 forgot xenapi.

* src/xenapi/xenapi_driver.c (xenapiDriver): Adjust to recent API.
2011-03-22 14:37:02 -06:00
7708da38c7 8021Qbh: use preassociate-rr during the migration prepare stage
This patch introduces PREASSOCIATE-RR during incoming VM migration on the
destination host. This is similar to the usage of PREASSOCIATE during
migration in 8021qbg libvirt code today. PREASSOCIATE-RR is a VDP operation.
With the latest at IEEE, 8021qbh will need to support VDP operations.
A corresponding enic driver patch to support PREASSOCIATE-RR for 8021qbh
will be posted for net-next-2.6 inclusion soon.
2011-03-22 15:27:01 -04:00
c59176c109 Fix uninitialized variable & error reporting in LXC veth setup
THe veth setup in LXC had a couple of flaws, first brInit did
not report any error when it failed. Second vethCreate() did
not correctly initialize the variable containing the return
code, so could report failure even when it succeeded.

* src/lxc/lxc_driver.c: Report error when brInit fails
* src/lxc/veth.c: Fix uninitialized variable
2011-03-22 15:54:56 +00:00
83cc3d1d55 Wire up virDomainMigrateSetSpeed into QEMU driver
Enhance the QEMU migration monitoring loop, so that it can get
a signal to change migration speed on the fly

* src/qemu/qemu_domain.h: Add signal for changing speed on the fly
* src/qemu/qemu_driver.c: Wire up virDomainMigrateSetSpeed driver
* src/qemu/qemu_migration.c: Support signal for changing speed
2011-03-22 15:53:08 +00:00
118dd7d06e Wire up virDomainMigrateSetSpeed for the remote RPC driver
* src/remote/remote_protocol.x: Define wire protocol
* daemon/remote.c, src/remote/remote_driver.c: Add new
  functions for virDomainMigrateSetSpeed API
* src/remote/remote_protocol.c, src/remote/remote_protocol.h,
  daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h,
  daemon/remote_dispatch_table.h: Re-generate files
2011-03-22 15:53:08 +00:00
cb4aba9b6a Add public API for setting migration speed on the fly
It is possible to set a migration speed limit when starting
migration. This new API allows the speed limit to be changed
on the fly to adjust to changing conditions

* src/driver.h, src/libvirt.c, src/libvirt_public.syms,
  include/libvirt/libvirt.h.in: Add virDomainMigrateSetMaxSpeed
* src/esx/esx_driver.c, src/lxc/lxc_driver.c,
  src/opennebula/one_driver.c, src/openvz/openvz_driver.c,
  src/phyp/phyp_driver.c, src/qemu/qemu_driver.c,
  src/remote/remote_driver.c, src/test/test_driver.c,
  src/uml/uml_driver.c, src/vbox/vbox_tmpl.c,
  src/vmware/vmware_driver.c, src/xen/xen_driver.c,
  src/libxl/libxl_driver.c: Stub new API
2011-03-22 15:53:08 +00:00
09fb354ce3 maint: update authors
* AUTHORS: Update, to satisfy 'make syntax-check'.
2011-03-22 08:33:22 -06:00
3c204d7d5b Disable libxl build in RPM on Fedora < 16
The xen RPM in Fedora isn't new enough to support libxl builds
yet. Disable it until Fedora 16

* libvirt.spec.in: Disable libxl on Fedora < 16
2011-03-22 14:25:51 +00:00
c33ac2e3b9 qemu: fallback to HMP drive_add/drive_del
fallback to HMP drive_add/drive_del commands if not found in QMP
2011-03-22 15:03:58 +01:00
24c56ceb08 qemu: Only use HMP passthrough if it is supported
Avoids calling text monitor methods when it is know they will not
succeed and also results in nicer error messages.
2011-03-22 15:03:58 +01:00
abdfca09f5 qemu: Detect support for HMP passthrough 2011-03-22 15:03:57 +01:00
3415eeb53e qemu: add two hook script events "prepare" and "release"
Fix for bug https://bugzilla.redhat.com/show_bug.cgi?id=618970

The "prepare" hook is called very early in the VM statup process
before device labeling, so that it can allocate ressources not
managed by libvirt, such as DRBD, or for instance create missing
bridges and vlan interfaces.
* src/util/hooks.c src/util/hooks.h: add definitions for new hooks
  VIR_HOOK_QEMU_OP_PREPARE and VIR_HOOK_QEMU_OP_RELEASE
* src/qemu/qemu_process.c: use them in qemuProcessStart and
  qemuProcessStop()
2011-03-22 21:12:36 +08:00
23674616b9 Update the set of maintainers for the project
Wen Congyang gained commiter access

Created a new section of previous commiters to the project
but not involved much anymore: Karel Zak, Atsushi SAKAI,
Dave Leskovec and Dan Smith
2011-03-22 10:10:15 +08:00
a24ada4e09 qemu: simplify interface fd handling in monitor
With only a single caller to these two monitor commands, I
didn't need to wrap a new WithFds version, but just change
the command itself.

* src/qemu/qemu_monitor.h (qemuMonitorAddNetdev)
(qemuMonitorAddHostNetwork): Add parameters.
* src/qemu/qemu_monitor.c (qemuMonitorAddNetdev)
(qemuMonitorAddHostNetwork): Add support for fd passing.
* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Use it to
simplify code.
2011-03-21 10:47:48 -06:00
098312391e qemu: simplify PCI configfd handling in monitor
This is also a bug fix - on the error path, qemu_hotplug would
leave the configfd file leaked into qemu.  At least the next
attempt to hotplug a PCI device would reuse the same fdname,
and when the qemu getfd monitor command gets a new fd by the
same name as an earlier one, it closes the earlier one, so there
is no risk of qemu running out of fds.

* src/qemu/qemu_monitor.h (qemuMonitorAddDeviceWithFd): New
prototype.
* src/qemu/qemu_monitor.c (qemuMonitorAddDevice): Move guts...
(qemuMonitorAddDeviceWithFd): ...to new function, and add support
for fd passing.
* src/qemu/qemu_hotplug.c (qemuDomainAttachHostPciDevice): Use it
to simplify code.
Suggested by Daniel P. Berrange.
2011-03-21 10:47:48 -06:00
058d4efa58 qemu: simplify monitor fd error handling
qemu_monitor was already returning -1 and setting errno to EINVAL
on any attempt to send an fd without a unix socket, but this was
a silent failure in the case of qemuDomainAttachHostPciDevice.
Meanwhile, qemuDomainAttachNetDevice was doing some sanity checking
for a better error message; it's better to consolidate that to a
central point in the API.

* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Move sanity
checking...
* src/qemu/qemu_monitor.c (qemuMonitorSendFileHandle): ...into
central location.
Suggested by Chris Wright.
2011-03-21 10:47:48 -06:00
4c7508b4de udev: fix regression with qemu:///session
https://bugzilla.redhat.com/show_bug.cgi?id=684655 points out
a regression introduced in commit 2215050edd - non-root users
can't connect to qemu:///session because libvirtd dies when
it can't use pciaccess initialization.

* src/node_device/node_device_udev.c (udevDeviceMonitorStartup):
Don't abort udev driver (and libvirtd overall) if non-root user
can't use pciaccess.
2011-03-21 10:47:48 -06:00
dd5564f218 logging: fix off-by-one bug
Valgrind caught that our log wrap-around was going 1 past the end.
Regression introduced in commit b16f47a; previously the
buffer was static and size+1 bytes, but now it is dynamic and
exactly size bytes.

* src/util/logging.c (virLogStr): Don't write past end of log.
2011-03-21 09:35:01 -06:00
3c2b210a3c do not report OOM error when prepareCall() failed
We have reported error in the function prepareCall(), and
the error is not only OOM error. So we should not report
OOM error in the function call() when prepareCall() failed.
2011-03-21 09:28:25 -06:00
8351358fb4 util: guarantee sane errno in virFileIsExecutable
If virFileIsExecutable is to replace access(file,X_OK), then
errno must be usable on failure.

* src/util/util.c (virFileIsExecutable): Set errno on failure.
2011-03-21 09:22:30 -06:00
4179f8e988 docs: Document first release with spice and qxl 2011-03-21 11:05:53 -04:00
918c8193e2 doc: Add schema definition for imagelabel
<imagelable> is not generated by running domain, actually we parse
it in src/conf/domain_conf.c, this patch is to fix it, otherwise any
validation (virt-xml-validate) on the domain xml dumped from shutoff
domain containing <imagelable> will fail.

* docs/schemas/domain.rng
2011-03-21 16:30:06 +08:00
83bc4fa7fa update virGetVersion description
The current description suggests that you always have to provide
a valid typeVer pointer. But if you want only the libvirt version
it's also possible to set type and typeVer to NULL to skip the
hypervisor part.
2011-03-18 17:09:28 -06:00
ae5155768f Don't return an error on failure to create blkio controller
This patch enables cgroup controllers as much as possible by skipping
the creation of blkio controller when running with old kernels that
doesn't support multi-level directory for blkio controller.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2011-03-18 16:59:03 -06:00
e36804ce86 Don't build libxenlight driver for Xen 4.0
The libxenlight driver does not build against the tech preview
version of libxenlight in Xen 4.0.  Only enable building the
driver against more complete libxenlight found in Xen 4.1.
2011-03-18 15:35:47 -06:00
496084175a qemu: respect locking rules
THREADS.txt states that the contents of vm should not be read or
modified while the vm lock is not held, but that the lock must not
be held while performing a monitor command.  This fixes all the
offenders that I could find.

* src/qemu/qemu_process.c (qemuProcessStartCPUs)
(qemuProcessInitPasswords, qemuProcessStart): Don't modify or
refer to vm state outside lock.
* src/qemu/qemu_driver.c (qemudDomainHotplugVcpus): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainChangeGraphicsPasswords):
Likewise.
2011-03-18 13:32:17 -06:00
b538cdd5a9 network driver: log error and abort network startup when radvd isn't found
This is detailed in:

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

Since radvd is executed by daemonizing it, the attempt to exec the
radvd binary doesn't happen until after libvirtd has already received
an exit code from the intermediate forked process, so no error is
detected or logged by __virExec().

We can't require radvd as a prerequisite for the libvirt package (many
installations don't use IPv6, so they don't need it), so instead we
add in a check to verify there is an executable radvd binary prior to
trying to exec it.
2011-03-18 14:53:45 -04:00
9db5679b02 openvz: fix a simple bug in openvzListDefinedDomains()
This patch adds missing curly brackets to an if
statement in openvzListDefinedDomains()
2011-03-18 11:05:34 -06:00
0d9e81f303 build: translate changes in previous patch
* po/POTFILES.in: Add src/util/hash.c for 'make syntax-check'.
2011-03-18 11:05:34 -06:00
635523f74a Fix delayed event delivery when SASL is active
When SASL is active, it was possible that we read and decoded
more data off the wire than we initially wanted. The loop
processing this data terminated after only one message to
avoid delaying the calling thread, but this could delay
event delivery. As long as there is decoded SASL data in
memory, we must process it, before returning to the poll()
event loop.

This is a counterpart to the same kind of issue solved in

  commit 68d2c3482f

in a different area of the code

* src/remote/remote_driver.c: Process all pending SASL data
2011-03-18 16:47:46 +00:00
e0d014f237 Ensure binary is resolved wrt $PATH in virExec
virExec would only resolved the binary to $PATH if no env
variables were being set. Since there is no execvep() API
in POSIX, we use virFindFileInPath to manually resolve
the binary and then use execv() instead of execvp().
2011-03-18 16:40:01 +00:00
2b84e445d5 Add libxenlight driver
Add a new xen driver based on libxenlight [1], which is the primary
toolstack starting with Xen 4.1.0.  The driver is stateful and runs
privileged only.

Like the existing xen-unified driver, the libxenlight driver is
accessed with xen:// URI.  Driver selection is based on the status
of xend.  If xend is running, the libxenlight driver will not load
and xen:// connections are handled by xen-unified.  If xend is not
running *and* the libxenlight driver is available, xen://
connections are deferred to the libxenlight driver.

V6:
 - Address several code style issues noted by Daniel Veillard
 - Make drive work with xen:/// URI
 - Hold domain object reference while domain is injected in
   libvirt event loop.  Race found and fixed by Markus Groß.

V5:
 - Ensure events are unregistered when domain private data
   is destroyed.  Discovered and fixed by Markus Groß.

V4:
 - Handle restart of libvirtd, reconnecting to previously
   started domains
 - Rebased to current master
 - Tested against Xen 4.1 RC7-pre (c/s 22961:c5d121fd35c0)

V3:
  - Reserve vnc port within driver when autoport=yes

V2:
  - Update to Xen 4.1 RC6-pre (c/s 22940:5a4710640f81)
  - Rebased to current master
  - Plug memory leaks found by Stefano Stabellini and valgrind
  - Handle SHUTDOWN_crash domain death event

[1] http://lists.xensource.com/archives/html/xen-devel/2009-11/msg00436.html
2011-03-18 08:57:48 -06:00
fba550f651 util: Forbid calling hash APIs from iterator callback
Calling most hash APIs is not safe from inside of an iterator callback.
Exceptions are APIs that do not modify the hash table and removing
current hash entry from virHashFroEach callback.

This patch make all APIs which are not safe fail instead of just relying
on the callback being nice not calling any unsafe APIs.
2011-03-18 10:54:56 +01:00
c3ad755f58 qemu: Fix copy&paste error messages in text monitor 2011-03-18 10:49:11 +01:00
d5df67be3c do not unref obj in qemuDomainObjExitMonitor*
Steps to reproduce this bug:
# cat test.sh
  #! /bin/bash -x
  virsh start domain
  sleep 5
  virsh qemu-monitor-command domain 'cpu_set 2 online' --hmp
# while true; do ./test.sh ; done

Then libvirtd will crash.

The reason is that:
we add a reference of obj when we open the monitor. We will reduce this
reference when we free the monitor.

If the reference of monitor is 0, we will free monitor automatically and
the reference of obj is reduced.

But in the function qemuDomainObjExitMonitorWithDriver(), we reduce this
reference again when the reference of monitor is 0.

It will cause the obj be freed in the function qemuDomainObjEndJob().

Then we start the domain again, and libvirtd will crash in the function
virDomainObjListSearchName(), because we pass a null pointer(obj->def->name)
to strcmp().

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-03-18 01:26:31 -04:00
e2aec53b97 qemu: check driver name while attaching disk
This bug was reported by Shi Jin(jinzishuai@gmail.com):
=============
# virsh attach-disk RHEL6RC /var/lib/libvirt/images/test3.img vdb \
        --driver file --subdriver qcow2
Disk attached successfully

# virsh save RHEL6RC /var/lib/libvirt/images/memory.save
Domain RHEL6RC saved to /var/lib/libvirt/images/memory.save

# virsh restore /var/lib/libvirt/images/memory.save
error: Failed to restore domain from /var/lib/libvirt/images/memory.save
error: internal error unsupported driver name 'file'
       for disk '/var/lib/libvirt/images/test3.img'
=============

We check the driver name when we start or restore VM, but we do
not check it while attaching a disk. This adds the same check on disk
driverName used in qemuBuildCommandLine to qemudDomainAttachDevice.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-03-18 00:36:37 -04:00
08ddbe61f6 Improve logging documentation including the debug buffer
* docs/logging.html.in: document the fact that starting from
  0.9.0 the server logs goes to libvirtd.log instead of syslog
  by default, describe the debug buffer, restructure the page
  and add a couple more examples
2011-03-18 10:06:31 +08:00
10598dd568 Avoid taking lock in libvirt debug dump
As pointed out, locking the buffer from the signal handler
cannot been guaranteed to be safe, so to avoid any hazard
we prefer the trade off of dumping logs possibly messed up
by concurrent logging activity rather than risk a daemon
crash.

* src/util/logging.c: change virLogEmergencyDumpAll() to not
  take any lock on the log buffer but reset buffer content variables
  to an empty set before starting the actual dump.
2011-03-18 10:06:30 +08:00
9741f3461b unlock the monitor when unwatching the monitor
Steps to reproduce this bug:
# virsh qemu-monitor-command domain 'cpu_set 2 online' --hmp
The domain has 2 cpus, and we try to set the third cpu online.
The qemu crashes, and this command will hang.

The reason is that the refs is not 1 when we unwatch the monitor.
We lock the monitor, but we do not unlock it. So virCondWait()
will be blocked.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-03-17 17:29:38 -06:00
838f669682 Add vim configuration that makes vim auto-indent code 2011-03-17 17:08:51 -06:00
d69171566d Make virDomainObjParseNode() static
Make virDomainObjParseNode() static since it is called only
in one file.
2011-03-17 16:47:55 -06:00
78ba748ef1 virsh: fix memtune's help message for swap_hard_limit
* Correct the documentation for cgroup: the swap_hard_limit indicates
  mem+swap_hard_limit.
* Change cgroup private apis to: virCgroupGet/SetMemSwapHardLimit

Signed-off-by: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>
2011-03-17 16:45:06 -06:00
2090b0f52d Add PCI sysfs reset access
I'm proposing we make use of $PCIDIR/reset in qemu-kvm to reset
devices on VM reset.  We need to add it to libvirt's list of
files that get ownership for device assignment.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2011-03-17 14:52:50 -06:00
b24b442bf7 Support Xen sysctl v8, domctl v7
xen-unstable c/s 21118:28e5409e3fb3 bumped sysctl version to 8.
xen-unstable c/s 21212:de94884a669c introduced CPU pools feature,
adding another member to xen_domctl_getdomaininfo struct.  Add a
corresponding domctl v7 struct in xen hypervisor sub-driver and
detect sysctl v8 during initialization.
2011-03-17 14:16:47 -06:00
55fb386671 remote: Add missing virCondDestroy calls
The virCond of the remote_thread_call struct was leaked in some
places. This results in leaking the underlying mutex. Which in turn
leaks a handle on Windows.

Reported by Aliaksandr Chabatar and Ihar Smertsin.
2011-03-17 17:51:33 +01:00
80e6200f32 build: improve rpm generation for distro backports
When building for an older distro, it's convenient to just
tell rpmbuild to define dist (for example, to .el6_0), rather
than also remembering to define rhel to 6.

* libvirt.spec.in: Guess %{rhel} based on %{dist}.
Based on an idea by Jiri Denemark.
2011-03-16 11:56:00 -06:00
12775d9491 macvtap: log an error if on failure to connect to netlink socket
A bug in libnl (see https://bugzilla.redhat.com/show_bug.cgi?id=677724
and https://bugzilla.redhat.com/show_bug.cgi?id=677725) makes it very
easy to create a failure to connect to the netlink socket when trying
to open a macvtap network device ("type='direct'" in domain interface
XML). When that error occurred (during a call to libnl's nl_connect()
from libvirt's nlComm(), there was no log message, leading virsh (for
example) to report "unknown error".

There were two other cases in nlComm where an error in a libnl
function might return with failure but no error reported. In all three
cases, this patch logs a message which will hopefully be more useful.

Note that more detailed information about the failure might be
available from libnl's nl_geterror() function, but it calls
strerror(), which is not threadsafe, so we can't use it.
2011-03-16 13:46:29 -04:00
98a4e5a301 storage: Fix a problem which will cause libvirtd crashed
If pool xml has no definition for "port", then "Segmentation fault"
happens when jumping to "cleanup:" to do "VIR_FREE(port)", as "port"
was not initialized in this situation.

* src/conf/storage_conf.c
2011-03-16 16:28:07 +08:00
100bba0647 qemu: support migration to fd
* src/qemu/qemu_monitor.h (qemuMonitorMigrateToFd): New
prototype.
* src/qemu/qemu_monitor.c (qemuMonitorMigrateToFd): New function.
2011-03-15 16:35:43 -06:00
8e42c50bd4 qemu: improve efficiency of dd during snapshots
POSIX states about dd:

If the bs=expr operand is specified and no conversions other than
sync, noerror, or notrunc are requested, the data returned from each
input block shall be written as a separate output block; if the read
returns less than a full block and the sync conversion is not
specified, the resulting output block shall be the same size as the
input block. If the bs=expr operand is not specified, or a conversion
other than sync, noerror, or notrunc is requested, the input shall be
processed and collected into full-sized output blocks until the end of
the input is reached.

Since we aren't using conv=sync, there is no zero-padding, but our
use of bs= means that a short read results in a short write.  If
instead we use ibs= and obs=, then short reads are collected and dd
only has to do a single write, which can make dd more efficient.

* src/qemu/qemu_monitor.c (qemuMonitorMigrateToFile):
Avoid 'dd bs=', since it can cause short writes.
2011-03-15 16:35:43 -06:00
6eaa4ee41b virsh: allow empty string arguments
"virsh connect ''" should try to connect to the default connection,
but the previous patch made it issue a warning about an invalid URI.

* tools/virsh.c (VSH_OFLAG_EMPTY_OK): New option flag.
(vshCommandOptString): Per the declaration, value is required to
be non-NULL.  Honor new flag.
(opts_connect): Allow empty string connection.
2011-03-15 14:33:54 -06:00
ce81bc5ce8 qemu: Fallback to HMP when cpu_set QMP command is not found 2011-03-15 09:55:06 -06:00
a9c32b5d62 Change message for VIR_FROM_RPC error domain
The VIR_FROM_RPC error domain is used generically for any RPC
problem, not simply XML-RPC problems.

* src/util/virterror.c: s/XML-RPC/RPC/
2011-03-15 15:26:35 +00:00
bd82db4057 Add compat function for geteuid()
* configure.ac: Check for geteuid()
* src/util/util.h: Compat for geteuid()
2011-03-15 15:26:35 +00:00
2a2a00eb69 Fix misc bugs in virCommandPtr
The virCommandNewArgs() method would free the virCommandPtr
if it failed to add the args. This meant errors reported in
virCommandAddArgSet() were lost. Simply removing the check
for errors from the constructor means they can be reported
correctly later

The virCommandAddEnvPassCommon() method failed to check for
errors before reallocating the cmd->env array, causing a
potential SEGV if cmd was NULL

The virCommandAddArgSet() method needs to validate that at
least 1 element in 'val's parameter is non-NULL, otherwise
code like

    cmd = virCommandNew(binary)
    virCommandAddAtg(cmd, "foo")

Would end up trying todo  execve("foo"), if binary was
NULL.
2011-03-15 15:26:35 +00:00
2737b6c20b Add virSetBlocking() to allow O_NONBLOCK to be toggle on or off
The virSetNonBlock() API only allows enabling non-blocking
operations. It doesn't allow turning blocking back on. Add
a new API to allow arbitrary toggling.

* src/libvirt_private.syms, src/util/util.h
  src/util/util.c: Add virSetBlocking
2011-03-15 15:26:35 +00:00
30a50fc3b0 qemu: use more appropriate error
Fixes bug in commit acacced

* src/qemu/qemu_command.c (qemuBuildCommandLine):
s/INVALID_ARG/CONFIG_UNSUPPORTED/.
Reported by Daniel P. Berrange.
2011-03-15 08:49:04 -06:00
fc4c8199de docs: update windows page for initial libvirt 0.8.8 installer 2011-03-15 23:31:29 +11:00
e5d46c08af libvirt: fix a simple bug in virDomainSetMemoryFlags()
This patch fix a simple bug in virDomainSetMemoryFlags function.
The patch sent before lacks the consideration of the case
where the driver doesn't support virDomainSetMemoryFlags API.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
2011-03-15 08:14:41 -04:00
4e3117ae50 Make LXC container startup/shutdown/I/O more robust
The current LXC I/O controller looks for HUP to detect
when a guest has quit. This isn't reliable as during
initial bootup it is possible that 'init' will close
the console and let mingetty re-open it. The shutdown
of containers was also flakey because it only killed
the libvirt I/O controller and expected container
processes to gracefully follow.

Change the I/O controller such that when it see HUP
or an I/O error, it uses kill($PID, 0) to see if the
process has really quit.

Change the container shutdown sequence to use the
virCgroupKillPainfully function to ensure every
really goes away

This change makes the use of the 'cpu', 'devices'
and 'memory' cgroups controllers compulsory with
LXC

* docs/drvlxc.html.in: Document that certain cgroups
  controllers are now mandatory
* src/lxc/lxc_controller.c: Check if PID is still
  alive before quitting on I/O error/HUP
* src/lxc/lxc_driver.c: Use virCgroupKillPainfully
2011-03-15 12:12:53 +00:00
b16f47ab61 Allow to dynamically set the size of the debug buffer
This is the part allowing to dynamically resize the debug log
buffer from it's default 64kB size. The buffer is now dynamically
allocated.
It adds a new API virLogSetBufferSize() which resizes the buffer
If passed a zero size, the buffer is deallocated and we do the small
optimization of not formatting messages which are not output anymore.
On the daemon side, it just adds a new option log_buffer_size to
libvirtd.conf and call virLogSetBufferSize() if needed
* src/util/logging.h src/util/logging.c src/libvirt_private.syms:
  make buffer dynamic and add virLogSetBufferSize() internal API
* daemon/libvirtd.conf: document the new log_buffer_size option
* daemon/libvirtd.c: read and use the new log_buffer_size option
2011-03-15 15:13:21 +08:00
1c5dc4c607 qemu: consolidate duplicated monitor migration code
* src/qemu/qemu_monitor_text.h (qemuMonitorTextMigrate): Declare
in place of individual monitor commands.
* src/qemu/qemu_monitor_json.h (qemuMonitorJSONMigrate): Likewise.
* src/qemu/qemu_monitor_text.c (qemuMonitorTextMigrateToHost)
(qemuMonitorTextMigrateToCommand, qemuMonitorTextMigrateToFile)
(qemuMonitorTextMigrateToUnix): Delete.
* src/qemu/qemu_monitor_json.c (qemuMonitorJSONMigrateToHost)
(qemuMonitorJSONMigrateToCommand, qemuMonitorJSONMigrateToFile)
(qemuMonitorJSONMigrateToUnix): Delete.
* src/qemu/qemu_monitor.c (qemuMonitorMigrateToHost)
(qemuMonitorMigrateToCommand, qemuMonitorMigrateToFile)
(qemuMonitorMigrateToUnix): Consolidate shared code.
2011-03-14 21:57:43 -06:00
c7af07ace4 qemu: use lighter-weight fd:n on incoming tunneled migration
Outgoing migration still uses a Unix socket and or exec netcat until
the next patch.

* src/qemu/qemu_migration.c (qemuMigrationPrepareTunnel):
Replace Unix socket with simpler pipe.
Suggested by Paolo Bonzini.
2011-03-14 21:57:42 -06:00
e004a8d98e maint: make spacing in .sh files easier
Commit 7f193757 renamed libvirt-guests.init from .in to .sh, which
made it slip past sc_TAB_in_indentation.  I nearly reintroduced a
tab, so I'm pushing this to prevent that from happening.

* cfg.mk (sc_TAB_in_indentation): Update rule to include .sh files.
* .dir-locals.el: List spacing preference for .sh files.
2011-03-14 21:57:42 -06:00
acacced812 qemu: Check the unsigned integer overflow
As perhaps other hypervisor drivers use different capacity units,
do the checking in qemu driver instead of in conf/domain_conf.c.
2011-03-15 11:50:09 +08:00
9bfde34661 Fix performance problem of virStorageVolCreateXMLFrom()
This patch changes zerobuf variable from array to VIR_ALLOC_N().

Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp>
2011-03-14 21:02:17 -06:00
e2d24e8de4 libvirt-guests: avoid globbing when splitting $URIS
* tools/libvirt-guests.init.sh (start, stop, gueststatus): Avoid
shell globbing, since valid URIs can contain '?'.
2011-03-14 15:00:36 -06:00
fff4682965 libvirt-guest.init: quoting variables
At least protect the $uri variable against further expansion by properly
quoting it. While doing that, also quote all other variables to protect
against shell meta characters.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2011-03-14 15:00:35 -06:00
c0c074c3aa docs/formatdomain.html.in: Fix spelling PIC->PCI
Not "Programmable Interrupt Controller" but "Peripheral Component
Interconnect".

Signed-off-by: Philipp Hahn <hahn@univention.de>
2011-03-14 14:54:19 -06:00
7cc101ce0e audit: eliminate potential null pointer deref when auditing macvtap devices
The newly added call to qemuAuditNetDevice in qemuPhysIfaceConnect was
assuming that res_ifname (the name of the macvtap device) was always
valid, but this isn't the case. If openMacvtapTap fails, it always
returns NULL, which would result in a segv.

Since the audit log only needs a record of devices that are actually
sent to qemu, and a failure to open the macvtap device means that no
device will be sent to qemu, we can solve this problem by only doing
the audit if openMacvtapTap is successful (in which case res_ifname is
guaranteed valid).
2011-03-14 12:45:03 -04:00
e6a8f9a16a virsh: Insert error messages to avoid a quiet abortion of commands
in case of incorrect option parsing.
2011-03-14 09:33:55 -06:00
013427e6e7 network driver: don't send default route to clients on isolated networks
Normally dnsmasq will send a default route (the address of the host in
the network definition) to any client requesting an address via
DHCP. On an isolated network this makes no sense, as we have iptables
to prevent any traffic going out via that interface, so anything sent
that way would be dropped anyway.

This extra/unusable default route becomes problematic if you have
setup a guest with multiple network interfaces, with one connected to
an isolated network and another that provides connectivity to the
outside (example - one interface directly connecting to a physical
interface via macvtap, with a second connected to an isolated network
so that the host and guest can communicate (macvtap doesn't support
guest<->host communication without an external switch that supports
vepa, or reflecting all traffic back)). In this case, if the guest
chooses the default route of the isolated network, the guest will not
be able to get network traffic beyond the host.

To prevent dnsmasq from sending a default route, you can tell it to
send 0 bytes of data for the default route option (option number 3)
with --dhcp-option=3 (normally the data to send for the option would
follow the option number; no extra data means "don't send this option").

I have checked on RHEL5 (a good representative of the oldest supported
libvirt platforms) and its version of dnsmasq (2.45) does support
--dhcp-option, so this shouldn't create any compatibility problems.
2011-03-14 08:24:23 -04:00
c51f08272a python: Use hardcoded python path in libvirt.py
This partially reverts (and fixes that part in a different way) commit
e4384459c9, which replaced
``/usr/bin/python'' with ``/usr/bin/env python'' in all examples or
scripts used during build to generate other files.

However, python bindings module is compiled and linked against a
specific python discovered or explicitly provided in configure phase.
Thus libvirt.py, which is generated and installed into the system,
should use the same python binary for which the module has been built.

The hunk in Makefile.am replaces $(srcdir) with $(PYTHON), which might
seem wrong but it is not. generator.py didn't use any of its command
line arguments so passing $(srcdir) to it was redundant.
2011-03-14 12:37:19 +01:00
976eb124e7 virsh: Allow starting domains by UUID 2011-03-14 12:34:39 +01:00
abfa97a225 virsh: Free stream when shutdown console
Otherwise connection of hypervisor driver will be leaked when
one shutdown the guest in console. e.g.

[root@localhost]# init 0
......
init: Re-executing /sbin/init
Halting system...
Power down.

error: Failed to disconnect from the hypervisor, 1 leaked reference(s)
2011-03-14 15:11:03 +08:00
71753cb7f7 Add missing checks for read only connections
As pointed on CVE-2011-1146, some API forgot to check the read-only
status of the connection for entry point which modify the state
of the system or may lead to a remote execution using user data.
The entry points concerned are:
  - virConnectDomainXMLToNative
  - virNodeDeviceDettach
  - virNodeDeviceReAttach
  - virNodeDeviceReset
  - virDomainRevertToSnapshot
  - virDomainSnapshotDelete

* src/libvirt.c: fix the above set of entry points to error on read-only
                 connections
2011-03-14 10:56:28 +08:00
13c00dde31 network driver: Use a separate dhcp leases file for each network
By default, all dnsmasq processes share the same leases file. libvirt
also uses the --dhcp-lease-max option to control the maximum number of
leases allowed. The problem is that libvirt puts in a number equal to
the number of addresses in the range for the one network handled by a
single instance of dnsmasq, but dnsmasq checks the total number of
leases in the file (which could potentially contain many more).

The solution is to tell each instance of dnsmasq to create and use its
own leases file. (/var/lib/libvirt/network/<net-name>.leases).

This file is created by dnsmasq when it starts, but not deleted when
it exists. This is fine when the network is just being stopped, but if
the leases file was left around when a network was undefined, we could
end up with an ever-increasing number of dead files - instead, we
explicitly unlink the leases file when a network is undefined.

Note that Ubuntu carries a patch against an older version of libvirt for this:

hhttps://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/713071
ttp://bazaar.launchpad.net/~serge-hallyn/ubuntu/maverick/libvirt/bugall/revision/109

I was certain I'd also seen discussion of this on libvir-list or
libvirt-users, but couldn't find it.
2011-03-11 23:49:47 -05:00
e368e71040 network driver: Fix indentation from previous commit
The previous commit put a large portion of networkBuildDnsmasqArgv
inside an if { } block. This readjusts the indentation.
2011-03-11 23:49:30 -05:00
7892edc9cc network driver: Start dnsmasq even if no dhcp ranges/hosts are specified.
This fixes a regression introduced in commit ad48df, and reported on
the libvirt-users list:

  https://www.redhat.com/archives/libvirt-users/2011-March/msg00018.html

The problem in that commit was that we began searching a list of ip
address definitions (rather than just having one) to look for a dhcp
range or static host; when we didn't find any, our pointer (ipdef) was
left at NULL, and when ipdef was NULL, we returned without starting up
dnsmasq.

Previously dnsmasq was started even without any dhcp ranges or static
entries, because it's still useful for DNS services.

Another problem I noticed while investigating was that, if there are
IPv6 addresses, but no IPv4 addresses of any kind, we would jump out
at an ever higher level in the call chain.

This patch does the following:

1) networkBuildDnsmasqArgv() = all uses of ipdef are protected from
   NULL dereference. (this patch doesn't change indentation, to make
   review easier. The next patch will change just the
   indentation). ipdef is intended to point to the first IPv4 address
   with DHCP info (or the first IPv4 address if none of them have any
   dhcp info).

2) networkStartDhcpDaemon() = if the loop looking for an ipdef with
   DHCP info comes up empty, we then grab the first IPv4 def from the
   list. Also, instead of returning if there are no IPv4 defs, we just
   return if there are no IP defs at all (either v4 or v6). This way a
   network that is IPv6-only will still get dnsmasq listening for DNS
   queries.

3) in networkStartNetworkDaemon() - we will startup dhcp not just if there
   are any IPv4 addresses, but also if there are any IPv6 addresses.
2011-03-11 23:49:11 -05:00
5cc370aa36 Don't use INT64_MAX in libvirt.h because it requires stdint.h
VIR_DOMAIN_MEMORY_PARAM_UNLIMITED uses INT64_MAX but stdint.h
was not and should not be included. Therefore, libvirt.h was
not self-contained.

Instead of including stdint.h specify the value directly.
2011-03-11 22:08:24 +01:00
2bbda1444d libvirt-guest.init: handle domain name with spaces
awk splits the line on consecutive spaces, which breaks getting the name
of a domain whose name contains spaces. Use sed instead to strip the
"Name:" prefix from the line

Signed-off-by: Philipp Hahn <hahn@univention.de>
2011-03-11 11:24:44 -07:00
a757e60a07 domain.rng vs. formatdomain.html#elementsUSB
The Relax-NG schema for domains regarding <hostdev> doesn't match what's
implemented in src/conf/domain_conf.c#virDomainHostdevDefFormat(): The
implementation only requires @type, but the schema currently either
required none or all three attributes (@mode, @type, and @managed) to be
defined together, because they are declared in the same
<optional)-section. (@managed is currently even undocumented on
<http://libvirt.org/formatdomain.html#elementsUSB>).

Thus the following minimal <hostdev>-example fails to validate:
<domain type='test'>
        <name>N</name>
        <memory>4096</memory>
        <bootloader>/bin/false</bootloader>
        <os>
                <type arch='x86_64' machine='xenpv'>linux</type>
        </os>
        <devices>
                <hostdev type='pci'>
                        <source>
                                <address bus='0x06' slot='0x00' function='0x0'/>
                        </source>
                </hostdev>
        </devices>
</domain>

The schema is changed to match the current implementation:
1. @mode is optional (which defaults to 'subsystem')
2. @type is required
3. @managed is optional (which defaults to 'no')

The documentation is updated to mention @managed.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2011-03-11 10:42:20 -07:00
de6b8a0800 qemu: fix -global argument usage
* src/qemu/qemu_command.c (qemuBuildCommandLine): Pass two
separate arguments, and fix indentation.
2011-03-11 10:11:48 -07:00
bfe87ece0e docs: fix missing </p>
* docs/formatdomain.html.in: Fix typo in last patch.
Reported by Matthias Bolte.
2011-03-11 10:08:24 -07:00
0ed445e79c Ignore backing file errors in FS storage pool
Currently a single storage volume with a broken backing file will disable the
whole storage pool. This can happen when the backing file is on some
unavailable network storage or if the backing volume is deleted, while the
storage volumes using it remain.
Since the storage pool can not be re-activated, re-creating the missing
or deleting the now useless volumes using libvirt only is not possible.

Fixing this is a little bit tricky:
1. virStorageBackendProbeTarget() only detects the missing backing file,
   if the backing file format is not explicitly specified. If the
   backing file is created using
	   kvm-img create -f qcow2 -o backing_fmt=qcow2,backing_file=... ...
   no error is detected at this stage.
   The new return code -3 signals that the backing file could not be
   opened.
2. The backingStore.format must be >= 0, since values < 0 would break
   virStorageVolTargetDefFormat() when dumping the XML data such as
       <format type='...'/>
   Because of this the format is faked as VIR_STORAGE_FILE_RAW.
3. virStorageBackendUpdateVolTargetInfo() always opens the backing file
   and thus always detects a missing backing file.
   Since it "only" updates the capacity, allocation, owner, group, mode
   and SELinux label, just ignore errors at this stage, print an error
   message and continue.
4. Using vol-dump on a broken volume still doesn't work, but at least
   vol-destroy and pool-refresh do work now.

To reproduce:
  dir=$(mktemp -d)
  virsh pool-create-as tmp dir '' '' '' '' "$dir"
  virsh vol-create-as --format qcow2 tmp back 1G
  virsh vol-create-as --format qcow2 --backing-vol-format qcow2 --backing-vol back tmp cow 1G
  virsh vol-delete --pool tmp back
  virsh pool-refresh tmp
After the last step, the pool will be gone (because it was not persistent). As
long as the now broken image stays in the directory, you will not be able to
re-create or re-start the pool.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2011-03-11 09:54:44 -07:00
a067b06e43 documenting the 802.1Qbg parameters of a 'direct' interface
This patchs adds documentation about the 802.1Qbg related parameters
of the virtualport element in a 'direct' interface definition.

Signed-off-by: Gerhard Stenzel <gerhard.stenzel@de.ibm.com>
2011-03-11 09:38:44 -07:00
5f4a48cbdf remote-protocol: implement new BlkioParameters API
Remote protocol implementation of virDomainSetBlkioParameters and virDomainGetBlkioParameters.

Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
2011-03-10 17:54:12 -07:00
17e7556dcf virsh: Adding blkiotune command to virsh tool
Adding blkiotune command to virsh tool

Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
2011-03-10 17:54:08 -07:00
f84a756eca qemu: implement new BlkioParameters API
Implement domainSetBlkioParameters and domainGetBlkioParameters for QEmu

Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
2011-03-10 17:53:52 -07:00
d55aa8694e libvirt: implements virDomain{Get,Set}BlkioParameters
Implements virDomainSetBlkioParameters and virDomainGetBlkioParameters and initialization

Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
2011-03-10 17:53:33 -07:00
13c5282122 libvirt: add virDomain{Get,Set}BlkioParameters
Add virDomainSetBlkioParameters virDomainGetBlkioParameters

Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
2011-03-10 17:53:16 -07:00
2d70a46911 setmem: add the new options to "virsh setmem" command
This patch adds the new options (--live and --config)  to "virsh setmem" command.
The behavior of above options is the same as that of "virsh setvcpus" and so on.
That is, when the --config option is specified, a modification is effective for
the persistent domain. Moreover we can modify the memory size of inactive domains
as well as that of active domains.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
2011-03-10 15:02:58 -07:00
55141abf9d setmem: implement the remote protocol to address the new API
This patch implements the remote protocol to address the new API.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
2011-03-10 15:02:58 -07:00
cad769001c setmem: implement the code to address the new API in the qemu driver
This patch implements the code to address the new API
in the qemu driver.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
2011-03-10 15:02:58 -07:00
e8340a8b79 setmem: introduce a new libvirt API (virDomainSetMemoryFlags)
This patch introduces a new libvirt API (virDomainSetMemoryFlags) and
a flag (virDomainMemoryModFlags).

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
2011-03-10 15:02:58 -07:00
a236732ec3 Make sure we reset the umask on the error path 2011-03-10 22:07:24 +01:00
9516a0eca3 audit: audit use of /dev/net/tun, /dev/tapN, /dev/vhost-net
Opening raw network devices with the intent of passing those fds to
qemu is worth an audit point.  This makes a multi-part audit: first,
we audit the device(s) that libvirt opens on behalf of the MAC address
of a to-be-created interface (which can independently succeed or
fail), then we audit whether qemu actually started the network device
with the same MAC (so searching backwards for successful audits with
the same MAC will show which fd(s) qemu is actually using).  Note that
it is possible for the fd to be successfully opened but no attempt
made to pass the fd to qemu (for example, because intermediate
nwfilter operations failed) - no interface start audit will occur in
that case; so the audit for a successful opened fd does not imply
rights given to qemu unless there is a followup audit about the
attempt to start a new interface.

Likewise, when a network device is hot-unplugged, there is only one
audit message about the MAC being discontinued; again, searching back
to the earlier device open audits will show which fds that qemu quits
using (and yes, I checked via /proc/<qemu-pid>/fd that qemu _does_
close out the fds associated with an interface on hot-unplug).  The
code would require much more refactoring to be able to definitively
state which device(s) were discontinued at that point, since we
currently don't record anywhere in the XML whether /dev/vhost-net was
opened for a given interface.

* src/qemu/qemu_audit.h (qemuAuditNetDevice): New prototype.
* src/qemu/qemu_audit.c (qemuAuditNetDevice): New function.
* src/qemu/qemu_command.h (qemuNetworkIfaceConnect)
(qemuPhysIfaceConnect, qemuOpenVhostNet): Adjust prototype.
* src/qemu/qemu_command.c (qemuNetworkIfaceConnect)
(qemuPhysIfaceConnect, qemuOpenVhostNet): Add audit points and
adjust parameters.
(qemuBuildCommandLine): Adjust caller.
* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
2011-03-10 08:35:42 -07:00
c52cbe487c qemu: don't request cgroup ACL access for /dev/net/tun
Since libvirt always passes /dev/net/tun to qemu via fd, we should
never trigger the cases where qemu tries to directly open the
device.  Therefore, it is safer to deny the cgroup device ACL.

* src/qemu/qemu_cgroup.c (defaultDeviceACL): Remove /dev/net/tun.
* src/qemu/qemu.conf (cgroup_device_acl): Reflect this change.
2011-03-10 08:32:43 -07:00
5d09151341 qemu: support vhost in attach-interface
* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Honor vhost
designations, similar to qemu_command code paths.
* src/qemu/qemu_command.h (qemuOpenVhostNet): New prototype.
* src/qemu/qemu_command.c (qemuOpenVhostNet): Export.
2011-03-10 08:28:16 -07:00
346236fea9 qemu: Stop guest CPUs before creating a snapshot 2011-03-10 14:36:05 +01:00
89e75b01a0 qemu: Refactor qemuDomainSnapshotCreateXML 2011-03-10 14:36:05 +01:00
81711cee34 qemu: Escape snapshot name passed to {save,load,del}vm 2011-03-10 14:36:05 +01:00
89241fe0d1 qemu: Fallback to HMP for snapshot commands
qemu driver in libvirt gained support for creating domain snapshots
almost a year ago in libvirt 0.8.0. Since then we enabled QMP support
for qemu >= 0.13.0 but QMP equivalents of {save,load,del}vm commands are
not implemented in current qemu (0.14.0) so the domain snapshot support
is not very useful.

This patch detects when the appropriate QMP command is not implemented
and tries to use human-monitor-command (aka HMP passthrough) to run
it's HMP equivalent.
2011-03-10 14:36:05 +01:00
b3c6ec03b8 qemu: Rename qemuMonitorCommandWithHandler as qemuMonitorText*
To make it more obvious that it is only used for text monitor. The
naming also matches the style of qemuMonitorTextCommandWithFd.
2011-03-10 14:36:05 +01:00
39b4f4aab2 qemu: Rename qemuMonitorCommand{,WithFd} as qemuMonitorHMP*
So that it's obvious that they are supposed to be used with HMP commands.
2011-03-10 14:36:04 +01:00
266265a560 qemu: Setup infrastructure for HMP passthrough
JSON monitor command implementation can now just directly call text
monitor implementation and it will be automatically encapsulated into
QMP's human-monitor-command.
2011-03-10 14:36:04 +01:00
3b8bf4a3a9 qemu: Fix warnings in event handlers
Some qemu monitor event handlers were issuing inadequate warning when
virDomainSaveStatus() failed. They copied the message from I/O error
handler without customizing it to provide better information on why
virDomainSaveStatus() was called.
2011-03-10 14:18:37 +01:00
d999376954 storage: Update qemu-img flag checking
For newer qemu-img, the help string for "backing file format" is
"[-F backing_fmt]".

Fix the wrong logic error by commit e997c268.

* src/storage/storage_backend.c
2011-03-10 15:02:28 +08:00
e997c268ef qemu: Replace deprecated option of qemu-img
qemu-img silently disable "-e", so we can't use it for volume
encryption anymore, change it into "-o encryption=on" if qemu
supports "-o" option.
2011-03-10 10:05:14 +08:00
340ab27dd2 audit: also audit cgroup ACL permissions
* src/qemu/qemu_audit.h (qemuAuditCgroupMajor)
(qemuAuditCgroupPath): Add parameter.
* src/qemu/qemu_audit.c (qemuAuditCgroupMajor)
(qemuAuditCgroupPath): Add 'acl=rwm' to cgroup audit entries.
* src/qemu/qemu_cgroup.c: Update clients.
* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Likewise.
2011-03-09 11:36:59 -07:00
5564c57528 cgroup: allow fine-tuning of device ACL permissions
Adding audit points showed that we were granting too much privilege
to qemu; it should not need any mknod rights to recreate any
devices.  On the other hand, lxc should have all device privileges.
The solution is adding a flag parameter.

This also lets us restrict write access to read-only disks.

* src/util/cgroup.h (virCgroup*Device*): Adjust prototypes.
* src/util/cgroup.c (virCgroupAllowDevice)
(virCgroupAllowDeviceMajor, virCgroupAllowDevicePath)
(virCgroupDenyDevice, virCgroupDenyDeviceMajor)
(virCgroupDenyDevicePath): Add parameter.
* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Update clients.
* src/lxc/lxc_controller.c (lxcSetContainerResources): Likewise.
* src/qemu/qemu_cgroup.c: Likewise.
(qemuSetupDiskPathAllow): Also, honor read-only disks.
2011-03-09 11:35:36 -07:00
48096a0064 audit: rename remaining qemu audit functions
Also add ATTRIBUTE_NONNULL markers.

* src/qemu/qemu_audit.h: The pattern qemuDomainXXXAudit is
inconsistent; prefer qemuAuditXXX instead.
* src/qemu/qemu_audit.c: Reflect the renames.
* src/qemu/qemu_driver.c: Likewise.
* src/qemu/qemu_hotplug.c: Likewise.
* src/qemu/qemu_migration.c: Likewise.
* src/qemu/qemu_process.c: Likewise.
2011-03-09 11:35:20 -07:00
f2512684ad audit: also audit cgroup controller path
Although the cgroup device ACL controller path can be worked out
by researching the code, it is more efficient to include that
information directly in the audit message.

* src/util/cgroup.h (virCgroupPathOfController): New prototype.
* src/util/cgroup.c (virCgroupPathOfController): Export.
* src/libvirt_private.syms: Likewise.
* src/qemu/qemu_audit.c (qemuAuditCgroup): Use it.
2011-03-09 10:19:17 -07:00
d04916faae audit: split cgroup audit types to allow more information
Device names can be manipulated, so it is better to also log
the major/minor device number corresponding to the cgroup ACL
changes that libvirt made.  This required some refactoring
of the relatively new qemu cgroup audit code.

Also, qemuSetupChardevCgroup was only auditing on failure, not success.

* src/qemu/qemu_audit.h (qemuDomainCgroupAudit): Delete.
(qemuAuditCgroup, qemuAuditCgroupMajor, qemuAuditCgroupPath): New
prototypes.
* src/qemu/qemu_audit.c (qemuDomainCgroupAudit): Rename...
(qemuAuditCgroup): ...and drop a parameter.
(qemuAuditCgroupMajor, qemuAuditCgroupPath): New functions, to
allow listing device major/minor in audit.
(qemuAuditGetRdev): New helper function.
* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Adjust callers.
* src/qemu/qemu_cgroup.c (qemuSetupDiskPathAllow)
(qemuSetupHostUsbDeviceCgroup, qemuSetupCgroup)
(qemuTeardownDiskPathDeny): Likewise.
(qemuSetupChardevCgroup): Likewise, fixing missing audit.
2011-03-09 09:08:10 -07:00
30ad48836e audit: tweak audit messages to match conventions
* src/qemu/qemu_audit.c (qemuDomainHostdevAudit): Avoid use of
"type", which has a pre-defined meaning.
(qemuDomainCgroupAudit): Likewise, as well as "item".
2011-03-09 08:11:31 -07:00
b12a02803e docs: silence warnings about generated API docs
I noticed these while testing 'make dist'.

Parsing ./../src/util/event.c
Function comment for virEventRegisterDefaultImpl lacks description of return value
Function comment for virEventRunDefaultImpl lacks description of return value
Parsing ./../src/util/virterror.c
Missing comment for function virSetErrorLogPriorityFunc

* src/util/event.c (virEventRegisterDefaultImpl)
(virEventRunDefaultImpl): Document return types.
* src/util/virterror.c (virSetErrorLogPriorityFunc): Provide docs.
2011-03-09 08:07:09 -07:00
94a4b6300c docs: document <driver name='vhost'/> for interfaces
* docs/formatdomain.html.in: Document virtio backend selection.
2011-03-09 08:00:11 -07:00
24bfa52e93 Make sure the rundir is accessible by the user
otherwise the user might not have enough permissions to access the
socket if root's umask is 077.

http://bugs.debian.org/614210
2011-03-09 15:40:39 +01:00
9189301426 Don't overwrite virRun error messages
virRun gives pretty useful error output, let's not overwrite it unless there
is a good reason. Some places were providing more information about what
the commands were _attempting_ to do, however that's usually less useful from
a debugging POV than what actually happened.
2011-03-09 08:53:12 -05:00
ae1c5a936c libvirtd: Remove indirect linking
as described at
http://wiki.debian.org/ToolChain/DSOLinking
https://fedoraproject.org/wiki/UnderstandingDSOLinkChange

otherwise the build fails on current Debian unstable with:

CCLD   libvirtd
/usr/bin/ld: ../src/.libs/libvirt_driver_lxc.a(libvirt_driver_lxc_la-lxc_container.o): undefined reference to symbol 'capng_apply'
/usr/bin/ld: note: 'capng_apply' is defined in DSO //usr/lib/libcap-ng.so.0 so try adding it to the linker command line

CCLD   libvirtd
/usr/bin/ld: ../src/.libs/libvirt_driver_storage.a(libvirt_driver_storage_la-storage_backend.o): undefined reference to symbol 'fgetfilecon'
/usr/bin/ld: note: 'fgetfilecon' is defined in DSO //lib/libselinux.so.1 so try adding it to the linker command line
//lib/libselinux.so.1: could not read symbols: Invalid operation

and similar errors.
2011-03-09 13:59:58 +01:00
83d35233a9 Fix a wrong error message thrown to user
* src/qemu/qemu_driver.c: qemuDomainUpdateDeviceFlags() is not disk
  specific as the message suggests
2011-03-09 20:09:25 +08:00
3dfd4ea398 build: avoid compiler warning on cygwin
On cygwin:

  CC       libvirt_driver_security_la-security_dac.lo
security/security_dac.c: In function 'virSecurityDACSetProcessLabel':
security/security_dac.c:618: warning: format '%d' expects type 'int', but argument 7 has type 'uid_t' [-Wformat]

We've done this before (see src/util/util.c).

* src/security/security_dac.c (virSecurityDACSetProcessLabel): On
cygwin, uid_t is a 32-bit long.
2011-03-08 21:56:18 -07:00
b1a5aefcee build: fix build on cygwin
On cygwin:

  CC        libvirt_util_la-cgroup.lo
util/cgroup.c: In function 'virCgroupKillRecursiveInternal':
util/cgroup.c:1458: warning: implicit declaration of function 'virCgroupNew' [-Wimplicit-function-declaration]

* src/util/cgroup.c (virCgroupKill): Don't build on platforms
where virCgroupNew is unsupported.
2011-03-08 21:44:24 -07:00
7e07a40113 build: fix building error when building without libvirtd
When building libvirt without libvirtd, I receive the following errors:
make[1]: Leaving directory `/home/wency/source/test/libvirt/src'
 (cd daemon && make  top_distdir=../libvirt-0.8.8 distdir=../libvirt-0.8.8/daemon \
     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)
make[1]: Entering directory `/home/wency/source/test/libvirt/daemon'
make[1]: *** No rule to make target `libvirtd.8.in', needed by `distdir'.  Stop.

This bug was caused by commit 6db98a2d.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2011-03-08 20:33:48 -07:00
7eca4ea3ac docs: correct range of default NAT subnet
* docs/formatdomain.html.in: Fix typo.
2011-03-08 16:26:26 -07:00
c7cd546b6c virsh: Remove indirect link against libxml2
as described at
http://wiki.debian.org/ToolChain/DSOLinking
https://fedoraproject.org/wiki/UnderstandingDSOLinkChange

otherwise the build fails on current Debian unstable with:

CCLD   virsh
/usr/bin/ld: virsh-virsh.o: undefined reference to symbol 'xmlSaveTree@@LIBXML2_2.6.8'
/usr/bin/ld: note: 'xmlSaveTree@@LIBXML2_2.6.8' is defined in DSO //usr/lib/libxml2.so.2 so try adding it to the linker command line
//usr/lib/libxml2.so.2: could not read symbols: Invalid operation
2011-03-08 21:28:57 +01:00
d03f199595 virsh: Change option parsing functions to return tri-state information
This is needed to detect situations when optional argument was
specified with non-integer value: '--int-opt foo'. To keep functions
uniform vshCommandOptString function was also changed, because it
returns tri-state value as well. Given result pointer is updated only
in case of success. If parsing fails, result is not updated at all.
2011-03-08 13:25:52 -07:00
dc3d60ecd5 virsh: change vshCommandOptString return type and fix const-correctness
This function should return pointer to const, because we don't want
to change command option value. Therefore we can ensure const-correctness.
2011-03-08 13:25:37 -07:00
3cd551053d docs/formatdomain: Add release info for disk <driver> attributes 2011-03-08 13:02:43 -05:00
d299e1d08e Fix build on cygwin
Apparently some signals found on Unix are not exposed, this led
to a compilation failure
* src/util/logging.c: make code related to each signal dependant
  upon the definition of that signal
2011-03-08 16:01:25 +08:00
0e29f71135 support to detach USB disk
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-03-07 11:40:12 -07:00
8f338032b9 rename qemuDomainDetachSCSIDiskDevice to qemuDomainDetachDiskDevice
The way to detach a USB disk is the same as that to detach a SCSI
disk. Rename this function and we can use it to detach a USB disk.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-03-07 11:28:15 -07:00
56a4d8127f qemu_hotplug: Reword error if spice password change not available
Currently it sounds like spice is completely unsupported, which is
confusing.
2011-03-07 13:26:46 -05:00
ac9ee6b5e0 unlock eventLoop before calling callback function
When I use newest libvirt to save a domain, libvirtd will be deadlock.
Here is the output of gdb:
(gdb) thread 3
[Switching to thread 3 (Thread 0x7f972a1fc710 (LWP 30265))]#0  0x000000351fe0e034 in __lll_lock_wait () from /lib64/libpthread.so.0
(gdb) bt
    at qemu/qemu_driver.c:2074
    ret=0x7f972a1fbbe0) at remote.c:2273
(gdb) thread 7
[Switching to thread 7 (Thread 0x7f9730bcd710 (LWP 30261))]#0  0x000000351fe0e034 in __lll_lock_wait () from /lib64/libpthread.so.0
(gdb) bt
(gdb) p *(virMutexPtr)0x6fdd60
$2 = {lock = {__data = {__lock = 2, __count = 0, __owner = 30261, __nusers = 1, __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}},
    __size = "\002\000\000\000\000\000\000\000\065v\000\000\001", '\000' <repeats 26 times>, __align = 2}}
(gdb) p *(virMutexPtr)0x1a63ac0
$3 = {lock = {__data = {__lock = 2, __count = 0, __owner = 30265, __nusers = 1, __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}},
    __size = "\002\000\000\000\000\000\000\000\071v\000\000\001", '\000' <repeats 26 times>, __align = 2}}
(gdb) info threads
  7 Thread 0x7f9730bcd710 (LWP 30261)  0x000000351fe0e034 in __lll_lock_wait () from /lib64/libpthread.so.0
  6 Thread 0x7f972bfff710 (LWP 30262)  0x000000351fe0b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  5 Thread 0x7f972b5fe710 (LWP 30263)  0x000000351fe0b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  4 Thread 0x7f972abfd710 (LWP 30264)  0x000000351fe0b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
* 3 Thread 0x7f972a1fc710 (LWP 30265)  0x000000351fe0e034 in __lll_lock_wait () from /lib64/libpthread.so.0
  2 Thread 0x7f97297fb710 (LWP 30266)  0x000000351fe0b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  1 Thread 0x7f9737aac800 (LWP 30260)  0x000000351fe0803d in pthread_join () from /lib64/libpthread.so.0

The reason is that we will try to lock some object in callback function, and we may call event API with locking the same object.
In the function virEventDispatchHandles(), we unlock eventLoop before calling callback function. I think we should
do the same thing in the function virEventCleanupTimeouts() and virEventCleanupHandles().

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2011-03-07 10:05:17 -07:00
2ed6cc7bec Expose event loop implementation as a public API
Not all applications have an existing event loop they need
to integrate with. Forcing them to implement the libvirt
event loop integration APIs is an undue burden. This just
exposes our simple poll() based implementation for apps
to use. So instead of calling

   virEventRegister(....callbacks...)

The app would call

   virEventRegisterDefaultImpl()

And then have a thread somewhere calling

    static bool quit = false;
    ....
    while (!quit)
      virEventRunDefaultImpl()

* daemon/libvirtd.c, tools/console.c,
  tools/virsh.c: Convert to public event loop APIs
* include/libvirt/libvirt.h.in, src/libvirt_private.syms: Add
  virEventRegisterDefaultImpl and virEventRunDefaultImpl
* src/util/event.c: Implement virEventRegisterDefaultImpl
  and virEventRunDefaultImpl using poll() event loop
* src/util/event_poll.c: Add full error reporting
* src/util/virterror.c, include/libvirt/virterror.h: Add
  VIR_FROM_EVENTS
2011-03-07 14:16:13 +00:00
343eaa150b Move event code out of the daemon/ into src/util/
The event loop implementation is used by more than just the
daemon, so move it into the shared area.

* daemon/event.c, src/util/event_poll.c: Renamed
* daemon/event.h, src/util/event_poll.h: Renamed
* tools/Makefile.am, tools/console.c, tools/virsh.c: Update
  to use new virEventPoll APIs
* daemon/mdns.c, daemon/mdns.c, daemon/Makefile.am: Update
  to use new virEventPoll APIs
2011-03-07 14:16:13 +00:00
5d2c045cd8 Convert daemon/virsh over to use primary event APIs, rather than impl
The daemon code calls virEventAddHandleImpl directly instead
of calling the wrapper virEventAddHandle.

* tools/console.c, daemon/libvirtd.c, daemon/mdns.c: Convert to
  use primary event APIs
2011-03-07 14:16:13 +00:00
bcb40b852c Cleaning up some of the logging code
* src/util/logging.c: fix virLogDumpAllFD() to avoid snprintf, simplify
  the code and provide more useful signal descriptions. Also remove an
  unused variable.
2011-03-07 21:23:53 +08:00
82dfc6f38e qemu: Support vram for video of qxl type
For qemu names the primary vga as "qxl-vga":

  1) if vram is specified for 2nd qxl device:

    -vga qxl -global qxl-vga.vram_size=$SIZE \
    -device qxl,id=video1,vram_size=$SIZE,...

  2) if vram is not specified for 2nd qxl device, (use the default
     set by global):

    -vga qxl -global qxl-vga.vram_size=$SIZE \
    -device qxl,id=video1,...

For qemu names all qxl devices as "qxl":

  1) if vram is specified for 2nd qxl device:

    -vga qxl -global qxl.vram_size=$SIZE \
    -device qxl,id=video1,vram_size=$SIZE ...

  2) if vram is not specified for 2nd qxl device:

    -vga qxl -global qxl-vga.vram_size=$SIZE \
    -device qxl,id=video1,...

"-global" is the only way to define vram_size for the primary qxl
device, regardless of how qemu names it, (It's not good a good
way, as original idea of "-global" is to set a global default for
a driver property, but to specify vram for first qxl device, we
have to use it).

For other qxl devices, as they are represented by "-device", could
specify it directly and seperately for each, and it overrides the
default set by "-global" if specified.

v1 - v2:
  * modify "virDomainVideoDefaultRAM" so that it returns 16M as the
    default vram_size for qxl device.

  * vram_size * 1024 (qemu accepts bytes for vram_size).

  * apply default vram_size for qxl device for which vram_size is
    not specified.

  * modify "graphics-spice" tests (more sensiable vram_size)

  * Add an argument of virDomainDefPtr type for qemuBuildVideoDevStr,
    to use virDomainVideoDefaultRAM in qemuBuildVideoDevStr).

v2 - v3:
  * Modify default video memory size for qxl device from 16M to 24M

  * Update codes to be consistent with changes on qemu_capabilities.*
2011-03-06 22:00:27 +08:00
5a81401235 fixes for several memory leaks
Signed-off-by: Eric Blake <eblake@redhat.com>
2011-03-04 09:52:12 -07:00
a9f35c4863 Dump the debug buffer to libvirtd.log on fatal signal
In case of imminent crash or upon request (signal USR2),
dump the logging buffer to the libvirtd.log file for
post-mortem analysis
* daemon/libvirtd.c: create a sig_fatal() handler connected to
  SIGFPE SIGSEGV SIGILL SIGABRT SIGBUS and SIGUSR2, just dumping
  the log buffer using virLogEmergencyDumpAll
2011-03-04 22:43:55 +08:00
398553c157 Add an an internal API for emergency dump of debug buffer
virLogEmergencyDumpAll() allows to dump the content of the
debug buffer from within a signal handler. It saves to all
log file or stderr if none is found
* src/util/logging.h src/util/logging.c: add the new API
  and cleanup the old virLogDump code
* src/libvirt_private.syms: exports it as a private symbol
2011-03-04 22:43:55 +08:00
35708ec151 Fix a counter bug in the log buffer
* src/util/logging.c: the start pointer need to wrap around too
2011-03-04 22:43:55 +08:00
e7aeed0067 Add logrotate support for libvirtd.log
As the file may grow quite a bit especially with debug turned on.
* daemon/libvirtd.logrotate.in daemon/Makefile.am libvirt.spec.in:
  add new logrotate file for the daemon log
2011-03-04 22:43:55 +08:00
8ddf6d1e4e Change default log policy to libvirtd.log instead of syslog
Syslog is not the best place to go search for libvirt error
logs, change it to a default file output libvirtd.log, but
still keep standard error if not run as a daemon.
Depending on whether it's run as root or user, the log is saved
in the local state dir or in $HOME/.libvirt.
* daemon/libvirtd.c: change default logging to go to libvirtd.log
2011-03-04 22:43:55 +08:00
8b9a1190c1 Force all logs to go to the round robbin memory buffer
Initially only the log actually written out by libvirt were
saved on the memory buffer, this patch forces all informations
including info and debug to be saved in memory too. This is
useful to get full data in case of crash.
2011-03-04 22:43:55 +08:00
f8ac67909d qemu: avoid corruption of domain hashtable and misuse of freed domains
This was also found while investigating

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

An EOF on a domain's monitor socket results in an event being queued
to handle the EOF. The handler calls qemuProcessHandleMonitorEOF. If
it is a transient domain, this leads to a call to
virDomainRemoveInactive, which removes the domain from the driver's
hashtable and unref's it. Nowhere in this code is the qemu driver lock
acquired.

However, all modifications to the driver's domain hashtable *must* be
done while holding the driver lock, otherwise the hashtable can become
corrupt, and (even more likely) another thread could call a different
hashtable function and acquire a pointer to the domain that is in the
process of being destroyed.

To prevent such a disaster, qemuProcessHandleMonitorEOF must get the
qemu driver lock *before* it gets the DomainObj's lock, and hold it
until it is finished with the DomainObj. This guarantees that nobody
else modifies the hashtable at the same time, and that anyone who had
already gotten the DomainObj from the hashtable prior to this call has
finished with it before we remove/destroy it.
2011-03-04 08:13:11 -05:00
e570ca1246 qemu: Add missing lock of virDomainObj before calling virDomainUnref
This was found while researching the root cause of:

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

virDomainUnref should only be called with the lock held for the
virDomainObj in question. However, when a transient qemu domain gets
EOF on its monitor socket, it queues an event which frees the monitor,
which unref's the virDomainObj without first locking it. If another
thread has already locked the virDomainObj, the modification of the
refcount could potentially be corrupted. In an extreme case, it could
also be potentially unlocked by virDomainObjFree, thus left open to
modification by anyone else who would have otherwise waited for the
lock (not to mention the fact that they would be accessing freed
data!).

The solution is to have qemuMonitorFree lock the domain object right
before unrefing it. Since the caller to qemuMonitorFree doesn't expect
this lock to be held, if the refcount doesn't go all the way to 0,
qemuMonitorFree must unlock it after the unref.
2011-03-04 08:12:58 -05:00
65fca8feba AUTHORS: adjust to preferred spelling
maybe sounds strange but I've used this signature for years.
see http://en.wikipedia.org/wiki/Family_name
2011-03-03 17:19:41 -07:00
b31d6c1269 esx: Escape password for XML
Passwords are allowed to contain <, >, &, ', " characters.
Those need to be replaced by the corresponding entities.

Reported by Hereward Cooper.
2011-03-03 22:18:09 +01:00
d152f64760 util: correct retry path in virFileOperation
In virFileOperation, the parent does a fallback to a non-fork
attempt if it detects that the child returned EACCES.  However,
the child was calling _exit(-EACCES), which does _not_ appear
as EACCES in the parent.

* src/util/util.c (virFileOperation): Correctly pass EACCES from
child to parent.
2011-03-03 08:12:08 -07:00
e5f3b90e97 Pass virSecurityManagerPtr to virSecurityDAC{Set, Restore}ChardevCallback
virSecurityDAC{Set,Restore}ChardevCallback expect virSecurityManagerPtr,
but are passed virDomainObjPtr instead. This makes
virSecurityDACSetChardevLabel set a wrong uid/gid on chardevs. This
patch fixes this behaviour.

Signed-off-by: Soren Hansen <soren@linux2go.dk>
2011-03-03 08:08:16 -07:00
9cece6c5a9 maint: update to latest gnulib
* .gnulib: Update to latest, for syntax-check improvement.
* .x-sc_prohibit_empty_lines_at_EOF: Add more exemptions.
2011-03-03 08:04:27 -07:00
3b750d136e maint: avoid long lines in more tests
* tests/xml2sexprdata/*.sexpr: Add backslash-newlines.
* tests/sexpr2xmldata/*.sexpr: Likewise.
* tests/qemuxml2argvdata/qemuxml2argv-disk-aio.args: Likewise.
2011-03-03 07:45:31 -07:00
9677cd33ee util: Allow removing hash entries in virHashForEach
This fixes a possible crash of libvirtd during its startup. When qemu
driver reconnects to running domains, it iterates over all domain
objects in a hash. When reconnecting to an associated qemu monitor
fails and the domain is transient, it's immediately removed from the
hash. Despite the fact that it's explicitly forbidden to do so. If
libvirtd is lucky enough, virHashForEach will access random memory when
the callback finishes and the deamon will crash.

Since it's trivial to fix virHashForEach to allow removal of hash
entries while iterating through them, I went this way instead of fixing
qemuReconnectDomain callback (and possibly others) to avoid deleting the
entries.
2011-03-03 15:22:16 +01:00
d6d30cd4ae Attempt to improve an error message
Replace the 'Unknown failure' error message with something a
little bit more descriptive.

* src/util/virterror.c: Improve error message
2011-03-03 14:17:12 +00:00
4f805dcdc4 qemu: avoid double close on domain restore
qemudDomainSaveImageStartVM was evil - it closed the incoming fd
argument on some, but not all, code paths, without informing the
caller about that action.  No wonder that this resulted in
double-closes: https://bugzilla.redhat.com/show_bug.cgi?id=672725

* src/qemu/qemu_driver.c (qemudDomainSaveImageStartVM): Alter
signature, to avoid double-close.
(qemudDomainRestore, qemudDomainObjRestore): Update callers.
2011-03-02 08:58:49 -07:00
6a8ef183be add additional event debug points
Followup to commit 2222bd24
2011-03-01 16:54:20 -07:00
7c6b22c4d5 qemu: only request sound cgroup ACL when required
When a SPICE or VNC graphics controller is present, and sound is
piggybacked over a channel to the graphics device rather than
directly accessing host hardware, then there is no need to grant
host hardware access to that qemu process.

* src/qemu/qemu_cgroup.c (qemuSetupCgroup): Prevent sound with
spice, and with vnc when vnc_allow_host_audio is 0.
Reported by Daniel Berrange.
2011-02-28 09:42:25 -07:00
3c37a171a2 Add check for kill() to fix build of cgroups on win32
The kill() function doesn't exist on Win32, so it needs to be
checked for at build time & code disabled in cgroups

* configure.ac: Check for kill()
* src/util/cgroup.c: Stub out virCGroupKill* functions
  when kill() isn't available
2011-02-28 14:13:58 +00:00
3ee7cf6c9b Add support for multiple serial ports into the Xen driver
this is the patch to add support for multiple serial ports to the
libvirt Xen driver. It support both old style (serial = "pty") and
new style (serial = [ "/dev/ttyS0", "/dev/ttyS1" ]) definition and
tests for xml2sexpr, sexpr2xml and xmconfig have been added as well.

Written and tested on RHEL-5 Xen dom0 and working as designed but
the Xen version have to have patch for RHBZ #614004 but this patch
is for upstream version of libvirt.

Also, this patch is addressing issue described in RHBZ #670789.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
2011-02-25 11:33:27 -07:00
79c3fe4d16 Fix port value parsing for serial and parallel ports
this is the patch to fix the virDomainChrDefParseTargetXML() functionality
to parse the target port from XML if available. This is necessary for
multiple serial port support which is the second part of this patch.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
2011-02-25 11:33:27 -07:00
33191b419c Add APIs for killing off processes inside a cgroup
The virCgroupKill method kills all PIDs found in a cgroup

The virCgroupKillRecursively method does this recursively
for child cgroups.

The virCgroupKillPainfully method does a recursive kill
several times in a row until everything has really died
2011-02-25 14:21:30 +00:00
16ba2aafc4 Allow hash tables to use generic pointers as keys
Relax the restriction that the hash table key must be a string
by allowing an arbitrary hash code generator + comparison func
to be provided

* util/hash.c, util/hash.h: Allow any pointer as a key
* internal.h: Include stdbool.h as standard.
* conf/domain_conf.c, conf/domain_conf.c,
  conf/nwfilter_params.c, nwfilter/nwfilter_gentech_driver.c,
  nwfilter/nwfilter_gentech_driver.h, nwfilter/nwfilter_learnipaddr.c,
  qemu/qemu_command.c, qemu/qemu_driver.c,
  qemu/qemu_process.c, uml/uml_driver.c,
  xen/xm_internal.c: s/char */void */ in hash callbacks
2011-02-25 13:00:54 +00:00
6952708ca4 Remove deallocator parameter from hash functions
Since the deallocator is passed into the constructor of
a hash table it is not desirable to pass it into each
function again. Remove it from all functions, but provide
a virHashSteal to allow a item to be removed from a hash
table without deleteing it.

* src/util/hash.c, src/util/hash.h: Remove deallocator
  param from all functions. Add virHashSteal
* src/libvirt_private.syms: Add virHashSteal
* src/conf/domain_conf.c, src/conf/nwfilter_params.c,
  src/nwfilter/nwfilter_learnipaddr.c,
  src/qemu/qemu_command.c, src/xen/xm_internal.c: Update
  for changed hash API
2011-02-25 13:00:46 +00:00
f0e9dfeca9 Make commandtest more robust wrt its execution environment
When executed from cron, commandtest would fail to correctly
identify daemon processes. Set session ID and process group
IDs at startup to ensure we have a consistent environment to
run in.

* tests/commandtest.c: Call setsid() and setpgid()
2011-02-25 11:02:08 +00:00
0905d1ee95 Fix spelling mistake: seek
Replace wrong "set" by correct "seek" in error message.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2011-02-24 14:19:15 -07:00
1aaef5ad72 audit: audit qemu pci and usb device passthrough
* src/qemu/qemu_audit.h (qemuDomainHostdevAudit): New prototype.
* src/qemu/qemu_audit.c (qemuDomainHostdevAudit): New function.
(qemuDomainStartAudit): Call as appropriate.
* src/qemu/qemu_hotplug.c (qemuDomainAttachHostPciDevice)
(qemuDomainAttachHostUsbDevice, qemuDomainDetachHostPciDevice)
(qemuDomainDetachHostUsbDevice): Likewise.
2011-02-24 13:32:17 -07:00
e25f2c74df audit: audit qemu memory and vcpu adjusments
* src/qemu/qemu_audit.h (qemuDomainMemoryAudit)
(qemuDomainVcpuAudit): New prototypes.
* src/qemu/qemu_audit.c (qemuDomainResourceAudit)
(qemuDomainMemoryAudit, qemuDomainVcpuAudit): New functions.
(qemuDomainStartAudit): Call as appropriate.
* src/qemu/qemu_driver.c (qemudDomainSetMemory)
(qemudDomainHotplugVcpus): Likewise.
2011-02-24 13:32:17 -07:00
6bb98d419f audit: add qemu hooks for auditing cgroup events
* src/qemu/qemu_audit.h (qemuDomainCgroupAudit): New prototype.
* src/qemu/qemu_audit.c (qemuDomainCgroupAudit): Implement it.
* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Add audit.
* src/qemu/qemu_cgroup.c (qemuSetupDiskPathAllow)
(qemuSetupChardevCgroup, qemuSetupHostUsbDeviceCgroup)
(qemuSetupCgroup, qemuTeardownDiskPathDeny): Likewise.
2011-02-24 13:32:15 -07:00
b4d3434fc2 audit: prepare qemu for listing vm in cgroup audits
* src/qemu/qemu_cgroup.h (struct qemuCgroupData): New helper type.
(qemuSetupDiskPathAllow, qemuSetupChardevCgroup)
(qemuTeardownDiskPathDeny): Drop unneeded prototypes.
(qemuSetupDiskCgroup, qemuTeardownDiskCgroup): Adjust prototype.
* src/qemu/qemu_cgroup.c
(qemuSetupDiskPathAllow, qemuSetupChardevCgroup)
(qemuTeardownDiskPathDeny): Mark static and use new type.
(qemuSetupHostUsbDeviceCgroup): Use new type.
(qemuSetupDiskCgroup): Alter signature.
(qemuSetupCgroup): Adjust caller.
* src/qemu/qemu_hotplug.c (qemuDomainAttachHostUsbDevice)
(qemuDomainDetachPciDiskDevice, qemuDomainDetachSCSIDiskDevice):
Likewise.
* src/qemu/qemu_driver.c (qemudDomainAttachDevice)
(qemuDomainUpdateDeviceFlags): Likewise.
2011-02-24 13:31:05 -07:00
061738764d cgroup: determine when skipping non-devices
* src/util/cgroup.c (virCgroupAllowDevicePath)
(virCgroupDenyDevicePath): Don't fail with EINVAL for
non-devices.
* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Update caller.
* src/qemu/qemu_cgroup.c (qemuSetupDiskPathAllow)
(qemuSetupChardevCgroup, qemuSetupHostUsbDeviceCgroup)
(qemuSetupCgroup, qemuTeardownDiskPathDeny): Likewise.
2011-02-24 13:31:05 -07:00
fd21ecfd49 virExec: avoid uninitialized memory usage
valgrind warns:

==21079== Syscall param rt_sigaction(act->sa_mask) points to uninitialised byte(s)
==21079==    at 0x329840F63E: __libc_sigaction (sigaction.c:67)
==21079==    by 0x4E5A8E7: __virExec (util.c:661)

Regression introduced in commit ab07533e.  Technically, sa_mask
shouldn't affect operation if sa_flags selects sa_handler, and
sa_handler selects SIG_IGN, but better safe than sorry.

* src/util/util.c (__virExec): Supply missing sigemptyset.
2011-02-24 13:12:52 -07:00
4f2094a8a6 Allow 32-on-64 execution for LXC guests
Using the 'personality(2)' system call, we can make a container
on an x86_64 host appear to be i686. Likewise for most other
Linux 64bit arches.

* src/lxc/lxc_conf.c: Fill in 32bit capabilities for x86_64 hosts
* src/lxc/lxc_container.h, src/lxc/lxc_container.c: Add API to
  check if an arch has a 32bit alternative
* src/lxc/lxc_controller.c: Set the process personality when
  starting guest
2011-02-24 12:04:29 +00:00
35416720c2 Put <stdbool.h> into internal.h so it is available everywhere
Remove the <stdbool.h> header from all source files / headers
and just put it into internal.h

* src/internal.h: Add <stdbool.h>
2011-02-24 12:04:06 +00:00
9fc4b6a606 qemu: Switch over command line capabilities to virBitmap
This is done for two reasons:
- we are getting very close to 64 flags which is the maximum we can use
  with unsigned long long
- by using LL constants in enum we already violates C99 constraint that
  enum values have to fit into int
2011-02-24 12:10:00 +01:00
23d935bd97 qemu: Rename qemud\?CmdFlags to qemuCaps
The new name complies more with the fact that it contains a set of
qemuCapsFlags.
2011-02-24 12:08:34 +01:00
a96d08dc53 qemu: Use helper functions for handling cmd line capabilities
Three new functions (qemuCapsSet, qemuCapsClear, and qemuCapsGet) were
introduced replacing direct bit operations.
2011-02-24 12:07:06 +01:00
21642e82b1 qemu: Rename QEMUD_CMD_FLAG_* to QEMU_CAPS_*
The new names comply more with the fact that they are all members of
enum qemuCapsFlags.
2011-02-24 12:05:39 +01:00
40641f2a63 util: Add API for converting virBitmap into printable string 2011-02-24 12:03:04 +01:00
533bee8249 util: Use unsigned long as a base type for virBitmap 2011-02-24 12:00:52 +01:00
6704e3fdb3 Expose name + UUID to LXC containers via env variables
When spawning 'init' in the container, set

  LIBVIRT_LXC_UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
  LIBVIRT_LXC_NAME=YYYYYYYYYYYY

to allow guest software to detect & identify that they
are in a container

* src/lxc/lxc_container.c: Set LIBVIRT_LXC_UUID and
  LIBVIRT_LXC_NAME env vars
2011-02-23 11:41:02 +00:00
449b4c87b5 Fix discard of expected errors
In a couple of commands virsh catches & ignores errors, but fails
to reset last_error. Thus the error is ignored, but still reported
to the user.

* tools/virsh.c: Reset last_error if ignoring an error
2011-02-23 11:11:55 +00:00
9f5bbe3b92 Fix off-by-1 in virFileAbsPath.
The virFileAbsPath was not taking into account the '/' directory
separator when allocating memory for combining cwd + path. Convert
to use virAsprintf to avoid this type of bug completely.

* src/util/util.c: Convert virFileAbsPath to use virAsprintf
2011-02-23 11:11:45 +00:00
08fb2a9ce8 Fix group/mode for /dev/pts inside LXC container
Normal practice for /dev/pts is to have it mode=620,gid=5
but LXC was leaving mode=000,gid=0 preventing unprivilegd
users in the guest use of PTYs

* src/lxc/lxc_controller.c: Fix /dev/pts setup
2011-02-23 11:11:35 +00:00
009fce98be security: avoid memory leak
Leak introduced in commit d6623003.

* src/qemu/qemu_driver.c (qemuSecurityInit): Avoid leak on failure.
* src/security/security_stack.c (virSecurityStackClose): Avoid
leaking component drivers.
2011-02-22 09:50:34 -07:00
dfd39ccda8 802.1Qbh: Delay IFF_UP'ing interface until migration final stage
Current code does an IFF_UP on a 8021Qbh interface immediately after a port
profile set. This is ok in most cases except when its the migration prepare
stage. During migration we want to postpone IFF_UP'ing the interface on the
destination host until the source host has disassociated the interface.
This patch moves IFF_UP of the interface to the final stage of migration.
The motivation for this change is to postpone any addr registrations on the
destination host until the source host has done the addr deregistrations.

While at it, for symmetry with associate move ifDown of a 8021Qbh interface
to before disassociate
2011-02-22 07:48:54 -05:00
9f928af12b storage: make debug log more useful
"__func__" is useless there, as VIR_DEBUG will print the function
name.

* src/storage/storage_backend_mpath.c
2011-02-22 10:10:31 +08:00
8fcc76a6e2 virsh: replace vshPrint with vshPrintExtra for snapshot list
Otherwise extra information will be printed even if "--quiet"
is specified.

* tools/virsh.c
2011-02-22 10:06:08 +08:00
606d63054c check device-mapper when building with mpath or disk storage driver
Currently, we need virIsDevMapperDevice() when we build libvirt with
disk or mpath storage drivers.  So we should check device-mapper-devel
when we build with disk storage driver but without mpath storage
driver.
2011-02-21 15:17:12 -07:00
e57f834547 build: add dependency on gnutls-utils
* libvirt.spec.in (Requires): Add gnutls-utils, for virt-pki-validate.
Suggested by Daniel P. Berrange.
2011-02-21 11:18:35 -07:00
3e53c7f954 Renamed functions in xenxs 2011-02-21 11:15:08 -07:00
2e69e66e38 Moved XM formatting functions to xenxs 2011-02-21 11:14:52 -07:00
1556ced2de Moved XM parsing functions to xenxs 2011-02-21 11:11:22 -07:00
2f2a88b998 Moved SEXPR formatting functions to xenxs 2011-02-21 11:07:43 -07:00
07129039cc Moved SEXPR parsing functions to xenxs 2011-02-21 10:53:53 -07:00
c71328b9aa Moved some SEXPR functions from xen-unified 2011-02-21 10:50:18 -07:00
8606ca0d0b Moved SEXPR unit to utils 2011-02-21 10:48:02 -07:00
cf61114cee protect the scsi controller to be deleted when it is in use
Steps to reproduce this bug:
1. virsh attach-disk domain --source imagefile --target sdb --sourcetype file --driver qemu --subdriver raw
2. virsh detach-device controller.xml # remove scsi controller 0
3. virsh detach-disk domain sdb
   error: Failed to detach disk
   error: operation failed: detaching scsi0-0-1 device failed: Device 'scsi0-0-1' not found

I think we should not detach a controller when it is used by some other device.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-02-21 10:38:19 -07:00
f409661e71 maint: fix grammar in error message
* python/tests/create.py: Use correct wording.
2011-02-21 10:35:25 -07:00
b3ff07a07d virt-*-validate.in: quote all variable references
Alas, the shell is not a real programming language.

Patch generated by manual confirmation of vim's
s/[^"]\@<=\$\S\+\s\@=/"&"/gc
and
s/\(echo \)\@<=[^"].*\$.*$/"&"/c matches.

This patch generate a lot of noise and carries little benefits, as
I do not really expect $PKI to contain spaces or backticks. I'm just
fuming, and would not really mind if this patch is ignored
2011-02-21 10:32:34 -07:00
9b47915914 virt-pki-validate: behave when CERTTOOL is missing 2011-02-21 10:28:01 -07:00
ec28eb29b7 autobuild.sh: use VPATH build
Try to avoid future regressions on the VPATH front.

* autobuild.sh: Uncomment VPATH use.
* .gitignore: Exclude build directory.
2011-02-21 09:27:05 -07:00
7e1dd7e090 maint: fix 'make dist' in VPATH build
A diff of 'make dist' from in-tree vs. a VPATH build showed
that we were missing docs/api_extension/*.patch files, but
shipping other files that we didn't need.

* bootstrap.conf (gnulib_extra_files): Don't distribute files we
don't care about.
* docs/Makefile.am (patches): Perform wildcard correctly.
2011-02-21 09:27:05 -07:00
6db98a2d4b build: don't require pod2man for tarball builds
Right now, 'man libvirtd' includes information that depends on
configure results, so it must be generated on the fly and live
in $(builddir); however, requiring pod2man on all end user
machines is overkill.  Meanwhile, 'man virsh' doesn't mention
any configure results, so it can be built at 'make dist' time.
If that situation changes in the future, we can generate virsh.1
in the same way that we generate libvirtd.8.

* daemon/Makefile.am (libvirtd.8.in): New rule, to run pod2man in
advance of distribution.
(libvirtd.8): Use only sed from tarball.
(EXTRA_DIST): Ship new file.
(libvirtd.pod): Delete unused rule.
(man8_MANS): Let automake know which section to use.
(CLEANFILES, MAINTAINERCLEANFILES): Adjust to new files.
* tools/Makefile.am (dist_man1_MANS): Distribute pre-built man
pages, fine since they don't require any substitution.
(virt-xml-validate.1, virt-pki-validate.1): Change input source.
(virsh.1): Build into srcdir.
(CLEANFILES, MAINTAINERCLEANFILES): Adjust to new build style.
* daemon/.gitignore: Update.
Reported by Diego Elio Pettenò.
2011-02-21 09:27:05 -07:00
994e7567b6 maint: kill all remaining uses of old DEBUG macro
Done mechanically with:
$ git grep -l '\bDEBUG0\? *(' | xargs -L1 sed -i 's/\bDEBUG0\? *(/VIR_&/'

followed by manual deletion of qemudDebug in daemon/libvirtd.c, along
with a single 'make syntax-check' fallout in the same file, and the
actual deletion in src/util/logging.h.

* src/util/logging.h (DEBUG, DEBUG0): Delete.
* daemon/libvirtd.h (qemudDebug): Likewise.
* global: Change remaining clients over to VIR_DEBUG counterpart.
2011-02-21 08:46:52 -07:00
03ba07cb73 hash: make virHashFree more free-like
Two-argument free functions are uncommon; match the style elsewhere
by caching the callback at creation.

* src/util/hash.h (virHashCreate, virHashFree): Move deallocator
argument to creation.
* cfg.mk (useless_free_options): Add virHashFree.
* src/util/hash.c (_virHashTable): Track deallocator.
(virHashCreate, virHashFree): Update to new signature.
* src/conf/domain_conf.c (virDomainObjListDeinit)
(virDomainObjListInit, virDomainDiskDefForeachPath)
(virDomainSnapshotObjListDeinit, virDomainSnapshotObjListInit):
Update callers.
* src/conf/nwfilter_params.c (virNWFilterHashTableFree)
(virNWFilterHashTableCreate): Likewise.
* src/conf/nwfilter_conf.c (virNWFilterTriggerVMFilterRebuild):
Likewise.
* src/cpu/cpu_generic.c (genericHashFeatures, genericBaseline):
Likewise.
* src/xen/xm_internal.c (xenXMOpen, xenXMClose): Likewise.
* src/nwfilter/nwfilter_learnipaddr.c (virNWFilterLearnInit)
(virNWFilterLearnShutdown): Likewise.
* src/qemu/qemu_command.c (qemuDomainPCIAddressSetCreate)
(qemuDomainPCIAddressSetFree): Likewise.
* src/qemu/qemu_process.c (qemuProcessWaitForMonitor): Likewise.
2011-02-21 08:27:02 -07:00
6e9f3dfa0c build: Fix API docs generation in VPATH build
XSLT allows for two ways of generating the output of transformation.
Either implicit, which xsltproc prints to stdout and can be redirected
to a file using -o file. Or explicit, which means the stylesheet
contains <xsl:document> element which specifies where the output should
be saved. This can be used for generating more files by a single run of
xsltproc and -o directory/ can change the directory where the output
files will be stored.

devhelp.xsl is special in that it combines both options in one
stylesheet, which doesn't work well with -o:

xsltproc --nonet -o ./devhelp/ ./devhelp/devhelp.xsl ./libvirt-api.xml

Outputs 4 *.html files into ./devhelp but then tries to write to
./devhelp/ as a file (hence the I/O error) rather than writing output to
the fifth file devhelp/libvirt.devhelp.

This patch modifies devhelp.xsl so that all files are generated using
<xsl:document> element and -o directory/ can be used to override output
directory where those files are saved.
2011-02-21 14:46:23 +01:00
2ff4c13754 Remove all object hashtable caches from virConnectPtr
The virConnectPtr struct will cache instances of all other
objects. APIs like virDomainLookupByUUID will return a
cached object, so if you do virDomainLookupByUUID twice in
a row, you'll get the same exact virDomainPtr instance.

This does not have any performance benefit, since the actual
logic in virDomainLookupByUUID (and other APIs returning
virDomainPtr, etc instances) is not short-circuited. All
it does is to ensure there is only one single virDomainPtr
in existance for any given UUID.

The caching has a number of downsides though, all relating
to stale data. If APIs aren't careful to always overwrite
the 'id' field in virDomainPtr it may become out of data.
Likewise for the name field, if a guest is renamed, or if
a guest is deleted, and then a new one created with the
same UUID but different name.

This has been an ongoing, endless source of bugs for all
applications using libvirt from languages with garbage
collection, causing them to get virDomainPtr instances
from long ago with stale data.

The caching is also a waste of memory resources, since
both applications, and language bindings often maintain
their own hashtable caches of object instances.

This patch removes all the hash table caching, so all
APIs return brand new virDomainPtr (etc) object instances.

* src/datatypes.h: Delete all hash tables.
* src/datatypes.c: Remove all object caching code
2011-02-21 11:50:46 +00:00
912d170f87 nwfilter: enable rejection of packets
This patch adds the possibility to not just drop packets, but to also have them rejected where iptables at least sends an ICMP msg back to the originator. On ebtables this again maps into dropping packets since rejecting is not supported.

I am adding 'since 0.8.9' to the docs assuming this will be the next version of libvirt.
2011-02-18 20:13:40 -05:00
acab8a97ce Drop empty argument from dnsmasq call
since dnsmasq >= 2.56 now bails out with empty arguments. See
    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=613944
for the Debian bug and
    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=589885
for the upstream reasoning.
2011-02-18 22:23:15 +01:00
7b6286b780 build: fix broken mingw cross-compilation
Two regressions:
Commit df1011ca broke builds for systems that lack devmapper
(non-Linux, as well as Linux with ./autogen.sh --without-libvirtd
and without the libraries present).
Commit ce6fd650 broke cross-compilation, due to a gnulib bug.

* .gnulib: Update to latest, for cross-compilation fix.
* src/util/util.c (virIsDevMapperDevice): Provide stub for
platforms not using storage driver.
* configure.ac (devmapper): Arrange to define HAVE_LIBDEVMAPPER_H.
devmapper issue reported by Wen Congyang.
2011-02-18 12:02:22 -07:00
791da4e736 esx: Ignore malformed host UUID from BIOS
Etienne Gosset reported that libvirt fails to connect to his ESX
server because it failed to parse its malformed host UUID, that
contains an additional space and lacks one hexdigit in the last
group:

xxxxxxxx-xxxx-xxxx-xxxx- xxxxxxxxxxx

Don't treat this as a fatal error, just ignore it.
2011-02-18 17:59:05 +01:00
595174aeb7 virsh: freecell --all getting wrong NUMA nodes count
Virsh freecell --all was not only getting wrong NUMA nodes count, but
even the NUMA nodes IDs. They doesn't have to be continuous, as I've
found out during testing this. Therefore a modification of
nodeGetCellsFreeMemory() error message.
2011-02-18 09:26:40 -07:00
1c07233436 build: speed up non-maintainer builds
* configure.ac (gl_ASSERT_NO_GNULIB_POSIXCHECK): Use to reduce
time spent in configure.
2011-02-18 09:04:22 -07:00
053013b0da build: recompute symbols after changing configure options
$ ./configure
...
$ make
...
  GEN    libvirt.syms
...
$ ./configure --with-driver-modules
...
$ make
...

libvirt.syms doesn't get regenerated but it should as it should
contain virDriverLoadModule now.

* src/Makefile.am (libvirt.syms): Depend on configure changes.
Reported by Matthias Bolte.
2011-02-18 08:58:36 -07:00
15285754dd maint: Expand tabs in python code
Also cfg.mk is tweaked to force this for all future changes to *.py
files.
2011-02-18 08:59:51 +01:00
39164c11d3 Requires gettext for client package
libvirt-guests invokes functions in gettext.sh, so we need to
require gettext package in spec file.

Demo with the fix:
% rpm -q gettext
package gettext is not installed

% rpm -ivh libvirt-client-0.8.8-1.fc14.x86_64.rpm
error: Failed dependencies:
	gettext is needed by libvirt-client-0.8.8-1.fc14.x86_64

* libvirt.spec.in
2011-02-18 13:45:13 +08:00
efc2594b4e Do not add drive 'boot=on' param when a kernel is specified
libvirt-tck was failing several domain tests [1] with qemu 0.14, which
is now less tolerable of specifying 2 bootroms with the same boot index [2].

Drop the 'boot=on' param if kernel has been specfied.

[1] https://www.redhat.com/archives/libvir-list/2011-February/msg00559.html
[2] http://lists.nongnu.org/archive/html/qemu-devel/2011-02/msg01892.html
2011-02-17 20:32:48 -07:00
50daaa0a3e remove duplicated call to reportOOMError 2011-02-17 17:12:23 -07:00
787e38890e remove space between function name and (
There were several occurrences of an extra space inserted between
a function name and the ( opening the argument list in
datatypes.c. This is not consistent with the coding style used in
the rest of this file so removing this extra space makes the
code slightly more readable.
2011-02-17 17:10:27 -07:00
7b9a509953 don't check for NULL before calling virHashFree
virHashFree follows the convention described in HACKING that
XXXFree() functions can be called with a NULL argument.
2011-02-17 17:02:32 -07:00
9905c69e4f remove no longer needed calls to virReportOOMError
Now that the virHash handling functions call virReportOOMError by
themselves when needed, users of the virHash API no longer need to
do it by themselves. Since users of the virHash API were not
consistently calling virReportOOMError after memory failures from
the virHash code, this has the added benefit of making OOM
reporting from this code more consistent and reliable.
2011-02-17 16:59:14 -07:00
7f1c65e551 factor common code in virHashAddEntry and virHashUpdateEntry
The only difference between these 2 functions is that one errors
out when the entry is already present while the other modifies
the existing entry. Add an helper function with a boolean argument
indicating whether existing entries should be updated or not, and
use this helper in both functions.
2011-02-17 16:46:54 -07:00
5c5880e047 add hash table rebalancing in virHashUpdateEntry
The code in virHashUpdateEntry and virHashAddEntry is really
similar. However, the latter rebalances the hash table when
one of its buckets contains too many elements while the former
does not. Fix this discrepancy.
2011-02-17 16:45:25 -07:00
aebe04d75e hash: modernize debug code
* src/util/hash.c (virHashGrow) [DEBUG_GROW]: Use modern logging.
Reported by Christophe Fergeau.
2011-02-17 16:33:12 -07:00
31d094cacd build: improve 'make install' for VPATH builds
This still doesn't fix {html,devhelp}/libvirt-{libvirt-virterror}.html,
but it's progress in the right direction.

* docs/Makefile.am (%.html): Build into srcdir.
2011-02-17 15:15:34 -07:00
34c13d0d1a check more error info about whether drive_add failed
When we attach a disk, but we specify a wrong format of disk image,
qemu monitor command drive_add will fail, but libvirt does not detect
this error.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-02-17 14:10:26 -07:00
bb904f45ff logging: make VIR_ERROR and friends preserve errno
Followup to commit 17e19add, and would have prevented the bug
independently fixed in commit 76c57a7c.

* src/util/logging.c (virLogMessage): Preserve errno, since
logging should be as unintrusive as possible.
2011-02-17 14:03:11 -07:00
ce6fd65088 maint: avoid 'make syntax-check' from tarball
* .gnulib: update to latest gnulib for maint.mk fixes
2011-02-17 13:26:48 -07:00
5754dbd56d Give each virtual network bridge its own fixed MAC address
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=609463

The problem was that, since a bridge always acquires the MAC address
of the connected interface with the numerically lowest MAC, as guests
are started and stopped, it was possible for the MAC address to change
over time, and this change in the network was being detected by
Windows 7 (it sees the MAC of the default route change), so on each
reboot it would bring up a dialog box asking about this "new network".

The solution is to create a dummy tap interface with a MAC guaranteed
to be lower than any guest interface's MAC, and attach that tap to the
bridge as soon as it's created. Since all guest MAC addresses start
with 0xFE, we can just generate a MAC with the standard "0x52, 0x54,
0" prefix, and it's guaranteed to always win (physical interfaces are
never connected to these bridges, so we don't need to worry about
competing numerically with them).

Note that the dummy tap is never set to IFF_UP state - that's not
necessary in order for the bridge to take its MAC, and not setting it
to UP eliminates the clutter of having an (eg) "virbr0-nic" displayed
in the output of the ifconfig command.

I chose to not auto-generate the MAC address in the network XML
parser, as there are likely to be consumers of that API that don't
need or want to have a MAC address associated with the
bridge.

Instead, in bridge_driver.c when the network is being defined, if
there is no MAC, one is generated. To account for virtual network
configs that already exist when upgrading from an older version of
libvirt, I've added a %post script to the specfile that searches for
all network definitions in both the config directory
(/etc/libvirt/qemu/networks) and the state directory
(/var/lib/libvirt/network) that are missing a mac address, generates a
random address, and adds it to the config (and a matching address to
the state file, if there is one).

docs/formatnetwork.html.in: document <mac address.../>
docs/schemas/network.rng: add nac address to schema
libvirt.spec.in: %post script to update existing networks
src/conf/network_conf.[ch]: parse and format <mac address.../>
src/libvirt_private.syms: export a couple private symbols we need
src/network/bridge_driver.c:
    auto-generate mac address when needed,
    create dummy interface if mac address is present.
tests/networkxml2xmlin/isolated-network.xml
tests/networkxml2xmlin/routed-network.xml
tests/networkxml2xmlout/isolated-network.xml
tests/networkxml2xmlout/routed-network.xml: add mac address to some tests
2011-02-17 13:36:32 -05:00
13ae7a02b3 Allow brAddTap to create a tap device that is down
An upcoming patch has a use for a tap device to be created that
doesn't need to be actually put into the "up" state, and keeping it
"down" keeps the output of ifconfig from being unnecessarily cluttered
(ifconfig won't show down interfaces unless you add "-a").

bridge.[ch]: add "up" as an arg to brAddTap()
uml_conf.c, qemu_command.c: add "up" (set to "true") to brAddTap() call.
2011-02-17 13:36:22 -05:00
e9bd5c0e24 Add txmode attribute to interface XML for virtio backend
This is in response to:

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

Explanation

qemu's virtio-net-pci driver allows setting the algorithm used for tx
packets to either "bh" or "timer". This is done by adding ",tx=bh" or
",tx=timer" to the "-device virtio-net-pci" commandline option.

'bh' stands for 'bottom half'; when this is set, packet tx is all done
in an iothread in the bottom half of the driver. (In libvirt, this
option is called the more descriptive "iothread".)

'timer' means that tx work is done in qemu, and if there is more tx
data than can be sent at the present time, a timer is set before qemu
moves on to do other things; when the timer fires, another attempt is
made to send more data. (libvirt retains the name "timer" for this
option.)

The resulting difference, according to the qemu developer who added
the option is:

    bh makes tx more asynchronous and reduces latency, but potentially
    causes more processor bandwidth contention since the cpu doing the
    tx isn't necessarily the cpu where the guest generated the
    packets.

Solution

This patch provides a libvirt domain xml knob to change the option on
the qemu commandline, by adding a new attribute "txmode" to the
<driver> element that can be placed inside any <interface> element in
a domain definition. It's use would be something like this:

    <interface ...>
      ...
      <model type='virtio'/>
      <driver txmode='iothread'/>
      ...
    </interface>

I chose to put this setting as an attribute to <driver> rather than as
a sub-element to <tune> because it is specific to the virtio-net
driver, not something that is generally usable by all network drivers.
(note that this is the same placement as the "driver name=..."
attribute used to choose kernel vs. userland backend for the
virtio-net driver.)

Actually adding the tx=xxx option to the qemu commandline is only done
if the version of qemu being used advertises it in the output of

    qemu -device virtio-net-pci,?

If a particular txmode is requested in the XML, and the option isn't
listed in that help output, an UNSUPPORTED_CONFIG error is logged, and
the domain fails to start.
2011-02-17 11:07:58 -05:00
b670a41206 Restructure domain struct interface "driver" data for easier expansion
When the <driver> element (and its "name" attribute) was added to the
domain XML's interface element, a "backend" enum was simply added to
the toplevel of the virDomainNetDef struct.

Ignoring the naming inconsistency ("name" vs. "backend"), this is fine
when there's only a single item contained in the driver element of the
XML, but doesn't scale well as we add more attributes that apply to
the backend of the virtio-net driver, or add attributes applicable to
other drivers.

This patch changes virDomainNetDef in two ways:

1) Rename the item in the struct from "backend" to "name", so that
   it's the same in the XML and in the struct, hopefully avoiding
   confusion for someone unfamiliar with the function of the
   attribute.

2) Create a "driver" union within virDomainNetDef, and a "virtio"
   struct in that struct, which contains the "name" enum value.

3) Move around the virDomainNetParse and virDomainNetFormat functions
   to allow for simple plugin of new attributes without disturbing
   existing code. (you'll note that this results in a seemingly
   redundant if() in the format function, but that will no longer be
   the case as soon as a 2nd attribute is added).

In the future, new attributes for the virtio driver backend can be
added to the "virtio" struct, and any other network device backend that
needs an attribute will have its own struct added to the "driver"
union.
2011-02-17 11:07:45 -05:00
85e601f8a5 build: Fix VPATH build
Even VPATH make dist succeeds now
2011-02-17 14:11:24 +01:00
766de43533 Move all the QEMU migration code to a new file
The introduction of the v3 migration protocol, along with
support for migration cookies, will significantly expand
the size of the migration code. Move it all to a separate
file to make it more manageable

The functions are not moved 100%. The API entry points
remain in the main QEMU driver, but once the public
virDomainPtr is resolved to the internal virDomainObjPtr,
all following code is moved.

This will allow the new v3 API entry points to call into the
same shared internal migration functions

* src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Add
  qemuDomainFormatXML helper method
* src/qemu/qemu_driver.c: Remove all migration code
* src/qemu/qemu_migration.c, src/qemu/qemu_migration.h: Add
  all migration code.
2011-02-17 12:56:10 +00:00
48c2d6c65b Split all QEMU process mangement code into separate file
Move the qemudStartVMDaemon and qemudShutdownVMDaemon
methods into a separate file, renaming them to
qemuProcessStart, qemuProcessStop. All helper methods
called by these are also moved & renamed to match

* src/Makefile.am: Add qemu_process.c/.h
* src/qemu/qemu_command.c: Add qemuDomainAssignPCIAddresses
* src/qemu/qemu_command.h: Add VNC port min/max
* src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Add
  domain event queue helpers
* src/qemu/qemu_driver.c, src/qemu/qemu_driver.h: Remove
  all QEMU process startup/shutdown functions
* src/qemu/qemu_process.c, src/qemu/qemu_process.h: Add
  all QEMU process startup/shutdown functions
2011-02-17 12:48:55 +00:00
df1011ca8e storage: Allow to delete device mapper disk partition
The name convention of device mapper disk is different, and 'parted'
can't be used to delete a device mapper disk partition. e.g.

Name                 Path
-----------------------------------------
3600a0b80005ad1d7000093604cae912fp1 /dev/mapper/3600a0b80005ad1d7000093604cae912fp1

Error: Expecting a partition number.

This patch introduces 'dmsetup' to fix it.

Changes:
  - New function "virIsDevMapperDevice" in "src/utils/utils.c"
  - remove "is_dm_device" in "src/storage/parthelper.c", use
    "virIsDevMapperDevice" instead.
  - Requires "device-mapper" for 'with-storage-disk" in "libvirt.spec.in"
  - Check "dmsetup" in 'configure.ac' for "with-storage-disk"
  - Changes on "src/Makefile.am" to link against libdevmapper
  - New entry for "virIsDevMapperDevice" in "src/libvirt_private.syms"

Changes from v1 to v3:
  - s/virIsDeviceMapperDevice/virIsDevMapperDevice/g
  - replace "virRun" with "virCommand"
  - sort the list of util functions in "libvirt_private.syms"
  - ATTRIBUTE_NONNULL(1) for virIsDevMapperDevice declaration.

e.g.

Name                 Path
-----------------------------------------
3600a0b80005ad1d7000093604cae912fp1 /dev/mapper/3600a0b80005ad1d7000093604cae912fp1

Vol /dev/mapper/3600a0b80005ad1d7000093604cae912fp1 deleted

Name                 Path
-----------------------------------------
2011-02-17 15:29:07 +08:00
43f8773c1f Release of libvirt-0.8.8
* configure.ac docs/news.html.in libvirt.spec.in: bump version and add docs
* po/*.po*: updated Gujarati, Polish and Dutch localisations and regenerated
2011-02-17 12:11:03 +08:00
cd951ad2ec qemu: Error prompt when saving a shutoff domain
"qemudDomainSaveFlag" goto wrong label "endjob", which will cause
error when security manager trying to restore label (regression).

As it's more reasonable to check if vm is shutoff immediately, and
return right away if it is, remove the checking in "qemudDomainSaveFlag",
and add checking in "qemudDomainSave".

* src/qemu/qemu_driver.c
2011-02-17 11:18:47 +08:00
51ff630fdc maint: delete unused 'make install' step
Libxml2-Logo-90x34.gif was removed from the repository in Sep 2009
(commit d6d528c) because our docs no longer reference it.

* docs/Makefile.am (install-data-local): Don't install missing file.
2011-02-16 10:21:21 -07:00
76c57a7c1d cgroup: preserve correct errno on failure
* src/util/cgroup.c (virCgroupSetValueStr, virCgroupGetValueStr)
(virCgroupRemoveRecursively): VIR_DEBUG can clobber errno.
(virCgroupRemove): Use VIR_DEBUG rather than DEBUG.
2011-02-16 08:10:30 -07:00
00c9cf50c6 Update czech localization 2011-02-16 21:40:44 +08:00
453d05dab9 qemu: Fix command line generation with faked host CPU
The code expected that host CPU architecture matches the architecture on
which libvirt runs. This is normally true but not in tests, where host
CPU is faked to produce consistent results.
2011-02-15 22:51:50 +01:00
aa3b2e40f5 tests: Fake host capabilities properly
Since we fake host CPU we should also fake host arch instead of taking
the real architecture tests are running on.
2011-02-15 22:51:37 +01:00
c106a83712 docs: fix typos
* docs/drvopenvz.html.in: Spell administrator correctly.
* docs/drvuml.html.in: Likewise.
* src/qemu/qemu.conf: Likewise.  Fix other typos, too.
2011-02-15 13:50:28 -07:00
251ad3b28b Avoid empty strings when --with-packager(-version) is not specified
Make with_packager and with_packager_version default to "no". This way
--without-packager-version (as shorthand for --with-packager(-version)=no)
works correctly too.

Prior to this patch libvirt outputs a line like this when
--with-packager(-version) was not specified

# ./daemon/libvirtd
14:11:15.018: 31796: info : libvirt version: 0.8.8, package:  ()

Now the unspecified parts are correctly omitted.

Reported by Osier Yang.
2011-02-15 19:48:44 +01:00
3db08aeaef build: address clang reports about virCommand
clang had 5 reports against virCommand; three were false positives
(a NULL deref in ProcessIO solved by sa_assert, and two uninitialized
memory operations solved by adding an initializer), but two were real.

* src/util/command.c (virCommandProcessIO): Fix real bug of
possible NULL dereference.  Teach clang that buf is never NULL.
(virCommandRun): Teach clang that infd is only ever accessed when
initialized.
2011-02-15 10:43:40 -07:00
1a82c5f7c6 build: silence some clang warnings
* tools/virsh.c (cmdHelp): Kill dead variables.
2011-02-15 10:43:40 -07:00
56152be578 qemu: don't mask real error with oom report
* src/qemu/qemu_command.c (qemuBuildCommandLine): Don't report oom
after qemuBuildControllerDevStr, which reported its own errors.
2011-02-15 10:43:39 -07:00
abaa65605f qemu: avoid NULL derefs
The processWatchdogEvent fix is real, although it can only trigger
on OOM, since bad things happen if doCoreDump is called with a NULL
pathname argument.  The other fixes silence clang, but aren't a real
bug because virReportErrorHelper tolerates a NULL format string even
though *printf does not.

* src/qemu/qemu_driver.c (processWatchdogEvent): Exit on OOM.
(qemuDomainIsActive, qemuDomainIsPersistent, qemuDomainIsUpdated):
Provide valid message.
2011-02-15 09:55:45 -07:00
ae891f956e virDomainMemoryStats: avoid null dereference
* src/libvirt.c (virDomainMemoryStats): Check domain before flags.
2011-02-15 09:43:05 -07:00
0fae440618 docs: added link for nimbus to apps page 2011-02-16 00:16:09 +11:00
dd50c0054c Fix leak of mutex attributes in POSIX threads impl
* src/util/threads-pthread.c: Fix mutex leak
2011-02-15 11:42:32 +00:00
7020ffc0ed Fix leak in SCSI storage backend
The SCSI storage backend leaks a string containing the pathname
for each block device it discovers

* src/storage/storage_backend_scsi.c: Free the device name
2011-02-15 11:41:48 +00:00
c7a6fc375a Output commandline on status != 0 in virCommandWait
This helps identifying which command exited with status != 0.
2011-02-15 11:46:16 +01:00
dad4a3f29a add missing error handling to virGetDomain
When creating the virDomain::snapshots hash table, virGetDomain
wasn't checking if the creation was successful. This would then
lead to failures in the vir*DomainSnapshot functions. Better to
report this error early and make virGetDomain fail if the
snapshots hash couldn't be created.
* src/datatypes.c: report failure to make a hash table
2011-02-15 11:05:38 +08:00
7adb3fb739 call virReportOOMError when appropriate in hash.c
A couple of allocation were not calling virReportOOMError on allocation
errors

* src/util/hash.c: add the needed call in virHashCreate and
  virHashAddOrUpdateEntry
2011-02-15 10:59:01 +08:00
b958419534 storage: Create enough volumes for mpath pool
"virStorageBackendCreateVols":
  "names->next" serves as condition expression for "do...while",
however, "names" was shifted before, it then results in one less
loop, and thus, one less volume will be created for mpath pool,
the patch is to fix it.

* src/storage/storage_backend_mpath.c
2011-02-15 10:12:24 +08:00
d4b230c8fc maint: kill dead assignments
* src/network/bridge_driver.c (networkStartNetworkDaemon): Delete
unused assignments.
2011-02-14 17:34:14 -07:00
0cca53921d qemu: avoid NULL deref on error
* src/qemu/qemu_command.c (qemuParseCommandLineDisk): Report error
before cleaning def.
2011-02-14 17:34:05 -07:00
bd6ea30384 build: silence false positive clang report
clang complained that STREQ(group->controllers[i].mountPoint,...)  was
a NULL dereference when i==VIR_CGROUP_CONTROLLER_CPUSET, because it
assumes the worst about virCgroupPathOfController.  Marking the
argument const doesn't yet have an effect, per this clang bug:
http://llvm.org/bugs/show_bug.cgi?id=7758

So, we use sa_assert, which was designed to shut up false positives
from tools like clang.

* src/util/cgroup.c (virCgroupMakeGroup): Teach clang that there
is no NULL dereference.
2011-02-14 15:37:32 -07:00
e046d41f72 qemu: ignore failure of qemu -M ? on older qemu
https://bugzilla.redhat.com/show_bug.cgi?id=676563

Regression introduced in commit 2211518.

* src/qemu/qemu_capabilities.c (qemuCapsProbeMachineTypes): Allow
non-zero exit status.
2011-02-14 15:33:33 -07:00
83a0489a21 xml: avoid compiler warning
Detected by clang.

* src/util/xml.c (virXPathStringLimit): Use %zd, not obsolete %Zd.
2011-02-14 13:39:03 -07:00
13e9ba7c2b nwfilter: reorder match extensions relative to state match
This patch reorders the connlimit and comment match extensions relative to the state match (-m state); connlimit being most useful if found after a -m state --state NEW and not before it.
2011-02-14 14:10:24 -05:00
f7bec64913 conf: Fix XML generation for smartcards
When formatting XML for smartcard device with mode=host, libvirt
generates invalid XML if the device has address info associated:

<smartcard mode='host' <address type='ccid' controller='0' slot='1'/>
2011-02-14 19:42:29 +01:00
41f551e25e Fix cleanup on VM state after failed QEMU startup
Commit 9962e406c6 introduced a
problem where if the VM failed to startup, it would not be
correctly cleaned up. Amongst other things the SELinux
security label would not be removed, which prevents the VM
from ever starting again.

The virDomainIsActive() check at the start of qemudShutdownVMDaemon
checks for vm->def->id not being -1. By moving the assignment of the
VM id to the start of qemudStartVMDaemon, we can ensure cleanup will
occur on failure

* src/qemu/qemu_driver.c: Move initialization of 'vm->def->id'
  so that qemudShutdownVMDaemon() will process the shutdown
2011-02-14 16:02:00 +00:00
3ed18372a3 libvirt-qemu: Fix enum type declaration 2011-02-14 12:35:39 +01:00
9190f0b0a0 fix OOM handling in hash routines
* src/util/hash.c: virHashAddEntry and virHashUpdateEntry were missing NULL
  checks on strdup
* AUTHORS: add Christophe Fergeau
2011-02-14 13:36:06 +08:00
eebf4dc343 Update src/README
Add missing subdirectories.
2011-02-12 17:10:30 +01:00
92f0ed0353 virsh: avoid mingw compiler warnings
Compilation on mingw was warning about %lld use in fprintf, and
in the gnulib strptime module about dead labels.

* tools/virsh.c (vshPrint): Change redirect.
(vshPrintExtra): Allow use within vshPrint.  Avoid fprintf on
arbitrary formats, since we aren't using gnulib module; instead,
use virVasprintf to pre-format.
(vshError): Likewise.
* .gnulib: Update to latest, for mingw strptime warning fix.
Reported by Matthias Bolte.
2011-02-12 06:39:27 -07:00
3a97fa28e4 build: avoid problems with autogen.sh runs from tarball
Introduced by commit fac97c65c distributing cfg.mk, which
previously could blindly assume it was in a git checkout.

* cfg.mk (_update_required): Also check for .git.
* autogen.sh: Don't run bootstrap from a tarball.
Reported by Daniel Veillard.
2011-02-12 06:28:28 -07:00
117b2a6756 docs: Distribute XSLT files to generate HACKING 2011-02-12 13:38:02 +01:00
1682bcf7d8 qemu: Report a more informative error for missing cgroup controllers
Also use VIR_ERR_OPERATION_INVALID instead of VIR_ERR_NO_SUPPORT, as
the operation could succeed when the cgroup controller was mounted.
2011-02-12 13:37:57 +01:00
0e629db3bf xen: Prevent updating device when attaching a device
When attaching a device that already exists, xend driver updates
the device with "device_configure", it causes problems (e.g. for
disk device, 'device_configure' only can be used to update device
like CDROM), on the other hand, we provide additional API
(virDomainUpdateDevice) to update device, this fix is to raise up
errors instead of updating the existed device which is not CDROM
device.

Changes from v1 to v2:
  - allow to update CDROM

* src/xen/xend_internal.c
2011-02-12 14:29:09 +08:00
699a5888b7 build: fix cygwin strerror_r failure
Building the 0.8.8 release candidate on cygwin produced this compiler
warning, which is indicative of catastrophic failure on any attempt to
print an error message with errno turned to a string:

  CC       strerror_r.lo
strerror_r.c: In function 'rpl_strerror_r':
strerror_r.c:67: warning: assignment makes integer from pointer without a cast

This has been fixed in gnulib.

* .gnulib: Update to latest, for strerror_r fix.
* src/util/memory.c (includes): Satisfy 'make syntax-check'.
2011-02-11 12:32:17 -07:00
f370fc37f9 qemu: Fix escape_monitor(escape_shell(command))
Suspending a VM which contains shell meta characters doesn't work with
libvirt-0.8.7:
/var/log/libvirt/qemu/andreas_231-ne\ doch\ nicht.log:
  sh: -c: line 0: syntax error near unexpected token `doch'
  sh: -c: line 0: `cat | { dd bs=4096 seek=1 if=/dev/null && dd bs=1048576; }

Although target="andreas_231-ne doch nicht" contains shell meta
characters (here: blanks), they are not properly escaped by
src/qemu/qemu_monitor_{json,text}.c#qemuMonitor{JSON,Text}MigrateToFile()

First, the filename needs to be properly escaped for the shell, than
this command line has to be properly escaped for qemu again.

For this to work, remove the old qemuMonitorEscapeArg() wrapper, rename
qemuMonitorEscape() to it removing the handling for shell=TRUE, and
implement a new qemuMonitorEscapeShell() returning strings using single
quotes.

Using double quotes or escaping special shell characters with backslashes
would also be possible, but the set of special characters heavily
depends on the concrete shell (dsh, bash, zsh) and its setting (history
expansion, interactive use, ...)

Signed-off-by: Philipp Hahn <hahn@univention.de>
2011-02-11 12:07:35 -07:00
cee61fc298 Imprint all logs with version + package build information
The logging functions are enhanced so that immediately prior to
the first log message being printed to any output channel, the
libvirt package version will be printed.

eg

 $ LIBVIRT_DEBUG=1 virsh
 18:13:28.013: 17536: info : libvirt version: 0.8.7
 18:13:28.013: 17536: debug : virInitialize:361 : register drivers
 ...

The 'configure' script gains two new arguments which can be
used as

   --with-packager="Fedora Project, x86-01.phx2.fedoraproject.org, 01-27-2011-18:00:10"
   --with-packager-version="1.fc14"

to allow distros to append a custom string with package specific
data.

The RPM specfile is modified so that it appends the RPM version,
the build host, the build date and the packager name.

eg

 $ LIBVIRT_DEBUG=1 virsh
 18:14:52.086: 17551: info : libvirt version: 0.8.7, package: 1.fc13 (Fedora Project, x86-01.phx2.fedoraproject.org, 01-27-2011-18:00:10)
 18:14:52.086: 17551: debug : virInitialize:361 : register drivers

Thus when distro packagers receive bug reports they can clearly
see what version was in use, even if the bug reporter mistakenly
or intentionally lies about version/builds

* src/util/logging.c: Output version data prior to first log message
* libvirt.spec.in: Include RPM release, date, hostname & packager
* configure.ac: Add --with-packager & --with-packager-version args
2011-02-11 14:13:08 +00:00
6bf4788e86 qemu: fix attach-interface regression
QEMUD_CMD_FLAG_PCI_MULTIBUS should be set in the function
qemuCapsExtractVersionInfo()

The flag QEMUD_CMD_FLAG_PCI_MULTIBUS is used in the function
qemuBuildDeviceAddressStr(). All callers get qemuCmdFlags
by the function qemuCapsExtractVersionInfo() except that
testCompareXMLToArgvFiles() in qemuxml2argvtest.c.

So we should set QEMUD_CMD_FLAG_PCI_MULTIBUS in the function
qemuCapsExtractVersionInfo() instead of qemuBuildCommandLine()
because the function qemuBuildCommandLine() does not be called
when we attach a pci device.

tests: set QEMUD_CMD_FLAG_PCI_MULTIBUS in testCompareXMLToArgvFiles()

set QEMUD_CMD_FLAG_PCI_MULTIBUS before calling qemuBuildCommandLine()
as the flags is not set by qemuCapsExtractVersionInfo().

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-02-10 15:07:21 -07:00
100f4a63a2 Avoid pthread_sigmask on Win32 platforms
Win32 doesn't have a concept of signal masks so disable that
code. It is unclear how SIGINT is delivered (if at all) on
Win32, so this might further work to provide an alternative
to pthread_sigmask

* tools/virsh.c: Avoid pthread_sigmask on Win32
2011-02-10 14:30:10 +00:00
eacb3bb02a Reduce log level when cgroups aren't mounted
Quite a few hosts don't have cgroups mounted and so see warnings
from libvirt logged, which then cause bug reports, etc. Reduce
the log level to INFO so they're not visible by default

* src/qemu/qemu_driver.c: Reduce log level for cgroups
2011-02-10 14:30:02 +00:00
525434dd60 Avoid warnings from nwfilter driver when run non-root
When run non-root the nwfilter driver logs error messages about
being unable to find iptables/ebtables commands (they are in
/sbin which isn't in $PATH). The nwfilter driver can't ever work
as non-root, so simply skip it entirely thus avoiding the error
messages

* src/conf/nwfilter_conf.h, src/nwfilter/nwfilter_driver.c,
  src/nwfilter/nwfilter_gentech_driver.c,
  src/nwfilter/nwfilter_gentech_driver.h: Pass 'bool privileged'
  flag down to final driver impl
* src/nwfilter/nwfilter_ebiptables_driver.c: Skip initialization
  if not privileged
2011-02-10 14:29:57 +00:00
10713b1b98 Fix typo in parsing of spice 'auth' data
A typo s/spice/vnc/ caused parsing of the spice 'auth' data
to write into the wrong part of the struct, blowing away
other unrelated data.

* src/conf/domain_conf.c: s/vnc/spice/ in parsing spice auth
2011-02-10 10:54:15 +00:00
fac97c65c1 build: distribute 'make syntax-check' tweaks
* Makefile.am (EXTRA_DIST): Distribute cfg.mk.
2011-02-09 12:34:32 -07:00
9a52746261 docs: Add information about libvirt-php new location
Signed-off-by: Michal Novotny <minovotn@redhat.com>
2011-02-09 12:29:29 -07:00
1652fa2fd2 maint: whitespace cleanup
* .dir-locals.el (html-mode): Let emacs help out.
* cfg.mk (sc_TAB_in_indentation): Check more files.
* docs/internals/command.html.in: Fix offenders.
* docs/formatdomain.html.in: Likewise.
* docs/internals.html.in: Likewise.
Reported by Jiri Denemark.
2011-02-09 11:18:06 -07:00
7a4bc156c1 Adjust some log levels in udev driver
Most of te VIR_INFO calls in the udev driver are only relevant
to developers so can switch to VIR_DEBUG. Failure to initialize
libpciaccess though is a fatal error

* src/node_device/node_device_udev.c: Adjust log levels
2011-02-09 17:23:21 +00:00
bf6a3825b5 Add check for binary existing in machine type probe
When probing machine types if the QEMU binary does not exist
we get a hard to diagnose error, due to the execve() in the
child failing

error: internal error Child process exited with status 1.

Add an explicit check so that we get

error: Cannot find QEMU binary /usr/libexec/qem3u-kvm: No such file or directory

* src/qemu/qemu_capabilities.c: Check for QEMU binary
2011-02-09 16:45:31 +00:00
2222bd2459 Add a little more debugging for async events
To make it easier to investigate problems with async event
delivery, add two more debugging lines

* daemon/remote.c: Debug when an event is queued for dispatch
* src/remote/remote_driver.c: Debug when an event is received
  for processing
2011-02-09 16:45:05 +00:00
8ce5d404be Move connection driver modules directory
When built as modules, the connection drivers live
in $LIBDIR/libvirt/drivers. Now we add lock manager
drivers, we need to distinguish. So move the existing
modules to 'connection-driver'

* src/Makefile.am: Move module install dir
* src/driver.c: Move module search dir
2011-02-09 16:22:06 +00:00
88d04d170f Reset logging filter function when forking
To ensure child processes will log all error messages, reset
the logging filter function when forking

* src/util/util.c: Reset log filter in fork
2011-02-09 16:21:55 +00:00
ab07533e76 Block SIGPIPE around virExec hook functions
Some functionality run in virExec hooks may do I/O which
can trigger SIGPIPE. Renable SIGPIPE blocking around the
hook function

* src/util/util.c: Block SIGPIPE around hooks
2011-02-09 16:21:06 +00:00
cd782cc391 Support SCSI RAID type & lower log level for unknown types
The Linux kernel headers don't have a value for SCSI type 12,
but HAL source code shows this to be a 'raid'. Add workaround
for this type. Lower log level for unknown types since
this is not a fatal error condition. Include the device sysfs
path in the log output to allow identification of which device
has problems.

* src/node_device/node_device_udev.c: Add SCSI RAID type
2011-02-09 16:20:38 +00:00
2215050edd Only initialize/cleanup libpciaccess once
libpciaccess has many bugs in its pci_system_init/cleanup
functions that makes calling them multiple times unwise.
eg it will double close() FDs, and leak other FDs.

* src/node_device/node_device_udev.c: Only initialize
  libpciaccess once
2011-02-09 16:20:27 +00:00
28209ca05e Don't use CLONE_NEWUSER for now
Until now, user namespaces have not done much, but (for that
reason) have been innocuous to glob in with other CLONE_
flags.  Upcoming userns development, however, will make tasks
cloned with CLONE_NEWUSER far more restricted.  In particular,
for some time they will be unable to access files with anything
other than the world access perms.

This patch assumes that noone really needs the user namespaces
to be enabled.  If that is wrong, then we can try a more
baroque patch where we create a file owned by a test userid with
700 perms and, if we can't access it after setuid'ing to that
userid, then return 0.  Otherwise, assume we are using an
older, 'harmless' user namespace implementation.

Comments appreciated.  Is it ok to do this?

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
2011-02-09 08:23:37 -07:00
5ec8fb5662 sysinfo: implement qemu support
* src/qemu/qemu_driver.c (qemuGetSysinfo): New function.
(qemuDriver): Install it.
2011-02-08 19:38:49 -07:00
cb5b5380c2 sysinfo: refactor xml formatting
* src/util/sysinfo.h (virSysinfoFormat): New prototype.
* src/conf/domain_conf.c (virDomainSysinfoDefFormat): Move guts...
* src/util/sysinfo.c (virSysinfoFormat): ...into new function.
* src/libvirt_private.syms: Export it.
2011-02-08 19:37:21 -07:00
c82be0530e sysinfo: implement virsh support
* tools/virsh.c (cmdSysinfo): New function.
(hostAndHypervisorCmds): Add it.
* tools/virsh.pod: Document it.
2011-02-08 19:29:48 -07:00
5c8dedddcc sysinfo: implement the remote protocol
Done by editing the first three files, then running
'make -C src rpcgen', then editing src/remote_protocol-structs
to match.

* daemon/remote.c (remoteDispatchGetSysinfo): New function.
* src/remote/remote_driver.c (remoteGetSysinfo, remote_driver):
Client side serialization.
* src/remote/remote_protocol.x (remote_get_sysinfo_args)
(remote_get_sysinfo_ret): New types.
(REMOTE_PROC_GET_SYSINFO): New enum value.
* daemon/remote_dispatch_args.h: Regenerate.
* daemon/remote_dispatch_prototypes.h: Likewise.
* daemon/remote_dispatch_ret.h: Likewise.
* daemon/remote_dispatch_table.h: Likewise.
* src/remote/remote_protocol.c: Likewise.
* src/remote/remote_protocol.h: Likewise.
* src/remote_protocol-structs: Likewise.
2011-02-08 19:29:46 -07:00
addee8a096 sysinfo: implement the public API
* src/libvirt.c (virConnectGetSysinfo): New function.
* docs/formatdomain.html.in: Mention it.
2011-02-08 19:29:44 -07:00
dec13a5a15 sysinfo: define internal driver API
* src/driver.h (virDrvGetSysinfo): New typedef.
(_virDriver): New callback member.
* src/esx/esx_driver.c (esxDriver): Add stub for driver.
* src/lxc/lxc_driver.c (lxcDriver): Likewise.
* src/opennebula/one_driver.c (oneDriver): Likewise.
* src/openvz/openvz_driver.c (openvzDriver): Likewise.
* src/phyp/phyp_driver.c (phypDriver): Likewise.
* src/qemu/qemu_driver.c (qemuDriver): Likewise.
* src/remote/remote_driver.c (remote_driver): Likewise.
* src/test/test_driver.c (testDriver): Likewise.
* src/uml/uml_driver.c (umlDriver): Likewise.
* src/vbox/vbox_tmpl.c (Driver): Likewise.
* src/vmware/vmware_driver.c (vmwareDriver): Likewise.
* src/xen/xen_driver.c (xenUnifiedDriver): Likewise.
* src/xenapi/xenapi_driver.c (xenapiDriver): Likewise.
2011-02-08 19:25:30 -07:00
353b760953 sysinfo: expose new API
The new virConnectGetSysinfo() API allows one to get the system
information associated to a connection host, providing the same
data as a guest that uses <os><smbios mode='host'/></os>, and in
a format that can be pasted into the guest and edited when using
<os><smbios mode='sysinfo'/></os>.

* include/libvirt/libvirt.h.in (virConnectGetSysinfo): Declare.
* src/libvirt_public.syms: Export new symbol.
2011-02-08 19:21:26 -07:00
cace96080e Adding Michal Novotny for previous patch 2011-02-09 10:05:19 +08:00
d0ae594885 Add libvirt-php information page
This adds a ibvirt-php information page with some
basic information on libvirt-php project compilation, contribution
and other useful information.
2011-02-09 09:43:09 +08:00
ab2def20ff cgroup: Add documentation for blkiotune elements.
Add documentation for blkiotune elements.

Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
2011-02-08 11:47:28 -07:00
76d99efc44 LXC: LXC Blkio weight configuration support.
LXC Blkio weight configuration support.

Reviewed-by: "Nikunj A. Dadhania" <nikunj@linux.vnet.ibm.com>
Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
2011-02-08 11:43:54 -07:00
d9b28a319a qemu: Implement blkio tunable XML configuration and parsing.
Implement blkio tunable XML configuration and parsing.

Reviewed-by: "Nikunj A. Dadhania" <nikunj@linux.vnet.ibm.com>
Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
2011-02-08 11:43:45 -07:00
7c8c183e24 cgroup: Update XML Schema for new entries.
Update XML Schema for new entries.

Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
2011-02-08 11:25:33 -07:00
c3658ab543 cgroup: Implement blkio.weight tuning API.
Implement blkio.weight tuning API.

Acked-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
2011-02-08 11:25:33 -07:00
b58241a690 cgroup: Enable cgroup hierarchy for blkio cgroup
Enable cgroup hierarchy for blkio cgroup

Acked-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
2011-02-08 10:42:14 -07:00
fbaed1a714 maint: update AUTHORS
* AUTHORS: Adjust for recent commits.
2011-02-08 10:30:03 -07:00
7ca438e39a Update Dutch and Polish localizations 2011-02-08 21:01:38 +08:00
e41270e242 Revert "Czech translation updates"
This reverts commit 9169c0eeb4.
The patch didn't applied cleanly and completely broke po regeneration
2011-02-08 20:38:02 +08:00
9169c0eeb4 Czech translation updates 2011-02-08 19:23:18 +08:00
675482a974 Vietnamese translations for libvirt 2011-02-08 18:37:35 +08:00
132448e553 docs/index.html.in: update KVM url
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2011-02-07 11:14:49 -07:00
5a3ec56ba3 spicevmc: support older -device spicevmc of qemu 0.13.0
qemu 0.13.0 (at least as built for Fedora 14, and also backported to
RHEL 6.0 qemu) supported an older syntax for a spicevmc channel; it's
not as flexible (it has an implicit name and hides the chardev
aspect), but now that we support spicevmc, we might as well target
both variants.

* src/qemu/qemu_capabilities.h (QEMUD_CMD_FLAG_DEVICE_SPICEVMC):
New flag.
* src/qemu/qemu_capabilities.c (qemuCapsParseDeviceStr): Set it
correctly.
* src/qemu/qemu_command.h (qemuBuildVirtioSerialPortDevStr): Drop
declaration.
* src/qemu/qemu_command.c (qemuBuildVirtioSerialPortDevStr): Alter
signature, check flag.
(qemuBuildCommandLine): Adjust caller and check flag.
* tests/qemuhelptest.c (mymain): Update test.
* tests/qemuxml2argvtest.c (mymain): New test.
* tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc-old.xml:
New file.
* tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc-old.args:
Likewise.
2011-02-04 09:17:01 -07:00
79f9267f4b smartcard: add spicevmc support
Adds <smartcard mode='passthrough' type='spicevmc'/>, which uses the
new <channel name='smartcard'/> of <graphics type='spice'>.

* docs/schemas/domain.rng: Support new XML.
* docs/formatdomain.html.in: Document it.
* src/conf/domain_conf.h (virDomainGraphicsSpiceChannelName): New
enum value.
(virDomainChrSpicevmcName): New enum.
(virDomainChrSourceDef): Distinguish spicevmc types.
* src/conf/domain_conf.c (virDomainGraphicsSpiceChannelName): Add
smartcard.
(virDomainSmartcardDefParseXML): Parse it.
(virDomainChrDefParseXML, virDomainSmartcardDefParseXML): Set
spicevmc name.
(virDomainChrSpicevmc): New enum conversion functions.
* src/libvirt_private.syms: Export new functions.
* src/qemu/qemu_command.c (qemuBuildChrChardevStr): Conditionalize
name.
* tests/qemuxml2argvtest.c (domain): New test.
* tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-spicevmc.args:
New file.
* tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-spicevmc.xml:
Likewise.
2011-02-04 09:00:39 -07:00
be87a1236e spicevmc: support new qemu chardev
Inspired by https://bugzilla.redhat.com/show_bug.cgi?id=615757

Add a new character device backend for virtio serial channels that
activates the QEMU spice agent on the main channel using the vdagent
spicevmc connection.  The <target> must be type='virtio', and supports
an optional name that specifies how the guest will see the channel
(for now, name must be com.redhat.spice.0).

<channel type='spicevmc'>
  <target type='virtio'/>
  <address type='virtio-serial' controller='1' bus='0' port='3'/>
</channel>

* docs/schemas/domain.rng: Support new XML.
* docs/formatdomain.html.in: Document it.
* src/conf/domain_conf.h (virDomainChrType): New enum value.
* src/conf/domain_conf.c (virDomainChr): Add spicevmc.
(virDomainChrDefParseXML, virDomainChrSourceDefParseXML)
(virDomainChrDefParseTargetXML): Parse and enforce proper use.
(virDomainChrSourceDefFormat, virDomainChrDefFormat): Format.
* src/qemu/qemu_command.c (qemuBuildChrChardevStr)
(qemuBuildCommandLine): Add qemu support.
* tests/qemuxml2argvtest.c (domain): New test.
* tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.xml: New
file.
* tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.args:
Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
2011-02-03 21:14:50 -07:00
f5fd9baac1 smartcard: turn on qemu support
* src/qemu/qemu_command.c (qemuBuildCommandLine): Emit smartcard
options.
(qemuAssignDeviceAliases): Assign an alias for smartcards.
(qemuBuildControllerDevStr): Manage the usb-ccid controller.
* tests/qemuxml2argvtest.c (mymain): Add new tests.
* tests/qemuxml2argvdata/qemuxml2argv-smartcard-host.args: New
file.
* tests/qemuxml2argvdata/qemuxml2argv-smartcard-host-certificates.args:
Likewise.
* tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough.args:
Likewise.
* tests/qemuxml2argvdata/qemuxml2argv-smartcard-controller.args:
Likewise.
2011-02-03 19:32:41 -07:00
32e52134ff smartcard: enable SELinux support
* src/security/security_selinux.c
(SELinuxRestoreSecuritySmartcardCallback)
(SELinuxSetSecuritySmartcardCallback): New helper functions.
(SELinuxRestoreSecurityAllLabel, SELinuxSetSecurityAllLabel): Use
them.
2011-02-03 19:28:53 -07:00
7a2f29e4f9 smartcard: check for qemu capability
Qemu smartcard/spicevmc support exists on branches (such as
http://cgit.freedesktop.org/~alon/qemu/commit/?h=usb_ccid.v15&id=024a37b)
but is not yet upstream.  The added -help output matches a scratch build
that will be close to the RHEL 6.1 qemu-kvm.

* src/qemu/qemu_capabilities.h (QEMUD_CMD_FLAG_CCID_EMULATED)
(QEMUD_CMD_FLAG_CCID_PASSTHRU, QEMUD_CMD_FLAG_CHARDEV_SPICEVMC):
New flags.
* src/qemu/qemu_capabilities.c (qemuCapsComputeCmdFlags)
(qemuCapsParseDeviceStr): Check for smartcard capabilities.
(qemuCapsExtractVersionInfo): Tweak comment.
* tests/qemuhelptest.c (mymain): New test.
* tests/qemuhelpdata/qemu-kvm-0.12.1.2-rhel61: New file.
* tests/qemuhelpdata/qemu-kvm-0.12.1.2-rhel61-device: Likewise.
2011-02-03 19:28:53 -07:00
c1be1a2e0e smartcard: add domain conf support
* src/conf/domain_conf.h (virDomainSmartcardType): New enum.
(virDomainSmartcardDef, virDomainDeviceCcidAddress): New structs.
(virDomainDef): Include smartcards.
(virDomainSmartcardDefIterator): New typedef.
(virDomainSmartcardDefFree, virDomainSmartcardDefForeach): New
prototypes.
(virDomainControllerType, virDomainDeviceAddressType): Add ccid
enum values.
(virDomainDeviceInfo): Add ccid address type.
* src/conf/domain_conf.c (virDomainSmartcard): Convert between
enum and string.
(virDomainSmartcardDefParseXML, virDomainSmartcardDefFormat)
(virDomainSmartcardDefFree, virDomainDeviceCcidAddressParseXML)
(virDomainDefMaybeAddSmartcardController): New functions.
(virDomainDefParseXML): Parse the new XML.
(virDomainDefFormat): Convert back to XML.
(virDomainDefFree): Clean up.
(virDomainDeviceInfoIterate): Iterate over passthrough aliases.
(virDomainController, virDomainDeviceAddress)
(virDomainDeviceInfoParseXML, virDomainDeviceInfoFormat)
(virDomainDefAddImplicitControllers): Support new values.
* src/libvirt_private.syms (domain_conf.h): New exports.
* cfg.mk (useless_free_options): List new function.
2011-02-03 19:28:53 -07:00
ffdf478be2 smartcard: add XML support for <smartcard> device
Assuming a hypervisor that supports multiple smartcard devices in the
guest, this would be a valid XML description:

<devices>
  <smartcard mode='host'/>
  <smartcard mode='host-certificates'>
    <certificate>/path/to/cert1</certificate>
    <certificate>/path/to/cert2</certificate>
    <certificate>/path/to/cert3</certificate>
  </smartcard>
  <smartcard mode='passthrough' type='tcp'>
    <source mode='bind' host='127.0.0.1' service='2001'/>
    <protocol type='raw'/>
  </smartcard>
</devices>

(As of this commit, the qemu hypervisor will be the first
implementation, but it only supports one smartcard.)

* docs/formatdomain.html.in (Smartcard devices): New section.
* docs/schemas/domain.rng (smartcard): New define, used in
devices.
* tests/qemuxml2argvdata/qemuxml2argv-smartcard-host.xml: New file
to test schema.
* tests/qemuxml2argvdata/qemuxml2argv-smartcard-host-certificates.xml:
Likewise.
* tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-tcp.xml:
Likewise.
* tests/qemuxml2argvdata/qemuxml2argv-smartcard-controller.xml:
Likewise.
2011-02-03 19:27:43 -07:00
ad88e17ff5 docs/index.html.in: update QEMU url 2011-02-03 16:55:12 -07:00
963a9460b6 qemu: Support booting from hostdev PCI devices 2011-02-03 22:20:30 +01:00
83e335f9d2 Support booting from hostdev devices 2011-02-03 22:20:30 +01:00
2169472ab6 qemu: Add shortcut for HMP pass through
Currently users who want to use virDomainQemuMonitorCommand() API or
it's virsh equivalent has to use the same protocol as libvirt uses for
communication to qemu. Since the protocol is QMP with current qemu and
HMP much more usable for humans, one ends up typing something like the
following:

    virsh qemu-monitor-command DOM \
'{"execute":"human-monitor-command","arguments":{"command-line":"info kvm"}}'

which is not a very convenient way of debugging qemu.

This patch introduces --hmp option to qemu-monitor-command, which says
that the provided command is in HMP. If libvirt uses QMP to talk with
qemu, the command will automatically be converted into QMP. So the
example above is simplified to just

    virsh qemu-monitor-command --hmp DOM "info kvm"

Also the result is converted from

    {"return":"kvm support: enabled\r\n"}

to just plain HMP:

    kvm support: enabled

If libvirt talks to qemu in HMP, --hmp flag is obviously a noop.
2011-02-03 22:20:30 +01:00
be23e2bd65 macvtap: fix 2 nla_put expressions (non-serious bug)
This patch fixes 2 occurrences of nla_put expression with a '!' in
front of them that basically prevented the detection that the buffer
is too small. However, code further below would then detect that the
buffer is too small when further parts are added to the netlink message.
2011-02-03 14:36:27 -05:00
9962e406c6 qemu: avoid double shutdown
* src/qemu/qemu_driver.c (qemudShutdownVMDaemon): Check that vm is
still active.
Reported by Wen Congyang as follows:

Steps to reproduce this bug:

1. use gdb to debug libvirtd, and set breakpoint in the function
   qemuConnectMonitor()
2. start a vm, and the libvirtd will be stopped in qemuConnectMonitor()
3. kill -STOP $(cat /var/run/libvirt/qemu/<domain>.pid)
4. continue to run libvirtd in gdb, and libvirtd will be blocked in the
   function qemuMonitorSetCapabilities()
5. kill -9 $(cat /var/run/libvirt/qemu/<domain>.pid)

Here is log of the qemu:
=========
LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin ...
char device redirected to /dev/pts/3
2011-01-27 09:38:48.101: shutting down
2011-01-27 09:41:26.401: shutting down
=========

The vm is shut down twice. I do not know whether this behavior has
side effect, but I think we should shutdown the vm only once.
2011-02-03 09:00:35 -07:00
de53effecc Fix conflicts with glibc globals
When compiling libvirt with GCC 3.4.6 the following warning is being triggered quite a lot:

util/memory.h:60: warning: declaration of 'remove' shadows a global declaration
/usr/include/stdio.h:175: warning: shadowed declaration is here

Fix this by renaming the parameter to 'toremove'.
2011-02-03 08:58:45 -07:00
3028f51c38 Fix compilation when building without sasl
Use of saslDecoded field need to be guarded by #if HAVE_SASL/endif
* src/remote/remote_driver.c: fix remoteIOEventLoop accordingly
2011-02-03 22:13:24 +08:00
0fa17ff52a docs: more on qemu locking patterns
* src/qemu/THREADS.txt: Improve documentation.
2011-02-02 09:19:31 -07:00
0b864eb103 qemuBuildDeviceAddressStr() checks for QEMUD_CMD_FLAG_PCI_MULTIBUS
Depending if the qemu binary supports multiple pci-busses, the device
options will contain "bus=pci" or "bus=pci.0".

Only x86_64 and i686 seem to have support for multiple PCI-busses. When
a guest of these architectures is started, set the
QEMUD_CMD_FLAG_PCI_MULTIBUS flag.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2011-02-02 09:00:46 -07:00
68d2c3482f Don't sleep in poll() if there is existing SASL decoded data
In the SASL codepath we typically read far more data off the
wire than we immediately need. When using a connection from a
single thread this isn't a problem, since only our reply will
be pending (or an event we can handle directly). When using a
connection from multiple threads though, we may read the data
from replies from other threads. If those replies occur after
our own reply, they'll not be processed. The other thread will
then go into poll() and wait for its reply which has already
been received and decoded. The solution is to set poll() timeout
to 0 if there is pending SASL data.

* src/remote/remote_driver.c: Don't sleep in poll() if SASL
  data exists
2011-02-02 10:59:55 +00:00
ae05728380 docs: renamed hudson project link to jenkins, matching project rename 2011-02-02 16:42:54 +11:00
c31e6cdc51 macvtap: fix variable in debugging output
This patch fixes a variable in the debugging output.
2011-02-01 12:02:01 -05:00
59b34f139d build: fix parted detection at configure time
* configure.ac (PARTED_FOUND): Issue configure error if
--with-storage-disk=yes but no parted is found.
2011-02-01 09:05:05 -07:00
8168285b45 docs: Update docs for cpu_shares setting
* tools/virsh.pod
2011-02-01 16:46:17 +08:00
16be54e898 qemu: Build command line for incoming tunneled migration
Command line building for incoming tunneled migration is missed,
as a result, all the tunneled migration will fail with "unknown
migration protocol".

* src/qemu/qemu_command.c
2011-02-01 16:33:34 +08:00
47969c055e bridge_driver: handle DNS over IPv6
* dnsmasq listens on all defined IPv[46] addresses for network
* Add ip6tables rules to allow DNS traffic to host
2011-01-31 20:25:48 -05:00
bd6c46fa0c tests: handle backspace-newline pairs in test input files
This patch teaches testutil how to read multi-line input files with
backspace-newline line continuation markers.

The patch also breaks up all the single-line arguments test input files into
multi-line files with lines shorter than 80 characters.
2011-01-31 11:25:34 -07:00
ee3b030050 qemu: More clear error parsing domain def failure of tunneled migration
* src/qemu/qemu_driver.c
2011-01-31 17:12:46 +08:00
7ca5765b91 Initialization error of controller in QEmu SCSI hotplug
Bug manifests itself by:

1. # virsh attach-disk --target sdb ...
2. # virsh attach-disk --target sdh ...
   error: Failed to attach disk
   error: operation failed: target scsi:0 already exists

sdh uses scsi:1, rather than scsi:0.

* src/qemu/qemu_hotplug.c: properly set controller idx in
  qemuDomainFindOrCreateSCSIDiskController()
2011-01-31 15:55:40 +08:00
53258f3e7f Osier get commit rights 2011-01-31 09:31:33 +08:00
030ce43b49 maint: reject raw close, popen in 'make syntax-check'
commit f1fe9671e was supposed to make sure we use files.h
macros to avoid double close, but it didn't work.

Meanwhile, virCommand is vastly superior to system(), fork(),
and popen() (also to virExec, but we haven't completed that
conversion), so enforce that, too.

* cfg.mk (sc_prohibit_close): Fix typo that excluded close, and
add pclose.
(sc_prohibit_fork_wrappers): New rule, for fork, system, and popen.
* .x-sc_prohibit_close: More exemptions.
* .x-sc_prohibit_fork_wrappers: New file.
* Makefile.am (syntax_check_exceptions): Ship new file.
* src/datatypes.c (virReleaseConnect): Tweak comment to avoid
false positive.
* src/util/files.h (VIR_CLOSE): Likewise.
2011-01-29 10:36:47 -07:00
e67ae61991 build: avoid close, system
* src/fdstream.c (virFDStreamOpenFile, virFDStreamCreateFile):
Use VIR_FORCE_CLOSE instead of close.
* tests/commandtest.c (mymain): Likewise.
* tools/virsh.c (editFile): Use virCommand instead of system.
* src/util/util.c (__virExec): Special case preservation of std
file descriptors to child.
2011-01-29 10:36:45 -07:00
dc52cab126 Prefer C style comments over C++ ones
Pure cosmetic change.
2011-01-29 00:59:45 +01:00
8f4999b477 esx: Ensure max-memory has 4 megabyte granularity 2011-01-29 00:59:39 +01:00
d9ad8ac392 Add VIR_DIV_UP to divide memory or storage request sizes with round up
Use it in all places where a memory or storage request size is converted
to a larger granularity. This avoids requesting too small memory or storage
sizes that could result from the truncation done by a simple division.

This extends the round up fix in 6002e0406c
to the whole codebase.

Instead of reporting errors for odd values in the VMX code round them up.

Update the QEMU Argv tests accordingly as the original memory size 219200
isn't a even multiple of 1024 and is rounded up to 215 megabyte now. Change
it to 219100 and 219136. Use two different values intentionally to make
sure that rounding up works.

Update virsh.pod accordingly, as rounding down and rejecting are replaced
by rounding up.
2011-01-29 00:42:10 +01:00
6fc1159d94 qemu: fix augeas support for vnc_auto_unix_socket
Fixes test failure that was overlooked after commit 1e1f7a8950.

* daemon/Makefile.am (check-local): Let 'make check' fail on error.
* daemon/test_libvirtd.aug: Move qemu-specific option...
* src/qemu/test_libvirtd_qemu.aug: ...into correct test.
* src/qemu/libvirtd_qemu.aug: Parse new option.
2011-01-28 15:28:30 -07:00
30e21374ea virsh: added --all flag to freecell command
This will iterate over all NUMA nodes, showing
free memory for each and sum at the end.
Existing default behavior is not changed.
2011-01-28 15:13:48 -07:00
96f4986aca esx: Don't try to change max-memory of an active domain
Report an VIR_ERR_OPERATION_INVALID error in that case instead of letting
the SOAP call fail with an VIR_ERR_INTERNAL_ERROR error.
2011-01-28 21:22:56 +01:00
819269c4f0 qemu aio: enable support
qemu allows the user to choose what io storage api should be used,
either the default (threads) or native (linux aio) which in the latter
case can result in better performance.

Based on a patch originally by Matthias Dahl.

Red Hat Bugzilla #591703
Signed-off-by: Eric Blake <eblake@redhat.com>
2011-01-28 09:09:49 -07:00
f19357ce37 qemu aio: parse aio support from qemu -help
Signed-off-by: Eric Blake <eblake@redhat.com>
2011-01-28 09:09:49 -07:00
91ef4e05ea qemu aio: add XML parsing
Allows io={threads|native} as an optional attribute to <driver>.

Signed-off-by: Eric Blake <eblake@redhat.com>
2011-01-28 09:09:48 -07:00
eb1be58e0e docs: replace CRLF with LF 2011-01-28 08:44:05 -07:00
0095edaa06 Remove bogus log warning lines when launching QEMU
The refactoring of QEMU command startup was comitted with
a couple of VIR_WARN lines left in from debugging.

* src/qemu/qemu_driver.c: Remove log warning lines
2011-01-28 11:49:21 +00:00
e85247e7c3 Remove double close of qemu monitor
When qemuMonitorSetCapabilities() fails, there is no need to
call qemuMonitorClose(), because the caller will already see
the error code and tear down the entire VM. The extra call to
qemuMonitorClose resulted in a double-free due to it removing
a ref count prematurely.

* src/qemu/qemu_driver.c: Remove premature close of monitor
2011-01-28 11:49:13 +00:00
331d7b09a7 Prevent overfilling of self-pipe in python event loop
If the event loop takes a very long time todo something, it is
possible for the 'self pipe' buffer to become full at which
point the entire event loop + remote driver deadlock. Use a
boolean flag to ensure we have strict one-in, one-out behaviour
on writes/reads of the 'self pipe'
2011-01-28 11:48:27 +00:00
cc4447b68a docs: Add docs for new extra parameter pkipath
* docs/remote.html.in
2011-01-27 20:47:17 -07:00
b96b6f4723 qemu: fix error messages
Regression in commit caa805ea let a lot of bad messages slip in.

* cfg.mk (msg_gen_function): Fix function name.
* src/qemu/qemu_cgroup.c (qemuRemoveCgroup): Fix fallout from
'make syntax-check'.
* src/qemu/qemu_driver.c (qemudDomainGetInfo)
(qemuDomainWaitForMigrationComplete, qemudStartVMDaemon)
(qemudDomainSaveFlag, qemudDomainAttachDevice)
(qemuDomainUpdateDeviceFlags): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainAttachHostUsbDevice)
(qemuDomainDetachPciDiskDevice, qemuDomainDetachSCSIDiskDevice):
Likewise.
2011-01-27 20:41:26 -07:00
cdbba1c496 qemu: Report more accurate error on failure to attach device.
When attaching device from a xml file and the device is mis-configured,
virsh gives mis-leading message "out of memory". This patch fixes this.

Signed-off-by: Eric Blake <eblake@redhat.com>
2011-01-27 20:27:05 -07:00
f15cad2916 Force guest suspend at timeout
If the memory of guest OS is changed constantly, the live migration
can not be ended ever for ever.

We can use the command 'virsh migrate-setmaxdowntime' to control the
live migration. But the value of maxdowntime is diffcult to calculate
because it depends on the transfer speed of network and constantly
changing memroy size. We need a easy way to control the live migration.

This patch adds the support of forcing guest to suspend at timeout.
With this patch, when we migrate the guest OS, we can specify a
timeout. If the live migration timeouts, auto-suspend the guest OS,
where the migration will complete offline.
2011-01-27 15:30:42 -07:00
d183e9d1e8 Show migration progress.
Show migration progress if `migrate --verbose'.
2011-01-27 15:29:24 -07:00
8e6d9860cd Cancel migration if user presses Ctrl-C when migration is in progress
While migration is in progress and virsh is waiting for its
completion, user may want to terminate the progress by pressing
Ctrl-C. But virsh just exits on user's Ctrl-C leaving migration
in background that user isn't even aware of. It's not reasonable.

This patch changes the behaviour for migration. For other
commands Ctrl-C still terminates virsh itself.
2011-01-27 15:26:20 -07:00
3fdc7895ec qemu: use separate alias for chardev and associated device
* src/qemu/qemu_command.c (qemuBuildChrChardevStr): Alter the
chardev alias.
(qemuBuildCommandLine): Output an id for the chardev counterpart.
* tests/qemuxml2argvdata/*: Update tests to match.
Reported by Daniel P. Berrange.
2011-01-27 13:55:35 -07:00
d96431f910 avoid vm to be deleted if qemuConnectMonitor failed
Steps to reproduce this bug:
1. service libvirtd start
2. virsh start <domain>
3. kill -STOP $(cat /var/run/libvirt/qemu/<domain>.pid)
4. service libvirtd restart
5. kill -9 $(cat /var/run/libvirt/qemu/<domain>.pid)

Then libvirtd will core dump or be in deadlock state.

Make sure that json is built into libvirt and the version
of qemu is newer than 0.13.0.

The reason of libvirtd cores dump is that:
We add vm->refs when we alloc the memory, and decrease it
in the function qemuHandleMonitorEOF() in other thread.

We add vm->refs in the function qemuConnectMonitor() and
decrease it when the vm is inactive.

The libvirtd will block in the function qemuMonitorSetCapabilities()
because the vm is stopped by signal SIGSTOP. Now the vm->refs is 2.

Then we kill the vm by signal SIGKILL. The function
qemuMonitorSetCapabilities() failed, and then we will decrease vm->refs
in the function qemuMonitorClose().
In another thread, mon->fd is broken and the function
qemuHandleMonitorEOF() is called.

If qemuHandleMonitorEOF() decreases vm->refs before qemuConnectMonitor()
returns, vm->refs will be decrease to 0 and the memory is freed.

We will call qemudShutdownVMDaemon() as qemuConnectMonitor() failed.
The memory has been freed, so qemudShutdownVMDaemon() is too dangerous.

We will reference NULL pointer in the function virDomainConfVMNWFilterTeardown():
=============
void
virDomainConfVMNWFilterTeardown(virDomainObjPtr vm) {
    int i;

    if (nwfilterDriver != NULL) {
        for (i = 0; i < vm->def->nnets; i++)
            virDomainConfNWFilterTeardown(vm->def->nets[i]);
    }
}
============
vm->def->nnets is not 0 but vm->def->nets is NULL(We don't set vm->def->nnets
to 0 when we free vm).

We should add an extra reference of vm to avoid vm to be deleted if
qemuConnectMonitor() failed.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-01-27 13:38:29 -07:00
cedf97e75a tests: Fix virtio channel tests
As noticed by Eric, commit 8e28c5d402,
which fixed generation of virtio-serial port numbers, forgot to adjust
test files which resulted in make check failure.
2011-01-27 19:00:36 +01:00
4282efcc76 docs: expand the man page text for virsh setmaxmem
Addresses BZ # 622534:

  https://bugzilla.redhat.com/show_bug.cgi?id=622534
2011-01-28 03:32:23 +11:00
a7483a5631 event: fix event-handling allocation crash
Regression introduced in commit e6b68d7 (Nov 2010).

Prior to that point, handlesAlloc was always a multiple of
EVENT_ALLOC_EXTENT (10), and was an int (so even if the subtraction
had been able to wrap, a negative value would be less than the count
not try to free the handles array).  But after that point,
VIR_RESIZE_N made handlesAlloc grow geometrically (with a pattern of
10, 20, 30, 45 for the handles array) but still freed in multiples of
EVENT_ALLOC_EXTENT; and the count changed to size_t.  Which means that
after 31 handles have been created, then 30 handles destroyed,
handlesAlloc is 5 while handlesCount is 1, and since (size_t)(1 - 5)
is indeed greater than 1, this then tried to free 10 elements, which
had the awful effect of nuking the handles array while there were
still live handles.

Nuking live handles puts libvirtd in an inconsistent state, and was
easily reproducible by starting and then stopping 60 faqemu guests.

* daemon/event.c (virEventCleanupTimeouts, virEventCleanupHandles):
Avoid integer wrap-around causing us to delete the entire array
while entries are still active.
* tests/eventtest.c (mymain): Expose the bug.
2011-01-27 09:12:36 -07:00
6014485cdb docs: fix incorrect XML element mentioned by setmem text 2011-01-27 22:57:18 +11:00
31242565ae remote: Add extra parameter pkipath for URI
This new parameter allows user specifies where the client
cerficate, client key, CA certificate of x509 is, instead of
hardcoding it. If 'pkipath' is not specified, and the user
is not root, try to find files in $HOME/.pki/libvirt, as long
as one of client cerficate, client key, CA certificate can
not be found, use default global location (LIBVIRT_CACERT,
LIBVIRT_CLIENTCERT, LIBVIRT_CLIENTKEY, see
src/remote/remote_driver.h)

Example of use:

[root@Osier client]# virsh -c qemu+tls://10.66.93.111/system?pkipath=/tmp/pki/client
error: Cannot access CA certificate '/tmp/pki/client/cacert.pem': No such file
or directory
error: failed to connect to the hypervisor
[root@Osier client]# ls -l
total 24
-rwxrwxr-x. 1 root root 6424 Jan 24 21:35 a.out
-rw-r--r--. 1 root root 1245 Jan 23 19:04 clientcert.pem
-rw-r--r--. 1 root root  132 Jan 23 19:04 client.info
-rw-r--r--. 1 root root 1679 Jan 23 19:04 clientkey.pem

[root@Osier client]# cp /tmp/cacert.pem .
[root@Osier client]# virsh -c qemu+tls://10.66.93.111/system?pkipath=/tmp/pki/client
Welcome to virsh, the virtualization interactive terminal.

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

virsh #

* src/remote/remote_driver.c: adds support for the new pkipath URI parameter
2011-01-27 16:34:54 +08:00
6002e0406c storage: Round up capacity for LVM volume creation
If vol->capacity is odd, the capacity will be rounded down
by devision, this patch is to round it up instead of rounding
down, to be safer in case of one writes to the volume with the
size he used to create.

- src/storage/storage_backend_logical.c: make sure size is not rounded down
2011-01-27 16:28:19 +08:00
28eae66a3a Update localization files from Fedora i10n 2011-01-27 13:33:45 +08:00
8e28c5d402 Do not use virtio-serial port 0 for generic ports
Per the discussion in:

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

The port numbering should start from 1, not 0.  We assign maxport + 1,
so start maxport at 0.
2011-01-26 23:02:40 -05:00
c9c794b52b Manually kill gzip if restore fails before starting qemu
If a guest image is saved in compressed format, and the restore fails
in some way after the intermediate process used to uncompress the
image has been started, but before qemu has been started to hook up to
the uncompressor, libvirt will endlessly wait for the uncompressor to
finish, but it never will because it's still waiting to have something
hooked up to drain its output.

The solution is to close the pipes on both sides of the uncompressor,
then send a SIGTERM before calling waitpid on it (only if the restore
has failed, of course).
2011-01-26 10:13:43 -05:00
3493f1bcec Fix setup of lib directory with autogen.sh --system
On x86_64 hosts, /usr/lib64 must be used instead of /usr/lib
Rather than attempt to whitelist architectures, just check
for existance of /usr/lib64

* autogen.sh: Fix to use /usr/lib64 if it exists
2011-01-26 14:54:23 +00:00
e0e4e4de7a Add check for poll error events in monitor
Handle poll errors in the same way as hangup event

* src/qemu/qemu_monitor.c: Handle error events
2011-01-26 14:54:23 +00:00
b8786c0641 Filter out certain expected error messages from libvirtd
Add a hook to the error reporting APIs to allow specific
error messages to be filtered out. Wire up libvirtd to
remove VIR_ERR_NO_DOMAIN & similar error codes from the
logs. They are still logged at DEBUG level.

* daemon/libvirtd.c: Filter VIR_ERR_NO_DOMAIN and friends
* src/libvirt_private.syms, src/util/virterror.c,
  src/util/virterror_internal.h: Hook for changing error
  reporting level
2011-01-26 14:54:23 +00:00
dbfca3ff70 Revert all previous error log priority hacks
This reverts the additions in commit

  abff683f78

taking us back to state where all errors are fully logged
in both libvirtd and normal clients.

THe intent was to stop VIR_ERR_NO_DOMAIN (No such domain
with UUID XXXX) messages from client apps polluting syslog
The change affected all error codes, but more seriously,
it also impacted errors from internal libvirtd infrastructure
For example guest autostart no longer logged errors. The
libvirtd network code no longer logged some errors. This
makes debugging incredibly hard

* daemon/libvirtd.c: Remove error log priority filter
* src/util/virterror.c, src/util/virterror_internal.h: Remove
  callback for overriding log priority
2011-01-26 14:54:23 +00:00
2b7ac8838d Cleanup code style in logging APIs
Remove use of brackets around following return statement.
Fix indentation of two switch statements
2011-01-26 14:54:23 +00:00
34a19dda1c Set SELinux context label of pipes used for qemu migration
This patch is a partial resolution to the following bug:

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

(to complete the fix, an updated selinux-policy package is required,
to add the policy that allows libvirt to set the context of a fifo,
which was previously not allowed).

Explanation : When an incoming migration is over a pipe (for example,
if the image was compressed and is being fed through gzip, or was on a
root-squash nfs server, so needed to be opened by a child process
running as a different uid), qemu cannot read it unless the selinux
context label for the pipe has been set properly.

The solution is to check the fd used as the source of the migration
just before passing it to qemu; if it's a fifo (implying that it's a
pipe), we call the newly added virSecurityManagerSetFDLabel() function
to set the context properly.
2011-01-26 09:03:21 -05:00
d89608f994 Add a function to the security driver API that sets the label of an open fd.
A need was found to set the SELinux context label on an open fd (a
pipe, as a matter of fact). This patch adds a function to the security
driver API that will set the label on an open fd to secdef.label. For
all drivers other than the SELinux driver, it's a NOP. For the SElinux
driver, it calls fsetfilecon().

If the return is a failure, it only returns error up to the caller if
1) the desired label is different from the existing label, 2) the
destination fd is of a type that supports setting the selinux context,
and 3) selinux is in enforcing mode. Otherwise it will return
success. This follows the pattern of the existing function
SELinuxSetFilecon().
2011-01-26 09:03:11 -05:00
413c88e773 docs: add a link to the bindings page under the downloads menu item
So people looking to download the language bindings, but don't know
they're under the "Docs" area.
2011-01-26 16:00:33 +11:00
cee47aace1 virsh: require --mac to avoid detach-interface ambiguity
bugfix for https://bugzilla.redhat.com/show_bug.cgi?id=671050

virsh simply refutes to detach-interface in case when multiple
interfaces are attached and --mac is not specified.
2011-01-25 10:47:28 -07:00
75da8b8505 dispatch error before return
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-01-25 10:05:03 -07:00
dbd63c4d63 qemu: Error prompt when managed save a shutoff domain
The problem was introduced by commit 4303c91, which removed the checking
of domain state, this patch is to fix it.

Otherwise, improper error will be thrown, e.g.

error: Failed to save domain rhel6 state
error: cannot resolve symlink /var/lib/libvirt/qemu/save/rhel6.save: No such
file or directory
2011-01-25 09:51:26 -07:00
6cbab7c159 build: avoid corrupted gnulib/tests/Makefile
Running 'make check' can sometimes fail in the gnulib/tests
subdirectory, when doing an incremental build, because
./bootstrap generates a Makefile.am that tries to refer to
../../.. instead of ../.., and gets lost.

This may be an upstream gnulib bug, where a more elegant
solution will present itself in the future:
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/24898

But in the meantime, I was able to reproduce both the issue,
and this solution to work around it.

* bootstrap.conf (bootstrap_epilogue): Ensure that no stray
../../.. components remain in gnulib/tests/Makefile.in.
Reported by Serge Hallyn.
2011-01-24 17:19:25 -07:00
6cabc0b0d0 qemu: sound: Support intel 'ich6' model
In QEMU, the card itself is a PCI device, but it requires a codec
(either -device hda-output or -device hda-duplex) to actually output
sound. Specifying <sound model='ich6'/> gives us -device intel-hda
-device hda-duplex I think it's important that a simple <sound model='ich6'/>
sets up a useful codec, to have consistent behavior with all other sound cards.

This is basically Dan's proposal of

    <sound model='ich6'>
        <codec type='output' slot='0'/>
        <codec type='duplex' slot='3'/>
    </sound>

without the codec bits implemented.

The important thing is to keep a consistent API here, we don't want some
<sound> devs require tweaking codecs but not others. Steps I see to
accomplishing this:

    - every <sound> device has a <codec type='default'/> (unless codecs are
        manually specified)
    - <codec type='none'/> is required to specify 'no codecs'
    - new audio settings like mic=on|off could then be exposed in
        <sound> or <codec> in a consistent manner for all sound models

v2:
    Use model='ich6'

v3:
    Use feature detection, from eblake
    Set codec id, bus, and cad values

v4:
    intel-hda isn't supported if -device isn't available

v5:
    Comment spelling fixes
2011-01-24 13:11:52 -05:00
4a267912bf vmx: Use VIR_ERR_CONFIG_UNSUPPORTED when appropriated 2011-01-22 00:26:52 +01:00
a11bd2e6cc event: fix event-handling data race
This bug has been present since before the time that commit
f8a519 (Dec 2008) tried to make the dispatch loop re-entrant.

Dereferencing eventLoop.handles outside the lock risks crashing, since
any other thread could have reallocated the array in the meantime.
It's a narrow race window, however, and one that would have most
likely resulted in passing bogus data to the callback rather than
actually causing a segv, which is probably why it has gone undetected
this long.

* daemon/event.c (virEventDispatchHandles): Cache data while
inside the lock, as the array might be reallocated once outside.
2011-01-21 15:54:54 -07:00
ae0cdd4710 build: fix 'make check' with older git
* .gnulib: Update to latest, for maintainer-makefile fix.
Reported by Matthias Bolte.
2011-01-21 15:40:46 -07:00
1e1f7a8950 Push unapplied fixups for previous patch
- Add augeas tests
- Clarify vnc_auto_unix_socket precedence in qemu.conf
2011-01-21 16:18:54 -05:00
a942ea0692 qemu: Add conf option to auto setup VNC unix sockets
If vnc_auto_unix_socket is enabled, any VNC devices without a hardcoded
listen or socket value will be setup to serve over a unix socket in
/var/lib/libvirt/qemu/$vmname.vnc.

We store the generated socket path in the transient VM definition at
CLI build time.
2011-01-21 16:03:05 -05:00
1d9c0a08d9 qemu: Allow serving VNC over a unix domain socket
QEMU supports serving VNC over a unix domain socket rather than traditional
TCP host/port. This is specified with:

<graphics type='vnc' socket='/foo/bar/baz'/>

This provides better security access control than VNC listening on
127.0.0.1, but will cause issues with tools that rely on the lax security
(virt-manager in fedora runs as regular user by default, and wouldn't be
able to access a socket owned by 'qemu' or 'root').

Also not currently supported by any clients, though I have patches for
virt-manager, and virt-viewer should be simple to update.

v2:
    schema: Make listen vs. socket a <choice>
2011-01-21 16:03:04 -05:00
cb4c2694f1 qemu: Set domain def transient at beginning of startup process
This will allow us to record transient runtime state in vm->def, like
default VNC parameters. Accomplish this by adding an extra 'live' parameter
to SetDefTransient, with similar semantics to the 'live' flag for
AssignDef.
2011-01-21 16:03:03 -05:00
125978fe3b maint: support --no-git option during autogen.sh
https://bugzilla.redhat.com/show_bug.cgi?id=562743

Also, fixes gnulib bug in dealing with strerror_r from glibc 2.13.

* .gnulib: Update to latest, for improved bootstrap.
* bootstrap: Resync from gnulib.
* autogen.sh (bootstrap): Add --bootstrap-sync, to make it easier
to keep bootstrap up-to-date.  Pass optional --no-git through.
Reported by Aleksey Avdeev.
2011-01-21 09:45:37 -07:00
4301b95af7 [v2] qemu: Retry JSON monitor cont cmd on MigrationExpected error
When restoring a saved qemu instance via JSON monitor, the vm is
left in a paused state.  Turns out the 'cont' cmd was failing with
"MigrationExpected" error class and "An incoming migration is
expected before this command can be executed" error description
due to migration (restore) not yet complete.

Detect if 'cont' cmd fails with "MigrationExpecte" error class and
retry 'cont' cmd.

V2: Fix potential double-free noted by Laine Stump
2011-01-21 09:35:57 -07:00
af268f2a36 qemu: report more proper error for unsupported graphics
Report VIR_ERR_CONFIG_UNSUPPORTED instead of VIR_ERR_INTERNAL_ERROR,
as it's valid in our domain schema, just unsupported by hypervisor
here.

* src/qemu/qemu_command.c
2011-01-21 09:27:15 -07:00
87a183f698 Fix startup with VNC password expiry on old QEMU
The code which set VNC passwords correctly had fallback for
the set_password command, but was lacking it for the
expire_password command. This made it impossible to start
a guest. It also failed to check whether QEMU was still
running after the initial 'set_password' command completed

* src/qemu/qemu_hotplug.c: Fix error handling when
  password expiry fails
* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_text.c: Fix
  return code for missing expire_password command
2011-01-21 16:24:13 +00:00
f0bbf96047 Fix error reporting when machine type probe fails
Avoid overwriting the real error message with a generic
OOM failure message, when machine type probe fails

* src/qemu/qemu_driver.c: Don't overwrite error
2011-01-21 16:08:28 +00:00
31c698d76d Avoid crash in security driver if model is NULL
If the XML security model is NULL, it is assumed that the current
model will be used with dynamic labelling. The verify step is
meaningless and potentially crashes if dereferencing NULL

* src/security/security_manager.c: Skip NULL model on verify
2011-01-21 16:07:04 +00:00
bda57661b8 qemu: Fix a possible deadlock in p2p migration
The function virUnrefConnect() may call virReleaseConnect() to release
the dest connection, and the function virReleaseConnect() will call
conn->driver->close().

So the function virUnrefConnect() should be surrounded by
qemuDomainObjEnterRemoteWithDriver() and
qemuDomainObjExitRemoteWithDriver() to prevent possible deadlock between
two communicating libvirt daemons.

See commit f0c8e1cb37 for further details.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-01-21 08:21:12 -07:00
3703c3fed4 docs: document <controller> element
* docs/formatdomain.html.in: Talk about <controller> and <address>
throughout.
2011-01-20 08:58:40 -07:00
e23842856c docs: move the apps page to the top level as its good promo 2011-01-20 17:17:41 +11:00
ab3a43200c docs: added new entries to apps page, plus adjusted a few existing
Added new entries for Hudson, LCFG, Tivoli Provisioning Manager,
virt-what, and Zenoss.  Adjusted the existing entries for BuildBot
and vmware2libvirt.
2011-01-20 12:57:10 +11:00
15e7865893 qemu: Avoid sending STOPPED event twice
In some circumstances, libvirtd would issue two STOPPED events after it
stopped a domain. This was because an EOF event can arrive after a qemu
process is killed but before qemuMonitorClose() is called.

qemuHandleMonitorEOF() should ignore EOF when the domain is not running.

I wasn't able to reproduce this bug directly, only after adding an
artificial sleep() into qemudShutdownVMDaemon().
2011-01-19 15:01:52 +01:00
45c02ee06f qemu: Fail if per-device boot is used but deviceboot is not supported 2011-01-19 15:01:52 +01:00
b9c1a9cbff spec: Start libvirt-guests only if it's on in current runlevel 2011-01-19 15:01:52 +01:00
f10d209585 Remove redundant brackets around return values
A large number of return values used 'return (0)' instead
of simply 'return 0'. Remove all these redundant brackets
so the style is consistent throughout the file

* src/libvirt.c: Remove redundant brackets
2011-01-19 12:42:23 +00:00
921b3812e2 Increase size of driver table to make UML work again
The driver table only has 10 slots, but there are potentially
11 drivers that need activating. Improve the error message
when driver registration fails

* src/libvirt.c: Increase driver table size & improve errors
2011-01-19 12:42:23 +00:00
19d931d290 Turn libvirt.c error reporting functions into macros
The virLibConnError() function (and related ones) do not correctly
report line number info. Turn them all into macros so line numbers
are reported correctly. Drop the connection object in all of them
since it is no longer used.

Also from the virLibConnWarning() equivalents completely. Now
that the Xen driver is running 100% inside libvirtd, those
codepaths for secondary drivers cannot be reached.

* src/libvirt.c: Replace error functions with macros
2011-01-19 12:42:18 +00:00
3c99896388 docs: document <sysinfo> and <smbios> elements
* docs/formatdomain.html.in: Talk about <sysinfo> throughout.
2011-01-18 15:35:41 -07:00
c5b11b3cc4 build: use more gnulib modules for simpler code
* .gnulib: Update to latest, for sigpipe and sigaction modules.
* bootstrap.conf (gnulib_modules): Add siaction, sigpipe, strerror_r.
* tools/virsh.c (vshSetupSignals) [!SIGPIPE]: Delete, now that
gnulib guarantees it.
(SA_SIGINFO): Define for mingw fallback.
* src/util/virterror.c (virStrerror): Simplify, now that gnulib
guarantees the POSIX interface.
* configure.ac (AC_CHECK_FUNCS_ONCE): Drop redundant check.
(AM_PROG_CC_STDC): Move earlier, to keep autoconf happy.
2011-01-18 15:35:41 -07:00
915bc7421e Remove two unused PATH_MAX-sized char arrays from the stack 2011-01-18 23:14:37 +01:00
e065e1ea04 Use VIR_ERR_OPERATION_INVALID when appropriated
VIR_ERR_OPERATION_INVALID means that the operation is not valid
for the current state of the involved object.
2011-01-18 23:14:37 +01:00
8c6d61162f Fix misuse of VIR_ERR_INVALID_* error code
VIR_ERR_INVALID_* is meant for invalid pointers only.
2011-01-18 23:14:37 +01:00
2c0db5b5dc Simplify "NWFilterPool" to "NWFilter"
The public object is called NWFilter but the corresponding private
object is called NWFilterPool. I don't see compelling reasons for this
Pool suffix. One might argue that an NWFilter is a "pool" of rules, etc.

Remove the Pool suffix from NWFilterPool. No functional change included.
2011-01-18 23:14:37 +01:00
f002e9218d datatypes: Fix outdated function names in the documentation 2011-01-18 23:14:37 +01:00
b75fab32ec Add documentation for VIR_DOMAIN_MEMORY_PARAM_UNLIMITED
Otherwise apibuild.py complains about it.
2011-01-18 23:14:37 +01:00
6916cfd7dd datatypes: Get virSecretFreeName in sync with the other free functions 2011-01-18 23:14:37 +01:00
a50a22df45 docs: Move the "Network Filtering" page one level up in the hierarchy
"Network Filtering" is not directly related to "Networks".

Suggested by Daniel P. Berrange.
2011-01-18 23:14:37 +01:00
5d6eb0efaf docs: add buildbot to the apps page 2011-01-19 09:03:34 +11:00
93681a3683 qemu: don't fail capabilities check on 0.12.x
Fixes regression introduced in commit 2211518, where all qemu 0.12.x
fails to start, as does qemu 0.13.x lacking the pci-assign device.
Prior to 2211518, the code was just ignoring a non-zero exit status
from the qemu child, but the virCommand code checked this to avoid
masking any other issues, which means the real bug of provoking
non-zero exit status has been latent for a longer time.

* src/qemu/qemu_capabilities.c (qemuCapsExtractVersionInfo): Check
for -device driver,? support.
(qemuCapsExtractDeviceStr): Avoid failure if all probed devices
are unsupported.
Reported by Ken Congyang.
2011-01-18 14:45:53 -07:00
2a2e0a8801 docs: add new conversion heading to the apps listing 2011-01-19 08:21:03 +11:00
6c92960d3c docs: updated windows page for new 0.8.7 installer 2011-01-19 05:00:44 +11:00
1859939a74 qemu: use -incoming fd:n to avoid qemu holding fd indefinitely
https://bugzilla.redhat.com/show_bug.cgi?id=620363

When using -incoming stdio or -incoming exec:, qemu keeps the
stdin fd open long after the migration is complete.  Not to
mention that exec:cat is horribly inefficient, by doubling the
I/O and going through a popen interface in qemu.

The new -incoming fd: of qemu 0.12.0 closes the fd after using
it, and allows us to bypass an intermediary cat process for
less I/O.

* src/qemu/qemu_command.h (qemuBuildCommandLine): Add parameter.
* src/qemu/qemu_command.c (qemuBuildCommandLine): Support
migration via fd: when possible.  Consolidate migration handling
into one spot, now that it is more complex.
* src/qemu/qemu_driver.c (qemudStartVMDaemon): Update caller.
* tests/qemuxml2argvtest.c (mymain): Likewise.
* tests/qemuxml2argvdata/qemuxml2argv-restore-v2-fd.args: New file.
* tests/qemuxml2argvdata/qemuxml2argv-restore-v2-fd.xml: Likewise.
2011-01-17 09:24:41 -07:00
e182ba872b tests: Add tests for per-device boot elements 2011-01-17 17:18:56 +01:00
3d44035824 qemu: Support per-device boot ordering
Support for this is included in qemu and seabios from upstream git.
2011-01-17 17:08:13 +01:00
94234fa2f8 Introduce per-device boot element
Currently, boot order can be specified per device class but there is no
way to specify exact disk/NIC device to boot from.

This patch adds <boot order='N'/> element which can be used inside
<disk/> and <interface/>. This is incompatible with the older os/boot
element. Since not all hypervisors support per-device boot
specification, new deviceboot flag is included in capabilities XML for
hypervisors which understand the new boot element. Presence of the flag
allows (but doesn't require) users to use the new style boot order
specification.
2011-01-17 17:08:13 +01:00
f5456ffd9d conf: Move boot parsing into a separate function 2011-01-17 17:08:13 +01:00
7f193757ef build: let xgettext see strings in libvirt-guests
* tools/libvirt-guests.init.in: Rename...
* tools/libvirt-guests.init.sh: ...so that xgettext's language
detection via suffix will work.
* po/POTFILES.in: Update all references.
* tools/Makefile.am (EXTRA_DIST, libvirt-guests.init): Likewise.
2011-01-17 07:48:17 -07:00
a9e31a4769 libvirt-guests: remove bashisms
* tools/libvirt-guests.init.sh: Use only POSIX shell features, which
includes using gettext.sh for translation rather than $"".
* tools/Makefile.am (libvirt-guests.init): Supply a few more substitutions.
* po/POTFILES.in: Mark that libvirt-guests.init needs translation.

Signed-off-by: Eric Blake <eblake@redhat.com>
2011-01-17 07:48:17 -07:00
8ea5bccafc A couple of fixes for the search PHP code 2011-01-17 16:55:41 +08:00
ed25dcc2c1 tests: Remove obsolete secaatest
Before the security driver was refactored in d6623003 seclabeltest and
secaatest were basically the same. seclabeltest was meant for SELinux
and secaatest for AppArmor. Both tests exited early when the specific
security driver backend wasn't enabled.

With the new security manager trying to initialize a disabled security
driver backend is an error that can't be distinguished from other errors
anymore. Therefore, the updated seclabeltest just asks for the first
available backend as this will always work even with SELinux and AppArmor
backend being disabled due to the new Nop backend.

Remove the obsolete secaatest and compile and run the seclabeltest
unconditional.

This fixes make check on systems that support AppArmor.
2011-01-15 23:36:31 +01:00
2095dc39af virsh: Use WITH_SECDRIVER_APPARMOR to detect AppArmor support
There is no ENABLE_SECDRIVER_APPARMOR.
2011-01-15 18:52:36 +01:00
d94a14f89d memtune: Let virsh know the unlimited value for memory tunables
Display or set unlimited values for memory parameters. Unlimited is
represented by INT64_MAX in memory cgroup.

Signed-off-by: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>
Reported-by: Justin Clift <jclift@redhat.com>
2011-01-14 17:17:27 -07:00
63dbc84a88 maint: improve sc_prohibit_strncmp syntax check
* .gnulib: Update, for sc_prohibit_strcmp fix.
* cfg.mk: Adjust copyright; the only FSF portions come from when
this file was copied from coreutils.
(sc_prohibit_strncmp): Copy bug-fixes from sc_prohibit_strcmp.
* .x-sc_prohibit_strcmp: Delete, now that rule is smarter.
* .x-sc_prohibit_strncmp: Likewise.
* Makefile.am (syntax_check_exceptions): Track deletion.
2011-01-14 15:39:05 -07:00
d9b0494779 datatypes: avoid redundant __FUNCTION__
virLibConnError already includes __FUNCTION__ in its output, so we
were redundant.  Furthermore, clang warns that __FUNCTION__ is not
a string literal (at least __FUNCTION__ will never contain %, so
it was not a security risk).

* src/datatypes.c: Replace __FUNCTION__ with a descriptive string.
2011-01-14 15:36:38 -07:00
fe053dbea7 Enable tuning of qemu network tap device "sndbuf" size
This is in response to a request in:

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

In short, under heavy load, it's possible for qemu's networking to
lock up due to the tap device's default 1MB sndbuf being
inadequate. adding "sndbuf=0" to the qemu commandline -netdevice
option will alleviate this problem (sndbuf=0 actually sets it to
0xffffffff).

Because we must be able to explicitly specify "0" as a value, the
standard practice of "0 means not specified" won't work here. Instead,
virDomainNetDef also has a sndbuf_specified, which defaults to 0, but
is set to 1 if some value was given.

The sndbuf value is put inside a <tune> element of each <interface> in
the domain. The intent is that further tunable settings will also be
placed inside this element.

     <interface type='network'>
       ...
       <tune>
         <sndbuf>0</sndbuf>
       ...
       </tune>
     </interface>
2011-01-14 14:46:38 -05:00
175077fd70 Add XML config switch to enable/disable vhost-net support
This patch is in response to

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

The existing libvirt support for the vhost-net backend to the virtio
network driver happens automatically - if the vhost-net device is
available, it is always enabled, otherwise the standard userland
virtio backend is used.

This patch makes it possible to force whether or not vhost-net is used
with a bit of XML. Adding a <driver> element to the interface XML, eg:

     <interface type="network">
       <model type="virtio"/>
       <driver name="vhost"/>

will force use of vhost-net (if it's not available, the domain will
fail to start). if driver name="qemu", vhost-net will not be used even
if it is available.

If there is no <driver name='xxx'/> in the config, libvirt will revert
to the pre-existing automatic behavior - use vhost-net if it's
available, and userland backend if vhost-net isn't available.
2011-01-14 14:46:21 -05:00
9d73efdbe3 Use the new set_password monitor command to set password.
We try to use that command first when setting a VNC/SPICE password. If
that doesn't work we fallback to the legacy VNC only password

Allow an expiry time to be set, if that doesn't work, throw an error
if they try to use SPICE.

Change since v1:
- moved qemuInitGraphicsPasswords to qemu_hotplug, renamed
  to qemuDomainChangeGraphicsPasswords.
- updated what looks like a typo (that appears to work anyway) in
  initial patch from Daniel:
    - ret = qemuInitGraphicsPasswords(driver, vm,
    -                                 VIR_DOMAIN_GRAPHICS_TYPE_SPICE,
    -                                 &vm->def->graphics[0]->data.vnc.auth,
    -                                 driver->vncPassword);
    + ret = qemuInitGraphicsPasswords(driver, vm,
    +                                 VIR_DOMAIN_GRAPHICS_TYPE_SPICE,
    +                                 &vm->def->graphics[0]->data.spice.auth,
    +                                 driver->spicePassword);

Based on patch by Daniel P. Berrange <berrange@redhat.com>.
2011-01-14 12:36:00 -07:00
4d099bc06c qemu: add set_password and expire_password monitor commands 2011-01-14 12:35:42 -07:00
094c6f4a24 Fix 'make check' after commit 04197350
I broke 'make check' with commit 04197350 by unconditionally
emitting 'hap=' in xen xm driver.  Only emit 'hap=' if
xendConfigVersion >= 3.  I've tested sending 'hap=' to a Xen 3.2
machine without support for hap setting and verified that xend
silently drops the unrecognized setting.
2011-01-14 11:49:52 -07:00
30b9e608c6 qemu: move monitor device out of domain_conf common code
* src/conf/domain_conf.h (virDomainChrDeviceType): Drop monitor.
* src/conf/domain_conf.c (virDomainChrDevice)
(virDomainChrDefParseTargetXML, virDomainChrDefFormat): Drop
monitor support.
* src/qemu/qemu_command.h (qemuBuildCommandLine): Alter signature.
* src/qemu/qemu_monitor.h (qemuMonitorOpen): Likewise.
* src/qemu/qemu_domain.h (_qemuDomainObjPrivate): Change type of
monConfig.
* src/qemu/qemu_domain.c (qemuDomainObjPrivateFree)
(qemuDomainObjPrivateXMLFormat, qemuDomainObjPrivateXMLParse):
Adjust to type change.
* src/qemu/qemu_command.c (qemuBuildCommandLine): Likewise.
* src/qemu/qemu_driver.c (qemuPrepareMonitorChr)
(qemudStartVMDaemon, qemuDomainXMLToNative, qemuConnectMonitor)
(qemudShutdownVMDaemon): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
* src/qemu/qemu_monitor.c (qemuMonitorOpen): Likewise.
* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Likewise.
2011-01-14 09:54:26 -07:00
98334e7c3a domain_conf: split source data out from ChrDef
This opens up the possibility of reusing the smaller ChrSourceDef
for both qemu monitor and a passthrough smartcard device.

* src/conf/domain_conf.h (_virDomainChrDef): Factor host
details...
(_virDomainChrSourceDef): ...into new struct.
(virDomainChrSourceDefFree): New prototype.
* src/conf/domain_conf.c (virDomainChrDefFree)
(virDomainChrDefParseXML, virDomainChrDefFormat): Split...
(virDomainChrSourceDefClear, virDomainChrSourceDefFree)
(virDomainChrSourceDefParseXML, virDomainChrSourceDefFormat):
...into new functions.
(virDomainChrDefParseTargetXML): Update clients to reflect type
split.
* src/vmx/vmx.c (virVMXParseSerial, virVMXParseParallel)
(virVMXFormatSerial, virVMXFormatParallel): Likewise.
* src/xen/xen_driver.c (xenUnifiedDomainOpenConsole): Likewise.
* src/xen/xend_internal.c (xenDaemonParseSxprChar)
(xenDaemonFormatSxprChr): Likewise.
* src/vbox/vbox_tmpl.c (vboxDomainDumpXML, vboxAttachSerial)
(vboxAttachParallel): Likewise.
* src/security/security_dac.c (virSecurityDACSetChardevLabel)
(virSecurityDACSetChardevCallback)
(virSecurityDACRestoreChardevLabel)
(virSecurityDACRestoreChardevCallback): Likewise.
* src/security/security_selinux.c (SELinuxSetSecurityChardevLabel)
(SELinuxSetSecurityChardevCallback)
(SELinuxRestoreSecurityChardevLabel)
(SELinuxSetSecurityChardevCallback): Likewise.
* src/security/virt-aa-helper.c (get_files): Likewise.
* src/lxc/lxc_driver.c (lxcVmStart, lxcDomainOpenConsole):
Likewise.
* src/uml/uml_conf.c (umlBuildCommandLineChr): Likewise.
* src/uml/uml_driver.c (umlIdentifyOneChrPTY, umlIdentifyChrPTY)
(umlDomainOpenConsole): Likewise.
* src/qemu/qemu_command.c (qemuBuildChrChardevStr)
(qemuBuildChrArgStr, qemuBuildCommandLine)
(qemuParseCommandLineChr): Likewise.
* src/qemu/qemu_domain.c (qemuDomainObjPrivateXMLFormat)
(qemuDomainObjPrivateXMLParse): Likewise.
* src/qemu/qemu_cgroup.c (qemuSetupChardevCgroup): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
* src/qemu/qemu_driver.c (qemudFindCharDevicePTYsMonitor)
(qemudFindCharDevicePTYs, qemuPrepareChardevDevice)
(qemuPrepareMonitorChr, qemudShutdownVMDaemon)
(qemuDomainOpenConsole): Likewise.
* src/qemu/qemu_command.h (qemuBuildChrChardevStr)
(qemuBuildChrArgStr): Delete, now that they are static.
* src/libvirt_private.syms (domain_conf.h): New exports.
* cfg.mk (useless_free_options): Update list.
* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Update
tests.
2011-01-14 09:54:26 -07:00
d4d5cccdf2 cpu: Add support for Westmere CPU model 2011-01-14 17:28:42 +01:00
f892f5a562 qemu: improve device flag parsing
* src/qemu/qemu_capabilities.h (qemuCapsParseDeviceStr): New
prototype.
* src/qemu/qemu_capabilities.c (qemuCapsParsePCIDeviceStrs)
Rename and split...
(qemuCapsExtractDeviceStr, qemuCapsParseDeviceStr): ...to make it
easier to add and test device-specific checks.
(qemuCapsExtractVersionInfo): Update caller.
* tests/qemuhelptest.c (testHelpStrParsing): Also test parsing of
device-related flags.
(mymain): Update expected flags.
* tests/qemuhelpdata/qemu-0.12.1-device: New file.
* tests/qemuhelpdata/qemu-kvm-0.12.1.2-rhel60-device: New file.
* tests/qemuhelpdata/qemu-kvm-0.12.3-device: New file.
* tests/qemuhelpdata/qemu-kvm-0.13.0-device: New file.
2011-01-13 16:03:11 -07:00
1ff03b28e9 util: add missing string->integer conversion functions
It was awkward having only int conversion in the virStrToLong family,
but only long conversion in the virXPath family.  Make both families
support both types.

* src/util/util.h (virStrToLong_l, virStrToLong_ul): New
prototypes.
* src/util/xml.h (virXPathInt, virXPathUInt): Likewise.
* src/util/util.c (virStrToLong_l, virStrToLong_ul): New
functions.
* src/util/xml.c (virXPathInt, virXPathUInt): Likewise.
* src/libvirt_private.syms (util.h, xml.h): Export them.
2011-01-13 15:10:40 -07:00
efc892ad6f docs: clarify virsh setvcpus and setmem usage with active domains
Addresses BZ # 622534:

  https://bugzilla.redhat.com/show_bug.cgi?id=622534
2011-01-14 07:48:43 +11:00
221151813c qemu: convert capabilities to use virCommand
* src/qemu/qemu_capabilities.c (qemuCapsProbeMachineTypes)
(qemuCapsProbeCPUModels, qemuCapsParsePCIDeviceStrs)
(qemuCapsExtractVersionInfo): Use virCommand rather than virExec.
2011-01-13 11:05:36 -07:00
6935a1e289 virsh: ensure --maximum flag used only with --config for setvcpus 2011-01-13 11:02:59 -07:00
79f56c669f Document HAP domain feature
Add HAP feature to schema and documentation.
2011-01-13 09:30:26 -07:00
af521a0182 Add HAP to xen hypervisor capabilities
xen-unstable c/s 16931 introduced a per-domain setting for hvm
guests to enable/disable hardware assisted paging.  If disabled,
software techniques such as shadow page tables are used.  If enabled,
and the feature exists in underlying hardware, hardware support for
paging is used.

Xen does not provide a mechanism to discover the HAP capability, so
we advertise its availability for hvm guests on Xen >= 3.3.
2011-01-13 09:30:26 -07:00
041973504f Add support for HAP feature to xen drivers
xen-unstable c/s 16931 introduced a per-domain setting for hvm
guests to enable/disable hardware assisted paging.  If disabled,
software techniques such as shadow page tables are used.  If enabled,
and the feature exists in underlying hardware, hardware support for
paging is used.

This provides implementation for mapping HAP setting to/from
domxml/native formats in xen drivers.
2011-01-13 09:30:26 -07:00
48a5dccda9 Add HAP to virDomainFeature enum
Extend the virDomainFeature enumeration to include HAP (hardware
assisted paging) feature.

Hardware features such as Extended Page Table and Nested Page
Table augment hypervisor software techniques such as shadow
page table.  Adding HAP to the virDomainFeature enumeration
allows users to select between hardware and software memory
management mechanisms for their guests.
2011-01-13 09:30:26 -07:00
90c2a13846 tests: virsh is no longer in builddir/src
Commit 870dba0 (Mar 2008) added builddir/src to PATH to pick
up virsh.  Later, virsh was moved to tools; commit db68d6b
(Oct 2009) noticed this, but only added the new location rather
than deleting the old location.

* tests/Makefile.am (path_add): Drop now-useless directory.
Suggested by Daniel P. Berrange.
2011-01-13 08:11:00 -07:00
9ae992f243 virFindFileInPath: only find executable non-directory
Without this patch, at least tests/daemon-conf (which sticks
$builddir/src in the PATH) tries to execute the directory
$builddir/src/qemu rather than a real qemu binary.

* src/util/util.h (virFileExists): Adjust prototype.
(virFileIsExecutable): New prototype.
* src/util/util.c (virFindFileInPath): Reject non-executables and
directories.  Avoid huge stack allocation.
(virFileExists): Use lighter-weight syscall.
(virFileIsExecutable): New function.
* src/libvirt_private.syms (util.h): Export new function.
2011-01-13 08:10:55 -07:00
657cd084a9 Fix old PHP syntax in the search online form 2011-01-13 14:09:13 +08:00
724a297dfb build: restore mingw build
* bootstrap.conf (gnulib_modules): Add chown.
2011-01-12 17:46:29 -07:00
c18df0b7c5 esx: Fix memory leak in HostSystem managed object free function 2011-01-12 22:38:42 +01:00
85347321b3 docs: fix trivial typos in currentMemory description 2011-01-13 08:33:09 +11:00
2fd1a2525b doc: improve the documentation of desturi
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-01-12 09:52:51 -07:00
59d13aae32 report error when specifying wrong desturi
When we do peer2peer migration, the dest uri is an address of the
target host as seen from the source machine. So we must specify
the ip or hostname of target host in dest uri. If we do not specify
it, report an error to the user.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-01-12 09:52:51 -07:00
0444ce1b00 qemu: Reject SDL graphic if it's not supported by qemu
If the emulator doesn't support SDL graphic, we should reject
the use of SDL graphic xml with error messages, but not ignore
it silently, and pretend things are fine.

"-sdl" flag was exposed explicitly by qemu since 0.10.0, more detail:
http://www.redhat.com/archives/libvir-list/2011-January/msg00442.html

And we already have capability flag "QEMUD_CMD_FLAG_0_10", which
could be used to prevent the patch affecting the older versions
of QEMU.

* src/qemu/qemu_command.c
2011-01-12 09:52:51 -07:00
c7f6d6fcc9 docs: reorder apps page alphabetically, plus add libguestfs entries 2011-01-13 01:24:42 +11:00
e90014e16c docs: add entry for archipel to the apps page 2011-01-12 08:03:28 +11:00
3cc872d982 docs: use xml entity encoding for extended character last name 2011-01-12 08:00:15 +11:00
e4570729ee vbox: Silently ignore missing registry key on Windows
Don't report an error when the VirtualBox registry key is missing,
as this just indicates that VirtualBox is not installed in general.

This matches the behavior of the XPCOM glue that silently ignores
a missing VBoxXPCOMC.so.
2011-01-11 20:56:25 +01:00
feddaf1dc8 qemu: Watchdog IB700 is not a PCI device (RHBZ#667091).
Skip IB700 when assigning PCI slots.

Note: the I6300ESB watchdog _is_ a PCI device.

To test this: I applied this patch to libvirt-0.8.3-2.fc14 (rebasing
it slightly: qemu_command.c didn't exist in that version) and
installed this on my machine, then tested that I could successfully
add an ib700 watchdog device to a guest, start the guest, and the
ib700 was available to the guest.  I also added an i6300esb (PCI)
watchdog to another guest, and verified that libvirt assigned a PCI
device to it, that the guest could be started, and that i6300esb was
present in the guest.

Note that if you previously had a domain with a ib700 watchdog, it
would have had an <address type='pci' .../> clause added to it in the
libvirt configuration.  This patch does not attempt to remove this.
You cannot start such a domain -- qemu gives an error if you try.
With this patch you are able to remove the bogus address element
without libvirt adding it back.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
2011-01-11 08:28:54 -07:00
fae1b8aac4 cpu: plug memory leak
* src/cpu/cpu_x86.c (x86ModelLoad): Free data before overwriting.
2011-01-10 16:57:54 -07:00
6e2bab80c8 network: plug memory leak
* src/conf/network_conf.c (virNetworkDefParseXML): Release ipNodes.
2011-01-10 15:35:37 -07:00
243b7814c7 network: plug unininitialized read found by valgrind
* src/util/network.c (virSocketAddrMask): Zero out port, so that
iptables can initialize just the netmask then call
virSocketFormatAddr without an uninitialized read in getnameinfo.
2011-01-10 15:22:57 -07:00
718a8dc6dd docs: updated memtune info again in virsh command reference 2011-01-11 07:33:15 +11:00
4254dfea78 python: Use PyCapsule API if available
On Fedore 14, virt-manager spews a bunch of warnings to the console:

/usr/lib64/python2.7/site-packages/libvirt.py:1781: PendingDeprecationWarning: The CObject type is marked Pending Deprecation in Python 2.7.  Please use capsule objects instead.

Have libvirt use the capsule API if available. I've verified this compiles
fine on older python (2.6 in RHEL6 which doesn't have capsules), and
virt-manager seems to function fine.
2011-01-10 15:18:05 -05:00
8f3b6bc2dd event-test: Simplify debug on/off
Make it easy to change debugging if being used by a client program.
2011-01-10 14:44:04 -05:00
1dd5c7f2df remote: Don't lose track of events when callbacks are slow
After the remote driver runs an event callback, it unconditionally disables the
loop timer, thinking it just flushed every queued event. This doesn't work
correctly though if an event is queued while a callback is running.

The events actually aren't being lost, it's just that the event loop didn't
think there was anything that needed to be dispatched. So all those 'lost
events' should actually get re-triggered if you manually kick the loop by
generating a new event (like creating a new guest).

The solution is to disable the dispatch timer _before_ we invoke any event
callbacks. Events queued while a callback is running will properly reenable the
timer.

More info at https://bugzilla.redhat.com/show_bug.cgi?id=624252
2011-01-10 14:44:03 -05:00
d6623003c6 Refactor the security drivers to simplify usage
The current security driver usage requires horrible code like

    if (driver->securityDriver &&
        driver->securityDriver->domainSetSecurityHostdevLabel &&
        driver->securityDriver->domainSetSecurityHostdevLabel(driver->securityDriver,
                                                              vm, hostdev) < 0)

This pair of checks for NULL clutters up the code, making the driver
calls 2 lines longer than they really need to be. The goal of the
patchset is to change the calling convention to simply

  if (virSecurityManagerSetHostdevLabel(driver->securityDriver,
                                        vm, hostdev) < 0)

The first check for 'driver->securityDriver' being NULL is removed
by introducing a 'no op' security driver that will always be present
if no real driver is enabled. This guarentees driver->securityDriver
!= NULL.

The second check for 'driver->securityDriver->domainSetSecurityHostdevLabel'
being non-NULL is hidden in a new abstraction called virSecurityManager.
This separates the driver callbacks, from main internal API. The addition
of a virSecurityManager object, that is separate from the virSecurityDriver
struct also allows for security drivers to carry state / configuration
information directly. Thus the DAC/Stack drivers from src/qemu which
used to pull config from 'struct qemud_driver' can now be moved into
the 'src/security' directory and store their config directly.

* src/qemu/qemu_conf.h, src/qemu/qemu_driver.c: Update to
  use new virSecurityManager APIs
* src/qemu/qemu_security_dac.c,  src/qemu/qemu_security_dac.h
  src/qemu/qemu_security_stacked.c, src/qemu/qemu_security_stacked.h:
  Move into src/security directory
* src/security/security_stack.c, src/security/security_stack.h,
  src/security/security_dac.c, src/security/security_dac.h: Generic
  versions of previous QEMU specific drivers
* src/security/security_apparmor.c, src/security/security_apparmor.h,
  src/security/security_driver.c, src/security/security_driver.h,
  src/security/security_selinux.c, src/security/security_selinux.h:
  Update to take virSecurityManagerPtr object as the first param
  in all callbacks
* src/security/security_nop.c, src/security/security_nop.h: Stub
  implementation of all security driver APIs.
* src/security/security_manager.h, src/security/security_manager.c:
  New internal API for invoking security drivers
* src/libvirt.c: Add missing debug for security APIs
2011-01-10 18:10:52 +00:00
92d6530106 conf: Report error if invalid type specified for character device
If invalid type is specified, e.g.
<serial type='foo'>
    <target port='0'/>
</serial>

We replace 'foo' with "null" type implicitly, without reporting an
error message to tell the user, and "start" or "edit" the domain
will be success.

It's not good to guess what the user wants, This patch is to fix
the problem.

* src/conf/domain_conf.c
2011-01-10 10:24:44 -07:00
5e5acbc8d6 daemon: Fix core dumps if unix_sock_group is set
Setting unix_sock_group to something else than default "root" in
/etc/libvirt/libvirtd.conf prevents system libvirtd from dumping core on
crash. This is because we used setgid(unix_sock_group) before binding to
/var/run/libvirt/libvirt-sock* and setgid() back to original group.
However, if a process changes its effective or filesystem group ID, it
will be forbidden from leaving core dumps unless fs.suid_dumpable sysctl
is set to something else then 0 (and it is 0 by default).

Changing socket's group ownership after bind works better. And we can do
so without introducing a race condition since we loosen access rights by
changing the group from root to something else.
2011-01-10 11:01:46 +01:00
dda24845fe Add AM_MAINTAINER_MODE
and keep it enabled by default. This allows downstreams to turn it off
via:

./configure --disable-maintainer-mode

as discussed in

https://www.redhat.com/archives/virt-tools-list/2010-October/msg00049.html
2011-01-07 20:22:24 +01:00
dd1f59a9e5 esx: Move occurrence check into esxVI_LookupObjectContentByType
This simplifies the callers of esxVI_LookupObjectContentByType.
2011-01-07 20:09:15 +01:00
3d4f6eeeae esx: Add domain autostart support 2011-01-06 22:51:32 +01:00
d86ce05797 commandtest: avoid printing loader-control variables from commandhelper
This avoids throwing the tests off if LD_LIBRARY_PATH or LD_PRELOAD or
other variables are set.

Signed-off-by: Diego Elio Pettenò <flameeyes@gmail.com>
2011-01-06 14:21:17 -07:00
d96fddee1d docs: updated release of virsh cmd reference, with memtune info 2011-01-07 05:37:23 +11:00
c2a6b26647 vmx: Add support for video device VRAM size
Update test suite accordingly.
2011-01-06 18:18:35 +01:00
4283bcb0fd vbox: Use correct VRAM size unit
VirtualBox uses megabyte, libvirt uses kilobyte.
2011-01-06 18:18:35 +01:00
a98d8f0d27 API: Improve log for domain related APIs
Add VM name/UUID in log for domain related APIs.
Format: "dom=%p, (VM: name=%s, uuid=%s), param0=%s, param1=%s

*src/libvirt.c (introduce two macros: VIR_DOMAIN_DEBUG, and
VIR_DOMAIN_DEBUG0)
2011-01-06 09:45:40 -07:00
2d44cb4960 schema: tighten <serial><protocol type=...> relaxNG
* docs/schemas/domain.rng (qemucdevSrcDef): Restrict list of
supported <protocol type=> values.
2011-01-06 08:15:50 -07:00
a43c7338d8 bridge: Fix generation of dnsmasq's --dhcp-hostsfile option
I added a host definition to a network definition:

<network>
  <name>Lokal</name>
  <uuid>2074f379-b82c-423f-9ada-305d8088daaa</uuid>
  <bridge name='virbr1' stp='on' delay='0' />
  <ip address='192.168.180.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.180.128' end='192.168.180.254' />
      <host mac='23:74:00:03:42:02' name='somevm' ip='192.168.180.10' />
    </dhcp>
  </ip>
</network>

But due to the wrong if-statement the argument --dhcp-hostsfile doesn't get
added to the dnsmasq command. The patch below fixes it for me.
2011-01-06 15:58:23 +01:00
4684f478e4 qemu: Fix bogus warning about uninitialized saveptr
The warning is bogus since strtok_r doesn't use the value when it's
first called and initializes it for the following calls.
2011-01-06 09:25:34 +01:00
a691cb88f2 Don't chown qemu saved image back to root after save if dynamic_ownership=0
When dynamic_ownership=0, saved images must be owned by the same uid
as is used to run the qemu process, otherwise restore won't work. To
accomplish this, qemuSecurityDACRestoreSavedStateLabel() needs to
simply return when it's called.

This fix is in response to:

  https://bugzilla.redhat.com/show_bug.cgi?id=661720
2011-01-05 20:22:19 -05:00
1000d9c2b0 maint: document dislike of mismatched if/else bracing
* docs/hacking.html.in (Curly braces): Tighten recommendations to
disallow if (cond) one-line; else { block; }.
* HACKING: Regenerate.
Suggested by Daniel P. Berrange.
2011-01-05 11:05:28 -07:00
cd6a8f9ce2 Log an error on attempts to add a NAT rule for non-IPv4 addresses
Although the upper-layer code protected against it, it was possible to
call iptablesForwardMasquerade() with an IPv6 address and have it
attempt to add a rule to the MASQUERADE chain of ip6tables (which
doesn't exist).

This patch changes that function to check the protocol of the given
address, generate an error log if it's not IPv4 (AF_INET), and finally
hardcodes all the family parameters sent down to lower-level functions.
2011-01-05 11:59:47 -05:00
6741ca36bd Improve error reporting when parsing dhcp info for virtual networks
This is partially in response to

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

The crash in that report was coincidentally fixed when we switched
from using inet_pton() to using virSocketParseAddr(), but the absence
of an ip address in a dhcp static host definition was still silently
ignored (and that entry discarded from the saved XML). This patch
turns that into a logged failure; likewise if the entry has neither a
mac address nor a name attribute (the entry is useless without at
least one of those, plus an ip address).

Since the network name is now pulled into this function in order for
those error logs to be more informative, the other error messages in
the function have also been changed to take advantage.
2011-01-05 11:59:34 -05:00
6ea4c85919 docs: added libvirt-announce to contact page
Also added explicit links to the subscription and
archive pages for the user and developer mailing
lists.
2011-01-05 18:07:30 +11:00
0922ff2fea qemu driver: fix positioning to end of log file
While doing some testing with Qemu and creating huge logfiles I encountered the case where the VM could not start anymore due to the lseek() to the end of the Qemu VM's log file failing. The patch below fixes the problem by replacing the previously used 'int' with 'off_t'.

To reproduce this error, you could do the following:

dd if=/dev/zero of=/var/log/libvirt/qemu/<name of VM>.log bs=1024 count=$((1024*2048))

and you should get an error like this:

error: Failed to start domain <name of VM>
error: Unable to seek to -2147482651 in /var/log/libvirt/qemu/<name of VM>.log: Success
2011-01-04 12:46:10 -05:00
45829e678e build: satisfy 'make syntax-check' regarding year change
* .gnulib: Update to latest, to pick up 2011 copyrights.
2011-01-04 09:50:07 -07:00
911 changed files with 615553 additions and 492532 deletions

View File

@ -5,4 +5,10 @@
(c-indent-level . 4) (c-indent-level . 4)
(c-basic-offset . 4) (c-basic-offset . 4)
)) ))
(html-mode . (
(indent-tabs-mode . nil)
))
(sh-mode . (
(indent-tabs-mode . nil)
))
) )

16
.gitignore vendored
View File

@ -1,7 +1,3 @@
!/m4/compiler-flags.m4
!/po/*.po
!/po/POTFILES.in
!/po/libvirt.pot
*#*# *#*#
*.#*# *.#*#
*.a *.a
@ -15,6 +11,7 @@
*~ *~
.git .git
.git-module-status .git-module-status
.lvimrc
.sc-start-sc_* .sc-start-sc_*
/ABOUT-NLS /ABOUT-NLS
/COPYING /COPYING
@ -26,6 +23,7 @@
/autom4te.cache /autom4te.cache
/build-aux /build-aux
/build-aux/ /build-aux/
/build/
/config.cache /config.cache
/config.guess /config.guess
/config.h /config.h
@ -44,14 +42,16 @@
/libvirt.spec /libvirt.spec
/ltconfig /ltconfig
/ltmain.sh /ltmain.sh
/m4/ /m4/*
/maint.mk /maint.mk
/mingw32-libvirt.spec /mingw32-libvirt.spec
/mkinstalldirs /mkinstalldirs
/po/ /po/*
/proxy/ /proxy/
/src/libvirt_iohelper
/tests/*.log /tests/*.log
/tests/cputest /tests/cputest
/tests/hashtest
/tests/nwfilterxml2xmltest /tests/nwfilterxml2xmltest
/update.log /update.log
Makefile Makefile
@ -64,3 +64,7 @@ results.log
stamp-h stamp-h
stamp-h.in stamp-h.in
stamp-h1 stamp-h1
!/m4/virt-*.m4
!/po/*.po
!/po/POTFILES.in
!/po/libvirt.pot

Submodule .gnulib updated: ce083ca023...3864a29763

View File

@ -1,3 +1,6 @@
# Format of each line:
# <Preferred address in AUTHORS> <other alias used by same author>
<amy.griffis@hp.com> <aron.griffis@hp.com> <amy.griffis@hp.com> <aron.griffis@hp.com>
<bozzolan@gmail.com> <redshift@gmx.com> <bozzolan@gmail.com> <redshift@gmx.com>
<charles_duffy@messageone.com> <charles@dyfis.net> <charles_duffy@messageone.com> <charles@dyfis.net>
@ -14,3 +17,5 @@
<jclift@redhat.com> <justin@salasaga.org> <jclift@redhat.com> <justin@salasaga.org>
<berrange@redhat.com> <dan@berrange.com> <berrange@redhat.com> <dan@berrange.com>
<soren@linux2go.dk> <soren@canonical.com> <soren@linux2go.dk> <soren@canonical.com>
<cfergeau@redhat.com> <teuf@gnome.org>
<wency@cn.fujitsu.com> <wency cn fujitsu com>

View File

@ -1 +0,0 @@
^gnulib/.*

View File

@ -1 +0,0 @@
^ChangeLog

View File

@ -1,9 +0,0 @@
^src/libvirt\.c$
^src/fdstream\.c$
^src/qemu/qemu_monitor\.c$
^src/util/command\.c$
^src/util/util\.c$
^src/xen/xend_internal\.c$
^daemon/libvirtd.c$
^gnulib/
^tools/console.c$

View File

@ -1,2 +0,0 @@
^tests/.*
^examples/.*

View File

@ -1 +0,0 @@
^gnulib/m4/intl\.m4$

View File

@ -1 +0,0 @@
^docs/

View File

@ -1 +0,0 @@
gnulib/.*

View File

@ -1,5 +0,0 @@
^ChangeLog$
^ChangeLog-old$
^include/libvirt/virterror\.h$
^daemon/dispatch\.c$
^src/util/virterror\.c$

View File

@ -1,4 +0,0 @@
ChangeLog*
docs/news.html.in
python/libvirt-override.c
python/typewrappers.c

View File

@ -1,5 +0,0 @@
ChangeLog
^bootstrap.conf$
^gnulib/
^po/
^src/util/util.c$

View File

@ -1,3 +0,0 @@
^docs/.*
^HACKING$
^src/util/files.c$

View File

@ -1,2 +0,0 @@
^docs/api_extension/.*
^tests/qemuhelpdata/.*

View File

@ -1,2 +0,0 @@
^gnulib/lib/getaddrinfo\.c$
^gnulib/m4/

View File

@ -1,2 +0,0 @@
^src/util/util\.c$
^ChangeLog-old$

View File

@ -1,2 +0,0 @@
ChangeLog*
docs/news.html.in

View File

@ -1 +0,0 @@
^gnulib/lib/strsep\.c$

View File

@ -1,10 +0,0 @@
^gnulib/
^po/
^ChangeLog$
^ChangeLog-old$
^Makefile*
^docs/
^tests/
^tools/virsh\.c$
^tools/console\.c$
^build-aux/

View File

@ -1,2 +0,0 @@
^src/util/util\.c$
^ChangeLog-old$

View File

@ -1,4 +0,0 @@
^docs/
^po/
^ChangeLog
^HACKING

View File

@ -1 +0,0 @@
^gnulib/

View File

@ -1 +0,0 @@
^src/internal\.h$

View File

@ -1,2 +0,0 @@
^src/util/util\.c$
^tools/virsh\.c$

View File

@ -1 +0,0 @@
docs/news.html.in

View File

@ -1 +0,0 @@
^src/util/xml.c$

View File

@ -1,4 +0,0 @@
^examples/
^gnulib/lib/dummy\.c$
^gnulib/tests/dummy\.c$
^ChangeLog$

View File

@ -1 +0,0 @@
^examples/

View File

@ -1,7 +0,0 @@
\.fig$
\.gif$
\.ico$
\.png$
^ChangeLog$
^NEWS$
^docs/.*

View File

@ -1,2 +0,0 @@
docs/apibuild.py
tests/virt-aa-helper-test

44
AUTHORS
View File

@ -10,25 +10,29 @@ The primary maintainers and people with commit access rights:
Daniel Veillard <veillard@redhat.com> Daniel Veillard <veillard@redhat.com>
Daniel Berrange <berrange@redhat.com> Daniel Berrange <berrange@redhat.com>
Richard W.M. Jones <rjones@redhat.com> Richard W.M. Jones <rjones@redhat.com>
Karel Zak <kzak@redhat.com>
Mark McLoughlin <markmc@redhat.com> Mark McLoughlin <markmc@redhat.com>
Anthony Liguori <aliguori@us.ibm.com> Anthony Liguori <aliguori@us.ibm.com>
Jim Meyering <meyering@redhat.com> Jim Meyering <meyering@redhat.com>
Jim Fehlig <jfehlig@novell.com> Jim Fehlig <jfehlig@novell.com>
Chris Lalancette <clalance@redhat.com> Chris Lalancette <clalance@redhat.com>
Atsushi SAKAI <sakaia@jp.fujitsu.com>
Dave Leskovec <dlesko@linux.vnet.ibm.com>
Cole Robinson <crobinso@redhat.com> Cole Robinson <crobinso@redhat.com>
Dan Smith <danms@us.ibm.com>
Guido Günther <agx@sigxcpu.org> Guido Günther <agx@sigxcpu.org>
John Levon <john.levon@sun.com> John Levon <john.levon@sun.com>
Matthias Bolte <matthias.bolte@googlemail.com> Matthias Bolte <matthias.bolte@googlemail.com>
Jiri Denemark <jdenemar@redhat.com> Jiří Denemark <jdenemar@redhat.com>
Dave Allan <dallan@redhat.com> Dave Allan <dallan@redhat.com>
Laine Stump <laine@redhat.com> Laine Stump <laine@redhat.com>
Stefan Berger <stefanb@us.ibm.com> Stefan Berger <stefanb@us.ibm.com>
Eric Blake <eblake@redhat.com> Eric Blake <eblake@redhat.com>
Justin Clift <jclift@redhat.com> Justin Clift <jclift@redhat.com>
Osier Yang <jyang@redhat.com>
Wen Congyang <wency@cn.fujitsu.com>
Previous maintainers:
Karel Zak <kzak@redhat.com>
Atsushi SAKAI <sakaia@jp.fujitsu.com>
Dave Leskovec <dlesko@linux.vnet.ibm.com>
Dan Smith <danms@us.ibm.com>
Patches have also been contributed by: Patches have also been contributed by:
@ -133,15 +137,39 @@ Patches have also been contributed by:
Lai Jiangshan <laijs@cn.fujitsu.com> Lai Jiangshan <laijs@cn.fujitsu.com>
Harsh Prateek Bora <harsh@linux.vnet.ibm.com> Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
John Morrissey <jwm@horde.net> John Morrissey <jwm@horde.net>
Osier Yang <jyang@redhat.com> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Wen Congyang <wency@cn.fujitsu.com>
Hu Tao <hutao@cn.fujitsu.com> Hu Tao <hutao@cn.fujitsu.com>
Laurent Léonard <laurent@open-minds.org> Laurent Léonard <laurent@open-minds.org>
MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Josh Durgin <joshd@hq.newdream.net> Josh Durgin <joshd@hq.newdream.net>
Roopa Prabhu <roprabhu@cisco.com> Roopa Prabhu <roprabhu@cisco.com>
Paweł Krześniak <pawel.krzesniak@gmail.com> Paweł Krześniak <pawel.krzesniak@gmail.com>
Kay Schubert <kayegypt@web.de>
Marc-André Lureau <marcandre.lureau@redhat.com>
Michal Prívozník <mprivozn@redhat.com>
Juerg Haefliger <juerg.haefliger@hp.com>
Matthias Dahl <mdvirt@designassembly.de>
Niels de Vos <ndevos@redhat.com>
Davidlohr Bueso <dave@gnu.org>
Alon Levy <alevy@redhat.com>
Hero Phương <herophuong93@gmail.com>
Zdenek Styblik <stybla@turnovfree.net>
Gui Jianfeng <guijianfeng@cn.fujitsu.com>
Michal Novotny <minovotn@redhat.com>
Christophe Fergeau <cfergeau@redhat.com>
Markus Groß <gross@univention.de>
Phil Petty <phpetty@cisco.com>
Taku Izumi <izumi.taku@jp.fujitsu.com>
Minoru Usui <usui@mxm.nes.nec.co.jp>
Tiziano Mueller <dev-zero@gentoo.org>
Thibault VINCENT <thibault.vincent@smartjog.com>
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Jesse Cook <code.crashenx@gmail.com>
Alexander Todorov <atodorov@otb.bg>
Richard Laager <rlaager@wiktel.com>
Mark Wu <dwu@redhat.com>
Yufang Zhang <yuzhang@redhat.com>
Supriya Kannery <supriyak@in.ibm.com>
[....send patches to get your name here....] [....send patches to get your name here....]

65
HACKING
View File

@ -87,6 +87,28 @@ If you use Emacs, add the following to one of one of your start-up files
'(lambda () (if (string-match "/libvirt" (buffer-file-name)) '(lambda () (if (string-match "/libvirt" (buffer-file-name))
(libvirt-c-mode)))) (libvirt-c-mode))))
If you use vim, append the following to your ~/.vimrc file:
set nocompatible
filetype on
set autoindent
set smartindent
set cindent
set tabstop=8
set shiftwidth=4
set expandtab
set cinoptions=(0,:0,l1,t0
filetype plugin indent on
au FileType make setlocal noexpandtab
au BufRead,BufNewFile *.am setlocal noexpandtab
match ErrorMsg /\s\+$\| \+\ze\t/
Or if you don't want to mess your ~/.vimrc up, you can save the above into a
file called .lvimrc (not .vimrc) located at the root of libvirt source, then
install a vim script from
http://www.vim.org/scripts/script.php?script_id=1408, which will load the
.lvimrc only when you edit libvirt code.
Code formatting (especially for new code) Code formatting (especially for new code)
========================================= =========================================
@ -105,6 +127,12 @@ Note that sometimes you'll have to post-process that output further, by piping
it through "expand -i", since some leading TABs can get through. Usually it through "expand -i", since some leading TABs can get through. Usually
they're in macro definitions or strings, and should be converted anyhow. they're in macro definitions or strings, and should be converted anyhow.
Libvirt requires a C99 compiler for various reasons. However, most of the code
base prefers to stick to C89 syntax unless there is a compelling reason
otherwise. For example, it is preferable to use "/* */" comments rather than
"//". Also, when declaring local variables, the prevailing style has been to
declare them at the beginning of a scope, rather than immediately before use.
Curly braces Curly braces
============ ============
@ -161,33 +189,42 @@ Do this, instead:
However, there is one exception in the other direction, when even a one-line However, there is one exception in the other direction, when even a one-line
block should have braces. That occurs when that one-line, brace-less block is block should have braces. That occurs when that one-line, brace-less block is
an "else" block, and the corresponding "then" block *does* use braces. In that an "if" or "else" block, and the counterpart block *does* use braces. In that
case, either put braces around the "else" block, or negate the "if"-condition case, put braces around both blocks. Also, if the "else" block is much shorter
and swap the bodies, putting the one-line block first and making the longer, than the "if" block, consider negating the "if"-condition and swapping the
multi-line block be the "else" block. bodies, putting the short block first and making the longer, multi-line block
be the "else" block.
if (expr) { if (expr) {
... ...
... ...
} }
else else
x = y; // BAD: braceless "else" with braced "then" x = y; // BAD: braceless "else" with braced "then",
// and short block last
This is preferred, especially when the multi-line body is more than a few if (expr)
lines long, because it is easier to read and grasp the semantics of an x = y; // BAD: braceless "if" with braced "else"
if-then-else block when the simpler block occurs first, rather than after the
more involved block:
if (!expr)
x = y; // putting the smaller block first is more readable
else { else {
... ...
... ...
} }
If you'd rather not negate the condition, then at least add braces: Keeping braces consistent and putting the short block first is preferred,
especially when the multi-line body is more than a few lines long, because it
is easier to read and grasp the semantics of an if-then-else block when the
simpler block occurs first, rather than after the more involved block:
if (expr) { if (!expr) {
x = y; // putting the smaller block first is more readable
} else {
...
...
}
But if negating a complex condition is too ugly, then at least add braces:
if (complex expr not worth negating) {
... ...
... ...
} else { } else {

View File

@ -14,36 +14,6 @@ XML_EXAMPLES = \
$(patsubst $(srcdir)/%,%,$(wildcard $(addprefix $(srcdir)/examples/xml/, \ $(patsubst $(srcdir)/%,%,$(wildcard $(addprefix $(srcdir)/examples/xml/, \
test/*.xml storage/*.xml))) test/*.xml storage/*.xml)))
syntax_check_exceptions = \
.x-sc_avoid_ctype_macros \
.x-sc_avoid_if_before_free \
.x-sc_avoid_write \
.x-sc_bindtextdomain \
.x-sc_m4_quote_check \
.x-sc_po_check \
.x-sc_prohibit_always_true_header_tests \
.x-sc_prohibit_asprintf \
.x-sc_prohibit_close \
.x-sc_prohibit_empty_lines_at_EOF \
.x-sc_prohibit_gethostby \
.x-sc_prohibit_gethostname \
.x-sc_prohibit_gettext_noop \
.x-sc_prohibit_have_config_h \
.x-sc_prohibit_HAVE_MBRTOWC \
.x-sc_prohibit_nonreentrant \
.x-sc_prohibit_readlink \
.x-sc_prohibit_sprintf \
.x-sc_prohibit_strcmp \
.x-sc_prohibit_strncmp \
.x-sc_prohibit_strncpy \
.x-sc_prohibit_test_minus_ao \
.x-sc_prohibit_VIR_ERR_NO_MEMORY \
.x-sc_prohibit_xmlGetProp \
.x-sc_require_config_h \
.x-sc_require_config_h_first \
.x-sc_trailing_blank \
.x-sc_unmarked_diagnostics
EXTRA_DIST = \ EXTRA_DIST = \
ChangeLog-old \ ChangeLog-old \
libvirt.spec libvirt.spec.in \ libvirt.spec libvirt.spec.in \
@ -52,8 +22,8 @@ EXTRA_DIST = \
autobuild.sh \ autobuild.sh \
Makefile.nonreentrant \ Makefile.nonreentrant \
autogen.sh \ autogen.sh \
cfg.mk \
examples/domain-events/events-python \ examples/domain-events/events-python \
$(syntax_check_exceptions) \
$(XML_EXAMPLES) $(XML_EXAMPLES)
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig

View File

@ -1,125 +0,0 @@
dnl
dnl Taken from gnome-common/macros2/gnome-compiler-flags.m4
dnl
dnl We've added:
dnl -Wextra -Wshadow -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Winline -Wredundant-decls
dnl We've removed
dnl CFLAGS="$realsave_CFLAGS"
dnl to avoid clobbering user-specified CFLAGS
dnl
AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
dnl ******************************
dnl More compiler warnings
dnl ******************************
AC_ARG_ENABLE(compile-warnings,
[AC_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@],
[Turn on compiler warnings])],,
[enable_compile_warnings="m4_default([$1],[maximum])"])
warnCFLAGS=
common_flags=
common_flags="$common_flags -Wp,-D_FORTIFY_SOURCE=2"
common_flags="$common_flags -fexceptions"
common_flags="$common_flags -fasynchronous-unwind-tables"
common_flags="$common_flags -fdiagnostics-show-option"
case "$enable_compile_warnings" in
no)
try_compiler_flags=""
;;
minimum)
try_compiler_flags="-Wall -Wformat -Wformat-security $common_flags"
;;
yes)
try_compiler_flags="-Wall -Wformat -Wformat-security -Wmissing-prototypes $common_flags"
;;
maximum|error)
try_compiler_flags="-Wall -Wformat -Wformat-security"
try_compiler_flags="$try_compiler_flags -Wmissing-prototypes"
try_compiler_flags="$try_compiler_flags -Wnested-externs "
try_compiler_flags="$try_compiler_flags -Wpointer-arith"
try_compiler_flags="$try_compiler_flags -Wextra -Wshadow"
try_compiler_flags="$try_compiler_flags -Wcast-align"
try_compiler_flags="$try_compiler_flags -Wwrite-strings"
try_compiler_flags="$try_compiler_flags -Waggregate-return"
try_compiler_flags="$try_compiler_flags -Wstrict-prototypes"
try_compiler_flags="$try_compiler_flags -Winline"
try_compiler_flags="$try_compiler_flags -Wredundant-decls"
try_compiler_flags="$try_compiler_flags -Wno-sign-compare"
try_compiler_flags="$try_compiler_flags -Wlogical-op"
try_compiler_flags="$try_compiler_flags $common_flags"
if test "$enable_compile_warnings" = "error" ; then
try_compiler_flags="$try_compiler_flags -Werror"
fi
;;
*)
AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
;;
esac
COMPILER_FLAGS=
for option in $try_compiler_flags; do
gl_COMPILER_FLAGS($option)
done
unset option
unset try_compiler_flags
AC_ARG_ENABLE(iso-c,
AC_HELP_STRING([--enable-iso-c],
[Try to warn if code is not ISO C ]),,
[enable_iso_c=no])
AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
complCFLAGS=
if test "x$enable_iso_c" != "xno"; then
if test "x$GCC" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-ansi[\ \ ]*) ;;
*) complCFLAGS="$complCFLAGS -ansi" ;;
esac
case " $CFLAGS " in
*[\ \ ]-pedantic[\ \ ]*) ;;
*) complCFLAGS="$complCFLAGS -pedantic" ;;
esac
fi
fi
AC_MSG_RESULT($complCFLAGS)
WARN_CFLAGS="$COMPILER_FLAGS $complCFLAGS"
WARN_LDFLAGS=$WARN_CFLAGS
AC_SUBST([WARN_CFLAGS])
AC_SUBST([WARN_LDFLAGS])
dnl Needed to keep compile quiet on python 2.4
COMPILER_FLAGS=
gl_COMPILER_FLAGS(-Wno-redundant-decls)
WARN_PYTHON_CFLAGS=$COMPILER_FLAGS
AC_SUBST(WARN_PYTHON_CFLAGS)
])
dnl
dnl To support the old pkg-config from RHEL4 vintage, we need
dnl to define the PKG_PROG_PKG_CONFIG macro if its not already
dnl present
m4_ifndef([PKG_PROG_PKG_CONFIG],
[AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=m4_default([$1], [0.9.0])
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])])

View File

@ -11,11 +11,11 @@ test -n "$1" && RESULTS=$1 || RESULTS=results.log
test -f Makefile && make -k distclean || : test -f Makefile && make -k distclean || :
rm -rf coverage rm -rf coverage
#rm -rf build rm -rf build
#mkdir build mkdir build
#cd build cd build
./autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \ ../autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \
--enable-test-coverage \ --enable-test-coverage \
--enable-compile-warnings=error --enable-compile-warnings=error
@ -66,7 +66,7 @@ if [ -x /usr/bin/i686-pc-mingw32-gcc ]; then
PKG_CONFIG_PATH="$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig" \ PKG_CONFIG_PATH="$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig" \
CC="i686-pc-mingw32-gcc" \ CC="i686-pc-mingw32-gcc" \
./configure \ ../configure \
--build=$(uname -m)-pc-linux \ --build=$(uname -m)-pc-linux \
--host=i686-pc-mingw32 \ --host=i686-pc-mingw32 \
--prefix="$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw" \ --prefix="$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw" \
@ -81,7 +81,6 @@ if [ -x /usr/bin/i686-pc-mingw32-gcc ]; then
--without-uml \ --without-uml \
--without-vbox \ --without-vbox \
--without-openvz \ --without-openvz \
--without-one \
--without-phyp \ --without-phyp \
--without-netcf \ --without-netcf \
--without-audit \ --without-audit \

View File

@ -8,15 +8,27 @@ THEDIR=`pwd`
cd "$srcdir" cd "$srcdir"
test -f src/libvirt.c || { test -f src/libvirt.c || {
echo "You must run this script in the top-level libvirt directory" echo "You must run this script in the top-level libvirt directory"
exit 1 exit 1
} }
EXTRA_ARGS= EXTRA_ARGS=
no_git=
if test "x$1" = "x--no-git"; then
no_git=" $1"
shift
fi
if test "x$1" = "x--system"; then if test "x$1" = "x--system"; then
shift shift
EXTRA_ARGS="--prefix=/usr --sysconfdir=/etc --localstatedir=/var" prefix=/usr
libdir=$prefix/lib
sysconfdir=/etc
localstatedir=/var
if [ -d /usr/lib64 ]; then
libdir=$prefix/lib64
fi
EXTRA_ARGS="--prefix=$prefix --sysconfdir=$sysconfdir --localstatedir=$localstatedir --libdir=$libdir"
echo "Running ./configure with $EXTRA_ARGS $@" echo "Running ./configure with $EXTRA_ARGS $@"
else else
if test -z "$*" && test ! -f "$THEDIR/config.status"; then if test -z "$*" && test ! -f "$THEDIR/config.status"; then
@ -40,16 +52,19 @@ bootstrap_hash()
# Also, running 'make rpm' tends to litter the po/ directory, and some people # Also, running 'make rpm' tends to litter the po/ directory, and some people
# like to run 'git clean -x -f po' to fix it; but only ./bootstrap regenerates # like to run 'git clean -x -f po' to fix it; but only ./bootstrap regenerates
# the required file po/Makevars. # the required file po/Makevars.
curr_status=.git-module-status # Only run bootstrap from a git checkout, never from a tarball.
t=$(bootstrap_hash; git diff .gnulib) if test -d .git; then
if test "$t" = "$(cat $curr_status 2>/dev/null)" \ curr_status=.git-module-status
&& test -f "po/Makevars"; then t=$(bootstrap_hash; git diff .gnulib)
# good, it's up to date, all we need is autoreconf if test "$t" = "$(cat $curr_status 2>/dev/null)" \
autoreconf -if && test -f "po/Makevars"; then
else # good, it's up to date, all we need is autoreconf
echo running bootstrap... autoreconf -if
./bootstrap && bootstrap_hash > $curr_status \ else
|| { echo "Failed to bootstrap, please investigate."; exit 1; } echo running bootstrap$no_git...
./bootstrap$no_git --bootstrap-sync && bootstrap_hash > $curr_status \
|| { echo "Failed to bootstrap, please investigate."; exit 1; }
fi
fi fi
cd "$THEDIR" cd "$THEDIR"

152
bootstrap
View File

@ -1,10 +1,10 @@
#! /bin/sh #! /bin/sh
# Print a version string. # Print a version string.
scriptversion=2010-11-12.21; # UTC scriptversion=2011-04-05.18; # UTC
# Bootstrap this package from checked-out sources. # Bootstrap this package from checked-out sources.
# Copyright (C) 2003-2010 Free Software Foundation, Inc. # Copyright (C) 2003-2011 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -42,24 +42,32 @@ local_gl_dir=gl
bt='._bootmp' bt='._bootmp'
bt_regex=`echo "$bt"| sed 's/\./[.]/g'` bt_regex=`echo "$bt"| sed 's/\./[.]/g'`
bt2=${bt}2 bt2=${bt}2
me=$0
usage() { usage() {
cat <<EOF cat <<EOF
Usage: $0 [OPTION]... Usage: $me [OPTION]...
Bootstrap this package from the checked-out sources. Bootstrap this package from the checked-out sources.
Options: Options:
--gnulib-srcdir=DIRNAME Specify the local directory where gnulib --gnulib-srcdir=DIRNAME specify the local directory where gnulib
sources reside. Use this if you already sources reside. Use this if you already
have gnulib sources on your machine, and have gnulib sources on your machine, and
do not want to waste your bandwidth downloading do not want to waste your bandwidth downloading
them again. Defaults to \$GNULIB_SRCDIR. them again. Defaults to \$GNULIB_SRCDIR
--copy Copy files instead of creating symbolic links. --bootstrap-sync if this bootstrap script is not identical to
--force Attempt to bootstrap even if the sources seem the version in the local gnulib sources,
not to have been checked out. update this script, and then restart it with
--skip-po Do not download po files. /bin/sh or the shell \$CONFIG_SHELL
--no-bootstrap-sync do not check whether bootstrap is out of sync
--copy copy files instead of creating symbolic links
--force attempt to bootstrap even if the sources seem
not to have been checked out
--no-git do not use git to update gnulib. Requires that
--gnulib-srcdir point to a correct gnulib snapshot
--skip-po do not download po files
If the file $0.conf exists in the same directory as this script, its If the file $me.conf exists in the same directory as this script, its
contents are read as shell variables to configure the bootstrap. contents are read as shell variables to configure the bootstrap.
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
@ -122,18 +130,7 @@ source_base=lib
m4_base=m4 m4_base=m4
doc_base=doc doc_base=doc
tests_base=tests tests_base=tests
gnulib_extra_files=''
# Extra files from gnulib, which override files from other sources.
gnulib_extra_files="
$build_aux/install-sh
$build_aux/missing
$build_aux/mdate-sh
$build_aux/texinfo.tex
$build_aux/depcomp
$build_aux/config.guess
$build_aux/config.sub
doc/INSTALL
"
# Additional gnulib-tool options to use. Use "\newline" to break lines. # Additional gnulib-tool options to use. Use "\newline" to break lines.
gnulib_tool_option_extras= gnulib_tool_option_extras=
@ -168,6 +165,13 @@ copy=false
# on which version control system (if any) is used in the source directory. # on which version control system (if any) is used in the source directory.
vc_ignore=auto vc_ignore=auto
# Set this to true in bootstrap.conf to enable --bootstrap-sync by
# default.
bootstrap_sync=false
# Use git to update gnulib sources
use_git=true
# find_tool ENVVAR NAMES... # find_tool ENVVAR NAMES...
# ------------------------- # -------------------------
# Search for a required program. Use the value of ENVVAR, if set, # Search for a required program. Use the value of ENVVAR, if set,
@ -192,11 +196,11 @@ find_tool ()
find_tool_error_prefix="\$$find_tool_envvar: " find_tool_error_prefix="\$$find_tool_envvar: "
fi fi
if test x"$find_tool_res" = x; then if test x"$find_tool_res" = x; then
echo >&2 "$0: one of these is required: $find_tool_names" echo >&2 "$me: one of these is required: $find_tool_names"
exit 1 exit 1
fi fi
($find_tool_res --version </dev/null) >/dev/null 2>&1 || { ($find_tool_res --version </dev/null) >/dev/null 2>&1 || {
echo >&2 "$0: ${find_tool_error_prefix}cannot run $find_tool_res --version" echo >&2 "$me: ${find_tool_error_prefix}cannot run $find_tool_res --version"
exit 1 exit 1
} }
eval "$find_tool_envvar=\$find_tool_res" eval "$find_tool_envvar=\$find_tool_res"
@ -214,6 +218,18 @@ case "$0" in
*) test -r "$0.conf" && . ./"$0.conf" ;; *) test -r "$0.conf" && . ./"$0.conf" ;;
esac esac
# Extra files from gnulib, which override files from other sources.
test -z "${gnulib_extra_files}" && \
gnulib_extra_files="
$build_aux/install-sh
$build_aux/missing
$build_aux/mdate-sh
$build_aux/texinfo.tex
$build_aux/depcomp
$build_aux/config.guess
$build_aux/config.sub
doc/INSTALL
"
if test "$vc_ignore" = auto; then if test "$vc_ignore" = auto; then
vc_ignore= vc_ignore=
@ -239,25 +255,53 @@ do
checkout_only_file=;; checkout_only_file=;;
--copy) --copy)
copy=true;; copy=true;;
--bootstrap-sync)
bootstrap_sync=true;;
--no-bootstrap-sync)
bootstrap_sync=false;;
--no-git)
use_git=false;;
*) *)
echo >&2 "$0: $option: unknown option" echo >&2 "$0: $option: unknown option"
exit 1;; exit 1;;
esac esac
done done
if $use_git || test -d "$GNULIB_SRCDIR"; then
:
else
echo "$0: Error: --no-git requires --gnulib-srcdir" >&2
exit 1
fi
if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
echo "$0: Bootstrapping from a non-checked-out distribution is risky." >&2 echo "$0: Bootstrapping from a non-checked-out distribution is risky." >&2
exit 1 exit 1
fi fi
# Ensure that lines starting with ! sort last, per gitignore conventions
# for whitelisting exceptions after a more generic blacklist pattern.
sort_patterns() {
sort -u "$@" | sed '/^!/ {
H
d
}
$ {
P
x
s/^\n//
}'
}
# If $STR is not already on a line by itself in $FILE, insert it, # If $STR is not already on a line by itself in $FILE, insert it,
# sorting the new contents of the file and replacing $FILE with the result. # sorting the new contents of the file and replacing $FILE with the result.
insert_sorted_if_absent() { insert_sorted_if_absent() {
file=$1 file=$1
str=$2 str=$2
test -f $file || touch $file test -f $file || touch $file
echo "$str" | sort -u - $file | cmp - $file > /dev/null \ echo "$str" | sort_patterns - $file | cmp - $file > /dev/null \
|| echo "$str" | sort -u - $file -o $file \ || { echo "$str" | sort_patterns - $file > $file.bak \
&& mv $file.bak $file; } \
|| exit 1 || exit 1
} }
@ -370,18 +414,22 @@ check_versions() {
if test "$app" = libtool; then if test "$app" = libtool; then
app=libtoolize app=libtoolize
fi fi
# Exempt git if --no-git is in effect.
if test "$app" = git; then
$use_git || continue
fi
# Honor $APP variables ($TAR, $AUTOCONF, etc.) # Honor $APP variables ($TAR, $AUTOCONF, etc.)
appvar=`echo $app | tr '[a-z]-' '[A-Z]_'` appvar=`echo $app | tr '[a-z]-' '[A-Z]_'`
test "$appvar" = TAR && appvar=AMTAR test "$appvar" = TAR && appvar=AMTAR
eval "app=\${$appvar-$app}" eval "app=\${$appvar-$app}"
inst_ver=$(get_version $app) inst_ver=$(get_version $app)
if [ ! "$inst_ver" ]; then if [ ! "$inst_ver" ]; then
echo "Error: '$app' not found" >&2 echo "$me: Error: '$app' not found" >&2
ret=1 ret=1
elif [ ! "$req_ver" = "-" ]; then elif [ ! "$req_ver" = "-" ]; then
latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2) latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
if [ ! "$latest_ver" = "$inst_ver" ]; then if [ ! "$latest_ver" = "$inst_ver" ]; then
echo "Error: '$app' version == $inst_ver is too old" >&2 echo "$me: Error: '$app' version == $inst_ver is too old" >&2
echo " '$app' version >= $req_ver is required" >&2 echo " '$app' version >= $req_ver is required" >&2
ret=1 ret=1
fi fi
@ -414,9 +462,9 @@ fi
if ! printf "$buildreq" | check_versions; then if ! printf "$buildreq" | check_versions; then
echo >&2 echo >&2
if test -f README-prereq; then if test -f README-prereq; then
echo "See README-prereq for how to get the prerequisite programs" >&2 echo "$0: See README-prereq for how to get the prerequisite programs" >&2
else else
echo "Please install the prerequisite programs" >&2 echo "$0: Please install the prerequisite programs" >&2
fi fi
exit 1 exit 1
fi fi
@ -428,11 +476,11 @@ if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
if git config merge.merge-changelog.driver >/dev/null ; then if git config merge.merge-changelog.driver >/dev/null ; then
: :
elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
echo "initializing git-merge-changelog driver" echo "$0: initializing git-merge-changelog driver"
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver' git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B' git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
else else
echo "consider installing git-merge-changelog from gnulib" echo "$0: consider installing git-merge-changelog from gnulib"
fi fi
fi fi
@ -448,7 +496,7 @@ git_modules_config () {
} }
gnulib_path=`git_modules_config submodule.gnulib.path` gnulib_path=`git_modules_config submodule.gnulib.path`
: ${gnulib_path=gnulib} test -z "$gnulib_path" && gnulib_path=gnulib
# Get gnulib files. # Get gnulib files.
@ -501,6 +549,16 @@ case ${GNULIB_SRCDIR--} in
;; ;;
esac esac
if $bootstrap_sync; then
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
echo "$0: updating bootstrap and restarting..."
exec sh -c \
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
-- "$GNULIB_SRCDIR/build-aux/bootstrap" \
"$0" "$@" --no-bootstrap-sync
}
fi
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
<$gnulib_tool || exit <$gnulib_tool || exit
@ -509,7 +567,7 @@ gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
download_po_files() { download_po_files() {
subdir=$1 subdir=$1
domain=$2 domain=$2
echo "$0: getting translations into $subdir for $domain..." echo "$me: getting translations into $subdir for $domain..."
cmd=`printf "$po_download_command_format" "$domain" "$subdir"` cmd=`printf "$po_download_command_format" "$domain" "$subdir"`
eval "$cmd" eval "$cmd"
} }
@ -543,7 +601,7 @@ update_po_files() {
! test -f "$po_dir/$po.po" || ! test -f "$po_dir/$po.po" ||
! $SHA1SUM -c --status "$cksum_file" \ ! $SHA1SUM -c --status "$cksum_file" \
< "$new_po" > /dev/null; then < "$new_po" > /dev/null; then
echo "updated $po_dir/$po.po..." echo "$me: updated $po_dir/$po.po..."
cp "$new_po" "$po_dir/$po.po" \ cp "$new_po" "$po_dir/$po.po" \
&& $SHA1SUM < "$new_po" > "$cksum_file" && $SHA1SUM < "$new_po" > "$cksum_file"
fi fi
@ -588,13 +646,13 @@ symlink_to_dir()
if $copy; then if $copy; then
{ {
test ! -h "$dst" || { test ! -h "$dst" || {
echo "$0: rm -f $dst" && echo "$me: rm -f $dst" &&
rm -f "$dst" rm -f "$dst"
} }
} && } &&
test -f "$dst" && test -f "$dst" &&
cmp -s "$src" "$dst" || { cmp -s "$src" "$dst" || {
echo "$0: cp -fp $src $dst" && echo "$me: cp -fp $src $dst" &&
cp -fp "$src" "$dst" cp -fp "$src" "$dst"
} }
else else
@ -608,7 +666,7 @@ symlink_to_dir()
*) *)
case /$dst/ in case /$dst/ in
*//* | */../* | */./* | /*/*/*/*/*/) *//* | */../* | */./* | /*/*/*/*/*/)
echo >&2 "$0: invalid symlink calculation: $src -> $dst" echo >&2 "$me: invalid symlink calculation: $src -> $dst"
exit 1;; exit 1;;
/*/*/*/*/) dot_dots=../../../;; /*/*/*/*/) dot_dots=../../../;;
/*/*/*/) dot_dots=../../;; /*/*/*/) dot_dots=../../;;
@ -616,7 +674,7 @@ symlink_to_dir()
esac;; esac;;
esac esac
echo "$0: ln -fs $dot_dots$src $dst" && echo "$me: ln -fs $dot_dots$src $dst" &&
ln -fs "$dot_dots$src" "$dst" ln -fs "$dot_dots$src" "$dst"
} }
fi fi
@ -649,7 +707,7 @@ cp_mark_as_generated()
cmp -s "$cp_src" "$cp_dst" || { cmp -s "$cp_src" "$cp_dst" || {
# Copy the file first to get proper permissions if it # Copy the file first to get proper permissions if it
# doesn't already exist. Then overwrite the copy. # doesn't already exist. Then overwrite the copy.
echo "$0: cp -f $cp_src $cp_dst" && echo "$me: cp -f $cp_src $cp_dst" &&
rm -f "$cp_dst" && rm -f "$cp_dst" &&
cp "$cp_src" "$cp_dst-t" && cp "$cp_src" "$cp_dst-t" &&
sed "s!$bt_regex/!!g" "$cp_src" > "$cp_dst-t" && sed "s!$bt_regex/!!g" "$cp_src" > "$cp_dst-t" &&
@ -667,7 +725,7 @@ cp_mark_as_generated()
if cmp -s "$cp_dst-t" "$cp_dst"; then if cmp -s "$cp_dst-t" "$cp_dst"; then
rm -f "$cp_dst-t" rm -f "$cp_dst-t"
else else
echo "$0: cp $cp_src $cp_dst # with edits" && echo "$me: cp $cp_src $cp_dst # with edits" &&
mv -f "$cp_dst-t" "$cp_dst" mv -f "$cp_dst-t" "$cp_dst"
fi fi
fi fi
@ -686,7 +744,7 @@ version_controlled_file() {
elif test -d .svn; then elif test -d .svn; then
svn log -r HEAD "$dir/$file" > /dev/null 2>&1 && found=yes svn log -r HEAD "$dir/$file" > /dev/null 2>&1 && found=yes
else else
echo "$0: no version control for $dir/$file?" >&2 echo "$me: no version control for $dir/$file?" >&2
fi fi
test $found = yes test $found = yes
} }
@ -710,18 +768,18 @@ slurp() {
remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g" remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
sed "$remove_intl" $1/$dir/$file | sed "$remove_intl" $1/$dir/$file |
cmp - $dir/$gnulib_mk > /dev/null || { cmp - $dir/$gnulib_mk > /dev/null || {
echo "$0: Copying $1/$dir/$file to $dir/$gnulib_mk ..." && echo "$me: Copying $1/$dir/$file to $dir/$gnulib_mk ..." &&
rm -f $dir/$gnulib_mk && rm -f $dir/$gnulib_mk &&
sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk && sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk &&
gnulib_mk_hook $dir/$gnulib_mk gnulib_mk_hook $dir/$gnulib_mk
} }
elif { test "${2+set}" = set && test -r $2/$dir/$file; } || elif { test "${2+set}" = set && test -r $2/$dir/$file; } ||
version_controlled_file $dir $file; then version_controlled_file $dir $file; then
echo "$0: $dir/$file overrides $1/$dir/$file" echo "$me: $dir/$file overrides $1/$dir/$file"
else else
copied=$copied$sep$file; sep=$nl copied=$copied$sep$file; sep=$nl
if test $file = gettext.m4; then if test $file = gettext.m4; then
echo "$0: patching m4/gettext.m4 to remove need for intl/* ..." echo "$me: patching m4/gettext.m4 to remove need for intl/* ..."
rm -f $dir/$file rm -f $dir/$file
sed ' sed '
/^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\ /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
@ -832,7 +890,7 @@ grep -E '^[ ]*AC_CONFIG_HEADERS?\>' configure.ac >/dev/null ||
for command in \ for command in \
libtool \ libtool \
"${ACLOCAL-aclocal} --force -I m4 $ACLOCAL_FLAGS" \ "${ACLOCAL-aclocal} --force -I '$m4_base' $ACLOCAL_FLAGS" \
"${AUTOCONF-autoconf} --force" \ "${AUTOCONF-autoconf} --force" \
"${AUTOHEADER-autoheader} --force" \ "${AUTOHEADER-autoheader} --force" \
"${AUTOMAKE-automake} --add-missing --copy --force-missing" "${AUTOMAKE-automake} --add-missing --copy --force-missing"
@ -843,7 +901,7 @@ do
command="${LIBTOOLIZE-libtoolize} -c -f" command="${LIBTOOLIZE-libtoolize} -c -f"
fi fi
echo "$0: $command ..." echo "$0: $command ..."
$command || exit eval "$command" || exit
done done

View File

@ -1,6 +1,6 @@
# Bootstrap configuration. # Bootstrap configuration.
# Copyright (C) 2010 Red Hat, Inc. # Copyright (C) 2010-2011 Red Hat, Inc.
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@ -21,8 +21,12 @@
gnulib_modules=' gnulib_modules='
areadlink areadlink
base64 base64
byteswap
c-ctype c-ctype
c-strcase
c-strcasestr
canonicalize-lgpl canonicalize-lgpl
chown
close close
connect connect
configmake configmake
@ -32,6 +36,7 @@ dirname-lgpl
fcntl-h fcntl-h
func func
getaddrinfo getaddrinfo
getcwd-lgpl
gethostname gethostname
getpass getpass
gettext-h gettext-h
@ -42,13 +47,17 @@ ignore-value
inet_pton inet_pton
ioctl ioctl
maintainer-makefile maintainer-makefile
manywarnings
mkstemp mkstemp
mkstemps mkstemps
mktempd mktempd
netdb netdb
nonblocking
passfd
perror perror
physmem physmem
pipe-posix pipe-posix
pipe2
poll poll
posix-shell posix-shell
pthread pthread
@ -57,12 +66,15 @@ random_r
sched sched
send send
setsockopt setsockopt
sigaction
sigpipe
snprintf snprintf
socket socket
stpcpy stpcpy
strchrnul strchrnul
strndup strndup
strerror strerror
strerror_r-posix
strptime strptime
strsep strsep
strtok_r strtok_r
@ -78,6 +90,7 @@ vasprintf
verify verify
vc-list-files vc-list-files
waitpid waitpid
warnings
' '
# Additional xgettext options to use. Use "\\\newline" to break lines. # Additional xgettext options to use. Use "\\\newline" to break lines.
@ -141,7 +154,7 @@ gnulib_tool_option_extras="\
# Convince bootstrap to use multiple m4 directories. # Convince bootstrap to use multiple m4 directories.
: ${ACLOCAL=aclocal} : ${ACLOCAL=aclocal}
ACLOCAL="$ACLOCAL -I gnulib/m4" ACLOCAL="$ACLOCAL -I m4"
export ACLOCAL export ACLOCAL
# Build prerequisites # Build prerequisites
@ -161,11 +174,23 @@ tar -
# Automake requires that ChangeLog exist. # Automake requires that ChangeLog exist.
touch ChangeLog || exit 1 touch ChangeLog || exit 1
# Override bootstrap's list - we don't use mdate-sh or texinfo.tex.
gnulib_extra_files="
$build_aux/install-sh
$build_aux/missing
$build_aux/depcomp
$build_aux/config.guess
$build_aux/config.sub
doc/INSTALL
"
bootstrap_epilogue() bootstrap_epilogue()
{ {
# Change paths in gnulib/tests/Makefile.am from "../../.." to "../..". # Change paths in gnulib/tests/Makefile.am from "../../.." to "../..",
# then ensure that gnulib/tests/Makefile.in is up-to-date.
m=gnulib/tests/Makefile.am m=gnulib/tests/Makefile.am
sed 's,\.\./\.\./\.\.,../..,g' $m > $m-t sed 's,\.\./\.\./\.\.,../..,g' $m > $m-t
mv -f $m-t $m mv -f $m-t $m
${AUTOMAKE-automake} gnulib/tests/Makefile
} }

169
cfg.mk
View File

@ -1,5 +1,6 @@
# Customize Makefile.maint. -*- makefile -*- # Customize Makefile.maint. -*- makefile -*-
# Copyright (C) 2003-2010 Free Software Foundation, Inc. # Copyright (C) 2008-2011 Red Hat, Inc.
# Copyright (C) 2003-2008 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -65,11 +66,12 @@ local-checks-to-skip = \
sc_useless_cpp_parens sc_useless_cpp_parens
# Files that should never cause syntax check failures. # Files that should never cause syntax check failures.
VC_LIST_ALWAYS_EXCLUDE_REGEX = ^docs/news.html.in$$ VC_LIST_ALWAYS_EXCLUDE_REGEX = ^(HACKING|docs/news\.html\.in)$$
# Functions like free() that are no-ops on NULL arguments. # Functions like free() that are no-ops on NULL arguments.
useless_free_options = \ useless_free_options = \
--name=VIR_FREE \ --name=VIR_FREE \
--name=qemuCapsFree \
--name=sexpr_free \ --name=sexpr_free \
--name=virBitmapFree \ --name=virBitmapFree \
--name=virCPUDefFree \ --name=virCPUDefFree \
@ -85,6 +87,7 @@ useless_free_options = \
--name=virConfFreeList \ --name=virConfFreeList \
--name=virConfFreeValue \ --name=virConfFreeValue \
--name=virDomainChrDefFree \ --name=virDomainChrDefFree \
--name=virDomainChrSourceDefFree \
--name=virDomainControllerDefFree \ --name=virDomainControllerDefFree \
--name=virDomainDefFree \ --name=virDomainDefFree \
--name=virDomainDeviceDefFree \ --name=virDomainDeviceDefFree \
@ -98,11 +101,13 @@ useless_free_options = \
--name=virDomainInputDefFree \ --name=virDomainInputDefFree \
--name=virDomainNetDefFree \ --name=virDomainNetDefFree \
--name=virDomainObjFree \ --name=virDomainObjFree \
--name=virDomainSmartcardDefFree \
--name=virDomainSnapshotDefFree \ --name=virDomainSnapshotDefFree \
--name=virDomainSnapshotObjFree \ --name=virDomainSnapshotObjFree \
--name=virDomainSoundDefFree \ --name=virDomainSoundDefFree \
--name=virDomainVideoDefFree \ --name=virDomainVideoDefFree \
--name=virDomainWatchdogDefFree \ --name=virDomainWatchdogDefFree \
--name=virHashFree \
--name=virInterfaceDefFree \ --name=virInterfaceDefFree \
--name=virInterfaceIpDefFree \ --name=virInterfaceIpDefFree \
--name=virInterfaceObjFree \ --name=virInterfaceObjFree \
@ -114,7 +119,7 @@ useless_free_options = \
--name=virNWFilterHashTableFree \ --name=virNWFilterHashTableFree \
--name=virNWFilterIPAddrLearnReqFree \ --name=virNWFilterIPAddrLearnReqFree \
--name=virNWFilterIncludeDefFree \ --name=virNWFilterIncludeDefFree \
--name=virNWFilterPoolObjFree \ --name=virNWFilterObjFree \
--name=virNWFilterRuleDefFree \ --name=virNWFilterRuleDefFree \
--name=virNWFilterRuleInstFree \ --name=virNWFilterRuleInstFree \
--name=virNetworkDefFree \ --name=virNetworkDefFree \
@ -192,9 +197,9 @@ useless_free_options = \
# y virNWFilterHashTableFree # y virNWFilterHashTableFree
# y virNWFilterIPAddrLearnReqFree # y virNWFilterIPAddrLearnReqFree
# y virNWFilterIncludeDefFree # y virNWFilterIncludeDefFree
# n virNWFilterPoolFreeName (returns int) # n virNWFilterFreeName (returns int)
# y virNWFilterPoolObjFree # y virNWFilterObjFree
# n virNWFilterPoolObjListFree FIXME # n virNWFilterObjListFree FIXME
# y virNWFilterRuleDefFree # y virNWFilterRuleDefFree
# n virNWFilterRuleFreeInstanceData (typedef) # n virNWFilterRuleFreeInstanceData (typedef)
# y virNWFilterRuleInstFree # y virNWFilterRuleInstFree
@ -239,19 +244,33 @@ sc_avoid_write:
# Avoid functions that can lead to double-close bugs. # Avoid functions that can lead to double-close bugs.
sc_prohibit_close: sc_prohibit_close:
@prohibit='\<[f]close *\(' \ @prohibit='([^>.]|^)\<[fp]?close *\(' \
halt='use VIR_{FORCE_}[F]CLOSE instead of [f]close' \ halt='use VIR_{FORCE_}[F]CLOSE instead of [f]close' \
$(_sc_search_regexp) $(_sc_search_regexp)
@prohibit='\<fdopen *\(' \ @prohibit='\<fdopen *\(' \
halt='use VIR_FDOPEN instead of fdopen' \ halt='use VIR_FDOPEN instead of fdopen' \
$(_sc_search_regexp) $(_sc_search_regexp)
# Prefer virCommand for all child processes.
# XXX - eventually, we want to enhance this to also prohibit virExec.
sc_prohibit_fork_wrappers:
@prohibit='= *\<(fork|popen|system) *\(' \
halt='use virCommand for child processes' \
$(_sc_search_regexp)
# access with X_OK accepts directories, but we can't exec() those.
# access with F_OK or R_OK is okay, though.
sc_prohibit_access_xok:
@prohibit='access''(at)? *\(.*X_OK' \
halt='use virFileIsExecutable instead of access''(,X_OK)' \
$(_sc_search_regexp)
# Similar to the gnulib maint.mk rule for sc_prohibit_strcmp # Similar to the gnulib maint.mk rule for sc_prohibit_strcmp
# Use STREQLEN or STRPREFIX rather than comparing strncmp == 0, or != 0. # Use STREQLEN or STRPREFIX rather than comparing strncmp == 0, or != 0.
sc_prohibit_strncmp: sc_prohibit_strncmp:
@grep -nE '! *str''ncmp *\(|\<str''ncmp *\([^)]+\) *==' \ @grep -nE '! *str''ncmp *\(|\<str''ncmp *\(.+\) *[!=]=' \
$$($(VC_LIST_EXCEPT)) \ $$($(VC_LIST_EXCEPT)) \
| grep -vE ':# *define STREQ\(' && \ | grep -vE ':# *define STR(N?EQLEN|PREFIX)\(' && \
{ echo '$(ME): use STREQLEN or STRPREFIX instead of str''ncmp' \ { echo '$(ME): use STREQLEN or STRPREFIX instead of str''ncmp' \
1>&2; exit 1; } || : 1>&2; exit 1; } || :
@ -312,13 +331,14 @@ sc_prohibit_ctype_h:
halt="don't use ctype.h; instead, use c-ctype.h" \ halt="don't use ctype.h; instead, use c-ctype.h" \
$(_sc_search_regexp) $(_sc_search_regexp)
# Ensure that no C source file or rng schema uses TABs for # Ensure that no C source file, docs, or rng schema uses TABs for
# indentation. Also match *.h.in files, to get libvirt.h.in. Exclude # indentation. Also match *.h.in files, to get libvirt.h.in. Exclude
# files in gnulib, since they're imported. # files in gnulib, since they're imported.
space_indent_files=(\.(rng|s?[ch](\.in)?|html.in|py)|(daemon|tools)/.*\.in)
sc_TAB_in_indentation: sc_TAB_in_indentation:
@prohibit='^ * ' \ @prohibit='^ * ' \
in_vc_files='(\.(rng|[ch](\.in)?)|(daemon|tools)/.*\.in)$$' \ in_vc_files='$(space_indent_files)$$' \
halt='use spaces, not TAB, for indentation in C, sh, and RNG schemas' \ halt='indent with space, not TAB, in C, sh, html, py, and RNG schemas' \
$(_sc_search_regexp) $(_sc_search_regexp)
ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\ ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
@ -329,6 +349,11 @@ sc_avoid_ctype_macros:
halt="don't use ctype macros (use c-ctype.h)" \ halt="don't use ctype macros (use c-ctype.h)" \
$(_sc_search_regexp) $(_sc_search_regexp)
sc_avoid_strcase:
@prohibit='\bstrn?case(cmp|str) *\(' \
halt="don't use raw strcase functions (use c-strcase instead)" \
$(_sc_search_regexp)
sc_prohibit_virBufferAdd_with_string_literal: sc_prohibit_virBufferAdd_with_string_literal:
@prohibit='\<virBufferAdd *\([^,]+, *"[^"]' \ @prohibit='\<virBufferAdd *\([^,]+, *"[^"]' \
halt='use virBufferAddLit, not virBufferAdd, with a string literal' \ halt='use virBufferAddLit, not virBufferAdd, with a string literal' \
@ -355,35 +380,68 @@ sc_prohibit_xmlGetProp:
msg_gen_function = msg_gen_function =
msg_gen_function += ESX_ERROR msg_gen_function += ESX_ERROR
msg_gen_function += ESX_VI_ERROR msg_gen_function += ESX_VI_ERROR
msg_gen_function += macvtapError msg_gen_function += PHYP_ERROR
msg_gen_function += remoteError msg_gen_function += VIR_ERROR
msg_gen_function += VIR_ERROR0
msg_gen_function += VMX_ERROR
msg_gen_function += XENXS_ERROR
msg_gen_function += eventReportError
msg_gen_function += ifaceError
msg_gen_function += interfaceReportError
msg_gen_function += iptablesError
msg_gen_function += lxcError msg_gen_function += lxcError
msg_gen_function += networkLog msg_gen_function += libxlError
msg_gen_function += macvtapError
msg_gen_function += networkReportError msg_gen_function += networkReportError
msg_gen_function += oneError msg_gen_function += nodeReportError
msg_gen_function += openvzError msg_gen_function += openvzError
msg_gen_function += pciReportError
msg_gen_function += qemuReportError
msg_gen_function += qemudDispatchClientFailure msg_gen_function += qemudDispatchClientFailure
msg_gen_function += qemudReportError
msg_gen_function += regerror msg_gen_function += regerror
msg_gen_function += remoteError
msg_gen_function += remoteDispatchFormatError msg_gen_function += remoteDispatchFormatError
msg_gen_function += statsError
msg_gen_function += streamsReportError
msg_gen_function += usbReportError
msg_gen_function += umlReportError msg_gen_function += umlReportError
msg_gen_function += vah_error msg_gen_function += vah_error
msg_gen_function += vah_warning msg_gen_function += vah_warning
msg_gen_function += vboxError msg_gen_function += vboxError
msg_gen_function += virCommandError msg_gen_function += virCommandError
msg_gen_function += virConfError msg_gen_function += virConfError
msg_gen_function += virCPUReportError
msg_gen_function += virEventError
msg_gen_function += virDomainReportError msg_gen_function += virDomainReportError
msg_gen_function += virGenericReportError
msg_gen_function += virHashError msg_gen_function += virHashError
msg_gen_function += virHookReportError
msg_gen_function += virInterfaceReportError
msg_gen_function += virJSONError
msg_gen_function += virLibConnError msg_gen_function += virLibConnError
msg_gen_function += virLibDomainError msg_gen_function += virLibDomainError
msg_gen_function += virLibDomainSnapshotError
msg_gen_function += virLibInterfaceError
msg_gen_function += virLibNetworkError
msg_gen_function += virLibNodeDeviceError
msg_gen_function += virLibNWFilterError
msg_gen_function += virLibSecretError
msg_gen_function += virLibStoragePoolError
msg_gen_function += virLibStorageVolError
msg_gen_function += virNetworkReportError msg_gen_function += virNetworkReportError
msg_gen_function += virNodeDeviceReportError msg_gen_function += virNodeDeviceReportError
msg_gen_function += virNWFilterReportError
msg_gen_function += virRaiseError msg_gen_function += virRaiseError
msg_gen_function += virReportErrorHelper msg_gen_function += virReportErrorHelper
msg_gen_function += virReportSystemError msg_gen_function += virReportSystemError
msg_gen_function += virSecretReportError
msg_gen_function += virSecurityReportError msg_gen_function += virSecurityReportError
msg_gen_function += virSexprError msg_gen_function += virSexprError
msg_gen_function += virSmbiosReportError
msg_gen_function += virSocketError
msg_gen_function += virStatsError
msg_gen_function += virStorageReportError msg_gen_function += virStorageReportError
msg_gen_function += virUtilError
msg_gen_function += virXMLError msg_gen_function += virXMLError
msg_gen_function += virXenInotifyError msg_gen_function += virXenInotifyError
msg_gen_function += virXenStoreError msg_gen_function += virXenStoreError
@ -392,8 +450,6 @@ msg_gen_function += vmwareError
msg_gen_function += xenapiSessionErrorHandler msg_gen_function += xenapiSessionErrorHandler
msg_gen_function += xenUnifiedError msg_gen_function += xenUnifiedError
msg_gen_function += xenXMError msg_gen_function += xenXMError
msg_gen_function += VIR_ERROR
msg_gen_function += VIR_ERROR0
# Uncomment the following and run "make syntax-check" to see diagnostics # Uncomment the following and run "make syntax-check" to see diagnostics
# that are not yet marked for translation, but that need to be rewritten # that are not yet marked for translation, but that need to be rewritten
@ -468,19 +524,6 @@ sc_prohibit_gettext_markup:
halt='do not mark these strings for translation' \ halt='do not mark these strings for translation' \
$(_sc_search_regexp) $(_sc_search_regexp)
# Ensure that the syntax_check_exceptions file list in Makefile.am
# stays in sync with corresponding files in the repository.
sce = syntax_check_exceptions
sc_x_sc_dist_check:
@test "$$( ($(VC_LIST) | sed -n '/\.x-sc_/p' \
| sed 's|^$(_dot_escaped_srcdir)/||'; \
sed -n '/^$(sce) =[ ]*\\$$/,/[^\]$$/p' \
$(srcdir)/Makefile.am \
| sed 's/^ *//;/^$(sce) =/d' \
| tr -s '\012\\' ' ' | fmt -1 \
) | sort | uniq -u)" \
&& { echo 'Makefile.am: $(sce) mismatch' >&2; exit 1; } || :;
# We don't use this feature of maint.mk. # We don't use this feature of maint.mk.
prev_version_file = /dev/null prev_version_file = /dev/null
@ -497,6 +540,7 @@ ifeq (0,$(MAKELEVEL))
_submodule_hash = sed 's/^[ +-]//;s/ .*//' _submodule_hash = sed 's/^[ +-]//;s/ .*//'
_update_required := $(shell \ _update_required := $(shell \
cd '$(srcdir)'; \ cd '$(srcdir)'; \
test -d .git || { echo 0; exit; }; \
test -f po/Makevars || { echo 1; exit; }; \ test -f po/Makevars || { echo 1; exit; }; \
actual=$$(git submodule status | $(_submodule_hash); \ actual=$$(git submodule status | $(_submodule_hash); \
git hash-object bootstrap.conf; \ git hash-object bootstrap.conf; \
@ -536,3 +580,64 @@ _makefile_at_at_check_exceptions = ' && !/(SCHEMA|SYSCONF)DIR/'
# regenerate HACKING as part of the syntax-check # regenerate HACKING as part of the syntax-check
syntax-check: $(top_srcdir)/HACKING syntax-check: $(top_srcdir)/HACKING
# List all syntax-check exemptions:
exclude_file_name_regexp--sc_avoid_strcase = ^tools/virsh\.c$$
_src1=libvirt|fdstream|qemu/qemu_monitor|util/(command|util)|xen/xend_internal
exclude_file_name_regexp--sc_avoid_write = \
^(src/($(_src1))|daemon/libvirtd|tools/console)\.c$$
exclude_file_name_regexp--sc_bindtextdomain = ^(tests|examples)/
exclude_file_name_regexp--sc_po_check = ^docs/
exclude_file_name_regexp--sc_prohibit_VIR_ERR_NO_MEMORY = \
^(include/libvirt/virterror\.h|daemon/dispatch\.c|src/util/virterror\.c)$$
exclude_file_name_regexp--sc_prohibit_access_xok = ^src/util/util\.c$$
exclude_file_name_regexp--sc_prohibit_always_true_header_tests = \
(^docs|^python/(libvirt-override|typewrappers)\.c$$)
exclude_file_name_regexp--sc_prohibit_asprintf = \
^(bootstrap.conf$$|po/|src/util/util\.c$$|examples/domain-events/events-c/event-test\.c$$)
exclude_file_name_regexp--sc_prohibit_can_not = ^po/
exclude_file_name_regexp--sc_prohibit_close = \
(\.py$$|^docs/|(src/util/files\.c|src/libvirt\.c)$$)
exclude_file_name_regexp--sc_prohibit_doubled_word = ^po/
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
(^docs/api_extension/|^tests/qemuhelpdata/|\.(gif|ico|png)$$)
_src2=src/(util/util|libvirt|lxc/lxc_controller)
exclude_file_name_regexp--sc_prohibit_fork_wrappers = \
(^docs|^($(_src2)|tests/testutils|daemon/libvirtd)\.c$$)
exclude_file_name_regexp--sc_prohibit_gethostname = ^src/util/util\.c$$
exclude_file_name_regexp--sc_prohibit_gettext_noop = ^docs/
exclude_file_name_regexp--sc_prohibit_nonreentrant = \
^((po|docs|tests)/|tools/(virsh|console)\.c$$)
exclude_file_name_regexp--sc_prohibit_readlink = ^src/util/util\.c$$
exclude_file_name_regexp--sc_prohibit_sprintf = ^(docs/|HACKING$$)
exclude_file_name_regexp--sc_prohibit_strncpy = \
^(src/util/util|tools/virsh)\.c$$
exclude_file_name_regexp--sc_prohibit_xmlGetProp = ^src/util/xml\.c$$
exclude_file_name_regexp--sc_require_config_h = ^examples/
exclude_file_name_regexp--sc_require_config_h_first = ^examples/
exclude_file_name_regexp--sc_trailing_blank = (^docs/|\.(fig|gif|ico|png)$$)
exclude_file_name_regexp--sc_unmarked_diagnostics = \
^(docs/apibuild.py|tests/virt-aa-helper-test)$$

View File

@ -1,12 +1,18 @@
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_INIT([libvirt], [0.8.7], [libvir-list@redhat.com], [], [http://libvirt.org]) AC_INIT([libvirt], [0.9.1], [libvir-list@redhat.com], [], [http://libvirt.org])
AC_CONFIG_SRCDIR([src/libvirt.c]) AC_CONFIG_SRCDIR([src/libvirt.c])
AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
dnl Make automake keep quiet about wildcards & other GNUmake-isms dnl Make automake keep quiet about wildcards & other GNUmake-isms
AM_INIT_AUTOMAKE([-Wno-portability]) AM_INIT_AUTOMAKE([-Wno-portability])
AM_MAINTAINER_MODE([enable])
# Maintainer note - comment this line out if you plan to rerun
# GNULIB_POSIXCHECK testing to see if libvirt should be using more modules.
# Leave it uncommented for normal releases, for faster ./configure.
gl_ASSERT_NO_GNULIB_POSIXCHECK
# Use the silent-rules feature when possible. # Use the silent-rules feature when possible.
m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])]) m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
@ -28,6 +34,25 @@ AC_SUBST([LIBVIRT_VERSION])
AC_SUBST([LIBVIRT_VERSION_INFO]) AC_SUBST([LIBVIRT_VERSION_INFO])
AC_SUBST([LIBVIRT_VERSION_NUMBER]) AC_SUBST([LIBVIRT_VERSION_NUMBER])
AC_ARG_WITH([packager],
[AS_HELP_STRING([--with-packager],
[Extra packager name])],
[],[with_packager=no])
AC_ARG_WITH([packager-version],
[AS_HELP_STRING([--with-packager-version],
[Extra packager version])],
[],[with_packager_version=no])
if test "x$with_packager" != "xno"
then
AC_DEFINE_UNQUOTED([PACKAGER], ["$with_packager"],
[Extra package name])
fi
if test "x$with_packager_version" != "xno"
then
AC_DEFINE_UNQUOTED([PACKAGER_VERSION], ["$with_packager_version"],
[Extra package version])
fi
dnl Required minimum versions of all libs we depend on dnl Required minimum versions of all libs we depend on
LIBXML_REQUIRED="2.6.0" LIBXML_REQUIRED="2.6.0"
GNUTLS_REQUIRED="1.0.25" GNUTLS_REQUIRED="1.0.25"
@ -43,16 +68,17 @@ DEVMAPPER_REQUIRED=1.0.0
LIBCURL_REQUIRED="7.18.0" LIBCURL_REQUIRED="7.18.0"
LIBPCAP_REQUIRED="1.0.0" LIBPCAP_REQUIRED="1.0.0"
LIBNL_REQUIRED="1.1" LIBNL_REQUIRED="1.1"
LIBSSH2_REQUIRED="1.0"
dnl Checks for C compiler. dnl Checks for C compiler.
AC_PROG_CC AC_PROG_CC
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_CPP AC_PROG_CPP
AM_PROG_CC_STDC
gl_EARLY gl_EARLY
gl_INIT gl_INIT
AM_PROG_CC_STDC
AC_TYPE_UID_T AC_TYPE_UID_T
dnl Make sure we have an ANSI compiler dnl Make sure we have an ANSI compiler
@ -92,12 +118,11 @@ fi
AC_MSG_RESULT([$have_cpuid]) AC_MSG_RESULT([$have_cpuid])
dnl Availability of various common functions (non-fatal if missing). dnl Availability of various common functions (non-fatal if missing),
AC_CHECK_FUNCS_ONCE([cfmakeraw regexec sched_getaffinity getuid getgid initgroups \ dnl and various less common threadsafe functions
posix_fallocate mmap]) AC_CHECK_FUNCS_ONCE([cfmakeraw regexec sched_getaffinity getuid getgid \
geteuid initgroups posix_fallocate mmap kill \
dnl Availability of various not common threadsafe functions getmntent_r getgrnam_r getpwuid_r])
AC_CHECK_FUNCS_ONCE([strerror_r getmntent_r getgrnam_r getpwuid_r])
dnl Availability of pthread functions (if missing, win32 threading is dnl Availability of pthread functions (if missing, win32 threading is
dnl assumed). Because of $LIB_PTHREAD, we cannot use AC_CHECK_FUNCS_ONCE. dnl assumed). Because of $LIB_PTHREAD, we cannot use AC_CHECK_FUNCS_ONCE.
@ -234,19 +259,19 @@ AC_ARG_WITH([openvz],
AC_ARG_WITH([vmware], AC_ARG_WITH([vmware],
AC_HELP_STRING([--with-vmware], [add VMware support @<:@default=yes@:>@]),[],[with_vmware=yes]) AC_HELP_STRING([--with-vmware], [add VMware support @<:@default=yes@:>@]),[],[with_vmware=yes])
AC_ARG_WITH([libssh2], AC_ARG_WITH([libssh2],
AC_HELP_STRING([--with-libssh2=@<:@PFX@:>@], [libssh2 location @<:@default=/usr/local/lib@:>@]),[],[with_libssh2=yes]) AC_HELP_STRING([--with-libssh2], [libssh2 location @<:@default=check@:>@]),[],[with_libssh2=check])
AC_ARG_WITH([phyp], AC_ARG_WITH([phyp],
AC_HELP_STRING([--with-phyp], [add PHYP support @<:@default=check@:>@]),[],[with_phyp=check]) AC_HELP_STRING([--with-phyp], [add PHYP support @<:@default=check@:>@]),[],[with_phyp=check])
AC_ARG_WITH([xenapi], AC_ARG_WITH([xenapi],
AC_HELP_STRING([--with-xenapi], [add XenAPI support @<:@default=check@:>@]),[],[with_xenapi=check]) AC_HELP_STRING([--with-xenapi], [add XenAPI support @<:@default=check@:>@]),[],[with_xenapi=check])
AC_ARG_WITH([libxl],
AC_HELP_STRING([--with-libxl], [add libxenlight support @<:@default=check@:>@]),[],[with_libxl=check])
AC_ARG_WITH([vbox], AC_ARG_WITH([vbox],
AC_HELP_STRING([--with-vbox=@<:@PFX@:>@], AC_HELP_STRING([--with-vbox=@<:@PFX@:>@],
[VirtualBox XPCOMC location @<:@default=yes@:>@]),[], [VirtualBox XPCOMC location @<:@default=yes@:>@]),[],
[with_vbox=yes]) [with_vbox=yes])
AC_ARG_WITH([lxc], AC_ARG_WITH([lxc],
AC_HELP_STRING([--with-lxc], [add Linux Container support @<:@default=check@:>@]),[],[with_lxc=check]) AC_HELP_STRING([--with-lxc], [add Linux Container support @<:@default=check@:>@]),[],[with_lxc=check])
AC_ARG_WITH([one],
AC_HELP_STRING([--with-one], [add ONE support @<:@default=check@:>@]),[],[with_one=check])
AC_ARG_WITH([esx], AC_ARG_WITH([esx],
AC_HELP_STRING([--with-esx], [add ESX support @<:@default=check@:>@]),[],[with_esx=check]) AC_HELP_STRING([--with-esx], [add ESX support @<:@default=check@:>@]),[],[with_esx=check])
AC_ARG_WITH([test], AC_ARG_WITH([test],
@ -414,11 +439,6 @@ if test "$with_qemu" = "yes" ; then
fi fi
AM_CONDITIONAL([WITH_QEMU], [test "$with_qemu" = "yes"]) AM_CONDITIONAL([WITH_QEMU], [test "$with_qemu" = "yes"])
if test "$with_one" = "yes" ; then
AC_DEFINE_UNQUOTED([WITH_ONE],1,[whether ONE driver is enabled])
fi
AM_CONDITIONAL([WITH_ONE],[test "$with_one" = "yes"])
if test "$with_test" = "yes" ; then if test "$with_test" = "yes" ; then
AC_DEFINE_UNQUOTED([WITH_TEST], 1, [whether Test driver is enabled]) AC_DEFINE_UNQUOTED([WITH_TEST], 1, [whether Test driver is enabled])
fi fi
@ -473,6 +493,46 @@ fi
AC_SUBST([LIBXENSERVER_CFLAGS]) AC_SUBST([LIBXENSERVER_CFLAGS])
AC_SUBST([LIBXENSERVER_LIBS]) AC_SUBST([LIBXENSERVER_LIBS])
old_LIBS="$LIBS"
old_CFLAGS="$CFLAGS"
LIBXL_LIBS=""
LIBXL_CFLAGS=""
dnl search for libxl, aka libxenlight
fail=0
if test "$with_libxl" != "no" ; then
if test "$with_libxl" != "yes" && test "$with_libxl" != "check" ; then
LIBXL_CFLAGS="-I$with_libxl/include"
LIBXL_LIBS="-L$with_libxl"
fi
CFLAGS="$CFLAGS $LIBXL_CFLAGS"
LIBS="$LIBS $LIBXL_LIBS"
AC_CHECK_LIB([xenlight], [libxl_domain_create_new], [
with_libxl=yes
LIBXL_LIBS="$LIBXL_LIBS -lxenlight -lxenstore -lxenctrl -lxenguest -luuid -lutil -lblktapctl"
],[
if test "$with_libxl" = "yes"; then
fail=1
fi
with_libxl=no
],[
-lxenstore -lxenctrl -lxenguest -luuid -lutil -lblktapctl
])
fi
LIBS="$old_LIBS"
CFLAGS="$old_CFLAGS"
if test $fail = 1; then
AC_MSG_ERROR([You must install the libxl Library to compile libxenlight driver with -lxl])
fi
if test "$with_libxl" = "yes"; then
AC_DEFINE_UNQUOTED([WITH_LIBXL], 1, [whether libxenlight driver is enabled])
fi
AM_CONDITIONAL([WITH_LIBXL], [test "$with_libxl" = "yes"])
AC_SUBST([LIBXL_CFLAGS])
AC_SUBST([LIBXL_LIBS])
old_LIBS="$LIBS" old_LIBS="$LIBS"
old_CFLAGS="$CFLAGS" old_CFLAGS="$CFLAGS"
@ -541,6 +601,8 @@ AM_CONDITIONAL([WITH_XEN], [test "$with_xen" = "yes"])
AC_SUBST([XEN_CFLAGS]) AC_SUBST([XEN_CFLAGS])
AC_SUBST([XEN_LIBS]) AC_SUBST([XEN_LIBS])
AM_CONDITIONAL([WITH_XENXS], [test "$with_libxl" = "yes" || test "$with_xen" = "yes"])
dnl dnl
dnl check for kernel headers required by xen_inotify dnl check for kernel headers required by xen_inotify
dnl dnl
@ -659,34 +721,6 @@ fi
dnl Need to test if pkg-config exists dnl Need to test if pkg-config exists
PKG_PROG_PKG_CONFIG PKG_PROG_PKG_CONFIG
dnl OpenNebula driver Compilation setting
dnl
if test "$with_libvirtd" = "no" ; then
with_one=no
fi
XMLRPC_CFLAGS=
XMLRPC_LIBS=
if test "x$with_one" = "xyes" || test "x$with_one" = "xcheck"; then
PKG_CHECK_MODULES(XMLRPC, xmlrpc_client >= $XMLRPC_REQUIRED,
[with_one=yes], [
if test "x$with_one" = "xcheck" ; then
with_one=no
else
AC_MSG_ERROR(
[You must install XMLRPC-C >= $XMLRPC_REQUIRED to compile libvirt ONE driver])
fi
])
if test "x$with_one" = "xyes" ; then
AC_DEFINE_UNQUOTED([HAVE_XMLRPC], 1,
[whether One is used to broadcast server presence])
fi
fi
AM_CONDITIONAL([HAVE_XMLRPC], [test "x$with_one" = "xyes"])
AM_CONDITIONAL([WITH_ONE], [test "x$with_one" = "xyes"])
AC_SUBST([XMLRPC_CFLAGS])
AC_SUBST([XMLRPC_LIBS])
dnl ========================================================================== dnl ==========================================================================
dnl find libxml2 library, borrowed from xmlsec dnl find libxml2 library, borrowed from xmlsec
@ -985,7 +1019,7 @@ AUDIT_LIBS=
if test "$with_audit" != "no" ; then if test "$with_audit" != "no" ; then
old_cflags="$CFLAGS" old_cflags="$CFLAGS"
old_libs="$LIBS" old_libs="$LIBS"
if test "$with_audit" != "check" && "$with_audit" != "yes" ; then if test "$with_audit" != "check" && test "$with_audit" != "yes" ; then
AUDIT_CFLAGS="-I$with_audit/include" AUDIT_CFLAGS="-I$with_audit/include"
AUDIT_LIBS="-L$with_audit/lib" AUDIT_LIBS="-L$with_audit/lib"
fi fi
@ -993,7 +1027,7 @@ if test "$with_audit" != "no" ; then
LIBS="$LIBS $AUDIT_LIBS" LIBS="$LIBS $AUDIT_LIBS"
fail=0 fail=0
AC_CHECK_HEADER([libaudit.h], [], [fail=1]) AC_CHECK_HEADER([libaudit.h], [], [fail=1])
AC_CHECK_LIB([audit], [audit_is_enabled], [], [fail=1]) AC_CHECK_LIB([audit], [audit_encode_nv_string], [], [fail=1])
if test $fail = 1 ; then if test $fail = 1 ; then
if test "$with_audit" = "yes" ; then if test "$with_audit" = "yes" ; then
@ -1295,78 +1329,33 @@ AM_CONDITIONAL([WITH_UML], [test "$with_uml" = "yes"])
dnl dnl
dnl libssh checks dnl check for libssh2 (PHYP)
dnl dnl
if test "$with_libssh2" != "yes" && test "$with_libssh2" != "no"; then LIBSSH2_CFLAGS=""
libssh2_path="$with_libssh2" LIBSSH2_LIBS=""
elif test "$with_libssh2" = "yes"; then
libssh2_path="/usr/local/lib/" if test "$with_phyp" = "yes" || test "$with_phyp" = "check"; then
elif test "$with_libssh2" = "no"; then PKG_CHECK_MODULES([LIBSSH2], [libssh2 >= $LIBSSH2_REQUIRED], [
with_phyp="no"; with_phyp=yes
], [
if test "$with_phyp" = "check"; then
with_phyp=no
AC_MSG_NOTICE([libssh2 is required for Phyp driver, disabling it])
else
AC_MSG_ERROR([libssh2 >= $LIBSSH2_REQUIRED is required for Phyp driver])
fi
])
fi fi
if test "$with_phyp" = "check"; then if test "$with_phyp" = "yes"; then
AC_CHECK_LIB([ssh2],[libssh2_session_startup],[ AC_DEFINE_UNQUOTED([WITH_PHYP], 1, [whether IBM HMC / IVM driver is enabled])
LIBSSH2_LIBS="$LIBSSH2_LIBS -lssh2 -L$libssh2_path"
AC_SUBST([LIBSSH2_LIBS])
],[
with_phyp="no"
with_libssh2="no";
],[])
if test "$with_phyp" != "no"; then
AC_CHECK_HEADERS([libssh2.h],[
with_phyp="yes"
LIBSSH2_CFLAGS="-I/usr/local/include"
AC_SUBST([LIBSSH2_CFLAGS])
],[
with_phyp="no"
with_libssh2="no";
],[
])
fi
if test "$with_phyp" != "no"; then
saved_libs="$LIBS"
LIBS="$LIBS -L$libssh2_path -lssh2"
AC_TRY_LINK([#include <libssh2.h>], [
(void) libssh2_session_block_directions(NULL);
], [
AC_DEFINE_UNQUOTED([WITH_PHYP], 1, [whether IBM HMC / IVM driver is enabled])
], [
with_phyp=no
AC_MSG_NOTICE([Function libssh2_session_block_directions() not present in your version of libssh2 but required for Phyp driver, disabling it])
])
LIBS="$saved_libs"
fi
elif test "$with_phyp" = "yes"; then
AC_CHECK_LIB([ssh2],[libssh2_session_startup],[
LIBSSH2_LIBS="$LIBSSH2_LIBS -lssh2 -L$libssh2_path"
AC_SUBST([LIBSSH2_LIBS])],[
AC_MSG_ERROR([You must install the libssh2 to compile Phyp driver.])
])
AC_CHECK_HEADERS([libssh2.h],[
LIBSSH2_CFLAGS="-I/usr/local/include"
AC_SUBST([LIBSSH2_CFLAGS])],[
AC_MSG_ERROR([Cannot find libssh2 headers. Is libssh2 installed ?])
],[])
saved_libs="$LIBS"
LIBS="$LIBS -lssh2"
AC_TRY_LINK([#include <libssh2.h>], [
(void) libssh2_session_block_directions(NULL);
], [], [
AC_MSG_ERROR([Function libssh2_session_block_directions() not present in your version of libssh2. Need >= 1.0])
])
LIBS="$saved_libs"
AC_DEFINE_UNQUOTED([WITH_PHYP], 1,
[whether IBM HMC / IVM driver is enabled])
fi fi
AM_CONDITIONAL([WITH_PHYP],[test "$with_phyp" = "yes"]) AM_CONDITIONAL([WITH_PHYP],[test "$with_phyp" = "yes"])
AC_SUBST([LIBSSH2_CFLAGS])
AC_SUBST([LIBSSH2_LIBS])
dnl libcap-ng dnl libcap-ng
AC_ARG_WITH([capng], AC_ARG_WITH([capng],
AC_HELP_STRING([--with-capng], [use libcap-ng to reduce libvirtd privileges @<:@default=check@:>@]), AC_HELP_STRING([--with-capng], [use libcap-ng to reduce libvirtd privileges @<:@default=check@:>@]),
@ -1678,42 +1667,27 @@ if test "$with_storage_mpath" = "check" && test "$with_linux" = "yes"; then
fi fi
AM_CONDITIONAL([WITH_STORAGE_MPATH], [test "$with_storage_mpath" = "yes"]) AM_CONDITIONAL([WITH_STORAGE_MPATH], [test "$with_storage_mpath" = "yes"])
if test "$with_storage_mpath" = "yes"; then
DEVMAPPER_CFLAGS=
DEVMAPPER_LIBS=
PKG_CHECK_MODULES([DEVMAPPER], [devmapper >= $DEVMAPPER_REQUIRED], [], [DEVMAPPER_FOUND=no])
if test "$DEVMAPPER_FOUND" = "no"; then
# devmapper is missing pkg-config files in ubuntu, suse, etc
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
DEVMAPPER_FOUND=yes
AC_CHECK_HEADER([libdevmapper.h],,[DEVMAPPER_FOUND=no])
AC_CHECK_LIB([devmapper], [dm_task_run],,[DEVMAPPER_FOUND=no])
DEVMAPPER_LIBS="-ldevmapper"
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
if test "$DEVMAPPER_FOUND" = "no" ; then
AC_MSG_ERROR([You must install device-mapper-devel/libdevmapper >= $DEVMAPPER_REQUIRED to compile libvirt])
fi
fi
AC_SUBST([DEVMAPPER_CFLAGS])
AC_SUBST([DEVMAPPER_LIBS])
LIBPARTED_CFLAGS= LIBPARTED_CFLAGS=
LIBPARTED_LIBS= LIBPARTED_LIBS=
if test "$with_storage_disk" = "yes" || test "$with_storage_disk" = "check"; then if test "$with_storage_disk" = "yes" ||
test "$with_storage_disk" = "check"; then
AC_PATH_PROG([PARTED], [parted], [], [$PATH:/sbin:/usr/sbin]) AC_PATH_PROG([PARTED], [parted], [], [$PATH:/sbin:/usr/sbin])
AC_PATH_PROG([DMSETUP], [dmsetup], [], [$PATH:/sbin:/usr/sbin])
if test -z "$PARTED" ; then if test -z "$PARTED" ; then
with_storage_disk=no
PARTED_FOUND=no PARTED_FOUND=no
else else
PARTED_FOUND=yes PARTED_FOUND=yes
fi fi
if test "$with_storage_disk" != "no" && test "x$PKG_CONFIG" != "x" ; then if test -z "$DMSETUP" ; then
PKG_CHECK_MODULES(LIBPARTED, libparted >= $PARTED_REQUIRED, [], [PARTED_FOUND=no]) DMSETUP_FOUND=no
else
DMSETUP_FOUND=yes
fi
if test "$PARTED_FOUND" = "yes" && test "x$PKG_CONFIG" != "x" ; then
PKG_CHECK_MODULES([LIBPARTED], [libparted >= $PARTED_REQUIRED], [],
[PARTED_FOUND=no])
fi fi
if test "$PARTED_FOUND" = "no"; then if test "$PARTED_FOUND" = "no"; then
# RHEL-5 vintage parted is missing pkg-config files # RHEL-5 vintage parted is missing pkg-config files
@ -1728,25 +1702,56 @@ if test "$with_storage_disk" = "yes" || test "$with_storage_disk" = "check"; the
CFLAGS="$save_CFLAGS" CFLAGS="$save_CFLAGS"
fi fi
if test "$PARTED_FOUND" = "no" ; then if test "$with_storage_disk" = "yes" &&
if test "$with_storage_disk" = "yes" ; then test "$PARTED_FOUND:$DMSETUP_FOUND" != "yes:yes"; then
AC_MSG_ERROR([We need parted for disk storage driver]) AC_MSG_ERROR([Need both parted and dmsetup for disk storage driver])
else fi
if test "$with_storage_disk" = "check"; then
if test "$PARTED_FOUND:$DMSETUP_FOUND" != "yes:yes"; then
with_storage_disk=no with_storage_disk=no
else
with_storage_disk=yes
fi fi
else
with_storage_disk=yes
fi fi
if test "$with_storage_disk" = "yes"; then if test "$with_storage_disk" = "yes"; then
AC_DEFINE_UNQUOTED([WITH_STORAGE_DISK], 1, [whether Disk backend for storage driver is enabled]) AC_DEFINE_UNQUOTED([WITH_STORAGE_DISK], 1,
AC_DEFINE_UNQUOTED([PARTED],["$PARTED"], [Location or name of the parted program]) [whether Disk backend for storage driver is enabled])
AC_DEFINE_UNQUOTED([PARTED],["$PARTED"],
[Location or name of the parted program])
AC_DEFINE_UNQUOTED([DMSETUP],["$DMSETUP"],
[Location or name of the dmsetup program])
fi fi
fi fi
AM_CONDITIONAL([WITH_STORAGE_DISK], [test "$with_storage_disk" = "yes"]) AM_CONDITIONAL([WITH_STORAGE_DISK], [test "$with_storage_disk" = "yes"])
AC_SUBST([LIBPARTED_CFLAGS]) AC_SUBST([LIBPARTED_CFLAGS])
AC_SUBST([LIBPARTED_LIBS]) AC_SUBST([LIBPARTED_LIBS])
if test "$with_storage_mpath" = "yes" ||
test "$with_storage_disk" = "yes"; then
DEVMAPPER_CFLAGS=
DEVMAPPER_LIBS=
PKG_CHECK_MODULES([DEVMAPPER], [devmapper >= $DEVMAPPER_REQUIRED], [], [DEVMAPPER_FOUND=no])
if test "$DEVMAPPER_FOUND" = "no"; then
# devmapper is missing pkg-config files in ubuntu, suse, etc
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
DEVMAPPER_FOUND=yes
AC_CHECK_LIB([devmapper], [dm_task_run],,[DEVMAPPER_FOUND=no])
DEVMAPPER_LIBS="-ldevmapper"
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
AC_CHECK_HEADERS([libdevmapper.h],,[DEVMAPPER_FOUND=no])
if test "$DEVMAPPER_FOUND" = "no" ; then
AC_MSG_ERROR([You must install device-mapper-devel/libdevmapper >= $DEVMAPPER_REQUIRED to compile libvirt])
fi
fi
AC_SUBST([DEVMAPPER_CFLAGS])
AC_SUBST([DEVMAPPER_LIBS])
dnl dnl
dnl check for libcurl (ESX/XenAPI) dnl check for libcurl (ESX/XenAPI)
dnl dnl
@ -1868,15 +1873,13 @@ if test "$with_python" != "no" ; then
then then
PYTHON_INCLUDES=-I/usr/include/python$PYTHON_VERSION PYTHON_INCLUDES=-I/usr/include/python$PYTHON_VERSION
else else
AC_MSG_NOTICE([Could not find python$PYTHON_VERSION/Python.h, disabling bindings]) AC_MSG_ERROR([You must install python-devel to build Python bindings])
with_python=no
fi fi
fi fi
fi fi
fi fi
else else
AC_MSG_NOTICE([Could not find python interpreter, disabling bindings]) AC_MSG_ERROR([You must install python to build Python bindings])
with_python=no
fi fi
else else
AC_MSG_NOTICE([Could not find python in $with_python, disabling bindings]) AC_MSG_NOTICE([Could not find python in $with_python, disabling bindings])
@ -1921,12 +1924,14 @@ AC_ARG_ENABLE([test-coverage],
enable_coverage=$enableval enable_coverage=$enableval
if test "${enable_coverage}" = yes; then if test "${enable_coverage}" = yes; then
COMPILER_FLAGS= save_WARN_CFLAGS=$WARN_CFLAGS
gl_COMPILER_FLAGS(-fprofile-arcs) WARN_CFLAGS=
gl_COMPILER_FLAGS(-ftest-coverage) gl_WARN_ADD([-fprofile-arcs])
AC_SUBST([COVERAGE_CFLAGS], [$COMPILER_FLAGS]) gl_WARN_ADD([-ftest-coverage])
AC_SUBST([COVERAGE_LDFLAGS], [$COMPILER_FLAGS]) COVERAGE_FLAGS=$WARN_CFLAGS
COMPILER_FLAGS= AC_SUBST([COVERAGE_CFLAGS], [$COVERAGE_FLAGS])
AC_SUBST([COVERAGE_LDFLAGS], [$COVERAGE_FLAGS])
WARN_CFLAGS=$save_WARN_CFLAGS
fi fi
AC_ARG_ENABLE([test-oom], AC_ARG_ENABLE([test-oom],
@ -2292,7 +2297,7 @@ cp -f COPYING.LIB COPYING
# Detect when running under the clang static analyzer's scan-build driver # Detect when running under the clang static analyzer's scan-build driver
# or Coverity-prevent's cov-build. Define STATIC_ANALYSIS accordingly. # or Coverity-prevent's cov-build. Define STATIC_ANALYSIS accordingly.
test -n "$CCC_ANALYZER_ANALYSIS$COVERITY_BUILD_COMMAND" && t=1 || t=0 test -n "${CCC_ANALYZER_ANALYSIS+set}$COVERITY_BUILD_COMMAND" && t=1 || t=0
AC_DEFINE_UNQUOTED([STATIC_ANALYSIS], [$t], AC_DEFINE_UNQUOTED([STATIC_ANALYSIS], [$t],
[Define to 1 when performing static analysis.]) [Define to 1 when performing static analysis.])
@ -2330,9 +2335,9 @@ AC_MSG_NOTICE([ OpenVZ: $with_openvz])
AC_MSG_NOTICE([ VMware: $with_vmware]) AC_MSG_NOTICE([ VMware: $with_vmware])
AC_MSG_NOTICE([ VBox: $with_vbox]) AC_MSG_NOTICE([ VBox: $with_vbox])
AC_MSG_NOTICE([ XenAPI: $with_xenapi]) AC_MSG_NOTICE([ XenAPI: $with_xenapi])
AC_MSG_NOTICE([xenlight: $with_libxl])
AC_MSG_NOTICE([ LXC: $with_lxc]) AC_MSG_NOTICE([ LXC: $with_lxc])
AC_MSG_NOTICE([ PHYP: $with_phyp]) AC_MSG_NOTICE([ PHYP: $with_phyp])
AC_MSG_NOTICE([ ONE: $with_one])
AC_MSG_NOTICE([ ESX: $with_esx]) AC_MSG_NOTICE([ ESX: $with_esx])
AC_MSG_NOTICE([ Test: $with_test]) AC_MSG_NOTICE([ Test: $with_test])
AC_MSG_NOTICE([ Remote: $with_remote]) AC_MSG_NOTICE([ Remote: $with_remote])
@ -2439,6 +2444,11 @@ AC_MSG_NOTICE([ xenapi: $LIBXENSERVER_CFLAGS $LIBXENSERVER_LIBS])
else else
AC_MSG_NOTICE([ xenapi: no]) AC_MSG_NOTICE([ xenapi: no])
fi fi
if test "$with_libxl" = "yes" ; then
AC_MSG_NOTICE([xenlight: $LIBXL_CFLAGS $LIBXL_LIBS])
else
AC_MSG_NOTICE([xenlight: no])
fi
if test "$with_hal" = "yes" ; then if test "$with_hal" = "yes" ; then
AC_MSG_NOTICE([ hal: $HAL_CFLAGS $HAL_LIBS]) AC_MSG_NOTICE([ hal: $HAL_CFLAGS $HAL_LIBS])
else else
@ -2454,11 +2464,6 @@ AC_MSG_NOTICE([ netcf: $NETCF_CFLAGS $NETCF_LIBS])
else else
AC_MSG_NOTICE([ netcf: no]) AC_MSG_NOTICE([ netcf: no])
fi fi
if test "$with_one" = "yes" ; then
AC_MSG_NOTICE([ xmlrpc: $XMLRPC_CFLAGS $XMLRPC_LIBS])
else
AC_MSG_NOTICE([ xmlrpc: no])
fi
if test "$with_qemu" = "yes" && test "$LIBPCAP_FOUND" != "no"; then if test "$with_qemu" = "yes" && test "$LIBPCAP_FOUND" != "no"; then
AC_MSG_NOTICE([ pcap: $LIBPCAP_CFLAGS $LIBPCAP_LIBS]) AC_MSG_NOTICE([ pcap: $LIBPCAP_CFLAGS $LIBPCAP_LIBS])
else else
@ -2489,6 +2494,7 @@ AC_MSG_NOTICE([Miscellaneous])
AC_MSG_NOTICE([]) AC_MSG_NOTICE([])
AC_MSG_NOTICE([ Debug: $enable_debug]) AC_MSG_NOTICE([ Debug: $enable_debug])
AC_MSG_NOTICE([ Warnings: $enable_compile_warnings]) AC_MSG_NOTICE([ Warnings: $enable_compile_warnings])
AC_MSG_NOTICE([Warning Flags: $WARN_CFLAGS])
AC_MSG_NOTICE([ Readline: $lv_use_readline]) AC_MSG_NOTICE([ Readline: $lv_use_readline])
AC_MSG_NOTICE([ Python: $with_python]) AC_MSG_NOTICE([ Python: $with_python])
AC_MSG_NOTICE([ DTrace: $with_dtrace]) AC_MSG_NOTICE([ DTrace: $with_dtrace])

3
daemon/.gitignore vendored
View File

@ -8,6 +8,7 @@ libvirt_qemud
libvirtd libvirtd
libvirtd.init libvirtd.init
libvirtd*.logrotate libvirtd*.logrotate
libvirtd.pod
libvirtd.8 libvirtd.8
libvirtd.8.in
libvirtd.pod
probes.h probes.h

View File

@ -3,7 +3,6 @@
CLEANFILES = CLEANFILES =
DAEMON_SOURCES = \ DAEMON_SOURCES = \
event.c event.h \
libvirtd.c libvirtd.h \ libvirtd.c libvirtd.h \
remote.c remote.h \ remote.c remote.h \
dispatch.c dispatch.h \ dispatch.c dispatch.h \
@ -27,17 +26,20 @@ EXTRA_DIST = \
remote_generate_stubs.pl \ remote_generate_stubs.pl \
libvirtd.conf \ libvirtd.conf \
libvirtd.init.in \ libvirtd.init.in \
libvirtd.upstart \
libvirtd.policy-0 \ libvirtd.policy-0 \
libvirtd.policy-1 \ libvirtd.policy-1 \
libvirtd.sasl \ libvirtd.sasl \
libvirtd.sysconf \ libvirtd.sysconf \
libvirtd.aug \ libvirtd.aug \
libvirtd.logrotate.in \
libvirtd.qemu.logrotate.in \ libvirtd.qemu.logrotate.in \
libvirtd.lxc.logrotate.in \ libvirtd.lxc.logrotate.in \
libvirtd.uml.logrotate.in \ libvirtd.uml.logrotate.in \
test_libvirtd.aug \ test_libvirtd.aug \
THREADING.txt \ THREADING.txt \
libvirtd.pod.in \ libvirtd.pod.in \
libvirtd.8.in \
libvirtd.stp \ libvirtd.stp \
$(AVAHI_SOURCES) \ $(AVAHI_SOURCES) \
$(DAEMON_SOURCES) $(DAEMON_SOURCES)
@ -46,7 +48,7 @@ BUILT_SOURCES =
if WITH_LIBVIRTD if WITH_LIBVIRTD
man_MANS = libvirtd.8 man8_MANS = libvirtd.8
sbin_PROGRAMS = libvirtd sbin_PROGRAMS = libvirtd
@ -59,10 +61,7 @@ augeas_DATA = libvirtd.aug
augeastestsdir = $(datadir)/augeas/lenses/tests augeastestsdir = $(datadir)/augeas/lenses/tests
augeastests_DATA = test_libvirtd.aug augeastests_DATA = test_libvirtd.aug
POD2MAN = pod2man -c "Virtualization Support" \ libvirtd.8: $(srcdir)/libvirtd.8.in
-r "$(PACKAGE)-$(VERSION)" -s 8
libvirtd.pod: libvirtd.pod.in
sed \ sed \
-e 's![@]sysconfdir[@]!$(sysconfdir)!g' \ -e 's![@]sysconfdir[@]!$(sysconfdir)!g' \
-e 's![@]localstatedir[@]!$(localstatedir)!g' \ -e 's![@]localstatedir[@]!$(localstatedir)!g' \
@ -70,9 +69,6 @@ libvirtd.pod: libvirtd.pod.in
< $< > $@-t < $< > $@-t
mv $@-t $@ mv $@-t $@
libvirtd.8: libvirtd.pod
$(AM_V_GEN)$(POD2MAN) $< $@
libvirtd_SOURCES = $(DAEMON_SOURCES) libvirtd_SOURCES = $(DAEMON_SOURCES)
#-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_C_SOURCE=199506L #-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_C_SOURCE=199506L
@ -111,12 +107,12 @@ if WITH_LXC
libvirtd_LDADD += ../src/libvirt_driver_lxc.la libvirtd_LDADD += ../src/libvirt_driver_lxc.la
endif endif
if WITH_UML if WITH_LIBXL
libvirtd_LDADD += ../src/libvirt_driver_uml.la libvirtd_LDADD += ../src/libvirt_driver_libxl.la
endif endif
if WITH_ONE if WITH_UML
libvirtd_LDADD += ../src/libvirt_driver_one.la libvirtd_LDADD += ../src/libvirt_driver_uml.la
endif endif
if WITH_STORAGE_DIR if WITH_STORAGE_DIR
@ -170,7 +166,7 @@ nodist_libvirtd_SOURCES = probes.h
BUILT_SOURCES += probes.h BUILT_SOURCES += probes.h
tapsetdir = $(datadir)/systemtap/tapsets tapsetdir = $(datadir)/systemtap/tapset
tapset_DATA = libvirtd.stp tapset_DATA = libvirtd.stp
probes.h: probes.d probes.h: probes.d
@ -245,10 +241,16 @@ qemu_dispatch_ret.h: $(srcdir)/remote_generate_stubs.pl $(QEMU_PROTOCOL)
$(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -r qemu $(QEMU_PROTOCOL) > $@ $(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -r qemu $(QEMU_PROTOCOL) > $@
LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \ LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \
libvirtd.uml.logrotate libvirtd.uml.logrotate libvirtd.logrotate
BUILT_SOURCES += $(LOGROTATE_CONFS) BUILT_SOURCES += $(LOGROTATE_CONFS)
libvirtd.logrotate: libvirtd.logrotate.in
sed \
-e 's![@]localstatedir[@]!$(localstatedir)!g' \
< $< > $@-t
mv $@-t $@
libvirtd.qemu.logrotate: libvirtd.qemu.logrotate.in libvirtd.qemu.logrotate: libvirtd.qemu.logrotate.in
sed \ sed \
-e 's![@]localstatedir[@]!$(localstatedir)!g' \ -e 's![@]localstatedir[@]!$(localstatedir)!g' \
@ -272,6 +274,7 @@ install-logrotate: $(LOGROTATE_CONFS)
mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/lxc/ mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/lxc/
mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/uml/ mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/uml/
mkdir -p $(DESTDIR)$(sysconfdir)/logrotate.d/ mkdir -p $(DESTDIR)$(sysconfdir)/logrotate.d/
$(INSTALL_DATA) libvirtd.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd
$(INSTALL_DATA) libvirtd.qemu.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.qemu $(INSTALL_DATA) libvirtd.qemu.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.qemu
$(INSTALL_DATA) libvirtd.lxc.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.lxc $(INSTALL_DATA) libvirtd.lxc.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.lxc
$(INSTALL_DATA) libvirtd.uml.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.uml $(INSTALL_DATA) libvirtd.uml.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.uml
@ -301,8 +304,9 @@ libvirtd.init: libvirtd.init.in $(top_builddir)/config.status
mv $@-t $@ mv $@-t $@
check-local: check-local:
test -x '$(AUGPARSE)' \ $(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
&& '$(AUGPARSE)' -I $(srcdir) $(srcdir)/test_libvirtd.aug || : '$(AUGPARSE)' -I $(srcdir) $(srcdir)/test_libvirtd.aug; \
fi
else else
@ -321,6 +325,13 @@ install-data-local: install-data-sasl
uninstall-local:: uninstall-data-sasl uninstall-local:: uninstall-data-sasl
endif # WITH_LIBVIRTD endif # WITH_LIBVIRTD
# This is needed for 'make dist' too, so can't wrap in WITH_LIBVIRTD.
POD2MAN = pod2man -c "Virtualization Support" \
-r "$(PACKAGE)-$(VERSION)" -s 8
$(srcdir)/libvirtd.8.in: libvirtd.pod.in
$(AM_V_GEN)$(POD2MAN) $< $@
# This is needed for clients too, so can't wrap in # This is needed for clients too, so can't wrap in
# the WITH_LIBVIRTD conditional # the WITH_LIBVIRTD conditional
if HAVE_SASL if HAVE_SASL
@ -337,5 +348,6 @@ uninstall-data-sasl:
endif endif
CLEANFILES += $(BUILT_SOURCES) $(man_MANS) libvirtd.pod CLEANFILES += $(BUILT_SOURCES) $(man8_MANS)
CLEANFILES += *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda CLEANFILES += *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda
MAINTAINERCLEANFILES = $(srcdir)/libvirtd.8.in

View File

@ -26,7 +26,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdbool.h>
#include "dispatch.h" #include "dispatch.h"
#include "remote.h" #include "remote.h"
@ -113,15 +112,10 @@ void remoteDispatchOOMError (remote_error *rerr)
} }
void remoteDispatchConnError (remote_error *rerr, void remoteDispatchError(remote_error *rerr)
virConnectPtr conn)
{ {
virErrorPtr verr; virErrorPtr verr = virGetLastError();
if (conn)
verr = virConnGetLastError(conn);
else
verr = virGetLastError();
if (verr) if (verr)
remoteDispatchCopyError(rerr, verr); remoteDispatchCopyError(rerr, verr);
else else
@ -141,7 +135,7 @@ remoteSerializeError(struct qemud_client *client,
unsigned int len; unsigned int len;
struct qemud_client_message *msg = NULL; struct qemud_client_message *msg = NULL;
DEBUG("prog=%d ver=%d proc=%d type=%d serial=%d, msg=%s", VIR_DEBUG("prog=%d ver=%d proc=%d type=%d serial=%d, msg=%s",
program, version, procedure, type, serial, program, version, procedure, type, serial,
rerr->message ? *rerr->message : "(none)"); rerr->message ? *rerr->message : "(none)");
@ -372,7 +366,7 @@ remoteDispatchClientRequest(struct qemud_server *server,
remote_error rerr; remote_error rerr;
bool qemu_call; bool qemu_call;
DEBUG("prog=%d ver=%d type=%d status=%d serial=%d proc=%d", VIR_DEBUG("prog=%d ver=%d type=%d status=%d serial=%d proc=%d",
msg->hdr.prog, msg->hdr.vers, msg->hdr.type, msg->hdr.prog, msg->hdr.vers, msg->hdr.type,
msg->hdr.status, msg->hdr.serial, msg->hdr.proc); msg->hdr.status, msg->hdr.serial, msg->hdr.proc);
@ -631,7 +625,7 @@ remoteSendStreamData(struct qemud_client *client,
struct qemud_client_message *msg; struct qemud_client_message *msg;
XDR xdr; XDR xdr;
DEBUG("client=%p stream=%p data=%p len=%d", client, stream, data, len); VIR_DEBUG("client=%p stream=%p data=%p len=%d", client, stream, data, len);
if (VIR_ALLOC(msg) < 0) { if (VIR_ALLOC(msg) < 0) {
return -1; return -1;
@ -682,7 +676,7 @@ remoteSendStreamData(struct qemud_client *client,
xdr_destroy (&xdr); xdr_destroy (&xdr);
DEBUG("Total %d", msg->bufferOffset); VIR_DEBUG("Total %d", msg->bufferOffset);
} }
if (data) if (data)
msg->streamTX = 1; msg->streamTX = 1;

View File

@ -46,8 +46,7 @@ void remoteDispatchFormatError (remote_error *rerr,
void remoteDispatchAuthError (remote_error *rerr); void remoteDispatchAuthError (remote_error *rerr);
void remoteDispatchGenericError (remote_error *rerr); void remoteDispatchGenericError (remote_error *rerr);
void remoteDispatchOOMError (remote_error *rerr); void remoteDispatchOOMError (remote_error *rerr);
void remoteDispatchConnError (remote_error *rerr, void remoteDispatchError(remote_error *rerr);
virConnectPtr conn);
int int

View File

@ -1,7 +1,7 @@
/* /*
* libvirtd.c: daemon start of day, guest process & i/o management * libvirtd.c: daemon start of day, guest process & i/o management
* *
* Copyright (C) 2006-2010 Red Hat, Inc. * Copyright (C) 2006-2011 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange * Copyright (C) 2006 Daniel P. Berrange
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
@ -63,6 +63,7 @@
#include "remote_driver.h" #include "remote_driver.h"
#include "conf.h" #include "conf.h"
#include "event.h" #include "event.h"
#include "event_poll.h"
#include "memory.h" #include "memory.h"
#include "stream.h" #include "stream.h"
#include "hooks.h" #include "hooks.h"
@ -80,12 +81,12 @@
# ifdef WITH_LXC # ifdef WITH_LXC
# include "lxc/lxc_driver.h" # include "lxc/lxc_driver.h"
# endif # endif
# ifdef WITH_LIBXL
# include "libxl/libxl_driver.h"
# endif
# ifdef WITH_UML # ifdef WITH_UML
# include "uml/uml_driver.h" # include "uml/uml_driver.h"
# endif # endif
# ifdef WITH_ONE
# include "opennebula/one_driver.h"
# endif
# ifdef WITH_NETWORK # ifdef WITH_NETWORK
# include "network/bridge_driver.h" # include "network/bridge_driver.h"
# endif # endif
@ -246,6 +247,26 @@ static void sig_handler(int sig, siginfo_t * siginfo,
errno = origerrno; errno = origerrno;
} }
static void sig_fatal(int sig, siginfo_t * siginfo ATTRIBUTE_UNUSED,
void* context ATTRIBUTE_UNUSED) {
struct sigaction sig_action;
int origerrno;
origerrno = errno;
virLogEmergencyDumpAll(sig);
/*
* If the signal is fatal, avoid looping over this handler
* by desactivating it
*/
if (sig != SIGUSR2) {
sig_action.sa_flags = SA_SIGINFO;
sig_action.sa_handler = SIG_IGN;
sigaction(sig, &sig_action, NULL);
}
errno = origerrno;
}
static void qemudDispatchClientEvent(int watch, int fd, int events, void *opaque); static void qemudDispatchClientEvent(int watch, int fd, int events, void *opaque);
static void qemudDispatchServerEvent(int watch, int fd, int events, void *opaque); static void qemudDispatchServerEvent(int watch, int fd, int events, void *opaque);
static int qemudStartWorker(struct qemud_server *server, struct qemud_worker *worker); static int qemudStartWorker(struct qemud_server *server, struct qemud_worker *worker);
@ -310,7 +331,7 @@ remoteInitializeGnuTLS (void)
if (remoteCheckCertFile("CA certificate", ca_file) < 0) if (remoteCheckCertFile("CA certificate", ca_file) < 0)
return -1; return -1;
qemudDebug ("loading CA cert from %s", ca_file); VIR_DEBUG("loading CA cert from %s", ca_file);
err = gnutls_certificate_set_x509_trust_file (x509_cred, ca_file, err = gnutls_certificate_set_x509_trust_file (x509_cred, ca_file,
GNUTLS_X509_FMT_PEM); GNUTLS_X509_FMT_PEM);
if (err < 0) { if (err < 0) {
@ -324,7 +345,7 @@ remoteInitializeGnuTLS (void)
if (remoteCheckCertFile("CA revocation list", crl_file) < 0) if (remoteCheckCertFile("CA revocation list", crl_file) < 0)
return -1; return -1;
DEBUG("loading CRL from %s", crl_file); VIR_DEBUG("loading CRL from %s", crl_file);
err = gnutls_certificate_set_x509_crl_file (x509_cred, crl_file, err = gnutls_certificate_set_x509_crl_file (x509_cred, crl_file,
GNUTLS_X509_FMT_PEM); GNUTLS_X509_FMT_PEM);
if (err < 0) { if (err < 0) {
@ -339,7 +360,7 @@ remoteInitializeGnuTLS (void)
return -1; return -1;
if (remoteCheckCertFile("server key", key_file) < 0) if (remoteCheckCertFile("server key", key_file) < 0)
return -1; return -1;
DEBUG("loading cert and key from %s and %s", cert_file, key_file); VIR_DEBUG("loading cert and key from %s and %s", cert_file, key_file);
err = err =
gnutls_certificate_set_x509_key_file (x509_cred, gnutls_certificate_set_x509_key_file (x509_cred,
cert_file, key_file, cert_file, key_file,
@ -542,7 +563,6 @@ static int qemudListenUnix(struct qemud_server *server,
char *path, int readonly, int auth) { char *path, int readonly, int auth) {
struct qemud_socket *sock; struct qemud_socket *sock;
mode_t oldmask; mode_t oldmask;
gid_t oldgrp;
char ebuf[1024]; char ebuf[1024];
if (VIR_ALLOC(sock) < 0) { if (VIR_ALLOC(sock) < 0) {
@ -579,21 +599,22 @@ static int qemudListenUnix(struct qemud_server *server,
if (sock->addr.data.un.sun_path[0] == '@') if (sock->addr.data.un.sun_path[0] == '@')
sock->addr.data.un.sun_path[0] = '\0'; sock->addr.data.un.sun_path[0] = '\0';
oldgrp = getgid();
oldmask = umask(readonly ? ~unix_sock_ro_mask : ~unix_sock_rw_mask); oldmask = umask(readonly ? ~unix_sock_ro_mask : ~unix_sock_rw_mask);
if (server->privileged && setgid(unix_sock_gid)) {
VIR_ERROR(_("Failed to set group ID to %d"), unix_sock_gid);
goto cleanup;
}
if (bind(sock->fd, &sock->addr.data.sa, sock->addr.len) < 0) { if (bind(sock->fd, &sock->addr.data.sa, sock->addr.len) < 0) {
VIR_ERROR(_("Failed to bind socket to '%s': %s"), VIR_ERROR(_("Failed to bind socket to '%s': %s"),
path, virStrerror(errno, ebuf, sizeof ebuf)); path, virStrerror(errno, ebuf, sizeof ebuf));
umask(oldmask);
goto cleanup; goto cleanup;
} }
umask(oldmask); umask(oldmask);
if (server->privileged && setgid(oldgrp)) {
VIR_ERROR(_("Failed to restore group ID to %d"), oldgrp); /* chown() doesn't work for abstract sockets but we use them only
* if libvirtd runs unprivileged
*/
if (server->privileged && chown(path, -1, unix_sock_gid)) {
VIR_ERROR(_("Failed to change group ID of '%s' to %d: %s"),
path, unix_sock_gid,
virStrerror(errno, ebuf, sizeof ebuf));
goto cleanup; goto cleanup;
} }
@ -615,7 +636,7 @@ static int qemudListenUnix(struct qemud_server *server,
return -1; return -1;
} }
// See: http://people.redhat.com/drepper/userapi-ipv6.html /* See: http://people.redhat.com/drepper/userapi-ipv6.html */
static int static int
remoteMakeSockets (int *fds, int max_fds, int *nfds_r, const char *node, const char *service) remoteMakeSockets (int *fds, int max_fds, int *nfds_r, const char *node, const char *service)
{ {
@ -826,6 +847,30 @@ static void virshErrorHandler(void *opaque ATTRIBUTE_UNUSED, virErrorPtr err ATT
* took care of reporting the error */ * took care of reporting the error */
} }
static int daemonErrorLogFilter(virErrorPtr err, int priority)
{
/* These error codes don't really reflect real errors. They
* are expected events that occur when an app tries to check
* whether a particular guest already exists. This filters
* them to a lower log level to prevent pollution of syslog
*/
switch (err->code) {
case VIR_ERR_NO_DOMAIN:
case VIR_ERR_NO_NETWORK:
case VIR_ERR_NO_STORAGE_POOL:
case VIR_ERR_NO_STORAGE_VOL:
case VIR_ERR_NO_NODE_DEVICE:
case VIR_ERR_NO_INTERFACE:
case VIR_ERR_NO_NWFILTER:
case VIR_ERR_NO_SECRET:
case VIR_ERR_NO_DOMAIN_SNAPSHOT:
return VIR_LOG_DEBUG;
}
return priority;
}
static struct qemud_server *qemudInitialize(void) { static struct qemud_server *qemudInitialize(void) {
struct qemud_server *server; struct qemud_server *server;
@ -849,8 +894,7 @@ static struct qemud_server *qemudInitialize(void) {
return NULL; return NULL;
} }
if (virEventInit() < 0) { if (virEventRegisterDefaultImpl() < 0) {
VIR_ERROR0(_("Failed to initialize event system"));
virMutexDestroy(&server->lock); virMutexDestroy(&server->lock);
if (virCondDestroy(&server->job) < 0) if (virCondDestroy(&server->job) < 0)
{} {}
@ -878,7 +922,6 @@ static struct qemud_server *qemudInitialize(void) {
virDriverLoadModule("qemu"); virDriverLoadModule("qemu");
virDriverLoadModule("lxc"); virDriverLoadModule("lxc");
virDriverLoadModule("uml"); virDriverLoadModule("uml");
virDriverLoadModule("one");
virDriverLoadModule("nwfilter"); virDriverLoadModule("nwfilter");
#else #else
# ifdef WITH_NETWORK # ifdef WITH_NETWORK
@ -899,6 +942,9 @@ static struct qemud_server *qemudInitialize(void) {
# ifdef WITH_NWFILTER # ifdef WITH_NWFILTER
nwfilterRegister(); nwfilterRegister();
# endif # endif
# ifdef WITH_LIBXL
libxlRegister();
# endif
# ifdef WITH_QEMU # ifdef WITH_QEMU
qemuRegister(); qemuRegister();
# endif # endif
@ -908,18 +954,8 @@ static struct qemud_server *qemudInitialize(void) {
# ifdef WITH_UML # ifdef WITH_UML
umlRegister(); umlRegister();
# endif # endif
# ifdef WITH_ONE
oneRegister();
# endif
#endif #endif
virEventRegisterImpl(virEventAddHandleImpl,
virEventUpdateHandleImpl,
virEventRemoveHandleImpl,
virEventAddTimeoutImpl,
virEventUpdateTimeoutImpl,
virEventRemoveTimeoutImpl);
return server; return server;
} }
@ -1061,12 +1097,12 @@ static int qemudNetworkEnable(struct qemud_server *server) {
sock = server->sockets; sock = server->sockets;
while (sock) { while (sock) {
if ((sock->watch = virEventAddHandleImpl(sock->fd, if ((sock->watch = virEventAddHandle(sock->fd,
VIR_EVENT_HANDLE_READABLE | VIR_EVENT_HANDLE_READABLE |
VIR_EVENT_HANDLE_ERROR | VIR_EVENT_HANDLE_ERROR |
VIR_EVENT_HANDLE_HANGUP, VIR_EVENT_HANDLE_HANGUP,
qemudDispatchServerEvent, qemudDispatchServerEvent,
server, NULL)) < 0) { server, NULL)) < 0) {
VIR_ERROR0(_("Failed to add server event callback")); VIR_ERROR0(_("Failed to add server event callback"));
return -1; return -1;
} }
@ -1127,9 +1163,9 @@ remoteCheckDN (const char *dname)
} }
/* Print the client's DN. */ /* Print the client's DN. */
DEBUG(_("remoteCheckDN: failed: client DN is %s"), dname); VIR_DEBUG("remoteCheckDN: failed: client DN is %s", dname);
return 0; // Not found. return 0; /* Not found. */
} }
static int static int
@ -1498,7 +1534,7 @@ error:
*/ */
void qemudDispatchClientFailure(struct qemud_client *client) { void qemudDispatchClientFailure(struct qemud_client *client) {
if (client->watch != -1) { if (client->watch != -1) {
virEventRemoveHandleImpl(client->watch); virEventRemoveHandle(client->watch);
client->watch = -1; client->watch = -1;
} }
@ -1508,7 +1544,7 @@ void qemudDispatchClientFailure(struct qemud_client *client) {
for (i = 0 ; i < VIR_DOMAIN_EVENT_ID_LAST ; i++) { for (i = 0 ; i < VIR_DOMAIN_EVENT_ID_LAST ; i++) {
if (client->domainEventCallbackID[i] != -1) { if (client->domainEventCallbackID[i] != -1) {
DEBUG("Deregistering to relay remote events %d", i); VIR_DEBUG("Deregistering to relay remote events %d", i);
virConnectDomainEventDeregisterAny(client->conn, virConnectDomainEventDeregisterAny(client->conn,
client->domainEventCallbackID[i]); client->domainEventCallbackID[i]);
} }
@ -1655,7 +1691,7 @@ static ssize_t qemudClientReadBuf(struct qemud_client *client,
return -1; return -1;
} }
/*qemudDebug ("qemudClientRead: len = %d", len);*/ /* VIR_DEBUG("qemudClientRead: len = %d", len);*/
if (!client->tlssession) { if (!client->tlssession) {
char ebuf[1024]; char ebuf[1024];
@ -1730,15 +1766,17 @@ static ssize_t qemudClientReadSASL(struct qemud_client *client) {
/* Need to read some more data off the wire */ /* Need to read some more data off the wire */
if (client->saslDecoded == NULL) { if (client->saslDecoded == NULL) {
int ret; int ret;
char encoded[8192]; ssize_t encodedLen;
ssize_t encodedLen = sizeof(encoded);
encodedLen = qemudClientReadBuf(client, encoded, encodedLen); encodedLen = qemudClientReadBuf(client, client->saslTemporary,
sizeof(client->saslTemporary));
if (encodedLen <= 0) if (encodedLen <= 0)
return encodedLen; return encodedLen;
ret = sasl_decode(client->saslconn, encoded, encodedLen, ret = sasl_decode(client->saslconn, client->saslTemporary, encodedLen,
&client->saslDecoded, &client->saslDecodedLength); &client->saslDecoded, &client->saslDecodedLength);
if (ret != SASL_OK) { if (ret != SASL_OK) {
VIR_ERROR(_("failed to decode SASL data %s"), VIR_ERROR(_("failed to decode SASL data %s"),
sasl_errstring(ret, NULL, NULL)); sasl_errstring(ret, NULL, NULL));
@ -1789,7 +1827,7 @@ static ssize_t qemudClientRead(struct qemud_client *client) {
*/ */
static void qemudDispatchClientRead(struct qemud_server *server, static void qemudDispatchClientRead(struct qemud_server *server,
struct qemud_client *client) { struct qemud_client *client) {
/*qemudDebug ("qemudDispatchClientRead: mode = %d", client->mode);*/ /* VIR_DEBUG("qemudDispatchClientRead: mode = %d", client->mode);*/
readmore: readmore:
if (qemudClientRead(client) < 0) if (qemudClientRead(client) < 0)
@ -1807,14 +1845,14 @@ readmore:
if (!xdr_u_int(&x, &len)) { if (!xdr_u_int(&x, &len)) {
xdr_destroy (&x); xdr_destroy (&x);
DEBUG0("Failed to decode packet length"); VIR_DEBUG0("Failed to decode packet length");
qemudDispatchClientFailure(client); qemudDispatchClientFailure(client);
return; return;
} }
xdr_destroy (&x); xdr_destroy (&x);
if (len < REMOTE_MESSAGE_HEADER_XDR_LEN) { if (len < REMOTE_MESSAGE_HEADER_XDR_LEN) {
DEBUG("Packet length %u too small", len); VIR_DEBUG("Packet length %u too small", len);
qemudDispatchClientFailure(client); qemudDispatchClientFailure(client);
return; return;
} }
@ -1823,7 +1861,7 @@ readmore:
len -= REMOTE_MESSAGE_HEADER_XDR_LEN; len -= REMOTE_MESSAGE_HEADER_XDR_LEN;
if (len > REMOTE_MESSAGE_MAX) { if (len > REMOTE_MESSAGE_MAX) {
DEBUG("Packet length %u too large", len); VIR_DEBUG("Packet length %u too large", len);
qemudDispatchClientFailure(client); qemudDispatchClientFailure(client);
return; return;
} }
@ -2192,10 +2230,10 @@ int qemudRegisterClientEvent(struct qemud_server *server,
mode = qemudCalculateHandleMode(client); mode = qemudCalculateHandleMode(client);
if ((client->watch = virEventAddHandleImpl(client->fd, if ((client->watch = virEventAddHandle(client->fd,
mode, mode,
qemudDispatchClientEvent, qemudDispatchClientEvent,
server, NULL)) < 0) server, NULL)) < 0)
return -1; return -1;
return 0; return 0;
@ -2209,7 +2247,7 @@ void qemudUpdateClientEvent(struct qemud_client *client) {
mode = qemudCalculateHandleMode(client); mode = qemudCalculateHandleMode(client);
virEventUpdateHandleImpl(client->watch, mode); virEventUpdateHandle(client->watch, mode);
} }
@ -2239,7 +2277,7 @@ qemudDispatchServerEvent(int watch, int fd, int events, void *opaque) {
static int qemudOneLoop(void) { static int qemudOneLoop(void) {
sig_atomic_t errors; sig_atomic_t errors;
if (virEventRunOnce() < 0) if (virEventRunDefaultImpl() < 0)
return -1; return -1;
/* Check for any signal handling errors and log them. */ /* Check for any signal handling errors and log them. */
@ -2260,10 +2298,10 @@ static void qemudInactiveTimer(int timerid, void *data) {
if (virStateActive() || if (virStateActive() ||
server->clients) { server->clients) {
DEBUG0("Timer expired but still active, not shutting down"); VIR_DEBUG0("Timer expired but still active, not shutting down");
virEventUpdateTimeoutImpl(timerid, -1); virEventUpdateTimeout(timerid, -1);
} else { } else {
DEBUG0("Timer expired and inactive, shutting down"); VIR_DEBUG0("Timer expired and inactive, shutting down");
server->quitEventThread = 1; server->quitEventThread = 1;
} }
} }
@ -2304,9 +2342,9 @@ static void *qemudRunLoop(void *opaque) {
virMutexLock(&server->lock); virMutexLock(&server->lock);
if (timeout > 0 && if (timeout > 0 &&
(timerid = virEventAddTimeoutImpl(-1, (timerid = virEventAddTimeout(-1,
qemudInactiveTimer, qemudInactiveTimer,
server, NULL)) < 0) { server, NULL)) < 0) {
VIR_ERROR0(_("Failed to register shutdown timeout")); VIR_ERROR0(_("Failed to register shutdown timeout"));
return NULL; return NULL;
} }
@ -2334,15 +2372,15 @@ static void *qemudRunLoop(void *opaque) {
if (timeout > 0) { if (timeout > 0) {
if (timerActive) { if (timerActive) {
if (server->clients) { if (server->clients) {
DEBUG("Deactivating shutdown timer %d", timerid); VIR_DEBUG("Deactivating shutdown timer %d", timerid);
virEventUpdateTimeoutImpl(timerid, -1); virEventUpdateTimeout(timerid, -1);
timerActive = 0; timerActive = 0;
} }
} else { } else {
if (!virStateActive() && if (!virStateActive() &&
!server->clients) { !server->clients) {
DEBUG("Activating shutdown timer %d", timerid); VIR_DEBUG("Activating shutdown timer %d", timerid);
virEventUpdateTimeoutImpl(timerid, timeout * 1000); virEventUpdateTimeout(timerid, timeout * 1000);
timerActive = 1; timerActive = 1;
} }
} }
@ -2351,7 +2389,7 @@ static void *qemudRunLoop(void *opaque) {
virMutexUnlock(&server->lock); virMutexUnlock(&server->lock);
if (qemudOneLoop() < 0) { if (qemudOneLoop() < 0) {
virMutexLock(&server->lock); virMutexLock(&server->lock);
DEBUG0("Loop iteration error, exiting"); VIR_DEBUG0("Loop iteration error, exiting");
break; break;
} }
virMutexLock(&server->lock); virMutexLock(&server->lock);
@ -2458,7 +2496,7 @@ static void qemudCleanup(struct qemud_server *server) {
while (sock) { while (sock) {
struct qemud_socket *next = sock->next; struct qemud_socket *next = sock->next;
if (sock->watch) if (sock->watch)
virEventRemoveHandleImpl(sock->watch); virEventRemoveHandle(sock->watch);
VIR_FORCE_CLOSE(sock->fd); VIR_FORCE_CLOSE(sock->fd);
/* Unlink unix domain sockets which are not in /* Unlink unix domain sockets which are not in
@ -2675,18 +2713,24 @@ remoteReadSaslAllowedUsernameList (virConfPtr conf ATTRIBUTE_UNUSED,
/* /*
* Set up the logging environment * Set up the logging environment
* By default if daemonized all errors go to syslog and the logging * By default if daemonized all errors go to the logfile libvirtd.log,
* is also saved onto the logfile libvird.log, but if verbose or error * but if verbose or error debugging is asked for then also output
* debugging is asked for then output informations or debug. * informational and debug messages. Default size if 64 kB.
*/ */
static int static int
qemudSetLogging(virConfPtr conf, const char *filename) qemudSetLogging(struct qemud_server *server, virConfPtr conf,
const char *filename)
{ {
int log_level = 0; int log_level = 0;
int log_buffer_size = 64;
char *log_filters = NULL; char *log_filters = NULL;
char *log_outputs = NULL; char *log_outputs = NULL;
char *log_file = NULL;
int ret = -1; int ret = -1;
GET_CONF_INT (conf, filename, log_buffer_size);
virLogSetBufferSize(log_buffer_size);
virLogReset(); virLogReset();
/* /*
@ -2720,19 +2764,30 @@ qemudSetLogging(virConfPtr conf, const char *filename)
} }
/* /*
* If no defined outputs, then direct to syslog when running * If no defined outputs, then direct to libvirtd.log when running
* as daemon. Otherwise the default output is stderr. * as daemon. Otherwise the default output is stderr.
*/ */
if (virLogGetNbOutputs() == 0) { if (virLogGetNbOutputs() == 0) {
char *tmp = NULL; char *tmp = NULL;
if (godaemon) { if (godaemon) {
if (virAsprintf (&tmp, "%d:syslog:libvirtd", if (server->privileged) {
virLogGetDefaultPriority()) < 0) if (virAsprintf(&tmp, "%d:file:%s/log/libvirt/libvirtd.log",
goto free_and_fail; virLogGetDefaultPriority(),
LOCALSTATEDIR) == -1)
goto out_of_memory;
} else {
char *userdir = virGetUserDirectory(geteuid());
if (!userdir)
goto free_and_fail;
if (virAsprintf(&tmp, "%d:file:%s/.libvirt/libvirtd.log",
virLogGetDefaultPriority(), userdir) == -1)
goto out_of_memory;
}
} else { } else {
if (virAsprintf (&tmp, "%d:stderr", if (virAsprintf(&tmp, "%d:stderr", virLogGetDefaultPriority()) < 0)
virLogGetDefaultPriority()) < 0) goto out_of_memory;
goto free_and_fail;
} }
virLogParseOutputs(tmp); virLogParseOutputs(tmp);
VIR_FREE(tmp); VIR_FREE(tmp);
@ -2749,7 +2804,21 @@ qemudSetLogging(virConfPtr conf, const char *filename)
free_and_fail: free_and_fail:
VIR_FREE(log_filters); VIR_FREE(log_filters);
VIR_FREE(log_outputs); VIR_FREE(log_outputs);
VIR_FREE(log_file);
return(ret); return(ret);
out_of_memory:
virReportOOMError();
goto free_and_fail;
}
/*
* Stop logging
*/
static void
qemudStopLogging(void)
{
virLogShutdown();
} }
/* Read the config file if it exists. /* Read the config file if it exists.
@ -2782,7 +2851,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
/* /*
* First get all the logging settings and activate them * First get all the logging settings and activate them
*/ */
if (qemudSetLogging(conf, filename) < 0) if (qemudSetLogging(server, conf, filename) < 0)
goto free_and_fail; goto free_and_fail;
GET_CONF_INT (conf, filename, listen_tcp); GET_CONF_INT (conf, filename, listen_tcp);
@ -2996,13 +3065,25 @@ daemonSetupSignals(struct qemud_server *server)
sigaction(SIGQUIT, &sig_action, NULL); sigaction(SIGQUIT, &sig_action, NULL);
sigaction(SIGTERM, &sig_action, NULL); sigaction(SIGTERM, &sig_action, NULL);
/*
* catch fatal errors to dump a log, also hook to USR2 for dynamic
* debugging purposes or testing
*/
sig_action.sa_sigaction = sig_fatal;
sigaction(SIGFPE, &sig_action, NULL);
sigaction(SIGSEGV, &sig_action, NULL);
sigaction(SIGILL, &sig_action, NULL);
sigaction(SIGABRT, &sig_action, NULL);
sigaction(SIGBUS, &sig_action, NULL);
sigaction(SIGUSR2, &sig_action, NULL);
sig_action.sa_handler = SIG_IGN; sig_action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &sig_action, NULL); sigaction(SIGPIPE, &sig_action, NULL);
if (virEventAddHandleImpl(sigpipe[0], if (virEventAddHandle(sigpipe[0],
VIR_EVENT_HANDLE_READABLE, VIR_EVENT_HANDLE_READABLE,
qemudDispatchSignalEvent, qemudDispatchSignalEvent,
server, NULL) < 0) { server, NULL) < 0) {
VIR_ERROR0(_("Failed to register callback for signal pipe")); VIR_ERROR0(_("Failed to register callback for signal pipe"));
goto error; goto error;
} }
@ -3104,10 +3185,6 @@ int main(int argc, char **argv) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Set error logging priority to debug, so client errors don't
* show up as errors in the daemon log */
virErrorSetLogPriority(VIR_LOG_DEBUG);
while (1) { while (1) {
int optidx = 0; int optidx = 0;
int c; int c;
@ -3206,16 +3283,20 @@ int main(int argc, char **argv) {
/* Ensure the rundir exists (on tmpfs on some systems) */ /* Ensure the rundir exists (on tmpfs on some systems) */
if (geteuid() == 0) { if (geteuid() == 0) {
const char *rundir = LOCALSTATEDIR "/run/libvirt"; const char *rundir = LOCALSTATEDIR "/run/libvirt";
mode_t old_umask;
old_umask = umask(022);
if (mkdir (rundir, 0755)) { if (mkdir (rundir, 0755)) {
if (errno != EEXIST) { if (errno != EEXIST) {
char ebuf[1024]; char ebuf[1024];
VIR_ERROR(_("unable to create rundir %s: %s"), rundir, VIR_ERROR(_("unable to create rundir %s: %s"), rundir,
virStrerror(errno, ebuf, sizeof(ebuf))); virStrerror(errno, ebuf, sizeof(ebuf)));
ret = VIR_DAEMON_ERR_RUNDIR; ret = VIR_DAEMON_ERR_RUNDIR;
umask(old_umask);
goto error; goto error;
} }
} }
umask(old_umask);
} }
/* Beyond this point, nothing should rely on using /* Beyond this point, nothing should rely on using
@ -3263,6 +3344,7 @@ int main(int argc, char **argv) {
/* Disable error func, now logging is setup */ /* Disable error func, now logging is setup */
virSetErrorFunc(NULL, virshErrorHandler); virSetErrorFunc(NULL, virshErrorHandler);
virSetErrorLogPriorityFunc(daemonErrorLogFilter);
/* /*
* Call the daemon startup hook * Call the daemon startup hook
@ -3349,6 +3431,6 @@ error:
qemudCleanup(server); qemudCleanup(server);
if (pid_file) if (pid_file)
unlink (pid_file); unlink (pid_file);
virLogShutdown(); qemudStopLogging();
return ret; return ret;
} }

View File

@ -313,6 +313,13 @@
# log_outputs="3:syslog:libvirtd" # log_outputs="3:syslog:libvirtd"
# to log all warnings and errors to syslog under the libvirtd ident # to log all warnings and errors to syslog under the libvirtd ident
# Log debug buffer size: default 64
# The daemon keeps an internal debug log buffer which will be dumped in case
# of crash or upon receiving a SIGUSR2 signal. This setting allows to override
# the default buffer size in kilobytes.
# If value is 0 or less the debug log buffer is deactivated
#log_buffer_size = 64
################################################################## ##################################################################
# #

View File

@ -1,7 +1,7 @@
/* /*
* libvirtd.h: daemon data structure definitions * libvirtd.h: daemon data structure definitions
* *
* Copyright (C) 2006-2010 Red Hat, Inc. * Copyright (C) 2006-2011 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange * Copyright (C) 2006 Daniel P. Berrange
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
@ -128,8 +128,6 @@
# endif # endif
# endif # endif
# define qemudDebug DEBUG
/* Whether we're passing reads & writes through a sasl SSF */ /* Whether we're passing reads & writes through a sasl SSF */
enum qemud_sasl_ssf { enum qemud_sasl_ssf {
QEMUD_SASL_SSF_NONE = 0, QEMUD_SASL_SSF_NONE = 0,
@ -215,6 +213,7 @@ struct qemud_client {
unsigned int saslEncodedLength; unsigned int saslEncodedLength;
unsigned int saslEncodedOffset; unsigned int saslEncodedOffset;
char *saslUsername; char *saslUsername;
char saslTemporary[8192]; /* temorary holds data to be decoded */
# endif # endif
/* Count of meages in 'dx' or 'tx' queue /* Count of meages in 'dx' or 'tx' queue

View File

@ -0,0 +1,9 @@
@localstatedir@/log/libvirt/libvirtd.log {
weekly
missingok
rotate 4
compress
delaycompress
copytruncate
minsize 100k
}

46
daemon/libvirtd.upstart Normal file
View File

@ -0,0 +1,46 @@
# libvirtd upstart job
#
# XXX wait for rc to get all dependent initscripts started
# from sysv libvirtd initscript: Required-Start: $network messagebus
start on stopped rc RUNLEVEL=[345]
stop on runlevel [!345]
respawn
script
LIBVIRTD_CONFIG=
LIBVIRTD_ARGS=
KRB5_KTNAME=/etc/libvirt/krb5.tab
if [ -f /etc/sysconfig/libvirtd ]; then
. /etc/sysconfig/libvirtd
fi
export QEMU_AUDIO_DRV
export SDL_AUDIODRIVER
export KRB5_KTNAME
LIBVIRTD_CONFIG_ARGS=
if [ -n "$LIBVIRTD_CONFIG" ]; then
LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG"
fi
# DAEMON_COREFILE_LIMIT from /etc/sysconfig/libvirtd is not handled
# automatically
if [ -n "$DAEMON_COREFILE_LIMIT" ]; then
ulimit -c "$DAEMON_COREFILE_LIMIT"
fi
# Clean up a pidfile that might be left around
rm -f /var/run/libvirtd.pid
mkdir -p /var/cache/libvirt
rm -rf /var/cache/libvirt/*
exec /usr/sbin/libvirtd $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
end script
post-stop script
rm -f $PIDFILE
rm -rf /var/cache/libvirt/*
end script

View File

@ -40,9 +40,10 @@
#include "libvirtd.h" #include "libvirtd.h"
#include "mdns.h" #include "mdns.h"
#include "event.h" #include "event.h"
#include "event_poll.h"
#include "memory.h" #include "memory.h"
#define AVAHI_DEBUG(fmt, ...) DEBUG(fmt, __VA_ARGS__) #define AVAHI_DEBUG(fmt, ...) VIR_DEBUG(fmt, __VA_ARGS__)
struct libvirtd_mdns_entry { struct libvirtd_mdns_entry {
char *type; char *type;
@ -230,7 +231,7 @@ static void libvirtd_mdns_client_callback(AvahiClient *c, AvahiClientState state
static void libvirtd_mdns_watch_dispatch(int watch, int fd, int events, void *opaque) static void libvirtd_mdns_watch_dispatch(int watch, int fd, int events, void *opaque)
{ {
AvahiWatch *w = (AvahiWatch*)opaque; AvahiWatch *w = (AvahiWatch*)opaque;
int fd_events = virEventHandleTypeToPollEvent(events); int fd_events = virEventPollToNativeEvents(events);
AVAHI_DEBUG("Dispatch watch %d FD %d Event %d", watch, fd, fd_events); AVAHI_DEBUG("Dispatch watch %d FD %d Event %d", watch, fd, fd_events);
w->revents = fd_events; w->revents = fd_events;
w->callback(w, fd, fd_events, w->userdata); w->callback(w, fd, fd_events, w->userdata);
@ -256,11 +257,11 @@ static AvahiWatch *libvirtd_mdns_watch_new(const AvahiPoll *api ATTRIBUTE_UNUSED
w->userdata = userdata; w->userdata = userdata;
AVAHI_DEBUG("New handle %p FD %d Event %d", w, w->fd, event); AVAHI_DEBUG("New handle %p FD %d Event %d", w, w->fd, event);
hEvents = virPollEventToEventHandleType(event); hEvents = virEventPollFromNativeEvents(event);
if ((w->watch = virEventAddHandleImpl(fd, hEvents, if ((w->watch = virEventAddHandle(fd, hEvents,
libvirtd_mdns_watch_dispatch, libvirtd_mdns_watch_dispatch,
w, w,
libvirtd_mdns_watch_dofree)) < 0) { libvirtd_mdns_watch_dofree)) < 0) {
VIR_FREE(w); VIR_FREE(w);
return NULL; return NULL;
} }
@ -271,7 +272,7 @@ static AvahiWatch *libvirtd_mdns_watch_new(const AvahiPoll *api ATTRIBUTE_UNUSED
static void libvirtd_mdns_watch_update(AvahiWatch *w, AvahiWatchEvent event) static void libvirtd_mdns_watch_update(AvahiWatch *w, AvahiWatchEvent event)
{ {
AVAHI_DEBUG("Update handle %p FD %d Event %d", w, w->fd, event); AVAHI_DEBUG("Update handle %p FD %d Event %d", w, w->fd, event);
virEventUpdateHandleImpl(w->watch, event); virEventUpdateHandle(w->watch, event);
} }
static AvahiWatchEvent libvirtd_mdns_watch_get_events(AvahiWatch *w) static AvahiWatchEvent libvirtd_mdns_watch_get_events(AvahiWatch *w)
@ -283,14 +284,14 @@ static AvahiWatchEvent libvirtd_mdns_watch_get_events(AvahiWatch *w)
static void libvirtd_mdns_watch_free(AvahiWatch *w) static void libvirtd_mdns_watch_free(AvahiWatch *w)
{ {
AVAHI_DEBUG("Free handle %p %d", w, w->fd); AVAHI_DEBUG("Free handle %p %d", w, w->fd);
virEventRemoveHandleImpl(w->watch); virEventRemoveHandle(w->watch);
} }
static void libvirtd_mdns_timeout_dispatch(int timer ATTRIBUTE_UNUSED, void *opaque) static void libvirtd_mdns_timeout_dispatch(int timer ATTRIBUTE_UNUSED, void *opaque)
{ {
AvahiTimeout *t = (AvahiTimeout*)opaque; AvahiTimeout *t = (AvahiTimeout*)opaque;
AVAHI_DEBUG("Dispatch timeout %p %d", t, timer); AVAHI_DEBUG("Dispatch timeout %p %d", t, timer);
virEventUpdateTimeoutImpl(t->timer, -1); virEventUpdateTimeout(t->timer, -1);
t->callback(t, t->userdata); t->callback(t, t->userdata);
} }
@ -329,10 +330,10 @@ static AvahiTimeout *libvirtd_mdns_timeout_new(const AvahiPoll *api ATTRIBUTE_UN
timeout = -1; timeout = -1;
} }
t->timer = virEventAddTimeoutImpl(timeout, t->timer = virEventAddTimeout(timeout,
libvirtd_mdns_timeout_dispatch, libvirtd_mdns_timeout_dispatch,
t, t,
libvirtd_mdns_timeout_dofree); libvirtd_mdns_timeout_dofree);
t->callback = cb; t->callback = cb;
t->userdata = userdata; t->userdata = userdata;
@ -364,13 +365,13 @@ static void libvirtd_mdns_timeout_update(AvahiTimeout *t, const struct timeval *
timeout = -1; timeout = -1;
} }
virEventUpdateTimeoutImpl(t->timer, timeout); virEventUpdateTimeout(t->timer, timeout);
} }
static void libvirtd_mdns_timeout_free(AvahiTimeout *t) static void libvirtd_mdns_timeout_free(AvahiTimeout *t)
{ {
AVAHI_DEBUG("Free timeout %p", t); AVAHI_DEBUG("Free timeout %p", t);
virEventRemoveTimeoutImpl(t->timer); virEventRemoveTimeout(t->timer);
} }

View File

@ -7,6 +7,6 @@ static int qemuDispatchMonitorCommand(
struct qemud_client *client, struct qemud_client *client,
virConnectPtr conn, virConnectPtr conn,
remote_message_header *hdr, remote_message_header *hdr,
remote_error *err, remote_error *rerr,
qemu_monitor_command_args *args, qemu_monitor_command_args *args,
qemu_monitor_command_ret *ret); qemu_monitor_command_ret *ret);

File diff suppressed because it is too large Load Diff

View File

@ -171,3 +171,10 @@
remote_domain_get_vcpus_flags_args val_remote_domain_get_vcpus_flags_args; remote_domain_get_vcpus_flags_args val_remote_domain_get_vcpus_flags_args;
remote_domain_open_console_args val_remote_domain_open_console_args; remote_domain_open_console_args val_remote_domain_open_console_args;
remote_domain_is_updated_args val_remote_domain_is_updated_args; remote_domain_is_updated_args val_remote_domain_is_updated_args;
remote_get_sysinfo_args val_remote_get_sysinfo_args;
remote_domain_set_memory_flags_args val_remote_domain_set_memory_flags_args;
remote_domain_set_blkio_parameters_args val_remote_domain_set_blkio_parameters_args;
remote_domain_get_blkio_parameters_args val_remote_domain_get_blkio_parameters_args;
remote_domain_migrate_set_max_speed_args val_remote_domain_migrate_set_max_speed_args;
remote_storage_vol_upload_args val_remote_storage_vol_upload_args;
remote_storage_vol_download_args val_remote_storage_vol_download_args;

File diff suppressed because it is too large Load Diff

View File

@ -138,3 +138,5 @@
remote_domain_get_memory_parameters_ret val_remote_domain_get_memory_parameters_ret; remote_domain_get_memory_parameters_ret val_remote_domain_get_memory_parameters_ret;
remote_domain_get_vcpus_flags_ret val_remote_domain_get_vcpus_flags_ret; remote_domain_get_vcpus_flags_ret val_remote_domain_get_vcpus_flags_ret;
remote_domain_is_updated_ret val_remote_domain_is_updated_ret; remote_domain_is_updated_ret val_remote_domain_is_updated_ret;
remote_get_sysinfo_ret val_remote_get_sysinfo_ret;
remote_domain_get_blkio_parameters_ret val_remote_domain_get_blkio_parameters_ret;

View File

@ -1017,3 +1017,38 @@
.args_filter = (xdrproc_t) xdr_remote_domain_is_updated_args, .args_filter = (xdrproc_t) xdr_remote_domain_is_updated_args,
.ret_filter = (xdrproc_t) xdr_remote_domain_is_updated_ret, .ret_filter = (xdrproc_t) xdr_remote_domain_is_updated_ret,
}, },
{ /* GetSysinfo => 203 */
.fn = (dispatch_fn) remoteDispatchGetSysinfo,
.args_filter = (xdrproc_t) xdr_remote_get_sysinfo_args,
.ret_filter = (xdrproc_t) xdr_remote_get_sysinfo_ret,
},
{ /* DomainSetMemoryFlags => 204 */
.fn = (dispatch_fn) remoteDispatchDomainSetMemoryFlags,
.args_filter = (xdrproc_t) xdr_remote_domain_set_memory_flags_args,
.ret_filter = (xdrproc_t) xdr_void,
},
{ /* DomainSetBlkioParameters => 205 */
.fn = (dispatch_fn) remoteDispatchDomainSetBlkioParameters,
.args_filter = (xdrproc_t) xdr_remote_domain_set_blkio_parameters_args,
.ret_filter = (xdrproc_t) xdr_void,
},
{ /* DomainGetBlkioParameters => 206 */
.fn = (dispatch_fn) remoteDispatchDomainGetBlkioParameters,
.args_filter = (xdrproc_t) xdr_remote_domain_get_blkio_parameters_args,
.ret_filter = (xdrproc_t) xdr_remote_domain_get_blkio_parameters_ret,
},
{ /* DomainMigrateSetMaxSpeed => 207 */
.fn = (dispatch_fn) remoteDispatchDomainMigrateSetMaxSpeed,
.args_filter = (xdrproc_t) xdr_remote_domain_migrate_set_max_speed_args,
.ret_filter = (xdrproc_t) xdr_void,
},
{ /* StorageVolUpload => 208 */
.fn = (dispatch_fn) remoteDispatchStorageVolUpload,
.args_filter = (xdrproc_t) xdr_remote_storage_vol_upload_args,
.ret_filter = (xdrproc_t) xdr_void,
},
{ /* StorageVolDownload => 209 */
.fn = (dispatch_fn) remoteDispatchStorageVolDownload,
.args_filter = (xdrproc_t) xdr_remote_storage_vol_download_args,
.ret_filter = (xdrproc_t) xdr_void,
},

View File

@ -132,7 +132,7 @@ elsif ($opt_p) {
print " struct qemud_client *client,\n"; print " struct qemud_client *client,\n";
print " virConnectPtr conn,\n"; print " virConnectPtr conn,\n";
print " remote_message_header *hdr,\n"; print " remote_message_header *hdr,\n";
print " remote_error *err,\n"; print " remote_error *rerr,\n";
print " $calls{$_}->{args} *args,\n"; print " $calls{$_}->{args} *args,\n";
print " $calls{$_}->{ret} *ret);\n"; print " $calls{$_}->{ret} *ret);\n";
} }

View File

@ -82,7 +82,7 @@ remoteStreamEvent(virStreamPtr st, int events, void *opaque)
goto cleanup; goto cleanup;
} }
DEBUG("st=%p events=%d", st, events); VIR_DEBUG("st=%p events=%d", st, events);
if (events & VIR_STREAM_EVENT_WRITABLE) { if (events & VIR_STREAM_EVENT_WRITABLE) {
if (remoteStreamHandleWrite(client, stream) < 0) { if (remoteStreamHandleWrite(client, stream) < 0) {
@ -149,7 +149,7 @@ remoteStreamFilter(struct qemud_client *client,
if (msg->hdr.serial == stream->serial && if (msg->hdr.serial == stream->serial &&
msg->hdr.proc == stream->procedure && msg->hdr.proc == stream->procedure &&
msg->hdr.type == REMOTE_STREAM) { msg->hdr.type == REMOTE_STREAM) {
DEBUG("Incoming rx=%p serial=%d proc=%d status=%d", VIR_DEBUG("Incoming rx=%p serial=%d proc=%d status=%d",
stream->rx, msg->hdr.proc, msg->hdr.serial, msg->hdr.status); stream->rx, msg->hdr.proc, msg->hdr.serial, msg->hdr.status);
/* If there are queued packets, we need to queue all further /* If there are queued packets, we need to queue all further
@ -207,7 +207,7 @@ remoteCreateClientStream(virConnectPtr conn,
{ {
struct qemud_client_stream *stream; struct qemud_client_stream *stream;
DEBUG("proc=%d serial=%d", hdr->proc, hdr->serial); VIR_DEBUG("proc=%d serial=%d", hdr->proc, hdr->serial);
if (VIR_ALLOC(stream) < 0) if (VIR_ALLOC(stream) < 0)
return NULL; return NULL;
@ -241,7 +241,7 @@ void remoteFreeClientStream(struct qemud_client *client,
if (!stream) if (!stream)
return; return;
DEBUG("proc=%d serial=%d", stream->procedure, stream->serial); VIR_DEBUG("proc=%d serial=%d", stream->procedure, stream->serial);
msg = stream->rx; msg = stream->rx;
while (msg) { while (msg) {
@ -265,7 +265,7 @@ int remoteAddClientStream(struct qemud_client *client,
{ {
struct qemud_client_stream *tmp = client->streams; struct qemud_client_stream *tmp = client->streams;
DEBUG("client=%p proc=%d serial=%d", client, stream->procedure, stream->serial); VIR_DEBUG("client=%p proc=%d serial=%d", client, stream->procedure, stream->serial);
if (virStreamEventAddCallback(stream->st, 0, if (virStreamEventAddCallback(stream->st, 0,
remoteStreamEvent, client, NULL) < 0) remoteStreamEvent, client, NULL) < 0)
@ -328,7 +328,7 @@ int
remoteRemoveClientStream(struct qemud_client *client, remoteRemoveClientStream(struct qemud_client *client,
struct qemud_client_stream *stream) struct qemud_client_stream *stream)
{ {
DEBUG("client=%p proc=%d serial=%d", client, stream->procedure, stream->serial); VIR_DEBUG("client=%p proc=%d serial=%d", client, stream->procedure, stream->serial);
struct qemud_client_stream *curr = client->streams; struct qemud_client_stream *curr = client->streams;
struct qemud_client_stream *prev = NULL; struct qemud_client_stream *prev = NULL;
@ -343,6 +343,7 @@ remoteRemoveClientStream(struct qemud_client *client,
filter->next = filter->next->next; filter->next = filter->next->next;
break; break;
} }
filter = filter->next;
} }
} }
@ -381,7 +382,7 @@ remoteStreamHandleWriteData(struct qemud_client *client,
remote_error rerr; remote_error rerr;
int ret; int ret;
DEBUG("stream=%p proc=%d serial=%d len=%d offset=%d", VIR_DEBUG("stream=%p proc=%d serial=%d len=%d offset=%d",
stream, msg->hdr.proc, msg->hdr.serial, msg->bufferLength, msg->bufferOffset); stream, msg->hdr.proc, msg->hdr.serial, msg->bufferLength, msg->bufferOffset);
memset(&rerr, 0, sizeof rerr); memset(&rerr, 0, sizeof rerr);
@ -402,7 +403,7 @@ remoteStreamHandleWriteData(struct qemud_client *client,
} else { } else {
VIR_INFO0("Stream send failed"); VIR_INFO0("Stream send failed");
stream->closed = 1; stream->closed = 1;
remoteDispatchConnError(&rerr, client->conn); remoteDispatchError(&rerr);
return remoteSerializeReplyError(client, &rerr, &msg->hdr); return remoteSerializeReplyError(client, &rerr, &msg->hdr);
} }
@ -426,7 +427,7 @@ remoteStreamHandleFinish(struct qemud_client *client,
remote_error rerr; remote_error rerr;
int ret; int ret;
DEBUG("stream=%p proc=%d serial=%d", VIR_DEBUG("stream=%p proc=%d serial=%d",
stream, msg->hdr.proc, msg->hdr.serial); stream, msg->hdr.proc, msg->hdr.serial);
memset(&rerr, 0, sizeof rerr); memset(&rerr, 0, sizeof rerr);
@ -436,7 +437,7 @@ remoteStreamHandleFinish(struct qemud_client *client,
ret = virStreamFinish(stream->st); ret = virStreamFinish(stream->st);
if (ret < 0) { if (ret < 0) {
remoteDispatchConnError(&rerr, client->conn); remoteDispatchError(&rerr);
return remoteSerializeReplyError(client, &rerr, &msg->hdr); return remoteSerializeReplyError(client, &rerr, &msg->hdr);
} else { } else {
/* Send zero-length confirm */ /* Send zero-length confirm */
@ -460,7 +461,7 @@ remoteStreamHandleAbort(struct qemud_client *client,
{ {
remote_error rerr; remote_error rerr;
DEBUG("stream=%p proc=%d serial=%d", VIR_DEBUG("stream=%p proc=%d serial=%d",
stream, msg->hdr.proc, msg->hdr.serial); stream, msg->hdr.proc, msg->hdr.serial);
memset(&rerr, 0, sizeof rerr); memset(&rerr, 0, sizeof rerr);
@ -495,7 +496,7 @@ remoteStreamHandleWrite(struct qemud_client *client,
{ {
struct qemud_client_message *msg, *tmp; struct qemud_client_message *msg, *tmp;
DEBUG("stream=%p", stream); VIR_DEBUG("stream=%p", stream);
msg = stream->rx; msg = stream->rx;
while (msg && !stream->closed) { while (msg && !stream->closed) {
@ -550,7 +551,7 @@ remoteStreamHandleRead(struct qemud_client *client,
size_t bufferLen = REMOTE_MESSAGE_PAYLOAD_MAX; size_t bufferLen = REMOTE_MESSAGE_PAYLOAD_MAX;
int ret; int ret;
DEBUG("stream=%p", stream); VIR_DEBUG("stream=%p", stream);
/* Shouldn't ever be called unless we're marked able to /* Shouldn't ever be called unless we're marked able to
* transmit, but doesn't hurt to check */ * transmit, but doesn't hurt to check */
@ -568,7 +569,7 @@ remoteStreamHandleRead(struct qemud_client *client,
} else if (ret < 0) { } else if (ret < 0) {
remote_error rerr; remote_error rerr;
memset(&rerr, 0, sizeof rerr); memset(&rerr, 0, sizeof rerr);
remoteDispatchConnError(&rerr, NULL); remoteDispatchError(&rerr);
ret = remoteSerializeStreamError(client, &rerr, stream->procedure, stream->serial); ret = remoteSerializeStreamError(client, &rerr, stream->procedure, stream->serial);
} else { } else {
@ -603,7 +604,7 @@ remoteStreamMessageFinished(struct qemud_client *client,
stream = stream->next; stream = stream->next;
} }
DEBUG("Message client=%p stream=%p proc=%d serial=%d", client, stream, msg->hdr.proc, msg->hdr.serial); VIR_DEBUG("Message client=%p stream=%p proc=%d serial=%d", client, stream, msg->hdr.proc, msg->hdr.serial);
if (stream) { if (stream) {
stream->tx = 1; stream->tx = 1;

View File

@ -64,7 +64,7 @@ dot_html_in = $(notdir $(wildcard $(srcdir)/*.html.in)) todo.html.in \
$(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/internals/*.html.in)) $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/internals/*.html.in))
dot_html = $(dot_html_in:%.html.in=%.html) dot_html = $(dot_html_in:%.html.in=%.html)
patches = $(wildcard api_extension/*.patch) patches = $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/api_extension/*.patch))
xml = \ xml = \
libvirt-api.xml \ libvirt-api.xml \
@ -80,6 +80,7 @@ fig = \
EXTRA_DIST= \ EXTRA_DIST= \
apibuild.py \ apibuild.py \
site.xsl newapi.xsl news.xsl page.xsl \ site.xsl newapi.xsl news.xsl page.xsl \
hacking1.xsl hacking2.xsl wrapstring.xsl \
$(dot_html) $(dot_html_in) $(gif) $(apihtml) $(apipng) \ $(dot_html) $(dot_html_in) $(gif) $(apihtml) $(apipng) \
$(devhelphtml) $(devhelppng) $(devhelpcss) $(devhelpxsl) \ $(devhelphtml) $(devhelppng) $(devhelpcss) $(devhelpxsl) \
$(xml) $(fig) $(png) $(css) \ $(xml) $(fig) $(png) $(css) \
@ -87,11 +88,14 @@ EXTRA_DIST= \
sitemap.html.in \ sitemap.html.in \
todo.pl todo.cfg-example todo.pl todo.cfg-example
MAINTAINERCLEANFILES = $(dot_html) $(apihtml) $(devhelphtml) MAINTAINERCLEANFILES = \
$(addprefix $(srcdir)/,$(dot_html)) \
$(addprefix $(srcdir)/,$(apihtml)) \
$(addprefix $(srcdir)/,$(devhelphtml))
all: web all: web
api: libvirt-api.xml libvirt-refs.xml api: $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml
web: $(dot_html) html/index.html devhelp/index.html web: $(dot_html) html/index.html devhelp/index.html
@ -137,28 +141,29 @@ internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in
"-//W3C//DTD XHTML 1.0 Strict//EN" > /dev/null ; then \ "-//W3C//DTD XHTML 1.0 Strict//EN" > /dev/null ; then \
echo "Validating $@" ; \ echo "Validating $@" ; \
SGML_CATALOG_FILES='$(XML_CATALOG_FILE)' \ SGML_CATALOG_FILES='$(XML_CATALOG_FILE)' \
$(XMLLINT) --catalogs --nonet --format --valid $< > $@ \ $(XMLLINT) --catalogs --nonet --format --valid $< > $(srcdir)/$@ \
|| { rm $@ && exit 1; }; \ || { rm $(srcdir)/$@ && exit 1; }; \
else echo "missing XHTML1 DTD" ; fi ; fi else echo "missing XHTML1 DTD" ; fi ; fi
html/index.html: libvirt-api.xml newapi.xsl page.xsl sitemap.html.in html/index.html: libvirt-api.xml newapi.xsl page.xsl sitemap.html.in
-@if [ -x $(XSLTPROC) ] ; then \ -@if [ -x $(XSLTPROC) ] ; then \
echo "Rebuilding the HTML pages from the XML API" ; \ echo "Rebuilding the HTML pages from the XML API" ; \
$(XSLTPROC) --nonet $(srcdir)/newapi.xsl libvirt-api.xml ; fi $(XSLTPROC) --nonet -o $(srcdir)/ \
$(srcdir)/newapi.xsl $(srcdir)/libvirt-api.xml ; fi
-@if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \ -@if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \
if $(XMLCATALOG) '$(XML_CATALOG_FILE)' "-//W3C//DTD XHTML 1.0 Strict//EN" \ if $(XMLCATALOG) '$(XML_CATALOG_FILE)' "-//W3C//DTD XHTML 1.0 Strict//EN" \
> /dev/null ; then \ > /dev/null ; then \
echo "Validating the resulting XHTML pages" ; \ echo "Validating the resulting XHTML pages" ; \
SGML_CATALOG_FILES='$(XML_CATALOG_FILE)' \ SGML_CATALOG_FILES='$(XML_CATALOG_FILE)' \
$(XMLLINT) --catalogs --nonet --valid --noout html/*.html ; \ $(XMLLINT) --catalogs --nonet --valid --noout $(srcdir)/html/*.html ; \
else echo "missing XHTML1 DTD" ; fi ; fi else echo "missing XHTML1 DTD" ; fi ; fi
$(addprefix $(srcdir)/,$(devhelphtml)): $(srcdir)/libvirt-api.xml $(devhelpxsl) $(addprefix $(srcdir)/,$(devhelphtml)): $(srcdir)/libvirt-api.xml $(devhelpxsl)
-@echo Rebuilding devhelp files -@echo Rebuilding devhelp files
-@if [ -x $(XSLTPROC) ] ; then \ -@if [ -x $(XSLTPROC) ] ; then \
$(XSLTPROC) --nonet -o devhelp/libvirt.devhelp \ $(XSLTPROC) --nonet -o $(srcdir)/devhelp/ \
$(top_srcdir)/docs/devhelp/devhelp.xsl libvirt-api.xml ; fi $(top_srcdir)/docs/devhelp/devhelp.xsl $(srcdir)/libvirt-api.xml ; fi
python_generated_files = \ python_generated_files = \
$(srcdir)/html/libvirt-libvirt.html \ $(srcdir)/html/libvirt-libvirt.html \
@ -178,7 +183,7 @@ clean-local:
rm -f *~ *.bak *.hierarchy *.signals *-unused.txt *.html rm -f *~ *.bak *.hierarchy *.signals *-unused.txt *.html
maintainer-clean-local: clean-local maintainer-clean-local: clean-local
rm -rf libvirt-api.xml libvirt-refs.xml todo.html.in rm -rf $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml todo.html.in
rebuild: api all rebuild: api all
@ -186,7 +191,6 @@ install-data-local:
$(mkinstalldirs) $(DESTDIR)$(HTML_DIR) $(mkinstalldirs) $(DESTDIR)$(HTML_DIR)
for f in $(css) $(dot_html) $(gif) $(png); do \ for f in $(css) $(dot_html) $(gif) $(png); do \
$(INSTALL) -m 0644 $(srcdir)/$$f $(DESTDIR)$(HTML_DIR); done $(INSTALL) -m 0644 $(srcdir)/$$f $(DESTDIR)$(HTML_DIR); done
-$(INSTALL) -m 0644 $(srcdir)/Libxml2-Logo-90x34.gif $(DESTDIR)$(HTML_DIR)
$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/html $(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/html
for h in $(apihtml); do \ for h in $(apihtml); do \
$(INSTALL) -m 0644 $(srcdir)/$$h $(DESTDIR)$(HTML_DIR)/html; done $(INSTALL) -m 0644 $(srcdir)/$$h $(DESTDIR)$(HTML_DIR)/html; done

View File

@ -4,7 +4,7 @@
<h1>The libvirt API concepts</h1> <h1>The libvirt API concepts</h1>
<p> This page describes the main principles and architecture choices <p> This page describes the main principles and architecture choices
behind the definition of the libvirt API: behind the definition of the libvirt API:</p>
<ul id="toc"></ul> <ul id="toc"></ul>
@ -22,7 +22,7 @@
possible to use both KVM and LinuxContainers on the same node). A NULL possible to use both KVM and LinuxContainers on the same node). A NULL
name will default to a preselected hypervisor but it's probably not a name will default to a preselected hypervisor but it's probably not a
wise thing to do in most cases. See the <a href="uri.html">connection wise thing to do in most cases. See the <a href="uri.html">connection
URI</a> page for a full descriptions of the values allowed.<p> URI</a> page for a full descriptions of the values allowed.</p>
<p> Once the application obtained a <code class='docref'>virConnectPtr</code> <p> Once the application obtained a <code class='docref'>virConnectPtr</code>
connection to the connection to the
hypervisor it can then use it to manage domains and related resources hypervisor it can then use it to manage domains and related resources
@ -61,7 +61,7 @@
<code>defined</code> in which case they are inactive but there is <code>defined</code> in which case they are inactive but there is
a permanent definition available in the system for them. Based on this a permanent definition available in the system for them. Based on this
thay can be activated dynamically in order to be used.</p> thay can be activated dynamically in order to be used.</p>
<p> Most kind of object can also be named in various ways:<p> <p> Most kind of object can also be named in various ways:</p>
<ul> <ul>
<li>by their <code>name</code>, an user friendly identifier but <li>by their <code>name</code>, an user friendly identifier but
whose unicity cannot be garanteed between two nodes.</li> whose unicity cannot be garanteed between two nodes.</li>
@ -82,7 +82,7 @@
<p> For each first class object you will find apis <p> For each first class object you will find apis
for the following actions:</p> for the following actions:</p>
<ul> <ul>
<li><b>Lookup</b>:...LookupByName, <li><b>Lookup</b>:...LookupByName,</li>
<li><b>Enumeration</b>:virConnectList... and virConnectNumOf...: <li><b>Enumeration</b>:virConnectList... and virConnectNumOf...:
those are used to enumerate a set of object available to an given those are used to enumerate a set of object available to an given
hypervisor connection like: hypervisor connection like:
@ -108,7 +108,8 @@
<li><b>Destruction</b>: ... </li> <li><b>Destruction</b>: ... </li>
</ul> </ul>
<p> For more in-depth details of the storage related APIs see <p> For more in-depth details of the storage related APIs see
<a href="storage.html">the storage management page</a>, <a href="storage.html">the storage management page</a>.
</p>
<h2><a name="Driver">The libvirt drivers</a></h2> <h2><a name="Driver">The libvirt drivers</a></h2>
<p></p> <p></p>
<p class="image"> <p class="image">

View File

@ -62,7 +62,7 @@ index 629d97b..1b39210 100644
+ unsigned int flags) + unsigned int flags)
+{ +{
+ virConnectPtr conn; + virConnectPtr conn;
+ DEBUG("domain=%p, nvcpus=%u, flags=%u", domain, nvcpus, flags); + VIR_DEBUG("domain=%p, nvcpus=%u, flags=%u", domain, nvcpus, flags);
+ +
+ virResetLastError(); + virResetLastError();
+ +
@ -125,7 +125,7 @@ index 629d97b..1b39210 100644
+virDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags) +virDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
+{ +{
+ virConnectPtr conn; + virConnectPtr conn;
+ DEBUG("domain=%p, flags=%u", domain, flags); + VIR_DEBUG("domain=%p, flags=%u", domain, flags);
+ +
+ virResetLastError(); + virResetLastError();
+ +

File diff suppressed because it is too large Load Diff

View File

@ -23,27 +23,54 @@
<img src="madeWith.png" alt="Made with libvirt"/> <img src="madeWith.png" alt="Made with libvirt"/>
</p> </p>
<h2><a name="clientserver">Client/Server applications</a></h2>
<dl>
<dt><a href="http://archipelproject.org">Archipel</a></dt>
<dd>
Archipel is a libvirt-based solution to manage and supervise virtual
machines. It uses XMPP for all communication. There is no web
service or custom protocol. You just need at least one XMPP server,
like eJabberd, to start playing with it. This allows Archipel to
work completely real time. You never have to refresh the user
interface, you'll be notified as soon as something happens. You can
even use your favorite chat clients to command your infrastructure.
</dd>
<dd>
Isn't it great to be able to open a chat conversation with your
virtual machine and say things like "How are you today?" or "Hey,
please reboot"?
</dd>
</dl>
<h2><a name="command">Command line tools</a></h2> <h2><a name="command">Command line tools</a></h2>
<dl> <dl>
<dt><a href="http://libguestfs.org">guestfish</a></dt>
<dd>
Guestfish is an interactive shell and command-line tool for examining
and modifying virtual machine filesystems. It uses libvirt to find
guests and their associated disks.
</dd>
<dt>virsh</dt> <dt>virsh</dt>
<dd> <dd>
An interactive shell, and batch scriptable tool for performing An interactive shell, and batch scriptable tool for performing
management tasks on all libvirt managed domains, networks and management tasks on all libvirt managed domains, networks and
storage. This is part of the libvirt core distribution. storage. This is part of the libvirt core distribution.
</dd> </dd>
<dt><a href="http://virt-manager.org/">virt-install</a></dt>
<dd>
Provides a way to provision new virtual machines from a
OS distribution install tree. It supports provisioning from
local CD images, and the network over NFS, HTTP and FTP.
</dd>
<dt><a href="http://virt-manager.org/">virt-clone</a></dt> <dt><a href="http://virt-manager.org/">virt-clone</a></dt>
<dd> <dd>
Allows the disk image(s) and configuration for an existing Allows the disk image(s) and configuration for an existing
virtual machine to be cloned to form a new virtual machine. virtual machine to be cloned to form a new virtual machine.
It automates copying of data across to new disk images, and It automates copying of data across to new disk images, and
updates the UUID, Mac address and name in the configuration updates the UUID, MAC address, and name in the configuration.
</dd>
<dt><a href="http://et.redhat.com/~rjones/virt-df/">virt-df</a></dt>
<dd>
Examine the utilization of each filesystem in a virtual machine
from the comfort of the host machine. This tool peeks into the
guest disks and determines how much space is used. It can cope
with common Linux filesystems and LVM volumes.
</dd> </dd>
<dt><a href="http://virt-manager.org/">virt-image</a></dt> <dt><a href="http://virt-manager.org/">virt-image</a></dt>
<dd> <dd>
@ -53,18 +80,102 @@
into the domain XML format for execution under any libvirt into the domain XML format for execution under any libvirt
hypervisor meeting the pre-requisites. hypervisor meeting the pre-requisites.
</dd> </dd>
<dt><a href="http://et.redhat.com/~rjones/virt-df/">virt-df</a></dt> <dt><a href="http://virt-manager.org/">virt-install</a></dt>
<dd> <dd>
Examine the utilization of each filesystem in a virtual machine Provides a way to provision new virtual machines from a
from the comfort of the host machine. This tool peeks into the OS distribution install tree. It supports provisioning from
guest disks and determines how much space is used. It can cope local CD images, and the network over NFS, HTTP and FTP.
with common Linux filesystems and LVM volumes.
</dd> </dd>
<dt><a href="http://et.redhat.com/~rjones/virt-top/">virt-top</a></dt> <dt><a href="http://et.redhat.com/~rjones/virt-top/">virt-top</a></dt>
<dd> <dd>
Watch the CPU, memory, network and disk utilization of all Watch the CPU, memory, network and disk utilization of all
virtual machines running on a host. virtual machines running on a host.
</dd> </dd>
<dt>
<a href="http://people.redhat.com/~rjones/virt-what/">virt-what</a>
</dt>
<dd>
virt-what is a shell script for detecting if the program is running
in a virtual machine. It prints out a list of facts about the
virtual machine, derived from heuristics.
</dd>
</dl>
<h2><a name="configmgmt">Configuration Management</a></h2>
<dl>
<dt><a href="https://wiki.lcfg.org/bin/view/LCFG/LcfgLibvirt">LCFG</a></dt>
<dd>
LCFG is a system for automatically installing and managing the
configuration of large numbers of Unix systems. It is particularly
suitable for sites with very diverse and rapidly changing
configurations.
</dd>
<dd>
The lcfg-libvirt package adds support for virtualized systems to
LCFG, with both Xen and KVM known to work. Cloning guests is
supported, as are the bridged, routed, and isolated modes for
Virtual Networking.
</dd>
</dl>
<h2><a name="continuousintegration">Continuous Integration</a></h2>
<dl>
<dt><a href="http://buildbot.net/buildbot/docs/current/Libvirt.html">BuildBot</a></dt>
<dd>
BuildBot is a system to automate the compile/test cycle required
by most software projects. CVS commits trigger new builds, run on
a variety of client machines. Build status (pass/fail/etc) are
displayed on a web page or through other protocols.
</dd>
</dl>
<dl>
<dt><a href="http://wiki.jenkins-ci.org/display/JENKINS/Libvirt+Slaves+Plugin">Jenkins</a></dt>
<dd>
This plugin for Jenkins adds a way to control guest domains hosted
on Xen or QEMU/KVM. You configure a Jenkins Slave,
selecting the guest domain and hypervisor. When you need to build a
job on a specific Slave, its guest domain is started, then the job is
run. When the build process is finished, the guest domain is shut
down, ready to be used again as required.
</dd>
</dl>
<h2><a name="conversion">Conversion</a></h2>
<dl>
<dt><a href="https://rwmj.wordpress.com/2009/10/13/poor-mans-p2v/">Poor mans p2v</a></dt>
<dd>
A simple approach for converting a physical machine to a virtual
machine, using a rescue CD.
</dd>
<dt><a href="http://et.redhat.com/~rjones/virt-p2v/">virt-p2v</a></dt>
<dd>
An older tool for converting a physical machine into a virtual
machine. It is a LiveCD which is booted on the machine to be
converted. It collects a little information from the user, then
copies the disks over to a remote machine and defines the XML for a
domain to run the guest.
</dd>
<dt><a href="http://git.fedorahosted.org/git/?p=virt-v2v.git;a=summary">virt-v2v</a></dt>
<dd>
virt-v2v converts guests from a foreign hypervisor to run on KVM,
managed by libvirt. It can currently convert Red Hat Enterprise
Linux (RHEL) and Fedora guests running on Xen and VMware ESX. It
will enable VirtIO drivers in the converted guest if possible.
</dd>
<dd>
For RHEL customers of Red Hat, conversion of Windows guests is also
possible. This conversion requires some Microsoft signed pieces,
that Red Hat can provide.
</dd>
<dt><a href="https://launchpad.net/virt-goodies">vmware2libvirt</a></dt>
<dd>
Part of the <i>virt-goodies</i> package, vmware2libvirt is a python
script for migrating a vmware image to libvirt.
</dd>
</dl> </dl>
<h2><a name="desktop">Desktop applications</a></h2> <h2><a name="desktop">Desktop applications</a></h2>
@ -86,23 +197,32 @@
</dd> </dd>
</dl> </dl>
<h2><a name="web">Web applications</a></h2> <h2><a name="iaas">Infrastructure as a Service (IaaS)</a></h2>
<dl> <dl>
<dt><a href="http://ovirt.org/">oVirt</a></dt> <dt><a href="http://www.nimbusproject.org">Nimbus</a></dt>
<dd> <dd>
oVirt provides the ability to manage large numbers of virtual Nimbus is an open-source toolkit focused on providing
machines across an entire data center of hosts. It integrates Infrastructure-as-a-Service (IaaS) capabilities to the scientific
with FreeIPA for Kerberos authentication, and in the future, community. It uses libvirt for communication with all KVM and Xen
certificate management. virtual machines.
</dd> </dd>
<dt><a href="http://community.abiquo.com/display/AbiCloud">AbiCloud</a></dt> </dl>
<h2><a name="libraries">Libraries</a></h2>
<dl>
<dt><a href="http://libguestfs.org">libguestfs</a></dt>
<dd> <dd>
AbiCloud is an open source cloud platform manager which allows to A library and set of tools for accessing and modifying virtual
easily deploy a private cloud in your datacenter. One of the key machine disk images. It can be linked with C and C++ management
differences of AbiCloud is the web rich interface for managing the programs, and has bindings for Perl, Python, Ruby, Java, OCaml,
infrastructure. You can deploy a new service just dragging and PHP, Haskell, and C#.
dropping a VM. </dd>
<dd>
Using its FUSE module, you can also mount guest filesystems on the
host, and there is a subproject to allow merging changes into the
Windows Registry in Windows guests.
</dd> </dd>
</dl> </dl>
@ -111,38 +231,78 @@
<dl> <dl>
<dt><a href="http://et.redhat.com/~rjones/virt-p2v/">virt-p2v</a></dt> <dt><a href="http://et.redhat.com/~rjones/virt-p2v/">virt-p2v</a></dt>
<dd> <dd>
A tool for converting a physical machine into a virtual machine. It An older tool for converting a physical machine into a virtual
is a LiveCD which is booted on the machine to be converted. It collects machine. It is a LiveCD which is booted on the machine to be
a little information from the user and then copies the disks over to converted. It collects a little information from the user, then
a remote machine and defines the XML for a domain to run the guest. copies the disks over to a remote machine and defines the XML for a
domain to run the guest.
</dd> </dd>
</dl> </dl>
<h2><a name="monitoring">Monitoring plugins</a></h2> <h2><a name="monitoring">Monitoring</a></h2>
<dl> <dl>
<dt><a href="http://honk.sigxcpu.org/projects/libvirt/#munin">for munin</a></dt> <dt><a href="http://collectd.org/plugins/libvirt.shtml">collectd</a></dt>
<dd> <dd>
The plugins provided by Guido Günther allow to monitor various things The libvirt-plugin is part of <a href="http://collectd.org/">collectd</a>
and gathers statistics about virtualized guests on a system. This
way, you can collect CPU, network interface and block device usage
for each guest without installing collectd on the guest systems.
For a full description, please refer to the libvirt section in the
collectd.conf(5) manual page.
</dd>
<dt><a href="http://honk.sigxcpu.org/projects/libvirt/#munin">Munin</a></dt>
<dd>
The plugins provided by Guido G&uuml;nther allow to monitor various things
like network and block I/O with like network and block I/O with
<a href="http://munin.projects.linpro.no/">Munin</a>. <a href="http://munin.projects.linpro.no/">Munin</a>.
</dd> </dd>
<dt><a href="http://collectd.org/plugins/libvirt.shtml">for collectd</a></dt> <dt><a href="http://et.redhat.com/~rjones/nagios-virt/">Nagios-virt</a></dt>
<dd> <dd>
The libvirt-plugin is part of <a href="http://collectd.org/">collectd</a> Nagios-virt is a configuration tool to add monitoring of your
and gather statistics about virtualized guests on a system. This
way, you can collect CPU, network interface and block device usage
for each guest without installing collectd on the guest systems.
or a full description of available please refer to the libvirt section
in the collectd.conf(5) manual page.
</dd>
<dt><a href="http://et.redhat.com/~rjones/nagios-virt/">nagios-virt</a></dt>
<dd>
Nagios-virt is a configuration tool for adding monitoring of your
virtualised domains to <a href="http://www.nagios.org/">Nagios</a>. virtualised domains to <a href="http://www.nagios.org/">Nagios</a>.
You can use this tool to either set up a new Nagios installation for You can use this tool to either set up a new Nagios installation for
your Xen or QEMU/KVM guests, or to integrate with your existing Nagios your Xen or QEMU/KVM guests, or to integrate with your existing Nagios
installation. installation.
</dd> </dd>
<dt><a href="http://community.zenoss.org/docs/DOC-4687">Zenoss</a></dt>
<dd>
The Zenoss libvirt Zenpack adds support for monitoring virtualization
servers. It has been tested with KVM, QEMU, VMware ESX, and VMware
GSX.
</dd>
</dl>
<h2><a name="provisioning">Provisioning</a></h2>
<dl>
<dt><a href="http://www.ibm.com/software/tivoli/products/prov-mgr/">Tivoli Provisioning Manager</a></dt>
<dd>
Part of the IBM Tivoli family, Tivoli Provisioning Manager (TPM) is
an IT lifecycle automation product. It
<a href="http://publib.boulder.ibm.com/infocenter/tivihelp/v38r1/index.jsp?topic=/com.ibm.tivoli.tpm.apk.doc/libvirt_package.html">uses libvirt</a>
for communication with virtualization hosts and guest domains.
</dd>
</dl>
<h2><a name="web">Web applications</a></h2>
<dl>
<dt><a href="http://community.abiquo.com/display/AbiCloud">AbiCloud</a></dt>
<dd>
AbiCloud is an open source cloud platform manager which allows to
easily deploy a private cloud in your datacenter. One of the key
differences of AbiCloud is the web rich interface for managing the
infrastructure. You can deploy a new service just dragging and
dropping a VM.
</dd>
<dt><a href="http://ovirt.org/">oVirt</a></dt>
<dd>
oVirt provides the ability to manage large numbers of virtual
machines across an entire data center of hosts. It integrates
with FreeIPA for Kerberos authentication, and in the future,
certificate management.
</dd>
</dl> </dl>
</body> </body>

View File

@ -32,7 +32,7 @@
</li> </li>
<li><strong>Guest C</strong>. The only network interface is connected <li><strong>Guest C</strong>. The only network interface is connected
to a virtual network <code>VLAN 2</code>. It has no direct connectivity to a virtual network <code>VLAN 2</code>. It has no direct connectivity
to a physical LAN, relying on <code>Guest B</codE> to route traffic to a physical LAN, relying on <code>Guest B</code> to route traffic
on its behalf. on its behalf.
</li> </li>
</ul> </ul>

View File

@ -27,16 +27,18 @@
</li> </li>
<li> <li>
<p> <p>
<strong>PHP</strong>: Radek Hladik develops <strong>PHP</strong>: Radek Hladik started developing
<a href="http://phplibvirt.cybersales.cz/">PHP bindings</a>. <a href="http://libvirt.org/php">PHP bindings</a> in 2010.
</p> </p>
<p> <p>
The php-libvirt bindings also have their source online In February 2011 the binding development has been moved to the libvirt.org website as
<a href="http://github.com/Kedarius/php-libvirt">here in Github</a>. libvirt-php project.
</p> </p>
<p> <p>
This allows you to easily see the code, make comments on it, The project is now maintained by Michal Novotny and it's heavily based
create your own forks, and contribute the changes back. on Radek's version. For more information, including
information on posting patches to libvirt-php, please refer
to the <a href="http://libvirt.org/php">PHP bindings</a> site.
</p> </p>
</li> </li>
<li> <li>

View File

@ -8,43 +8,78 @@
<h2><a name="email">Mailing lists</a></h2> <h2><a name="email">Mailing lists</a></h2>
<p> <p>
There are two mailing-lists: There are three mailing-lists:
</p> </p>
<dl> <dl>
<dt><a href="https://www.redhat.com/archives/libvir-list/">libvir-list@redhat.com</a></dt> <dt><a href="https://www.redhat.com/mailman/listinfo/libvir-list">libvir-list@redhat.com</a> (for development)</dt>
<dd>This list a place for discussions about the <strong>development</strong> of libvirt. Topics for discussion include <dd>
<ul> Archives at <a href="https://www.redhat.com/archives/libvir-list">https://www.redhat.com/archives/libvir-list</a>
<li>New features for libvirt</li> </dd>
<li>Bug fixing of libvirt</li> <dd>
<li>New hypervisor drivers</li> This is a high volume mailing list. It is a place for discussions
<li>Development of language bindings for libvirt API</li> about the <strong>development</strong> of libvirt.
<li>Testing and documentation of libvirt</li> </dd>
</ul> <dd>
Topics for discussion include:
<ul>
<li>New features for libvirt</li>
<li>Bug fixing of libvirt</li>
<li>New hypervisor drivers</li>
<li>Development of language bindings for libvirt API</li>
<li>Testing and documentation of libvirt</li>
</ul>
</dd> </dd>
<dt><a href="https://www.redhat.com/archives/libvirt-users/">libvirt-users@redhat.com</a></dt> <dt><a href="https://www.redhat.com/mailman/listinfo/libvirt-users">libvirt-users@redhat.com</a> (for users)</dt>
<dd>This list a place for discussions involving libvirt <strong>users</strong>. Topics for discussion include <dd>
<ul> Archives at <a href="https://www.redhat.com/archives/libvirt-users">https://www.redhat.com/archives/libvirt-users</a>
<li>Usage of libvirt / virsh</li>
<li>Administration of libvirtd</li>
<li>Deployment of libvirt with hypervisors</li>
<li>Development of applications on top of / using the libvirt API(s)</li>
<li>Any other topics along these lines</li>
</ul>
</dd> </dd>
<dd>
This is a moderate volume mailing list. It is a place for discussions
involving libvirt <strong>users</strong>.
</dd>
<dd>
Topics for discussion include:
<ul>
<li>Usage of libvirt / virsh</li>
<li>Administration of libvirt</li>
<li>Deployment of libvirt with hypervisors</li>
<li>Development of applications on top of / using the libvirt API(s)</li>
<li>Any other topics along these lines</li>
</ul>
</dd>
<dt><a href="https://www.redhat.com/mailman/listinfo/libvirt-announce">libvirt-announce@redhat.com</a> (for release notices)</dt>
<dd>
Archives at <a href="https://www.redhat.com/archives/libvirt-announce">https://www.redhat.com/archives/libvirt-announce</a>
</dd>
<dd>
This is a low volume mailing list, with restricted posting, for
announcements of new libvirt releases.
</dd>
<dd>
Subscribe to just this if you want to be notified of new releases,
without subscribing to either of the other mailing lists.
</dd>
</dl> </dl>
<p> <p>
Both mailing lists require that you subscribe before posting to the list, It is recommended but not required that you subscribe before posting
otherwise your posting will be delayed for manual approval by mailman. to the user and development lists. Posts from non-subscribers will be
You can subscribe at the linked webpages above. subject to manual moderation delays. You can subscribe at the linked
web pages above.
</p> </p>
<p> <p>
Patches with explanations and provided as attachments are really appreciated and should Patches with explanations and provided as attachments are really
be directed to the development mailing list will be discussed on the mailing list. appreciated, and should be directed to the development mailing list
If possible generate the patches by using <code>git format-patch</code> in a GIT for review and discussion.
clone. Wherever possible, please generate the patches by using
<code>git format-patch</code> in a git repository clone. Further
useful information regarding developing libvirt and/or contributing is
available on our <a href="hacking.html">Contributor Guidelines</a>
page.
</p> </p>
<h2><a name="irc">IRC discussion</a></h2> <h2><a name="irc">IRC discussion</a></h2>

View File

@ -13,6 +13,13 @@
<!-- Build keys for all symbols --> <!-- Build keys for all symbols -->
<xsl:key name="symbols" match="/api/symbols/*" use="@name"/> <xsl:key name="symbols" match="/api/symbols/*" use="@name"/>
<xsl:template match="/">
<xsl:document xmlns="http://www.devhelp.net/book" href="libvirt.devhelp"
method="xml" encoding="UTF-8" indent="yes">
<xsl:apply-templates/>
</xsl:document>
</xsl:template>
<xsl:template match="/api"> <xsl:template match="/api">
<book title="{@name} Reference Manual" link="index.html" author="" name="{@name}"> <book title="{@name} Reference Manual" link="index.html" author="" name="{@name}">
<xsl:apply-templates select="files"/> <xsl:apply-templates select="files"/>

View File

@ -20,7 +20,6 @@
<ul> <ul>
<li><strong><a href="drvlxc.html">LXC</a></strong> - Linux Containers</li> <li><strong><a href="drvlxc.html">LXC</a></strong> - Linux Containers</li>
<li><strong><a href="drvone.html">OpenNebula</a></strong></li>
<li><strong><a href="drvopenvz.html">OpenVZ</a></strong></li> <li><strong><a href="drvopenvz.html">OpenVZ</a></strong></li>
<li><strong><a href="drvqemu.html">QEMU</a></strong></li> <li><strong><a href="drvqemu.html">QEMU</a></strong></li>
<li><strong><a href="drvtest.html">Test</a></strong> - Used for testing</li> <li><strong><a href="drvtest.html">Test</a></strong> - Used for testing</li>

View File

@ -74,7 +74,7 @@ vpx://example-vcenter.com/dc1/cluster1/example-esx.com
</pre> </pre>
<h4><a name="extraparams">Extra parameters</h4> <h4><a name="extraparams">Extra parameters</a></h4>
<p> <p>
Extra parameters can be added to a URI as part of the query string Extra parameters can be added to a URI as part of the query string
(the part following <code>?</code>). A single parameter is formed by a (the part following <code>?</code>). A single parameter is formed by a
@ -308,7 +308,7 @@ error: invalid argument in libvirt was built without the 'esx' driver
There are several specialties in the domain XML config for ESX domains. There are several specialties in the domain XML config for ESX domains.
</p> </p>
<h3><a name="restrictions">Restrictions</h3> <h3><a name="restrictions">Restrictions</a></h3>
<p> <p>
There are some restrictions for some values of the domain XML config. There are some restrictions for some values of the domain XML config.
The driver will complain if this restrictions are violated. The driver will complain if this restrictions are violated.
@ -328,7 +328,7 @@ error: invalid argument in libvirt was built without the 'esx' driver
</ul> </ul>
<h3><a name="datastore">Datastore references</h3> <h3><a name="datastore">Datastore references</a></h3>
<p> <p>
Storage is managed in datastores. VMware uses a special path format to Storage is managed in datastores. VMware uses a special path format to
reference files in a datastore. Basically, the datastore name is put reference files in a datastore. Basically, the datastore name is put
@ -347,7 +347,7 @@ error: invalid argument in libvirt was built without the 'esx' driver
</p> </p>
<h3><a name="macaddresses">MAC addresses</h3> <h3><a name="macaddresses">MAC addresses</a></h3>
<p> <p>
VMware has registered two MAC address prefixes for domains: VMware has registered two MAC address prefixes for domains:
<code>00:0c:29</code> and <code>00:50:56</code>. These prefixes are <code>00:0c:29</code> and <code>00:50:56</code>. These prefixes are
@ -408,7 +408,7 @@ ethernet0.checkMACAddress = "false"
</pre> </pre>
<h3><a name="hardware">Available hardware</h3> <h3><a name="hardware">Available hardware</a></h3>
<p> <p>
VMware ESX supports different models of SCSI controllers and network VMware ESX supports different models of SCSI controllers and network
cards. cards.

View File

@ -9,6 +9,28 @@ light-weight "application container" which does not have it's own root image. Y
start it using start it using
</p> </p>
<h2>Cgroups Requirements</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:
</p>
<pre>
# mount -t cgroup cgroup /dev/cgroup -o cpuacct,memory,devices,cpu,freezer,blkio
</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 neccessary to unmount the blkio controller.
</p>
<h3>Example config version 1</h3> <h3>Example config version 1</h3>
<p></p> <p></p>
<pre> <pre>

View File

@ -1,108 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8">
<title></title>
<meta name="GENERATOR" content="OpenOffice.org 3.0 (Linux)">
<meta name="CREATED" content="0;0">
<meta name="CHANGED" content="20090701;13170700">
</head>
<body lang="en-US" dir="LTR">
<h1>OpenNebula Virtual Infrastructure Manager driver</h1>
<p><a name="toc"></a><a href="http://opennebula.org/">OpenNebula</a>
is a Virtual Infrastructure Manager that controls Virtual Machines (VM) in a pool of distributed resources
by orchestrating network, storage and virtualization technologies. The OpenNebula driver lets you manage your private or hybrid (<a href="http://aws.amazon.com/ec2/">Amazon EC2</a> or <a href="http://www.elastichosts.com/">Elastic Hosts</a> based) cloud using a standard libvirt interface, including the API as well as the related
tools and VM description files.</p>
<h2>
<a name="prereq"></a>Deployment pre-requisites</h2>
<ul>
<li>
<p style="margin-bottom: 0in">A working OpenNebula installation,
version 1.2 or higher.
</p>
</li>
</ul>
<h2>
<a name="uris"></a>Connections to OpenNebula driver</h2>
<p>The Uri of the driver protocol is "one". Some example
connection Uris for the driver are:
</p>
<pre>
one:/// (local access)
one+unix:/// (local access)
one://example.com/ (remote access)
one+tcp://example.com/ (remote access, SASl/Kerberos)
one+ssh://user@example.com/ (remote access, SSH tunnelled)
</pre>
<h2>
<a name="xmlconfig"></a>Example domain XML config</h2>
<p>There are some limitations on the XML attributes that may be
specified when interfacing OpenNebula. The following xml example
details the attributes and options supported by the OpenNebula
driver:</p>
<h3>Paravirtualized guest direct kernel boot
</h3>
<pre>
&lt;domain type='one'&gt;
&lt;name&gt;vm01&lt;/name&gt;
&lt;memory&gt;32768&lt;/memory&gt;
&lt;vcpu&gt;1&lt;/vcpu&gt;
&lt;os&gt;
&lt;type&gt;linux&lt;/type&gt;
&lt;kernel&gt;/boot/vmlinuz-2.6.24-17-xen&lt;/kernel&gt;
&lt;initrd&gt;/boot/initrd.img-2.6.24-17-xen&lt;/initrd&gt;
&lt;cmdline&gt;&lt;/cmdline&gt;
&lt;root&gt;sda1&lt;/root&gt;
&lt;/os&gt;
&lt;devices&gt;
&lt;disk type='file' device='disk'&gt;
&lt;source file='/images/sgehosts/01/disk.img'/&gt;
&lt;target dev='sda1'/&gt;
&lt;/disk&gt;
&lt;disk type='file' device='disk'&gt;
&lt;source file='/images/sgehosts/01/swap.img'/&gt;
&lt;target dev='sda2'/&gt;
&lt;/disk&gt;
&lt;disk type='file' device='cdrom'&gt;
&lt;source file='/images/iso/cdrom.iso'/&gt;
&lt;target dev='hdc'/&gt;
&lt;readonly/&gt;
&lt;/disk&gt;
&lt;!--BRIDGE--&gt;
&lt;interface type='bridge'&gt;
&lt;source bridge='eth0'/&gt;
&lt;mac address='00:16:3e:5d:c7:9e'/&gt;
&lt;/interface&gt;
&lt;!--ONE Network--&gt;
&lt;interface type='network'&gt;
&lt;source network='onenetwork'/&gt;
&lt;/interface&gt;
&lt;/devices&gt;
&lt;/domain&gt;
</pre>
<p>
<b>Note:</b> The "&lt;interface type='network'&gt;" will
attach the interface to a previously configured network (named
<tt>onenetwork</tt>) within the <a href="http://opennebula.org/">OpenNebula</a> system, typically with the
<tt>onevnet</tt> CLI command.</p>
<p><b>Note</b>: OpenNebula supports the simultaneous use of different hypervisors, so you can specify any os type (linux or hvm) supported by your cluster.
</p>
<h2>Links</h2>
<ul>
<li><a href="http://www.opennebula.org/doku.php?id=documentation">OpenNebula Documentation</a>
</li>
<li><a href="http://www.opennebula.org/doku.php?id=documentation:rel1.2:ug">OpenNebula User Guide</a>
</li>
</ul>
</body>
</html>

View File

@ -55,7 +55,7 @@ openvz+ssh://root@example.com/system (remote access, SSH tunnelled)
OpenVZ releases later than 3.0.23 ship with a standard network device OpenVZ releases later than 3.0.23 ship with a standard network device
setup script that is able to setup bridging, named setup script that is able to setup bridging, named
<code>/usr/sbin/vznetaddbr</code>. For releases prior to 3.0.23, this <code>/usr/sbin/vznetaddbr</code>. For releases prior to 3.0.23, this
script must be created manually by the host OS adminstrator. The script must be created manually by the host OS administrator. The
simplest way is to just download the latest version of this script simplest way is to just download the latest version of this script
from a newer OpenVZ release, or upstream source repository. Then from a newer OpenVZ release, or upstream source repository. Then
a generic configuration file <code>/etc/vz/vznetctl.conf</code> a generic configuration file <code>/etc/vz/vznetctl.conf</code>

View File

@ -7,7 +7,7 @@
guests built for User Mode Linux. UML requires no special support in guests built for User Mode Linux. UML requires no special support in
the host kernel, so can be used by any user of any linux system, provided the host kernel, so can be used by any user of any linux system, provided
they have enough free RAM for their guest's needs, though there are they have enough free RAM for their guest's needs, though there are
certain restrictions on network connectivity unless the adminstrator certain restrictions on network connectivity unless the administrator
has pre-created TAP devices. has pre-created TAP devices.
</p> </p>

View File

@ -8,7 +8,9 @@
</p> </p>
<p> <p>
This driver uses the "vmrun" utility which is distributed with the VMware VIX API. This driver uses the "vmrun" utility which is distributed with the VMware VIX API.
You can download the VIX API from <a href="http://www.vmware.com/support/developer/vix-api/">here</a>. You can download the VIX API
from <a href="http://www.vmware.com/support/developer/vix-api/">here</a>.
</p>
<h2>Connections to VMware driver</h2> <h2>Connections to VMware driver</h2>

View File

@ -55,6 +55,7 @@ BIOS you will see</p>
&lt;/arch&gt; &lt;/arch&gt;
&lt;features&gt; &lt;features&gt;
&lt;cpuselection/&gt; &lt;cpuselection/&gt;
&lt;deviceboot/&gt;
&lt;/features&gt; &lt;/features&gt;
&lt;/guest&gt;</span> &lt;/guest&gt;</span>
... ...

File diff suppressed because it is too large Load Diff

View File

@ -105,12 +105,15 @@
<h3><a name="elementsAddress">Addressing</a></h3> <h3><a name="elementsAddress">Addressing</a></h3>
<p> <p>
The final set of elements define the IPv4 address range available, The final set of elements define the addresses (IPv4 and/or
and optionally enable DHCP sevices. IPv6, as well as MAC) to be assigned to the bridge device
associated with the virtual network, and optionally enable DHCP
services.
</p> </p>
<pre> <pre>
... ...
&lt;mac address='00:16:3E:5D:C7:9E'/&gt;
&lt;ip address="192.168.122.1" netmask="255.255.255.0"&gt; &lt;ip address="192.168.122.1" netmask="255.255.255.0"&gt;
&lt;dhcp&gt; &lt;dhcp&gt;
&lt;range start="192.168.122.100" end="192.168.122.254" /&gt; &lt;range start="192.168.122.100" end="192.168.122.254" /&gt;
@ -118,9 +121,24 @@
&lt;host mac="00:16:3e:3e:a9:1a" name="bar.example.com" ip="192.168.122.11" /&gt; &lt;host mac="00:16:3e:3e:a9:1a" name="bar.example.com" ip="192.168.122.11" /&gt;
&lt;/dhcp&gt; &lt;/dhcp&gt;
&lt;/ip&gt; &lt;/ip&gt;
&lt;ip family="ipv6" address="2001:8794:ca2:2::1" prefix="64" /&gt;
&lt;/network&gt;</pre> &lt;/network&gt;</pre>
<dl> <dl>
<dt><code>mac</code></dt>
<dd>The <code>address</code> attribute defines a MAC
(hardware) address formatted as 6 groups of 2-digit
hexadecimal numbers, the groups separated by colons
(eg, <code>"52:54:00:1C:DA:2F"</code>). This MAC address is
assigned to the bridge device when it is created. Generally
it is best to not specify a MAC address when creating a
network - in this case, if a defined MAC address is needed for
proper operation, libvirt will automatically generate a random
MAC address and save it in the config. Allowing libvirt to
generate the MAC address will assure that it is compatible
with the idiosyncrasies of the platform where libvirt is
running. <span class="since">Since 0.8.8</span>
</dd>
<dt><code>ip</code></dt> <dt><code>ip</code></dt>
<dd>The <code>address</code> attribute defines an IPv4 address in <dd>The <code>address</code> attribute defines an IPv4 address in
dotted-decimal format, or an IPv6 address in standard dotted-decimal format, or an IPv6 address in standard
@ -209,6 +227,7 @@
&lt;range start="192.168.122.2" end="192.168.122.254" /&gt; &lt;range start="192.168.122.2" end="192.168.122.254" /&gt;
&lt;/dhcp&gt; &lt;/dhcp&gt;
&lt;/ip&gt; &lt;/ip&gt;
&lt;ip family="ipv6" address="2001:8794:ca2:2::1" prefix="64" /&gt;
&lt;/network&gt;</pre> &lt;/network&gt;</pre>
<h3><a name="examplesRoute">Routed network config</a></h3> <h3><a name="examplesRoute">Routed network config</a></h3>
@ -232,6 +251,7 @@
&lt;range start="192.168.122.2" end="192.168.122.254" /&gt; &lt;range start="192.168.122.2" end="192.168.122.254" /&gt;
&lt;/dhcp&gt; &lt;/dhcp&gt;
&lt;/ip&gt; &lt;/ip&gt;
&lt;ip family="ipv6" address="2001:8794:ca2:2::1" prefix="64" /&gt;
&lt;/network&gt;</pre> &lt;/network&gt;</pre>
<h3><a name="examplesPrivate">Isolated network config</a></h3> <h3><a name="examplesPrivate">Isolated network config</a></h3>
@ -253,6 +273,7 @@
&lt;range start="192.168.152.2" end="192.168.152.254" /&gt; &lt;range start="192.168.152.2" end="192.168.152.254" /&gt;
&lt;/dhcp&gt; &lt;/dhcp&gt;
&lt;/ip&gt; &lt;/ip&gt;
&lt;ip family="ipv6" address="2001:8794:ca2:3::1" prefix="64" /&gt;
&lt;/network&gt;</pre> &lt;/network&gt;</pre>
</body> </body>

View File

@ -25,18 +25,18 @@
cannot be circumvented from within cannot be circumvented from within
the virtual machine, it makes them mandatory from the point of the virtual machine, it makes them mandatory from the point of
view of a virtual machine user. view of a virtual machine user.
<br><br> <br/><br/>
The network filter subsystem allows each virtual machine's network The network filter subsystem allows each virtual machine's network
traffic filtering rules to be configured individually on a per traffic filtering rules to be configured individually on a per
interface basis. The rules are interface basis. The rules are
applied on the host when the virtual machine is started and can be modified applied on the host when the virtual machine is started and can be modified
while the virtual machine is running. The latter can be achieved by while the virtual machine is running. The latter can be achieved by
modifying the XML description of a network filter. modifying the XML description of a network filter.
<br><br> <br/><br/>
Multiple virtual machines can make use of the same generic network filter. Multiple virtual machines can make use of the same generic network filter.
When such a filter is modified, the network traffic filtering rules When such a filter is modified, the network traffic filtering rules
of all running virtual machines that reference this filter are updated. of all running virtual machines that reference this filter are updated.
<br><br> <br/><br/>
Network filtering support is available <span class="since">since 0.8.1 Network filtering support is available <span class="since">since 0.8.1
(Qemu, KVM)</span> (Qemu, KVM)</span>
</p> </p>
@ -52,8 +52,6 @@
<li><code>network</code></li> <li><code>network</code></li>
<li><code>ethernet</code> -- must be used in bridging mode</li> <li><code>ethernet</code> -- must be used in bridging mode</li>
<li><code>bridge</code></li> <li><code>bridge</code></li>
<li><code>direct</code> -- only protocols mac, arp, ip and ipv6
can be filtered</li>
</ul> </ul>
<p> <p>
The interface XML is used to reference a top-level filter. In the The interface XML is used to reference a top-level filter. In the
@ -79,7 +77,7 @@
other filters can be used, a <i>tree</i> of filters can be built. other filters can be used, a <i>tree</i> of filters can be built.
The <code>clean-traffic</code> filter can be viewed using the The <code>clean-traffic</code> filter can be viewed using the
command <code>virsh nwfilter-dumpxml clean-traffic</code>. command <code>virsh nwfilter-dumpxml clean-traffic</code>.
<br><br> <br/><br/>
As previously mentioned, a single network filter can be referenced As previously mentioned, a single network filter can be referenced
by multiple virtual machines. Since interfaces will typically by multiple virtual machines. Since interfaces will typically
have individual parameters associated with their respective traffic have individual parameters associated with their respective traffic
@ -108,7 +106,7 @@
10.0.0.1 and enforce that the traffic from this interface will 10.0.0.1 and enforce that the traffic from this interface will
always be using 10.0.0.1 as the source IP address, which is always be using 10.0.0.1 as the source IP address, which is
one of the purposes of this particular filter. one of the purposes of this particular filter.
<br><br> <br/><br/>
</p> </p>
<h3><a name="nwfconceptsvars">Usage of variables in filters</a></h3> <h3><a name="nwfconceptsvars">Usage of variables in filters</a></h3>
@ -117,7 +115,7 @@
Two variables names have so far been reserved for usage by the Two variables names have so far been reserved for usage by the
network traffic filtering subsystem: <code>MAC</code> and network traffic filtering subsystem: <code>MAC</code> and
<code>IP</code>. <code>IP</code>.
<br><br> <br/><br/>
<code>MAC</code> is the MAC address of the <code>MAC</code> is the MAC address of the
network interface. A filtering rule that references this variable network interface. A filtering rule that references this variable
will automatically be instantiated with the MAC address of the will automatically be instantiated with the MAC address of the
@ -125,7 +123,7 @@
the MAC parameter. Even though it is possible to specify the MAC the MAC parameter. Even though it is possible to specify the MAC
parameter similar to the IP parameter above, it is discouraged parameter similar to the IP parameter above, it is discouraged
since libvirt knows what MAC address an interface will be using. since libvirt knows what MAC address an interface will be using.
<br><br> <br/><br/>
The parameter <code>IP</code> represents the IP address The parameter <code>IP</code> represents the IP address
that the operating system inside the virtual machine is expected that the operating system inside the virtual machine is expected
to use on the given interface. The <code>IP</code> parameter to use on the given interface. The <code>IP</code> parameter
@ -136,7 +134,7 @@
For current limitations on IP address detection, consult the For current limitations on IP address detection, consult the
<a href="#nwflimits">section on limitations</a> on how to use this <a href="#nwflimits">section on limitations</a> on how to use this
feature and what to expect when using it. feature and what to expect when using it.
<br><br> <br/><br/>
The following is the XML description of the network filer The following is the XML description of the network filer
<code>no-arp-spoofing</code>. It serves as an example for <code>no-arp-spoofing</code>. It serves as an example for
a network filter XML referencing the <code>MAC</code> and a network filter XML referencing the <code>MAC</code> and
@ -205,7 +203,7 @@
filters may be referenced multiple times in a filter tree but filters may be referenced multiple times in a filter tree but
references between filters must not introduce loops (directed references between filters must not introduce loops (directed
acyclic graph). acyclic graph).
<br><br> <br/><br/>
The following shows the XML of the <code>clean-traffic</code> The following shows the XML of the <code>clean-traffic</code>
network filter referencing several other filters. network filter referencing several other filters.
</p> </p>
@ -226,7 +224,7 @@
needs to be provided inside a <code>filter</code> node. This needs to be provided inside a <code>filter</code> node. This
node must have the attribute <code>filter</code> whose value contains node must have the attribute <code>filter</code> whose value contains
the name of the filter to be referenced. the name of the filter to be referenced.
<br><br> <br/><br/>
New network filters can be defined at any time and New network filters can be defined at any time and
may contain references to network filters that are may contain references to network filters that are
not known to libvirt, yet. However, once a virtual machine not known to libvirt, yet. However, once a virtual machine
@ -260,9 +258,11 @@
</p> </p>
<ul> <ul>
<li> <li>
action -- mandatory; must either be <code>drop</code> or <code>accept</code> if action -- mandatory; must either be <code>drop</code>,
the evaluation of the filtering rule is supposed to drop or accept <code>reject</code><span class="since">(since 0.9.0)</span>,
a packet or <code>accept</code> if
the evaluation of the filtering rule is supposed to drop,
reject (using ICMP message), or accept a packet
</li> </li>
<li> <li>
direction -- mandatory; must either be <code>in</code>, <code>out</code> or direction -- mandatory; must either be <code>in</code>, <code>out</code> or
@ -280,7 +280,7 @@
<li> <li>
statematch -- optional; possible values are '0' or 'false' to statematch -- optional; possible values are '0' or 'false' to
turn the underlying connection state matching off; default is 'true' turn the underlying connection state matching off; default is 'true'
<br> <br/>
Also read the section on <a href="#nwfelemsRulesAdv">advanced configuration</a> Also read the section on <a href="#nwfelemsRulesAdv">advanced configuration</a>
topics. topics.
</li> </li>
@ -292,7 +292,7 @@
traffic of type <code>ip</code> is also associated with the chain traffic of type <code>ip</code> is also associated with the chain
'ipv4' then that filter's rules will be ordered relative to the priority 'ipv4' then that filter's rules will be ordered relative to the priority
500 of the shown rule. 500 of the shown rule.
<br><br> <br/><br/>
A rule may contain a single rule for filtering of traffic. The A rule may contain a single rule for filtering of traffic. The
above example shows that traffic of type <code>ip</code> is to be above example shows that traffic of type <code>ip</code> is to be
filtered. filtered.
@ -323,7 +323,7 @@
<li>STRING: A string</li> <li>STRING: A string</li>
</ul> </ul>
<p> <p>
<br><br> <br/><br/>
Every attribute except for those of type IP_MASK or IPV6_MASK can Every attribute except for those of type IP_MASK or IPV6_MASK can
be negated using the <code>match</code> be negated using the <code>match</code>
attribute with value <code>no</code>. Multiple negated attributes attribute with value <code>no</code>. Multiple negated attributes
@ -347,14 +347,14 @@
the protocol property attribute1 does not match value1 AND the protocol property attribute1 does not match value1 AND
the protocol property attribute2 does not match value2 AND the protocol property attribute2 does not match value2 AND
the protocol property attribute3 matches value3. the protocol property attribute3 matches value3.
<br><br> <br/><br/>
</p> </p>
<h5><a name="nwfelemsRulesProtoMAC">MAC (Ethernet)</a></h5> <h5><a name="nwfelemsRulesProtoMAC">MAC (Ethernet)</a></h5>
<p> <p>
Protocol ID: <code>mac</code> Protocol ID: <code>mac</code>
<br> <br/>
Note: Rules of this type should go into the <code>root</code> chain. Note: Rules of this type should go into the <code>root</code> chain.
</p> </p>
<table class="top_table"> <table class="top_table">
@ -406,7 +406,7 @@
<h5><a name="nwfelemsRulesProtoARP">ARP/RARP</a></h5> <h5><a name="nwfelemsRulesProtoARP">ARP/RARP</a></h5>
<p> <p>
Protocol ID: <code>arp</code> or <code>rarp</code> Protocol ID: <code>arp</code> or <code>rarp</code>
<br> <br/>
Note: Rules of this type should either go into the Note: Rules of this type should either go into the
<code>root</code> or <code>arp/rarp</code> chain. <code>root</code> or <code>arp/rarp</code> chain.
</p> </p>
@ -481,7 +481,7 @@
Valid strings for the <code>Opcode</code> field are: Valid strings for the <code>Opcode</code> field are:
Request, Reply, Request_Reverse, Reply_Reverse, DRARP_Request, Request, Reply, Request_Reverse, Reply_Reverse, DRARP_Request,
DRARP_Reply, DRARP_Error, InARP_Request, ARP_NAK DRARP_Reply, DRARP_Error, InARP_Request, ARP_NAK
<br><br> <br/><br/>
</p> </p>
<h5><a name="nwfelemsRulesProtoIP">IPv4</a></h5> <h5><a name="nwfelemsRulesProtoIP">IPv4</a></h5>
@ -570,7 +570,7 @@
<p> <p>
Valid strings for <code>protocol</code> are: Valid strings for <code>protocol</code> are:
tcp, udp, udplite, esp, ah, icmp, igmp, sctp tcp, udp, udplite, esp, ah, icmp, igmp, sctp
<br><br> <br/><br/>
</p> </p>
@ -660,13 +660,13 @@
<p> <p>
Valid strings for <code>protocol</code> are: Valid strings for <code>protocol</code> are:
tcp, udp, udplite, esp, ah, icmpv6, sctp tcp, udp, udplite, esp, ah, icmpv6, sctp
<br><br> <br/><br/>
</p> </p>
<h5><a name="nwfelemsRulesProtoTCP-ipv4">TCP/UDP/SCTP</a></h5> <h5><a name="nwfelemsRulesProtoTCP-ipv4">TCP/UDP/SCTP</a></h5>
<p> <p>
Protocol ID: <code>tcp</code>, <code>udp</code>, <code>sctp</code> Protocol ID: <code>tcp</code>, <code>udp</code>, <code>sctp</code>
<br> <br/>
Note: The chain parameter is ignored for this type of traffic Note: The chain parameter is ignored for this type of traffic
and should either be omitted or set to <code>root</code>. and should either be omitted or set to <code>root</code>.
</p> </p>
@ -753,16 +753,21 @@
<td>STRING</td> <td>STRING</td>
<td>comma separated list of NEW,ESTABLISHED,RELATED,INVALID or NONE</td> <td>comma separated list of NEW,ESTABLISHED,RELATED,INVALID or NONE</td>
</tr> </tr>
<tr>
<td>flags <span class="since">(Since 0.9.1)</span></td>
<td>STRING</td>
<td>TCP-only: format of mask/flags with mask and flags each being a comma separated list of SYN,ACK,URG,PSH,FIN,RST or NONE or ALL</td>
</tr>
</table> </table>
<p> <p>
<br><br> <br/><br/>
</p> </p>
<h5><a name="nwfelemsRulesProtoICMP">ICMP</a></h5> <h5><a name="nwfelemsRulesProtoICMP">ICMP</a></h5>
<p> <p>
Protocol ID: <code>icmp</code> Protocol ID: <code>icmp</code>
<br> <br/>
Note: The chain parameter is ignored for this type of traffic Note: The chain parameter is ignored for this type of traffic
and should either be omitted or set to <code>root</code>. and should either be omitted or set to <code>root</code>.
</p> </p>
@ -855,13 +860,13 @@
</tr> </tr>
</table> </table>
<p> <p>
<br><br> <br/><br/>
</p> </p>
<h5><a name="nwfelemsRulesProtoMisc">IGMP, ESP, AH, UDPLITE, 'ALL'</a></h5> <h5><a name="nwfelemsRulesProtoMisc">IGMP, ESP, AH, UDPLITE, 'ALL'</a></h5>
<p> <p>
Protocol ID: <code>igmp</code>, <code>esp</code>, <code>ah</code>, <code>udplite</code>, <code>all</code> Protocol ID: <code>igmp</code>, <code>esp</code>, <code>ah</code>, <code>udplite</code>, <code>all</code>
<br> <br/>
Note: The chain parameter is ignored for this type of traffic Note: The chain parameter is ignored for this type of traffic
and should either be omitted or set to <code>root</code>. and should either be omitted or set to <code>root</code>.
</p> </p>
@ -944,14 +949,14 @@
</tr> </tr>
</table> </table>
<p> <p>
<br><br> <br/><br/>
</p> </p>
<h5><a name="nwfelemsRulesProtoTCP-ipv6">TCP/UDP/SCTP over IPV6</a></h5> <h5><a name="nwfelemsRulesProtoTCP-ipv6">TCP/UDP/SCTP over IPV6</a></h5>
<p> <p>
Protocol ID: <code>tcp-ipv6</code>, <code>udp-ipv6</code>, <code>sctp-ipv6</code> Protocol ID: <code>tcp-ipv6</code>, <code>udp-ipv6</code>, <code>sctp-ipv6</code>
<br> <br/>
Note: The chain parameter is ignored for this type of traffic Note: The chain parameter is ignored for this type of traffic
and should either be omitted or set to <code>root</code>. and should either be omitted or set to <code>root</code>.
</p> </p>
@ -1038,16 +1043,21 @@
<td>STRING</td> <td>STRING</td>
<td>comma separated list of NEW,ESTABLISHED,RELATED,INVALID or NONE</td> <td>comma separated list of NEW,ESTABLISHED,RELATED,INVALID or NONE</td>
</tr> </tr>
<tr>
<td>flags <span class="since">(Since 0.9.1)</span></td>
<td>STRING</td>
<td>TCP-only: format of mask/flags with mask and flags each being a comma separated list of SYN,ACK,URG,PSH,FIN,RST or NONE or ALL</td>
</tr>
</table> </table>
<p> <p>
<br><br> <br/><br/>
</p> </p>
<h5><a name="nwfelemsRulesProtoICMPv6">ICMPv6</a></h5> <h5><a name="nwfelemsRulesProtoICMPv6">ICMPv6</a></h5>
<p> <p>
Protocol ID: <code>icmpv6</code> Protocol ID: <code>icmpv6</code>
<br> <br/>
Note: The chain parameter is ignored for this type of traffic Note: The chain parameter is ignored for this type of traffic
and should either be omitted or set to <code>root</code>. and should either be omitted or set to <code>root</code>.
</p> </p>
@ -1126,13 +1136,13 @@
</tr> </tr>
</table> </table>
<p> <p>
<br><br> <br/><br/>
</p> </p>
<h5><a name="nwfelemsRulesProtoMiscv6">IGMP, ESP, AH, UDPLITE, 'ALL' over IPv6</a></h5> <h5><a name="nwfelemsRulesProtoMiscv6">IGMP, ESP, AH, UDPLITE, 'ALL' over IPv6</a></h5>
<p> <p>
Protocol ID: <code>igmp-ipv6</code>, <code>esp-ipv6</code>, <code>ah-ipv6</code>, <code>udplite-ipv6</code>, <code>all-ipv6</code> Protocol ID: <code>igmp-ipv6</code>, <code>esp-ipv6</code>, <code>ah-ipv6</code>, <code>udplite-ipv6</code>, <code>all-ipv6</code>
<br> <br/>
Note: The chain parameter is ignored for this type of traffic Note: The chain parameter is ignored for this type of traffic
and should either be omitted or set to <code>root</code>. and should either be omitted or set to <code>root</code>.
</p> </p>
@ -1200,7 +1210,7 @@
</tr> </tr>
</table> </table>
<p> <p>
<br><br> <br/><br/>
</p> </p>
<h3><a name="nwfelemsRulesAdv">Advanced Filter Configuration Topics</a></h3> <h3><a name="nwfelemsRulesAdv">Advanced Filter Configuration Topics</a></h3>
@ -1225,7 +1235,7 @@
port 80 on an attacker site, then the attacker will not be able to port 80 on an attacker site, then the attacker will not be able to
initiate a connection from TCP port 80 back towards the VM. initiate a connection from TCP port 80 back towards the VM.
By default the connection state match that enables connection tracking By default the connection state match that enables connection tracking
and then enforcement of directionality of traffic is turned on. <br> and then enforcement of directionality of traffic is turned on. <br/>
The following shows an example XML fragement where this feature has been The following shows an example XML fragement where this feature has been
turned off for incoming connections to TCP port 12345. turned off for incoming connections to TCP port 12345.
</p> </p>
@ -1275,14 +1285,14 @@
</pre> </pre>
<p> <p>
Note that the rule for the limit has to logically appear Note that the rule for the limit has to logically appear
before the rule for accepting the traffic.<br> before the rule for accepting the traffic.<br/>
An additional rule for letting DNS traffic to port 22 An additional rule for letting DNS traffic to port 22
go out the VM has been added to avoid ssh sessions not go out the VM has been added to avoid ssh sessions not
getting established for reasons related to DNS lookup failures getting established for reasons related to DNS lookup failures
by the ssh daemon. Leaving this rule out may otherwise lead to by the ssh daemon. Leaving this rule out may otherwise lead to
fun-filled debugging joy (symptom: ssh client seems to hang fun-filled debugging joy (symptom: ssh client seems to hang
while trying to connect). while trying to connect).
<br><br> <br/><br/>
Lot of care must be taken with timeouts related Lot of care must be taken with timeouts related
to tracking of traffic. An ICMP ping that to tracking of traffic. An ICMP ping that
the user may have terminated inside the VM may have a long the user may have terminated inside the VM may have a long
@ -1297,7 +1307,7 @@
<p> <p>
sets the ICMP connection tracking timeout to 3 seconds. The sets the ICMP connection tracking timeout to 3 seconds. The
effect of this is that once one ping is terminated, another effect of this is that once one ping is terminated, another
one can start after 3 seconds.<br> one can start after 3 seconds.<br/>
Further, we want to point out that a client that for whatever Further, we want to point out that a client that for whatever
reason has not properly closed a TCP connection may cause a reason has not properly closed a TCP connection may cause a
connection to be held open for a longer period of time, connection to be held open for a longer period of time,
@ -1321,7 +1331,7 @@
with life-cycle support for network filters. All commands related with life-cycle support for network filters. All commands related
to the network filtering subsystem start with the prefix to the network filtering subsystem start with the prefix
<code>nwfilter</code>. The following commands are available: <code>nwfilter</code>. The following commands are available:
<p> </p>
<ul> <ul>
<li>nwfilter-list : list UUIDs and names of all network filters</li> <li>nwfilter-list : list UUIDs and names of all network filters</li>
<li>nwfilter-define : define a new network filter or update an existing one</li> <li>nwfilter-define : define a new network filter or update an existing one</li>
@ -1396,7 +1406,7 @@
the protocols very well that you want to be filtering on so that the protocols very well that you want to be filtering on so that
no further traffic than what you want can pass and that in fact the no further traffic than what you want can pass and that in fact the
traffic you want to allow does pass. traffic you want to allow does pass.
<br><br> <br/><br/>
The network filtering subsystem is currently only available on The network filtering subsystem is currently only available on
Linux hosts and only works for Qemu and KVM type of virtual machines. Linux hosts and only works for Qemu and KVM type of virtual machines.
On Linux On Linux
@ -1410,19 +1420,19 @@
<li>arp, rarp</li> <li>arp, rarp</li>
<li>ip</li> <li>ip</li>
<li>ipv6</li> <li>ipv6</li>
</uL> </ul>
<p> <p>
All other protocols over IPv4 are supported using iptables, those over All other protocols over IPv4 are supported using iptables, those over
IPv6 are implemented using ip6tables. IPv6 are implemented using ip6tables.
<br><br> <br/><br/>
On a Linux host, all traffic filtering instantiated by libvirt's network On a Linux host, all traffic filtering instantiated by libvirt's network
filter subsystem first passes through the filtering support implemented filter subsystem first passes through the filtering support implemented
by ebtables and only then through iptables or ip6tables filters. If by ebtables and only then through iptables or ip6tables filters. If
a filter tree has rules with the protocols <code>mac</code>, a filter tree has rules with the protocols <code>mac</code>,
<code>arp</code>, <code>rarp</code>, <code>ip</code>, or <code>ipv6</code> <code>arp</code>, <code>rarp</code>, <code>ip</code>, or <code>ipv6</code>
ebtables rules will automatically be instantiated. ebtables rules will automatically be instantiated.
<br> <br/>
The role of the <code>chain</code> attribute in the network filter The role of the <code>chain</code> attribute in the network filter
XML is that internally a new user-defined ebtables table is created XML is that internally a new user-defined ebtables table is created
that then for example receives all <code>arp</code> traffic coming that then for example receives all <code>arp</code> traffic coming
@ -1433,7 +1443,7 @@
placed into filters specifying this chain. This type of branching placed into filters specifying this chain. This type of branching
into user-defined tables is only supported with filtering on the ebtables into user-defined tables is only supported with filtering on the ebtables
layer. layer.
<br> <br/>
As an example, it is As an example, it is
possible to filter on UDP traffic by source and destination ports using possible to filter on UDP traffic by source and destination ports using
the <code>ip</code> protocol filter and specifying attributes for the the <code>ip</code> protocol filter and specifying attributes for the
@ -1465,7 +1475,7 @@
The requirement to prevent spoofing is fulfilled by the existing The requirement to prevent spoofing is fulfilled by the existing
<code>clean-traffic</code> network filter, thus we will reference this <code>clean-traffic</code> network filter, thus we will reference this
filter from our custom filter. filter from our custom filter.
<br> <br/>
To enable traffic for TCP ports 22 and 80 we will add 2 rules to To enable traffic for TCP ports 22 and 80 we will add 2 rules to
enable this type of traffic. To allow the VM to send ping traffic enable this type of traffic. To allow the VM to send ping traffic
we will add a rule for ICMP traffic. For simplicity reasons we will add a rule for ICMP traffic. For simplicity reasons
@ -1521,7 +1531,7 @@
per-interface basis and the rules are evaluated based on the knowledge per-interface basis and the rules are evaluated based on the knowledge
about which (tap) interface has sent or will receive the packet rather about which (tap) interface has sent or will receive the packet rather
than what their source or destination IP address may be. than what their source or destination IP address may be.
<br><br> <br/><br/>
An XML fragment for a possible network interface description inside An XML fragment for a possible network interface description inside
the domain XML of the <code>test</code> VM could then look like this: the domain XML of the <code>test</code> VM could then look like this:
</p> </p>
@ -1566,7 +1576,7 @@
<li>allows the VM to send ping traffic from an interface <li>allows the VM to send ping traffic from an interface
but not let the VM be pinged on the interface</li> but not let the VM be pinged on the interface</li>
<li>allows the VM to do DNS lookups (UDP towards port 53)</li> <li>allows the VM to do DNS lookups (UDP towards port 53)</li>
<li>enable an ftp server (in active mode) to be run inside the VM <li>enable an ftp server (in active mode) to be run inside the VM</li>
</ul> </ul>
<p> <p>
The additional requirement of allowing an ftp server to be run inside The additional requirement of allowing an ftp server to be run inside
@ -1575,7 +1585,7 @@
outgoing tcp connection originating from the VM's TCP port 20 back to outgoing tcp connection originating from the VM's TCP port 20 back to
the ftp client (ftp active mode). There are several ways of how this the ftp client (ftp active mode). There are several ways of how this
filter can be written and we present 2 solutions. filter can be written and we present 2 solutions.
<br><br> <br/><br/>
The 1st solution makes use of the <code>state</code> attribute of The 1st solution makes use of the <code>state</code> attribute of
the TCP protocol that gives us a hook into the connection tracking the TCP protocol that gives us a hook into the connection tracking
framework of the Linux host. For the VM-initiated ftp data connection framework of the Linux host. For the VM-initiated ftp data connection
@ -1750,13 +1760,13 @@
to be using. to be using.
Different IP addresses in use by multiple interfaces of a VM Different IP addresses in use by multiple interfaces of a VM
(one IP address each) will be independently detected. (one IP address each) will be independently detected.
<br><br> <br/><br/>
Once a VM's IP address has been detected, its IP network traffic Once a VM's IP address has been detected, its IP network traffic
may be locked to that address, if for example IP address spoofing may be locked to that address, if for example IP address spoofing
is prevented by one of its filters. In that case the user of the VM is prevented by one of its filters. In that case the user of the VM
will not be able to change the IP address on the interface inside will not be able to change the IP address on the interface inside
the VM, which would be considered IP address spoofing. the VM, which would be considered IP address spoofing.
<br><br> <br/><br/>
In case a VM is resumed after suspension or migrated, IP address In case a VM is resumed after suspension or migrated, IP address
detection will be restarted. detection will be restarted.
</p> </p>
@ -1774,7 +1784,7 @@
outside the scope of libvirt to ensure that referenced filters outside the scope of libvirt to ensure that referenced filters
on the source system are equivalent to those on the target system on the source system are equivalent to those on the target system
and vice versa. and vice versa.
<br><br> <br/><br/>
Migration must occur between libvirt insallations of version Migration must occur between libvirt insallations of version
0.8.1 or later in order not to lose the network traffic filters 0.8.1 or later in order not to lose the network traffic filters
associated with an interface. associated with an interface.

View File

@ -30,7 +30,7 @@
by the particular volume format and driver, automatically generate a by the particular volume format and driver, automatically generate a
secret value at the time of volume creation, and store it using the secret value at the time of volume creation, and store it using the
specified <code>uuid</code>. specified <code>uuid</code>.
<p> </p>
<h3><a name="StorageEncryptionDefault">"default" format</a></h3> <h3><a name="StorageEncryptionDefault">"default" format</a></h3>
<p> <p>
<code>&lt;encryption type="default"/&gt;</code> can be specified only <code>&lt;encryption type="default"/&gt;</code> can be specified only

View File

@ -16,20 +16,35 @@
<p class="image"> <p class="image">
<img alt="Hypervisor and domains running on a node" src="node.gif"/> <img alt="Hypervisor and domains running on a node" src="node.gif"/>
</p> </p>
<p>Now we can define the goal of libvirt: to provide a common generic <p>Now we can define the goal of libvirt: <b> to provide a common and
and stable layer to securely manage domains on a node. The node may be stable layer sufficient to securely manage domains on a node, possibly
distant and libvirt should provide all APIs needed to provision, create, remote</b>.</p>
modify, monitor, control, migrate and stop the domains, within the limits <p> As a result, libvirt should provide all APIs needed to do the
of the support of the hypervisor for those operations. Multiple nodes may management, such as: provision, create, modify, monitor, control, migrate
be accessed with libvirt simultaneously but the APIs are limited to and stop the domains - within the limits of the support of the hypervisor
single node operations.</p> for those operations.
Not all hypervisors provide the same operations; but if an operation is
useful for domain management of even one specific hypervisor it is worth
providing in libvirt.
Multiple nodes
may be accessed with libvirt simultaneously, but the APIs are limited to
single node operations. Node resource operations which are needed
for the management and provisioning of domains are also in the scope of
the libvirt API, such as interface setup, firewall rules, storage management
and general provisioning APIs. Libvirt will also provide the state
monitoring APIs needed to implement management policies, obviously
checking domain state but also exposing local node resource consumption.
</p>
<p>This implies the following sub-goals:</p> <p>This implies the following sub-goals:</p>
<ul> <ul>
<li>the API should not be targeted to a single virtualization environment <li>All API can be carried remotely though secure APIs</li>
which also means that some very specific capabilities which are not generic <li>While most API will be generic in term of hypervisor or Host OS,
enough may not be provided as libvirt APIs</li> some API may be targeted to a single virtualization environment
as long as the semantic for the operations from a domain management
perspective is clear</li>
<li>the API should allow to do efficiently and cleanly all the operations <li>the API should allow to do efficiently and cleanly all the operations
needed to manage domains on a node</li> needed to manage domains on a node, including resource provisioning and
setup</li>
<li>the API will not try to provide high level virtualization policies or <li>the API will not try to provide high level virtualization policies or
multi-nodes management features like load balancing, but the API should be multi-nodes management features like load balancing, but the API should be
sufficient so they can be implemented on top of libvirt</li> sufficient so they can be implemented on top of libvirt</li>

View File

@ -101,6 +101,32 @@
(libvirt-c-mode)))) (libvirt-c-mode))))
</pre> </pre>
<p>
If you use vim, append the following to your ~/.vimrc file:
</p>
<pre>
set nocompatible
filetype on
set autoindent
set smartindent
set cindent
set tabstop=8
set shiftwidth=4
set expandtab
set cinoptions=(0,:0,l1,t0
filetype plugin indent on
au FileType make setlocal noexpandtab
au BufRead,BufNewFile *.am setlocal noexpandtab
match ErrorMsg /\s\+$\| \+\ze\t/
</pre>
<p>
Or if you don't want to mess your ~/.vimrc up, you can save the above
into a file called .lvimrc (not .vimrc) located at the root of libvirt
source, then install a vim script from
http://www.vim.org/scripts/script.php?script_id=1408,
which will load the .lvimrc only when you edit libvirt code.
</p>
<h2><a name="formatting">Code formatting (especially for new code)</a></h2> <h2><a name="formatting">Code formatting (especially for new code)</a></h2>
<p> <p>
@ -126,6 +152,16 @@
anyhow. anyhow.
</p> </p>
<p>
Libvirt requires a C99 compiler for various reasons. However,
most of the code base prefers to stick to C89 syntax unless
there is a compelling reason otherwise. For example, it is
preferable to use <code>/* */</code> comments rather
than <code>//</code>. Also, when declaring local variables, the
prevailing style has been to declare them at the beginning of a
scope, rather than immediately before use.
</p>
<h2><a name="curly_braces">Curly braces</a></h2> <h2><a name="curly_braces">Curly braces</a></h2>
@ -209,11 +245,13 @@
<p> <p>
However, there is one exception in the other direction, when even a However, there is one exception in the other direction, when even a
one-line block should have braces. That occurs when that one-line, one-line block should have braces. That occurs when that one-line,
brace-less block is an <code>else</code> block, and the corresponding brace-less block is an <code>if</code> or <code>else</code>
<code>then</code> block <b>does</b> use braces. In that case, either block, and the counterpart block <b>does</b> use braces. In
put braces around the <code>else</code> block, or negate the that case, put braces around both blocks. Also, if
<code>if</code>-condition and swap the bodies, putting the the <code>else</code> block is much shorter than
one-line block first and making the longer, multi-line block be the the <code>if</code> block, consider negating the
<code>if</code>-condition and swapping the bodies, putting the
short block first and making the longer, multi-line block be the
<code>else</code> block. <code>else</code> block.
</p> </p>
@ -223,19 +261,11 @@
... ...
} }
else else
x = y; // BAD: braceless "else" with braced "then" x = y; // BAD: braceless "else" with braced "then",
</pre> // and short block last
<p> if (expr)
This is preferred, especially when the multi-line body is more than a x = y; // BAD: braceless "if" with braced "else"
few lines long, because it is easier to read and grasp the semantics of
an if-then-else block when the simpler block occurs first, rather than
after the more involved block:
</p>
<pre>
if (!expr)
x = y; // putting the smaller block first is more readable
else { else {
... ...
... ...
@ -243,11 +273,29 @@
</pre> </pre>
<p> <p>
If you'd rather not negate the condition, then at least add braces: Keeping braces consistent and putting the short block first is
preferred, especially when the multi-line body is more than a
few lines long, because it is easier to read and grasp the semantics of
an if-then-else block when the simpler block occurs first, rather than
after the more involved block:
</p> </p>
<pre> <pre>
if (expr) { if (!expr) {
x = y; // putting the smaller block first is more readable
} else {
...
...
}
</pre>
<p>
But if negating a complex condition is too ugly, then at least
add braces:
</p>
<pre>
if (complex expr not worth negating) {
... ...
... ...
} else { } else {

View File

@ -100,11 +100,26 @@
<h5><a name="qemu">/etc/libvirt/hooks/qemu</a></h5> <h5><a name="qemu">/etc/libvirt/hooks/qemu</a></h5>
<ul> <ul>
<li>When a QEMU guest is started, the qemu hook script is called as:<br/> <li>Before a QEMU guest is started, the qemu hook script is
<pre>/etc/libvirt/hooks/qemu guest_name start begin -</pre></li> called in two locations; if either location fails, the guest
is not started. The first location, <span class="since">since
0.9.0</span>, is before libvirt performs any resource
labeling, and the hook can allocate resources not managed by
libvirt such as DRBD or missing bridges. This is called as:<br/>
<pre>/etc/libvirt/hooks/qemu guest_name prepare begin -</pre>
The second location, available <span class="since">Since
0.8.0</span>, occurs after libvirt has finished labeling
all resources, but has not yet started the guest, called as:<br/>
<pre>/etc/libvirt/hooks/qemu guest_name start begin -</pre></li>
<li>When a QEMU guest is stopped, the qemu hook script is called <li>When a QEMU guest is stopped, the qemu hook script is called
as:<br/> in two locations, to match the startup.
<pre>/etc/libvirt/hooks/qemu guest_name stopped end -</pre></li> First, <span class="since">since 0.8.0</span>, the hook is
called before libvirt restores any labels:<br/>
<pre>/etc/libvirt/hooks/qemu guest_name stopped end -</pre>
Then, after libvirt has released all resources, the hook is
called again, <span class="since">since 0.9.0</span>, to allow
any additional resource cleanup:<br/>
<pre>/etc/libvirt/hooks/qemu guest_name release end -</pre></li>
</ul> </ul>
<h5><a name="lxc">/etc/libvirt/hooks/lxc</a></h5> <h5><a name="lxc">/etc/libvirt/hooks/lxc</a></h5>

View File

@ -8,7 +8,8 @@
<ul> <ul>
<li> <li>
A toolkit to interact with the virtualization capabilities A toolkit to interact with the virtualization capabilities
of recent versions of Linux (and other OSes). of recent versions of Linux (and other OSes), see our
<a href="goals.html">project goals</a> for details.
</li> </li>
<li> <li>
Free software available under the Free software available under the
@ -38,10 +39,10 @@
on Linux and Solaris hosts. on Linux and Solaris hosts.
</li> </li>
<li> <li>
The <a href="http://bellard.org/qemu/">QEMU</a> emulator The <a href="http://wiki.qemu.org/Index.html">QEMU</a> emulator
</li> </li>
<li> <li>
The <a href="http://kvm.qumranet.com/kvmwiki">KVM</a> Linux hypervisor The <a href="http://www.linux-kvm.org/">KVM</a> Linux hypervisor
</li> </li>
<li> <li>
The <a href="http://lxc.sourceforge.net/">LXC</a> Linux container system The <a href="http://lxc.sourceforge.net/">LXC</a> Linux container system

File diff suppressed because it is too large Load Diff

View File

@ -9,11 +9,11 @@
</p> </p>
<ul> <ul>
<li>Introduction to basic rules and guidelines for <a href="hacking.html">hacking<a> <li>Introduction to basic rules and guidelines for <a href="hacking.html">hacking</a>
on libvirt code</li> on libvirt code</li>
<li>Guide to adding <a href="api_extension.html">public APIs<a></li> <li>Guide to adding <a href="api_extension.html">public APIs</a></li>
<li>Approach for <a href="internals/command.html">spawning commands</a> from <li>Approach for <a href="internals/command.html">spawning commands</a> from
libvirt driver code</li> libvirt driver code</li>
</ul> </ul>
</body> </body>

View File

@ -20,27 +20,27 @@
<ul> <ul>
<li><code>fork+exec</code>: The lowest &amp; most flexible <li><code>fork+exec</code>: The lowest &amp; most flexible
level, but very hard to use correctly / safely. It level, but very hard to use correctly / safely. It
is easy to leak file descriptors, have unexpected is easy to leak file descriptors, have unexpected
signal handler behaviour and not handle edge cases. signal handler behaviour and not handle edge cases.
Furthermore, it is not portable to mingw. Furthermore, it is not portable to mingw.
</li> </li>
<li><code>system</code>: Convenient if you don't care <li><code>system</code>: Convenient if you don't care
about capturing command output, but has the serious about capturing command output, but has the serious
downside that the command string is interpreted by downside that the command string is interpreted by
the shell. This makes it very dangerous to use, because the shell. This makes it very dangerous to use, because
improperly validated user input can lead to exploits improperly validated user input can lead to exploits
via shell meta characters. via shell meta characters.
</li> </li>
<li><code>popen</code>: Inherits the flaws of <li><code>popen</code>: Inherits the flaws of
<code>system</code>, and has no option for bi-directional <code>system</code>, and has no option for bi-directional
communication. communication.
</li> </li>
<li><code>posix_spawn</code>: A half-way house between <li><code>posix_spawn</code>: A half-way house between
simplicity of system() and the flexibility of fork+exec. simplicity of system() and the flexibility of fork+exec.
It does not allow for a couple of important features It does not allow for a couple of important features
though, such as running a hook between the fork+exec though, such as running a hook between the fork+exec
stage, or closing all open file descriptors.</li> stage, or closing all open file descriptors.</li>
</ul> </ul>
<p> <p>

View File

@ -6,17 +6,37 @@
this complements the <a href="errors.html">error handling</a> this complements the <a href="errors.html">error handling</a>
mechanism and APIs to allow tracing through the execution of the mechanism and APIs to allow tracing through the execution of the
library as well as in the libvirtd daemon.</p> library as well as in the libvirtd daemon.</p>
<ul>
<li>
<a href="#log_library">Logging in the library</a>
</li>
<li>
<a href="#log_config">Configuring logging in the library</a>
</li>
<li>
<a href="#log_daemon">Logging in the daemon</a>
</li>
<li>
<a href="#log_syntax">Syntax for filters and output values</a>
</li>
<li>
<a href="#log_examples">Examples</a>
</li>
</ul>
<h3>
<a name="log_library">Logging in the library</a>
</h3>
<p>The logging functionalities in libvirt are based on 3 key concepts, <p>The logging functionalities in libvirt are based on 3 key concepts,
similar to the one present in other generic logging facilities like similar to the one present in other generic logging facilities like
log4j:</p> log4j:</p>
<ul> <ul>
<li>log messages: they are information generated at runtime by <li><b>log messages</b>: they are information generated at runtime by
the libvirt code. Each message includes a priority level (DEBUG = 1, the libvirt code. Each message includes a priority level (DEBUG = 1,
INFO = 2, WARNING = 3, ERROR = 4), a category, function name and INFO = 2, WARNING = 3, ERROR = 4), a category, function name and
line number, indicating where it originated from, and finally line number, indicating where it originated from, and finally
a formatted message. In addition the library adds a timestamp a formatted message. In addition the library adds a timestamp
at the begining of the message</li> at the beginning of the message</li>
<li>log filters: a set of patterns and priorities to accept <li><b>log filters</b>: a set of patterns and priorities to accept
or reject a log message. If the message category matches a filter, or reject a log message. If the message category matches a filter,
the message priority is compared to the filter priority, if lower the message priority is compared to the filter priority, if lower
the message is discarded, if higher the message is output. If the message is discarded, if higher the message is output. If
@ -24,12 +44,22 @@
all remaining messages. This allows, for example, capturing all all remaining messages. This allows, for example, capturing all
debug messages for the QEmu driver, but otherwise only allowing debug messages for the QEmu driver, but otherwise only allowing
errors to show up from other parts.</li> errors to show up from other parts.</li>
<li>log outputs: once a message has gone through filtering a set of <li><b>log outputs</b>: once a message has gone through filtering a set of
output defines where to send the message, they can also filter output defines where to send the message, they can also filter
based on the priority, for example it may be useful to output based on the priority, for example it may be useful to output
all messages to a debugging file but only allow errors to be all messages to a debugging file but only allow errors to be
logged through syslog.</li> logged through syslog.</li>
</ul> </ul>
<p>Note that the logging module saves all logs to a <b>debug buffer</b>
filled in a round-robin fashion as to keep a full log of the
recent logs including all debug. The debug buffer can be resized
or deactivated in the daemon using the log_buffer_size variable,
default is 64 kB. This can be used when debugging the library
(see the virLogBuffer variable content).</p>
<h3>
<a name="log_config">Configuring logging in the library</a>
</h3>
<p>The library configuration of logging is through 3 environment variables <p>The library configuration of logging is through 3 environment variables
allowing to control the logging behaviour:</p> allowing to control the logging behaviour:</p>
<ul> <ul>
@ -48,8 +78,11 @@
you specify an invalid value, it will be ignored with a warning. If you you specify an invalid value, it will be ignored with a warning. If you
have an error in a filter or output string, some of the settings may be have an error in a filter or output string, some of the settings may be
applied up to the point at which libvirt encountered the error.</p> applied up to the point at which libvirt encountered the error.</p>
<h3>
<a name="log_daemon">Logging in the daemon</a>
</h3>
<p>Similarly the daemon logging behaviour can be tuned using 3 config <p>Similarly the daemon logging behaviour can be tuned using 3 config
variables, stored in the configuration file: variables, stored in the configuration file:</p>
<ul> <ul>
<li>log_level: accepts the following values: <li>log_level: accepts the following values:
<ul> <ul>
@ -64,12 +97,21 @@
<p>When starting the libvirt daemon, any logging environment variable <p>When starting the libvirt daemon, any logging environment variable
settings will override settings in the config file. Command line options settings will override settings in the config file. Command line options
take precedence over all. If no outputs are defined for libvirtd, it take precedence over all. If no outputs are defined for libvirtd, it
defaults to logging to syslog when it is running as a daemon, or to defaults to logging to /var/log/libvirt/libvirtd.log (before 0.9.0
it was using syslog) when it is running as a daemon, or to
stderr when it is running in the foreground.</p> stderr when it is running in the foreground.</p>
<p>Libvirtd does not reload its logging configuration when issued a SIGHUP. <p>Libvirtd does not reload its logging configuration when issued a SIGHUP.
If you want to reload the configuration, you must do a <code>service If you want to reload the configuration, you must do a <code>service
libvirtd restart</code> or manually stop and restart the daemon libvirtd restart</code> or manually stop and restart the daemon
yourself.</p> yourself.</p>
<p>Starting from 0.9.0, the daemon can save all the content of the debug
buffer to the defined error channels (or /var/log/libvirt/libvirtd.log
by default) in case of crash, this can also be activated explicitly
for debugging purposes by sending the daemon a USR2 signal:</p>
<pre>killall -USR2 libvirtd</pre>
<h3>
<a name="log_syntax">Syntax for filters and output values</a>
</h3>
<p>The syntax for filters and outputs is the same for both types of <p>The syntax for filters and outputs is the same for both types of
variables.</p> variables.</p>
<p>The format for a filter is:</p> <p>The format for a filter is:</p>
@ -86,7 +128,7 @@
<p>Multiple filters can be defined in a single string, they just need to be <p>Multiple filters can be defined in a single string, they just need to be
separated by spaces, e.g: <code>"3:remote 4:event"</code> to only get separated by spaces, e.g: <code>"3:remote 4:event"</code> to only get
warning or errors from the remote layer and only errors from the event warning or errors from the remote layer and only errors from the event
layer.<p> layer.</p>
<p>If you specify a log priority in a filter that is below the default log <p>If you specify a log priority in a filter that is below the default log
priority level, messages that match that filter will still be logged, priority level, messages that match that filter will still be logged,
while others will not. In order to see those messages, you must also have while others will not. In order to see those messages, you must also have
@ -109,8 +151,11 @@
<p>Multiple output can be defined, they just need to be separated by <p>Multiple output can be defined, they just need to be separated by
spaces, e.g.: <code>"3:syslog:libvirtd 1:file:/tmp/libvirt.log"</code> spaces, e.g.: <code>"3:syslog:libvirtd 1:file:/tmp/libvirt.log"</code>
will log all warnings and errors to syslog under the libvirtd ident will log all warnings and errors to syslog under the libvirtd ident
but also log everything debugging and informations included in the but also log all debug and information included in the
file <code>/tmp/libvirt.log</code></p> file <code>/tmp/libvirt.log</code></p>
<h3>
<a name="log_examples">Examples</a>
</h3>
<p>For example setting up the following:</p> <p>For example setting up the following:</p>
<pre>export LIBVIRT_DEBUG=1 <pre>export LIBVIRT_DEBUG=1
export LIBVIRT_LOG_OUTPUTS="1:file:virsh.log"</pre> export LIBVIRT_LOG_OUTPUTS="1:file:virsh.log"</pre>
@ -123,5 +168,16 @@ export LIBVIRT_LOG_OUTPUTS="1:file:virsh.log"</pre>
message. This should be sufficient to at least get a precise idea of message. This should be sufficient to at least get a precise idea of
what is happening and where things are going wrong, allowing to then what is happening and where things are going wrong, allowing to then
put the correct breakpoints when running under a debugger.</p> put the correct breakpoints when running under a debugger.</p>
<p>To activate full debug of the libvirt entry points, utility
functions and the QEmu/KVM driver, set:</p>
<pre>log_filters=1:libvirt 1:util 1:qemu
log_output=1:file:/var/log/libvirt/libvirtd.log</pre>
<p>in libvirtd.conf and restart the daemon will allow to
gather a copious amount of debugging traces for the operations done
in those areas.</p>
<p>On the other hand to deactivate the logbuffer in the daemon
for stable high load servers, set</p>
<pre>log_buffer_size=0</pre>
<p>in the libvirtd.conf.</p>
</body> </body>
</html> </html>

View File

@ -8,6 +8,865 @@
<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 <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> and check the <a href="http://libvirt.org/git/?p=libvirt.git;a=log">GIT log</a> to gauge progress.</p>
<h3>0.9.1: May 5 2011</h3>
<ul>
<li> Features:<br/>
support various persistent domain updates (KAMEZAWA Hiroyuki),<br/>
improvements on memory APIs (Taku Izumi),<br/>
Add virDomainEventRebootNew (Matthias Bolte),<br/>
various improvements to libxl driver (Markus Groß),<br/>
Spice: support audio, images and stream compression (Michal Privoznik)<br/>
</li>
<li> Documentation:<br/>
fix missing VLAN id for Qbg example (Gerhard Stenzel),<br/>
docs: Document filesystem tag device (Cole Robinson),<br/>
maint: fix comment typos (Eric Blake),<br/>
Fix two out-of-date comments in LVM backend (Richard Laager),<br/>
docs: Serial and parallel device target ports actually start from 0 (Matthias Bolte),<br/>
maint: fix grammar errors (Eric Blake),<br/>
docs: document freecell --all (Eric Blake),<br/>
docs: remove "returns" word from beginning of lines (Jean-Baptiste Rouault),<br/>
docs: add an IPv6 address to network XML examples (Laine Stump)<br/>
</li>
<li> Portability:<br/>
build: fix getcwd portability problems (Eric Blake),<br/>
build: avoid test warnings on mingw (Eric Blake),<br/>
virsh: avoid compiler warning on mingw (Eric Blake),<br/>
build: Use pkg-config for libssh2 check (Jiri Denemark),<br/>
build: Ignore old audit library (Jiri Denemark),<br/>
build: fix 32-bit test failure (Eric Blake),<br/>
build: Fix problem of building Python bindings (Osier Yang),<br/>
build: fix 32-bit test failure (Eric Blake),<br/>
ppc: Enable starting of Qemu VMs on ppc host (Stefan Berger),<br/>
Migrate VMs between different-endianess hosts (Stefan Berger),<br/>
build: really fix mingw startup (Eric Blake),<br/>
build: fix mingw build (Eric Blake),<br/>
do not build libvirt_iohelper when building without libvirtd (Wen Congyang),<br/>
virsh: fix mingw startup (Eric Blake),<br/>
build: avoid compiler warning on cygwin (Eric Blake),<br/>
Fix build for older gcc (Jim Fehlig),<br/>
Don't try to enable stack protector on Win32 (Daniel P. Berrange)<br/>
</li>
<li> Bug Fixes:<br/>
storage: avoid null deref and leak on failure (Eric Blake),<br/>
esx: Avoid null dereference on error in esxDomainGetInfo (Matthias Bolte),<br/>
remote: avoid null dereference on error (Eric Blake),<br/>
cgroup: avoid leaking a file (Eric Blake),<br/>
virsh: avoid null pointer dereference (Eric Blake),<br/>
pci: fix null pointer dereference (Eric Blake),<br/>
qemu: avoid null pointer dereference (Eric Blake),<br/>
tests: avoid null pointer dereference (Eric Blake),<br/>
Fix disability to run on systems with no PCI bus (Michal Privoznik),<br/>
virsh: fix regression in log to file (Supriya Kannery),<br/>
nwfilter: Fix memory leak in the ebtables subdriver (Matthias Bolte),<br/>
qemu: Fix qemuDomainModifyDeviceFlags leaking the caps bitmap (Matthias Bolte),<br/>
Fix memory leak in __virExec (Matthias Bolte),<br/>
hash: fix memory leak regression (Eric Blake),<br/>
Xen: Do not generate net ifname if domain is inactive (Jim Fehlig),<br/>
xen: check if device is assigned to guest before reattaching (Yufang Zhang),<br/>
util: Initialize hooks at daemon shutdown if no hooks defined (Osier Yang),<br/>
fix virsh's regression (Wen Congyang),<br/>
release PCI address only when we have ensured it successfully (Wen Congyang),<br/>
free memory properly in cleanup patch (Hu Tao),<br/>
free buf content when vsnprintf() failed (Wen Congyang),<br/>
esx: Fix dynamic dispatch for CastFromAnyType functions (Matthias Bolte),<br/>
Make crash and live flags mutually exclusive in virDomainCoreDump (Mark Wu),<br/>
Fix small memory leaks in config parsing related functions (Matthias Bolte),<br/>
daemon: Don't try to free an unsigned int in error paths (Matthias Bolte),<br/>
Fix QEMU tunnelled migration FD handling (Daniel P. Berrange),<br/>
Remove artificial minimum limit for guest memory (Jiri Denemark),<br/>
fix tunnelled migration's regression (Wen Congyang),<br/>
qemu: fix the check of virDomainObjUnref()'s return value (Wen Congyang),<br/>
Fix checking of return codes in dispatcher (Daniel P. Berrange),<br/>
qemu: avoid qemu_driver being unlocked twice when virThreadPoolNew() failed (Wen Congyang),<br/>
virsh: fix regression in parsing optional integer (Eric Blake),<br/>
phyp: avoid memory leaks in command values (Eric Blake),<br/>
phyp: avoid memory leak on failure (Eric Blake),<br/>
phyp: avoid a logic bug (Eric Blake),<br/>
free cpumask of vcpupinDef (Hu Tao),<br/>
network: Fix NULL dereference during error recovery (Michal Privoznik),<br/>
Add missing checks for QEMU domain state in tunables APIs (Daniel P. Berrange),<br/>
phyp: Fix too small buffer allocation in phypAttachDevice (Matthias Bolte),<br/>
phyp: Don't overwrite error from virDomainDeviceDefParse by OOM error (Matthias Bolte),<br/>
phyp: Don't try to use a string from a failed virAsprintf (Matthias Bolte),<br/>
phyp: Remove stack allocating a 4kb volume key and fix related memory leaks (Matthias Bolte),<br/>
qemu: fix a dead-lock problem (Hu Tao),<br/>
util: Fix crash when removing entries during hash iteration (Jiri Denemark),<br/>
Fix possible infinite loop in remote driver (Michal Privoznik),<br/>
qemu: Remove the managed state file only if restoring succeeded (Osier Yang),<br/>
reattach pci devices when qemuPrepareHostdevPCIDevices() failed (Wen Congyang),<br/>
reattach pci device when pciBindDeviceToStub() failed (Wen Congyang),<br/>
remove devices from driver activePciHostdevs when qemuPrepareHostdevPCIDevices() failed (Wen Congyang),<br/>
pci: avoid invalid free, init path to NULL (Wen Congyang),<br/>
qemu: Support for overriding NPROC limit (Jiri Denemark),<br/>
qemu: Always reserves slot 0x02 for primary VGA. (Osier Yang),<br/>
Fix typo in systemtap tapset directory name (Daniel P. Berrange),<br/>
qemu: Ignore unusable binaries (Jiri Denemark)<br/>
</li>
<li> Improvements:<br/>
maint: detect clang 2.9 (Eric Blake),<br/>
qemu: update qemuCgroupControllerActive signature (Eric Blake),<br/>
lxc: report correct error (Eric Blake),<br/>
libxl: avoid compiler warning (Eric Blake),<br/>
storage: use virCommand to avoid compiler warning (Eric Blake),<br/>
tests: Lower stack usage below 4096 bytes (Matthias Bolte),<br/>
tests: Update valgrind suppressions file (Matthias Bolte),<br/>
tests: simplify common setup (Eric Blake),<br/>
network: fix return value of hostsFileWrite (Laine Stump),<br/>
libvirt/qemu - support persistent attach/detach disks (KAMEZAWA Hiroyuki),<br/>
libvirt/qemu - support persistent modification of devices (KAMEZAWA Hiroyuki),<br/>
util: Simplify hash implementation (Jiri Denemark),<br/>
tests: More unit tests for internal hash APIs (Jiri Denemark),<br/>
Move call to virReportOOMError into virFileBuildPath (Matthias Bolte),<br/>
build: use gnulib passfd for simpler SCM_RIGHTS code (Eric Blake),<br/>
qemu: Add flags checking in DomainCoreDump (Jiri Denemark),<br/>
Make sure DNSMASQ_STATE_DIR exists (Guido Günther),<br/>
build: make VIR_FREE do some type checking (Eric Blake),<br/>
threads: add one-time initialization support (Eric Blake),<br/>
esx: Add a wrapper for shared CURL handles (Matthias Bolte),<br/>
esx: Move CURL handling code to it's own type (Matthias Bolte),<br/>
daemon: Honor error variable name change in the generator (Matthias Bolte),<br/>
libvirt/qemu - clean up UpdateDevice for consolidation. (KAMEZAWA Hiroyuki),<br/>
libvirt/qemu - clean up At(De)tachDeviceFlags() for consolidation. (KAMEZAWA Hiroyuki),<br/>
libvirt/qemu - Centralize device modification in the more flexible APIs (KAMEZAWA Hiroyuki),<br/>
Add support for s390(x) cpu options parsing (Michal Privoznik),<br/>
PHYP: Adding reboot domain function (Eduardo Otubo),<br/>
nwfilter: no support for direct type of interface (Stefan Berger),<br/>
Add cputune support to libxl driver (Markus Groß),<br/>
Update and sort msg_gen_function list and mark unmarked messages (Matthias Bolte),<br/>
Write error check conditionals in more compact form for dispatcher (Daniel P. Berrange),<br/>
Merge all returns paths from dispatcher into single path (Daniel P. Berrange),<br/>
Experimental libvirtd upstart job (Alan Pevec),<br/>
enhance processWatchdogEvent() (Wen Congyang),<br/>
xen: Replace statsErrorFunc with a macro (Matthias Bolte),<br/>
tests: Unit tests for internal hash APIs (Jiri Denemark),<br/>
build: include esx_vi.generated.* into dist file (Wen Congyang),<br/>
tests: test recent virsh option parsing changes (Eric Blake),<br/>
virsh: list required options first (Eric Blake),<br/>
phyp: use consistent return string handling (Eric Blake),<br/>
maint: use lighter-weight function for straight appends (Eric Blake),<br/>
libvirt-guests: implement START_DELAY (Alexander Todorov),<br/>
network: truncate bridges' dummy tap device names to IFNAMSIZ (15) chars (Laine Stump),<br/>
Introduce virDomainChrDefNew() (Michal Novotny),<br/>
esx: Make the parsed URI part of the private connection data (Matthias Bolte),<br/>
esx: Mark error message in macros for translation (Matthias Bolte),<br/>
esx: Extend VI generator to cover managed object types (Matthias Bolte),<br/>
esx: Cleanup and refactor CastFromAnyType macros (Matthias Bolte),<br/>
esx: Cleanup VI generator code (Matthias Bolte),<br/>
phyp: Reduce code duplication in error and success paths (Matthias Bolte),<br/>
Replace REMOTE_DEBUG with VIR_DEBUG in daemon dispatcher (Daniel P. Berrange),<br/>
Add missing checks for whether the connection is open in dispatcher (Daniel P. Berrange),<br/>
PHYP: Adding network interface (Eduardo Otubo),<br/>
xen: Remove PATH_MAX sized stack allocation from block stats code (Matthias Bolte),<br/>
setmaxmem: add the new options to "virsh setmaxmem" command (Taku Izumi),<br/>
maxmem: implement virDomainSetMaxMemory API of the qemu driver (Taku Izumi),<br/>
maxmem: introduces VIR_DOMAIN_MEM_MAXIMUM flag (Taku Izumi),<br/>
nwfilters: support for TCP flags evaluation (Stefan Berger),<br/>
setmem: add --current option to virsh setmem command (Taku Izumi),<br/>
setmem: add VIR_DOMAIN_MEM_CURRENT support to qemu (Taku Izumi),<br/>
setmem: introduce VIR_DOMAIN_MEM_CURRENT flag (Taku Izumi),<br/>
build: Install libxenlight log dir (Jim Fehlig),<br/>
Add domainSet/GetSchedulerParameters to libxl driver (Markus Groß),<br/>
rename pciUnBindDeviceFromStub() to pciUnbindDeviceFromStub() and float it up (Wen Congyang),<br/>
Add domainIsUpdated to libxl driver (Markus Groß),<br/>
Change locking for udev monitor and callbacks (Serge Hallyn),<br/>
Improve SCSI volume key generation (Daniel P. Berrange),<br/>
qemu: Rewrite LOOKUP_PTYS macro into a function (Jiri Denemark),<br/>
Enable use of -Wold-style-definition compiler flag (Daniel P. Berrange),<br/>
Enable use of -Wmissing-noreturn (Daniel P. Berrange),<br/>
Enable -Wmissing-format-attribute warning (Daniel P. Berrange),<br/>
Use gnulib's manywarnings and warnings modules (Daniel P. Berrange),<br/>
Use virBufferPtr for sexpr2string instead of manual buffer handling (Matthias Bolte),<br/>
xend: Remove 4kb stack allocation (Matthias Bolte),<br/>
uml: Remove PATH_MAX sized stack allocation from /proc parsing code (Matthias Bolte),<br/>
storage: Remove PATH_MAX sized stack allocation from iSCSI backend (Matthias Bolte),<br/>
qemu: Remove PATH_MAX sized stack allocation used in commandline building (Matthias Bolte),<br/>
Remove PATH_MAX sized stack allocation from virFileOpenTtyAt (Matthias Bolte),<br/>
openvz: Remove several larger stack allocations (Matthias Bolte),<br/>
daemon: Remove 4kb stack allocation of security label (Matthias Bolte),<br/>
virsh: Remove two 4kb stack allocations (Matthias Bolte),<br/>
Use virFileAbsPath instead of manually creating the absolute path (Matthias Bolte),<br/>
xenxs: Remove PATH_MAX sized stack allocation in XM script parsing (Matthias Bolte),<br/>
sasl: Remove stack allocated 8kb temporary buffers (Matthias Bolte),<br/>
qemu: Use heap allocated memory to read the monitor greeting (Matthias Bolte),<br/>
phyp: Remove 16kb stack allocation (Matthias Bolte),<br/>
virt-aa-helper: Remove PATH_MAX sized stack allocations (Matthias Bolte),<br/>
ebtables: Remove PATH_MAX sized stack allocation (Matthias Bolte),<br/>
pci: Remove PATH_MAX sized stack allocations (Matthias Bolte),<br/>
Remove PATH_MAX sized stack allocations related to virFileBuildPath (Matthias Bolte),<br/>
vmx: Use case-insensitive compare functions for all content (Matthias Bolte),<br/>
vmx: Support persistent CPU shares (Matthias Bolte),<br/>
Add autostart support to libxl driver (Markus Groß),<br/>
Allow relative path for qemu backing file (Jesse Cook),<br/>
build: detect potentential uninitialized variables (Eric Blake)<br/>
</li>
<li> Cleanups:<br/>
esx: Disable performance counter queries in esxDomainGetInfo (Matthias Bolte),<br/>
esx: Remove dead store in esxUtil_ParseDatastorePath (Matthias Bolte),<br/>
util: remove dead assignment (Eric Blake),<br/>
qemu: remove dead assignment (Eric Blake),<br/>
qemu: silence clang false positives (Eric Blake),<br/>
tests: suppress more valgrind situations (Eric Blake),<br/>
tests: avoid compiler warning (Eric Blake),<br/>
qemu: fix uninitialized variable warning (Christophe Fergeau),<br/>
build: fix syntax-check failure (Eric Blake),<br/>
virsh: nuke use of TRUE and FALSE (Eric Blake),<br/>
phyp: another simplification (Eric Blake),<br/>
maint: ignore built file (Eric Blake),<br/>
Change some variable names to follow standard in daemon dispatcher (Daniel P. Berrange),<br/>
Remove curly braces on all single-line conditional jumps in dispatcher (Daniel P. Berrange),<br/>
Remove virConnectPtr from virRaiseErrorFull (Matthias Bolte),<br/>
phyp: prefer memcpy over memmove when legal (Eric Blake),<br/>
phyp: use consistent style for labels (Eric Blake),<br/>
phyp: more return handling cleanup (Eric Blake),<br/>
esx: Fix gcc 4.6 warning about initialized but unused variables (Matthias Bolte),<br/>
maint: silence cppi warnings (Eric Blake),<br/>
Fix gcc 4.6 warnings in vbox_tmpl.c (Christophe Fergeau),<br/>
Fix gcc 4.6 warnings (Christophe Fergeau),<br/>
Remove C99 variable declare in PHYP network driver (Daniel P. Berrange),<br/>
Standard on error variable name in libvirtd dispatcher (Daniel P. Berrange),<br/>
Remove all whitespace before function brackets in daemon dispatcher (Daniel P. Berrange),<br/>
docs: tweak virsh restore warning (Eric Blake),<br/>
setmaxmem: remove the code to invoke virDomainSetMemory in cmdSetmaxmem (Taku Izumi),<br/>
build: fix gitignore sorting (Eric Blake),<br/>
tests: fix recent test failures (Eric Blake),<br/>
libxl: avoid compiler warning (Eric Blake),<br/>
Avoid compiler warnings about int to void * casts (Daniel P. Berrange),<br/>
Remove acinclude.m4 file (Daniel P. Berrange),<br/>
Remove possible uninitialized variable in openvz driver (Daniel P. Berrange)<br/>
</li>
</ul>
<h3>0.9.0: Apr 4 2011</h3>
<ul>
<li> Features:<br/>
Support cputune cpu usage tuning (Osier Yang and Nikunj A. Dadhania),<br/>
Add public APIs for storage volume upload/download (Daniel P. Berrange),<br/>
Add public API for setting migration speed on the fly (Daniel P. Berrange),<br/>
Add libxenlight driver (Jim Fehlig and Markus Groß),<br/>
qemu: support migration to fd (Eric Blake),<br/>
libvirt: add virDomain{Get,Set}BlkioParameters (Gui Jianfeng),<br/>
setmem: introduce a new libvirt API (virDomainSetMemoryFlags) (Taku Izumi),<br/>
Expose event loop implementation as a public API (Daniel P. Berrange),<br/>
Dump the debug buffer to libvirtd.log on fatal signal (Daniel Veillard),<br/>
Audit support (Eric Blake)<br/>
</li>
<li> Documentation:<br/>
fix typo (Eric Blake),<br/>
correct invalid xml (Eric Blake),<br/>
virsh: Fix documentation for memtune command (Jiri Denemark),<br/>
Fix several formatting mistakes in doc (Michal Privoznik),<br/>
mention C89 syntax preferences (Eric Blake),<br/>
document recent hook additions (Eric Blake),<br/>
Update on the goal page (Daniel Veillard),<br/>
Document first release with spice and qxl (Cole Robinson),<br/>
Add schema definition for imagelabel (Osier Yang),<br/>
update virGetVersion description (Tiziano Mueller),<br/>
Improve logging documentation including the debug buffer (Daniel Veillard),<br/>
update windows page for initial libvirt 0.8.8 installer (Justin Clift),<br/>
formatdomain.html.in: Fix spelling PIC-&gt;PCI (Philipp Hahn),<br/>
fix missing &lt;p&gt; (Eric Blake),<br/>
documenting the 802.1Qbg parameters of a 'direct' interface (Gerhard Stenzel),<br/>
silence warnings about generated API docs (Eric Blake),<br/>
document &lt;driver name='vhost'/&gt; for interfaces (Eric Blake),<br/>
correct range of default NAT subnet (Eric Blake),<br/>
formatdomain: Add release info for disk &lt;driver&gt; attributes (Cole Robinson),<br/>
Fix spelling mistake: seek (Philipp Hahn),<br/>
maint: fix grammar in error message (Eric Blake)<br/>
</li>
<li> Portability:<br/>
virsh: fix mingw failure on creating nonblocking pipe (Eric Blake),<br/>
Remove iohelper on Win32 since it is not required (Daniel P. Berrange),<br/>
Fix domain events C example on Win32 (Daniel P. Berrange),<br/>
build: fix compilation on mingw (Eric Blake),<br/>
util: use SCM_RIGHTS in virFileOperation when needed (Eric Blake),<br/>
Don't use INT64_MAX in libvirt.h because it requires stdint.h (Matthias Bolte),<br/>
libvirtd: Remove indirect linking (Guido Günther),<br/>
build: avoid compiler warning on cygwin (Eric Blake),<br/>
build: fix build on cygwin (Eric Blake),<br/>
build: fix building error when building without libvirtd (Wen Congyang),<br/>
virsh: Remove indirect link against libxml2 (Guido Günther),<br/>
Fix build on cygwin (Daniel Veillard),<br/>
Add check for kill() to fix build of cgroups on win32 (Daniel P. Berrange),<br/>
build: fix broken mingw cross-compilation (Eric Blake)<br/>
</li>
<li> Bug fixes:<br/>
fix memory leak in qemuProcessHandleGraphics() (Wen Congyang),<br/>
do not lock vm while allocating memory (Wen Congyang),<br/>
Fix libxl driver startup (Daniel Veillard),<br/>
qemu: Ignore libvirt debug messages in qemu log (Jiri Denemark),<br/>
qemu: Fix improper logic of qemuCgroupSetup (Osier Yang),<br/>
free tmp after unlinking it (Wen Congyang),<br/>
qemu: Fix media eject with qemu-0.12.* (Jiri Denemark),<br/>
check whether qemuMonitorJSONHMP() failed (Wen Congyang),<br/>
do not send monitor command after monitor meet error (Wen Congyang),<br/>
qemu: unlock qemu driver before return from domain save (Hu Tao),<br/>
qemu: fix regression with fd labeling on migration (Eric Blake),<br/>
Ignore return value of virDomainObjUnref (Markus Groß),<br/>
Fix infinite loop in daemon if client quits with multiple streams open (Daniel P. Berrange),<br/>
qemu: fix regression that hangs on save failure (Eric Blake),<br/>
qemu: fix restoring a compressed save image (Eric Blake),<br/>
util: allow clearing cloexec bit (Eric Blake),<br/>
logging: always NUL-terminate circular buffer (Eric Blake),<br/>
tests: don't alter state in $HOME (Eric Blake),<br/>
qemu: don't restore state label twice (Eric Blake),<br/>
Fix syntax error in configure.ac (Osier Yang),<br/>
remote: Don't leak gnutls session on negotiation error (Matthias Bolte),<br/>
hooks: fix regression in previous patch (Eric Blake),<br/>
Add missing { for qemudDomainInterfaceStats (Philipp Hahn),<br/>
daemon: Avoid resetting errors before they are reported (Jiri Denemark),<br/>
fix the check of the output of monitor command 'device_add' (Wen Congyang),<br/>
Make error reporting in libvirtd thread safe (Jiri Denemark),<br/>
update domain status forcibly even if attach a device failed (Wen Congyang),<br/>
util: Fix return value for virJSONValueFromString if it fails (Osier Yang),<br/>
Initialization error of qemuCgroupData in Qemu host usb hotplug (Wen Congyang),<br/>
build: fix missing initializer (Eric Blake),<br/>
Fix uninitialized variable &amp; error reporting in LXC veth setup (Daniel P. Berrange),<br/>
udev: fix regression with qemu:///session (Eric Blake),<br/>
logging: fix off-by-one bug (Eric Blake),<br/>
do not report OOM error when prepareCall() failed (Wen Congyang),<br/>
Don't return an error on failure to create blkio controller (Hu Tao),<br/>
qemu: respect locking rules (Eric Blake),<br/>
openvz: fix a simple bug in openvzListDefinedDomains() (Jean-Baptiste Rouault),<br/>
Fix delayed event delivery when SASL is active (Daniel P. Berrange),<br/>
qemu: Fix copy&amp;paste error messages in text monitor (Jiri Denemark),<br/>
do not unref obj in qemuDomainObjExitMonitor* (Wen Congyang),<br/>
qemu: check driver name while attaching disk (Wen Congyang),<br/>
remote: Add missing virCondDestroy calls (Matthias Bolte),<br/>
build: improve rpm generation for distro backports (Eric Blake),<br/>
storage: Fix a problem which will cause libvirtd crashed (Osier Yang),<br/>
Fix misc bugs in virCommandPtr (Daniel P. Berrange),<br/>
libvirt: fix a simple bug in virDomainSetMemoryFlags() (Taku Izumi),<br/>
qemu: Check the unsigned integer overflow (Osier Yang),<br/>
audit: eliminate potential null pointer deref when auditing macvtap devices (Laine Stump),<br/>
network driver: don't send default route to clients on isolated networks (Laine Stump),<br/>
virsh: Free stream when shutdown console (Osier Yang),<br/>
Add missing checks for read only connections (Guido Günther),<br/>
qemu: fix -global argument usage (Eric Blake),<br/>
Make sure we reset the umask on the error path (Guido Günther),<br/>
qemu: Stop guest CPUs before creating a snapshot (Jiri Denemark),<br/>
qemu: Escape snapshot name passed to {save,load,del}vm (Jiri Denemark),<br/>
qemu: Fix warnings in event handlers (Jiri Denemark),<br/>
storage: Update qemu-img flag checking (Osier Yang),<br/>
Make sure the rundir is accessible by the user (Guido Günther),<br/>
Fix a wrong error message thrown to user (Hu Tao),<br/>
unlock eventLoop before calling callback function (Wen Congyang),<br/>
fixes for several memory leaks (Phil Petty),<br/>
Fix a counter bug in the log buffer (Daniel Veillard),<br/>
qemu: avoid corruption of domain hashtable and misuse of freed domains (Laine Stump),<br/>
qemu: Add missing lock of virDomainObj before calling virDomainUnref (Laine Stump),<br/>
esx: Escape password for XML (Matthias Bolte),<br/>
util: correct retry path in virFileOperation (Eric Blake),<br/>
util: Allow removing hash entries in virHashForEach (Jiri Denemark),<br/>
qemu: avoid double close on domain restore (Eric Blake),<br/>
Fix port value parsing for serial and parallel ports (Michal Novotny),<br/>
Fix off-by-1 in virFileAbsPath. (Daniel P. Berrange),<br/>
security: avoid memory leak (Eric Blake),<br/>
protect the scsi controller to be deleted when it is in use (Wen Congyang),<br/>
virsh: freecell --all getting wrong NUMA nodes count (Michal Privoznik),<br/>
remove duplicated call to reportOOMError (Christophe Fergeau)<br/>
</li>
<li> Improvements:<br/>
Make check_fc_host() and check_vport_capable() usable as rvalues (Guido Günther),<br/>
maint: avoid locale-sensitivity in string case comparisons (Eric Blake),<br/>
extend logging to record configuration-related changes (Naoya Horiguchi),<br/>
Add libvirt_iohelper to spec file (Daniel Veillard),<br/>
cputune: New tests for cputune XML (Osier Yang),<br/>
cputune: Support cputune for xend driver (Osier Yang),<br/>
cputune: Support cputune for lxc driver (Osier Yang),<br/>
cputune: Support cputune for qemu driver (Osier Yang),<br/>
cputune: Implementations of parsing and formating cputune xml (Osier Yang),<br/>
cputune: Add data structures presenting cputune XML (Osier Yang),<br/>
cputune: Add document for cputune XML (Osier Yang),<br/>
cputune: Add XML schema for cputune xml (Osier Yang),<br/>
qemu: improve error message on failed fd transfer (Eric Blake),<br/>
maint: ignore new built file (Eric Blake),<br/>
Add domainSuspend/Resume to libxl driver (Markus Groß),<br/>
Add domainGetOSType to libxl driver (Markus Groß),<br/>
Add domainGetSchedulerType to libxl driver (Markus Groß),<br/>
Implements domainXMLTo/FromNative in libxl driver (Markus Groß),<br/>
Add vcpu functions to libxl driver (Markus Groß),<br/>
List authors in copyright headers (Markus Groß),<br/>
Add event callbacks to libxl driver (Markus Groß),<br/>
Remote protocol support for storage vol upload/download APIs (Daniel P. Berrange),<br/>
Support volume data upload/download APIs in storage driver (Daniel P. Berrange),<br/>
Add vol-upload and vol-download commands to virsh (Daniel P. Berrange),<br/>
Enhance the streams helper to support plain file I/O (Daniel P. Berrange),<br/>
Update event loop example programs to demonstrate best practice (Daniel P. Berrange),<br/>
qemu: support fd: migration with compression (Eric Blake),<br/>
qemu: skip granting access during fd migration (Eric Blake),<br/>
qemu: consolidate migration to file code (Eric Blake),<br/>
qemu: use common API for reading difficult files (Eric Blake),<br/>
qemu, storage: improve type safety (Eric Blake),<br/>
util: adjust indentation in previous patch (Eric Blake),<br/>
util: rename virFileOperation to virFileOpenAs (Eric Blake),<br/>
storage: simplify fd handling (Eric Blake),<br/>
qemu: simplify domain save fd handling (Eric Blake),<br/>
qemu: allow simple domain save to use fd: protocol (Eric Blake),<br/>
Update of localisations, switch to transifex (Daniel Veillard),<br/>
build: shorten libxenlight summary for consistent alignment (Eric Blake),<br/>
command: add virCommandAbort for cleanup paths (Eric Blake),<br/>
command: don't mix RunAsync and daemons (Eric Blake),<br/>
command: properly diagnose process exit via signal (Eric Blake),<br/>
Add memory functions to libxl driver (Markus Groß),<br/>
build: enforce reference count checking (Eric Blake),<br/>
maint: prohibit access(,X_OK) (Eric Blake),<br/>
Get cpu time and current memory balloon from libxl (Markus Groß),<br/>
build: nuke all .x-sc* files, and fix VPATH syntax-check (Eric Blake),<br/>
command: reject pidfile on non-daemon (Eric Blake),<br/>
rpm: add missing dependencies (Eric Blake),<br/>
rpm: separate runtime and build requirements (Eric Blake),<br/>
qemu: simplify monitor callbacks (Eric Blake),<br/>
8021Qbh: use preassociate-rr during the migration prepare stage (Roopa Prabhu),<br/>
Wire up virDomainMigrateSetSpeed into QEMU driver (Daniel P. Berrange),<br/>
Wire up virDomainMigrateSetSpeed for the remote RPC driver (Daniel P. Berrange),<br/>
maint: update authors (Eric Blake),<br/>
Disable libxl build in RPM on Fedora &lt; 16 (Daniel P. Berrange),<br/>
qemu: fallback to HMP drive_add/drive_del (Hu Tao),<br/>
qemu: Only use HMP passthrough if it is supported (Jiri Denemark),<br/>
qemu: Detect support for HMP passthrough (Jiri Denemark),<br/>
qemu: add two hook script events "prepare" and "release" (Thibault Vincent),<br/>
qemu: simplify interface fd handling in monitor (Eric Blake),<br/>
qemu: simplify PCI configfd handling in monitor (Eric Blake),<br/>
qemu: simplify monitor fd error handling (Eric Blake),<br/>
util: guarantee sane errno in virFileIsExecutable (Eric Blake),<br/>
Don't build libxenlight driver for Xen 4.0 (Jim Fehlig),<br/>
network driver: log error and abort network startup when radvd isn't found (Laine Stump),<br/>
build: translate changes in previous patch (Eric Blake),<br/>
Ensure binary is resolved wrt $PATH in virExec (Daniel P. Berrange),<br/>
util: Forbid calling hash APIs from iterator callback (Jiri Denemark),<br/>
Avoid taking lock in libvirt debug dump (Daniel Veillard),<br/>
unlock the monitor when unwatching the monitor (Wen Congyang),<br/>
Add vim configuration that makes vim auto-indent code (Hu Tao),<br/>
virsh: fix memtune's help message for swap_hard_limit (Nikunj A. Dadhania),<br/>
Add PCI sysfs reset access (Alex Williamson),<br/>
Support Xen sysctl v8, domctl v7 (Jim Fehlig),<br/>
macvtap: log an error if on failure to connect to netlink socket (Laine Stump),<br/>
qemu: improve efficiency of dd during snapshots (Eric Blake),<br/>
virsh: allow empty string arguments (Eric Blake),<br/>
qemu: Fallback to HMP when cpu_set QMP command is not found (Wen Congyang),<br/>
Change message for VIR_FROM_RPC error domain (Daniel P. Berrange),<br/>
Add compat function for geteuid() (Daniel P. Berrange),<br/>
Add virSetBlocking() to allow O_NONBLOCK to be toggle on or off (Daniel P. Berrange),<br/>
qemu: use more appropriate error (Eric Blake),<br/>
Make LXC container startup/shutdown/I/O more robust (Daniel P. Berrange),<br/>
Allow to dynamically set the size of the debug buffer (Daniel Veillard),<br/>
qemu: consolidate duplicated monitor migration code (Eric Blake),<br/>
qemu: use lighter-weight fd:n on incoming tunneled migration (Eric Blake),<br/>
Fix performance problem of virStorageVolCreateXMLFrom() (Minoru Usui),<br/>
libvirt-guests: avoid globbing when splitting $URIS (Eric Blake),<br/>
libvirt-guest.init: quoting variables (Philipp Hahn),<br/>
virsh: Insert error messages to avoid a quiet abortion of commands (Michal Privoznik),<br/>
python: Use hardcoded python path in libvirt.py (Jiri Denemark),<br/>
virsh: Allow starting domains by UUID (Jiri Denemark),<br/>
network driver: Use a separate dhcp leases file for each network (Laine Stump),<br/>
network driver: Start dnsmasq even if no dhcp ranges/hosts are specified. (Laine Stump),<br/>
libvirt-guest.init: handle domain name with spaces (Philipp Hahn),<br/>
domain.rng vs. formatdomain.html#elementsUSB (Philipp Hahn),<br/>
Ignore backing file errors in FS storage pool (Philipp Hahn),<br/>
remote-protocol: implement new BlkioParameters API (Gui Jianfeng),<br/>
virsh: Adding blkiotune command to virsh tool (Gui Jianfeng),<br/>
qemu: implement new BlkioParameters API (Gui Jianfeng),<br/>
libvirt: implements virDomain{Get,Set}BlkioParameters (Gui Jianfeng),<br/>
setmem: add the new options to "virsh setmem" command (Taku Izumi),<br/>
setmem: implement the remote protocol to address the new API (Taku Izumi),<br/>
setmem: implement the code to address the new API in the qemu driver (Taku Izumi),<br/>
audit: audit use of /dev/net/tun, /dev/tapN, /dev/vhost-net (Eric Blake),<br/>
qemu: don't request cgroup ACL access for /dev/net/tun (Eric Blake),<br/>
qemu: support vhost in attach-interface (Eric Blake),<br/>
qemu: Refactor qemuDomainSnapshotCreateXML (Jiri Denemark),<br/>
qemu: Fallback to HMP for snapshot commands (Jiri Denemark),<br/>
qemu: Setup infrastructure for HMP passthrough (Jiri Denemark),<br/>
qemu: Replace deprecated option of qemu-img (Osier Yang),<br/>
audit: also audit cgroup ACL permissions (Eric Blake),<br/>
cgroup: allow fine-tuning of device ACL permissions (Eric Blake),<br/>
audit: rename remaining qemu audit functions (Eric Blake),<br/>
audit: also audit cgroup controller path (Eric Blake),<br/>
audit: split cgroup audit types to allow more information (Eric Blake),<br/>
audit: tweak audit messages to match conventions (Eric Blake),<br/>
Don't overwrite virRun error messages (Cole Robinson),<br/>
virsh: Change option parsing functions to return tri-state information (Michal Privoznik),<br/>
virsh: change vshCommandOptString return type and fix const-correctness (Michal Privoznik),<br/>
support to detach USB disk (Wen Congyang),<br/>
rename qemuDomainDetachSCSIDiskDevice to qemuDomainDetachDiskDevice (Wen Congyang),<br/>
qemu_hotplug: Reword error if spice password change not available (Cole Robinson),<br/>
Move event code out of the daemon/ into src/util/ (Daniel P. Berrange),<br/>
Convert daemon/virsh over to use primary event APIs, rather than impl (Daniel P. Berrange),<br/>
Cleaning up some of the logging code (Daniel Veillard),<br/>
qemu: Support vram for video of qxl type (Osier Yang),<br/>
Add an an internal API for emergency dump of debug buffer (Daniel Veillard),<br/>
Add logrotate support for libvirtd.log (Daniel Veillard),<br/>
Change default log policy to libvirtd.log instead of syslog (Daniel Veillard),<br/>
Force all logs to go to the round robbin memory buffer (Daniel Veillard),<br/>
AUTHORS: adjust to preferred spelling (KAMEZAWA Hiroyuki),<br/>
Pass virSecurityManagerPtr to virSecurityDAC{Set, Restore}ChardevCallback (Soren Hansen),<br/>
maint: update to latest gnulib (Eric Blake),<br/>
Attempt to improve an error message (Daniel P. Berrange),<br/>
add additional event debug points (Daniel P. Berrange),<br/>
qemu: only request sound cgroup ACL when required (Eric Blake),<br/>
Add support for multiple serial ports into the Xen driver (Michal Novotny),<br/>
Add APIs for killing off processes inside a cgroup (Daniel P. Berrange),<br/>
Allow hash tables to use generic pointers as keys (Daniel P. Berrange),<br/>
Remove deallocator parameter from hash functions (Daniel P. Berrange),<br/>
Make commandtest more robust wrt its execution environment (Daniel P. Berrange),<br/>
audit: audit qemu pci and usb device passthrough (Eric Blake),<br/>
audit: audit qemu memory and vcpu adjusments (Eric Blake),<br/>
audit: add qemu hooks for auditing cgroup events (Eric Blake),<br/>
audit: prepare qemu for listing vm in cgroup audits (Eric Blake),<br/>
cgroup: determine when skipping non-devices (Eric Blake),<br/>
virExec: avoid uninitialized memory usage (Eric Blake),<br/>
Allow 32-on-64 execution for LXC guests (Daniel P. Berrange),<br/>
Put &lt;stdbool.h&gt; into internal.h so it is available everywhere (Daniel P. Berrange),<br/>
qemu: Switch over command line capabilities to virBitmap (Jiri Denemark),<br/>
qemu: Rename qemud\?CmdFlags to qemuCaps (Jiri Denemark),<br/>
qemu: Use helper functions for handling cmd line capabilities (Jiri Denemark),<br/>
qemu: Rename QEMUD_CMD_FLAG_* to QEMU_CAPS_* (Jiri Denemark),<br/>
util: Add API for converting virBitmap into printable string (Jiri Denemark),<br/>
util: Use unsigned long as a base type for virBitmap (Jiri Denemark),<br/>
Expose name + UUID to LXC containers via env variables (Daniel P. Berrange),<br/>
Fix discard of expected errors (Daniel P. Berrange),<br/>
Fix group/mode for /dev/pts inside LXC container (Daniel P. Berrange),<br/>
802.1Qbh: Delay IFF_UP'ing interface until migration final stage (Roopa Prabhu),<br/>
storage: make debug log more useful (Osier Yang),<br/>
virsh: replace vshPrint with vshPrintExtra for snapshot list Otherwise extra information will be printed even if "--quiet" is specified. (Osier Yang),<br/>
check device-mapper when building with mpath or disk storage driver (Wen Congyang),<br/>
build: add dependency on gnutls-utils (Eric Blake),<br/>
Renamed functions in xenxs (Markus Groß),<br/>
Moved XM formatting functions to xenxs (Markus Groß),<br/>
Moved XM parsing functions to xenxs (Markus Groß),<br/>
Moved SEXPR formatting functions to xenxs (Markus Groß),<br/>
Moved SEXPR parsing functions to xenxs (Markus Groß),<br/>
Moved some SEXPR functions from xen-unified (Markus Groß),<br/>
Moved SEXPR unit to utils (Markus Groß),<br/>
virt-*-validate.in: quote all variable references (Dan Kenigsberg),<br/>
virt-pki-validate: behave when CERTTOOL is missing (Dan Kenigsberg),<br/>
autobuild.sh: use VPATH build (Eric Blake),<br/>
maint: fix 'make dist' in VPATH build (Eric Blake),<br/>
build: don't require pod2man for tarball builds (Eric Blake),<br/>
hash: make virHashFree more free-like (Eric Blake),<br/>
build: Fix API docs generation in VPATH build (Jiri Denemark),<br/>
Remove all object hashtable caches from virConnectPtr (Daniel P. Berrange),<br/>
nwfilter: enable rejection of packets (Stefan Berger),<br/>
Drop empty argument from dnsmasq call (Guido Günther),<br/>
esx: Ignore malformed host UUID from BIOS (Matthias Bolte),<br/>
build: speed up non-maintainer builds (Eric Blake),<br/>
build: recompute symbols after changing configure options (Eric Blake),<br/>
Requires gettext for client package (Osier Yang),<br/>
Do not add drive 'boot=on' param when a kernel is specified (Jim Fehlig),<br/>
factor common code in virHashAddEntry and virHashUpdateEntry (Christophe Fergeau),<br/>
add hash table rebalancing in virHashUpdateEntry (Christophe Fergeau),<br/>
hash: modernize debug code (Eric Blake),<br/>
build: improve 'make install' for VPATH builds (Eric Blake),<br/>
check more error info about whether drive_add failed (Wen Congyang),<br/>
logging: make VIR_ERROR and friends preserve errno (Eric Blake),<br/>
maint: avoid 'make syntax-check' from tarball (Eric Blake),<br/>
Give each virtual network bridge its own fixed MAC address (Laine Stump),<br/>
Allow brAddTap to create a tap device that is down (Laine Stump),<br/>
Add txmode attribute to interface XML for virtio backend (Laine Stump),<br/>
Restructure domain struct interface "driver" data for easier expansion (Laine Stump),<br/>
build: Fix VPATH build (Jiri Denemark),<br/>
storage: Allow to delete device mapper disk partition (Osier Yang)<br/>
</li>
<li> Cleanups:<br/>
The next release is 0.9.0 not 0.8.9 (Daniel Veillard),<br/>
maint: use space, not tab, in remote_protocol-structs (Eric Blake),<br/>
Remove the Open Nebula driver (Daniel P. Berrange),<br/>
domain_conf: drop unused ref-count in snapshot object (Eric Blake),<br/>
Update the set of maintainers for the project (Daniel Veillard),<br/>
Make virDomainObjParseNode() static (Hu Tao),<br/>
maint: make spacing in .sh files easier (Eric Blake),<br/>
network driver: Fix indentation from previous commit (Laine Stump),<br/>
qemu: Rename qemuMonitorCommandWithHandler as qemuMonitorText* (Jiri Denemark),<br/>
qemu: Rename qemuMonitorCommand{,WithFd} as qemuMonitorHMP* (Jiri Denemark),<br/>
maint: avoid long lines in more tests (Eric Blake),<br/>
maint: kill all remaining uses of old DEBUG macro (Eric Blake),<br/>
maint: Expand tabs in python code (Jiri Denemark),<br/>
remove space between function name and ( (Christophe Fergeau),<br/>
don't check for NULL before calling virHashFree (Christophe Fergeau),<br/>
remove no longer needed calls to virReportOOMError (Christophe Fergeau),<br/>
Move all the QEMU migration code to a new file (Daniel P. Berrange),<br/>
Split all QEMU process mangement code into separate file (Daniel P. Berrange)<br/>
</li>
</ul>
<h3>0.8.8: Feb 17 2011</h3>
<ul>
<li>Features:<br/>
sysinfo: expose new API (Eric Blake),<br/>
cgroup blkio weight support. (Gui Jianfeng),<br/>
smartcard device support (Eric Blake),<br/>
qemu: Support per-device boot ordering (Jiri Denemark)<br/>
</li>
<li>Documentation:<br/>
docs: fix typos (Eric Blake),<br/>
docs: added link for nimbus to apps page (Justin Clift),<br/>
Update src/README (Matthias Bolte),<br/>
docs: Add information about libvirt-php new location (Michal Novotny),<br/>
Add libvirt-php information page (Michal Novotny),<br/>
cgroup: Add documentation for blkiotune elements. (Gui Jianfeng),<br/>
docs/index.html.in: update KVM url (Niels de Vos),<br/>
docs/index.html.in: update QEMU url (Alon Levy),<br/>
docs: more on qemu locking patterns (Eric Blake),<br/>
docs: renamed hudson project link to jenkins, matching project rename (Justin Clift),<br/>
docs: Update docs for cpu_shares setting (Osier Yang),<br/>
docs: replace CRLF with LF (Juerg Haefliger),<br/>
docs: Add docs for new extra parameter pkipath (Osier Yang),<br/>
docs: expand the man page text for virsh setmaxmem (Justin Clift),<br/>
docs: fix incorrect XML element mentioned by setmem text (Justin Clift),<br/>
docs: add a link to the bindings page under the downloads menu item (Justin Clift),<br/>
docs: document &lt;controller&gt; element (Eric Blake),<br/>
docs: move the apps page to the top level as its good promo (Justin Clift),<br/>
docs: added new entries to apps page, plus adjusted a few existing (Justin Clift),<br/>
docs: document &lt;sysinfo&gt; and &lt;smbios&gt; elements (Eric Blake),<br/>
datatypes: Fix outdated function names in the documentation (Matthias Bolte),<br/>
Add documentation for VIR_DOMAIN_MEMORY_PARAM_UNLIMITED (Matthias Bolte),<br/>
docs: Move the "Network Filtering" page one level up in the hierarchy (Matthias Bolte),<br/>
docs: add buildbot to the apps page (Justin Clift),<br/>
docs: add new conversion heading to the apps listing (Justin Clift),<br/>
docs: updated windows page for new 0.8.7 installer (Justin Clift),<br/>
docs: clarify virsh setvcpus and setmem usage with active domains (Justin Clift),<br/>
Document HAP domain feature (Jim Fehlig),<br/>
docs: fix trivial typos in currentMemory description (Justin Clift),<br/>
doc: improve the documentation of desturi (Wen Congyang),<br/>
docs: reorder apps page alphabetically, plus add libguestfs entries (Justin Clift),<br/>
docs: add entry for archipel to the apps page (Justin Clift),<br/>
docs: use xml entity encoding for extended character last name (Justin Clift),<br/>
docs: updated memtune info again in virsh command reference (Justin Clift),<br/>
docs: updated release of virsh cmd reference, with memtune info (Justin Clift),<br/>
maint: document dislike of mismatched if/else bracing (Eric Blake),<br/>
docs: added libvirt-announce to contact page (Justin Clift)<br/>
</li>
<li>Portability:<br/>
qemu: ignore failure of qemu -M ? on older qemu (Eric Blake),<br/>
virsh: avoid mingw compiler warnings (Eric Blake),<br/>
build: avoid problems with autogen.sh runs from tarball (Eric Blake),<br/>
build: fix cygwin strerror_r failure (Eric Blake),<br/>
Avoid pthread_sigmask on Win32 platforms (Daniel P. Berrange),<br/>
Fix compilation when building without sasl (Daniel Veillard),<br/>
build: fix parted detection at configure time (Eric Blake),<br/>
Fix setup of lib directory with autogen.sh --system (Daniel P. Berrange),<br/>
build: fix 'make check' with older git (Eric Blake),<br/>
maint: support --no-git option during autogen.sh (Eric Blake),<br/>
libvirt-guests: remove bashisms (Laurent Léonard),<br/>
build: restore mingw build (Eric Blake),<br/>
commandtest: avoid printing loader-control variables from commandhelper (Diego Elio Pettenò)<br/>
</li>
<li>Bug fixes:<br/>
qemu: Error prompt when saving a shutoff domain (Osier Yang),<br/>
cgroup: preserve correct errno on failure (Eric Blake),<br/>
qemu: Fix command line generation with faked host CPU (Jiri Denemark),<br/>
tests: Fake host capabilities properly (Jiri Denemark),<br/>
build: address clang reports about virCommand (Eric Blake),<br/>
qemu: don't mask real error with oom report (Eric Blake),<br/>
qemu: avoid NULL derefs (Eric Blake),<br/>
virDomainMemoryStats: avoid null dereference (Eric Blake),<br/>
Fix leak of mutex attributes in POSIX threads impl (Daniel P. Berrange),<br/>
Fix leak in SCSI storage backend (Daniel P. Berrange),<br/>
storage: Create enough volumes for mpath pool (Osier Yang),<br/>
qemu: avoid NULL deref on error (Eric Blake),<br/>
conf: Fix XML generation for smartcards (Jiri Denemark),<br/>
Fix cleanup on VM state after failed QEMU startup (Daniel P. Berrange),<br/>
libvirt-qemu: Fix enum type declaration (Jiri Denemark),<br/>
xen: Prevent updating device when attaching a device (Osier Yang),<br/>
qemu: Fix escape_monitor(escape_shell(command)) (Philipp Hahn),<br/>
qemu: fix attach-interface regression (Wen Congyang),<br/>
Fix typo in parsing of spice 'auth' data (Michal Privoznik),<br/>
Reset logging filter function when forking (Daniel P. Berrange),<br/>
Block SIGPIPE around virExec hook functions (Daniel P. Berrange),<br/>
Only initialize/cleanup libpciaccess once (Daniel P. Berrange),<br/>
macvtap: fix 2 nla_put expressions (non-serious bug) (Stefan Berger),<br/>
qemu: avoid double shutdown (Eric Blake),<br/>
Fix conflicts with glibc globals (Davidlohr Bueso),<br/>
qemuBuildDeviceAddressStr() checks for QEMUD_CMD_FLAG_PCI_MULTIBUS (Niels de Vos),<br/>
Don't sleep in poll() if there is existing SASL decoded data (Daniel P. Berrange),<br/>
Initialization error of controller in QEmu SCSI hotplug (Wen Congyang),<br/>
esx: Ensure max-memory has 4 megabyte granularity (Matthias Bolte),<br/>
Remove double close of qemu monitor (Daniel P. Berrange),<br/>
Prevent overfilling of self-pipe in python event loop (Daniel P. Berrange),<br/>
avoid vm to be deleted if qemuConnectMonitor failed (Wen Congyang),<br/>
tests: Fix virtio channel tests (Jiri Denemark),<br/>
event: fix event-handling allocation crash (Eric Blake),<br/>
storage: Round up capacity for LVM volume creation (Osier Yang),<br/>
Do not use virtio-serial port 0 for generic ports (David Allan),<br/>
Manually kill gzip if restore fails before starting qemu (Laine Stump),<br/>
Set SELinux context label of pipes used for qemu migration (Laine Stump),<br/>
virsh: require --mac to avoid detach-interface ambiguity (Michal Privoznik),<br/>
dispatch error before return (Wen Congyang),<br/>
event: fix event-handling data race (Eric Blake),<br/>
qemu: Retry JSON monitor cont cmd on MigrationExpected error (Jim Fehlig),<br/>
Fix startup with VNC password expiry on old QEMU (Daniel P. Berrange),<br/>
Fix error reporting when machine type probe fails (Daniel P. Berrange),<br/>
Avoid crash in security driver if model is NULL (Daniel P. Berrange),<br/>
qemu: Fix a possible deadlock in p2p migration (Wen Congyang),<br/>
qemu: Avoid sending STOPPED event twice (Jiri Denemark),<br/>
spec: Start libvirt-guests only if it's on in current runlevel (Jiri Denemark),<br/>
Increase size of driver table to make UML work again (Daniel P. Berrange),<br/>
qemu: don't fail capabilities check on 0.12.x (Eric Blake),<br/>
Fix 'make check' after commit 04197350 (Jim Fehlig),<br/>
esx: Fix memory leak in HostSystem managed object free function (Matthias Bolte),<br/>
qemu: Watchdog IB700 is not a PCI device (RHBZ#667091). (Richard W.M. Jones),<br/>
cpu: plug memory leak (Eric Blake),<br/>
network: plug memory leak (Eric Blake),<br/>
network: plug unininitialized read found by valgrind (Eric Blake),<br/>
remote: Don't lose track of events when callbacks are slow (Cole Robinson),<br/>
conf: Report error if invalid type specified for character device (Osier Yang),<br/>
daemon: Fix core dumps if unix_sock_group is set (Jiri Denemark),<br/>
vbox: Use correct VRAM size unit (Matthias Bolte),<br/>
bridge: Fix generation of dnsmasq's --dhcp-hostsfile option (Kay Schubert),<br/>
qemu: Fix bogus warning about uninitialized saveptr (Jiri Denemark),<br/>
Don't chown qemu saved image back to root after save if dynamic_ownership=0 (Laine Stump)<br/>
</li>
<li>Improvements:<br/>
maint: delete unused 'make install' step (Eric Blake),<br/>
Update czech localization (Zdenek Styblik),<br/>
Avoid empty strings when --with-packager(-version) is not specified (Matthias Bolte),<br/>
Output commandline on status != 0 in virCommandWait (Matthias Bolte),<br/>
add missing error handling to virGetDomain (Christophe Fergeau),<br/>
call virReportOOMError when appropriate in hash.c (Christophe Fergeau),<br/>
xml: avoid compiler warning (Eric Blake),<br/>
nwfilter: reorder match extensions relative to state match (Stefan Berger),<br/>
fix OOM handling in hash routines (Christophe Fergeau),<br/>
docs: Distribute XSLT files to generate HACKING (Matthias Bolte),<br/>
qemu: Report a more informative error for missing cgroup controllers (Matthias Bolte),<br/>
Imprint all logs with version + package build information (Daniel P. Berrange),<br/>
Reduce log level when cgroups aren't mounted (Daniel P. Berrange),<br/>
Avoid warnings from nwfilter driver when run non-root (Daniel P. Berrange),<br/>
build: distribute 'make syntax-check' tweaks (Eric Blake),<br/>
Adjust some log levels in udev driver (Daniel P. Berrange),<br/>
Add check for binary existing in machine type probe (Daniel P. Berrange),<br/>
Add a little more debugging for async events (Daniel P. Berrange),<br/>
Move connection driver modules directory (Daniel P. Berrange),<br/>
Support SCSI RAID type &amp; lower log level for unknown types (Daniel P. Berrange),<br/>
Don't use CLONE_NEWUSER for now (Serge E. Hallyn),<br/>
sysinfo: implement qemu support (Eric Blake),<br/>
sysinfo: refactor xml formatting (Eric Blake),<br/>
sysinfo: implement virsh support (Eric Blake),<br/>
sysinfo: implement the remote protocol (Eric Blake),<br/>
sysinfo: implement the public API (Eric Blake),<br/>
sysinfo: define internal driver API (Eric Blake),<br/>
LXC: LXC Blkio weight configuration support. (Gui Jianfeng),<br/>
qemu: Implement blkio tunable XML configuration and parsing. (Gui Jianfeng),<br/>
cgroup: Update XML Schema for new entries. (Gui Jianfeng),<br/>
cgroup: Implement blkio.weight tuning API. (Gui Jianfeng),<br/>
cgroup: Enable cgroup hierarchy for blkio cgroup (Gui Jianfeng),<br/>
Update Dutch and Polish localizations (Daniel Veillard),<br/>
Vietnamese translations for libvirt (Hero Phương),<br/>
spicevmc: support older -device spicevmc of qemu 0.13.0 (Eric Blake),<br/>
smartcard: add spicevmc support (Eric Blake),<br/>
spicevmc: support new qemu chardev (Daniel P. Berrange),<br/>
smartcard: turn on qemu support (Eric Blake),<br/>
smartcard: enable SELinux support (Eric Blake),<br/>
smartcard: check for qemu capability (Eric Blake),<br/>
smartcard: add domain conf support (Eric Blake),<br/>
smartcard: add XML support for &lt;smartcard&gt; device (Eric Blake),<br/>
qemu: Support booting from hostdev PCI devices (Jiri Denemark),<br/>
Support booting from hostdev devices (Jiri Denemark),<br/>
qemu: Add shortcut for HMP pass through (Jiri Denemark),<br/>
macvtap: fix variable in debugging output (Stefan Berger),<br/>
qemu: Build command line for incoming tunneled migration (Osier Yang),<br/>
bridge_driver: handle DNS over IPv6 (Paweł Krześniak),<br/>
tests: handle backspace-newline pairs in test input files (Juerg Haefliger),<br/>
qemu: More clear error parsing domain def failure of tunneled migration (Osier Yang),<br/>
maint: reject raw close, popen in 'make syntax-check' (Eric Blake),<br/>
build: avoid close, system (Eric Blake),<br/>
Add VIR_DIV_UP to divide memory or storage request sizes with round up (Matthias Bolte),<br/>
qemu: fix augeas support for vnc_auto_unix_socket (Eric Blake),<br/>
virsh: added --all flag to freecell command (Michal Privoznik),<br/>
esx: Don't try to change max-memory of an active domain (Matthias Bolte),<br/>
qemu aio: enable support (Eric Blake),<br/>
qemu aio: parse aio support from qemu -help (Matthias Dahl),<br/>
qemu aio: add XML parsing (Matthias Dahl),<br/>
Remove bogus log warning lines when launching QEMU (Daniel P. Berrange),<br/>
qemu: fix error messages (Eric Blake),<br/>
qemu: Report more accurate error on failure to attach device. (Hu Tao),<br/>
Force guest suspend at timeout (Wen Congyang),<br/>
Show migration progress. (Wen Congyang),<br/>
Cancel migration if user presses Ctrl-C when migration is in progress (Hu Tao),<br/>
qemu: use separate alias for chardev and associated device (Eric Blake),<br/>
remote: Add extra parameter pkipath for URI (Osier Yang),<br/>
Update localization files from Fedora i10n (Daniel Veillard),<br/>
Add check for poll error events in monitor (Daniel P. Berrange),<br/>
Filter out certain expected error messages from libvirtd (Daniel P. Berrange),<br/>
Add a function to the security driver API that sets the label of an open fd. (Laine Stump),<br/>
qemu: Error prompt when managed save a shutoff domain (Osier Yang),<br/>
build: avoid corrupted gnulib/tests/Makefile (Eric Blake),<br/>
qemu: sound: Support intel 'ich6' model (Cole Robinson),<br/>
vmx: Use VIR_ERR_CONFIG_UNSUPPORTED when appropriated (Matthias Bolte),<br/>
Push unapplied fixups for previous patch (Cole Robinson),<br/>
qemu: Add conf option to auto setup VNC unix sockets (Cole Robinson),<br/>
qemu: Allow serving VNC over a unix domain socket (Cole Robinson),<br/>
qemu: Set domain def transient at beginning of startup process (Cole Robinson),<br/>
qemu: report more proper error for unsupported graphics (Osier Yang),<br/>
qemu: Fail if per-device boot is used but deviceboot is not supported (Jiri Denemark),<br/>
Turn libvirt.c error reporting functions into macros (Daniel P. Berrange),<br/>
build: use more gnulib modules for simpler code (Eric Blake),<br/>
Remove two unused PATH_MAX-sized char arrays from the stack (Matthias Bolte),<br/>
Use VIR_ERR_OPERATION_INVALID when appropriated (Matthias Bolte),<br/>
Fix misuse of VIR_ERR_INVALID_* error code (Matthias Bolte),<br/>
Simplify "NWFilterPool" to "NWFilter" (Matthias Bolte),<br/>
datatypes: Get virSecretFreeName in sync with the other free functions (Matthias Bolte),<br/>
qemu: use -incoming fd:n to avoid qemu holding fd indefinitely (Eric Blake),<br/>
tests: Add tests for per-device boot elements (Jiri Denemark),<br/>
Introduce per-device boot element (Jiri Denemark),<br/>
conf: Move boot parsing into a separate function (Jiri Denemark),<br/>
build: let xgettext see strings in libvirt-guests (Eric Blake),<br/>
A couple of fixes for the search PHP code (Daniel Veillard),<br/>
virsh: Use WITH_SECDRIVER_APPARMOR to detect AppArmor support (Matthias Bolte),<br/>
memtune: Let virsh know the unlimited value for memory tunables (Nikunj A. Dadhania),<br/>
maint: improve sc_prohibit_strncmp syntax check (Eric Blake),<br/>
Enable tuning of qemu network tap device "sndbuf" size (Laine Stump),<br/>
Add XML config switch to enable/disable vhost-net support (Laine Stump),<br/>
Use the new set_password monitor command to set password. (Marc-André Lureau),<br/>
qemu: add set_password and expire_password monitor commands (Marc-André Lureau),<br/>
qemu: move monitor device out of domain_conf common code (Eric Blake),<br/>
domain_conf: split source data out from ChrDef (Eric Blake),<br/>
cpu: Add support for Westmere CPU model (Jiri Denemark),<br/>
qemu: improve device flag parsing (Eric Blake),<br/>
util: add missing string-&gt;integer conversion functions (Eric Blake),<br/>
qemu: convert capabilities to use virCommand (Eric Blake),<br/>
virsh: ensure --maximum flag used only with --config for setvcpus (Justin Clift),<br/>
Add HAP to xen hypervisor capabilities (Jim Fehlig),<br/>
Add support for HAP feature to xen drivers (Jim Fehlig),<br/>
Add HAP to virDomainFeature enum (Jim Fehlig),<br/>
tests: virsh is no longer in builddir/src (Eric Blake),<br/>
virFindFileInPath: only find executable non-directory (Eric Blake),<br/>
Fix old PHP syntax in the search online form (Daniel Veillard),<br/>
report error when specifying wrong desturi (Wen Congyang),<br/>
qemu: Reject SDL graphic if it's not supported by qemu (Osier Yang),<br/>
vbox: Silently ignore missing registry key on Windows (Matthias Bolte),<br/>
python: Use PyCapsule API if available (Cole Robinson),<br/>
event-test: Simplify debug on/off (Cole Robinson),<br/>
Refactor the security drivers to simplify usage (Daniel P. Berrange),<br/>
Add AM_MAINTAINER_MODE (Guido Günther),<br/>
esx: Move occurrence check into esxVI_LookupObjectContentByType (Matthias Bolte),<br/>
esx: Add domain autostart support (Matthias Bolte),<br/>
vmx: Add support for video device VRAM size (Matthias Bolte),<br/>
API: Improve log for domain related APIs (Osier Yang),<br/>
schema: tighten &lt;serial&gt;&lt;protocol type=...&gt; relaxNG (Eric Blake),<br/>
Log an error on attempts to add a NAT rule for non-IPv4 addresses (Laine Stump),<br/>
Improve error reporting when parsing dhcp info for virtual networks (Laine Stump),<br/>
qemu driver: fix positioning to end of log file (Stefan Berger),<br/>
build: satisfy 'make syntax-check' regarding year change (Eric Blake)<br/>
</li>
<li>Cleanups:<br/>
build: silence some clang warnings (Eric Blake),<br/>
maint: kill dead assignments (Eric Blake),<br/>
build: silence false positive clang report (Eric Blake),<br/>
maint: whitespace cleanup (Eric Blake),<br/>
maint: update AUTHORS (Eric Blake),<br/>
Prefer C style comments over C++ ones (Matthias Bolte),<br/>
Revert all previous error log priority hacks (Daniel P. Berrange),<br/>
Cleanup code style in logging APIs (Daniel P. Berrange),<br/>
Remove redundant brackets around return values (Daniel P. Berrange),<br/>
tests: Remove obsolete secaatest (Matthias Bolte),<br/>
datatypes: avoid redundant __FUNCTION__ (Eric Blake)<br/>
</li>
</ul>
<h3>0.8.7: Jan 4 2011</h3> <h3>0.8.7: Jan 4 2011</h3>
<ul> <ul>
<li>Features:<br/> <li>Features:<br/>
@ -18,7 +877,7 @@ and check the <a href="http://libvirt.org/git/?p=libvirt.git;a=log">GIT log</a>
</li> </li>
<li>Documentation:<br/> <li>Documentation:<br/>
esx: Fix "occurence" typo (again),<br/> (Matthias Bolte) esx: Fix "occurence" typo (again) (Matthias Bolte),<br/>
update docs for network disks (MORITA Kazutaka),<br/> update docs for network disks (MORITA Kazutaka),<br/>
docs: Make VMware Workstation / Player page appear in the menu (Matthias Bolte),<br/> docs: Make VMware Workstation / Player page appear in the menu (Matthias Bolte),<br/>
Add info about VMware driver to the libvirt website (Jean-Baptiste Rouault),<br/> Add info about VMware driver to the libvirt website (Jean-Baptiste Rouault),<br/>

View File

@ -1,175 +1,175 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<xsl:stylesheet <xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common" xmlns:exsl="http://exslt.org/common"
exclude-result-prefixes="xsl exsl" exclude-result-prefixes="xsl exsl"
version="1.0"> version="1.0">
<!-- The sitemap.html.in page contains the master navigation structure --> <!-- 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/body/div[@id='sitemap']"/>
<xsl:template match="code[@class='docref']" mode="content"> <xsl:template match="code[@class='docref']" mode="content">
<xsl:variable name="name"><xsl:value-of select="."/></xsl:variable> <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> <a href="html/libvirt-libvirt.html#{$name}"><code><xsl:value-of select="$name"/></code></a>
</xsl:template> </xsl:template>
<xsl:template match="node() | @*" mode="content"> <xsl:template match="node() | @*" mode="content">
<xsl:copy> <xsl:copy>
<xsl:apply-templates select="node() | @*" mode="content"/> <xsl:apply-templates select="node() | @*" mode="content"/>
</xsl:copy> </xsl:copy>
</xsl:template> </xsl:template>
<xsl:template match="ul[@id='toc']" mode="content"> <xsl:template match="ul[@id='toc']" mode="content">
<xsl:call-template name="toc"/> <xsl:call-template name="toc"/>
</xsl:template> </xsl:template>
<!-- This processes the sitemap to form a context sensitive <!-- This processes the sitemap to form a context sensitive
navigation menu for the current page --> navigation menu for the current page -->
<xsl:template match="ul" mode="menu"> <xsl:template match="ul" mode="menu">
<xsl:param name="pagename"/> <xsl:param name="pagename"/>
<xsl:param name="level"/> <xsl:param name="level"/>
<ul class="{concat('l', $level)}"> <ul class="{concat('l', $level)}">
<xsl:for-each select="li"> <xsl:for-each select="li">
<!-- The extra div tag here works around an IE6 whitespace collapsing problem --> <!-- The extra div tag here works around an IE6 whitespace collapsing problem -->
<li><div> <li><div>
<!-- A menu is active if there is an 'a' tag with <!-- A menu is active if there is an 'a' tag with
a href matching this pagename at this level a href matching this pagename at this level
or a child menu --> or a child menu -->
<xsl:variable name="class"> <xsl:variable name="class">
<xsl:choose> <xsl:choose>
<xsl:when test="count(.//a[@href = $pagename]) > 0"> <xsl:when test="count(.//a[@href = $pagename]) > 0">
<xsl:text>active</xsl:text> <xsl:text>active</xsl:text>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:text>inactive</xsl:text> <xsl:text>inactive</xsl:text>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
<!-- A menu should use a 'span' instead of 'a' if <!-- A menu should use a 'span' instead of 'a' if
the immediate 'a' tag has href matching the the immediate 'a' tag has href matching the
current pagename --> current pagename -->
<xsl:choose> <xsl:choose>
<xsl:when test="$pagename = a/@href"> <xsl:when test="$pagename = a/@href">
<span class="{$class}"><xsl:value-of select="a"/></span> <span class="{$class}"><xsl:value-of select="a"/></span>
</xsl:when> </xsl:when>
<xsl:when test="a/@href = 'http://wiki.libvirt.org'"> <xsl:when test="a/@href = 'http://wiki.libvirt.org'">
<a title="{./span}" class="{$class}" href="{a/@href}"><xsl:value-of select="a"/></a> <a title="{./span}" class="{$class}" href="{a/@href}"><xsl:value-of select="a"/></a>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<a title="{./span}" class="{$class}" href="{concat($href_base, a/@href)}"><xsl:value-of select="a"/></a> <a title="{./span}" class="{$class}" href="{concat($href_base, a/@href)}"><xsl:value-of select="a"/></a>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<!-- A sub-menu should only be expanded it contains <!-- A sub-menu should only be expanded it contains
an 'a' tag with href matching this pagename --> an 'a' tag with href matching this pagename -->
<xsl:if test="count(.//a[@href = $pagename]) > 0"> <xsl:if test="count(.//a[@href = $pagename]) > 0">
<xsl:apply-templates select="ul" mode="menu"> <xsl:apply-templates select="ul" mode="menu">
<xsl:with-param name="pagename" select="$pagename"/> <xsl:with-param name="pagename" select="$pagename"/>
<xsl:with-param name="level" select="$level + 1"/> <xsl:with-param name="level" select="$level + 1"/>
</xsl:apply-templates> </xsl:apply-templates>
</xsl:if> </xsl:if>
</div></li> </div></li>
</xsl:for-each> </xsl:for-each>
</ul> </ul>
</xsl:template> </xsl:template>
<xsl:template name="toc"> <xsl:template name="toc">
<ul> <ul>
<xsl:for-each select="/html/body/h2[count(a) = 1]"> <xsl:for-each select="/html/body/h2[count(a) = 1]">
<xsl:variable name="thish2" select="."/> <xsl:variable name="thish2" select="."/>
<li> <li>
<a href="#{a/@name}"><xsl:value-of select="a/text()"/></a> <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"> <xsl:if test="count(./following-sibling::h3[preceding-sibling::h2[1] = $thish2 and count(a) = 1]) > 0">
<ul> <ul>
<xsl:for-each select="./following-sibling::h3[preceding-sibling::h2[1] = $thish2 and count(a) = 1]"> <xsl:for-each select="./following-sibling::h3[preceding-sibling::h2[1] = $thish2 and count(a) = 1]">
<xsl:variable name="thish3" select="."/> <xsl:variable name="thish3" select="."/>
<li> <li>
<a href="#{a/@name}"><xsl:value-of select="a/text()"/></a> <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"> <xsl:if test="count(./following-sibling::h4[preceding-sibling::h3[1] = $thish3 and count(a) = 1]) > 0">
<ul> <ul>
<xsl:for-each select="./following-sibling::h4[preceding-sibling::h3[1] = $thish3 and count(a) = 1]"> <xsl:for-each select="./following-sibling::h4[preceding-sibling::h3[1] = $thish3 and count(a) = 1]">
<xsl:variable name="thish4" select="."/> <xsl:variable name="thish4" select="."/>
<li> <li>
<a href="#{a/@name}"><xsl:value-of select="a/text()"/></a> <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"> <xsl:if test="count(./following-sibling::h5[preceding-sibling::h4[1] = $thish4 and count(a) = 1]) > 0">
<ul> <ul>
<xsl:for-each select="./following-sibling::h5[preceding-sibling::h4[1] = $thish4 and count(a) = 1]"> <xsl:for-each select="./following-sibling::h5[preceding-sibling::h4[1] = $thish4 and count(a) = 1]">
<xsl:variable name="thish5" select="."/> <xsl:variable name="thish5" select="."/>
<li> <li>
<a href="#{a/@name}"><xsl:value-of select="a/text()"/></a> <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"> <xsl:if test="count(./following-sibling::h6[preceding-sibling::h5[1] = $thish5 and count(a) = 1]) > 0">
<ul> <ul>
<xsl:for-each select="./following-sibling::h6[preceding-sibling::h5[1] = $thish5 and count(a) = 1]"> <xsl:for-each select="./following-sibling::h6[preceding-sibling::h5[1] = $thish5 and count(a) = 1]">
<li> <li>
<a href="#{a/@name}"><xsl:value-of select="a/text()"/></a> <a href="#{a/@name}"><xsl:value-of select="a/text()"/></a>
</li> </li>
</xsl:for-each> </xsl:for-each>
</ul> </ul>
</xsl:if> </xsl:if>
</li> </li>
</xsl:for-each> </xsl:for-each>
</ul> </ul>
</xsl:if> </xsl:if>
</li> </li>
</xsl:for-each> </xsl:for-each>
</ul> </ul>
</xsl:if> </xsl:if>
</li> </li>
</xsl:for-each> </xsl:for-each>
</ul> </ul>
</xsl:if> </xsl:if>
</li> </li>
</xsl:for-each> </xsl:for-each>
</ul> </ul>
</xsl:template> </xsl:template>
<!-- This is the master page structure --> <!-- This is the master page structure -->
<xsl:template match="/" mode="page"> <xsl:template match="/" mode="page">
<xsl:param name="pagename"/> <xsl:param name="pagename"/>
<html> <html>
<xsl:comment> <xsl:comment>
This file is autogenerated from <xsl:value-of select="$pagename"/>.in This file is autogenerated from <xsl:value-of select="$pagename"/>.in
Do not edit this file. Changes will be lost. Do not edit this file. Changes will be lost.
</xsl:comment> </xsl:comment>
<head> <head>
<link rel="stylesheet" type="text/css" href="{$href_base}main.css"/> <link rel="stylesheet" type="text/css" href="{$href_base}main.css"/>
<link rel="SHORTCUT ICON" href="{$href_base}32favicon.png"/> <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/body/h1"/></title>
<meta name="description" content="libvirt, virtualization, virtualization API"/> <meta name="description" content="libvirt, virtualization, virtualization API"/>
</head> </head>
<body> <body>
<div id="header"> <div id="header">
<div id="headerLogo"/> <div id="headerLogo"/>
<div id="headerSearch"> <div id="headerSearch">
<form action="{$href_base}search.php" enctype="application/x-www-form-urlencoded" method="get"> <form action="{$href_base}search.php" enctype="application/x-www-form-urlencoded" method="get">
<div> <div>
<input id="query" name="query" type="text" size="12" value=""/> <input id="query" name="query" type="text" size="12" value=""/>
<input id="submit" name="submit" type="submit" value="Search"/> <input id="submit" name="submit" type="submit" value="Search"/>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
<div id="body"> <div id="body">
<div id="menu"> <div id="menu">
<xsl:apply-templates select="exsl:node-set($sitemap)/ul" mode="menu"> <xsl:apply-templates select="exsl:node-set($sitemap)/ul" mode="menu">
<xsl:with-param name="pagename" select="$pagename"/> <xsl:with-param name="pagename" select="$pagename"/>
<xsl:with-param name="level" select="0"/> <xsl:with-param name="level" select="0"/>
</xsl:apply-templates> </xsl:apply-templates>
</div> </div>
<div id="content"> <div id="content">
<xsl:apply-templates select="/html/body/*" mode="content"/> <xsl:apply-templates select="/html/body/*" mode="content"/>
</div> </div>
</div> </div>
<div id="footer"> <div id="footer">
<p id="sponsor"> <p id="sponsor">
Sponsored by:<br/> Sponsored by:<br/>
<a href="http://et.redhat.com/"><img src="{$href_base}et.png" alt="Project sponsored by Red Hat Emerging Technology"/></a> <a href="http://et.redhat.com/"><img src="{$href_base}et.png" alt="Project sponsored by Red Hat Emerging Technology"/></a>
</p> </p>
</div> </div>
</body> </body>
</html> </html>
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>

34
docs/php.html.in Normal file
View File

@ -0,0 +1,34 @@
<?xml version="1.0"?>
<html>
<body>
<h1>PHP API bindings</h1>
<h2>Presentation</h2>
<p>The libvirt-php, originally called php-libvirt, is the PHP API bindings for
the libvirt virtualization toolkit originally developed by Radek Hladik but
currently maintained by Red Hat.</p>
<h2>Getting the source</h2>
<p> The PHP bindings code source is now maintained in a <a
href="http://git-scm.com/">git</a> repository available on
<a href="http://libvirt.org/git/">libvirt.org</a>:
</p>
<pre>
git clone git://libvirt.org/libvirt-php.git
</pre>
<p>
It can also be browsed at
</p>
<pre>
<a href="http://libvirt.org/git/?p=libvirt-php.git;a=summary">http://libvirt.org/git/?p=libvirt-php.git;a=summary</a>
</pre>
<p></p>
<h2>Project pages</h2>
<p>Since February 2011 the project have it's own pages hosted at libvirt.org. For more information on the project
please refer to <a href="http://libvirt.org/php">http://libvirt.org/php</a>.
</p>
</body>
</html>

View File

@ -308,6 +308,21 @@ Note that parameter values must be
<td colspan="2"/> <td colspan="2"/>
<td> Example: <code>no_tty=1</code> </td> <td> Example: <code>no_tty=1</code> </td>
</tr> </tr>
<tr>
<td>
<code>pkipath</code>
</td>
<td> tls</td>
<td>
Specifies x509 certificates path for the client. If any of
the CA certificate, client certificate, or client key is
missing, the connection will fail with a fatal error.
</td>
</tr>
<tr>
<td colspan="2"/>
<td> Example: <code>pkipath=/tmp/pki/client</code> </td>
</tr>
</table> </table>
<h3> <h3>
<a name="Remote_certificates">Generating TLS certificates</a> <a name="Remote_certificates">Generating TLS certificates</a>
@ -372,6 +387,21 @@ next section.
</td> </td>
</tr> </tr>
</table> </table>
<p>
If 'pkipath' is specified in URI, then all the client
certificates must be found in the path specified, otherwise the
connection will fail with a fatal error. If 'pkipath' is not
specified:
</p>
<ul>
<li> For a non-root user, libvirt tries to find the certificates
in $HOME/.pki/libvirt. If any of the required certificates can
not be found, then the global default locations
(/etc/pki/CA/cacert.pem, /etc/pki/libvirt/private/clientkey,
/etc/pki/libvirt/clientcert.pem) will be used.
</li>
<li> For the root user, the global default locations will be used.</li>
</ul>
<h4> <h4>
<a name="Remote_TLS_background">Background to TLS certificates</a> <a name="Remote_TLS_background">Background to TLS certificates</a>
</h4> </h4>

View File

@ -64,6 +64,9 @@
<element name="label"> <element name="label">
<text/> <text/>
</element> </element>
<element name="imagelabel">
<text/>
</element>
</element> </element>
</define> </define>
<define name="hvs"> <define name="hvs">
@ -121,9 +124,9 @@
</optional> </optional>
<choice> <choice>
<ref name="osbootkernel"/> <ref name="osbootkernel"/>
<oneOrMore> <zeroOrMore>
<ref name="osbootdev"/> <ref name="osbootdev"/>
</oneOrMore> </zeroOrMore>
</choice> </choice>
<optional> <optional>
<element name="bootmenu"> <element name="bootmenu">
@ -306,6 +309,18 @@
</element> </element>
</optional> </optional>
<!-- The Blkio cgroup related tunables would go in the blkiotune -->
<optional>
<element name="blkiotune">
<!-- I/O weight the VM can use -->
<optional>
<element name="weight">
<ref name="weight"/>
</element>
</optional>
</element>
</optional>
<!-- All the memory/swap related tunables would go in the memtune --> <!-- All the memory/swap related tunables would go in the memtune -->
<optional> <optional>
<element name="memtune"> <element name="memtune">
@ -351,6 +366,27 @@
<ref name="countCPU"/> <ref name="countCPU"/>
</element> </element>
</optional> </optional>
<!-- All the cpu related tunables would go in the cputune -->
<optional>
<element name="cputune">
<optional>
<element name="shares">
<ref name="cpushares"/>
</element>
</optional>
<zeroOrMore>
<element name="vcpupin">
<attribute name="vcpu">
<ref name="vcpuid"/>
</attribute>
<attribute name="cpuset">
<ref name="cpuset"/>
</attribute>
</element>
</zeroOrMore>
</element>
</optional>
</interleave> </interleave>
</define> </define>
<define name="clock"> <define name="clock">
@ -525,6 +561,9 @@
<ref name="driver"/> <ref name="driver"/>
</optional> </optional>
<ref name="target"/> <ref name="target"/>
<optional>
<ref name="deviceBoot"/>
</optional>
<optional> <optional>
<element name="readonly"> <element name="readonly">
<empty/> <empty/>
@ -693,6 +732,9 @@
<optional> <optional>
<ref name="driverErrorPolicy"/> <ref name="driverErrorPolicy"/>
</optional> </optional>
<optional>
<ref name="driverIO"/>
</optional>
<empty/> <empty/>
</element> </element>
</define> </define>
@ -724,6 +766,14 @@
</choice> </choice>
</attribute> </attribute>
</define> </define>
<define name="driverIO">
<attribute name="io">
<choice>
<value>threads</value>
<value>native</value>
</choice>
</attribute>
</define>
<define name="controller"> <define name="controller">
<element name="controller"> <element name="controller">
<choice> <choice>
@ -735,6 +785,7 @@
<value>ide</value> <value>ide</value>
<value>scsi</value> <value>scsi</value>
<value>sata</value> <value>sata</value>
<value>ccid</value>
</choice> </choice>
</attribute> </attribute>
</optional> </optional>
@ -963,6 +1014,7 @@
- the IP address bound to the interface - the IP address bound to the interface
- the name of the script used to set up the binding - the name of the script used to set up the binding
- the target device used - the target device used
- boot order
--> -->
<define name="interface-options"> <define name="interface-options">
<interleave> <interleave>
@ -1004,6 +1056,27 @@
<empty/> <empty/>
</element> </element>
</optional> </optional>
<optional>
<element name="driver">
<optional>
<attribute name="name">
<choice>
<value>qemu</value>
<value>vhost</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="txmode">
<choice>
<value>iothread</value>
<value>timer</value>
</choice>
</attribute>
</optional>
<empty/>
</element>
</optional>
<optional> <optional>
<ref name="address"/> <ref name="address"/>
</optional> </optional>
@ -1012,6 +1085,19 @@
<ref name="filterref-node-attributes"/> <ref name="filterref-node-attributes"/>
</element> </element>
</optional> </optional>
<optional>
<element name="tune">
<optional>
<!-- size of send buffer for network tap devices -->
<element name="sndbuf">
<ref name="unsignedInt"/>
</element>
</optional>
</element>
</optional>
<optional>
<ref name="deviceBoot"/>
</optional>
</interleave> </interleave>
</define> </define>
<define name="virtualPortProfile"> <define name="virtualPortProfile">
@ -1097,24 +1183,35 @@
<attribute name="type"> <attribute name="type">
<value>vnc</value> <value>vnc</value>
</attribute> </attribute>
<optional> <choice>
<attribute name="port"> <group>
<ref name="PortNumber"/> <optional>
</attribute> <attribute name="port">
</optional> <ref name="PortNumber"/>
<optional> </attribute>
<attribute name="autoport"> </optional>
<choice> <optional>
<value>yes</value> <attribute name="autoport">
<value>no</value> <choice>
</choice> <value>yes</value>
</attribute> <value>no</value>
</optional> </choice>
<optional> </attribute>
<attribute name="listen"> </optional>
<ref name="addrIP"/> <optional>
</attribute> <attribute name="listen">
</optional> <ref name="addrIP"/>
</attribute>
</optional>
</group>
<group>
<optional>
<attribute name="socket">
<ref name="absFilePath"/>
</attribute>
</optional>
</group>
</choice>
<optional> <optional>
<attribute name="passwd"> <attribute name="passwd">
<text/> <text/>
@ -1163,28 +1260,81 @@
<text/> <text/>
</attribute> </attribute>
</optional> </optional>
<zeroOrMore> <interleave>
<element name="channel"> <zeroOrMore>
<attribute name="name"> <element name="channel">
<choice> <attribute name="name">
<value>main</value> <choice>
<value>display</value> <value>main</value>
<value>inputs</value> <value>display</value>
<value>cursor</value> <value>inputs</value>
<value>playback</value> <value>cursor</value>
<value>record</value> <value>playback</value>
</choice> <value>record</value>
</attribute> <value>smartcard</value>
<attribute name="mode"> </choice>
<choice> </attribute>
<value>any</value> <attribute name="mode">
<value>secure</value> <choice>
<value>insecure</value> <value>any</value>
</choice> <value>secure</value>
</attribute> <value>insecure</value>
<empty/> </choice>
</element> </attribute>
</zeroOrMore> <empty/>
</element>
</zeroOrMore>
<optional>
<element name="image">
<attribute name="compression">
<choice>
<value>auto_glz</value>
<value>auto_lz</value>
<value>quic</value>
<value>glz</value>
<value>lz</value>
<value>off</value>
</choice>
</attribute>
<empty/>
</element>
</optional>
<optional>
<element name="jpeg">
<attribute name="compression">
<choice>
<value>auto</value>
<value>never</value>
<value>always</value>
</choice>
</attribute>
<empty/>
</element>
</optional>
<optional>
<element name="zlib">
<attribute name="compression">
<choice>
<value>auto</value>
<value>never</value>
<value>always</value>
</choice>
</attribute>
<empty/>
</element>
</optional>
<optional>
<element name="playback">
<attribute name="compression">
<choice>
<value>on</value>
<value>off</value>
</choice>
</attribute>
<empty/>
</element>
</optional>
</interleave>
</group> </group>
<group> <group>
<attribute name="type"> <attribute name="type">
@ -1422,6 +1572,7 @@
<value>stdio</value> <value>stdio</value>
<value>vc</value> <value>vc</value>
<value>pty</value> <value>pty</value>
<value>spicevmc</value>
</choice> </choice>
</attribute> </attribute>
</define> </define>
@ -1448,7 +1599,14 @@
<optional> <optional>
<element name="protocol"> <element name="protocol">
<optional> <optional>
<attribute name="type"/> <attribute name="type">
<choice>
<value>raw</value>
<value>telnet</value>
<value>telnets</value>
<value>tls</value>
</choice>
</attribute>
</optional> </optional>
</element> </element>
</optional> </optional>
@ -1482,6 +1640,7 @@
<value>es1370</value> <value>es1370</value>
<value>pcspk</value> <value>pcspk</value>
<value>ac97</value> <value>ac97</value>
<value>ich6</value>
</choice> </choice>
</attribute> </attribute>
<optional> <optional>
@ -1550,7 +1709,7 @@
<define name="virtioTarget"> <define name="virtioTarget">
<element name="target"> <element name="target">
<attribute name="type"> <attribute name="type">
<value>virtio</value> <value>virtio</value>
</attribute> </attribute>
<optional> <optional>
<attribute name="name"/> <attribute name="name"/>
@ -1572,6 +1731,51 @@
</interleave> </interleave>
</element> </element>
</define> </define>
<define name="smartcard">
<element name="smartcard">
<choice>
<group>
<attribute name="mode">
<value>host</value>
</attribute>
<!-- might need to add optional database element here later -->
</group>
<group>
<attribute name="mode">
<value>host-certificates</value>
</attribute>
<ref name='certificate'/>
<ref name='certificate'/>
<ref name='certificate'/>
<optional>
<element name="database">
<ref name="absDirPath"/>
</element>
</optional>
</group>
<group>
<attribute name="mode">
<value>passthrough</value>
</attribute>
<ref name="qemucdevSrcType"/>
<interleave>
<ref name="qemucdevSrcDef"/>
<optional>
<ref name="qemucdevTgtDef"/>
</optional>
</interleave>
</group>
</choice>
<optional>
<ref name="address"/>
</optional>
</element>
</define>
<define name="certificate">
<element name="certificate">
<text/>
</element>
</define>
<define name="input"> <define name="input">
<element name="input"> <element name="input">
<attribute name="type"> <attribute name="type">
@ -1603,12 +1807,14 @@
<value>capabilities</value> <value>capabilities</value>
</choice> </choice>
</attribute> </attribute>
<attribute name="type"> </optional>
<choice> <attribute name="type">
<value>usb</value> <choice>
<value>pci</value> <value>usb</value>
</choice> <value>pci</value>
</attribute> </choice>
</attribute>
<optional>
<attribute name="managed"> <attribute name="managed">
<choice> <choice>
<value>yes</value> <value>yes</value>
@ -1632,6 +1838,9 @@
</choice> </choice>
</element> </element>
</group> </group>
<optional>
<ref name="deviceBoot"/>
</optional>
<optional> <optional>
<ref name="address"/> <ref name="address"/>
</optional> </optional>
@ -1705,8 +1914,21 @@
</attribute> </attribute>
</optional> </optional>
</define> </define>
<define name="ccidaddress">
<attribute name="controller">
<ref name="driveController"/>
</attribute>
<optional>
<attribute name="slot">
<ref name="driveUnit"/>
</attribute>
</optional>
</define>
<!-- <!--
Devices attached to a domain. Devices attached to a domain.
Sub-elements such as <alias> are not documented here, as they
can only exist when generated for a live domain and are ignored
when defining a domain.
--> -->
<define name="devices"> <define name="devices">
<element name="devices"> <element name="devices">
@ -1729,6 +1951,7 @@
<ref name="parallel"/> <ref name="parallel"/>
<ref name="serial"/> <ref name="serial"/>
<ref name="channel"/> <ref name="channel"/>
<ref name="smartcard"/>
</choice> </choice>
</zeroOrMore> </zeroOrMore>
<optional> <optional>
@ -1741,7 +1964,7 @@
</element> </element>
</define> </define>
<!-- <!--
A set of optional features: PAE, APIC and ACPI support A set of optional features: PAE, APIC, ACPI, and HAP support
--> -->
<define name="features"> <define name="features">
<optional> <optional>
@ -1762,6 +1985,11 @@
<empty/> <empty/>
</element> </element>
</optional> </optional>
<optional>
<element name="hap">
<empty/>
</element>
</optional>
</interleave> </interleave>
</element> </element>
</optional> </optional>
@ -1953,6 +2181,12 @@
</attribute> </attribute>
<ref name="virtioserialaddress"/> <ref name="virtioserialaddress"/>
</group> </group>
<group>
<attribute name="type">
<value>ccid</value>
</attribute>
<ref name="ccidaddress"/>
</group>
</choice> </choice>
</element> </element>
</define> </define>
@ -1973,6 +2207,15 @@
</optional> </optional>
</define> </define>
<define name="deviceBoot">
<element name="boot">
<attribute name="order">
<ref name="positiveInteger"/>
</attribute>
<empty/>
</element>
</define>
<!-- <!--
Optional hypervisor extensions in their own namespace: Optional hypervisor extensions in their own namespace:
QEmu QEmu
@ -2002,9 +2245,10 @@
Type library Type library
Our unsignedInt doesn't allow a leading '+' in its lexical form Our unsignedInt doesn't allow a leading '+' in its lexical form
A domain name shoul be made of ascii, numbers, _-+ and is non-empty A domain name should be made of ascii, numbers, _-+ and is non-empty
UUID currently allows only the 32 characters strict syntax UUID currently allows only the 32 characters strict syntax
memoryKB request at least 4Mbytes though Xen will grow bigger if too low memoryKB request at least 4Mbytes though Xen will grow bigger if too low
weight currently is in range [100, 1000]
--> -->
<define name="unsignedInt"> <define name="unsignedInt">
<data type="unsignedInt"> <data type="unsignedInt">
@ -2027,6 +2271,16 @@
<param name="minInclusive">1</param> <param name="minInclusive">1</param>
</data> </data>
</define> </define>
<define name="vcpuid">
<data type="unsignedShort">
<param name="pattern">[0-9]+</param>
</data>
</define>
<define name="cpushares">
<data type="unsignedInt">
<param name="pattern">[0-9]+</param>
</data>
</define>
<define name="hostName"> <define name="hostName">
<data type="string"> <data type="string">
<param name="pattern">[a-zA-Z0-9\.\-]+</param> <param name="pattern">[a-zA-Z0-9\.\-]+</param>
@ -2037,6 +2291,13 @@
<param name="minInclusive">-1</param> <param name="minInclusive">-1</param>
</data> </data>
</define> </define>
<define name="weight">
<data type="unsignedInt">
<param name="pattern">[0-9]+</param>
<param name="minInclusive">100</param>
<param name="maxInclusive">1000</param>
</data>
</define>
<define name="memoryKB"> <define name="memoryKB">
<data type="unsignedInt"> <data type="unsignedInt">
<param name="pattern">[0-9]+</param> <param name="pattern">[0-9]+</param>

View File

@ -50,6 +50,14 @@
</element> </element>
</optional> </optional>
<!-- <mac> element -->
<optional>
<element name="mac">
<attribute name="address"><ref name="mac-addr"/></attribute>
<empty/>
</element>
</optional>
<!-- <forward> element --> <!-- <forward> element -->
<optional> <optional>
<!-- The device through which the bridge is connected to the <!-- The device through which the bridge is connected to the

View File

@ -81,6 +81,7 @@
<ref name="common-port-attributes"/> <ref name="common-port-attributes"/>
<ref name="common-ip-attributes-p1"/> <ref name="common-ip-attributes-p1"/>
<ref name="common-ip-attributes-p2"/> <ref name="common-ip-attributes-p2"/>
<ref name="tcp-attributes"/>
<ref name="comment-attribute"/> <ref name="comment-attribute"/>
</element> </element>
</zeroOrMore> </zeroOrMore>
@ -184,6 +185,7 @@
<ref name="common-port-attributes"/> <ref name="common-port-attributes"/>
<ref name="common-ipv6-attributes-p1"/> <ref name="common-ipv6-attributes-p1"/>
<ref name="common-ipv6-attributes-p2"/> <ref name="common-ipv6-attributes-p2"/>
<ref name="tcp-attributes"/>
<ref name="comment-attribute"/> <ref name="comment-attribute"/>
</element> </element>
</zeroOrMore> </zeroOrMore>
@ -606,6 +608,14 @@
</optional> </optional>
</define> </define>
<define name="tcp-attributes">
<optional>
<attribute name="flags">
<ref name="tcpflags-type"/>
</attribute>
</optional>
</define>
<!-- ################ type library ################ --> <!-- ################ type library ################ -->
<define name="UUID"> <define name="UUID">
@ -839,6 +849,7 @@
<choice> <choice>
<value>drop</value> <value>drop</value>
<value>accept</value> <value>accept</value>
<value>reject</value>
</choice> </choice>
</define> </define>
@ -871,4 +882,10 @@
<param name="pattern">((NEW|ESTABLISHED|RELATED|INVALID)(,(NEW|ESTABLISHED|RELATED|INVALID))*|NONE)</param> <param name="pattern">((NEW|ESTABLISHED|RELATED|INVALID)(,(NEW|ESTABLISHED|RELATED|INVALID))*|NONE)</param>
</data> </data>
</define> </define>
<define name='tcpflags-type'>
<data type="string">
<param name="pattern">((SYN|ACK|URG|PSH|FIN|RST)(,(SYN|ACK|URG|PSH|FIN|RST))*|ALL|NONE)/((SYN|ACK|URG|PSH|FIN|RST)(,(SYN|ACK|URG|PSH|FIN|RST))*|ALL|NONE)</param>
</data>
</define>
</grammar> </grammar>

View File

@ -18,14 +18,13 @@
<div id="body"> <div id="body">
<div id="content"> <div id="content">
<?php <?php
$query = $HTTP_GET_VARS[ "query" ];
$scope = $HTTP_GET_VARS[ "scope" ];
// We handle only the first argument so far
$query = $_GET['query']; $query = $_GET['query'];
// We handle only the first argument so far
$query = ltrim ($query); $query = ltrim ($query);
if (! $query) { if (! $query) {
echo "<h1 align='center'>Search the documentation on Libvir.org</h1>"; echo "<h1 align='center'>Search the documentation on Libvir.org</h1>";
} }
$scope = $_GET['scope'];
if ($scope == NULL) if ($scope == NULL)
$scope = "any"; $scope = "any";
$scope = ltrim ($scope); $scope = ltrim ($scope);
@ -34,7 +33,7 @@
?> ?>
<p> The search service indexes the libvirt APIs and documentation as well as the libvir-list@redhat.com mailing-list archives. To use it simply provide a set of keywords:</p> <p> The search service indexes the libvirt APIs and documentation as well as the libvir-list@redhat.com mailing-list archives. To use it simply provide a set of keywords:</p>
<form action="<?php echo "$PHP_SELF", "?query=", rawurlencode($query) ?>" <form action="<?php echo $_SERVER['PHP_SELF'], "?query=", rawurlencode($query) ?>"
enctype="application/x-www-form-urlencoded" method="get"> enctype="application/x-www-form-urlencoded" method="get">
<input name="query" type="text" size="50" value="<?php echo $query?>"/> <input name="query" type="text" size="50" value="<?php echo $query?>"/>
<select name="scope"> <select name="scope">

View File

@ -18,6 +18,10 @@
</li> </li>
</ul> </ul>
</li> </li>
<li>
<a href="apps.html">Applications</a>
<span>Applications known to use libvirt</span>
</li>
<li> <li>
<a href="downloads.html">Downloads</a> <a href="downloads.html">Downloads</a>
<span>Get the latest source releases, binary builds and get access to the source repository</span> <span>Get the latest source releases, binary builds and get access to the source repository</span>
@ -26,6 +30,10 @@
<a href="windows.html">Windows</a> <a href="windows.html">Windows</a>
<span>Downloads for Windows</span> <span>Downloads for Windows</span>
</li> </li>
<li>
<a href="bindings.html">Language bindings</a>
<span>Bindings of the libvirt API for languages other than C</span>
</li>
</ul> </ul>
</li> </li>
<li> <li>
@ -111,12 +119,10 @@
<li> <li>
<a href="formatnetwork.html">Networks</a> <a href="formatnetwork.html">Networks</a>
<span>The virtual network XML format</span> <span>The virtual network XML format</span>
<ul> </li>
<li> <li>
<a href="formatnwfilter.html">Network Filtering</a> <a href="formatnwfilter.html">Network Filtering</a>
<span>Network filter XML format</span> <span>Network filter XML format</span>
</li>
</ul>
</li> </li>
<li> <li>
<a href="formatstorage.html">Storage</a> <a href="formatstorage.html">Storage</a>
@ -184,10 +190,6 @@
<a href="drvvbox.html">VirtualBox</a> <a href="drvvbox.html">VirtualBox</a>
<span>Driver for VirtualBox</span> <span>Driver for VirtualBox</span>
</li> </li>
<li>
<a href="drvone.html">OpenNebula</a>
<span>Driver for OpenNebula</span>
</li>
<li> <li>
<a href="drvesx.html">VMware ESX</a> <a href="drvesx.html">VMware ESX</a>
<span>Driver for VMware ESX</span> <span>Driver for VMware ESX</span>
@ -260,6 +262,10 @@
<a href="csharp.html">C#</a> <a href="csharp.html">C#</a>
<span>overview of the C# API bindings</span> <span>overview of the C# API bindings</span>
</li> </li>
<li>
<a href="php.html">PHP</a>
<span>overview of the PHP API bindings</span>
</li>
</ul> </ul>
</li> </li>
<li> <li>
@ -315,12 +321,6 @@
<li> <li>
<a href="relatedlinks.html">Related Links</a> <a href="relatedlinks.html">Related Links</a>
<span>Miscellaneous links of interest related to libvirt</span> <span>Miscellaneous links of interest related to libvirt</span>
<ul>
<li>
<a href="apps.html">Applications</a>
<span>Overview of applications using the libvirt APIs</span>
</li>
</ul>
</li> </li>
<li> <li>
<a href="sitemap.html">Sitemap</a> <a href="sitemap.html">Sitemap</a>

View File

@ -49,21 +49,21 @@
<ul> <ul>
<li> <li>
Standard HTML format, multiple pages Standard HTML format, multiple pages
(<a href="http://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.6-1-html-multi-page.tar.gz">.tar.gz</a>) (<a href="http://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.7-1-html-multi-page.tar.gz">.tar.gz</a>)
(<a href="http://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.6-1-html-multi-page.tar.bz2">.tar.bz2</a>) (<a href="http://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.7-1-html-multi-page.tar.bz2">.tar.bz2</a>)
(<a href="http://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.6-1-html-multi-page.zip">.zip</a>) (<a href="http://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.7-1-html-multi-page.zip">.zip</a>)
</li> </li>
<li> <li>
HTML format, one long page HTML format, one long page
(<a href="http://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.6-1-html-single.tar.gz">.tar.gz</a>) (<a href="http://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.7-1-html-single.tar.gz">.tar.gz</a>)
(<a href="http://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.6-1-html-single.tar.bz2">.tar.bz2</a>) (<a href="http://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.7-1-html-single.tar.bz2">.tar.bz2</a>)
(<a href="http://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.6-1-html-single.zip">.zip</a>) (<a href="http://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.7-1-html-single.zip">.zip</a>)
</li> </li>
<li> <li>
<a href="http://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.6-1.pdf">PDF format</a> <a href="http://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.7-1.pdf">PDF format</a>
</li> </li>
<li> <li>
<a href="http://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.6-1.epub">ePub format</a> <a href="http://libvirt.org/sources/virshcmdref/Virsh_Command_Reference-0.8.7-1.epub">ePub format</a>
</li> </li>
</ul> </ul>

View File

@ -18,7 +18,7 @@
version is available here: version is available here:
</p> </p>
<a href="http://libvirt.org/sources/win32_experimental/Libvirt-0.8.6-2.exe">http://libvirt.org/sources/win32_experimental/Libvirt-0.8.6-2.exe</a> <a href="http://libvirt.org/sources/win32_experimental/Libvirt-0.8.8-0.exe">http://libvirt.org/sources/win32_experimental/Libvirt-0.8.8-0.exe</a>
<p> <p>
<b>It is not production ready.</b> <b>It is not production ready.</b>
@ -30,7 +30,7 @@
and untested Python bindings. and untested Python bindings.
</p> </p>
<h3><a name="caveats">Caveats</h3> <h3><a name="caveats">Caveats</a></h3>
<ul> <ul>
<li> <li>
@ -47,7 +47,7 @@
</li> </li>
</ul> </ul>
<h3><a name="knowninstallerprobs">Existing problems with this installer we know about</a> <h3><a name="knowninstallerprobs">Existing problems with this installer we know about</a></h3>
<p> <p>
These are problems we know about, and need to be fixed in subsequent These are problems we know about, and need to be fixed in subsequent
@ -70,25 +70,9 @@
<br /><br /> <br /><br />
</li> </li>
<li>
Start menu shortcuts aren't being removed at uninstall time
<br /><br />
Not sure why yet. Needs to be investigated.
<br /><br />
</li>
<li>
Libvirt dll files should be added to path
<br /><br />
At the moment, anything that needs to use the libvirt dll files
(i.e. the C# bindings) won't automatically find them. This can be
worked around by copying the dll files into the same directory as
whatever needs them, but is probably not an optimal approach.
There might be a better way and needs to be investigated.
</li>
</ul> </ul>
<h2><a name="conntypes">Connection types</h2> <h2><a name="conntypes">Connection types</a></h2>
<p> <p>
These connection types are known to work: These connection types are known to work:
@ -118,26 +102,34 @@
Please let us know either the results (either way) if you do. Please let us know either the results (either way) if you do.
</p> </p>
<p>
<b>Special note</b> - Support for VirtualBox *on windows* was added in
libvirt 0.8.7, so reports on success and failure if you're using that
would be really helpful and appreciated.
</p>
<p> <p>
<b>WARNING - The qemu+tcp:// connection type passes all traffic <b>WARNING - The qemu+tcp:// connection type passes all traffic
without encryption. This is a security hazard, and should <i>not</i> without encryption. This is a security hazard, and should <i>not</i>
be used in security sensitive environments.</b> be used in security sensitive environments.</b>
</p> </p>
<h2><a name="esx">Connecting to VMware ESX/vSphere</h2> <h2><a name="esx">Connecting to VMware ESX/vSphere</a></h2>
<p> <p>
Details on the capabilities and connection string syntax used for Details on the capabilities, certificates, and connection string
connecting to VMware ESX and vSphere can be found online here:<br /> syntax used for connecting to VMware ESX and vSphere can be found
online here:<br />
</p> </p>
<a href="http://libvirt.org/drvesx.html">http://libvirt.org/drvesx.html</a> <a href="http://libvirt.org/drvesx.html">http://libvirt.org/drvesx.html</a>
<h2><a name="tlscerts">TLS Certificates</h2> <h2><a name="tlscerts">TLS Certificates</a></h2>
<p> <p>
TLS certificates are needed prior to connecting to either QEMU TLS certificates need to have been created and placed in the correct
instances with TLS, or connecting to VMware ESX/vSphere. locations, before you will be able to connect to QEMU servers over
TLS.
</p> </p>
<p> <p>
@ -154,8 +146,8 @@
</p> </p>
<p> <p>
The locations of the TLS certificates and key file are hard coded, The locations of the TLS certificates and key file on Windows are hard
rather than being configurable. coded, rather than being configurable.
</p> </p>
<p> <p>
@ -192,7 +184,7 @@
<li>C:\Users\someuser\AppData\Roaming\libvirt\pki\libvirt\private\clientkey.pem</li> <li>C:\Users\someuser\AppData\Roaming\libvirt\pki\libvirt\private\clientkey.pem</li>
</ul> </ul>
<h2><a name="feedback">Feedback</h2> <h2><a name="feedback">Feedback</a></h2>
<p> <p>
Feedback and suggestions on changes to make and what else to include Feedback and suggestions on changes to make and what else to include

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