1. 25 4月, 2014 7 次提交
  2. 24 4月, 2014 6 次提交
    • J
      conf: Format and parse backing chains in domain XML · 546154e3
      Jiri Denemark 提交于
      This patch implements formating and parsing code for the backing store
      schema defined and documented by the previous patch.
      
      This patch does not aim at providing full persistent storage of disk
      backing chains yet. The formatter is supposed to provide the backing
      chain detected when starting a domain and thus it is not formatted into
      an inactive domain XML. The parser is implemented mainly for the purpose
      of testing the XML generated by the formatter and thus it does not
      distinguish between no backingStore element and an empty backingStore
      element. This will have to change once we fully implement support for
      user-supplied backing chains.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      546154e3
    • 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
      storage: Move disk->backingChain to the recursive disk->src.backingStore · 44551275
      Peter Krempa 提交于
      Switch over to storing of the backing chain as a recursive
      virStorageSource structure.
      
      This is a string based move. Currently the first element will be present
      twice in the backing chain as currently the retrieval function stores
      the parent in the newly detected chain. This will be fixed later.
      44551275
    • 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
      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
      virstoragefile: Kill "backingStore" field from virStorageFileMetadata · 39c5aa4e
      Peter Krempa 提交于
      Remove the obsolete field replaced by data in "path".
      
      The testsuite requires tweaking as the name of the backing file is now
      stored one layer deeper in the backing chain linked list.
      39c5aa4e
  3. 22 4月, 2014 2 次提交
  4. 16 4月, 2014 1 次提交
    • E
      conf: fix omission of <driver> in domain dumpxml · 8fb44675
      Eric Blake 提交于
      I noticed that depending on the <driver> attributes the user passed
      in, the output may omit the <driver> element altogether.  For example,
      the rerror_policy has had this problem since commit 4bb4109f in Oct
      2011.  But in adding testsuite coverage to expose it, I found another
      problem: the C code is just fine without a driver name, but the
      XML validator required either a name or a cache mode.
      
      * src/conf/domain_conf.c (virDomainDiskDefFormat): Update
      conditional.
      * docs/schemas/domaincommon.rng (diskDriver): Simplify.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-drive-copy-on-read.xml:
      * tests/qemuxml2argvdata/qemuxml2argv-disk-drive-copy-on-read.args:
      New files.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-drive-discard.xml:
      Enhance test.
      * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-discard.xml:
      Likewise.
      * tests/qemuxml2argvtest.c (mymain): New test.
      * tests/qemuxml2xmltest.c (mymain): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      8fb44675
  5. 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
  6. 11 4月, 2014 1 次提交
    • E
      conf: expose probe for non-local storage · 86f71e0a
      Eric Blake 提交于
      Deciding if a user string represents a local file instead of a
      network path is an operation worth exposing directly, particularly
      since the next patch will be removing a redundant variable that
      was caching the information.
      
      * src/util/virstoragefile.h (virStorageIsFile): New declaration.
      * src/util/virstoragefile.c (virBackingStoreIsFile): Rename...
      (virStorageIsFile): ...export, and allow NULL input.
      (virStorageFileGetMetadataInternal)
      (virStorageFileGetMetadataRecurse, virStorageFileGetMetadata):
      Update callers.
      * src/conf/domain_conf.c (virDomainDiskDefForeachPath): Use it.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
      Likewise.
      * src/libvirt_private.syms (virstoragefile.h): Export function.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      86f71e0a
  7. 09 4月, 2014 1 次提交
  8. 08 4月, 2014 5 次提交
  9. 05 4月, 2014 2 次提交
    • R
      bhyve: add console support through nmdm device · 6c91134d
      Roman Bogorodskiy 提交于
      nmdm is a FreeBSD driver which allows to create a pair of tty
      devices one of which is passed to the guest and second is used
      by the client.
      
      This patch adds new 'nmdm' character device type. Its definition
      looks this way:
      
      <serial type='nmdm'>
        <source master='/dev/nmdm0A' slave='/dev/nmdm0B'/>
      </serial>
      
      Master is passed to the hypervisior and slave is used for client
      connection.
      
      Also implement domainOpenConsole() for bhyve driver based on that.
      6c91134d
    • E
      conf: track when storage type is still undetermined · 9673418c
      Eric Blake 提交于
      Right now, virStorageFileMetadata tracks bool backingStoreIsFile
      for whether the backing string specified in metadata can be
      resolved as a file (covering both block and regular file
      resources) or is treated as a network protocol.  But when
      merging this struct with virStorageSource, it will be easier
      to just actually track which type of resource it is, as well
      as have a reserved value for the case where the resource type
      is unknown (or had an error during probing).
      
      * src/util/virstoragefile.h (virStorageType): Add a placeholder
      value, swap order to match similar public enum.
      * src/util/virstoragefile.c (virStorage): Update string mapping.
      * src/conf/domain_conf.c (virDomainDiskSourceParse)
      (virDomainDiskDefParseXML, virDomainDiskDefFormat)
      (virDomainDiskSourceFormat): Adjust clients.
      * src/conf/snapshot_conf.c (virDomainSnapshotDiskDefParseXML):
      Likewise.
      * src/qemu/qemu_driver.c
      (qemuDomainSnapshotPrepareDiskExternalBackingInactive)
      (qemuDomainSnapshotPrepareDiskExternalOverlayActive)
      (qemuDomainSnapshotPrepareDiskExternalOverlayInactive)
      (qemuDomainSnapshotPrepareDiskInternal)
      (qemuDomainSnapshotCreateSingleDiskActive): Likewise.
      * src/qemu/qemu_command.c (qemuGetDriveSourceString): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      9673418c
  10. 03 4月, 2014 3 次提交
  11. 02 4月, 2014 11 次提交
    • E
      conf: track sizes directly in source struct · cce2410a
      Eric Blake 提交于
      One of the features of qcow2 is that a wrapper file can have
      more capacity than its backing file from the guest's perspective;
      what's more, sparse files make tracking allocation of both
      the active and backing file worthwhile.  As such, it makes
      more sense to show allocation numbers for each file in a chain,
      and not just the top-level file.  This sets up the fields for
      the tracking, although it does not modify XML to display any
      new information.
      
      * src/util/virstoragefile.h (_virStorageSource): Add fields.
      * src/conf/storage_conf.h (_virStorageVolDef): Drop redundant
      fields.
      * src/storage/storage_backend.c (virStorageBackendCreateBlockFrom)
      (createRawFile, virStorageBackendCreateQemuImgCmd)
      (virStorageBackendCreateQcowCreate): Update clients.
      * src/storage/storage_driver.c (storageVolDelete)
      (storageVolCreateXML, storageVolCreateXMLFrom, storageVolResize)
      (storageVolWipeInternal, storageVolGetInfo): Likewise.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget)
      (virStorageBackendFileSystemRefresh)
      (virStorageBackendFileSystemVolResize)
      (virStorageBackendFileSystemVolRefresh): Likewise.
      * src/storage/storage_backend_logical.c
      (virStorageBackendLogicalMakeVol)
      (virStorageBackendLogicalCreateVol): Likewise.
      * src/storage/storage_backend_scsi.c
      (virStorageBackendSCSINewLun): Likewise.
      * src/storage/storage_backend_mpath.c
      (virStorageBackendMpathNewVol): Likewise.
      * src/storage/storage_backend_rbd.c
      (volStorageBackendRBDRefreshVolInfo)
      (virStorageBackendRBDCreateImage): Likewise.
      * src/storage/storage_backend_disk.c
      (virStorageBackendDiskMakeDataVol)
      (virStorageBackendDiskCreateVol): Likewise.
      * src/storage/storage_backend_sheepdog.c
      (virStorageBackendSheepdogBuildVol)
      (virStorageBackendSheepdogParseVdiList): Likewise.
      * src/storage/storage_backend_gluster.c
      (virStorageBackendGlusterRefreshVol): Likewise.
      * src/conf/storage_conf.c (virStorageVolDefFormat)
      (virStorageVolDefParseXML): Likewise.
      * src/test/test_driver.c (testOpenVolumesForPool)
      (testStorageVolCreateXML, testStorageVolCreateXMLFrom)
      (testStorageVolDelete, testStorageVolGetInfo): Likewise.
      * src/esx/esx_storage_backend_iscsi.c (esxStorageVolGetXMLDesc):
      Likewise.
      * src/esx/esx_storage_backend_vmfs.c (esxStorageVolGetXMLDesc)
      (esxStorageVolCreateXML): Likewise.
      * src/parallels/parallels_driver.c (parallelsAddHddByVolume):
      Likewise.
      * src/parallels/parallels_storage.c (parallelsDiskDescParseNode)
      (parallelsStorageVolDefineXML, parallelsStorageVolCreateXMLFrom)
      (parallelsStorageVolDefRemove, parallelsStorageVolGetInfo):
      Likewise.
      * src/vbox/vbox_tmpl.c (vboxStorageVolCreateXML)
      (vboxStorageVolGetXMLDesc): Likewise.
      * tests/storagebackendsheepdogtest.c (test_vdi_list_parser):
      Likewise.
      * src/phyp/phyp_driver.c (phypStorageVolCreateXML): Likewise.
      cce2410a
    • E
      conf: use common struct in storage volumes · df176115
      Eric Blake 提交于
      A fairly smooth transition.  And now that domain disks and
      storage volumes share a common struct, it opens the doors for
      a future patch to expose more details in the XML for both
      objects.
      
      * src/conf/storage_conf.h (_virStorageVolTarget): Delete.
      (_virStorageVolDef): Use common type.
      * src/conf/storage_conf.c (virStorageVolDefFree)
      (virStorageVolTargetDefFormat): Update clients.
      * src/storage/storage_backend.h: Likewise.
      * src/storage/storage_backend.c
      (virStorageBackendDetectBlockVolFormatFD)
      (virStorageBackendUpdateVolTargetInfo)
      (virStorageBackendUpdateVolTargetInfoFD): Likewise.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
      Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      df176115
    • E
      conf: move volume structs to util/ · 2a4fd228
      Eric Blake 提交于
      Another step towards unification of structures.  While we might
      not expose everything in XML via domain disk as we do for
      storage volume pointer, both places want to deal with (at least
      part of) the backing chain; therefore, moving towards a single
      struct usable from both contexts will make the backing chain
      code more reusable.
      
      * src/conf/storage_conf.h (_virStoragePerms)
      (virStorageTimestamps): Move...
      * src/util/virstoragefile.h: ...here.
      (_virStorageSource): Add more fields.
      * src/util/virstoragefile.c (virStorageSourceClear): Clean
      additional fields.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      2a4fd228
    • E
      conf: tweak volume target struct details · dae1568c
      Eric Blake 提交于
      Some preparatory work before consolidating storage volume
      structs with the rest of virstoragefile.  Making these
      changes allows a volume target to be much closer to (a
      subset of) the virStorageSource struct.
      
      Making perms be a pointer allows it to be optional if we
      have a storage pool that doesn't expose permissions in a
      way we can access.  It also allows future patches to
      optionally expose permissions details learned about a disk
      image via domain <disk> listings, rather than just
      limiting it to storage volume listings.
      
      Disk partition types was only used by internal code to
      control what type of partition to create when carving up
      an MS-DOS partition table storage pool (and is not used
      for GPT partition tables or other storage pools).  It was
      not exposed in volume XML, and as it is more closely
      related to extent information of the overall block device
      than it is to the <target> information describing the host
      file.  Besides, if we ever decide to expose it in XML down
      the road, we can move it back as needed.
      
      * src/conf/storage_conf.h (_virStorageVolTarget): Change perms to
      pointer, enhance comments.  Move partition type...
      (_virStorageVolSource): ...here.
      * src/conf/storage_conf.c (virStorageVolDefFree)
      (virStorageVolDefParseXML, virStorageVolTargetDefFormat): Update
      clients.
      * src/storage/storage_backend_fs.c (createFileDir): Likewise.
      * src/storage/storage_backend.c (virStorageBackendCreateBlockFrom)
      (virStorageBackendCreateRaw, virStorageBackendCreateExecCommand)
      (virStorageBackendUpdateVolTargetInfoFD): Likewise.
      * src/storage/storage_backend_logical.c
      (virStorageBackendLogicalCreateVol): Likewise.
      * src/storage/storage_backend_disk.c
      (virStorageBackendDiskMakeDataVol)
      (virStorageBackendDiskPartTypeToCreate): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      dae1568c
    • E
      conf: manage disk source by struct instead of pieces · c99efbcd
      Eric Blake 提交于
      Now that we have a dedicated type for representing a disk source,
      we might as well parse and format directly into that type instead
      of piecemeal into pointers to members of the type.
      
      * src/conf/domain_conf.h (virDomainDiskSourceDefFormatInternal)
      (virDomainDiskSourceDefParse): Rename...
      (virDomainDiskSourceFormat, virDomainDiskSourceParse): ...and
      compress signatures.
      * src/conf/domain_conf.c (virDomainDiskSourceParse)
      (virDomainDiskSourceFormat): Rewrite to use common struct.
      (virDomainDiskSourceDefFormat): Delete.
      (virDomainDiskDefParseXML, virDomainDiskDefFormat): Update
      callers.
      * src/conf/snapshot_conf.c (virDomainSnapshotDiskDefParseXML)
      (virDomainSnapshotDiskDefFormat): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c99efbcd
    • E
      conf: let snapshots share disk source struct · ca1ee0fd
      Eric Blake 提交于
      Now that we have a common struct, it's time to start using it!
      Since external snapshots make a longer backing chain, it is
      only natural to use the same struct for the file created by
      the snapshot as what we use for <domain> disks.
      
      * src/conf/snapshot_conf.h (_virDomainSnapshotDiskDef): Use common
      struct instead of open-coded duplicate fields.
      * src/conf/snapshot_conf.c (virDomainSnapshotDiskDefClear)
      (virDomainSnapshotDiskDefParseXML, virDomainSnapshotAlignDisks)
      (virDomainSnapshotDiskDefFormat)
      (virDomainSnapshotDiskGetActualType): Adjust clients.
      * src/qemu/qemu_conf.c (qemuTranslateSnapshotDiskSourcePool):
      Likewise.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotDiskGetSourceString)
      (qemuDomainSnapshotCreateInactiveExternal)
      (qemuDomainSnapshotPrepareDiskExternalOverlayActive)
      (qemuDomainSnapshotPrepareDiskExternal)
      (qemuDomainSnapshotPrepare)
      (qemuDomainSnapshotCreateSingleDiskActive): Likewise.
      * src/storage/storage_driver.c
      (virStorageFileInitFromSnapshotDef): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ca1ee0fd
    • E
      conf: move common disk source functions · 7a4fd22b
      Eric Blake 提交于
      Move some functions out of domain_conf for use in the next
      patch where snapshot starts to directly use structs in
      virstoragefile.
      
      * src/conf/domain_conf.c (virDomainDiskDefFree)
      (virDomainDiskSourcePoolDefParse): Adjust callers.
      (virDomainDiskSourceDefClear, virDomainDiskSourcePoolDefFree)
      (virDomainDiskAuthClear): Move...
      * src/util/virstoragefile.c (virStorageSourceClear)
      (virStorageSourcePoolDefFree, virStorageSourceAuthClear): ...and
      rename.
      * src/conf/domain_conf.h (virDomainDiskAuthClear): Drop
      declaration.
      * src/qemu/qemu_conf.c (qemuTranslateDiskSourcePool): Adjust
      caller.
      * src/util/virstoragefile.h: Declare them.
      * src/libvirt_private.syms (virstoragefile.h): Export them.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7a4fd22b
    • E
      conf: move storage source type to util/ · 8a20e227
      Eric Blake 提交于
      With this patch, all information related to a host resource in
      a storage file backing chain now lives in util/virstoragefile.h.
      The next step will be to consolidate various places that have
      been tracking backing chain details to all use a common struct.
      
      The changes to tools/Makefile.am were made necessary by the
      fact that virstorageencryption includes uses of libxml, and is
      now pulled in by inclusion from virstoragefile.h.  No
      additional libraries are linked into the final image, and in
      comparison, the build of the setuid library in src/Makefile.am
      already was using LIBXML_CFLAGS via AM_CFLAGS.
      
      * src/conf/domain_conf.h (virDomainDiskSourceDef): Move...
      * src/util/virstoragefile.h (virStorageSource): ...and rename.
      * src/conf/domain_conf.c (virDomainDiskSourceDefClear)
      (virDomainDiskAuthClear): Adjust clients.
      * tools/Makefile.am (virt_login_shell_CFLAGS)
      (virt_host_validate_CFLAGS): Add libxml headers.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      8a20e227
    • E
      conf: move storage secret type to util/ · c05d9dca
      Eric Blake 提交于
      This one is a relatively easy move.  We don't ever convert the
      enum to or from strings (it is inferred from other elements in
      the xml, rather than directly represented).
      
      * src/conf/domain_conf.h (virDomainDiskSecretType): Move...
      * src/util/virstoragefile.h (virStorageSecreteType): ...and
      rename.
      * src/conf/domain_conf.c (virDomainDiskSecretType): Drop unused
      enum conversion.
      (virDomainDiskAuthClear, virDomainDiskDefParseXML)
      (virDomainDiskDefFormat): Adjust clients.
      * src/qemu/qemu_command.c (qemuGetSecretString): Likewise.
      * src/qemu/qemu_conf.c (qemuTranslateDiskSourcePoolAuth):
      Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c05d9dca
    • E
      conf: move source pool type to util/ · b6edf2bf
      Eric Blake 提交于
      Another struct being moved to util.  This one doesn't have as
      much use yet, thankfully.
      
      * src/conf/domain_conf.h (virDomainDiskSourcePoolMode)
      (virDomainDiskSourcePoolDef): Move...
      * src/util/virstoragefile.h (virStorageSourcePoolMode)
      (virStorageSourcePoolDef): ...and rename.
      * src/conf/domain_conf.c (virDomainDiskSourcePoolDefFree)
      (virDomainDiskSourceDefClear, virDomainDiskSourcePoolDefParse)
      (virDomainDiskDefParseXML, virDomainDiskSourceDefParse)
      (virDomainDiskSourceDefFormatInternal)
      (virDomainDiskDefForeachPath, virDomainDiskSourceIsBlockType):
      Adjust clients.
      * src/qemu/qemu_conf.c (qemuTranslateDiskSourcePool): Likewise.
      * src/libvirt_private.syms (domain_conf.h): Move symbols...
      (virstoragefile.h): ...as appropriate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b6edf2bf
    • E
      conf: move storage encryption type to util/ · 8fc32859
      Eric Blake 提交于
      Encryption keys can be associated with each source file in a
      backing chain; as such, this file belongs more in util/ where
      it can be used by virstoragefile.h.
      
      * src/conf/storage_encryption_conf.h: Rename...
      * src/util/virstorageencryption.h: ...to this.
      * src/conf/storage_encryption_conf.c: Rename...
      * src/util/virstorageencryption.c: ...to this.
      * src/Makefile.am (ENCRYPTION_CONF_SOURCES, CONF_SOURCES)
      (UTIL_SOURCES): Update to new file names.
      * src/libvirt_private.syms: Likewise.
      * src/conf/domain_conf.h: Update client.
      * src/conf/storage_conf.h: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      8fc32859