1. 21 12月, 2012 2 次提交
  2. 13 12月, 2012 1 次提交
    • D
      Fix error reporting when fetching SCSI/LVM keys · 41ac222e
      Daniel P. Berrange 提交于
      The current  virStorageFileGet{LVM,SCSI}Key methods return
      the key as the return value. Unfortunately it is desirable
      for "NULL" to be a valid return value, as well as an error
      indicator. Thus the returned key must instead be provided
      as an out-parameter.
      
      When we invoke lvs or scsi_id to extract ID for block devices,
      we don't want virCommandWait logging errors messages. Thus we
      must explicitly check 'status != 0', rather than letting
      virCommandWait do it.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      41ac222e
  3. 12 12月, 2012 1 次提交
  4. 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
  5. 20 10月, 2012 5 次提交
    • 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
    • E
      storage: remember relative names in backing chain · 82507838
      Eric Blake 提交于
      In order to search for a backing file name as literally present
      in a chain, we need to remember if the chain had relative names.
      Also, searching for absolute names is easier if we only have
      to canonicalize once, rather than on every iteration.
      
      * src/util/storage_file.h (_virStorageFileMetadata): Add field.
      * src/util/storage_file.c (virStorageFileGetMetadataFromBuf):
      (virStorageFileFreeMetadata): Manage it
      (absolutePathFromBaseFile): Store absolute names in canonical form.
      82507838
    • E
      storage: don't require caller to pre-allocate metadata struct · 1fc95932
      Eric Blake 提交于
      Requiring pre-allocation was an unusual idiom.  It allowed iteration
      over the backing chain to use fewer mallocs, but made one-shot
      clients harder to read.  Also, this makes it easier for a future
      patch to move away from opening fds on every iteration over the chain.
      
      * src/util/storage_file.h (virStorageFileGetMetadataFromFD): Alter
      signature.
      * src/util/storage_file.c (virStorageFileGetMetadataFromFD): Allocate
      return value.
       (virStorageFileGetMetadata): Update clients.
      * src/conf/domain_conf.c (virDomainDiskDefForeachPath): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainGetBlockInfo): Likewise.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
      Likewise.
      1fc95932
    • E
      storage: get entire metadata chain in one call · 35c74c17
      Eric Blake 提交于
      Previously, no one was using virStorageFileGetMetadata, and for good
      reason - it couldn't support root-squash NFS.  Change the signature
      and make it useful to future patches, including enhancing the metadata
      to recursively track the entire chain.
      
      * src/util/storage_file.h (_virStorageFileMetadata): Add field.
      (virStorageFileGetMetadata): Alter signature.
      * src/util/storage_file.c (virStorageFileGetMetadata): Rewrite.
      (virStorageFileGetMetadataRecurse): New function.
      (virStorageFileFreeMetadata): Handle recursion.
      35c74c17
    • E
      storage: list more file types · f772b3d9
      Eric Blake 提交于
      When an image has no backing file, using VIR_STORAGE_FILE_AUTO
      for its type is a bit confusing.  Additionally, a future patch
      would like to reserve a default value for the case of no file
      type specified in the XML, but different from the current use
      of -1 to imply probing, since probing is not always safe.
      
      Also, a couple of file types were missing compared to supported
      code: libxl supports 'vhd', and qemu supports 'fat' for directories
      passed through as a file system.
      
      * src/util/storage_file.h (virStorageFileFormat): Add
      VIR_STORAGE_FILE_NONE, VIR_STORAGE_FILE_FAT, VIR_STORAGE_FILE_VHD.
      * src/util/storage_file.c (virStorageFileMatchesVersion): Match
      documentation when version probing not supported.
      (cowGetBackingStore, qcowXGetBackingStore, qcow1GetBackingStore)
      (qcow2GetBackingStoreFormat, qedGetBackingStore)
      (virStorageFileGetMetadataFromBuf)
      (virStorageFileGetMetadataFromFD): Take NONE into account.
      * src/conf/domain_conf.c (virDomainDiskDefForeachPath): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainGetBlockInfo): Likewise.
      * src/conf/storage_conf.c (virStorageVolumeFormatFromString): New
      function.
      (poolTypeInfo): Use it.
      f772b3d9
  6. 21 9月, 2012 1 次提交
  7. 09 8月, 2012 1 次提交
  8. 23 7月, 2012 1 次提交
    • O
      Desert the FSF address in copyright · f9ce7dad
      Osier Yang 提交于
      Per the FSF address could be changed from time to time, and GNU
      recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html)
      
        You should have received a copy of the GNU General Public License
        along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
      
      This patch removes the explicit FSF address, and uses above instead
      (of course, with inserting 'Lesser' before 'General').
      
      Except a bunch of files for security driver, all others are changed
      automatically, the copyright for securify files are not complete,
      that's why to do it manually:
      
        src/security/security_selinux.h
        src/security/security_driver.h
        src/security/security_selinux.c
        src/security/security_apparmor.h
        src/security/security_apparmor.c
        src/security/security_driver.c
      f9ce7dad
  9. 23 2月, 2012 1 次提交
  10. 01 2月, 2012 1 次提交
  11. 14 7月, 2011 1 次提交
    • M
      storage: Avoid memory leak on metadata fetching · 85aa40e2
      Michal Privoznik 提交于
      Getting metadata on storage allocates a memory (path) which need to
      be freed after use otherwise it gets leaked. This means after use of
      virStorageFileGetMetadataFromFD or virStorageFileGetMetadata one
      must call virStorageFileFreeMetadata to free it. This function frees
      structure internals and structure itself.
      85aa40e2
  12. 24 2月, 2011 1 次提交
  13. 23 11月, 2010 1 次提交
  14. 20 11月, 2010 2 次提交
  15. 10 11月, 2010 1 次提交
    • A
      Allow non-file disk backingStores · 9c7c4a4f
      Adam Litke 提交于
      I am trying to use a qcow image with libvirt where the backing 'file' is a
      qemu-nbd server.  Unfortunately virDomainDiskDefForeachPath() assumes that
      backingStore is always a real file so something like 'nbd:0:3333' is rejected
      because a file with that name cannot be accessed.  Note that I am not worried
      about directly using nbd images.  That would require a new disk type with XML
      markup, etc.  I only want it to be permitted as a backingStore
      
      The following patch implements danpb's suggestion:
      > I think I'm inclined to push the logic for skipping NBD one stage higher.
      > I'd rather expect virStorageFileGetMetadata() to return all backing
      > stores, even if not files. The virDomainDiskDefForeachPath() method
      > should definitely ignore non-file backing stores though.
      >
      > So what I'm thinking is to extend the virStorageFileMetadata struct and
      > just add a 'bool isFile' field to it. Default this field to true, unless
      > you see the prefix of nbd: in which case set it to false. The
      > virDomainDiskDefForeachPath() method can then skip over any backing
      > store with isFile == false
      Signed-off-by: NAdam Litke <agl@us.ibm.com>
      Cc: Daniel P. Berrange <berrange@redhat.com>
      9c7c4a4f
  16. 02 11月, 2010 1 次提交
    • D
      Treat failure to relabel stdin_path as non-fatal on NFS · 93a18bba
      Daniel P. Berrange 提交于
      NFS does not support file labelling, so ignore this error
      for stdin_path when on NFS.
      
      * src/security/security_selinux.c: Ignore failures on labelling
        stdin_path on NFS
      * src/util/storage_file.c, src/util/storage_file.h: Refine
        virStorageFileIsSharedFS() to allow it to check for a
        specific FS type.
      93a18bba
  17. 20 7月, 2010 1 次提交
    • D
      Require format to be passed into virStorageFileGetMetadata · bf80fc68
      Daniel P. Berrange 提交于
      Require the disk image to be passed into virStorageFileGetMetadata.
      If this is set to VIR_STORAGE_FILE_AUTO, then the format will be
      resolved using probing. This makes it easier to control when
      probing will be used
      
      * src/qemu/qemu_driver.c, src/qemu/qemu_security_dac.c,
        src/security/security_selinux.c, src/security/virt-aa-helper.c:
        Set VIR_STORAGE_FILE_AUTO when calling virStorageFileGetMetadata.
      * src/storage/storage_backend_fs.c: Probe for disk format before
        calling virStorageFileGetMetadata.
      * src/util/storage_file.h, src/util/storage_file.c: Remove format
        from virStorageFileMeta struct & require it to be passed into
        method.
      bf80fc68
  18. 19 7月, 2010 2 次提交
    • D
      Refactor virStorageFileGetMetadataFromFD to separate functionality · c70cb0f4
      Daniel P. Berrange 提交于
      The virStorageFileGetMetadataFromFD did two jobs in one. First
      it probed for storage type, then it extracted metadata for the
      type. It is desirable to be able to separate these jobs, allowing
      probing without querying metadata, and querying metadata without
      probing.
      
      To prepare for this, split out probing code into a new pair of
      methods
      
        virStorageFileProbeFormatFromFD
        virStorageFileProbeFormat
      
      * src/util/storage_file.c, src/util/storage_file.h,
        src/libvirt_private.syms: Introduce virStorageFileProbeFormat
        and virStorageFileProbeFormatFromFD
      c70cb0f4
    • D
      Extract the backing store format as well as name, if available · a93402d4
      Daniel P. Berrange 提交于
      When QEMU opens a backing store for a QCow2 file, it will
      normally auto-probe for the format of the backing store,
      rather than assuming it has the same format as the referencing
      file. There is a QCow2 extension that allows an explicit format
      for the backing store to be embedded in the referencing file.
      This closes the auto-probing security hole in QEMU.
      
      This backing store format can be useful for libvirt users
      of virStorageFileGetMetadata, so extract this data and report
      it.
      
      QEMU does not require disk image backing store files to be in
      the same format the file linkee. It will auto-probe the disk
      format for the backing store when opening it. If the backing
      store was intended to be a raw file this could be a security
      hole, because a guest may have written data into its disk that
      then makes the backing store look like a qcow2 file. If it can
      trick QEMU into thinking the raw file is a qcow2 file, it can
      access arbitrary files on the host by adding further backing
      store links.
      
      To address this, callers of virStorageFileGetMeta need to be
      told of the backing store format. If no format is declared,
      they can make a decision whether to allow format probing or
      not.
      a93402d4
  19. 14 5月, 2010 1 次提交
    • D
      Don't reset user/group/security label on shared filesystems during migrate · 02ddaddf
      Daniel P. Berrange 提交于
      When QEMU runs with its disk on NFS, and as a non-root user, the
      disk is chownd to that non-root user. When migration completes
      the last step is shutting down the QEMU on the source host. THis
      normally resets user/group/security label. This is bad when the
      VM was just migrated because the file is still in use on the dest
      host. It is thus neccessary to skip the reset step for any files
      found to be on a shared filesystem
      
      * src/libvirt_private.syms: Export virStorageFileIsSharedFS
      * src/util/storage_file.c, src/util/storage_file.h: Add a new
        method virStorageFileIsSharedFS() to determine if a file is
        on a shared filesystem (NFS, GFS, OCFS2, etc)
      * src/qemu/qemu_driver.c: Tell security driver not to reset
        disk labels on migration completion
      * src/qemu/qemu_security_dac.c, src/qemu/qemu_security_stacked.c,
        src/security/security_selinux.c, src/security/security_driver.h,
        src/security/security_apparmor.c: Add ability to skip disk
        restore step for files on shared filesystems.
      02ddaddf
  20. 30 4月, 2010 1 次提交
  21. 10 3月, 2010 1 次提交
  22. 09 2月, 2010 1 次提交
  23. 30 9月, 2009 4 次提交
    • M
      Add virStorageFileGetMetadata() helper · 295fd6e8
      Mark McLoughlin 提交于
      * src/util/storage_file.c: add virStorageFileGetMetadata() so that
        the caller does not need to open the file
      295fd6e8
    • M
      Move virStorageGetMetadataFromFD() to libvirt_util · a010fb58
      Mark McLoughlin 提交于
      Finally, we get to the point of all this.
      
      Move virStorageGetMetadataFromFD() to virStorageFileGetMetadataFromFD()
      and move to src/util/storage_file.[ch]
      
      There's no functional changes in this patch, just code movement
      
      * src/storage/storage_backend_fs.c: move code from here ...
      
      * src/util/storage_file.[ch]: ... to here
      
      * src/libvirt_private.syms: export virStorageFileGetMetadataFromFD()
      a010fb58
    • M
      Introduce virStorageFileMetadata structure · 5fede0a9
      Mark McLoughlin 提交于
      Introduce a metadata structure and make virStorageGetMetadataFromFD()
      fill it in.
      
      * src/util/storage_file.h: add virStorageFileMetadata
      
      * src/backend/storage_backend_fs.c: virStorageGetMetadataFromFD() now
        fills in the virStorageFileMetadata structure
      5fede0a9
    • M
      Move file format enum to libvirt_util · 00fd3ff4
      Mark McLoughlin 提交于
      Rename virStorageVolFormatFileSystem to virStorageFileFormat and
      move to src/util/storage_file.[ch]
      
      * src/Makefile.am: add src/util/storage_file.[ch]
      
      * src/conf/storage_conf.[ch]: move enum from here ...
      
      * src/util/storage_file.[ch]: .. to here
      
      * src/libvirt_private.syms: update To/FromString exports
      
      * src/storage/storage_backend.c, src/storage/storage_backend_fs.c,
        src/vbox/vbox_tmpl.c: update for above changes
      00fd3ff4
  24. 21 9月, 2009 1 次提交
  25. 11 4月, 2008 1 次提交
  26. 20 2月, 2008 3 次提交
  27. 30 1月, 2008 1 次提交
    • J
      Enable the <config.h>-requiring test; fix violations · a3781881
      Jim Meyering 提交于
      Use <config.h>, not "config.h", per autoconf documentation.
      * Makefile.cfg (local-checks-to-skip) [sc_require_config_h]: Enable.
      * .x-sc_require_config_h: New file, to list exempted files.
      * Makefile.am (EXTRA_DIST): Add .x-sc_require_config_h.
      a3781881
  28. 26 11月, 2007 1 次提交