- 10 7月, 2013 1 次提交
-
-
由 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>
-
- 11 8月, 2012 1 次提交
-
-
由 Peter Krempa 提交于
This patch introduces a new error code VIR_ERR_OPERATION_UNSUPPORTED to mark error messages regarding operations that failed due to lack of support on the hypervisor or other than libvirt issues. The code is first used in reporting error if qemu does not support block IO tuning variables yielding error message: error: Unable to get block I/O throttle parameters error: Operation not supported: block_io_throttle field 'total_bytes_sec' missing in qemu's output instead of: error: Unable to get block I/O throttle parameters error: internal error cannot read total_bytes_sec
-
- 01 8月, 2012 1 次提交
-
-
由 Dmitry Guryanov 提交于
Parallels Cloud Server is a cloud-ready virtualization solution that allows users to simultaneously run multiple virtual machines and containers on the same physical server. More information can be found here: http://www.parallels.com/products/pcs/ Also beta version of Parallels Cloud Server can be downloaded there. Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
-
- 27 7月, 2012 1 次提交
-
-
由 Osier Yang 提交于
This is a follow up patch of commit f9ce7dad, it modifies all the files which declare the copyright like "See COPYING.LIB for the License of this software" to use the detailed/consistent one. And deserts the outdated comments like: * libvirt-qemu.h: * Summary: qemu specific interfaces * Description: Provides the interfaces of the libvirt library to handle * qemu specific methods * * Copy: Copyright (C) 2010, 2012 Red Hat, Inc. Uses the more compact style like: * libvirt-qemu.h: Interfaces specific for QEMU/KVM driver * * Copyright (C) 2010, 2012 Red Hat, Inc.
-
- 21 7月, 2012 1 次提交
-
-
由 Daniel P. Berrange 提交于
When reporting a system error (VIR_ERR_SYSTEM_ERROR) via virReportSystemError, we should copy the errno value into the 'int1' field of the virErrorPtr struct. This allows callers to detect certain errno conditions & discard the error * src/util/virterror.c: Place errno value in int1 field
-
- 24 5月, 2012 1 次提交
-
-
由 Daniel P. Berrange 提交于
Add a VIR_ERR_DOMAIN_LAST sentinel for virErrorDomain and replace the virErrorDomainName function by a VIR_ENUM_IMPL In the process the naming of error domains is sanitized * src/util/virterror.c: Use VIR_ENUM_IMPL for converting error domains to strings * include/libvirt/virterror.h: Add VIR_ERR_DOMAIN_LAST
-
- 23 4月, 2012 1 次提交
-
-
由 Eric Blake 提交于
This patch introduces a new block job, useful for live storage migration using pre-copy streaming. Justification for including this under virDomainBlockRebase rather than adding a new command includes: 1) there are now two possible block jobs in qemu, with virDomainBlockRebase starting either type of command, and virDomainBlockJobInfo and virDomainBlockJobAbort working to end either type; 2) reusing this command allows distros to backport this feature to the libvirt 0.9.10 API without a .so bump. Note that a future patch may add a more powerful interface named virDomainBlockJobCopy, dedicated to just the block copy job, in order to expose even more options (such as setting an arbitrary format type for the destination without having to probe it from a pre-existing destination file); adding a new command for targetting just block copy would be similar to how we already have virDomainBlockPull for targetting just the block pull job. Using a live VM with the backing chain: base <- snap1 <- snap2 as the starting point, we have: - virDomainBlockRebase(dom, disk, "/path/to/copy", 0, VIR_DOMAIN_BLOCK_REBASE_COPY) creates /path/to/copy with the same format as snap2, with no backing file, so entire chain is copied and flattened - virDomainBlockRebase(dom, disk, "/path/to/copy", 0, VIR_DOMAIN_BLOCK_REBASE_COPY|VIR_DOMAIN_BLOCK_REBASE_COPY_RAW) creates /path/to/copy as a raw file, so entire chain is copied and flattened - virDomainBlockRebase(dom, disk, "/path/to/copy", 0, VIR_DOMAIN_BLOCK_REBASE_COPY|VIR_DOMAIN_BLOCK_REBASE_SHALLOW) creates /path/to/copy with the same format as snap2, but with snap1 as a backing file, so only snap2 is copied. - virDomainBlockRebase(dom, disk, "/path/to/copy", 0, VIR_DOMAIN_BLOCK_REBASE_COPY|VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT) reuse existing /path/to/copy (must have empty contents, and format is probed[*] from the metadata), and copy the full chain - virDomainBlockRebase(dom, disk, "/path/to/copy", 0, VIR_DOMAIN_BLOCK_REBASE_COPY|VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT| VIR_DOMAIN_BLOCK_REBASE_SHALLOW) reuse existing /path/to/copy (contents must be identical to snap1, and format is probed[*] from the metadata), and copy only the contents of snap2 - virDomainBlockRebase(dom, disk, "/path/to/copy", 0, VIR_DOMAIN_BLOCK_REBASE_COPY|VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT| VIR_DOMAIN_BLOCK_REBASE_SHALLOW|VIR_DOMAIN_BLOCK_REBASE_COPY_RAW) reuse existing /path/to/copy (must be raw volume with contents identical to snap1), and copy only the contents of snap2 Less useful combinations: - virDomainBlockRebase(dom, disk, "/path/to/copy", 0, VIR_DOMAIN_BLOCK_REBASE_COPY|VIR_DOMAIN_BLOCK_REBASE_SHALLOW| VIR_DOMAIN_BLOCK_REBASE_COPY_RAW) fail if source is not raw, otherwise create /path/to/copy as raw and the single file is copied (no chain involved) - virDomainBlockRebase(dom, disk, "/path/to/copy", 0, VIR_DOMAIN_BLOCK_REBASE_COPY|VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT| VIR_DOMAIN_BLOCK_REBASE_COPY_RAW) makes little sense: the destination must be raw but have no contents, meaning that it is an empty file, so there is nothing to reuse The other three flags are rejected without VIR_DOMAIN_BLOCK_COPY. [*] Note that probing an existing file for its format can be a security risk _if_ there is a possibility that the existing file is 'raw', in which case the guest can manipulate the file to appear like some other format. But, by virtue of the VIR_DOMAIN_BLOCK_REBASE_COPY_RAW flag, it is possible to avoid probing of raw files, at which point, probing of any remaining file type is no longer a security risk. It would be nice if we could issue an event when pivoting from phase 1 to phase 2, but qemu hasn't implemented that, and we would have to poll in order to synthesize it ourselves. Meanwhile, qemu will give us a distinct job info and completion event when we either cancel or pivot to end the job. Pivoting is accomplished via the new: virDomainBlockJobAbort(dom, disk, VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT) Management applications can pre-create the copy with a relative backing file name, and use the VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT flag to have qemu reuse the metadata; if the management application also copies the backing files to a new location, this can be used to perform live storage migration of an entire backing chain. * include/libvirt/libvirt.h.in (VIR_DOMAIN_BLOCK_JOB_TYPE_COPY): New block job type. (virDomainBlockJobAbortFlags, virDomainBlockRebaseFlags): New enums. * src/libvirt.c (virDomainBlockRebase): Document the new flags, and implement general restrictions on flag combinations. (virDomainBlockJobAbort): Document the new flag. (virDomainSaveFlags, virDomainSnapshotCreateXML) (virDomainRevertToSnapshot, virDomainDetachDeviceFlags): Document restrictions. * include/libvirt/virterror.h (VIR_ERR_BLOCK_COPY_ACTIVE): New error. * src/util/virterror.c (virErrorMsg): Define it.
-
- 20 4月, 2012 1 次提交
-
-
由 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.
-
- 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>
-
- 27 3月, 2012 1 次提交
-
-
由 Martin Kletzander 提交于
Return statements with parameter enclosed in parentheses were modified and parentheses were removed. The whole change was scripted, here is how: List of files was obtained using this command: git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' | \ grep -e '\.[ch]$' -e '\.py$' Found files were modified with this command: sed -i -e \ 's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \ -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_' Then checked for nonsense. The whole command looks like this: git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' | \ grep -e '\.[ch]$' -e '\.py$' | xargs sed -i -e \ 's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \ -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
-
- 23 3月, 2012 2 次提交
-
-
由 Daniel P. Berrange 提交于
* src/util/virauth.c, src/util/virauth.h: Add virAuthGetConfigFilePath * include/libvirt/virterror.h, src/util/virterror.c: Add VIR_FROM_AUTH error domain Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
由 Daniel P. Berrange 提交于
Move error reporting out of the callers, into virURIParse and virURIFormat, to get consistency. * include/libvirt/virterror.h, src/util/virterror.c: Add VIR_FROM_URI * src/util/viruri.c, src/util/viruri.h: Add error reporting * src/esx/esx_driver.c, src/libvirt.c, src/libxl/libxl_driver.c, src/lxc/lxc_driver.c, src/openvz/openvz_driver.c, src/qemu/qemu_driver.c, src/qemu/qemu_migration.c, src/remote/remote_driver.c, src/uml/uml_driver.c, src/vbox/vbox_tmpl.c, src/vmx/vmx.c, src/xen/xen_driver.c, src/xen/xend_internal.c, tests/viruritest.c: Remove error reporting Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 08 3月, 2012 1 次提交
-
-
由 Eric Blake 提交于
Overflow can be user-induced, so it deserves more than being called an internal error. Note that in general, 32-bit platforms have far more places to trigger this error (anywhere the public API used 'unsigned long' but the other side of the connection is a 64-bit server); but some are possible on 64-bit platforms (where the public API computes the product of two numbers). * include/libvirt/virterror.h (VIR_ERR_OVERFLOW): New error. * src/util/virterror.c (virErrorMsg): Translate it. * src/libvirt.c (virDomainSetVcpusFlags, virDomainGetVcpuPinInfo) (virDomainGetVcpus, virDomainGetCPUStats): Use it. * daemon/remote.c (HYPER_TO_TYPE): Likewise. * src/qemu/qemu_driver.c (qemuDomainBlockResize): Likewise.
-
- 24 2月, 2012 1 次提交
-
-
由 Benjamin Cama 提交于
[forwarding this here from RH bug #796732] When creating a network (virsh net-create) with an erroneous XML containing an empty <name> element, the error message is misleading: error: Failed to create network from foo.xml error: missing domain name information It took me a bit of time to figure out that it was the *network* name that was missing (I generate this xml and didn't look at it, first). I realized that the same message is used for missing name when creating a domain, network, or device node.
-
- 22 2月, 2012 1 次提交
-
-
由 Jiri Denemark 提交于
This patch adds VIR_MIGRATE_UNSAFE flag for migration APIs and new VIR_ERR_MIGRATION_UNSAFE error code. The error code should be returned whenever migrating a domain is considered unsafe (e.g., it's configured in a way that does not ensure data integrity once it is migrated). VIR_MIGRATE_UNSAFE flag may be used to force migration even though it would normally be considered unsafe and forbidden.
-
- 04 2月, 2012 1 次提交
-
-
由 Philipp Hahn 提交于
compat{a->i}bility erron{->e}ous nec{c->}essary. Either "the" or "a". Signed-off-by: NPhilipp Hahn <hahn@univention.de>
-
- 02 2月, 2012 1 次提交
-
-
由 Peter Krempa 提交于
This patch adds API to modify domain metadata for running and stopped domains. The api supports changing description, title as well as the newly added <metadata> element. The API has support for storing data in the metadata element using xml namespaces. * include/libvirt/libvirt.h.in * src/libvirt_public.syms - add function headers - add enum to select metadata to operate on - export functions * src/libvirt.c - add public api implementation * src/driver.h - add driver support * src/remote/remote_driver.c * src/remote/remote_protocol.x - wire up the remote protocol * include/libvirt/virterror.h * src/util/virterror.c - add a new error message note that metadata for domain are missing
-