- 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 7 次提交
-
-
由 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()
-
由 Chris Lalancette 提交于
* src/util/pci.c: update 2 message on pciRead errors
-
由 Jim Meyering 提交于
* src/util/buf.c (virBufferStrcat): Do not skip va_end due to an early return.
-
由 Jim Meyering 提交于
* src/util/qparams.c (new_qparam_set, append_qparams): Do not skip va_end due to an early return.
-
由 Stefan Berger 提交于
This patch sets or unsets the IFF_VNET_HDR flag depending on what device is used in the VM. The manipulation of the flag is done in the open function and is only fatal if the IFF_VNET_HDR flag could not be cleared although it has to be (or if an ioctl generally fails). In that case the macvtap tap is closed again and the macvtap interface torn. * src/qemu/qemu_conf.c src/qemu/qemu_conf.h: pass qemuCmdFlags to qemudPhysIfaceConnect() * src/util/macvtap.c src/util/macvtap.h: add vnet_hdr boolean to openMacvtapTap(), and private function configMacvtapTap() * src/qemu/qemu_driver.c: add extra qemuCmdFlags when calling qemudPhysIfaceConnect()
-
由 Laine Stump 提交于
For __virExec() this is a semantic NOP except for when fork() fails. __virExec() would previously forget to restore the signal mask in this case; virFork() corrects this behavior. virFileCreate() and virDirCreate() gain the code to reset the logging and properly deal with the signal handling race condition. This also removes a log message that had a typo ("cannot fork o create file '%s'") - this error is now logged in a more generic manner in virFork() (more generic, but really just as informative, since the fact that it's forking to create a file is immaterial to the fact that it simply can't fork) * src/util/util.c: use the generic virFork() in the 3 functions
-
由 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().
-
- 18 2月, 2010 2 次提交
-
-
由 Cole Robinson 提交于
virGetLastError returns NULL if no error has been set, not on allocation error like virSetError assumed. Use virLastErrorObject instead. This fixes virSetError when no error is currently stored.
-
由 Stefan Berger 提交于
Rework and simplification of teardown of the macvtap device. Basically all devices with the same MAC address and link device are kept alive and not attempted to be torn down. If a macvtap device linked to a physical interface with a certain MAC address 'M' is to be created it will automatically fail if the interface is 'up'ed and another macvtap with the same properties (MAC addr 'M', link dev) happens to be 'up'. This will prevent the VM from starting or the device from being attached to a running VM. Stale interfaces are assumed to be there for some reason and not stem from libvirt. In the VM shutdown path, it's assuming that an interface name is always available so that if the device type is DIRECT it can be torn down using its name. * src/util/macvtap.h src/libvirt_macvtap.syms: change of deleting routine * src/util/macvtap.c: cleanups and change of deleting routine * src/qemu/qemu_driver.c: change cleanup on shutdown * src/qemu/qemu_conf.c: don't delete Macvtap in qemudPhysIfaceConnect()
-
- 16 2月, 2010 3 次提交
-
-
由 Stefan Berger 提交于
This part adds the helper code to setup and tear down macvtap devices using direct communication with the device driver via netlink sockets. The rather short messages received from the netlink layer are now written into a dynamically allocated buffer * src/util/macvtap.h src/util/macvtap.c: provides the new module * po/POTFILES.in: the module contains translated strings
-
由 Stefan Berger 提交于
This part adds support to domain_conf.{c|h} for parsing the new interface XML of type 'direct'. The parsed mode is now stored as an int. * src/conf/domain_conf.c src/conf/domain_conf.h: extend parsing code * src/util/macvtap.h: empty header to not break compilation
-
由 Stefan Berger 提交于
This patch adds build support for libvirt checking for certain contents of /usr/include/linux/if_link.h to see whether macvtap support is compilable on that system. One can disable macvtap support in libvirt via --without-macvtap passed to configure. * configure.ac src/Makefile.am: new build support * src/libvirt_macvtap.syms: list of exported symbols * src/util/macvtap.c: empty module to not break compilation
-
- 13 2月, 2010 1 次提交
-
-
由 Daniel P. Berrange 提交于
* src/util/hostusb.c: The device path for a USB device wants the bus/device IDs in decimal not octal
-
- 10 2月, 2010 3 次提交
-
-
由 Daniel P. Berrange 提交于
All callers now pass a NULL virConnectPtr into the USB/PCi device iterator functions. Therefore the virConnectPtr arg can now be removed from these functions * src/util/hostusb.h, src/util/hostusb.c: Remove virConnectPtr from usbDeviceFileIterate * src/util/pci.c, src/util/pci.h: Remove virConnectPtr arg from pciDeviceFileIterate * src/qemu/qemu_security_dac.c, src/security/security_selinux.c: Update to drop redundant virConnectPtr arg
-
由 Jim Meyering 提交于
* src/util/util.h (virAsprintf): Remove ATTRIBUTE_RETURN_CHECK, since it is perfectly fine to ignore the return value, now that the pointer is guaranteed to be set to NULL upon failure. * src/util/storage_file.c (absolutePathFromBaseFile): Remove now- unnecessary use of ignore_value.
-
由 Jim Meyering 提交于
* src/util/storage_file.c (absolutePathFromBaseFile): While this use of virAsprintf is slightly cleaner than using stpncpy(stpcpy(..., it does impose an artificial limitation on the length of the base_file name. Rather than asserting that it does not exceed INT_MAX, return NULL when it does.
-
- 09 2月, 2010 9 次提交
-
-
由 Matthias Bolte 提交于
It was used for error reporting only.
-
由 Matthias Bolte 提交于
-
由 Matthias Bolte 提交于
It was used for error reporting only.
-
由 Matthias Bolte 提交于
It was used for error reporting only.
-
由 Matthias Bolte 提交于
It was used for error reporting only.
-
由 Matthias Bolte 提交于
It was used for error reporting only.
-
由 Matthias Bolte 提交于
It was used for error reporting only.
-
由 Matthias Bolte 提交于
-
由 Matthias Bolte 提交于
-
- 05 2月, 2010 5 次提交
-
-
由 Jim Meyering 提交于
When configured with --enable-gcc-warnings, it didn't even compile. * src/util/storage_file.c: Include <assert.h>. (absolutePathFromBaseFile): Assert that converting size_t to int is valid. Reverse length/string args to match "%.*s". Explicitly ignore the return value of virAsprintf.
-
由 Jim Meyering 提交于
* src/util/storage_file.c: Include "dirname.h". (absolutePathFromBaseFile): Rewrite not to leak, and to require fewer allocations. * bootstrap (modules): Add dirname-lgpl. * .gnulib: Update submodule to the latest.
-
由 Jim Meyering 提交于
* src/util/util.c (virExecWithHook): Free argv_str string before returning upon failure to allocate space for environment.
-
由 Jim Meyering 提交于
* src/util/cgroup.c (virCgroupDetectPlacement): Close the mapping FILE* also upon error.
-
由 Jim Meyering 提交于
* src/util/cgroup.c (virCgroupCpuSetInherit) [HAVE_MNTENT_H]: Don't leak CPU-set inheritance value strings.
-
- 04 2月, 2010 2 次提交
-
-
由 Laine Stump 提交于
Similar fix as previous one but for fork() usage when creating a file or directory * src/util/util.c: virLogLock() and virLogUnlock() around fork() in virFileCreate() and virDirCreateSimple()
-
由 Cole Robinson 提交于
Ad pointed out by Dan Berrange: So if some thread in libvirtd is currently executing a logging call, while another thread calls virExec(), that other thread no longer exists in the child, but its lock is never released. So when the child then does virLogReset() it deadlocks. The only way I see to address this, is for the parent process to call virLogLock(), immediately before fork(), and then virLogUnlock() afterwards in both parent & child. This will ensure that no other thread can be holding the lock across fork(). * src/util/logging.[ch] src/libvirt_private.syms: export virLogLock() and virLogUnlock() * src/util/util.c: lock just before forking and unlock just after - in both parent and child.
-
- 02 2月, 2010 2 次提交
-
-
由 Jim Meyering 提交于
* src/util/util.c (virGetUserID, virGetGroupID): In the unlikely event that sysconf(_SC_GETPW_R_SIZE_MAX) fails, don't use -1 as the size in the subsequent allocation.
-
由 Jim Meyering 提交于
* src/util/json.c (virJSONValueFree): Free the "value" pointer, too.
-
- 01 2月, 2010 2 次提交
-
-
由 Chris Lalancette 提交于
Signed-off-by: NChris Lalancette <clalance@redhat.com>
-
由 Chris Lalancette 提交于
On RHEL-5 the qemu-kvm binary is located in /usr/libexec. To reduce confusion for people trying to run upstream libvirt on RHEL-5 machines, make the qemu driver look in /usr/libexec for the qemu-kvm binary. To make this work, I modified virFindFileInPath to handle an absolute path correctly. I also ran into an issue where NULL was sometimes being passed for the file parameter to virFindFileInPath; it didn't crash prior to this patch since it was building paths like /usr/bin/(null). This is non-standard behavior, though, so I added a NULL check at the beginning. Signed-off-by: NChris Lalancette <clalance@redhat.com>
-
- 30 1月, 2010 1 次提交
-
-
由 Jim Meyering 提交于
* src/util/util.c (virGetUserEnt): In the unlikely event that sysconf(_SC_GETPW_R_SIZE_MAX) fails, don't use -1 as the size in the subsequent allocation.
-
- 27 1月, 2010 2 次提交
-
-
由 Jim Meyering 提交于
* src/util/pci.c (pciDeviceDownstreamLacksACS): Fix a typo that rendered a subexpression always false.
-
由 Matthias Bolte 提交于
-