1. 20 10月, 2012 13 次提交
    • E
      storage: use cache to walk backing chain · 38c4a9cc
      Eric Blake 提交于
      We used to walk the backing file chain at least twice per disk,
      once to set up cgroup device whitelisting, and once to set up
      security labeling.  Rather than walk the chain every iteration,
      which possibly includes calls to fork() in order to open root-squashed
      NFS files, we can exploit the cache of the previous patch.
      
      * src/conf/domain_conf.h (virDomainDiskDefForeachPath): Alter
      signature.
      * src/conf/domain_conf.c (virDomainDiskDefForeachPath): Require caller
      to supply backing chain via disk, if recursion is desired.
      * src/security/security_dac.c
      (virSecurityDACSetSecurityImageLabel): Adjust caller.
      * src/security/security_selinux.c
      (virSecuritySELinuxSetSecurityImageLabel): Likewise.
      * src/security/virt-aa-helper.c (get_files): Likewise.
      * src/qemu/qemu_cgroup.c (qemuSetupDiskCgroup)
      (qemuTeardownDiskCgroup): Likewise.
      (qemuSetupCgroup): Pre-populate chain.
      38c4a9cc
    • E
      storage: cache backing chain while qemu domain is live · 4d34c929
      Eric Blake 提交于
      Technically, we should not be re-probing any file that qemu might
      be currently writing to.  As such, we should cache the backing
      file chain prior to starting qemu.  This patch adds the cache,
      but does not use it until the next patch.
      
      Ultimately, we want to also store the chain in domain XML, so that
      it is remembered across libvirtd restarts, and so that the only
      kosher way to modify the backing chain of an offline domain will be
      through libvirt API calls, but we aren't there yet.  So for now, we
      merely invalidate the cache any time we do a live operation that
      alters the chain (block-pull, block-commit, external disk snapshot),
      as well as tear down the cache when the domain is not running.
      
      * src/conf/domain_conf.h (_virDomainDiskDef): New field.
      * src/conf/domain_conf.c (virDomainDiskDefFree): Clean new field.
      * src/qemu/qemu_domain.h (qemuDomainDetermineDiskChain): New
      prototype.
      * src/qemu/qemu_domain.c (qemuDomainDetermineDiskChain): New
      function.
      * src/qemu/qemu_driver.c (qemuDomainAttachDeviceDiskLive)
      (qemuDomainChangeDiskMediaLive): Pre-populate chain.
      (qemuDomainSnapshotCreateSingleDiskActive): Uncache chain before
      snapshot.
      * src/qemu/qemu_process.c (qemuProcessHandleBlockJob): Update
      chain after block pull.
      4d34c929
    • 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: don't probe non-files · eac74c1f
      Eric Blake 提交于
      Backing chains can end on a network protocol, such as nbd:xxx; we
      should not attempt to probe the file system in this case.
      
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
      Only probe files.
      eac74c1f
    • E
      storage: use enum for snapshot driver type · 1246640b
      Eric Blake 提交于
      This is the last use of raw strings for disk formats throughout
      the src/conf directory.
      
      * src/conf/snapshot_conf.h (_virDomainSnapshotDiskDef): Store enum
      rather than string for disk type.
      * src/conf/snapshot_conf.c (virDomainSnapshotDiskDefClear)
      (virDomainSnapshotDiskDefParseXML, virDomainSnapshotDefFormat):
      Adjust users.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotDiskPrepare)
      (qemuDomainSnapshotCreateSingleDiskActive): Likewise.
      1246640b
    • E
      storage: use enum for disk driver type · e5e8d5d0
      Eric Blake 提交于
      Actually use the enum in the domain conf structure.
      
      * src/conf/domain_conf.h (_virDomainDiskDef): Store enum rather
      than string for disk type.
      * src/conf/domain_conf.c (virDomainDiskDefFree)
      (virDomainDiskDefParseXML, virDomainDiskDefFormat)
      (virDomainDiskDefForeachPath): Adjust users.
      * src/xenxs/xen_sxpr.c (xenParseSxprDisks, xenFormatSxprDisk):
      Likewise.
      * src/xenxs/xen_xm.c (xenParseXM, xenFormatXMDisk): Likewise.
      * src/vbox/vbox_tmpl.c (vboxAttachDrives): Likewise.
      * src/libxl/libxl_conf.c (libxlMakeDisk): Likewise.
      e5e8d5d0
    • E
      storage: use enum for default driver type · 09e7fb5e
      Eric Blake 提交于
      Express the default disk type as an enum, for easier handling.
      
      * src/conf/capabilities.h (_virCaps): Store enum rather than
      string for disk type.
      * src/conf/domain_conf.c (virDomainDiskDefParseXML): Adjust
      clients.
      * src/qemu/qemu_driver.c (qemuCreateCapabilities): Likewise.
      09e7fb5e
    • E
      storage: treat 'aio' like 'raw' at parse time · 41e0edaf
      Eric Blake 提交于
      We have historically allowed 'aio' as a synonym for 'raw' for
      back-compat to xen, but since a future patch will move to using
      an enum value, we have to pick one to be our preferred output
      name.  This is a slight change in the output XML, but the sexpr
      and xm outputs should still be identical, and the input XML can
      still use either form.
      
      * src/conf/domain_conf.c (virDomainDiskDefForeachPath): Move aio
      back-compat...
      (virDomainDiskDefParseXML): ...to parse time.
      * src/xenxs/xen_sxpr.c (xenParseSxprDisks, xenFormatSxprDisk): ...and
      to output time.
      * src/xenxs/xen_xm.c (xenParseXM, xenFormatXMDisk): Likewise.
      * tests/sexpr2xmldata/sexpr2xml-*.xml: Update tests.
      41e0edaf
    • 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
    • G
      selinux: relabel tapfd in qemuPhysIfaceConnect · 4492ef7f
      Guannan Ren 提交于
      Relabeling tapfd right after the tap device is created.
      qemuPhysIfaceConnect is common function called both for static
      netdevs and for hotplug netdevs.
      4492ef7f
  2. 19 10月, 2012 4 次提交
  3. 18 10月, 2012 8 次提交
  4. 17 10月, 2012 11 次提交
  5. 16 10月, 2012 4 次提交