- 09 3月, 2011 1 次提交
-
-
由 Cole Robinson 提交于
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.
-
- 29 1月, 2011 1 次提交
-
-
由 Matthias Bolte 提交于
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 6002e040 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.
-
- 19 1月, 2011 1 次提交
-
-
由 Matthias Bolte 提交于
VIR_ERR_INVALID_* is meant for invalid pointers only.
-
- 21 12月, 2010 1 次提交
-
-
由 Osier Yang 提交于
If there is a dangling symbolic link in filesystem pool, the pool will fail to start or refresh, this patch is to fix it by ignoring it with a warning log.
-
- 25 11月, 2010 1 次提交
-
-
由 Eric Blake 提交于
security_context_t happens to be a typedef for char*, and happens to begin with a string usable as a raw context string. But in reality, it is an opaque type that may or may not have additional information after the first NUL byte, where that additional information can include pointers that can only be freed via freecon(). Proof is from this valgrind run of daemon/libvirtd: ==6028== 839,169 (40 direct, 839,129 indirect) bytes in 1 blocks are definitely lost in loss record 274 of 274 ==6028== at 0x4A0515D: malloc (vg_replace_malloc.c:195) ==6028== by 0x3022E0D48C: selabel_open (label.c:165) ==6028== by 0x3022E11646: matchpathcon_init_prefix (matchpathcon.c:296) ==6028== by 0x3022E1190D: matchpathcon (matchpathcon.c:317) ==6028== by 0x4F9D842: SELinuxRestoreSecurityFileLabel (security_selinux.c:382) 800k is a lot of memory to be leaking. * src/storage/storage_backend.c (virStorageBackendUpdateVolTargetInfoFD): Avoid leak on error. * src/security/security_selinux.c (SELinuxReserveSecurityLabel, SELinuxGetSecurityProcessLabel) (SELinuxRestoreSecurityFileLabel): Use correct function to free security_context_t.
-
- 17 11月, 2010 1 次提交
-
-
由 Stefan Berger 提交于
Similarly to deprecating close(), I am now deprecating fclose() and introduce VIR_FORCE_FCLOSE() and VIR_FCLOSE(). Also, fdopen() is replaced with VIR_FDOPEN(). Most of the files are opened in read-only mode, so usage of VIR_FORCE_CLOSE() seemed appropriate. Others that are opened in write mode already had the fclose()< 0 check and I converted those to VIR_FCLOSE()< 0. I did not find occurrences of possible double-closed files on the way.
-
- 10 11月, 2010 1 次提交
-
-
由 Stefan Berger 提交于
Using automated replacement with sed and editing I have now replaced all occurrences of close() with VIR_(FORCE_)CLOSE() except for one, of course. Some replacements were straight forward, others I needed to pay attention. I hope I payed attention in all the right places... Please have a look. This should have at least solved one more double-close error.
-
- 20 8月, 2010 1 次提交
-
-
由 Eric Blake 提交于
* src/storage/storage_backend.c (virStorageBackendCreateQemuImg) (virStorageBackendCreateQcowCreate): Use virAsprintf instead. * src/storage/storage_backend_disk.c (virStorageBackendDiskCreateVol, virStorageBackendDiskPartFormat): Likewise.
-
- 31 7月, 2010 1 次提交
-
-
由 Eric Blake 提交于
Found by clang. Clang complained that virStorageBackendProbeTarget could dereference NULL if backingStoreFormat was NULL, but since all callers passed a valid pointer, I added attributes instead of null checks. * src/storage/storage_backend.c (virStorageBackendQEMUImgBackingFormat): Kill dead store. * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget): Likewise. Skip null checks, by adding attributes.
-
- 22 7月, 2010 3 次提交
-
-
由 Laine Stump 提交于
One error exit in virStorageBackendCreateBlockFrom was setting the return value to errno. The convention for volume build functions is to return 0 on success or -1 on failure. Not only was it not necessary to set the return value (it defaults to -1, and is set to 0 when everything has been successfully completed), in the case that some caller were checking for < 0 rather than != 0, they would incorrectly believe that it completed successfully.
-
由 Laine Stump 提交于
Previously virStorageBackendCopyToFD would simply return -1 on error. This made the error return from one of its callers inconsistent (createRawFileOpHook is supposed to return -errno, but if virStorageBackendCopyToFD failed, createRawFileOpHook would just return -1). Since there is a useful errno in every case of error return from virStorageBackendCopyToFD, and since the other uses of that function ignore the return code (beyond simply checking to see if it is < 0), this is a safe change.
-
由 Laine Stump 提交于
virFileOperation previously returned 0 on success, or the value of errno on failure. Although there are other functions in libvirt that use this convention, the preferred (and more common) convention is to return 0 on success and -errno (or simply -1 in some cases) on failure. This way the check for failure is always (ret < 0). * src/util/util.c - change virFileOperation and virFileOperationNoFork to return -errno on failure. * src/storage/storage_backend.c, src/qemu/qemu_driver.c - change the hook functions passed to virFileOperation to return -errno on failure.
-
- 20 7月, 2010 3 次提交
-
-
由 Laine Stump 提交于
Originally the storage volume files were opened with O_DSYNC to make sure they were flushed to disk immediately. It turned out that this was extremely slow in some cases, so the O_DSYNC was removed in favor of just calling fsync() after all the data had been written. However, this call to fsync was inside the block that is executed to zero-fill the end of the volume file. In cases where the new volume is copied from an old volume, and they are the same length, this fsync would never take place. Now the fsync is *always* done, unless there is an error (in which case it isn't important, and is most likely inappropriate.
-
由 Laine Stump 提交于
A missing set of braces around an error condition caused us to skip zero'ing out the remainder of a new volume file if the new volume was longer than the original (the goto was supposed to be taken only in the case of error, but was always being taken).
-
由 Daniel P. Berrange 提交于
When creating qcow2 files with a backing store, it is important to set an explicit format to prevent QEMU probing. The storage backend was only doing this if it found a 'kvm-img' binary. This is wrong because plenty of kvm-img binaries don't support an explicit format, and plenty of 'qemu-img' binaries do support a format. The result was that most qcow2 files were not getting a backing store format. This patch runs 'qemu-img -h' to check for the two support argument formats '-o backing_format=raw' '-F raw' and use whichever option it finds * src/storage/storage_backend.c: Query binary to determine how to set the backing store format
-
- 29 5月, 2010 1 次提交
-
-
由 Cole Robinson 提交于
If a directory pool contains pipes or sockets, a pool start can fail or hang: https://bugzilla.redhat.com/show_bug.cgi?id=589577 We already try to avoid these special files, but only attempt after opening the path, which is where the problems lie. Unify volume opening into helper functions, which use the proper open() flags to avoid error, followed by fstat to validate storage mode. Previously, virStorageBackendUpdateVolTargetInfoFD attempted to enforce the storage mode check, but allowed callers to detect this case and silently continue. In practice, only the FS backend was using this feature, the rest were treating unknown mode as an error condition. Unfortunately the InfoFD function wasn't raising an error message here, so error reporting was busted. This patch adds 2 functions: virStorageBackendVolOpen, and virStorageBackendVolOpenModeSkip. The latter retains the original opt out semantics, the former now throws an explicit error. This patch maintains the previous volume mode checks: allowing specific modes for specific pool types requires a bit of surgery, since VolOpen is called through several different helper functions. v2: Use ATTRIBUTE_NONNULL. Drop stat check, just open with O_NONBLOCK|O_NOCTTY. v3: Move mode check logic back to VolOpen. Use 2 VolOpen functions with different error semantics. v4: Make second VolOpen function more extensible. Didn't opt to change FS backend defaults, this can just be to fix the original bug. v5: Prefix default flags with VIR_, use ATTRIBUTE_RETURN_CHECK
-
- 24 5月, 2010 1 次提交
-
-
由 Cole Robinson 提交于
Volume detection in the scsi backend was duplicating code already present in storage_backend.c. Let's drop the duplicate code. Also, change the shared function name to be less generic, and remove some error squashing in the other call site.
-
- 07 5月, 2010 1 次提交
-
-
由 Eric Blake 提交于
* configure.ac: Drop sys/wait.h check. * src/libvirt.c (includes): Use header unconditionally. * src/remote/remote_driver.c (includes): Likewise. * src/storage/storage_backend.c (includes): Likewise. * src/util/ebtables.c (includes): Likewise. * src/util/hooks.c (includes): Likewise. * src/util/iptables.c (includes): Likewise. * src/util/util.c (includes): Likewise.
-
- 04 5月, 2010 1 次提交
-
-
由 Eric Blake 提交于
WIN32 is always defined when __MINGW32__ is defined, but the converse is not true. WIN32 is more generic, if someone were to ever attempt porting to a microsoft compiler. This does not affect Cygwin, which intentionally does not define WIN32. * src/qemu/qemu_driver.c (qemuDomainGetBlockInfo): Use more generic flag macro. * src/storage/storage_backend.c (virStorageBackendUpdateVolTargetInfoFD) (virStorageBackendRunProgRegex): Likewise. * tools/console.h (vshRunConsole): Likewise.
-
- 30 4月, 2010 1 次提交
-
-
由 Daniel P. Berrange 提交于
* src/qemu/qemu_driver.c: Implementation of virDomainGetBlockInfo * src/util/storage_file.h: Add DEV_BSIZE * src/storage/storage_backend.c: Remove DEV_BSIZE
-
- 08 4月, 2010 1 次提交
-
-
由 Jim Meyering 提交于
* src/storage/storage_backend.c (createRawFileOpHook): Remove dead stores and declaration of each stored-to variable.
-
- 16 3月, 2010 1 次提交
-
-
由 Jiri Denemark 提交于
Instead of opening storage file with O_DSYNC, make sure data are written to a disk only before we claim allocation has finished.
-
- 10 3月, 2010 1 次提交
-
-
由 Eric Blake 提交于
* global: patch created by running: for f in $(git ls-files '*.[ch]') ; do cppi $f > $f.t && mv $f.t $f done
-
- 05 3月, 2010 1 次提交
-
-
由 Laine Stump 提交于
This allows the config to have a setting that means "leave it alone", eg when building a pool where the directory already exists the user may want the current uid/gid of the directory left intact. This actually gets us back to older behavior - before recent changes to the pool building code, we weren't as insistent about honoring the uid/gid settings in the XML, and virt-manager was taking advantage of this behavior. As a side benefit, removing calls to getuid/getgid from the XML parsing functions also seems like a good idea. And having a default that is different from a common/useful value (0 == root) is a good thing in general, as it removes ambiguity from decisions (at least one place in the code was checking for (perms.uid == 0) to see if a special uid was requested). Note that this will only affect newly created pools and volumes. Due to the way that the XML is parsed, then formatted for newly created volumes, all existing pools/volumes already have an explicit uid and gid set. src/conf/storage_conf.c: Remove calls to setuid/setgid for default values of uid/gid, and set them to -1 instead src/storage/storage_backend.c: src/storage/storage_backend_fs.c: Make account for the new default values of perms.uid and perms.gid.
-
- 03 3月, 2010 1 次提交
-
-
由 Jiri Denemark 提交于
Various safezero() implementations used either -1, errno or -errno return values. This patch fixes them all to return -1 and set errno appropriately. There was also a bug in size parameter passed to safewrite() which could result in an attempt to write gigabytes out of a megabyte buffer. Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
-
- 22 2月, 2010 1 次提交
-
-
由 Jiri Denemark 提交于
Recently we introduced O_DSYNC flag when creating raw storage files to avoid filling all disk cache with dirty pages. However, the patch got lost when virStorageBackendCreateRaw was reworked using virFileOperation. Let's use O_DSYNC again.
-
- 20 2月, 2010 2 次提交
-
-
由 Laine Stump 提交于
There were a few operations on the storage volume file that were still being done as root, which will fail if the file is on a root-squashed NFS share. The result was that attempts to create a storage volume of type "raw" on a root-squashed NFS share would fail. This patch uses the newly introduced "hook" function in virFileOperation to execute all those file operations in the child process that's run under the uid that owns the file (and, presumably, has permission to write to the NFS share) * src/storage/storage_backend.c: use virFileOperation() in virStorageBackendCreateRaw, turning virStorageBackendCreateRaw() into a new createRawFileOpHook() hook
-
由 Laine Stump 提交于
It turns out it is also useful to be able to perform other operations on a file created while running as a different uid (eg, write things to that file), and possibly to do this to a file that already exists. This patch adds an optional hook function to the renamed (for more accuracy of purpose) virFileOperation; the hook will be called after the file has been opened (possibly created) and gid/mode checked/set, before closing it. As with the other operations on the file, if the VIR_FILE_OP_AS_UID flag is set, this hook function will be called in the context of a child process forked from the process that called virFileOperation. The implication here is that, while all data in memory is available to this hook function, any modification to that data will not be seen by the caller - the only indication in memory of what happened in the hook will be the return value (which the hook should set to 0 on success, or one of the standard errno values on failure). Another piece of making the function more flexible was to add an "openflags" argument. This arg should contain exactly the flags to be passed to open(2), eg O_RDWR | O_EXCL, etc. In the process of adding the hook to virFileOperation, I also realized that the bits to fix up file owner/group/mode settings after creation were being done in the parent process, which could fail, so I moved them to the child process where they should be. * src/util/util.[ch]: rename and rework virFileCreate-->virFileOperation, and redo flags in virDirCreate * storage/storage_backend.c, storage/storage_backend_fs.c: update the calls to virFileOperation/virDirCreate to reflect changes in the API, but don't yet take advantage of the hook.
-
- 10 2月, 2010 2 次提交
-
-
由 Daniel P. Berrange 提交于
The virConnectPtr is no longer required for error reporting since that is recorded in a thread local. Remove use of virConnectPtr from all APIs in secret_conf.{h,c} and update all callers to match
-
由 Daniel P. Berrange 提交于
The virConnectPtr is no longer required for error reporting since that is recorded in a thread local. Remove use of virConnectPtr from all APIs in storage_conf.{h,c} and storage_encryption_conf.{h,c} and update all callers to match
-
- 09 2月, 2010 4 次提交
-
-
由 Jiri Denemark 提交于
When creating preallocated large raw files opening them with O_DSYNC prevents long delays in reading because cache pages can be immediately reused without writing them on a disk first.
-
由 Matthias Bolte 提交于
It was used for error reporting only.
-
由 Matthias Bolte 提交于
-
由 Matthias Bolte 提交于
-
- 02 2月, 2010 1 次提交
-
-
由 Jim Meyering 提交于
* src/storage/storage_backend.c (virStorageBackendRunProgRegex): Don't close a negative (read-only) file descriptor.
-
- 21 1月, 2010 1 次提交
-
-
由 Laine Stump 提交于
In order to avoid problems trying to chown files that were created by root on a root-squashing nfs server, fork a new process that setuid's to the desired uid before creating the file. (It's only done this way if the pool containing the new volume is of type 'netfs', otherwise the old method of creating the file followed by chown() is used.) This changes the semantics of the "create_func" slightly - previously it was assumed that this function just created the file, then the caller would chown it to the desired uid. Now, create_func does both operations. There are multiple functions that can take on the role of create_func: createFileDir - previously called mkdir(), now calls virDirCreate(). virStorageBackendCreateRaw - previously called open(), now calls virFileCreate(). virStorageBackendCreateQemuImg - use virRunWithHook() to setuid/gid. virStorageBackendCreateQcowCreate - same. virStorageBackendCreateBlockFrom - preserve old behavior (but attempt chown when necessary even if not root) * src/storage/storage_backend.[ch] src/storage/storage_backend_disk.c src/storage/storage_backend_fs.c src/storage/storage_backend_logical.c src/storage/storage_driver.c: change the create_func implementations, also propagate the pool information to be able to detect NETFS ones.
-
- 11 12月, 2009 1 次提交
-
-
由 Matthias Bolte 提交于
-
- 10 12月, 2009 1 次提交
-
-
由 Matthias Bolte 提交于
Replace free(virBufferContentAndReset()) with virBufferFreeAndReset(). Update documentation and replace all remaining calls to free() with calls to VIR_FREE(). Also add missing calls to virBufferFreeAndReset() and virReportOOMError() in OOM error cases.
-
- 03 11月, 2009 1 次提交
-
-
由 Chris Lalancette 提交于
When building with --disable-nls, I got a few messages like this: storage/storage_backend.c: In function 'virStorageBackendCreateQemuImg': storage/storage_backend.c:571: warning: format not a string literal and no format arguments Fix these up. Signed-off-by: NChris Lalancette <clalance@redhat.com>
-
- 30 9月, 2009 1 次提交
-
-
由 Mark McLoughlin 提交于
Rename virStorageVolFormatFileSystem to virStorageFileFormat and move to src/util/storage_file.[ch] * src/Makefile.am: add src/util/storage_file.[ch] * src/conf/storage_conf.[ch]: move enum from here ... * src/util/storage_file.[ch]: .. to here * src/libvirt_private.syms: update To/FromString exports * src/storage/storage_backend.c, src/storage/storage_backend_fs.c, src/vbox/vbox_tmpl.c: update for above changes
-