1. 07 11月, 2013 2 次提交
    • E
      storage: always probe type with buffer · 348b4e25
      Eric Blake 提交于
      This gets rid of another stat() per volume, as well as cutting
      bytes read in half, when populating the volumes of a directory
      pool during a pool refresh.  Not to mention that it provides an
      interface that can let gluster pools also probe file types.
      
      * src/util/virstoragefile.h (virStorageFileProbeFormatFromFD):
      Delete.
      (virStorageFileProbeFormatFromBuf): New prototype.
      (VIR_STORAGE_MAX_HEADER): New constant, based on...
      * src/util/virstoragefile.c (STORAGE_MAX_HEAD): ...old name.
      (vmdk4GetBackingStore, virStorageFileGetMetadataInternal)
      (virStorageFileProbeFormat): Adjust clients.
      (virStorageFileProbeFormatFromFD): Delete.
      (virStorageFileProbeFormatFromBuf): Export.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
      Adjust client.
      * src/libvirt_private.syms (virstoragefile.h): Adjust exports.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      348b4e25
    • E
      storage: reduce number of stat calls · 9cac8639
      Eric Blake 提交于
      We are calling fstat() at least twice per storage volume in
      a directory storage pool; this is rather wasteful.  Refactoring
      this is also a step towards making code reusable for gluster,
      where gluster can provide struct stat but cannot use fstat().
      
      * src/storage/storage_backend.h
      (virStorageBackendVolOpenCheckMode)
      (virStorageBackendUpdateVolTargetInfoFD): Update signature.
      * src/storage/storage_backend.c
      (virStorageBackendVolOpenCheckMode): Pass stat results back.
      (virStorageBackendUpdateVolTargetInfoFD): Use existing stats.
      (virStorageBackendVolOpen, virStorageBackendUpdateVolTargetInfo):
      Update callers.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
      Likewise.
      * src/storage/storage_backend_scsi.c
      (virStorageBackendSCSIUpdateVolTargetInfo): Likewise.
      * src/storage/storage_backend_mpath.c
      (virStorageBackendMpathUpdateVolTargetInfo): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      9cac8639
  2. 21 10月, 2013 1 次提交
  3. 16 9月, 2013 1 次提交
  4. 11 7月, 2013 2 次提交
  5. 10 7月, 2013 1 次提交
  6. 21 6月, 2013 1 次提交
    • J
      conf: add features to volume target XML · 31d42506
      Ján Tomko 提交于
      Add <features> and <compat> elements to volume target XML.
      
      <compat> is a string which for qcow2 represents the QEMU version
      it should be compatible with. Valid values are 0.10 and 1.1.
      1.1 is implicit if the <features> element is present, otherwise
      qemu-img default is used. 0.10 can be specified to explicitly
      create older images after the qemu-img default changes.
      
      <features> contains optional features, so far
      <lazy_refcounts/> is available, which enables caching of reference
      counters, improving performance for snapshots.
      31d42506
  7. 05 6月, 2013 1 次提交
    • O
      storage: Support preallocate the new capacity for vol-resize · aa2a4cff
      Osier Yang 提交于
      The document for "vol-resize" says the new capacity will be sparse
      unless "--allocate" is specified, however, the "--allocate" flag
      is never implemented. This implements the "--allocate" flag for
      fs backend's raw type volume, based on posix_fallocate and the
      syscall SYS_fallocate.
      aa2a4cff
  8. 31 5月, 2013 1 次提交
  9. 15 5月, 2013 1 次提交
  10. 10 5月, 2013 1 次提交
  11. 02 5月, 2013 1 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88
  12. 23 2月, 2013 1 次提交
    • S
      storage: use f_frsize, not f_bsize, for calculating available space · c2092abf
      Sage Weil 提交于
      The bfree and blocks fields are supposed to be in units of frsize.  We were
      calculating capacity correctly using those units, but the available
      calculation was using bsize instead.  Most file systems report these as the
      same value specifically because many programs are buggy, but that is no
      reason to rely on that behavior, or to behave inconsistently.
      
      This bug has been present since e266ded2 (2008) and aa296e6c, when the code
      was originally introduced (the latter via cut and paste).
      Signed-off-by: NSage Weil <sage@newdream.net>
      c2092abf
  13. 24 1月, 2013 1 次提交
  14. 14 1月, 2013 1 次提交
  15. 21 12月, 2012 6 次提交
  16. 07 12月, 2012 1 次提交
    • J
      storage: allow metadata preallocation when creating qcow2 images · 1c9a2fb1
      Ján Tomko 提交于
      Add VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA flag to virStorageVolCreateXML
      and virStorageVolCreateXMLFrom. This flag requests metadata
      preallocation when creating/cloning qcow2 images, resulting in creating
      a sparse file with qcow2 metadata. It has only slightly larger disk usage
      compared to new image with no allocation, but offers higher performance.
      1c9a2fb1
  17. 06 12月, 2012 1 次提交
  18. 22 11月, 2012 2 次提交
  19. 02 11月, 2012 1 次提交
  20. 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
  21. 20 10月, 2012 2 次提交
    • 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: 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
  22. 21 9月, 2012 1 次提交
  23. 02 8月, 2012 1 次提交
    • G
      storage: netfs and iscsi need option srcSpec for resource discovery · 40570488
      Guannan Ren 提交于
      The option 'srcSpec' to virsh command find-storage-pool-sources
      is optional for logical type of storage pool, but mandatory for
      netfs and iscsi type.
      When missing the option for netfs and iscsi, libvirt reports XML
      parsing error due to null string option srcSpec.
      
      before
      error: Failed to find any netfs pool sources
      error: (storage_source_specification):1: Document is empty
      (null)
      
      after:
      error: pool type 'iscsi' requires option --srcSpec for source discovery
      40570488
  24. 27 7月, 2012 1 次提交
    • E
      maint: don't permit format strings without % · 768007ae
      Eric Blake 提交于
      Any time we have a string with no % passed through gettext, a
      translator can inject a % to cause a stack overread.  When there
      is nothing to format, it's easier to ask for a string that cannot
      be used as a formatter, by using a trivial "%s" format instead.
      
      In the past, we have used --disable-nls to catch some of the
      offenders, but that doesn't get run very often, and many more
      uses have crept in.  Syntax check to the rescue!
      
      The syntax check can catch uses such as
      virReportError(code,
                     _("split "
                       "string"));
      by using a sed script to fold context lines into one pattern
      space before checking for a string without %.
      
      This patch is just mechanical insertion of %s; there are probably
      several messages touched by this patch where we would be better
      off giving the user more information than a fixed string.
      
      * cfg.mk (sc_prohibit_diagnostic_without_format): New rule.
      * src/datatypes.c (virUnrefConnect, virGetDomain)
      (virUnrefDomain, virGetNetwork, virUnrefNetwork, virGetInterface)
      (virUnrefInterface, virGetStoragePool, virUnrefStoragePool)
      (virGetStorageVol, virUnrefStorageVol, virGetNodeDevice)
      (virGetSecret, virUnrefSecret, virGetNWFilter, virUnrefNWFilter)
      (virGetDomainSnapshot, virUnrefDomainSnapshot): Add %s wrapper.
      * src/lxc/lxc_driver.c (lxcDomainSetBlkioParameters)
      (lxcDomainGetBlkioParameters): Likewise.
      * src/conf/domain_conf.c (virSecurityDeviceLabelDefParseXML)
      (virDomainDiskDefParseXML, virDomainGraphicsDefParseXML):
      Likewise.
      * src/conf/network_conf.c (virNetworkDNSHostsDefParseXML)
      (virNetworkDefParseXML): Likewise.
      * src/conf/nwfilter_conf.c (virNWFilterIsValidChainName):
      Likewise.
      * src/conf/nwfilter_params.c (virNWFilterVarValueCreateSimple)
      (virNWFilterVarAccessParse): Likewise.
      * src/libvirt.c (virDomainSave, virDomainSaveFlags)
      (virDomainRestore, virDomainRestoreFlags)
      (virDomainSaveImageGetXMLDesc, virDomainSaveImageDefineXML)
      (virDomainCoreDump, virDomainGetXMLDesc)
      (virDomainMigrateVersion1, virDomainMigrateVersion2)
      (virDomainMigrateVersion3, virDomainMigrate, virDomainMigrate2)
      (virStreamSendAll, virStreamRecvAll)
      (virDomainSnapshotGetXMLDesc): Likewise.
      * src/nwfilter/nwfilter_dhcpsnoop.c (virNWFilterSnoopReqLeaseDel)
      (virNWFilterDHCPSnoopReq): Likewise.
      * src/openvz/openvz_driver.c (openvzUpdateDevice): Likewise.
      * src/openvz/openvz_util.c (openvzKBPerPages): Likewise.
      * src/qemu/qemu_cgroup.c (qemuSetupCgroup): Likewise.
      * src/qemu/qemu_command.c (qemuBuildHubDevStr, qemuBuildChrChardevStr)
      (qemuBuildCommandLine): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainGetPercpuStats): Likewise.
      * src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
      * src/rpc/virnetsaslcontext.c (virNetSASLSessionGetIdentity):
      Likewise.
      * src/rpc/virnetsocket.c (virNetSocketNewConnectUNIX)
      (virNetSocketSendFD, virNetSocketRecvFD): Likewise.
      * src/storage/storage_backend_disk.c
      (virStorageBackendDiskBuildPool): Likewise.
      * src/storage/storage_backend_fs.c
      (virStorageBackendFileSystemProbe)
      (virStorageBackendFileSystemBuild): Likewise.
      * src/storage/storage_backend_rbd.c
      (virStorageBackendRBDOpenRADOSConn): Likewise.
      * src/storage/storage_driver.c (storageVolumeResize): Likewise.
      * src/test/test_driver.c (testInterfaceChangeBegin)
      (testInterfaceChangeCommit, testInterfaceChangeRollback):
      Likewise.
      * src/vbox/vbox_tmpl.c (vboxListAllDomains): Likewise.
      * src/xenxs/xen_sxpr.c (xenFormatSxprDisk, xenFormatSxpr):
      Likewise.
      * src/xenxs/xen_xm.c (xenXMConfigGetUUID, xenFormatXMDisk)
      (xenFormatXM): Likewise.
      768007ae
  25. 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
  26. 19 7月, 2012 1 次提交
  27. 12 7月, 2012 1 次提交
  28. 11 7月, 2012 1 次提交
    • S
      Fix directory removal in filesystem storage driver · 5079a7b3
      Sascha Peilicke 提交于
      Fix the virStorageBackendFileSystemVolDelete method to not use
      unlink() unconditionally. It must use rmdir() for volumes which
      are directories. It should also raise an error if given a volume
      which has the network/block type.
      5079a7b3
  29. 10 7月, 2012 1 次提交
  30. 09 7月, 2012 2 次提交
    • P
      storage_backend_fs: Allocate entry for host before accessing it · 48b78519
      Peter Krempa 提交于
      Commit 122fa379 introduces option to
      store more than one host entry in a storage pool source definition. That
      commit causes a regression, where a check is added that only one host
      entry should be present (that actualy is not present as the source
      structure was just allocated and zeroed) instead of allocating memory
      for the host entry.
      48b78519
    • P
      storage_backend_fs: Don't free a part of a structure on error · ab9c72ae
      Peter Krempa 提交于
      As the storage pool sources are stored in a list of structs, the pointer
      returned by virStoragePoolSourceListNewSource() shouldn't be freed as it
      points in the middle of a memory block. This combined with a regression
      that takes the error path every time on caused a double-free abort on
      the src struct in question.
      ab9c72ae