1. 12 11月, 2013 2 次提交
    • P
      conf: Split out code to parse the source of a disk definition · 16bc7864
      Peter Krempa 提交于
      To avoid code duplication between snapshot configuration code that
      parses the disk source too we need to split out this code that will be
      reused later on.
      
      This patch tries to be code movement, some aspects of this function will
      be refactored later.
      16bc7864
    • M
      qemuDomainObjStart: Warn on corrupted image · cfc28c66
      Michal Privoznik 提交于
      If the managedsave image is corrupted, e.g. the XML part is, we fail to
      parse it and throw an error, e.g.:
      
      error: Failed to start domain jms8
      error: XML error: missing security model when using multiple labels
      
      This is okay, as we can't really start the machine and avoid undefined
      qemu behaviour. On the other hand, the error message doesn't give a
      clue to users what should they do. The consensus here would be to thrown
      a warning to logs saying "Hey, you've got a corrupted file".
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      cfc28c66
  2. 11 11月, 2013 3 次提交
    • C
      docs: fix typos in libvirt.h.in · 0a85160f
      Chen Hanxiao 提交于
      s/repersents/represents
      Signed-off-by: NChen Hanxiao <chenhanxiao@cn.fujitsu.com>
      0a85160f
    • M
      virSecurityLabelDefParseXML: Don't parse label on model='none' · 9fb3f957
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1027096
      
      If there's the following snippet in the domain XML, the domain will be
      lost upon the daemon restart (if the domain is started prior restart):
      
          <seclabel type='dynamic' relabel='yes'/>
      
      The problem is, the 'label', 'imagelabel' and 'baselabel' are parsed
      whenever the VIR_DOMAIN_XML_INACTIVE is *not* present or the label is
      static. The latter is not our case, obviously. So, when libvirtd starts
      up, it finds domain state xml and parse it. During parsing, many XML
      flags are enabled but VIR_DOMAIN_XML_INACTIVE. Hence, our parser tries
      to extract 'label', 'imagelabel' and 'baselabel' from the XML which
      fails for model='none'. Err, this model - even though not specified in
      XML - can be taken from qemu wide config file: /etc/libvirtd/qemu.conf.
      
      However, in order to know we are dealing with model='none' the code in
      question must be moved forward a bit. Then a new check must be
      introduced. This is what the first two chunks are doing.
      
      But this alone is not sufficient. The domain state XML won't contain the
      model attribute without slight modification. The model should be
      inserted into the XML even if equal to 'none' and the state XML is being
      generated - what if the origin (the @security_driver variable in
      qemu.conf) changes during libvirtd restarts?
      
      At the end, a test to catch this scenario is introduced.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      9fb3f957
    • P
      virsh-domain: Mark --live and --config mutually exclusive in vcpucount · bf45db60
      Peter Krempa 提交于
      The 'vcpucount' command is a getter command for the vCPUu count. When
      one or more of the filtering flags are specified the command returns the
      value only for the selected combination. In this case the --live and
      --config combination isn't valid. This however didn't cause errors as
      the combination of flags was rejected by the libvirt API but then the
      fallback code kicked in and requested the count in a way where the clash
      of the flags didn't matter.
      
      Mark the flag combination mutually exclusive so that users aren't
      confused.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1024245
      bf45db60
  3. 09 11月, 2013 2 次提交
  4. 08 11月, 2013 15 次提交
    • V
      qemu: Fix SCSI hotplug on pseries guests · efdd591d
      Vitor de Lima 提交于
      This patch moves some code in the qemuDomainAttachSCSIDisk
      function. The check for the existence of a PCI address assigned
      to the SCSI controller was moved in order to be executed only
      when needed. The PCI address of a controller is not necessary
      if QEMU_CAPS_DEVICE is supported.
      
      This fixes issues with the hotplug of SCSI disks on pseries guests.
      efdd591d
    • L
      pci: properly handle out-of-order SRIOV virtual functions · 88c1fcd5
      Laine Stump 提交于
      This resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1025397
      
      When virPCIGetVirtualFunctions created the list of an SRIOV Physical
      Function's (PF) Virtual Functions (VF), it had assumed that the order
      of "virtfn*" links returned by readdir() from the PF's sysfs directory
      was already in the correct order. Experience has shown that this is
      not always the case - it can be in alphabetical order (which would
      e.g. place virtfn11 before virtfn2) or even some seemingly random
      order (see the example in the bugzilla report)
      
      This results in 1) incorrect assumptions made by consumers of the
      output of the virt_functions list of virsh nodedev-dumpxml, and 2)
      setting MAC address and vlan tag on the wrong VF (since libvirt uses
      netlink to set mac address and vlan tag, netlink requires the VF#, and
      the function virPCIGetVirtualFunctionIndex() returns the wrong index
      due to the improperly ordered VF list).
      
      The solution provided by this patch is for virPCIGetVirtualFunctions
      to no longer scan the entire device directory in its natural order,
      but instead to check for links individually by name "virtfn%d" where
      %d starts at 0 and increases with each success. Since VFs are created
      contiguously by the kernel, this will guarantee that all VFs are
      found, and placed in the arry in the correct order.
      
      One note of use to the uninitiated is that VIR_APPEND_ELEMENT always
      either increments *num_virtual_functions or fails, so no this isn't an
      endless loop.
      
      (NB: the SRIOV_* defines at the top of virpci.c were removed
      because they are unnecessary and/or not used.)
      88c1fcd5
    • L
      util: use size_t instead of unsigned int for num_virtual_functions · 89e2a6c8
      Laine Stump 提交于
      This is a prerequisite to the fix for the fix to:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1025397
      
      num_virtual_functions needs to be size_t in order to use the
      VIR_APPEND_ELEMENT macro.
      89e2a6c8
    • V
      qemu: assign PCI address to primary video card · 54e4d9d0
      Vitor de Lima 提交于
      When adding support for Q35 guests, the code to assign a PCI address
      to the primary video card was moved into Q35 and i440fx(PIIX3)
      specific functions, but no fallback was kept for other machine types
      that might have a video card.
      
      This patch remedies that by assigning a PCI address to the primary
      video card if it does not have any kind of address.  In particular,
      this fixes issues with pseries guests.
      Signed-off-by: NVitor de Lima <vitor.lima@eldorado.org.br>
      Signed-off-by: NLaine Stump <laine@laine.org>
      54e4d9d0
    • S
      util: use -w flag when calling iptables · ba95426d
      Serge Hallyn 提交于
      When supported, ask iptables to wait rather than fail if it is in use
      by another caller (like ufw).
      
      (See https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1245322)
      Signed-off-by: NSerge Hallyn <serge.hallyn@ubuntu.com>
      ba95426d
    • P
      qemu: process: Validate specific CPUID flags of a guest · d94b7817
      Peter Krempa 提交于
      When starting a VM the qemu process may filter out some requested
      features of a domain as it's not supported either by the host or by
      qemu. Libvirt didn't check if this happened which might end up in
      changing of the guest ABI when migrating.
      
      The proof of concept implementation adds the check for the recently
      introduced kvm_pv_unhalt cpuid feature bit. This feature depends on both
      qemu and host kernel support and thus increase the possibility of guest
      ABI breakage.
      d94b7817
    • P
      qemu: Add support for paravirtual spinlocks in the guest · e0dc8511
      Peter Krempa 提交于
      The linux kernel recently added support for paravirtual spinlock
      handling to avoid performance regressions on overcomitted hosts. This
      feature needs to be turned in the hypervisor so that the guest OS is
      notified about the possible support.
      
      This patch adds a new feature "paravirt-spinlock" to the XML and
      supporting code to enable the "kvm_pv_unhalt" pseudo CPU feature in
      qemu.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1008989
      e0dc8511
    • P
      conf: Refactor storing and usage of feature flags · de7b5faf
      Peter Krempa 提交于
      Currently we were storing domain feature flags in a bit field as the
      they were either enabled or disabled. New features such as paravirtual
      spinlocks however can be tri-state as the default option may depend on
      hypervisor version.
      
      To allow storing tri-state feature state in the same place instead of
      having to declare dedicated variables for each feature this patch
      refactors the bit field to an array.
      de7b5faf
    • P
      cpu: x86: Add internal CPUID features support and KVM feature bits · 2e8f9080
      Peter Krempa 提交于
      Some of the emulator features are presented in the <features> element in
      the domain XML although they are virtual CPUID feature bits when
      presented to the guest. To avoid confusing the users with these
      features, as they are not configurable via the <cpu> element, this patch
      adds an internal array where those can be stored privately instead of
      exposing them in the XML.
      
      Additionaly KVM feature bits are added as example usage of this code.
      2e8f9080
    • J
      qemu: Add monitor APIs to fetch CPUID data from QEMU · 3afde075
      Jiri Denemark 提交于
      The qemu monitor supports retrieval of actual CPUID bits presented to
      the guest using QMP monitor. Add APIs to extract these information and
      tests for them.
      Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
      3afde075
    • P
      cpu_x86: Refactor storage of CPUID data to add support for KVM features · f80a11c9
      Peter Krempa 提交于
      The CPUID functions were stored in multiple arrays according to a
      specified prefix of those. This made it very hard to add another prefix
      to store KVM CPUID features (0x40000000). Instead of hardcoding a third
      array this patch changes the approach used:
      
      The code is refactored to use a single array where the CPUID functions
      are stored ordered by the cpuid function so that they don't depend on
      the specific prefix and don't waste memory. The code is also less
      complex using this approach. A trateoff to this is the change from O(N)
      complexity to O(N^2) in x86DataAdd and x86DataSubtract. The rest of the
      functions were already using O(N^2) algorithms.
      f80a11c9
    • L
      storage: Fix a vol-clone bug on ppc64 · 4ffcb020
      Li Zhang 提交于
      vol-clone reports out of memory error with disk type on ppc64.
      
      Currently, wbytes is defined as size_t type (8 bytes), but
      args's value in ioctl(fd, args..) in kernel is int (4 bytes).
      This makes wbytes 2^32 times larger, causing an out of memory error.
      
      This patch changes size_t to int to synchronize with kernel.
      
      [1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/block/ioctl.c?id=5e01dc7b#n363
      [2] https://lkml.org/lkml/2013/11/1/620Signed-off-by: NLi Zhang <zhlcindy@linux.vnet.ibm.com>
      Signed-off-by: NJán Tomko <jtomko@redhat.com>
      4ffcb020
    • M
      qemu: Don't access vm->priv on unlocked domain · 1f2f879e
      Michal Privoznik 提交于
      Since 86d90b3a (yes, my patch; again) we are supporting NBD storage
      migration. However, on error recovery path we got the steps reversed.
      The correct order is: return NBD port to the virPortAllocator and then
      either unlock the vm or remove it from the driver. Not vice versa.
      
      ==11192== Invalid write of size 4
      ==11192==    at 0x11488559: qemuMigrationPrepareAny (qemu_migration.c:2459)
      ==11192==    by 0x11488EA6: qemuMigrationPrepareDirect (qemu_migration.c:2652)
      ==11192==    by 0x114D1509: qemuDomainMigratePrepare3Params (qemu_driver.c:10332)
      ==11192==    by 0x519075D: virDomainMigratePrepare3Params (libvirt.c:7290)
      ==11192==    by 0x1502DA: remoteDispatchDomainMigratePrepare3Params (remote.c:4798)
      ==11192==    by 0x12DECA: remoteDispatchDomainMigratePrepare3ParamsHelper (remote_dispatch.h:5741)
      ==11192==    by 0x5212127: virNetServerProgramDispatchCall (virnetserverprogram.c:435)
      ==11192==    by 0x5211C86: virNetServerProgramDispatch (virnetserverprogram.c:305)
      ==11192==    by 0x520A8FD: virNetServerProcessMsg (virnetserver.c:165)
      ==11192==    by 0x520A9E1: virNetServerHandleJob (virnetserver.c:186)
      ==11192==    by 0x50DA78F: virThreadPoolWorker (virthreadpool.c:144)
      ==11192==    by 0x50DA11C: virThreadHelper (virthreadpthread.c:161)
      ==11192==  Address 0x1368baa0 is 576 bytes inside a block of size 688 free'd
      ==11192==    at 0x4A07F5C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==11192==    by 0x5079A2F: virFree (viralloc.c:580)
      ==11192==    by 0x11456C34: qemuDomainObjPrivateFree (qemu_domain.c:267)
      ==11192==    by 0x50F41B4: virDomainObjDispose (domain_conf.c:2034)
      ==11192==    by 0x50C2991: virObjectUnref (virobject.c:262)
      ==11192==    by 0x50F4CFC: virDomainObjListRemove (domain_conf.c:2361)
      ==11192==    by 0x1145C125: qemuDomainRemoveInactive (qemu_domain.c:2087)
      ==11192==    by 0x11488520: qemuMigrationPrepareAny (qemu_migration.c:2456)
      ==11192==    by 0x11488EA6: qemuMigrationPrepareDirect (qemu_migration.c:2652)
      ==11192==    by 0x114D1509: qemuDomainMigratePrepare3Params (qemu_driver.c:10332)
      ==11192==    by 0x519075D: virDomainMigratePrepare3Params (libvirt.c:7290)
      ==11192==    by 0x1502DA: remoteDispatchDomainMigratePrepare3Params (remote.c:4798)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      1f2f879e
    • M
      qemu: Avoid double free of VM · 5a4c2374
      Michal Privoznik 提交于
      One of my previous patches (c7ac2519) did try to fix the issue when
      domain dies too soon during migration. However, this clumsy approach was
      missing removal of qemuProcessHandleMonitorDestroy resulting in double
      unrefing of mon->vm and hence producing the daemon crash:
      
      ==11843== Invalid read of size 4
      ==11843==    at 0x50C28C5: virObjectUnref (virobject.c:255)
      ==11843==    by 0x1148F7DB: qemuMonitorDispose (qemu_monitor.c:258)
      ==11843==    by 0x50C2991: virObjectUnref (virobject.c:262)
      ==11843==    by 0x50C2D13: virObjectFreeCallback (virobject.c:388)
      ==11843==    by 0x509C37B: virEventPollCleanupHandles (vireventpoll.c:583)
      ==11843==    by 0x509C711: virEventPollRunOnce (vireventpoll.c:652)
      ==11843==    by 0x509A620: virEventRunDefaultImpl (virevent.c:274)
      ==11843==    by 0x520D21C: virNetServerRun (virnetserver.c:1112)
      ==11843==    by 0x11F368: main (libvirtd.c:1513)
      ==11843==  Address 0x13b88864 is 4 bytes inside a block of size 136 free'd
      ==11843==    at 0x4A07F5C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==11843==    by 0x5079A2F: virFree (viralloc.c:580)
      ==11843==    by 0x50C29E3: virObjectUnref (virobject.c:270)
      ==11843==    by 0x114770E4: qemuProcessHandleMonitorDestroy (qemu_process.c:1103)
      ==11843==    by 0x1148F7CB: qemuMonitorDispose (qemu_monitor.c:257)
      ==11843==    by 0x50C2991: virObjectUnref (virobject.c:262)
      ==11843==    by 0x50C2D13: virObjectFreeCallback (virobject.c:388)
      ==11843==    by 0x509C37B: virEventPollCleanupHandles (vireventpoll.c:583)
      ==11843==    by 0x509C711: virEventPollRunOnce (vireventpoll.c:652)
      ==11843==    by 0x509A620: virEventRunDefaultImpl (virevent.c:274)
      ==11843==    by 0x520D21C: virNetServerRun (virnetserver.c:1112)
      ==11843==    by 0x11F368: main (libvirtd.c:1513)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      5a4c2374
    • J
      Allow root directory in filesystem source dir schema · eab51940
      Ján Tomko 提交于
      Use absDirPath instead of absFilePath.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1028107
      eab51940
  5. 07 11月, 2013 14 次提交
    • M
      qemuMigrationBeginPhase: Check for 'drive-mirror' for NBD · b2f31af7
      Michal Privoznik 提交于
      So far we are checking if qemu supports 'nbd-server-start'. This,
      however, makes no sense on the source as nbd-server-* is used on the
      destination. On the source the 'drive-mirror' is used instead.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      b2f31af7
    • C
      conf: fix incorrect error log in virCPUDefIsEqual · 4bcb74d0
      Chen Hanxiao 提交于
      A copy-paste error.
      s/model/vendor id
      Signed-off-by: NChen Hanxiao <chenhanxiao@cn.fujitsu.com>
      4bcb74d0
    • M
      tests: Distribute virpcitestdata · 5ac7f078
      Michal Privoznik 提交于
      Since 21685c95 we have tests/virpcitestdata dir containing the PCI
      config files for some dummy PCI devices that are used int virpcitest.
      However, the directory containing the config files is not distributed
      making 'make rpm' fail.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      5ac7f078
    • J
      tests: Fix virtpcitest in VPATH · 2cbc0164
      Jiri Denemark 提交于
      2cbc0164
    • P
      conf: Refactor virDomainDiskSourcePoolDefParse · 6e037015
      Peter Krempa 提交于
      For some strange reason virDomainDiskSourcePoolDefParse accessed def of
      the disk and allocated the pool object in it. To avoid the need to carry
      over the disk definition object, refactor this function to return the
      allocated object instead.
      6e037015
    • 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
  6. 06 11月, 2013 4 次提交
    • 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