- 18 7月, 2012 1 次提交
-
-
由 Daniel P. Berrange 提交于
The virNetServerMDNSTimeoutNew method was casting a long long to an int when reporting errors. This should just be using %lld instead of %d, avoiding the need to cast Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 12 7月, 2012 1 次提交
-
-
由 Christophe Fergeau 提交于
Commit 32a9aac2 switched libvirt to use the XDG base directories to locate most of its data/config. In particular, the per-user socket for qemu:///session is now stored in the XDG runtime directory. This directory is located by looking at the XDG_RUNTIME_DIR environment variable, with a fallback to ~/.cache/libvirt if this variable is not set. When the daemon is autospawned because a client application wants to use qemu:///session, the daemon is ran in a clean environment which does not contain XDG_RUNTIME_DIR. It will create its socket in ~/.cache/libvirt. If the client application has XDG_RUNTIME_DIR set, it will not look for the socket in the fallback place, and will fail to connect to the autospawned daemon. This patch adds XDG_RUNTIME_DIR to the daemon environment before auto-starting it. I've done this in virNetSocketForkDaemon rather than in virCommandAddEnvPassCommon as I wasn't sure we want to pass these variables to other commands libvirt spawns. XDG_CACHE_HOME and XDG_CONFIG_HOME are also added to the daemon env as it makes use of those as well.
-
- 05 7月, 2012 2 次提交
-
-
由 Daniel P. Berrange 提交于
Refactor the RPC server dispatcher code so that if 'max_workers==0' the entire server will run single threaded. This is useful for use cases where there will only ever be 1 client connected which serializes its requests Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
由 Daniel P. Berrange 提交于
The callback that is invoked when a new RPC client is initialized does not have any opaque parameter. Add one so that custom data can be passed into the callback Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 23 6月, 2012 1 次提交
-
-
由 Hu Tao 提交于
The test of ref count is not protected by lock, which is unsafe because the ref count may have been changed by other threads during the test. This patch fixes this.
-
- 22 6月, 2012 1 次提交
-
-
由 Jim Fehlig 提交于
When shutting down libvirtd, the virNetServer shutdown can deadlock if there are in-flight jobs being handled by virNetServerHandleJob(). virNetServerFree() will acquire the virNetServer lock and call virThreadPoolFree() to terminate the workers, waiting for the workers to finish. But in-flight workers will attempt to acquire the virNetServer lock, resulting in deadlock. Fix the deadlock by unlocking the virNetServer lock before calling virThreadPoolFree(). This is safe since the virNetServerPtr object is ref-counted and only decrementing the ref count needs to be protected. Additionally, there is no need to re-acquire the lock after virThreadPoolFree() completes as all the workers have terminated.
-
- 13 6月, 2012 13 次提交
-
-
由 Daniel P. Berrange 提交于
First 'poll' can't return EWOULDBLOCK, and second, we're checking errno so far away from the poll() call that we've probably already trashed the original errno value.
-
由 Jiri Denemark 提交于
In addition to keepalive responses, we also need to send keepalive requests from client IO loop to properly detect dead connection in case a libvirt API is called from the main loop, which prevents any timers to be called.
-
由 Jiri Denemark 提交于
We don't need to add or remove filters when client object is already locked anymore. There's no reason to keep the *Locked variants of those APIs.
-
由 Jiri Denemark 提交于
The previous commit removed the only usage of ``all'' parameter in virKeepAliveStopInternal, which was actually the only reason for having virKeepAliveStopInternal. This effectively reverts most of commit 6446a9e2.
-
由 Jiri Denemark 提交于
When a libvirt API is called from the main event loop (which seems to be common in event-based glib apps), the client IO loop would properly handle keepalive requests sent by a server but will not actually send them because the main event loop is blocked with the API. This patch gets rid of response timer and the thread which is processing keepalive requests is also responsible for queueing responses for delivery.
-
由 Jiri Denemark 提交于
This makes it possible to create and queue new calls while we are running IO loop.
-
由 Jiri Denemark 提交于
Add virKeepAliveTimeout and virKeepAliveTrigger APIs that can be used to set poll timeouts and trigger keepalive timer. virKeepAliveTrigger checks if it is called to early and does nothing in that case.
-
由 Jiri Denemark 提交于
The code that needs to be run every keepalive interval of inactivity was only called from a timer and thus from the main event loop. We will need to call the code directly from another place.
-
由 Jiri Denemark 提交于
As we never drop non-blocking calls, the return value that used to indicate a call was dropped is no longer needed.
-
由 Jiri Denemark 提交于
As non-blocking calls are no longer dropped, we don't really need to care that much about their fate and wait for the thread with the buck to process them. If another thread has the buck, we can just push a non-blocking call to the queue and be done with it.
-
由 Jiri Denemark 提交于
So far, we were dropping non-blocking calls whenever sending them would block. In case a client is sending lots of stream calls (which are not supposed to generate any reply), the assumption that having other calls in a queue is sufficient to get a reply from the server doesn't work. I tried to fix this in b1e374a7 but failed and reverted that commit. With this patch, non-blocking calls are never dropped (unless the connection is being closed) and will always be sent.
-
由 Jiri Denemark 提交于
Normally, when every call has a thread associated with it, the thread may get the buck and be in charge of sending all calls until its own call is done. When we introduced non-blocking calls, we had to add special handling of new non-blocking calls. This patch uses event loop to send data if there is no thread to get the buck so that any non-blocking calls left in the queue are properly sent without having to handle them specially. It also avoids adding even more cruft to client IO loop in the following patches. With this change in, non-blocking calls may see unpredictable delays in delivery when the client has no event loop registered. However, the only non-blocking calls we have are keepalives and we already require event loop for them, which makes this a non-issue until someone introduces new non-blocking calls.
-
由 Jiri Denemark 提交于
When analyzing our debug log, I'm always confused about what each of the pointers mean. Let's be explicit.
-
- 11 6月, 2012 1 次提交
-
-
由 Michal Privoznik 提交于
My latest patch for RPC rework (a2c304f6) introduced a memory leak. virNetMessageEncodeHeader() is calling VIR_ALLOC_N(msg->buffer, ...) despite fact, that msg->buffer isn't VIR_FREE()'d on all paths calling the function. Therefore, rather than injecting free statement switch to VIR_REALLOC_N().
-
- 05 6月, 2012 2 次提交
-
-
由 Michal Privoznik 提交于
Since we are allocating RPC buffer dynamically, we can increase limits for max. size of RPC message and RPC string. This is needed to cover some corner cases where libvirt is run on such huge machines that their capabilities XML is 4 times bigger than our current limit. This leaves users with inability to even connect.
-
由 Michal Privoznik 提交于
Currently, we are allocating buffer for RPC messages statically. This is not such pain when RPC limits are small. However, if we want ever to increase those limits, we need to allocate buffer dynamically, based on RPC message len (= the first 4 bytes). Therefore we will decrease our mem usage in most cases and still be flexible enough in corner cases.
-
- 04 6月, 2012 1 次提交
-
-
由 Radu Caragea 提交于
The stream lock is unlocked twice instead of being locked and then unlocked. Probably a typo.
-
- 28 5月, 2012 2 次提交
-
-
由 Daniel P. Berrange 提交于
Remove the uid param from virGetUserConfigDirectory, virGetUserCacheDirectory, virGetUserRuntimeDirectory, and virGetUserDirectory These functions were universally called with the results of getuid() or geteuid(). To make it practical to port to Win32, remove the uid parameter and hardcode geteuid() Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
由 Daniel P. Berrange 提交于
When you try to connect to a socket in the abstract namespace, the error will be ECONNREFUSED for a non-listening daemon. With the non-abstract namespace though, you instead get ENOENT. Add a check for this extra errno when auto-spawning the daemon Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 23 5月, 2012 1 次提交
-
-
由 Jiri Denemark 提交于
This reverts commit b1e374a7, which was rather bad since I failed to consider all sides of the issue. The main things I didn't consider properly are: - a thread which sends a non-blocking call waits for the thread with the buck to process the call - the code doesn't expect non-blocking calls to remain in the queue unless they were already partially sent Thus, the reverted patch actually breaks more than what it fixes and clients (which may even be libvirtd during p2p migrations) will likely end up in a deadlock.
-
- 26 4月, 2012 2 次提交
-
-
由 Jiri Denemark 提交于
Currently, non-blocking calls are either sent immediately or discarded in case sending would block. This was implemented based on the assumption that the non-blocking keepalive call is not needed as there are other calls in the queue which would keep the connection alive. However, if those calls are no-reply calls (such as those carrying stream data), the remote party knows the connection is alive but since we don't get any reply from it, we think the connection is dead. This is most visible in tunnelled migration. If it happens to be longer than keepalive timeout (30s by default), it may be unexpectedly aborted because the connection is considered to be dead. With this patch, we only discard non-blocking calls when the last call with a thread is completed and thus there is no thread left to keep sending the remaining non-blocking calls.
-
由 Peter Krempa 提交于
The docs for virConnectSetKeepAlive() advertise that this function should be able to disable keepalives on negative or zero interval time. This patch removes the check that prohibited this and adds code to disable keepalives on negative/zero interval. * src/libvirt.c: virConnectSetKeepAlive(): - remove check for negative values * src/rpc/virnetclient.c * src/rpc/virnetclient.h: - add virNetClientKeepAliveStop() to disable keepalive messages * src/remote/remote_driver.c: remoteSetKeepAlive(): -add ability to disable keepalives
-
- 20 4月, 2012 2 次提交
-
-
由 Eric Blake 提交于
POSIX says that sa_sigaction is only safe to use if sa_flags includes SA_SIGINFO; conversely, sa_handler is only safe to use when flags excludes that bit. Gnulib doesn't guarantee an implementation of SA_SIGINFO, but does guarantee that if SA_SIGINFO is undefined, we can safely define it to 0 as long as we don't dereference the 2nd or 3rd argument of any handler otherwise registered via sa_sigaction. Based on a report by Wen Congyang. * src/rpc/virnetserver.c (SA_SIGINFO): Stub for mingw. (virNetServerSignalHandler): Avoid bogus dereference. (virNetServerFatalSignal, virNetServerNew): Set flags properly. (virNetServerAddSignalHandler): Drop unneeded #ifdef.
-
由 Daniel P. Berrange 提交于
DBus connection. The HAL device code further requires that the DBus connection is integrated with the event loop and provides such glue logic itself. The forthcoming FirewallD integration also requires a dbus connection with event loop integration. Thus we need to pull the current event loop glue out of the HAL driver. Thus we create src/util/virdbus.{c,h} files. This contains just one method virDBusGetSystemBus() which obtains a handle to the single shared system bus instance, with event glue automagically setup.
-
- 10 4月, 2012 1 次提交
-
-
由 Daniel P. Berrange 提交于
-
- 30 3月, 2012 1 次提交
-
-
由 Daniel P. Berrange 提交于
The code is splattered with a mix of sizeof foo sizeof (foo) sizeof(foo) Standardize on sizeof(foo) and add a syntax check rule to enforce it Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 08 3月, 2012 2 次提交
-
-
由 Eric Blake 提交于
Commit 5d4b0c4c tried to fix certain classes of VPATH builds, but was too limited. In particular, Guannan Ren reported: > For example: The libvirt source code resides in /home/testuser, > I make dist in /tmp/buildvpath, the XDR routine .c file will > include full path of the header file like: > > #include "/home/testuser/src/rpc/virnetprotocol.h" > #include "internal.h" > #include <arpa/inet.h> > > If we distribute the tarball to another machine to compile, > it will report error as follows: > > rpc/virnetprotocol.c:7:59: fatal error: > /home/testuser/src/rpc/virnetprotocol.h: No such file or directory * src/rpc/genprotocol.pl: Fix more include lines.
-
由 Eric Blake 提交于
On 64-bit platforms, unsigned long and unsigned long long are identical, so we don't have to worry about overflow checks. On 32-bit platforms, anywhere we narrow unsigned long long back to unsigned long, we have to worry about overflow; it's easier to do this in one place by having most of the code use the same or wider types, and only doing the narrowing at the last minute. Therefore, the memory set commands remain unsigned long, and the memory get command now centralizes the overflow check into libvirt.c, so that drivers don't have to repeat the work. This also fixes a bug where xen returned the wrong value on failure (most APIs return -1 on failure, but getMaxMemory must return 0 on failure). * src/driver.h (virDrvDomainGetMaxMemory): Use long long. * src/libvirt.c (virDomainGetMaxMemory): Raise overflow. * src/test/test_driver.c (testGetMaxMemory): Fix driver. * src/rpc/gendispatch.pl (name_to_ProcName): Likewise. * src/xen/xen_hypervisor.c (xenHypervisorGetMaxMemory): Likewise. * src/xen/xen_driver.c (xenUnifiedDomainGetMaxMemory): Likewise. * src/xen/xend_internal.c (xenDaemonDomainGetMaxMemory): Likewise. * src/xen/xend_internal.h (xenDaemonDomainGetMaxMemory): Likewise. * src/xen/xm_internal.c (xenXMDomainGetMaxMemory): Likewise. * src/xen/xm_internal.h (xenXMDomainGetMaxMemory): Likewise. * src/xen/xs_internal.c (xenStoreDomainGetMaxMemory): Likewise. * src/xen/xs_internal.h (xenStoreDomainGetMaxMemory): Likewise. * src/xenapi/xenapi_driver.c (xenapiDomainGetMaxMemory): Likewise. * src/esx/esx_driver.c (esxDomainGetMaxMemory): Likewise. * src/libxl/libxl_driver.c (libxlDomainGetMaxMemory): Likewise. * src/qemu/qemu_driver.c (qemudDomainGetMaxMemory): Likewise. * src/lxc/lxc_driver.c (lxcDomainGetMaxMemory): Likewise. * src/uml/uml_driver.c (umlDomainGetMaxMemory): Likewise.
-
- 05 3月, 2012 1 次提交
-
-
由 Jiri Denemark 提交于
A multi-threaded client with event loop may crash if one of its threads closes a connection while event loop is in the middle of sending keep-alive message (either request or response). The right place for it is inside virNetClientIOEventLoop() between poll() and virNetClientLock(). We should only close a connection directly if no-one is using it and defer the closing to the last user otherwise. So far we only did so if the close was initiated by keep-alive timeout.
-
- 02 3月, 2012 1 次提交
-
-
由 Eric Blake 提交于
Nuke the last vestiges of printing pid_t values with the wrong types, at least in code compiled on mingw64. There may be other places, but for now they are only compiled on systems where the existing %d doesn't trigger gcc warnings. * src/rpc/virnetsocket.c (virNetSocketNew): Use %lld and casting, rather than assuming any particular int type for pid_t. * src/util/command.c (virCommandRunAsync, virPidWait) (virPidAbort): Likewise. (verify): Drop a now stale assertion.
-
- 04 2月, 2012 2 次提交
-
-
由 Philipp Hahn 提交于
compat{a->i}bility erron{->e}ous nec{c->}essary. Either "the" or "a". Signed-off-by: NPhilipp Hahn <hahn@univention.de>
-
由 Eric Blake 提交于
Our HACKING discourages use of malloc and free, for at least a couple of years now. But we weren't enforcing it, until now :) For now, I've exempted python and tests, and will clean those up in subsequent patches. Examples should be permanently exempt, since anyone copying our examples won't have use of our internal-only memory.h via libvirt_util.la. * cfg.mk (sc_prohibit_raw_allocation): New rule. (exclude_file_name_regexp--sc_prohibit_raw_allocation): and exemptions. * src/cpu/cpu.c (cpuDataFree): Avoid false positive. * src/conf/network_conf.c (virNetworkDNSSrvDefParseXML): Fix offenders. * src/libxl/libxl_conf.c (libxlMakeDomBuildInfo, libxlMakeVfb) (libxlMakeDeviceModelInfo): Likewise. * src/rpc/virnetmessage.c (virNetMessageSaveError): Likewise. * tools/virsh.c (_vshMalloc, _vshCalloc): Likewise.
-
- 02 2月, 2012 1 次提交
-
-
由 Eric Blake 提交于
Qemu is adding the ability to do a partial rebase. That is, given: base <- intermediate <- current virDomainBlockPull will produce: current but qemu now has the ability to leave base in the chain, to produce: base <- current Note that current qemu can only do a forward merge, and only with the current image as the destination, which is fully described by this API without flags. But in the future, it may be possible to enhance this API for additional scenarios by using flags: Merging the current image back into a previous image (that is, undoing a live snapshot), could be done by passing base as the destination and flags with a bit requesting a backward merge. Merging any other part of the image chain, whether forwards (the backing image contents are pulled into the newer file) or backwards (the deltas recorded in the newer file are merged back into the backing file), could also be done by passing a new flag that says that base should be treated as an XML snippet rather than an absolute path name, where the XML could then supply the additional instructions of which part of the image chain is being merged into any other part. * include/libvirt/libvirt.h.in (virDomainBlockRebase): New declaration. * src/libvirt.c (virDomainBlockRebase): Implement it. * src/libvirt_public.syms (LIBVIRT_0.9.10): Export it. * src/driver.h (virDrvDomainBlockRebase): New driver callback. * src/rpc/gendispatch.pl (long_legacy): Add exemption. * docs/apibuild.py (long_legacy_functions): Likewise.
-
- 28 1月, 2012 1 次提交
-
-
由 Michal Privoznik 提交于
This API allows a domain to be put into one of S# ACPI states. Currently, S3 and S4 are supported. These states are shared with virNodeSuspendForDuration. However, for now we don't support any duration other than zero. The same apply for flags.
-