1. 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
  2. 26 6月, 2014 1 次提交
  3. 25 6月, 2014 4 次提交
  4. 24 6月, 2014 1 次提交
  5. 20 6月, 2014 1 次提交
  6. 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
  7. 29 5月, 2014 1 次提交
  8. 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
  9. 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
  10. 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
  11. 15 5月, 2014 1 次提交
  12. 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
  13. 01 5月, 2014 1 次提交
  14. 25 4月, 2014 2 次提交
  15. 24 4月, 2014 9 次提交
  16. 15 4月, 2014 1 次提交
    • E
      conf: restrict external snapshots to backing store formats · db7d7c0e
      Eric Blake 提交于
      Domain snapshots should only permit an external snapshot into
      a storage format that permits a backing chain, since the new
      snapshot file necessarily must be backed by the existing file.
      The C code for the qemu driver is a little bit stricter in
      currently enforcing only qcow2 or qed, but at the XML parser
      level, including virt-xml-validate, it is fairly easy to
      enforce that a user can't request a 'raw' external snapshot.
      
      * docs/schemas/storagecommon.rng (storageFormat): Split out...
      (storageFormatBacking): ...new sublist.
      * docs/schemas/domainsnapshot.rng (disksnapshotdriver): Use new
      type.
      * src/util/virstoragefile.h (virStorageFileFormat): Rearrange for
      easier code management.
      * src/util/virstoragefile.c (virStorageFileFormat, fileTypeInfo):
      Likewise.
      * src/conf/snapshot_conf.c (virDomainSnapshotDiskDefParseXML): Use
      new marker to limit selection of formats.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      db7d7c0e
  17. 12 4月, 2014 2 次提交
    • 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: 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
  18. 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: return backing information separately from metadata · a4dfc8d3
      Eric Blake 提交于
      A couple pieces of virStorageFileMetadata are used only while
      collecting information about the chain, and don't need to
      live permanently in the struct.  This patch refactors external
      callers to collect the information separately, so that the
      next patch can remove the fields.
      
      * src/util/virstoragefile.h (virStorageFileGetMetadataFromBuf):
      Alter signature.
      * src/util/virstoragefile.c (virStorageFileGetMetadataInternal):
      Likewise.
      (virStorageFileGetMetadataFromFDInternal): Adjust callers.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
      Likewise.
      * src/storage/storage_backend_gluster.c
      (virStorageBackendGlusterRefreshVol): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a4dfc8d3
    • 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