summaryrefslogtreecommitdiff
path: root/daemon
Commit message (Collapse)AuthorAgeFilesLines
* Make SASL work over UNIX domain socketsDaniel P. Berrange2010-09-221-0/+8
| | | | | | | | | | | | | The addrToString methods were not coping with UNIX domain sockets which have no normal host+port address. Hardcode special handling for these so that SASL routines can work over UNIX sockets. Also fix up SSF logic in remote client so that it presumes that a UNIX socket is secure * daemon/remote.c: Fix addrToString for UNIX sockets. * src/remote/remote_driver.c: Fix addrToString for UNIX sockets and fix SSF logic to work for TLS + UNIX sockets in the same manner
* Refactor some daemon code to facilitate introduction of static probesDaniel P. Berrange2010-09-222-96/+147
| | | | | | | | | | | | Refactor some daemon code to facilitate the introductioin of static probes, sanitizing function exit paths in many places * daemon/libvirtd.c: Pass the dname string into remoteCheckDN to let caller deal with failure paths. Add separate exit paths to remoteCheckCertificate for auth failure vs denial. Merge all exit paths in qemudDispatchServer to one cleanup block * daemon/remote.c: Add separate exit paths to SASL & PolicyKit functions for auth failure vs denial
* libvirtd: improve the error message displayed on tls client auth failureJustin Clift2010-09-161-1/+1
| | | | | | This address BZ # 556599: https://bugzilla.redhat.com/show_bug.cgi?id=556599
* Fix dependancies for remote generated filesDaniel P. Berrange2010-09-101-8/+11
| | | | | | | | | | Very occasionally during a parallel make, dispatch.c would be compiled before the generated remote headers had been fully written. This would cause it to compile an empty union, and result in really wierd runtime bugs that are near impossible to diagnose. * daemon/Makefile.am: Fix remote build deps
* Ensure remote daemon unions are always non-zero lengthDaniel P. Berrange2010-09-101-0/+4
| | | | | | | | | If the remote daemon args/ret unions ever become zero length (due to a build / Makefile bug) then bad stuff happens at runtime. Add a compile time assertion to check for this kind of problem * daemon/remote.h: Ensure non-zero length unions
* build: Fix permissions of sysconfig filesJiri Denemark2010-09-071-1/+1
|
* maint: track moved fileEric Blake2010-08-311-1/+0
| | | | | * daemon/.gitignore: Move libvirt-guests.init... * tools/.gitignore: ...to its new location.
* Move libvirt-guests init script and config to toolsJiri Denemark2010-08-253-377/+4
| | | | | | | | Since libvirt-guests init script and its configuration do not require libvirtd to be running/installed, it was a bad idea to put them into daemon directory. libvirt.spec even includes these files in libvirt-client subpackage, which may result in build failure for client-only builds when the whole daemon directory is just skipped.
* Try harder to send RPC error message back to clientDaniel P. Berrange2010-08-241-17/+28
| | | | | | | | | When failing to serialize the normal RPC reply, try harder to send a error message back to the client, instead of immediately closing the connection. * daemon/dispatch.c: Improve error messages when RPC reply can not be sent
* Add explicit warning messages when failing to serialize to XDRDaniel P. Berrange2010-08-241-0/+6
| | | | | | | | | When libvirtd fails to serialize a message to XDR the client connection is terminated immediately. To enable this to be diagnosed, log the message which caused the problem on the server * daemon/dispatch.c: Log XDR serialization failures
* build-sys: fix build when daemon is disabled by not installing libvirtd.8Diego Elio Pettenò2010-08-061-2/+2
| | | | | | Since the rule to build libvirtd.8 is within the WITH_LIBVIRTD conditional, so declare the man page in there as well. Without this change, build without daemon will fail.
* build: distribute libvirt_qemu.symsEric Blake2010-07-291-0/+4
| | | | | | * src/Makefile.am (EXTRA_DIST): Ensure 'make distcheck' and 'rpmbuild' can reproduce a build. * daemon/Makefile.am (DAEMON_SOURCES): Likewise.
* build: restore operation of bit-rotted 'make cov'Eric Blake2010-07-291-2/+0
| | | | | | | | | | | | | | | | | | | | './autobuild.sh' with lcov installed discovered that our coverage support has been bit-rotting for a while. This restores it back to a successful state, although I have not yet spent any time looking through the resulting files to look for low-hanging fruit in the unit test coverage front. * configure.ac: Clear COMPILER_FLAGS at right place. * Makefile.am (cov): Newer genhtml no longer likes plain -s. * m4/compiler-flags.m4 (gl_COMPILER_FLAGS): Don't AC_SUBST COMPILER_FLAGS; it is a shell variable for use in configure only. * src/Makefile.am (AM_CFLAGS, AM_LDFLAGS): New variables, to make it easier to provide global flag additions. Use throughout, to uniformly apply coverage flags. * .gitignore: Globally ignore gcov output. * daemon/.gitignore: Simplify. * src/.gitignore: Likewise. * tests/.gitignore: Likewise.
* libvirt-guests: add reload, condrestartEric Blake2010-07-281-2/+6
| | | | | | | | Optional per LSB, but required by Fedora: https://fedoraproject.org/wiki/Packaging/SysVInitScript * daemon/libvirt-guests.init.in (main): Add more required commands.
* libvirt-guests: enhance statusEric Blake2010-07-281-6/+20
| | | | | | | | | | LSB and https://fedoraproject.org/wiki/Packaging/SysVInitScript require status to output something useful, rather than just use the exit code. * daemon/libvirt-guests.init.in (rh_status): Break into new routine, and provide output. (usage): Document status.
* libvirt-guests: detect invalid argumentsEric Blake2010-07-281-2/+14
| | | | | | | | | | Reject extra arguments. Return the correct status for unknown arguments, as mandated by https://fedoraproject.org/wiki/Packaging/SysVInitScript Add --help, as a permitted extension. * daemon/libvirt-guests.init.in (usage): New function. Use it in more places, and return correct value.
* libvirt-guests: Don't throw errors if libvirtd is not installedJiri Denemark2010-07-271-0/+7
| | | | | | | | | | | | | | | | | When only client parts of libvirt are installed (i.e., no libvirtd daemon), libvirt-guests init script in its default configuration would throw seriously looking errors during host shutdown: Running guests on default URI: error: unable to connect to '/var/run/libvirt/libvirt-sock', libvirtd may need to be started: No such file or directory error: failed to connect to the hypervisor This patch changes the script to print rather harmless message in that situation: Running guests on default URI: libvirtd not installed; skipping this URI.
* Qemu remote protocol.Chris Lalancette2010-07-2310-43/+185
| | | | | | | | | | | | | | | | | | | | | | | Since we are adding a new "per-hypervisor" protocol, we make it so that the qemu remote protocol uses a new PROTOCOL and PROGRAM number. This allows us to easily distinguish it from the normal REMOTE protocol. This necessitates changing the proc in remote_message_header from a "remote_procedure" to an "unsigned", which should be the same size (and thus preserve the on-wire protocol). Changes since v1: - Fixed up a couple of script problems in remote_generate_stubs.pl - Switch an int flag to a bool in dispatch.c Changes since v2: - None Changes since v3: - Change unsigned proc to signed proc, to conform to spec Signed-off-by: Chris Lalancette <clalance@redhat.com>
* man pages: update authors and copyright notice for libvirtd and virshJustin Clift2010-07-171-23/+3
| | | | | | | | | | This patch removes the individual author names from the libvirtd and virsh man pages, instead referring to the main AUTHORS file distributed with libvirt. This approach is needed, as we can't guarantee unicode support across all versions of pod2man used with libvirt. Additionally, this patch includes the libvirtd man page in the spec file used with "make rpm". Without this patch "make rpm" is broken.
* daemon: dispatch.c should include stdio.h (and stdarg.h)Ryota Ozaki2010-07-151-0/+3
| | | | | | | | | | | | | | dispatch.c requires stdio.h (and stdarg.h), however, currently dispatch.c implicitly relys on rpc/xdr.h to include stdio.h. If rpc/xdr.h unxpectedly does not include stdio.h, the compilation of dispatch.c fails. This can happen, for example, when portablexdr is installed under /usr/local; because portablexdr's rpc/xdr.h does not include stdio.h and gcc looks up it not /usr/include/rpc/xdr.h. Note that stdarg.h is also included according to man va_start, although stdio.h seems including it anyway.
* .gitignore: Ignore generated libvirtd docsCole Robinson2010-07-131-0/+2
|
* Fix build by removing unknown pod2man flagDaniel P. Berrange2010-07-121-1/+1
| | | | | | | Some versions of pod2man do not support the -u flag, so this can't be used * daemon/Makefile.am: Remove -u flag from pod2man
* libvirtd: add man page for libvirtdJustin Clift2010-07-102-1/+206
| | | | | | | | | With gracious thanks to Chris Lalancette for helping knock the description section into shape. This addresses BZ #595350 https://bugzilla.redhat.com/show_bug.cgi?id=595350
* Fix a reference leak for node devices.Chris Lalancette2010-06-261-0/+15
| | | | | | | | | | | | | | | There were some major, and some minor bugs having to do with the reference counting of node devices in daemon/remote.c. Some functions were completely failing to unreference node devices; this would lead to many open file descriptors, which would eventually fail. The minor bugs were along the same lines, but were in rarely used error paths. Signed-off-by: Chris Lalancette <clalance@redhat.com> Signed-off-by: Matthias Bolte <matthias.bolte@googlemail.com>
* Don't leak open fd to virsh in libvirt-guests init scriptJiri Denemark2010-06-221-1/+1
| | | | | | | Running virsh while having /var/lib/libvirt/libvirt-guests file open makes SELinux emit messages about preventing virsh from reading that file. Since virsh doesn't really want to read anything, it's better to run it with /dev/null on stdin to prevent those messages.
* Add several missing vir*Free calls in libvirtd's remote codeMatthias Bolte2010-06-161-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Justin Clift reported a problem with adding virStoragePoolIsPersistent to virsh's pool-info command, resulting in a strange problem. Here's an example: virsh # pool-create-as images_dir3 dir - - - - "/home/images2" Pool images_dir3 created virsh # pool-info images_dir3 Name: images_dir3 UUID: 90301885-94eb-4ca7-14c2-f30b25a29a36 State: running Capacity: 395.20 GB Allocation: 30.88 GB Available: 364.33 GB virsh # pool-destroy images_dir3 Pool images_dir3 destroyed At this point the images_dir3 pool should be gone (because it was transient) and we should be able to create a new pool with the same name: virsh # pool-create-as images_dir3 dir - - - - "/home/images2" Pool images_dir3 created virsh # pool-info images_dir3 Name: images_dir3 UUID: 90301885-94eb-4ca7-14c2-f30b25a29a36 error: Storage pool not found The new pool got the same UUID as the first one, but we didn't specify one. libvirt should have picked a random UUID, but it didn't. It turned out that virStoragePoolIsPersistent leaks a reference to the storage pool object (actually remoteDispatchStoragePoolIsPersistent does). As a result, pool-destroy doesn't remove the virStoragePool for the "images_dir3" pool from the virConnectPtr's storagePools hash on libvirtd's side. Then the second pool-create-as get's the stale virStoragePool object associated with the "images_dir3" name. But this object has the old UUID. This commit ensures that all get_nonnull_* and make_nonnull_* calls for libvirt objects are matched properly with vir*Free calls. This fixes the reference leaks and the reported problem. All remoteDispatch*IsActive and remoteDispatch*IsPersistent functions were affected. But also remoteDispatchDomainMigrateFinish2 was affected in the success path. I wonder why that didn't surface earlier. Probably because domainMigrateFinish2 is executed on the destination host and in the common case this connection is opened especially for the migration and gets closed after the migration is done. So there was no chance to run into a problem because of the leaked reference.
* remote: protocol implementation for virDomainCreateWithFlagsEric Blake2010-06-155-0/+43
| | | | | | | | | | | | | | | | | | | | Define the wire format for the new virDomainCreateWithFlags API, and implement client and server side of marshaling code. * daemon/remote.c (remoteDispatchDomainCreateWithFlags): Add server side dispatch for virDomainCreateWithFlags. * src/remote/remote_driver.c (remoteDomainCreateWithFlags) (remote_driver): Client side serialization. * src/remote/remote_protocol.x (remote_domain_create_with_flags_args) (remote_domain_create_with_flags_ret) (REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS): Define wire format. * daemon/remote_dispatch_args.h: Regenerate. * daemon/remote_dispatch_prototypes.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.
* Ensure UNIX domain sockets are removed on daemon shutdownDaniel P. Berrange2010-06-082-59/+70
| | | | | | | | | | | | When libvirtd exits it is leaving UNIX domain sockets on the filesystem. These need to be removed. The qemudInitPaths() method has signficant code churn to switch from using a pre-allocated buffer on the stack, to dynamically allocating on the heap. * daemon/libvirtd.c, daemon/libvirtd.h: Store a reference to the UNIX domain socket path and unlink it on shutdown
* build: depend on correct fileEric Blake2010-06-011-1/+1
| | | | | | | | | | | Otherwise, VPATH builds fail with: make[1]: *** No rule to make target `libvirt-guests.init', needed by `all'. Regression introduced in commit 482e08a9. * daemon/Makefile.am (%.init): Look in correct place for config.status.
* Fix libvirt-guests init scriptJiri Denemark2010-05-281-9/+18
| | | | | | | | | | | | | | Firstly, the init script has to touch its file under /var/lock/subsys when started, otherwise the system would think it's not running and won't stop it during shutdown. Secondly, for some reason there is a policy to automatically enable init scripts when they are installed, so let the specfile do this. We also need to start the init script to ensure it will be stopped during the first shutdown after installing the package. Also $LISTFILE should be enclosed by quotes everywhere as suggested by Eric.
* daemon: sysconf: Update comment about VNC audioCole Robinson2010-05-261-1/+2
|
* libvirtd: diagnose invalid host UUIDJim Meyering2010-05-251-1/+3
| | | | | * daemon/libvirtd.c (remoteReadConfigFile): Diagnose an invalid host UUID rather than silently exiting with status 7.
* Expose a host UUID in the capabilities XMLDaniel P. Berrange2010-05-252-0/+22
| | | | | | | | | | | | | | | | | | | | Allow for a host UUID in the capabilities XML. Local drivers will initialize this from the SMBIOS data. If a sanity check shows SMBIOS uuid is invalid, allow an override from the libvirtd.conf configuration file * daemon/libvirtd.c, daemon/libvirtd.conf: Support a host_uuid configuration option * docs/schemas/capability.rng: Add optional host uuid field * src/conf/capabilities.c, src/conf/capabilities.h: Include host UUID in XML * src/libvirt_private.syms: Export new uuid.h functions * src/lxc/lxc_conf.c, src/qemu/qemu_driver.c, src/uml/uml_conf.c: Set host UUID in capabilities * src/util/uuid.c, src/util/uuid.h: Support for host UUIDs * src/node_device/node_device_udev.c: Use the host UUID functions * tests/confdata/libvirtd.conf, tests/confdata/libvirtd.out: Add new host_uuid config option to test
* libvirtd: start each diagnostic with "argv0: "Jim Meyering2010-05-221-13/+15
| | | | | | | | | | | Some diagnostics had a hard-coded "libvirtd: " prefix, some used "error: " and some used "argv[0]: ". Always use "argv[0]: ". * daemon/libvirtd.c (argv0): New global. (main): Set it. (version, usage): Remove argv0 parameter. Use global; update callers. (daemonForkIntoBackground): Use argv0:, not error:. (qemudWritePidFile): Start each diagnostic with argv0:. Suggested by Eric Blake.
* libvirtd: mark strings for translation, including --help outputJim Meyering2010-05-221-15/+21
| | | | | | | | | | | * daemon/libvirtd.c (daemonForkIntoBackground, main): Mark strings for translation. (usage): Rework --help so that it is translatable, replacing each embedded, configuration-dependent, macro with an `%s'. libvirtd: don't ignore virInitialize failure * daemon/libvirtd.c (main): Diagnose virInitialize failure and exit nonzero.
* build: force init scripts to rebuild on changed --prefixEric Blake2010-05-211-1/+1
| | | | | | | | | Otherwise, './configure --prefix=/foo && make && ./configure --prefix=/bar && make' leaves the wrong files in libvirtd.init (/foo instead of /bar). * daemon/Makefile.am (libvirtd.init): Add dependency on config.status. Reported by Cole Robinson.
* .gitignore: Add libvirt-guests.initCole Robinson2010-05-211-0/+1
|
* daemon: Export SDL audio environment variablesCole Robinson2010-05-211-0/+3
| | | | | | | | | | | /etc/sysconfig/libvirtd has a few environment variables for configuring libvirt SDL audio. The libvirtd process doesn't see these, however, because they are never exported. Let's export the variables after sourcing the sysconfig script. There is another problem here that the commented out values in the sysconfig script are not neccessarily the actual defaults, we are qemus mercy here. Not sure how to solve that.
* Init script for handling guests on shutdown/bootJiri Denemark2010-05-213-4/+331
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example output during shutdown: Running guests on default URI: console, rhel6-1, rhel5-64 Running guests on lxc:/// URI: lxc-shell Running guests on xen:/// URI: error: no hypervisor driver available for xen:/// error: failed to connect to the hypervisor Running guests on vbox+tcp://orkuz/system URI: no running guests. Suspending guests on default URI... Suspending console: done Suspending rhel6-1: done Suspending rhel5-64: done Suspending guests on lxc:/// URI... Suspending lxc-shell: error: Failed to save domain 9cba8bfb-56f4-6589-2d12-8a58c886dd3b state error: this function is not supported by the hypervisor: virDomainManagedSave Note, the "Suspending $guest: " shows progress during the suspend phase if domjobinfo gives meaningful output. Example output during boot: Resuming guests on default URI... Resuming guest rhel6-1: done Resuming guest rhel5-64: done Resuming guest console: done Resuming guests on lxc:/// URI... Resuming guest lxc-shell: already active Configuration used for generating the examples above: URIS='default lxc:/// xen:/// vbox+tcp://orkuz/system' The script uses /var/lib/libvirt/libvirt-guests files to note all active guest it should try to resume on next boot. It's content looks like: default 7f8b9d93-30e1-f0b9-47a7-cb408482654b 085b4c95-5da2-e8e1-712f-6ea6a4156af2 fb4d8360-5305-df3a-2da1-07d682891b8c lxc:/// 9cba8bfb-56f4-6589-2d12-8a58c886dd3b
* maint: more of same, but manual: convert VIR_ERROR("%s" to VIR_ERROR0(Jim Meyering2010-05-201-2/+1
|
* maint: mark translatable string args of VIR_ERRORJim Meyering2010-05-201-1/+1
| | | | | | Run this: git grep -l 'VIR_ERROR\s*("'|xargs perl -pi -e \ 's/(VIR_ERROR)\s*\((".*?"),/$1(_($2),/'
* maint: mark translatable string args of VIR_ERROR0Jim Meyering2010-05-201-3/+3
| | | | | | Run this: git grep -l 'VIR_ERROR0\s*("'|xargs perl -pi -e \ 's/(VIR_ERROR0)\s*\((".*?")\)/$1(_($2))/'
* maint: use VIR_ERROR0 rather than VIR_ERROR with a bare "%s"Jim Meyering2010-05-201-6/+6
| | | | | | | | | | | | | | Change VIR_ERROR("%s", "..." to VIR_ERROR0("..." and Change VIR_ERROR("%s", _("...") to VIR_ERROR0(_("...") Use this command: git grep -E -l 'VIR_ERROR\("%s", (_\()?"'|xargs perl -pi -e \ 's/VIR_ERROR\("%s", (_\()?"/VIR_ERROR0($1"/'
* daemon: A few initscript correctionsCole Robinson2010-05-201-3/+3
| | | | | | | Fedora bug https://bugzilla.redhat.com/show_bug.cgi?id=565238 - Avahi service is called 'avahi-daemon' - chkconfig descriptions must use \ for line continuations
* libvirtd: don't ignore virInitialize failureJim Meyering2010-05-201-1/+4
| | | | | * daemon/libvirtd.c (main): Diagnose virInitialize failure and exit nonzero.
* docs: distribute more coding convention documentationEric Blake2010-05-191-0/+1
| | | | | | | | These files may be useful for anyone making modifications to source files in a tarball distribution. * src/Makefile.am (EXTRA_DIST): Add THREADS.txt. * daemon/Makefile.am (EXTRA_DIST): Add THREADING.txt.
* maint: don't mark VIR_WARN or VIR_WARN0 diagnostics for translationJim Meyering2010-05-191-3/+3
| | | | | | | | | | | Approximately 60 messages were marked. Since these diagnostics are intended solely for developers and maintainers, encouraging translation is deemed to be counterproductive: http://thread.gmane.org/gmane.comp.emulators.libvirt/25050/focus=25052 Run this command: git grep -l VIR_WARN|xargs perl -pi -e \ 's/(VIR_WARN0?)\s*\(_\((".*?")\)/$1($2/'
* Add support for another explicit IO error eventDaniel P. Berrange2010-04-302-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a new event type VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON This event is the same as the previous VIR_DOMAIN_ID_IO_ERROR event, but also includes a string describing the cause of the event. Thus there is a new callback definition for this event type typedef void (*virConnectDomainEventIOErrorReasonCallback)(virConnectPtr conn, virDomainPtr dom, const char *srcPath, const char *devAlias, int action, const char *reason, void *opaque); This is currently wired up to the QEMU block IO error events * daemon/remote.c: Dispatch IO error events to client * examples/domain-events/events-c/event-test.c: Watch for IO error events * include/libvirt/libvirt.h.in: Define new IO error event ID and callback signature * src/conf/domain_event.c, src/conf/domain_event.h, src/libvirt_private.syms: Extend API to handle IO error events * src/qemu/qemu_driver.c: Connect to the QEMU monitor event for block IO errors and emit a libvirt IO error event * src/remote/remote_driver.c: Receive and dispatch IO error events to application * src/remote/remote_protocol.x: Wire protocol definition for IO error events * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h, src/qemu/qemu_monitor_json.c: Watch for BLOCK_IO_ERROR event from QEMU monitor
* Remote protocol impl for virDomainGetBlockInfoDaniel P. Berrange2010-04-295-0/+49
| | | | | | | | | | * daemon/remote.c: Server side dispatcher * daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h, daemon/remote_dispatch_ret.h, daemon/remote_dispatch_table.h: Update with new API * src/remote/remote_driver.c: Client side dispatcher * src/remote/remote_protocol.c, src/remote/remote_protocol.h: Update * src/remote/remote_protocol.x: Define new wire protocol
* Fix a memory leak in the snapshot code in libvirtd.Chris Lalancette2010-04-231-42/+65
| | | | | | | | | | | | While running libvirtd under valgrind and doing some snapshot testing I noticed that we would always leak a connection reference. The problem was actually that we were leaking a domain reference in the libvirtd remote snapshot code, which was in turn causing a leaked connection reference. Fix the situation by explicitly taking and dropping a domain reference where we need it. Signed-off-by: Chris Lalancette <clalance@redhat.com>