1. 12 9月, 2014 1 次提交
  2. 18 7月, 2014 1 次提交
    • J
      storage: Disallow vol_wipe for sparse logical volumes · 8a9f7cbe
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1091866
      
      Add a new boolean 'sparse'.  This will be used by the logical backend
      storage driver to determine whether the target volume is sparse or not
      (also known by a snapshot or thin logical volume). Although setting sparse
      to true at creation could be seen as duplicitous to setting during
      virStorageBackendLogicalMakeVol() in case there are ever other code paths
      between Create and FindLVs that need to know about the volume be sparse.
      
      Use the 'sparse' in a new virStorageBackendLogicalVolWipe() to decide whether
      to attempt to wipe the logical volume or not. For now, I have found no
      means to wipe the volume without writing to it. Writing to the sparse
      volume causes it to be filled. A sparse logical volume is not completely
      writeable as there exists metadata which if overwritten will cause the
      sparse lv to go INACTIVE which means pool-refresh will not find it.
      Access to whatever lvm uses to manage data blocks is not provided by
      any API I could find.
      8a9f7cbe
  3. 16 7月, 2014 1 次提交
    • C
      storagevol: add nocow to vol xml · a9fd30e6
      Chunyan Liu 提交于
      Add 'nocow' to storage volume xml so that user can have an option
      to set NOCOW flag to the newly created volume. It's useful on btrfs
      file system to enhance performance.
      
      Btrfs has low performance when hosting VM images, even more when the guest
      in those VM are also using btrfs as file system. One way to mitigate this
      bad performance is to turn off COW attributes on VM files. Generally, there
      are two ways to turn off COW on btrfs: a) by mounting fs with nodatacow,
      then all newly created files will be NOCOW. b) per file. Add the NOCOW file
      attribute. It could only be done to empty or new files.
      
      This patch tries the second way, according to 'nocow' option, it could set
      NOCOW flag per file:
      for raw file images, handle 'nocow' in libvirt code; for non-raw file images,
      pass 'nocow=on' option to qemu-img, and let qemu-img to handle that (requires
      qemu-img version >= 2.1).
      Signed-off-by: NChunyan Liu <cyliu@suse.com>
      a9fd30e6
  4. 09 7月, 2014 2 次提交
    • P
      util: storage: Fix build after 25924dec · 61e45dfb
      Peter Krempa 提交于
      The commit referenced above changed function arguments of
      virStorageFileGetMetadataFromBuf() but didn't tweak the
      ATTRIBUTE_NONNULL tied to them. This was caught by coverity as it
      actually obeys them. We disabled them for GCC and thus it didn't show
      up.
      
      Additionally in commit 3ea661de I passed
      NULL to the backingFormat argument which was also marked as nonnull. Use
      a dummy int's address when the argument isn't supplied so that the code
      doesn't need to change much.
      61e45dfb
    • P
      util: storage: Return complete parent info from virStorageFileChainLookup · 75017710
      Peter Krempa 提交于
      Instead of just returning the parent path, return the complete parent
      source structure.
      75017710
  5. 08 7月, 2014 5 次提交
  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. 26 6月, 2014 1 次提交
  8. 25 6月, 2014 4 次提交
  9. 24 6月, 2014 1 次提交
  10. 20 6月, 2014 1 次提交
  11. 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
  12. 29 5月, 2014 1 次提交
  13. 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
  14. 19 5月, 2014 2 次提交
    • E
      Revert "maint: prefer enum over int for virstoragefile structs" · 71bce84a
      Eric Blake 提交于
      This partially reverts commits b279e52f and ea18f8b2.
      
      It turns out our code base is full of:
      
      if ((struct.member = virBlahFromString(str)) < 0)
          goto error;
      
      Meanwhile, the C standard says it is up to the compiler whether
      an enum is signed or unsigned when all of its declared values
      happen to be positive.  In my testing (Fedora 20, gcc 4.8.2),
      the compiler picked signed, and nothing changed.  But others
      testing with gcc 4.7 got compiler warnings, because it picked
      the enum to be unsigned, but no unsigned value is less than 0.
      Even worse:
      
      if ((struct.member = virBlahFromString(str)) <= 0)
          goto error;
      
      is silently compiled without warning, but incorrectly treats -1
      from a bad parse as a large positive number with no warning; and
      without the compiler's help to find these instances, it is a
      nightmare to maintain correctly.  We could force signed enums
      with a dummy negative declaration in each enum, or cast the
      result of virBlahFromString back to int after assigning to an
      enum value, or use a temporary int for collecting results from
      virBlahFromString, but those actions are all uglier than what we
      were trying to cure by directly using enum types for struct
      values in the first place.  It's better off to just live with int
      members, and use 'switch ((virFoo) struct.member)' where we want
      the compiler to help, than to track down all the conversions from
      string to enum and ensure they don't suffer from type problems.
      
      * src/util/virstorageencryption.h: Revert back to int declarations
      with comment about enum usage.
      * src/util/virstoragefile.h: Likewise.
      * src/conf/domain_conf.c: Restore back to casts in switches.
      * src/qemu/qemu_driver.c: Likewise.
      * src/qemu/qemu_command.c: Add cast rather than revert.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      71bce84a
    • D
      parallels: add VIR_STORAGE_FILE_PLOOP format · 13f229aa
      Dmitry Guryanov 提交于
      Add VIR_STORAGE_FILE_PLOOP format. This format is used
      to store disk images for virtual machines in PCS and containers
      in PCS, OpenVZ and also in Parallels Desktop for Mac.
      
      This format is described on OpenVZ site -
      https://openvz.org/Ploop (together with ploop devices). It
      consists of XML descriptor and one or more image files: base
      image and deltas. Format of the image files described here:
      https://openvz.org/Ploop/format.
      
      This patch only adds VIR_STORAGE_FILE_PLOOP constant, consequent
      patches will use it in parallels driver.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      13f229aa
  15. 16 5月, 2014 1 次提交
    • E
      maint: prefer enum over int for virstoragefile structs · b279e52f
      Eric Blake 提交于
      For internal structs, we might as well be type-safe and let the
      compiler help us with less typing required on our part (getting
      rid of casts is always nice).  In trying to use enums directly,
      I noticed two problems in virstoragefile.h that can't be fixed
      without more invasive refactoring: virStorageSource.format is
      used as more of a union of multiple enums in storage volume
      code (so it has to remain an int), and virStorageSourcePoolDef
      refers to pooltype whose enum is declared in src/conf, but where
      src/util can't pull in headers from src/conf.
      
      * src/util/virstoragefile.h (virStorageNetHostDef)
      (virStorageSourcePoolDef, virStorageSource): Use enums instead of
      int for fields of internal types.
      * src/qemu/qemu_command.c (qemuParseCommandLine): Cover all values.
      * src/conf/domain_conf.c (virDomainDiskSourceParse)
      (virDomainDiskSourceFormat): Simplify clients.
      * src/qemu/qemu_driver.c
      (qemuDomainSnapshotCreateSingleDiskActive)
      (qemuDomainSnapshotPrepareDiskExternalBackingInactive)
      (qemuDomainSnapshotPrepareDiskExternalOverlayActive)
      (qemuDomainSnapshotPrepareDiskInternal): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b279e52f
  16. 15 5月, 2014 1 次提交
  17. 06 5月, 2014 2 次提交
    • J
      util: use typedefs for enums in "src/util/" directory · 1b14c449
      Julio Faracco 提交于
      In "src/util/" there are many enumeration (enum) declarations.
      Sometimes, it's better using a typedef for variable types,
      function types and other usages. Other enumeration will be
      changed to typedef's in the future.
      Signed-off-by: NJulio Faracco <jcfaracco@gmail.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1b14c449
    • 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
  18. 01 5月, 2014 1 次提交
  19. 25 4月, 2014 2 次提交
  20. 24 4月, 2014 5 次提交
    • P
      util: storage: Invert the way recursive metadata retrieval works · 8823272d
      Peter Krempa 提交于
      To avoid having the root of a backing chain present twice in the list we
      need to invert the working of virStorageFileGetMetadataRecurse.
      
      Until now the recursive worker created a new backing chain element from
      the name and other information passed as arguments. This required us to
      pass the data of the parent in a deconstructed way and the worker
      created a new entry for the parent.
      
      This patch converts this function so that it just fills in metadata
      about the parent and creates a backing chain element from those. This
      removes the duplication of the first element.
      
      To avoid breaking the test suite, virstoragetest now calls a wrapper
      that creates the parent structure explicitly and pre-fills it with the
      test data with same function signature as previously used.
      8823272d
    • P
      util: virstoragefile: Rename backingMeta to backingStore · b627b8fd
      Peter Krempa 提交于
      To conform with the naming of the planned XML output rename the metadata
      variable name.
      
      s/backingMeta/backingStore/g
      b627b8fd
    • P
      util: virstorage: Kill struct virStorageFileMetadata · 4905b983
      Peter Krempa 提交于
      Remove the now unused pieces of the structure.
      4905b983
    • P
      maint: Switch over from struct virStorageFileMetadata to virStorageSource · d64d9ff9
      Peter Krempa 提交于
      Replace the old structure with the new one. This change is a trivial
      name change operation (along with change of the freeing function).
      d64d9ff9
    • P
      util: storagefile: Add fields from virStorageMetadata to virStorageSource · 0b5161d9
      Peter Krempa 提交于
      Add the required fields that are missing from the new structure that
      will allow us to switch the storage file metadata code entirely to the
      new structure.
      
      Add "relPath" and "relDir" and the raw backing store name. Also allow
      creating linked lists of virStorageSourcePtrs to express backing chains.
      0b5161d9