1. 29 5月, 2015 1 次提交
    • J
      storage: Fix problem with disk backend pool allocation calculation · 6839b08b
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1224018
      
      The disk pool recalculates the pool allocation, capacity, and available
      values each time through processing a newly created disk partition. This
      created an issue with the allocation setting since the code used is shared
      with the refresh path. Each path calls virStorageBackendDiskReadPartitions
      which initializes the pool values and then processes the partition table
      from the 'libvirt_parthelper' utility output with the only difference being
      create passes a specific volume to be processed while refresh pass a NULL
      indicating to process all volumes. That passed volume is check during the
      virStorageBackendDiskMakeVol call to see if the current partition described
      by the volume key already exists. If it exists, then no adjustments are
      made to the allocation and the next entry in the output is checked.
      
      For the create path this resulted in only the most recently created
      partition size would be accounted for in the 'allocation' setting. This
      patch thus checks whether the incoming volume is NULL before clearing
      the pool allocation value.
      6839b08b
  2. 24 5月, 2015 1 次提交
  3. 04 5月, 2015 1 次提交
  4. 10 4月, 2015 1 次提交
    • J
      storage: Need to update freeExtent at delete primary partition · 1ffd82bb
      John Ferlan 提交于
      Commit id '471e1c4e' only considered updating the pool if the extended
      partition was removed. As it turns out removing a primary partition
      would also need to update the freeExtent list otherwise the following
      sequence would fail (assuming a "fresh" disk pool for /dev/sde of 500M):
      
      $  virsh pool-info disk-pool
      ...
      Capacity:       509.88 MiB
      Allocation:     0.00 B
      Available:      509.84 MiB
      
      $ virsh vol-create-as disk-pool sde1 --capacity 300M
      $ virsh vol-delete --pool disk-pool sde1
      $ virsh vol-create-as disk-pool sde1 --capacity 300M
      error: Failed to create vol sde1
      error: internal error: no large enough free extent
      
      $
      
      This patch will refresh the pool, rereading the partitions, and
      return
      1ffd82bb
  5. 03 3月, 2015 1 次提交
    • J
      disk: Provide a default storage source format type. · 832a9256
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1181062
      
      According to the formatstorage.html description for <source> element
      and "format" attribute: "All drivers are required to have a default
      value for this, so it is optional."
      
      As it turns out the disk backend did not choose a default value, so I
      added a default of "msdos" if the source type is "unknown" as well as
      updating the storage.html backend disk volume driver documentation to
      indicate the default format is dos.
      832a9256
  6. 02 3月, 2015 1 次提交
  7. 19 2月, 2015 1 次提交
    • J
      Search for schemas and cpu_map.xml in source tree · bc6e2063
      Jiri Denemark 提交于
      Not all files we want to find using virFileFindResource{,Full} are
      generated when libvirt is built, some of them (such as RNG schemas) are
      distributed with sources. The current API was not able to find source
      files if libvirt was built in VPATH.
      
      Both RNG schemas and cpu_map.xml are distributed in source tarball.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      bc6e2063
  8. 29 1月, 2015 6 次提交
    • J
      storage: Check the partition name against provided name · 9bbbb912
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1138516
      
      If the provided volume name doesn't match what parted generated as the
      partition name, then return a failure.
      
      Update virsh.pod and formatstorage.html.in to describe the 'name' restriction
      for disk pools as well as the usage of the <target>'s <format type='value'>.
      9bbbb912
    • J
      storage: When delete extended partition, need to refresh pool · 471e1c4e
      John Ferlan 提交于
      When removing a volume that is the extended partition, all the logical
      volume partitions that exist within the extended partition will also be
      removed, so we need to refresh the pool to have the updated list
      471e1c4e
    • J
      storage: Adjust how to refresh extended partition disk data · bce671b7
      John Ferlan 提交于
      During virStorageBackendDiskMakeDataVol processing, if we find an extended
      partition, then handle it specially when updating the capacity/allocation
      rather than calling virStorageBackendUpdateVolInfo.
      
      As it turns out, once a logical partition exists, any attempt to refresh
      the pool or after libvirtd restart/reload will result in a failure to open
      the extended partition device resulting in the inability to start the pool.
      The downside to this is we will lose the <permissions> and <timestamps> for
      the extended partition upon subsequent restart, refresh, reload since the
      stat() in virStorageBackendUpdateVolTargetInfoFD will not be called. However,
      since it's really only a container and shouldn't directly be used for
      storage that seems reasonable.
      
      Therefore, only use the existing code that already had a comment about
      getting the allocation wrong for extended partitions for just the setting
      of the extended partition data.
      bce671b7
    • J
      storage: Fix check for partition type for disk backing volumes · a0d88ed4
      John Ferlan 提交于
      While checking the existing partitions in virStorageBackendDiskPartFormat,
      the code would erroneously compare the volume target format type (eg, the
      virStoragePartedFsType) rather than the source partition type (eg, the
      virStorageVolTypeDisk) which is set during virStorageBackendDiskReadPartitions.
      a0d88ed4
    • J
      storage: Attempt error recovery in virStorageBackendDiskCreateVol · 290ffcfb
      John Ferlan 提交于
      During virStorageBackendDiskCreateVol if virStorageBackendDiskReadPartitions
      fails, then we were leaving with an error and a partition on the disk for
      which there was no corresponding volume and used space on the disk which
      could be reclaimable through direct parted activity. On a subsequent restart,
      reload, or refresh the volume may magically appear too.
      290ffcfb
    • J
      storage: Move virStorageBackendDiskDeleteVol · 1e79ad6d
      John Ferlan 提交于
      Move the API to before virStorageBackendDiskCreateVol in order to be
      able to call the DeleteVol API when virStorageBackendDiskReadPartitions
      fails so that we don't by chance leave a partition on the disk.
      1e79ad6d
  9. 10 12月, 2014 1 次提交
  10. 15 11月, 2014 1 次提交
  11. 11 9月, 2014 1 次提交
  12. 04 9月, 2014 1 次提交
    • E
      maint: use consistent if-else braces in conf and friends · ff78ff7c
      Eric Blake 提交于
      I'm about to add a syntax check that enforces our documented
      HACKING style of always using matching {} on if-else statements.
      
      This patch focuses on code shared between multiple drivers.
      
      * src/conf/domain_conf.c (virDomainFSDefParseXML)
      (virSysinfoParseXML, virDomainNetDefParseXML)
      (virDomainWatchdogDefParseXML)
      (virDomainRedirFilterUSBDevDefParseXML): Correct use of {}.
      * src/conf/interface_conf.c (virInterfaceDefParseDhcp)
      (virInterfaceDefParseIp, virInterfaceVlanDefFormat)
      (virInterfaceDefParseStartMode, virInterfaceDefParseBondMode)
      (virInterfaceDefParseBondMiiCarrier)
      (virInterfaceDefParseBondArpValid): Likewise.
      * src/conf/node_device_conf.c (virNodeDevCapStorageParseXML):
      Likewise.
      * src/conf/nwfilter_conf.c (virNWFilterRuleDetailsParse)
      (virNWFilterRuleParse, virNWFilterDefParseXML): Likewise.
      * src/conf/secret_conf.c (secretXMLParseNode): Likewise.
      * src/cpu/cpu_x86.c (x86Baseline, x86FeatureLoad, x86ModelLoad):
      Likewise.
      * src/network/bridge_driver.c (networkKillDaemon)
      (networkDnsmasqConfContents): Likewise.
      * src/node_device/node_device_hal.c (dev_refresh): Likewise.
      * src/nwfilter/nwfilter_gentech_driver.c (virNWFilterInstantiate):
      Likewise.
      * src/nwfilter/nwfilter_ebiptables_driver.c
      (_iptablesCreateRuleInstance): Likewise.
      * src/storage/storage_backend_disk.c
      (virStorageBackendDiskBuildPool): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ff78ff7c
  13. 17 7月, 2014 1 次提交
  14. 11 7月, 2014 1 次提交
  15. 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
  16. 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
  17. 25 4月, 2014 1 次提交
  18. 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
  19. 01 4月, 2014 2 次提交
  20. 25 3月, 2014 1 次提交
  21. 21 3月, 2014 1 次提交
  22. 18 3月, 2014 1 次提交
  23. 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
  24. 10 3月, 2014 1 次提交
  25. 12 2月, 2014 1 次提交
  26. 16 1月, 2014 1 次提交
  27. 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
  28. 11 7月, 2013 1 次提交
  29. 10 7月, 2013 1 次提交
  30. 21 5月, 2013 1 次提交
  31. 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