- 22 7月, 2011 1 次提交
-
-
由 Laine Stump 提交于
If util.h is going to have a MIN, it may as well also have MAX.
-
- 12 7月, 2011 1 次提交
-
-
由 Daniel P. Berrange 提交于
Avoid re-formatting the pidfile path everytime we need it. Create it once when starting the guest, and preserve it until the guest is shutdown. * src/libvirt_private.syms, src/util/util.c, src/util/util.h: Add virFileReadPidPath * src/qemu/qemu_domain.h: Add pidfile field * src/qemu/qemu_process.c: Store pidfile path in qemuDomainObjPrivate
-
- 08 7月, 2011 1 次提交
-
-
由 Eric Blake 提交于
No caller was using the flags argument, and this function is internal only, so we might as well skip it. * src/util/util.h (safezero): Update signature. * src/util/util.c (safezero): Update function. * src/locking/lock_driver_sanlock.c (virLockManagerSanlockSetupLockspace) (virLockManagerSanlockCreateLease): Update all callers. * src/storage/storage_backend.c (createRawFile): Likewise.
-
- 07 7月, 2011 2 次提交
-
-
由 Eric Blake 提交于
The next patch wants to adjust an end pointer to trim trailing spaces but without modifying the underlying string, but a more generally useful ability to trim trailing spaces in place is also worth providing. * src/util/util.h (virTrimSpaces, virSkipSpacesBackwards): New prototypes. * src/util/util.c (virTrimSpaces, virSkipSpacesBackwards): New functions. * src/libvirt_private.syms (util.h): Export new functions. Inspired by a patch by Minoru Usui.
-
由 Eric Blake 提交于
Most clients of virSkipSpaces don't want to omit backslashes. Also, open-coding the list of spaces is not as nice as using c_isspace. * src/util/util.c (virSkipSpaces): Use c_isspace. (virSkipSpacesAndBackslash): New function. * src/util/util.h (virSkipSpacesAndBackslash): New prototype. * src/xen/xend_internal.c (sexpr_to_xend_topology): Update caller. * src/libvirt_private.syms (util.h): Export new function.
-
- 02 7月, 2011 1 次提交
-
-
由 Eric Blake 提交于
To avoid regressions, we let callers specify whether to require a minor and micro version. Callers that were parsing uname() output benefit from defaulting to 0, whereas callers that were parsing version strings from other sources should not change in behavior. * src/util/util.c (virParseVersionString): Allow caller to choose whether to fail if minor or micro is missing. * src/util/util.h (virParseVersionString): Update signature. * src/esx/esx_driver.c (esxGetVersion): Update callers. * src/lxc/lxc_driver.c (lxcVersion): Likewise. * src/openvz/openvz_conf.c (openvzExtractVersionInfo): Likewise. * src/uml/uml_driver.c (umlGetVersion): Likewise. * src/vbox/vbox_MSCOMGlue.c (vboxLookupVersionInRegistry): Likewise. * src/vbox/vbox_tmpl.c (vboxExtractVersion): Likewise. * src/vmware/vmware_conf.c (vmwareExtractVersion): Likewise. * src/xenapi/xenapi_driver.c (xenapiGetVersion): Likewise. Reported by Matthias Bolte.
-
- 13 6月, 2011 1 次提交
-
-
由 Jiri Denemark 提交于
-
- 08 6月, 2011 1 次提交
-
-
由 Cole Robinson 提交于
Seems reasonable to have all command wrappers in the same place v2: Dont move SetInherit v3: Comment spelling fix Adjust WARN0 comment Remove spurious #include movement Don't include sys/types.h Combine virExec enums Signed-off-by: NCole Robinson <crobinso@redhat.com>
-
- 07 6月, 2011 1 次提交
-
-
由 Cole Robinson 提交于
v3: Remove obsolete comment Signed-off-by: NCole Robinson <crobinso@redhat.com>
-
- 29 5月, 2011 1 次提交
-
-
由 Richard Laager 提交于
This was necessary to get libvirt to build on Solaris 11 Express and seems correct (as it makes this match the definition in util.c):
-
- 17 5月, 2011 1 次提交
-
-
由 Cole Robinson 提交于
virRunWithHook is now unused, so we can drop it. Tested w/ raw + qcow2 volume creation and copying. v2: Use opaque data to skip hook second time around Simply command building v3: Drop explicit FindFileInPath
-
- 14 5月, 2011 1 次提交
-
-
由 Cole Robinson 提交于
And drop the now unused virExecDaemonize
-
- 06 5月, 2011 1 次提交
-
-
由 Michal Privoznik 提交于
Users often edit XML file stored in configuration directory thinking of modifying a domain/network/pool/etc. Thus it is wise to let them know they are using the wrong way and give them hint.
-
- 05 4月, 2011 1 次提交
-
-
由 Matthias Bolte 提交于
Make virFileBuildPath operate on the heap instead of the stack. It allocates a buffer instead of expecting a preexisting buffer.
-
- 29 3月, 2011 3 次提交
-
-
由 Eric Blake 提交于
This patch intentionally doesn't change indentation, in order to make it easier to review the real changes. * src/util/util.h (VIR_FILE_OP_RETURN_FD, virFileOperationHook): Delete. (virFileOperation): Rename... (virFileOpenAs): ...and reduce parameters. * src/util/util.c (virFileOperationNoFork, virFileOperation): Rename and simplify. * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Adjust caller. * src/storage/storage_backend.c (virStorageBackendCreateRaw): Likewise. * src/libvirt_private.syms: Reflect rename.
-
由 Eric Blake 提交于
Currently, the hook function in virFileOperation is extremely limited: it must be async-signal-safe, and cannot modify any memory in the parent process. It is much handier to return a valid fd and operate on it in the parent than to deal with hook restrictions. * src/util/util.h (VIR_FILE_OP_RETURN_FD): New flag. * src/util/util.c (virFileOperationNoFork, virFileOperation): Honor new flag.
-
由 Eric Blake 提交于
* src/util/util.h (virSetInherit): New prototype. * src/util/util.c (virSetCloseExec): Move guts... (virSetInherit): ...to new function, and allow clearing. * src/libvirt_private.syms (util.h): Export it.
-
- 15 3月, 2011 2 次提交
-
-
由 Daniel P. Berrange 提交于
* configure.ac: Check for geteuid() * src/util/util.h: Compat for geteuid()
-
由 Daniel P. Berrange 提交于
The virSetNonBlock() API only allows enabling non-blocking operations. It doesn't allow turning blocking back on. Add a new API to allow arbitrary toggling. * src/libvirt_private.syms, src/util/util.h src/util/util.c: Add virSetBlocking
-
- 24 2月, 2011 1 次提交
-
-
由 Daniel P. Berrange 提交于
Remove the <stdbool.h> header from all source files / headers and just put it into internal.h * src/internal.h: Add <stdbool.h>
-
- 17 2月, 2011 1 次提交
-
-
由 Osier Yang 提交于
The name convention of device mapper disk is different, and 'parted' can't be used to delete a device mapper disk partition. e.g. Name Path ----------------------------------------- 3600a0b80005ad1d7000093604cae912fp1 /dev/mapper/3600a0b80005ad1d7000093604cae912fp1 Error: Expecting a partition number. This patch introduces 'dmsetup' to fix it. Changes: - New function "virIsDevMapperDevice" in "src/utils/utils.c" - remove "is_dm_device" in "src/storage/parthelper.c", use "virIsDevMapperDevice" instead. - Requires "device-mapper" for 'with-storage-disk" in "libvirt.spec.in" - Check "dmsetup" in 'configure.ac' for "with-storage-disk" - Changes on "src/Makefile.am" to link against libdevmapper - New entry for "virIsDevMapperDevice" in "src/libvirt_private.syms" Changes from v1 to v3: - s/virIsDeviceMapperDevice/virIsDevMapperDevice/g - replace "virRun" with "virCommand" - sort the list of util functions in "libvirt_private.syms" - ATTRIBUTE_NONNULL(1) for virIsDevMapperDevice declaration. e.g. Name Path ----------------------------------------- 3600a0b80005ad1d7000093604cae912fp1 /dev/mapper/3600a0b80005ad1d7000093604cae912fp1 Vol /dev/mapper/3600a0b80005ad1d7000093604cae912fp1 deleted Name Path -----------------------------------------
-
- 14 1月, 2011 1 次提交
-
-
由 Eric Blake 提交于
It was awkward having only int conversion in the virStrToLong family, but only long conversion in the virXPath family. Make both families support both types. * src/util/util.h (virStrToLong_l, virStrToLong_ul): New prototypes. * src/util/xml.h (virXPathInt, virXPathUInt): Likewise. * src/util/util.c (virStrToLong_l, virStrToLong_ul): New functions. * src/util/xml.c (virXPathInt, virXPathUInt): Likewise. * src/libvirt_private.syms (util.h, xml.h): Export them.
-
- 13 1月, 2011 1 次提交
-
-
由 Eric Blake 提交于
Without this patch, at least tests/daemon-conf (which sticks $builddir/src in the PATH) tries to execute the directory $builddir/src/qemu rather than a real qemu binary. * src/util/util.h (virFileExists): Adjust prototype. (virFileIsExecutable): New prototype. * src/util/util.c (virFindFileInPath): Reject non-executables and directories. Avoid huge stack allocation. (virFileExists): Use lighter-weight syscall. (virFileIsExecutable): New function. * src/libvirt_private.syms (util.h): Export new function.
-
- 24 12月, 2010 1 次提交
-
-
由 Laine Stump 提交于
virSetUIDGID() sets both the real and effective group and user of the process, and additionally calls initgroups() to assure that the process joins all the auxiliary groups that the given uid is a member of.
-
- 03 12月, 2010 3 次提交
-
-
由 Jean-Baptiste Rouault 提交于
This patch adds a mode_t parameter to virFileWriteStr(). If mode is different from 0, virFileWriteStr() will try to create the file if it doesn't exist. * src/util/util.h (virFileWriteStr): Alter signature. * src/util/util.c (virFileWriteStr): Allow file creation. * src/network/bridge_driver.c (networkEnableIpForwarding) (networkDisableIPV6): Adjust clients. * src/node_device/node_device_driver.c (nodeDeviceVportCreateDelete): Likewise. * src/util/cgroup.c (virCgroupSetValueStr): Likewise. * src/util/pci.c (pciBindDeviceToStub, pciUnBindDeviceFromStub): Likewise.
-
由 Eric Blake 提交于
* src/util/util.h (virVasprintf): New declaration. * src/util/util.c (virVasprintf): New function. (virAsprintf): Use it. * src/util/virtaudit.c (virAuditSend): Likewise. * src/libvirt_private.syms: Export it. * cfg.mk (sc_prohibit_asprintf): Also prohibit vasprintf. * .x-sc_prohibit_asprintf: Add exemption.
-
由 Eric Blake 提交于
* src/util/util.c (saferead): Fix return type. (safewrite): Fix indentation.
-
- 02 11月, 2010 1 次提交
-
-
由 Osier Yang 提交于
* src/util/util.h * src/util/util.c * src/libvirt_private.syms
-
- 31 8月, 2010 1 次提交
-
-
由 Matthias Bolte 提交于
virHexToBin will be used in the .vmx handling code.
-
- 26 5月, 2010 2 次提交
-
-
由 Chris Lalancette 提交于
We've been running into a lot of situations where virGetHostname() is returning "localhost", where a plain gethostname() would have returned the correct thing. This is because virGetHostname() is *always* trying to canonicalize the name returned from gethostname(), even when it doesn't have to. This patch changes virGetHostname so that if the value returned from gethostname() is already FQDN or localhost, it returns that string directly. If the value returned from gethostname() is a shortened hostname, then we try to canonicalize it. If that succeeds, we returned the canonicalized hostname. If that fails, and/or returns "localhost", then we just return the original string we got from gethostname() and hope for the best. Note that after this patch it is up to clients to check whether "localhost" is an allowed return value. The only place where it's currently not is in qemu migration. Signed-off-by: NChris Lalancette <clalance@redhat.com>
-
由 Cole Robinson 提交于
Spurious / in a pool target path makes life difficult for apps using the GetVolByPath, and doing other path based comparisons with pools. This has caused a few issues for virt-manager users: https://bugzilla.redhat.com/show_bug.cgi?id=494005 https://bugzilla.redhat.com/show_bug.cgi?id=593565 Add a new util API which removes spurious /, virFileSanitizePath. Sanitize target paths when parsing pool XML, and for paths passed to GetVolByPath. v2: Leading // must be preserved, properly sanitize path=/, sanitize away /./ -> / v3: Properly handle starting ./ and ending /. v4: Drop all '.' handling, just sanitize / for now.
-
- 22 4月, 2010 1 次提交
-
-
由 Jiri Denemark 提交于
-
- 16 4月, 2010 1 次提交
-
-
由 Eric Blake 提交于
Based on a warning from coverity. The safe* functions guarantee complete transactions on success, but don't guarantee freedom from failure. * src/util/util.h (saferead, safewrite, safezero): Add ATTRIBUTE_RETURN_CHECK. * src/remote/remote_driver.c (remoteIO, remoteIOEventLoop): Ignore some failures. (remoteIOReadBuffer): Adjust error messages on read failure. * daemon/event.c (virEventHandleWakeup): Ignore read failure.
-
- 01 4月, 2010 1 次提交
-
-
由 Matthias Bolte 提交于
virParseVersionString uses virStrToLong_ui instead of sscanf. This also fixes a bug in the UML driver, that always returned 0 as version number. Introduce STRSKIP to check if a string has a certain prefix and to skip this prefix.
-
- 30 3月, 2010 1 次提交
-
-
由 Daniel Veillard 提交于
used to read the data from virExec stdout/err file descriptors * src/util/util.c src/util/util.h: not static anymore and export it * src/libvirt_private.syms: allow access internally
-
- 23 3月, 2010 1 次提交
-
-
由 Matthias Bolte 提交于
Add dummy bodies for HAVE_GETPWUID_R and HAVE_MNTENT_H dependent functions for MinGW builds.
-
- 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
-
- 20 2月, 2010 1 次提交
-
-
由 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.
-
- 19 2月, 2010 2 次提交
-
-
由 Chris Lalancette 提交于
If the hostname as returned by "gethostname" resolves to "localhost" (as it does with the broken Fedora-12 installer), then live migration will fail because the source will try to migrate to itself. Detect this situation up-front and abort the live migration before we do any real work. * src/util/util.h src/util/util.c: add a new virGetHostnameLocalhost with an optional localhost check, and rewire virGetHostname() to use it * src/libvirt_private.syms: expose the new function * src/qemu/qemu_driver.c: use it in qemudDomainMigratePrepare2()
-
由 Laine Stump 提交于
virFork() contains bookkeeping that must be done any time a process forks. Currently this includes: 1) Call virLogLock() prior to fork() and virLogUnlock() just after, to avoid a deadlock if some other thread happens to hold that lock during the fork. 2) Reset the logging hooks and send all child process log messages to stderr. 3) Block all signals prior to fork(), then either a) reset the signal mask for the parent process, or b) clear the signal mask for the child process. Note that the signal mask handling in __virExec erroneously fails to restore the signal mask when fork() fails. virFork() fixes this problem. Other than this, it attempts to behave as closely to fork() as possible (including preserving errno for the caller), with a couple exceptions: 1) The return value is 0 (success) or -1 (failure), while the pid is returned via the pid_t* argument. Like fork(), if pid < 0 there is no child process, otherwise both the child and the parent will return to the caller, and both should look at the return value, which will indicate if some of the extra processing outlined above encountered an error. 2) If virFork() returns with pid < 0 or with a return value < 0 indicating an error condition, the error has already been reported. You can log an additional message if you like, but it isn't necessary, and may be awkwardly extraneous. Note that virFork()'s child process will *never* call _exit() - if a child process is created, it will return to the caller. * util.c util.h: add virFork() function, based on what is currently done in __virExec().
-