- 28 1月, 2012 3 次提交
-
-
由 Daniel P. Berrange 提交于
The virEmitXMLWarning function should always have been in the xml.[hc] files, and should use virXML as its name prefix * src/util/util.c, src/util/util.h: Remove virEmitXMLWarning * src/util/xml.c, src/util/xml.h: Add virXMLEmitWarning
-
由 Daniel P. Berrange 提交于
Move the virMacAddrXXX functions out of util.[ch] and into a new dedicate file virmacaddr.[ch]
-
由 Daniel P. Berrange 提交于
Rename virFormatMacAddr, virGenerateMacAddr and virParseMacAddr to virMacAddrFormat, virMacAddrGenerate and virMacAddrParse respectively
-
- 27 1月, 2012 2 次提交
-
-
由 Eric Blake 提交于
On RHEL5, I got: util/virrandom.c:66: warning: nested extern declaration of '_gl_verify_function66' [-Wnested-externs] The fix is to hoist the verify earlier. Also some other hodge-podge fixes I noticed while reviewing Dan's recent series. * .gitignore: Ignore new test. * src/util/cgroup.c: Bump copyright year. * src/util/virhash.c: Fix typo in description. * src/util/virrandom.c (virRandomBits): Mark doc comment, and hoist assert to silence older gcc.
-
由 Michal Privoznik 提交于
Some files are using uint32_t or int64_t without including stdint.h which defines them. Fix this.
-
- 26 1月, 2012 8 次提交
-
-
由 Daniel P. Berrange 提交于
Recent discussions have illustrated the potential for DOS attacks with the hash table implementations used by most languages and libraries. https://lwn.net/Articles/474912/ libvirt has an internal hash table impl, and uses hash tables for a variety of purposes. The hash key generation code is pretty simple and thus not strongly collision resistant. This patch replaces the current libvirt hash key generator with the (public domain) Murmurhash3 code. In addition every hash table now gets a random seed value which is used to perturb the hashing code. This should make it impossible to mount any practical attack against libvirt hashing code. * bootstrap.conf: Import bitrotate module * src/Makefile.am: Add virhashcode.[ch] * src/util/util.c: Make virRandom() return a fixed 32 bit integer value. * src/util/hash.c, src/util/hash.h, src/util/cgroup.c: Replace hash code generation with a call to virHashCodeGen() * src/util/virhashcode.h, src/util/virhashcode.c: Add a new virHashCodeGen() API using the Murmurhash3 algorithm.
-
由 Daniel P. Berrange 提交于
In preparation for the patch to include Murmurhash3, which introduces a virhashcode.h and virhashcode.c files, rename the existing hash.h and hash.c to virhash.h and virhash.c respectively.
-
由 Daniel P. Berrange 提交于
In preparation for conversion over to use the Murmurhash3 algorithm, convert various virHash APIs to use size_t or uint32 for their return values/parameters, instead of the variable size 'unsigned long' or 'int' types
-
由 Daniel P. Berrange 提交于
The old virRandom() API was not generating good random numbers. Replace it with a new API virRandomBits which instead of being told the upper limit, gets told the number of bits of randomness required. * src/util/virrandom.c, src/util/virrandom.h: Add virRandomBits, and move virRandomInitialize * src/util/util.h, src/util/util.c: Delete virRandom and virRandomInitialize * src/libvirt.c, src/security/security_selinux.c, src/test/test_driver.c, src/util/iohelper.c: Update for changes from virRandom to virRandomBits * src/storage/storage_backend_iscsi.c: Remove bogus call to virRandomInitialize & convert to virRandomBits
-
由 Marc-André Lureau 提交于
Fix a few warnings with mingw64 x86_64.
-
由 Eric Blake 提交于
In file included from ../gnulib/lib/unistd.h:51:0, from ../src/util/util.h:30, from rpc/virkeepalive.c:29: /usr/x86_64-w64-mingw32/sys-root/mingw/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp] Reported by Marc-André Lureau. * src/util/threads-win32.h (includes): Pick up winsock2.h before windows.h, as required by mingw64.
-
由 Marc-André Lureau 提交于
Fixes the following warning: util/virterror.c:1242:31: warning: declaration of 'errcode' shadows a global declaration [-Wshadow]
-
由 Marc-André Lureau 提交于
Add missing function if !HAVE_GETPWUID_R.
-
- 25 1月, 2012 2 次提交
-
-
由 Daniel P. Berrange 提交于
Add a virFileTouch API which ensures that a file will always exist, even if zero length * src/util/virfile.c, src/util/virfile.h, src/libvirt_private.syms: Introduce virFileTouch
-
由 Laszlo Ersek 提交于
POLLIN and POLLHUP are not mutually exclusive. Currently the following seems possible: the child writes 3K to its stdout or stderr pipe, and immediately closes it. We get POLLIN|POLLHUP (I'm not sure that's possible on Linux, but SUSv4 seems to allow it). We read 1K and throw away the rest. When poll() returns and we're about to check the /revents/ member in a given array element, let's map all the revents bits to two (independent) ideas: "let's attempt to read()", and "let's attempt to write()". This should cover all errors, EOFs, and normal conditions; the read()/write() call should report any pending error. Under this approach, both POLLHUP and POLLERR are mapped to "needs read()" if we're otherwise prepared for POLLIN. POLLERR also maps to "needs write()" if we're otherwise prepared for POLLOUT. The rest of the mappings (POLLPRI etc.) would be easy, but probably useless for pipes. Additionally, SUSv4 doesn't appear to forbid POLLIN|POLLERR (or POLLOUT|POLLERR) set simultaneously. One could argue that the read() or write() call would return without blocking in these cases (with an error), so POLLIN / POLLOUT would be justified beside POLLERR. The code now penalizes POLLIN|POLLERR differently from plain POLLERR. The former (ie. read() returning -1) is terminal and we jump to cleanup, while plain POLLERR masks only the affected file descriptor for the future. Let's unify those. Signed-off-by: NLaszlo Ersek <lersek@redhat.com>
-
- 24 1月, 2012 1 次提交
-
-
由 Stefan Berger 提交于
Add function to compare two hash tables for equality.
-
- 21 1月, 2012 1 次提交
-
-
由 Eric Blake 提交于
When converting a linear enum to a string, we have checks in place in the VIR_ENUM_IMPL macro to ensure that there is one string for every value, which lets us quickly flag if a user added a value but forgot to add a counterpart string. However, this only works if we use the _LAST marker. * cfg.mk (sc_require_enum_last_marker): New syntax check. * src/conf/domain_conf.h (virDomainSnapshotState): Add new marker. * src/conf/domain_conf.c (virDomainSnapshotState): Fix offender. * src/qemu/qemu_monitor_json.c (qemuMonitorWatchdogAction) (qemuMonitorIOErrorAction, qemuMonitorGraphicsAddressFamily): Likewise. * src/util/virtypedparam.c (virTypedParameter): Likewise.
-
- 20 1月, 2012 3 次提交
-
-
由 Eric Blake 提交于
While we still don't want to enable gcc's new -Wformat-literal warning, I found a rather easy case where the warning could be reduced, by getting rid of obsolete error-reporting practices. This is the last place where we were passing the (unused) net and conn arguments for constructing an error. * src/util/virterror_internal.h (virErrorMsg): Delete prototype. (virReportError): Delete macro. * src/util/virterror.c (virErrorMsg): Make static. * src/libvirt_private.syms (virterror_internal.h): Drop export. * src/util/conf.c (virConfError): Convert to macro. (virConfErrorHelper): New function, and adjust error calls. * src/xen/xen_hypervisor.c (virXenErrorFunc): Delete. (xenHypervisorGetSchedulerType) (xenHypervisorGetSchedulerParameters) (xenHypervisorSetSchedulerParameters) (xenHypervisorDomainBlockStats) (xenHypervisorDomainInterfaceStats) (xenHypervisorDomainGetOSType) (xenHypervisorNodeGetCellsFreeMemory, xenHypervisorGetVcpus): Update callers.
-
由 Eric Blake 提交于
Preparation for another patch that refactors common patterns into the new file for fewer lines of code overall. * src/util/util.h (virTypedParameterArrayClear): Move... * src/util/virtypedparam.h: ...to new file. (virTypedParameterArrayValidate, virTypedParameterAssign): New prototypes. * src/util/util.c (virTypedParameterArrayClear): Likewise. * src/util/virtypedparam.c: New file. * po/POTFILES.in: Mark file for translation. * src/Makefile.am (UTIL_SOURCES): Build it. * src/libvirt_private.syms (util.h): Split... (virtypedparam.h): to new section. (virkeycode.h): Sort. * daemon/remote.c: Adjust callers. * tools/virsh.c: Likewise.
-
由 Eric Blake 提交于
We had a memory leak on a very arcane OOM situation (unlikely to ever hit in practice, but who knows if libvirt.so would ever be linked into some other program that exhausts all thread-local storage keys?). I found it by code inspection, while analyzing a valgrind report generated by Alex Jia. * src/util/threads.h (virThreadLocalSet): Alter signature. * src/util/threads-pthread.c (virThreadHelper): Reduce allocation lifetime. (virThreadLocalSet): Detect failure. * src/util/threads-win32.c (virThreadLocalSet): Likewise. (virCondWait): Fix caller. * src/util/virterror.c (virLastErrorObject): Likewise.
-
- 19 1月, 2012 1 次提交
-
-
由 Daniel P. Berrange 提交于
-
- 18 1月, 2012 2 次提交
-
-
由 Daniel P. Berrange 提交于
Given an LXC guest with a root filesystem path of /export/lxc/roots/helloworld/root During startup, we will pivot the root filesystem to end up at /.oldroot/export/lxc/roots/helloworld/root We then try to open /.oldroot/export/lxc/roots/helloworld/root/dev/pts Now consider if '/export/lxc' is an absolute symlink pointing to '/media/lxc'. The kernel will try to open /media/lxc/roots/helloworld/root/dev/pts whereas it should be trying to open /.oldroot//media/lxc/roots/helloworld/root/dev/pts To deal with the fact that the root filesystem can be moved, we need to resolve symlinks in *any* part of the filesystem source path. * src/libvirt_private.syms, src/util/util.c, src/util/util.h: Add virFileResolveAllLinks to resolve all symlinks in a path * src/lxc/lxc_container.c: Resolve all symlinks in filesystem paths during startup
-
由 Osier Yang 提交于
pciTrySecondaryBusReset checks if there is active device on the same bus, however, qemu driver doesn't maintain an effective list for the inactive devices, and it passes meaningless argument for parameter "inactiveDevs". e.g. (qemuPrepareHostdevPCIDevices) if (!(pcidevs = qemuGetPciHostDeviceList(hostdevs, nhostdevs))) return -1; ..skipped... if (pciResetDevice(dev, driver->activePciHostdevs, pcidevs) < 0) goto reattachdevs; NB, the "pcidevs" used above are extracted from domain def, and thus one won't be able to attach a device of which bus has other device even detached from host (nodedev-detach). To see more details of the problem: RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=773667 This patch is to resolve the problem by introducing an inactive PCI device list (just like qemu_driver->activePciHostdevs), and the whole logic is: * Add the device to inactive list during nodedev-dettach * Remove the device from inactive list during nodedev-reattach * Remove the device from inactive list during attach-device (for non-managed device) * Add the device to inactive list after detach-device, only if the device is not managed With the above, we have a sufficient inactive PCI device list, and thus we can use it for pciResetDevice. e.g.(qemuPrepareHostdevPCIDevices) if (pciResetDevice(dev, driver->activePciHostdevs, driver->inactivePciHostdevs) < 0) goto reattachdevs;
-
- 13 1月, 2012 2 次提交
-
-
由 Eric Blake 提交于
Detected by Coverity. Although unlikely, if we are ever started with stdin closed, we could reach a situation where we open a uuid file but then fail to close it, making that file the new stdin for the rest of the process. * src/util/uuid.c (getDMISystemUUID): Allow for stdin.
-
由 Daniel P. Berrange 提交于
-
- 12 1月, 2012 2 次提交
-
-
由 Shradha Shah 提交于
This functions enables us to get the Virtual Functions attached to a Physical function given the name of a SR-IOV physical functio. In order to accomplish the task, added a getter function pciGetDeviceAddrString to get the BDF of the Virtual Function in a char array.
-
由 Shradha Shah 提交于
-
- 07 1月, 2012 1 次提交
-
-
由 Eric Blake 提交于
Commit db371a21 mistakenly added new functions inside a #ifndef WIN32 guard, even though they are needed on all platforms. * src/util/command.c (virCommandFDSet): Move outside WIN32 conditional.
-
- 05 1月, 2012 1 次提交
-
-
由 Michal Privoznik 提交于
Currently, virCommand implementation uses FD_ macros from sys/select.h. However, those cannot handle more opened files than FD_SETSIZE. Therefore switch to generalized implementation based on array of integers.
-
- 04 1月, 2012 2 次提交
-
-
由 Michal Privoznik 提交于
It is a good practise to set revents to zero before doing any poll(). Moreover, we should check if event we waited for really occurred or if any of fds we were polling on didn't encountered hangup.
-
- 25 12月, 2011 1 次提交
-
-
由 Michal Privoznik 提交于
In order to avoid situation where a USB device is in use by two domains, we must keep a list of already attached devices like we do for PCI.
-
- 21 12月, 2011 1 次提交
-
-
由 Hu Tao 提交于
-
- 16 12月, 2011 1 次提交
-
-
由 Peter Krempa 提交于
A generic error code was returned, if the user aborted a migration job. This made it hard to distinguish between a user requested abort and an error that might have occured. This patch introduces a new error code, which is returned in the specific case of a user abort, while leaving all other failures with their existing code. This makes it easier to distinguish between failure while mirgrating and an user requested abort. * include/libvirt/virterror.h: - add new error code * src/util/virterror.c: - add message for the new error code * src/qemu/qemu_migration.h: - Emit operation aborted error instead of operation failed, on migration abort
-
- 10 12月, 2011 2 次提交
-
-
由 Michal Privoznik 提交于
instead of simple 'if' statement as virCondWait can return even if associated condition was not signaled.
-
由 Michal Privoznik 提交于
-
- 09 12月, 2011 2 次提交
-
-
由 Michal Privoznik 提交于
Pool creates new workers dynamically. However, it is possible for a pool to have no workers. If we want to free that pool, we don't want to wait on quit condition as it will never be signaled.
-
由 Jiri Denemark 提交于
Due to copy&paste error in c1df2c14, virNetDevBridge[SG]etSTPDelay APIs were accessing wrong file.
-
- 08 12月, 2011 1 次提交
-
-
由 Eric Blake 提交于
On RHEL 5, with libxml2-2.6.26, the build failed with: virsh.c: In function 'vshNodeIsSuperset': virsh.c:11951: warning: implicit declaration of function 'xmlChildElementCount' (or if warnings aren't errors, a link failure later on). * src/util/xml.h (virXMLChildElementCount): New prototype. * src/util/xml.c (virXMLChildElementCount): New function. * src/libvirt_private.syms (xml.h): Export it. * tools/virsh.c (vshNodeIsSuperset): Use it.
-
- 04 12月, 2011 1 次提交
-
-
由 Eric Blake 提交于
https://bugzilla.redhat.com/show_bug.cgi?id=648855 mentioned a misuse of 'an' where 'a' is proper; that has since been fixed, but a search found other problems (some were a spelling error for 'and', while most were fixed by 'a'). * daemon/stream.c: Fix grammar. * src/conf/domain_conf.c: Likewise. * src/conf/domain_event.c: Likewise. * src/esx/esx_driver.c: Likewise. * src/esx/esx_vi.c: Likewise. * src/rpc/virnetclient.c: Likewise. * src/rpc/virnetserverprogram.c: Likewise. * src/storage/storage_backend_fs.c: Likewise. * src/util/conf.c: Likewise. * src/util/dnsmasq.c: Likewise. * src/util/iptables.c: Likewise. * src/xen/xen_hypervisor.c: Likewise. * src/xen/xend_internal.c: Likewise. * src/xen/xs_internal.c: Likewise. * tools/virsh.c: Likewise.
-