1. 07 11月, 2013 9 次提交
    • E
      nodeinfo: fix build on non-Linux · adb44955
      Eric Blake 提交于
      Commit b0f85462 broke the build on mingw, by exposing code that
      had Linux-specific dependencies but which was previously protected
      by libnuma ifdef guards:
      
      make[3]: Entering directory `/home/eblake/libvirt-tmp/build/src'
        CC       libvirt_driver_la-nodeinfo.lo
      ../../src/nodeinfo.c: In function 'virNodeGetSiblingsList':
      ../../src/nodeinfo.c:1543:30: error: 'SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX' undeclared (first use in this function)
           if (virFileReadAll(path, SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX, &buf) < 0)
                                    ^
      ../../src/nodeinfo.c:1543:30: note: each undeclared identifier is reported only once for each function it appears in
      ../../src/nodeinfo.c: In function 'virNodeCapsFillCPUInfo':
      ../../src/nodeinfo.c:1562:5: error: implicit declaration of function 'virNodeGetCpuValue' [-Werror=implicit-function-declaration]
           if ((tmp = virNodeGetCpuValue(SYSFS_CPU_PATH, cpu_id,
           ^
      ../../src/nodeinfo.c:1562:5: error: nested extern declaration of 'virNodeGetCpuValue' [-Werror=nested-externs]
      ../../src/nodeinfo.c:1562:35: error: 'SYSFS_CPU_PATH' undeclared (first use in this function)
           if ((tmp = virNodeGetCpuValue(SYSFS_CPU_PATH, cpu_id,
                                         ^
      cc1: all warnings being treated as errors
      
      * src/nodeinfo.c (virNodeCapsFillCPUInfo): Make conditional.
      (virNodeGetSiblingsList): Move into #ifdef linux block.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      adb44955
    • E
      storage: always probe type with buffer · 348b4e25
      Eric Blake 提交于
      This gets rid of another stat() per volume, as well as cutting
      bytes read in half, when populating the volumes of a directory
      pool during a pool refresh.  Not to mention that it provides an
      interface that can let gluster pools also probe file types.
      
      * src/util/virstoragefile.h (virStorageFileProbeFormatFromFD):
      Delete.
      (virStorageFileProbeFormatFromBuf): New prototype.
      (VIR_STORAGE_MAX_HEADER): New constant, based on...
      * src/util/virstoragefile.c (STORAGE_MAX_HEAD): ...old name.
      (vmdk4GetBackingStore, virStorageFileGetMetadataInternal)
      (virStorageFileProbeFormat): Adjust clients.
      (virStorageFileProbeFormatFromFD): Delete.
      (virStorageFileProbeFormatFromBuf): Export.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
      Adjust client.
      * src/libvirt_private.syms (virstoragefile.h): Adjust exports.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      348b4e25
    • E
      storage: refactor backing chain division of labor · 3ead2e7d
      Eric Blake 提交于
      Future patches will want to learn metadata about a file using
      a buffer that was already parsed in order to probe the file's
      format.  Rather than reopening and re-reading the file, it makes
      sense to separate getting file contents from actually parsing
      those contents.
      
      * src/util/virstoragefile.c (virStorageFileGetMetadataFromBuf)
      (virStorageFileGetMetadataFromFDInternal): New functions.
      (virStorageFileGetMetadataInternal): Hoist fstat() and read() into
      callers.
      (virStorageFileGetMetadataFromFD)
      (virStorageFileGetMetadataRecurse): Rework clients.
      * src/util/virstoragefile.h (virStorageFileGetMetadataFromBuf):
      New prototype.
      * src/libvirt_private.syms (virstoragefile.h): Export it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      3ead2e7d
    • E
      storage: reduce number of stat calls · 9cac8639
      Eric Blake 提交于
      We are calling fstat() at least twice per storage volume in
      a directory storage pool; this is rather wasteful.  Refactoring
      this is also a step towards making code reusable for gluster,
      where gluster can provide struct stat but cannot use fstat().
      
      * src/storage/storage_backend.h
      (virStorageBackendVolOpenCheckMode)
      (virStorageBackendUpdateVolTargetInfoFD): Update signature.
      * src/storage/storage_backend.c
      (virStorageBackendVolOpenCheckMode): Pass stat results back.
      (virStorageBackendUpdateVolTargetInfoFD): Use existing stats.
      (virStorageBackendVolOpen, virStorageBackendUpdateVolTargetInfo):
      Update callers.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
      Likewise.
      * src/storage/storage_backend_scsi.c
      (virStorageBackendSCSIUpdateVolTargetInfo): Likewise.
      * src/storage/storage_backend_mpath.c
      (virStorageBackendMpathUpdateVolTargetInfo): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      9cac8639
    • E
      storage: avoid short reads while chasing backing chain · 5327fad4
      Eric Blake 提交于
      Our backing file chain code was not very robust to an ill-timed
      EINTR, which could lead to a short read causing us to randomly
      treat metadata differently than usual.  But the existing
      virFileReadLimFD forces an error if we don't read the entire
      file, even though we only care about the header of the file.
      So add a new virFile function that does what we want.
      
      * src/util/virfile.h (virFileReadHeaderFD): New prototype.
      * src/util/virfile.c (virFileReadHeaderFD): New function.
      * src/libvirt_private.syms (virfile.h): Export it.
      * src/util/virstoragefile.c (virStorageFileGetMetadataInternal)
      (virStorageFileProbeFormatFromFD): Use it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      5327fad4
    • E
      storage: use simpler 'char *' · 5717ee6a
      Eric Blake 提交于
      'unsigned char *' makes sense if you are doing math on bytes and
      don't want to worry about wraparound from a signed 'char'; but
      since all we are doing is memcmp() or virReadBufInt*[LB]E(), which
      are both safe on either type of char, and since read() prefers to
      operate on 'char *', it's simpler to avoid casts by just typing
      things as 'char *' from the get-go.  [Technically, read can
      operate on an 'unsigned char *' thanks to the C rule that any
      pointer can be implicitly converted to 'char *' for legacy K&R
      compatibility; but where this patch saves us is if we try to use
      virfile.h functions that take 'char **' in order to allocate the
      buffer, where the compiler would barf on type mismatch.]
      
      * src/util/virstoragefile.c (FileTypeInfo): Avoid unsigned char.
      (cowGetBackingStore, qcow2GetBackingStoreFormat)
      (qcowXGetBackingStore, qcow1GetBackingStore)
      (qcow2GetBackingStore, vmdk4GetBackingStore, qedGetBackingStore)
      (virStorageFileMatchesMagic, virStorageFileMatchesVersion)
      (virStorageFileProbeFormatFromBuf, qcow2GetFeatures)
      (virStorageFileGetMetadataInternal)
      (virStorageFileProbeFormatFromFD): Simplify clients.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      5717ee6a
    • J
      add SystemTap to apps using libvirt · 3897975e
      Jonathan Lebon 提交于
      Starting from v2.4 (released today!), SystemTap can use libvirt to
      execute scripts inside virtual machines.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      3897975e
    • G
      test driver: add support for .connectBaselineCPU · 2b68ad71
      Giuseppe Scrivano 提交于
      It uses the same functionalities of the qemu driver.
      Signed-off-by: NGiuseppe Scrivano <gscrivan@redhat.com>
      2b68ad71
    • M
      qemuMonitorDispose: Reset lastError · 9cc8a5af
      Michal Privoznik 提交于
      Since the 90139a62 commit the error is copied into mon->lastError but
      it's never freed from there.
      
      ==31989== 395 bytes in 1 blocks are definitely lost in loss record 877 of 978
      ==31989==    at 0x4A06C2B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==31989==    by 0x7EAF129: strdup (in /lib64/libc-2.15.so)
      ==31989==    by 0x50D586C: virStrdup (virstring.c:554)
      ==31989==    by 0x50976C1: virCopyError (virerror.c:191)
      ==31989==    by 0x5097A35: virCopyLastError (virerror.c:312)
      ==31989==    by 0x114909A9: qemuMonitorIO (qemu_monitor.c:690)
      ==31989==    by 0x509BEDE: virEventPollDispatchHandles (vireventpoll.c:501)
      ==31989==    by 0x509C701: virEventPollRunOnce (vireventpoll.c:648)
      ==31989==    by 0x509A620: virEventRunDefaultImpl (virevent.c:274)
      ==31989==    by 0x520D21C: virNetServerRun (virnetserver.c:1112)
      ==31989==    by 0x11F368: main (libvirtd.c:1513)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      9cc8a5af
  2. 06 11月, 2013 6 次提交
    • C
      docs: fix a typo in formatnwfilter · 15020291
      Chen Hanxiao 提交于
      s/fragement/fragment
      Signed-off-by: NChen Hanxiao <chenhanxiao@cn.fujitsu.com>
      15020291
    • Z
      qemu: clean up migration ports when migration cancelled · c92ca769
      Zeng Junliang 提交于
      If there's a migration cancelled, the bitmap of migration port should be
      cleaned up too.
      Signed-off-by: NZeng Junliang <zengjunliang@huawei.com>
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      c92ca769
    • L
      network: fix connections count in case of allocate failure · b4e0299d
      Laine Stump 提交于
      This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1020135
      
      If networkAllocateActualDevice() had failed due to a pool of hostdev
      or direct devices being depleted, the calling function could still
      call networkReleaseActualDevice() as part of its cleanup, and that
      function would then unconditionally decrement the connections count
      for the network, even though it hadn't been incremented (due to
      failure of allocate). This *was* necessary because the .actual member
      of the netdef was allocated with a "lazy" algorithm, only being
      created if there was a need to store data there (e.g. if a device was
      allocated from a pool, or bandwidth was allocated for the device), so
      there was no simple way for networkReleaseActualDevice() to tell if
      something really had been allocated (i.e. if "connections++" had been
      executed).
      
      This patch changes networkAllocateDevice() to *always* allocate an
      actual device for any netdef of type='network', even if it isn't
      needed for any other reason. This has no ill effects anywhere else in
      the code (except for using a small amount of memory), and
      networkReleaseActualDevice() can then determine if there was a
      previous successful allocate by checking for .actual != NULL (if not,
      it skips the "connections--").
      b4e0299d
    • M
      virpcitest: Introduce testVirPCIDeviceReset · 21685c95
      Michal Privoznik 提交于
      This addition, however, requires some refactoring to be done.  First of
      all, to match the best practice we should detach the device prior
      resetting it. That's why testVirPCIDeviceDetach is detaching all devices
      within 0000:00:01.0 and 0000:00:03.0 range. Then, the brand new test
      will reset the 0000:00:02.0 device, so the last testVirPCIDeviceReattach
      can reattach all the devices back.
      
      In order to perform a PCI device reset, the dummy config file is not
      sufficient anymore and must be replaced with real PCI config (binary
      mess). Such config files are to be stored under tests/virpcitestdata/
      and ought to have '.config' suffix.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      21685c95
    • G
      virt-login-shell: also build virAtomic.h · 12dc729a
      Guido Günther 提交于
      Needed for architectures that don't use gcc atomic ops but pthread. This
      fixes the armel build that otherwise breaks like:
      
       CCLD     virt-login-shell
       ../src/.libs/libvirt-setuid-rpc-client.a(libvirt_setuid_rpc_client_la-virobject.o): In function `virClassNew':
       /«PKGBUILDDIR»/debian/build/src/../../../src/util/virobject.c:150: undefined reference to `virAtomicLock'
       ../src/.libs/libvirt-setuid-rpc-client.a(libvirt_setuid_rpc_client_la-virobject.o): In function `virObjectNew':
       /«PKGBUILDDIR»/debian/build/src/../../../src/util/virobject.c:202: undefined reference to `virAtomicLock'
       ../src/.libs/libvirt-setuid-rpc-client.a(libvirt_setuid_rpc_client_la-virobject.o): In function `virObjectUnref':
       /«PKGBUILDDIR»/debian/build/src/../../../src/util/virobject.c:274: undefined reference to `virAtomicLock'
       ../src/.libs/libvirt-setuid-rpc-client.a(libvirt_setuid_rpc_client_la-virobject.o): In function `virObjectRef':
       /«PKGBUILDDIR»/debian/build/src/../../../src/util/virobject.c:295: undefined reference to `virAtomicLock'
       collect2: error: ld returned 1 exit status
      
      See https://buildd.debian.org/status/fetch.php?pkg=libvirt&arch=armel&ver=1.1.4-1&stamp=1383588268
      12dc729a
    • M
      virpcitest: Fix variable arguments using in pci_driver_new · 361f2fa8
      Michal Privoznik 提交于
      In the pci_driver_new function it is possible to set a list of
      <vendor:device> IDs that the driver knows. These IDs are passed as
      variable arguments and are processed  the usual way using va_start() and
      va_arg(). However, after all arguments has been processed, we should
      call va_end() what we aren't currently doing.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      361f2fa8
  3. 05 11月, 2013 13 次提交
  4. 04 11月, 2013 12 次提交