- 25 3月, 2014 1 次提交
-
-
由 Ján Tomko 提交于
-
- 21 3月, 2014 1 次提交
-
-
由 Martin Kletzander 提交于
Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
- 18 3月, 2014 3 次提交
-
-
由 Daniel P. Berrange 提交于
Any source file which calls the logging APIs now needs to have a VIR_LOG_INIT("source.name") declaration at the start of the file. This provides a static variable of the virLogSource type. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
由 Daniel P. Berrange 提交于
As part of the goal to get away from doing string matching on filenames when deciding whether to emit a log message, turn the virLogSource enum into a struct which contains a log "name". There will eventually be one virLogSource instance statically declared per source file. To minimise churn in this commit though, a single global instance is used. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
由 Daniel P. Berrange 提交于
The error reporting code will invoke a callback when any error is raised and the default callback will print to stderr. The virRaiseErrorFull method also sends all error messages on to the logging code, which also prints to stderr by default. To avoid duplicated data on stderr, the logging code has some logic to skip emission when no log outputs are configured, which checks whether the virLogSource == VIR_LOG_FROM_ERROR. Meanwhile the libvirtd daemon can register another callback which is used to reduce log message priority from error to a lower level. When this is used we do want messages to end up on stderr, so the error code will conditionally use either VIR_LOG_FROM_FILE or VIR_LOG_FROM_ERROR depending on whether such a callback is provided. This will all complicate later refactoring. By pushing the checks for whether a log output is present up a level into the error code, the special cases can be isolated in one place. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 11 3月, 2014 1 次提交
-
-
由 Daniel P. Berrange 提交于
GNULIB provides APIs for calculating md5 and sha256 hashes, but these APIs only return you raw byte arrays. Most users in libvirt want the hash in printable string format. Add some helper APIs in util/vircrypto.{c,h} for doing this. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 01 3月, 2014 1 次提交
-
-
由 Daniel P. Berrange 提交于
When a virError is raised, pass the error domain and code onto the systemd journald using metadata fields. This allows error messages to be queried by code eg $ journalctl LIBVIRT_CODE=43 Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 19 2月, 2014 1 次提交
-
-
由 Roman Bogorodskiy 提交于
At this point it has a limited functionality and is highly experimental. Supported domain operations are: * define * start * destroy * dumpxml * dominfo It's only possible to have only one disk device and only one network, which should be of type bridge.
-
- 06 1月, 2014 1 次提交
-
-
由 Eric Blake 提交于
Some of our operation denied messages are outright stupid; for example, if virIdentitySetAttr fails: error: operation Identity attribute is already set forbidden for read only access This patch fixes things to a saner: error: operation forbidden: Identity attribute is already set It also consolidates the most common usage pattern for operation denied errors: read-only connections preventing a public API. In this case, 'virsh -r -c test:///default destroy test' changes from: error: operation virDomainDestroy forbidden for read only access to: error: operation forbidden: read only access prevents virDomainDestroy Note that we were previously inconsistent on which APIs used VIR_FROM_DOM (such as virDomainDestroy) vs. VIR_FROM_NONE (such as virDomainPMSuspendForDuration). After this patch, all uses consistently use VIR_FROM_NONE, on the grounds that it is unlikely that a caller learning that a call is denied can do anything in particular with extra knowledge which error domain the call belongs to (similar to what we did in commit baa72449). * src/util/virerror.c (virErrorMsg): Rework OPERATION_DENIED error message. * src/internal.h (virCheckReadOnlyGoto): New macro. * src/util/virerror.h (virReportRestrictedError): New macro. * src/libvirt-lxc.c: Use new macros. * src/libvirt-qemu.c: Likewise. * src/libvirt.c: Likewise. * src/locking/lock_daemon.c (virLockDaemonClientNew): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 08 10月, 2013 2 次提交
-
-
由 Michal Privoznik 提交于
We currently have other error codes in singular form, e.g. VIR_ERR_NETWORK_EXIST. Cleanup the previous patch to match the form. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Hongwei Bi 提交于
I created a storage volume(eg: test) from a storage pool(eg:vg10) using the following command:"virsh vol-create-as --pool vg10 --name test --capacity 300M." When I re-executed the above command, the output was as the following: "error: Failed to create vol test error: Storage volume not found: storage vol 'test' already exists" I think the output "Storage volume not found" is not appropriate. Because in fact storage vol test has been found at this time. And then I think virErrorNumber should includes VIR_ERR_STORAGE_EXIST which can also be used elsewhere. So I make this patch. The result is as following: "error: Failed to create vol test error: storage volume 'test' exists already"
-
- 24 7月, 2013 1 次提交
-
-
由 Ján Tomko 提交于
As we do for other errors with an extra string.
-
- 22 7月, 2013 3 次提交
-
-
由 Daniel P. Berrange 提交于
Add virErrorSetErrnoFromLastError and virLastErrorIsSystemErrno to simplify code which wants to handle system errors in a more graceful fashion. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
由 Daniel P. Berrange 提交于
To register virtual machines and containers with systemd-machined, and thus have cgroups auto-created, we need to talk over DBus. This is somewhat tedious code, so introduce a dedicated function to isolate the DBus call in one place. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
由 Daniel P. Berrange 提交于
Doing DBus method calls using libdbus.so is tedious in the extreme. systemd developers came up with a nice high level API for DBus method calls (sd_bus_call_method). While systemd doesn't use libdbus.so, their API design can easily be ported to libdbus.so. This patch thus introduces methods virDBusCallMethod & virDBusMessageRead, which are based on the code used for sd_bus_call_method and sd_bus_message_read. This code in systemd is under the LGPLv2+, so we're license compatible. This code is probably pretty unintelligible unless you are familiar with the DBus type system. So I added some API docs trying to explain how to use them, as well as test cases to validate that I didn't screw up the adaptation from the original systemd code. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 10 7月, 2013 2 次提交
-
-
由 Michal Privoznik 提交于
Actually, I'm turning this function into a macro as filename, function name and line number needs to be passed. The new function virAsprintfInternal is introduced with the extended set of arguments.
-
由 Michal Privoznik 提交于
Similarly to VIR_STRDUP, we want the OOM error to be reported in VIR_ALLOC and friends.
-
- 24 6月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
This patch introduces the virAccessManagerPtr class as the interface between virtualization drivers and the access control drivers. The viraccessperm.h file defines the various permissions that will be used for each type of object libvirt manages Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 24 5月, 2013 1 次提交
-
-
由 Michal Privoznik 提交于
-
- 11 5月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
Apps using libvirt will often have code like if (virXXXX() < 0) { virErrorPtr err = virGetLastError(); fprintf(stderr, "Something failed: %s\n", err && err->message ? err->message : "unknown error"); return -1; } Checking for a NULL error object or message leads to very verbose code. A virGetLastErrorMessage() helper from libvirt can simplify this to if (virXXXX() < 0) { fprintf(stderr, "Something failed: %s\n", virGetLastErrorMessage()); return -1; } Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 02 5月, 2013 1 次提交
-
-
由 Michal Privoznik 提交于
The source code base needs to be adapted as well. Some files include virutil.h just for the string related functions (here, the include is substituted to match the new file), some include virutil.h without any need (here, the include is removed), and some require both.
-
- 16 4月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
Add a virCgroupIsolateMount method which looks at where the current process is place in the cgroups (eg /system/demo.lxc.libvirt) and then remounts the cgroups such that this sub-directory becomes the root directory from the current process' POV. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 19 3月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
Introduce a local object virIdentity for managing security attributes used to form a client application's identity. Instances of this object are intended to be used as if they were immutable, once created & populated with attributes Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 04 3月, 2013 1 次提交
-
-
由 Guannan Ren 提交于
BZ:https://bugzilla.redhat.com/show_bug.cgi?id=912021 Without error handler set, virDefaultErrorFunc will be called, the error message is prefixed with "libvir:". It become a little better by using prefix "libvirt:" when working with upper application. For example: 1, stop libvirtd daemon 2, run virt-top. libvir: XML-RPC error : Failed to connect \ socket to '/var/run/libvirt/libvirt-sock-ro': \ No such file or directory libvirt: VIR_ERR_SYSTEM_ERROR: VIR_FROM_RPC: \ Failed to connect socket to '/var/run/libvirt/libvirt-sock-ro': \ No such file or directory
-
- 31 1月, 2013 1 次提交
-
-
由 John Ferlan 提交于
Way back when I started making changes for Coverity messages my first set were to a bunch of CHECKED_RETURN errors. In particular virAsprintf() had a few callers that Coverity noted didn't check their return (although some did check if the buffer being printed to was NULL or not). It was suggested at the time as a further patch an ATTRIBUTE_RETURN_CHECK should be added to virAsprintf(), see: https://www.redhat.com/archives/libvir-list/2013-January/msg00120.html This patch does that and fixes a few more instances not found by Coverity that failed the check.
-
- 21 12月, 2012 5 次提交
-
-
由 Daniel P. Berrange 提交于
-
由 Daniel P. Berrange 提交于
-
由 Daniel P. Berrange 提交于
-
由 Daniel P. Berrange 提交于
-
由 Daniel P. Berrange 提交于
-
- 01 12月, 2012 1 次提交
-
-
由 Daniel P. Berrange 提交于
To be able todo controlled shutdown/reboot of containers an API to talk to init via /dev/initctl is required. Fortunately this is quite straightforward to implement, and is supported by both sysvinit and systemd. Upstart support for /dev/initctl is unclear. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 15 11月, 2012 1 次提交
-
-
由 Miloslav Trmač 提交于
... and update all users. No change in functionality, the parameter will be used later. The metadata representation is as minimal as possible, but requires the caller to allocate an array on stack explicitly. The alternative of using varargs in the virLogMessage() callers: * Would not allow the caller to optionally omit some metadata elements, except by having two calls to virLogMessage. * Would not be as type-safe (e.g. using int vs. size_t), and the compiler wouldn't be able to do type checking * Depending on parameter order: a) virLogMessage(..., message format, message params..., metadata..., NULL) can not be portably implemented (parse_printf_format() is a glibc function) b) virLogMessage(..., metadata..., NULL, message format, message params...) would prevent usage of ATTRIBUTE_FMT_PRINTF and the associated compiler checking. Signed-off-by: NMiloslav Trmač <mitr@redhat.com>
-
- 02 11月, 2012 1 次提交
-
-
由 Daniel P. Berrange 提交于
The libvirt coding standard is to use 'function(...args...)' instead of 'function (...args...)'. A non-trivial number of places did not follow this rule and are fixed in this patch. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 16 10月, 2012 1 次提交
-
-
由 Daniel P. Berrange 提交于
The previously introduced virFile{Lock,Unlock} APIs provide a way to acquire/release fcntl() locks on individual files. For unknown reason though, the POSIX spec says that fcntl() locks are released when *any* file handle referring to the same path is closed. In the following sequence threadA: fd1 = open("foo") threadB: fd2 = open("foo") threadA: virFileLock(fd1) threadB: virFileLock(fd2) threadB: close(fd2) you'd expect threadA to come out holding a lock on 'foo', and indeed it does hold a lock for a very short time. Unfortunately when threadB does close(fd2) this releases the lock associated with fd1. For the current libvirt use case for virFileLock - pidfiles - this doesn't matter since the lock is acquired at startup while single threaded an never released until exit. To provide a more generally useful API though, it is necessary to introduce a slightly higher level abstraction, which is to be referred to as a "lockspace". This is to be provided by a virLockSpacePtr object in src/util/virlockspace.{c,h}. The core idea is that the lockspace keeps track of what files are already open+locked. This means that when a 2nd thread comes along and tries to acquire a lock, it doesn't end up opening and closing a new FD. The lockspace just checks the current list of held locks and immediately returns VIR_ERR_RESOURCE_BUSY. NB, the API as it stands is designed on the basis that the files being locked are not being otherwise opened and used by the application code. One approach to using this API is to acquire locks based on a hash of the filepath. eg to lock /var/lib/libvirt/images/foo.img the application might do virLockSpacePtr lockspace = virLockSpaceNew("/var/lib/libvirt/imagelocks"); lockname = md5sum("/var/lib/libvirt/images/foo.img"); virLockSpaceAcquireLock(lockspace, lockname); NB, in this example, the caller should ensure that the path is canonicalized before calculating the checksum. It is also possible to do locks directly on resources by using a NULL lockspace directory and then using the file path as the lock name eg virLockSpacePtr lockspace = virLockSpaceNew(NULL); virLockSpaceAcquireLock(lockspace, "/var/lib/libvirt/images/foo.img"); This is only safe to do though if no other part of the process will be opening the files. This will be the case when this code is used inside the soon-to-be-reposted virlockd daemon Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 28 9月, 2012 2 次提交
-
-
由 Daniel P. Berrange 提交于
The 'const char *category' parameter only has a few possible values now that the filename has been separated. Turn this parameter into an enum instead. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
由 Daniel P. Berrange 提交于
Currently the logging APIs have a 'const char *category' parameter which indicates where the log message comes from. This is typically a combination of the __FILE__ string and other prefix. Split the __FILE__ off into a dedicated parameter so it can passed to the log outputs Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 21 9月, 2012 1 次提交
-
-
由 Eric Blake 提交于
https://www.gnu.org/licenses/gpl-howto.html recommends that the 'If not, see <url>.' phrase be a separate sentence. * tests/securityselinuxhelper.c: Remove doubled line. * tests/securityselinuxtest.c: Likewise. * globally: s/; If/. If/
-
- 28 8月, 2012 1 次提交
-
-
由 Michal Privoznik 提交于
Currently, when guest agent is configured but not responsive (e.g. due to appropriate service not running in the guest) we return VIR_ERR_INTERNAL_ERROR. Both are wrong. Therefore we need to introduce new error code to reflect this case.
-
- 21 8月, 2012 1 次提交
-
-
由 Peter Krempa 提交于
This patch adds helper functions that enable us to use libssh2 in conjunction with libvirt's virNetSockets for ssh transport instead of spawning "ssh" client process. This implemetation supports tunneled plaintext, keyboard-interactive, private key, ssh agent based and null authentication. Libvirt's Auth callback is used for interaction with the user. (Keyboard interactive authentication, adding of host keys, private key passphrases). This enables seamless integration into the application using libvirt. No helpers as "ssh-askpass" are needed. Reading and writing of OpenSSH style "known_hosts" files is supported. Communication is done using SSH exec channel, where the user may specify arbitrary command to be executed on the remote side and reads and writes to/from stdin/out are sent through the ssh channel. Usage of stderr is not (yet) supported.
-
- 18 8月, 2012 1 次提交
-
-
由 Shradha Shah 提交于
Move the functions the parse/format, and validate PCI addresses to their own file so they can be conveniently used in other places besides device_conf.c Refactoring existing code without causing any functional changes to prepare for new code. This patch makes the code reusable. Signed-off-by: NShradha Shah <sshah@solarflare.com>
-