1. 12 9月, 2014 1 次提交
  2. 10 9月, 2014 1 次提交
  3. 08 8月, 2014 1 次提交
    • E
      blockjob: avoid memory leak during block pivot · a595a005
      Eric Blake 提交于
      Valgrind caught a memory leak:
      
      ==2018== 9 bytes in 1 blocks are definitely lost in loss record 143 of 927
      ==2018==    at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==2018==    by 0x8C42369: strdup (strdup.c:42)
      ==2018==    by 0x50EACC9: virStrdup (virstring.c:676)
      ==2018==    by 0x50E79E5: virStorageSourceCopy (virstoragefile.c:1845)
      ==2018==    by 0x20A3FAA7: qemuDomainBlockCommit (qemu_driver.c:15620)
      ==2018==    by 0x51DC6B2: virDomainBlockCommit (libvirt.c:20092)
      
      I traced it to the fact that blockcopy and blockcommit end up
      reparsing a backing chain on pivot, but the chain parsing code
      doesn't gracefully handle the case where the backing file is
      already known.
      
      I'm not exactly sure when this was introduced, but suspect that the
      refactoring in commit 9944b710 and friends that moved towards probing
      in-place rather than into a temporary structure are part of the cause.
      
      * src/util/virstoragefile.c (virStorageFileGetMetadataInternal):
      Don't leak any prior value.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a595a005
  4. 09 7月, 2014 3 次提交
  5. 08 7月, 2014 6 次提交
  6. 04 7月, 2014 3 次提交
    • P
      util: storage: Add helper to determine whether storage is local · ea43f5f9
      Peter Krempa 提交于
      There's a lot of places where we skip doing actions based on the
      locality of given storage type. The usual pattern is to skip it if:
      
      virStorageSourceGetActualType(src) == VIR_STORAGE_TYPE_NETWORK
      
      Add a simple helper to simplify the pattern to
      virStorageSourceIsLocalStorage(src)
      ea43f5f9
    • J
      Utilize virDomainDiskAuth for domain disk · 6887af39
      John Ferlan 提交于
      Replace the inline "auth" struct in virStorageSource with a pointer
      to a virStorageAuthDefPtr and utilize between the domain_conf, qemu_conf,
      and qemu_command sources for finding the auth data for a domain disk
      6887af39
    • J
      virstorage: Introduce virStorageAuthDef · 1c36b944
      John Ferlan 提交于
      Introduce virStorageAuthDef and friends.  Future patches will merge/utilize
      their view of storage source/pool auth/secret definitions.
      
      New API's include:
          virStorageAuthDefParse:  Parse the "<auth/>" XML data for either the
                                   domain disk or storage pool returning a
                                   virStorageAuthDefPtr
          virStorageAuthDefCopy:   Copy a virStorageAuthDefPtr - to be used by
                                   the qemuTranslateDiskSourcePoolAuth when it
                                   copies storage pool auth data into domain
                                   disk auth data
          virStorageAuthDefFormat: Common output of the "<auth" in the domain
                                   disk or storage pool XML
          virStorageAuthDefFree:   Free memory associated with virStorageAuthDef
      
      Subsequent patches will utilize the new functions for the domain disk and
      storage pools.
      
      Future work in the hostdev pass through can then make use of common data
      structures and code.
      1c36b944
  7. 03 7月, 2014 1 次提交
    • J
      Use virBufferCheckError everywhere we report OOM error · 92a8e72f
      Ján Tomko 提交于
      Replace:
      if (virBufferError(&buf)) {
          virBufferFreeAndReset(&buf);
          virReportOOMError();
          ...
      }
      
      with:
      if (virBufferCheckError(&buf) < 0)
          ...
      
      This should not be a functional change (unless some callers
      misused the virBuffer APIs - a different error would be reported
      then)
      92a8e72f
  8. 26 6月, 2014 1 次提交
  9. 25 6月, 2014 5 次提交
  10. 24 6月, 2014 1 次提交
  11. 20 6月, 2014 2 次提交
  12. 16 6月, 2014 1 次提交
    • E
      blockcommit: require base below top · 3e3c6ff1
      Eric Blake 提交于
      The block commit code looks for an explicit base file relative
      to the discovered top file; so for a chain of:
        base <- snap1 <- snap2 <- snap3
      and a command of:
        virsh blockcommit $dom vda --base snap2 --top snap1
      we got a sane message (here from libvirt 1.0.5):
      error: invalid argument: could not find base 'snap2' below 'snap1' in chain for 'vda'
      
      Meanwhile, recent refactoring has slightly reduced the quality of the
      libvirt error messages, by losing the phrase 'below xyz':
      error: invalid argument: could not find image 'snap2' in chain for 'snap3'
      
      But we had a one-off, where we were not excluding the top file
      itself in searching for the base; thankfully qemu still reports
      the error, but the quality is worse:
        virsh blockcommit $dom vda --base snap2 --top snap2
      error: internal error unable to execute QEMU command 'block-commit': Base '/snap2' not found
      
      Fix the one-off in blockcommit by changing the semantics of name
      lookup - if a starting point is specified, then the result must
      be below that point, rather than including that point.  The only
      other call to chain lookup was blockpull code, which was already
      forcing the lookup to omit the active layer and only needs a
      tweak to use the new semantics.
      
      This also fixes the bug exposed in the testsuite, where when doing
      a lookup pinned to an intermediate point in the chain, we were
      unable to return the name of the parent also in the chain.
      
      * src/util/virstoragefile.c (virStorageFileChainLookup): Change
      semantics for non-NULL startFrom.
      * src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Adjust caller,
      to keep existing semantics.
      * tests/virstoragetest.c (mymain): Adjust to expose new semantics.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      3e3c6ff1
  13. 11 6月, 2014 1 次提交
    • E
      storage: fix memory leak with encrypted images · 1c7eb95c
      Eric Blake 提交于
      Jim Fehlig reported a regression found by libvirt-TCK tests:
      
      > ~ # perl /usr/share/libvirt-tck/tests/qemu/100-disk-encryption.t
      ...
      > ok 4 - defined persistent domain config
      > # Starting inactive domain config
      > libvirt error code: 1, message: internal error: unable to execute QEMU command
      > 'cont': 'drive-ide0-0-1'
      > (/var/cache/libvirt-tck/300-disk-encryption/demo.qcow2) is encrypted
      
      Commit 2279d560 converted a boolean into a pointer with the intent of
      transferring that pointer out of a temporary object into the caller's
      data structure.  The temporary structure meant that meta->encryption
      was always NULL on entry, so we could get away with blindly allocating
      the pointer when the header said so.  But later, commit 8823272d
      tweaked things to do backing chain detection in-place, rather than via
      a temporary object; this has the net result that meta->encryption can
      be non-NULL on entry.  Not only did this turn the latent behavior into
      a memory leak, it is also a behavior regression: blindly allocating a
      new pointer wipes out what secrets we already knew about the chain,
      making it impossible to restart the domain.
      
      Of course, no one in their right mind should be relying on qcow2
      encryption - it is fundamentally flawed.  And sadly, the TCK tests
      don't get run often enough, and this shows that our virstoragetest
      does not exercise encrypted images at all.  Otherwise, we could
      have avoided a release containing this regression.
      
      * src/util/virstoragefile.c (virStorageFileGetMetadataInternal):
      Don't nuke an already-existing encryption.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1c7eb95c
  14. 03 6月, 2014 3 次提交
    • P
      storage: Add infrastructure to parse remote network backing names · ed68eb86
      Peter Krempa 提交于
      Add parsers for relative and absolute backing names for local and remote
      storage files.
      
      This parser parses relative paths as relative to their parents and
      absolute paths according to the protocol or local access.
      
      For remote storage volumes, all URI based backing file names are
      supported and for the qemu colon syntax the NBD protocol is supported.
      ed68eb86
    • P
      storage: Switch metadata crawler to use storage driver to read headers · 2bdb8b96
      Peter Krempa 提交于
      Use virStorageFileReadHeader() to read headers of storage files possibly
      on remote storage to retrieve the image metadata.
      
      The backend information is now parsed by
      virStorageFileGetMetadataInternal which is now exported from the util
      source and virStorageFileGetMetadataFromFDInternal now doesn't need to
      be exported.
      2bdb8b96
    • P
      storage: Move virStorageFileGetMetadata to the storage driver · 713cc3b0
      Peter Krempa 提交于
      My future work will modify the metadata crawler function to use the
      storage driver file APIs to access the files instead of accessing them
      directly so that we will be able to request the metadata for remote
      files too. To avoid linking the storage driver to every helper file
      using the utils code, the backing chain traversal function needs to be
      moved to the storage driver source.
      
      Additionally the virt-aa-helper and virstoragetest programs need to be
      linked with the storage driver as a result of this change.
      713cc3b0
  15. 29 5月, 2014 3 次提交
  16. 23 5月, 2014 2 次提交
    • P
      storage: Add NONE protocol type for network disks · a01d9357
      Peter Krempa 提交于
      Currently the protocol type with index 0 was NBD which made it hard to
      distinguish whether the protocol type was actually assigned. Add a new
      protocol type with index 0 to distinguish it explicitly.
      a01d9357
    • P
      storage: Store gluster volume name separately · 1115f975
      Peter Krempa 提交于
      The gluster volume name was previously stored as part of the source path
      string. This is unfortunate when we want to do operations on the path as
      the volume is used separately.
      
      Parse and store the volume name separately for gluster storage volumes
      and use the newly stored variable appropriately.
      1115f975
  17. 19 5月, 2014 1 次提交
  18. 06 5月, 2014 1 次提交
    • E
      conf: drop extra storage probe · fff74b27
      Eric Blake 提交于
      All callers of virStorageFileGetMetadataFromBuf were first calling
      virStorageFileProbeFormatFromBuf, to learn what format to pass in.
      But this function is already wired to do the exact same probe if
      the incoming format is VIR_STORAGE_FILE_AUTO, so it's simpler to
      just refactor the probing into the central function.
      
      * src/util/virstoragefile.h (virStorageFileGetMetadataFromBuf):
      Drop parameter.
      (virStorageFileProbeFormatFromBuf): Drop declaration.
      * src/util/virstoragefile.c (virStorageFileGetMetadataFromBuf):
      Do probe here instead of in callers.
      (virStorageFileProbeFormatFromBuf): Make static.
      * src/libvirt_private.syms (virstoragefile.h): Drop function.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
      Update caller.
      * src/storage/storage_backend_gluster.c
      (virStorageBackendGlusterRefreshVol): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      fff74b27
  19. 02 5月, 2014 1 次提交
    • E
      storage: reject negative indices · 5c05e2b1
      Eric Blake 提交于
      Commit f22b7899 stumbled across a difference between 32-bit and
      64-bit platforms when parsing "-1" as an int.  Now that we've
      fixed that difference, it's time to fix the testsuite.
      
      * src/util/virstoragefile.c (virStorageFileParseChainIndex):
      Require a positive index.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      5c05e2b1
  20. 01 5月, 2014 1 次提交
  21. 29 4月, 2014 1 次提交