1. 30 10月, 2014 1 次提交
    • P
      storage: Fix crash when parsing backing store URI with schema · 98784369
      Peter Krempa 提交于
      The code that parses the schema from the URI touches the "hosts[0]"
      member of the storage file source structure in case the URI contains a
      schema. The hosts array was not yet allocated at the point in the code
      where the transport protocol was parsed and set. This lead to a crash of
      libvirtd.
      
      Fix the code by allocating the "hosts" array upfront and add a test case
      to verify this scenario. (Unfortunately this requires shuffling the test
      case numbers too).
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1156288
      98784369
  2. 24 9月, 2014 1 次提交
    • P
      util: storage: Allow metadata crawler to report useful errors · b8549877
      Peter Krempa 提交于
      Add a new parameter to virStorageFileGetMetadata that will break the
      backing chain detection process and report useful error message rather
      than having to use virStorageFileChainGetBroken.
      
      This patch just introduces the option, usage will be provided
      separately.
      b8549877
  3. 09 7月, 2014 1 次提交
  4. 25 6月, 2014 9 次提交
  5. 24 6月, 2014 2 次提交
  6. 16 6月, 2014 4 次提交
    • 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
    • E
      storage: better tests of lookup · b10a0e91
      Eric Blake 提交于
      Add some more tests of what happens when we restrict a lookup
      to begin at a point in the middle of a chain.  In particular,
      we want to ensure that a parent is not found when starting at
      the child.  This commit also demonstrates that we have a slight
      difference in behavior on what parent we report when filtering
      is in effect; as the determination of the parent affects the
      code in block commit, exposing this in the testsuite will help
      justify changes in future patches that tweak the semantics of
      what lookups are allowed.
      
      * tests/virstoragetest.c (testStorageLookup): Test user input.
      (TEST_LOOKUP_TARGET): Add parameter.
      (mymain): Add lookup tests.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b10a0e91
    • E
      storage: renumber lookup tests · 54597c56
      Eric Blake 提交于
      The next patch will be adding tests, including adding a parameter
      for testing more conditions.  For ease of review of that patch, I
      want to create common context lines that don't change when the new
      tests are added (it's easier to visually review additions than it
      is to review an entire chunk of tests rewritten into another
      larger chunk of tests).
      
      * tests/virstoragetest.c (mymain): Add a parameter and renumber
      the lookup tests.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      54597c56
    • E
      storage: add alias for less typing · 47aaceb7
      Eric Blake 提交于
      Typing chain->backingStore->backingStore gets old after a while;
      introduce some alias variables to make the test more compact.
      
      * tests/virstoragetest.c (mymain): Introduce some shorthand.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      47aaceb7
  7. 13 6月, 2014 1 次提交
    • P
      tests: virstoragetest: Fix output when hitting errors · 51c43905
      Peter Krempa 提交于
      When the test is failing but the debug output isn't enabled the
      resulting line would look ugly like and would not contain the actual
      difference.
      
      TEST: virstoragetest
            .................chain member 1!chain member 1!chain member 1!
      
      Store the member index in the actual checked string to hide this problem
      51c43905
  8. 03 6月, 2014 4 次提交
    • P
      tests: storagetest: Unify and reformat storage chain format string · 8ed19d8c
      Peter Krempa 提交于
      All the fields crammed into two lines weren't easy to parse by human
      eyes. Split up the format string into lines and put it into a central
      variable so that changes in two places aren't necessary.
      8ed19d8c
    • P
      storage: Change to new backing store parser · b225444e
      Peter Krempa 提交于
      Use the new backing store parser in the backing chain crawler. This
      change needs one test change where information about the NBD image are
      now parsed differently.
      b225444e
    • P
      test: storage: Initialize storage source to correct type · 29aabe73
      Peter Krempa 提交于
      Stat the path of the storage file being tested to set the correct type
      into the virStorageSource. This will avoid breaking the test suite when
      inquiring metadata of directory paths in the next patches.
      29aabe73
    • 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
  9. 06 5月, 2014 1 次提交
  10. 25 4月, 2014 2 次提交
  11. 24 4月, 2014 7 次提交
  12. 12 4月, 2014 4 次提交
    • E
      conf: delete internal directory field · e0292e0c
      Eric Blake 提交于
      Another field no longer needed, getting us one step closer to
      merging virStorageFileMetadata and virStorageSource.
      
      * src/util/virstoragefile.h (_virStorageFileMetadata): Drop
      field.
      * src/util/virstoragefile.c (virStorageFileGetMetadataInternal)
      (virStorageFileGetMetadataFromFDInternal): Alter signature.
      (virStorageFileFreeMetadata, virStorageFileGetMetadataFromBuf)
      (virStorageFileGetMetadataFromFD): Adjust clients.
      * tests/virstoragetest.c (_testFileData, testStorageChain)
      (mymain): Simplify test.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e0292e0c
    • E
      conf: tweak chain lookup internals · d193b34d
      Eric Blake 提交于
      Thanks to the testsuite, I feel quite confident that this rewrite
      is correct; it gives the same results for all cases except for one.
      I can make the argument that _that_ case was a pre-existing bug:
      when looking up relative names, the lookup is supposed to be
      pegged to the directory that contains the parent qcow2 file.  Thus,
      this resolves the fixme first mentioned in commit 367cd69d (even
      though I accidentally removed the fixme comment early in 74430fe3).
      
      * src/util/virstoragefile.c (virStorageFileChainLookup): Depend on
      new rather than old fields.
      * tests/virstoragetest.c (mymain): Adjust test to match fix.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d193b34d
    • E
      conf: drop redundant parameter to chain lookup · 74430fe3
      Eric Blake 提交于
      The original chain lookup code had to pass in the starting name,
      because it was not available in the chain.  But now that we have
      added fields to the struct, this parameter is redundant.
      
      * src/util/virstoragefile.h (virStorageFileChainLookup): Alter
      signature.
      * src/util/virstoragefile.c (virStorageFileChainLookup): Adjust
      handling of top of chain.
      * src/qemu/qemu_driver.c (qemuDomainBlockCommit): Adjust caller.
      * tests/virstoragetest.c (testStorageLookup, mymain): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      74430fe3
    • E
      conf: test backing chain lookup · 367cd69d
      Eric Blake 提交于
      I realized that we had no good test coverage of looking up a
      name from within a backing chain, even though code like
      block-commit is relying on it.
      
      * tests/virstoragetest.c (testStorageLookup): New function.
      (mymain): New tests.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      367cd69d
  13. 11 4月, 2014 3 次提交
    • E
      conf: delete useless backingStoreFormat field · 86cfa1f6
      Eric Blake 提交于
      Drop another redundant field from virStorageFileMetadata.
      
      * src/util/virstoragefile.h (_virStorageFileMetadata): Drop
      field.
      * src/util/virstoragefile.c
      (virStorageFileGetMetadataFromFDInternal)
      (virStorageFileGetMetadataFromFD)
      (virStorageFileGetMetadataRecurse): Adjust callers.
      * tests/virstoragetest.c (_testFileData, testStorageChain)
      (mymain): Simplify test.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      86cfa1f6
    • E
      conf: delete useless backingStoreIsFile field · c919ed7e
      Eric Blake 提交于
      Finally starting to prune away some of the old fields that have
      been made redundant by the new fields, on my way towards directly
      reusing virStorageSource.
      
      * src/util/virstoragefile.h (_virStorageFileMetadata): Drop
      field.
      * src/util/virstoragefile.c (virStorageFileGetMetadataInternal)
      (virStorageFileChainLookup): Adjust callers.
      * tests/virstoragetest.c (_testFileData, testStorageChain)
      (mymain): Simplify test.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c919ed7e
    • E
      conf: provide details on network backing store · 7010768c
      Eric Blake 提交于
      So far, my work has been merely preserving the status quo of
      backing file analysis.  But this patch starts to tread in the
      territory of making the backing chain code more powerful - we
      will eventually support network storage containing non-raw
      formats.  Here, we expose metadata information about a network
      backing store, even if that information is still hardcoded to
      a raw format for now.
      
      * src/util/virstoragefile.c (virStorageFileGetMetadataRecurse):
      Also populate struct for non-file backing.
      (virStorageFileGetMetadata, virStorageFileGetMetadatainternal):
      Recognize non-file top image.
      (virFindBackingFile): Add comment.
      (virStorageFileChainGetBroken): Adjust comment, ensure output
      is set.
      * tests/virstoragetest.c (mymain): Update test to reflect it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7010768c