1. 05 11月, 2013 1 次提交
  2. 21 10月, 2013 1 次提交
  3. 01 10月, 2013 1 次提交
    • L
      util: recognize SMB/CIFS filesystems as shared · e4e73337
      Laine Stump 提交于
      This should resolve:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1012085
      
      libvirt previously recognized NFS, GFS2, OCFS2, and AFS filesystems as
      "shared", and thus eligible for exceptions to certain rules/actions
      about chowning image files before handing them off to a guest. This
      patch widens the definition of "shared filesystem" to include SMB and
      CIFS filesystems (aka "Windows file sharing"); both of these use the
      same protocol, but different drivers so there are different magic
      numbers for each.
      e4e73337
  4. 01 8月, 2013 1 次提交
    • G
      qemu: add helper functions for diskchain checking · d7b7aa2c
      Guannan Ren 提交于
      *src/util/virstoragefile.c: Add a helper function to get
      the first name of missing backing files, if the name is NULL,
      it means the diskchain is not broken.
      *src/qemu/qemu_domain.c: qemuDiskChainCheckBroken(disk) to
      check if its chain is broken
      d7b7aa2c
  5. 11 7月, 2013 1 次提交
  6. 10 7月, 2013 2 次提交
  7. 21 6月, 2013 1 次提交
    • J
      util: add support for qcow2v3 image detection · a1ee8e18
      Ján Tomko 提交于
      Detect qcow2 images with version 3 in the image header as
      VIR_STORAGE_FILE_QCOW2.
      
      These images have a feature bitfield, with just one feature supported
      so far: lazy_refcounts.
      
      The header length changed too, moving the location of the backing
      format name.
      a1ee8e18
  8. 10 6月, 2013 1 次提交
  9. 06 6月, 2013 1 次提交
  10. 05 6月, 2013 1 次提交
    • O
      storage: Support preallocate the new capacity for vol-resize · aa2a4cff
      Osier Yang 提交于
      The document for "vol-resize" says the new capacity will be sparse
      unless "--allocate" is specified, however, the "--allocate" flag
      is never implemented. This implements the "--allocate" flag for
      fs backend's raw type volume, based on posix_fallocate and the
      syscall SYS_fallocate.
      aa2a4cff
  11. 24 5月, 2013 1 次提交
  12. 21 5月, 2013 1 次提交
  13. 11 5月, 2013 1 次提交
    • L
      util: fix virFileOpenAs return value and resulting error logs · a2c1bedb
      Laine Stump 提交于
      This resolves:
      
           https://bugzilla.redhat.com/show_bug.cgi?id=851411
           https://bugzilla.redhat.com/show_bug.cgi?id=955500
      
      The first problem was that virFileOpenAs was returning fd (-1) in one
      of the error cases rather than ret (-errno), so the caller thought
      that the error was EPERM rather than ENOENT.
      
      The second problem was that some log messages in the general purpose
      qemuOpenFile() function would always say "Failed to create" even if
      the caller hadn't included O_CREAT (i.e. they were trying to open an
      existing file).
      
      This fixes virFileOpenAs to jump down to the error return (which
      returns ret instead of fd) in the previously mentioned incorrect
      failure case of virFileOpenAs(), removes all error logging from
      virFileOpenAs() (since the callers report it), and modifies
      qemuOpenFile to appropriately use "open" or "create" in its log
      messages.
      
      NB: I seriously considered removing logging from all callers of
      virFileOpenAs(), but there is at least one case where the caller
      doesn't want virFileOpenAs() to log any errors, because it's just
      going to try again (qemuOpenFile()). We can't simply make a silent
      variation of virFileOpenAs() though, because qemuOpenFile() can't make
      the decision about whether or not it wants to retry until after
      virFileOpenAs() has already returned an error code.
      
      Likewise, I also considered changing virFileOpenAs() to return -1 with
      errno set on return, and may still do that, but only as a separate
      patch, as it obscures the intent of this patch too much.
      a2c1bedb
  14. 02 5月, 2013 1 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88
  15. 14 3月, 2013 1 次提交
  16. 16 2月, 2013 4 次提交
    • E
      storage: don't follow backing chain symlinks too eagerly · d1333dd0
      Eric Blake 提交于
      If you have a qcow2 file /path1/to/file pointed to by symlink
      /path2/symlink, and pass qemu /path2/symlink, then qemu treats
      a relative backing file in the qcow2 metadata as being relative
      to /path2, not /path1/to.  Yes, this means that it is possible
      to create a qcow2 file where the choice of WHICH directory and
      symlink you access its contents from will then determine WHICH
      backing file (if any) you actually find; the results can be
      rather screwy, but we have to match what qemu does.
      
      Libvirt and qemu default to creating absolute backing file
      names, so most users don't hit this.  But at least VDSM uses
      symlinks and relative backing names alongside the
      --reuse-external flags to libvirt snapshot operations, with the
      result that libvirt was failing to follow the intended chain of
      backing files, and then backing files were not granted the
      necessary sVirt permissions to be opened by qemu.
      
      See https://bugzilla.redhat.com/show_bug.cgi?id=903248 for
      more gory details.  This fixes a regression introduced in
      commit 82507838.
      
      I tested this patch by creating the following chain:
      
      ls /home/eblake/Downloads/Fedora.iso # raw file for base
      cd /var/lib/libvirt/images
      qemu-img create -f qcow2 \
        -obacking_file=/home/eblake/Downloads/Fedora.iso,backing_fmt=raw one
      mkdir sub
      cd sub
      ln -s ../one onelink
      qemu-img create -f qcow2 \
        -obacking_file=../sub/onelink,backing_fmt=qcow2 two
      mv two ..
      ln -s ../two twolink
      qemu-img create -f qcow2 \
        -obacking_file=../sub/twolink,backing_fmt=qcow2 three
      mv three ..
      ln -s ../three threelink
      
      then pointing my domain at /var/lib/libvirt/images/sub/threelink.
      Prior to this patch, I got complaints about missing backing
      files; afterwards, I was able to verify that the backing chain
      (and hence DAC and SELinux relabels) of the entire chain worked.
      
      * src/util/virstoragefile.h (_virStorageFileMetadata): Add
      directory member.
      * src/util/virstoragefile.c (absolutePathFromBaseFile): Drop,
      replaced by...
      (virFindBackingFile): ...better function.
      (virStorageFileGetMetadataInternal): Add an argument.
      (virStorageFileGetMetadataFromFD, virStorageFileChainLookup)
      (virStorageFileGetMetadata): Update callers.
      d1333dd0
    • E
      storage: refactor metadata lookup · 2485f921
      Eric Blake 提交于
      Prior to this patch, we had the callchains:
      external users
        \-> virStorageFileGetMetadataFromFD
            \-> virStorageFileGetMetadataFromBuf
      virStorageFileGetMetadataRecurse
        \-> virStorageFileGetMetadataFromFD
            \-> virStorageFileGetMetadataFromBuf
      
      However, a future patch wants to add an additional parameter to
      the bottom of the chain, for use by virStorageFileGetMetadataRecurse,
      without affecting existing external callers.  Since there is only a
      single caller of the internal function, we can repurpose it to fit
      our needs, with this patch giving us:
      
      external users
        \-> virStorageFileGetMetadataFromFD
            \-> virStorageFileGetMetadataInternal
      virStorageFileGetMetadataRecurse /
        \-> virStorageFileGetMetadataInternal
      
      * src/util/virstoragefile.c (virStorageFileGetMetadataFromFD):
      Move most of the guts...
      (virStorageFileGetMetadataFromBuf): ...here, and rename...
      (virStorageFileGetMetadataInternal): ...to this.
      (virStorageFileGetMetadataRecurse): Use internal helper.
      2485f921
    • E
      storage: prepare for refactoring · b7df4f92
      Eric Blake 提交于
      virStorageFileGetMetadataFromFD is the only caller of
      virStorageFileGetMetadataFromBuf; and it doesn't care about the
      difference between a return of 0 (total success) or 1
      (metadata was inconsistent, but pointer was populated as best
      as possible); only about a return of -1 (could not read metadata
      or out of memory).  Changing the return type, and normalizing
      the variable names used, will make merging the functions easier
      in the next commit.
      
      * src/util/virstoragefile.c (virStorageFileGetMetadataFromBuf):
      Change return value, and rename some variables.
      (virStorageFileGetMetadataFromFD): Rename some variables.
      b7df4f92
    • E
      storage: rearrange functions · 5e4946d4
      Eric Blake 提交于
      No semantic change; done so the next patch doesn't need a forward
      declaration of a static function.
      
      * src/util/virstoragefile.c (virStorageFileProbeFormatFromBuf):
      Hoist earlier.
      5e4946d4
  17. 13 2月, 2013 1 次提交
    • E
      util: use new virendian.h macros · 731ad692
      Eric Blake 提交于
      This makes code easier to read, by avoiding lines longer than
      80 columns and removing the repetition from the callers.
      
      * src/util/virstoragefile.c (qedGetHeaderUL, qedGetHeaderULL):
      Delete in favor of more generic macros.
      (qcow2GetBackingStoreFormat, qcowXGetBackingStore)
      (qedGetBackingStore, virStorageFileMatchesVersion)
      (virStorageFileGetMetadataInternal): Use new macros.
      * src/cpu/cpu_x86.c (x86VendorLoad): Likewise.
      731ad692
  18. 05 2月, 2013 2 次提交
    • M
      Add basic support for VDI images · 027bf2ea
      Martin Kletzander 提交于
      QEMU is fully capable of handling VDI images and we just refuse to
      work with them.  As qemu-img knows and supports this, there should be
      no problem with this addition.
      
      This is of course, just basic functionality, without searching for any
      backing files, etc.
      027bf2ea
    • M
      Support shifted magic in storage files · a0f98229
      Martin Kletzander 提交于
      Some files have the magic shifted to some offset other than 0, so we
      have to support that.  I also cleaned up some lines to be more
      readable and added missing magic for iso file format.
      a0f98229
  19. 14 1月, 2013 1 次提交
  20. 21 12月, 2012 5 次提交
  21. 13 12月, 2012 4 次提交
  22. 12 12月, 2012 1 次提交
  23. 22 11月, 2012 1 次提交
    • P
      qemu: Stop recursive detection of image chains when an image is missing · 58a54dc3
      Peter Krempa 提交于
      Commit e0c469e5 that fixes the detection
      of image chain wasn't complete. Iteration through the backing image
      chain has to stop at the last existing image if some of the images are
      missing otherwise the backing chain that is cached contains entries with
      paths being set to NULL resulting to:
      
      error: Unable to allow access for disk path (null): Bad address
      
      Fortunately stat() is kind enough not to crash when it's presented with
      a NULL argument. At least on Linux.
      58a54dc3
  24. 09 11月, 2012 1 次提交
    • P
      storage: fix broken backing chain · e0c469e5
      Philipp Hahn 提交于
      82507838 refactored the code to keep both the raw and canonicalized form
      of the backingStore, which breaks badly when the storage pool contains a
      storage volume, which is missing its backing store file:
       # ./daemon/libvirtd -l
       2012-11-07 12:43:33.279+0000: 22175: info : libvirt version: 1.0.0
       2012-11-07 12:43:33.279+0000: 22175: error : absolutePathFromBaseFile:542 : Can't canonicalize path '/var/lib/libvirt/images/base.qcow2': No such file or directory
       2012-11-07 12:43:33.280+0000: 22175: error : storageDriverAutostart:115 : Failed to autostart storage pool 'default': Can't canonicalize path '/var/lib/libvirt/images/base.qcow2': No such file or directory
      
      This is because virStorageFileGetMetadataFromBuf() aborts with -1 if the
      filename of the backingStore can not be canonicalized:
       #0  absolutePathFromBaseFile () at util/storage_file.c:541
       #1  virStorageFileGetMetadataFromBuf () at util/storage_file.c:728
       #2  virStorageFileGetMetadataFromFD () at util/storage_file.c:932
       #3  virStorageBackendProbeTarget () at storage/storage_backend_fs.c:94
       #4  virStorageBackendFileSystemRefresh () at storage/storage_backend_fs.c:849
       #5  storagePoolStart () at storage/storage_driver.c:700
       #6  virStoragePoolCreate () at libvirt.c:12471
       ...
      
      Treat files which miss their backing file as standalone files.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      e0c469e5
  25. 02 11月, 2012 1 次提交
  26. 31 10月, 2012 1 次提交
  27. 22 10月, 2012 1 次提交
    • E
      storage: let format probing work on root-squash NFS · d9d77bfa
      Eric Blake 提交于
      Yet another instance of where using plain open() mishandles files
      that live on root-squash NFS, and where improving the API can
      improve the chance of a successful probe.
      
      * src/util/storage_file.h (virStorageFileProbeFormat): Alter
      signature.
      * src/util/storage_file.c (virStorageFileProbeFormat): Use better
      method for opening file.
      * src/qemu/qemu_driver.c (qemuDomainGetBlockInfo): Update caller.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
      Likewise.
      d9d77bfa
  28. 20 10月, 2012 1 次提交
    • E
      storage: make it easier to find file within chain · 5eaf6054
      Eric Blake 提交于
      In order to temporarily label files read/write during a commit
      operation, we need to crawl the backing chain and find the absolute
      file name that needs labeling in the first place, as well as the
      name of the file that owns the backing file.
      
      * src/util/storage_file.c (virStorageFileChainLookup): New
      function.
      * src/util/storage_file.h: Declare it.
      * src/libvirt_private.syms (storage_file.h): Export it.
      5eaf6054