1. 07 11月, 2013 6 次提交
    • 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 14 次提交
  5. 03 11月, 2013 1 次提交
    • D
      MacOS: Handle changes to xdrproc_t definition · 9fa3a8ab
      Doug Goldstein 提交于
      With Mac OS X 10.9, xdrproc_t is no longer defined as:
      
      typedef bool_t (*xdrproc_t)(XDR *, ...);
      
      but instead as:
      
      typdef bool_t (*xdrproc_t)(XDR *, void *, unsigned int);
      
      For reference, Linux systems typically define it as:
      
      typedef bool_t (*xdrproc_t)(XDR *, void *, ...);
      
      The rationale explained in the header is that using a vararg is
      incorrect and has a potential to change the ABI slightly do to compiler
      optimizations taken and the undefined behavior. They decided
      to specify the exact number of parameters and for compatibility with old
      code decided to make the signature require 3 arguments. The third
      argument is ignored for cases that its not used and its recommended to
      supply a 0.
      9fa3a8ab