1. 11 7月, 2014 1 次提交
  2. 16 5月, 2014 1 次提交
    • E
      maint: shorten 'TypeType' function names · ab517818
      Eric Blake 提交于
      The VIR_ENUM_DECL/VIR_ENUM_IMPL helper macros already append 'Type'
      to the enum name being converted; it looks silly to have functions
      with 'TypeType' in their name.  Even though some of our enums have
      to have a 'Type' suffix, the corresponding string conversion
      functions do not.
      
      * src/conf/secret_conf.h (VIR_ENUM_DECL): Rename virSecretUsageType.
      * src/conf/storage_conf.h (VIR_ENUM_DECL): Rename
      virStoragePoolAuthType, virStoragePoolSourceAdapterType,
      virStoragePartedFsType.
      * src/conf/domain_conf.c (virDomainDiskDefParseXML)
      (virDomainFSDefParseXML, virDomainFSDefFormat): Update callers.
      * src/conf/secret_conf.c (virSecretDefParseUsage)
      (virSecretDefFormatUsage): Likewise.
      * src/conf/storage_conf.c (virStoragePoolDefParseAuth)
      (virStoragePoolDefParseSource, virStoragePoolSourceFormat):
      Likewise.
      * src/lxc/lxc_controller.c (virLXCControllerSetupLoopDevices):
      Likewise.
      * src/storage/storage_backend_disk.c
      (virStorageBackendDiskPartFormat): Likewise.
      * src/util/virstorageencryption.c (virStorageEncryptionSecretParse)
      (virStorageEncryptionSecretFormat): Likewise.
      * tools/virsh-secret.c (cmdSecretList): Likewise.
      * src/libvirt_private.syms (secret_conf.h, storage_conf.h): Export
      corrected names.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ab517818
  3. 02 5月, 2014 1 次提交
    • J
      Restore skipping of setting capacity · f1856eb6
      John Ferlan 提交于
      Commit id 'ac9a0963' refactored out the 'withCapacity' for the
      virStorageBackendUpdateVolInfo() API.  See:
      
      http://www.redhat.com/archives/libvir-list/2014-April/msg00043.html
      
      This resulted in a difference in how 'virsh vol-info --pool <poolName>
      <volume>' or 'virsh vol-list vol-list --pool <poolName> --details' outputs
      the capacity information for a directory pool with a qcow2 sparse file.
      
      For example, using the following XML
      
      mkdir /home/TestPool
      cat testpool.xml
      <pool type='dir'>
        <name>TestPool</name>
        <uuid>6bf80895-10b6-75a6-6059-89fdea2aefb7</uuid>
        <source>
        </source>
        <target>
          <path>/home/TestPool</path>
          <permissions>
            <mode>0755</mode>
            <owner>0</owner>
            <group>0</group>
          </permissions>
        </target>
      </pool>
      
      virsh pool-create testpool.xml
      virsh vol-create-as --pool TestPool temp_vol_1 \
            --capacity 1048576 --allocation 1048576 --format qcow2
      virsh vol-info --pool TestPool temp_vol_1
      
      Results in listing a Capacity value.  Prior to the commit, the value would
      be '1.0 MiB' (1048576 bytes). However, after the commit the output would be
      (for example) '192.50 KiB', which for my system was the size of the volume
      in my file system (eg 'ls -l TestPool/temp_vol_1' results in '197120' bytes
      or 192.50 KiB). While perhaps technically correct, it's not necessarily
      what the user expected (certainly virt-test didn't expect it).
      
      This patch restores the code to not update the target capacity for this path
      f1856eb6
  4. 25 4月, 2014 1 次提交
  5. 02 4月, 2014 4 次提交
    • E
      conf: drop redundant parameters during probe · ac9a0963
      Eric Blake 提交于
      Now that each virStorageSource can track allocation information,
      and given that we already have the information without extra
      syscalls, it's easier to just always populate the information
      directly into the struct than it is to sometimes pass the address
      of the struct members down the call chain.
      
      * src/storage/storage_backend.h (virStorageBackendUpdateVolInfo)
      (virStorageBackendUpdateVolTargetInfo)
      (virStorageBackendUpdateVolTargetInfoFD): Update signature.
      * src/storage/storage_backend.c (virStorageBackendUpdateVolInfo)
      (virStorageBackendUpdateVolTargetInfo)
      (virStorageBackendUpdateVolTargetInfoFD): Always populate struct
      members instead.
      * src/storage/storage_backend_disk.c
      (virStorageBackendDiskMakeDataVol): Update client.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget)
      (virStorageBackendFileSystemRefresh)
      (virStorageBackendFileSystemVolRefresh): Likewise.
      * src/storage/storage_backend_gluster.c
      (virStorageBackendGlusterRefreshVol): Likewise.
      * src/storage/storage_backend_logical.c
      (virStorageBackendLogicalMakeVol): Likewise.
      * src/storage/storage_backend_mpath.c
      (virStorageBackendMpathNewVol): Likewise.
      * src/storage/storage_backend_scsi.c
      (virStorageBackendSCSINewLun): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ac9a0963
    • 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: 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
      maint: fix spelling errors in disk pools · 17f82636
      Eric Blake 提交于
      Noticed during my work on storage struct cleanups.
      
      * src/storage/storage_backend_disk.c
      (virStorageBackendDiskPartBoundaries): Fix spelling errors.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      17f82636
  6. 01 4月, 2014 2 次提交
  7. 25 3月, 2014 1 次提交
  8. 21 3月, 2014 1 次提交
  9. 18 3月, 2014 1 次提交
  10. 12 3月, 2014 1 次提交
    • J
      storage: Fix bugs in VIR_APPEND_ELEMENT series · ea10cd76
      John Ferlan 提交于
      From commit id 'd53bbfd1'
      
      Found one core and one possible memory leak. Core seen during local
      virt-test/tp_libvirt run for the vol_create_from test. The memory leak
      was seen by inspection during a review of all VIR_APPEND_ELEMENT changes
      
      In storage_backend_disk/virStorageBackendDiskMakeDataVol(), the 'vol'
      needs to be kept around since it's used later, so use the _COPY macro.
      This caused a segv in libvirtd:
      
      Program received signal SIGSEGV, Segmentation fault.
      [Switching to Thread 0x7fffe87c3700 (LWP 6919)]
      virStorageBackendDiskMakeDataVol (vol=0x0, groups=0x7fffc8000d70, pool=0x7fffc8002460) at storage/storage_backend_disk.c:66
      66          if (vol->target.path == NULL) {
      
      In storage_backend_rbd/virStorageBackendRBDRefreshPool() there's a failure
      path where the 'vol' needs to go through virStorageVolDefFree() since it
      wouldn't be appended.
      ea10cd76
  11. 10 3月, 2014 1 次提交
  12. 12 2月, 2014 1 次提交
  13. 16 1月, 2014 1 次提交
  14. 05 12月, 2013 1 次提交
    • P
      maint: Kill usage of atoi() · df36af58
      Peter Krempa 提交于
      Kill the use of atoi() and introduce syntax check to forbid it and it's
      friends (atol, atoll, atof, atoq).
      
      Also fix a typo in variable name holding the cylinders count of a disk
      pool (apparently unused).
      
      examples/domsuspend/suspend.c will need a larger scale refactor as the
      whole example file is broken thus it will be exempted from the syntax
      check for now.
      df36af58
  15. 11 7月, 2013 1 次提交
  16. 10 7月, 2013 1 次提交
  17. 21 5月, 2013 1 次提交
  18. 11 5月, 2013 1 次提交
    • L
      util: move virFile* functions from virutil.c to virfile.c · bfe7721d
      Laine Stump 提交于
      These all existed before virfile.c was created, and for some reason
      weren't moved.
      
      This is mostly straightfoward, although the syntax rule prohibiting
      write() had to be changed to have an exception for virfile.c instead
      of virutil.c.
      
      This movement pointed out that there is a function called
      virBuildPath(), and another almost identical function called
      virFileBuildPath(). They really should be a single function, which
      I'll take care of as soon as I figure out what the arglist should look
      like.
      bfe7721d
  19. 10 5月, 2013 1 次提交
  20. 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
  21. 26 4月, 2013 1 次提交
    • E
      build: avoid unsafe functions in libgen.h · 1fbf1905
      Eric Blake 提交于
      POSIX says that both basename() and dirname() may return static
      storage (aka they need not be thread-safe); and that they may but
      not must modify their input argument.  Furthermore, <libgen.h>
      is not available on all platforms.  For these reasons, you should
      never use these functions in a multi-threaded library.
      
      Gnulib instead recommends a way to avoid the portability nightmare:
      gnulib's "dirname.h" provides useful thread-safe counterparts.  The
      obvious dir_name() and base_name() are GPL (because they malloc(),
      but call exit() on failure) so we can't use them; but the LGPL
      variants mdir_name() (malloc's or returns NULL) and last_component
      (always points into the incoming string without modifying it,
      differing from basename semantics only on corner cases like the
      empty string that we shouldn't be hitting in the first place) are
      already in use in libvirt.  This finishes the swap over to the safe
      functions.
      
      * cfg.mk (sc_prohibit_libgen): New rule.
      * src/util/vircgroup.c: Fix offenders.
      * src/parallels/parallels_storage.c (parallelsPoolAddByDomain):
      Likewise.
      * src/parallels/parallels_network.c (parallelsGetBridgedNetInfo):
      Likewise.
      * src/node_device/node_device_udev.c (udevProcessSCSIHost)
      (udevProcessSCSIDevice): Likewise.
      * src/storage/storage_backend_disk.c
      (virStorageBackendDiskDeleteVol): Likewise.
      * src/util/virpci.c (virPCIGetDeviceAddressFromSysfsLink):
      Likewise.
      * src/util/virstoragefile.h (_virStorageFileMetadata): Avoid false
      positive.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1fbf1905
  22. 06 2月, 2013 1 次提交
  23. 21 12月, 2012 5 次提交
  24. 02 11月, 2012 1 次提交
  25. 23 10月, 2012 1 次提交
    • C
      storage: Don't do wait loops from VolLookupByPath · 77eff5ee
      Cole Robinson 提交于
      virStorageVolLookupByPath is an API call that virt-manager uses
      quite a bit when dealing with storage. This call use BackendStablePath
      which has several usleep() heuristics that can be tripped up
      and hang virt-manager for a while.
      
      Current example: an empty mpath pool pointing to /dev/mapper makes
      _any_ calls to virStorageVolLookupByPath take 5 seconds.
      
      The sleep heuristics are actually only needed in certain cases
      when we are waiting for new storage to appear, so let's skip the
      timeout steps when calling from LookupByPath.
      77eff5ee
  26. 12 10月, 2012 1 次提交
  27. 21 9月, 2012 1 次提交
  28. 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
  29. 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
  30. 19 7月, 2012 1 次提交
  31. 12 7月, 2012 1 次提交
  32. 15 11月, 2011 1 次提交