1. 08 4月, 2014 3 次提交
    • G
      tests: link against libxml2 · ed1b5d8e
      Guido Günther 提交于
      to avoid
      
      CCLD     storagevolxml2argvtest
      /usr/bin/ld: ../src/.libs/libvirt_driver_storage_impl.a(libvirt_driver_storage_impl_la-storage_backend.o): undefined reference to symbol 'xmlFreeDoc@@LIBXML2_2.4.30'
      //usr/lib/x86_64-linux-gnu/libxml2.so.2: error adding symbols: DSO missing from command line
      ed1b5d8e
    • E
      conf: avoid memleak on NULL path · 87333039
      Eric Blake 提交于
      I noticed that the apparmor code could request metadata even
      for a cdrom with no media, which would cause a memory leak of
      the hash table used to look for loops in the backing chain.
      But even before that, we blindly dereferenced the path for
      printing a debug statement, so it is just better to enforce
      that this is only used on non-NULL names.
      
      * src/util/virstoragefile.c (virStorageFileGetMetadata): Assume
      non-NULL path.
      * src/util/virstoragefile.h: Annotate this.
      * src/security/virt-aa-helper.c (get_files): Fix caller.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      87333039
    • C
  2. 07 4月, 2014 9 次提交
    • W
      bhyve: connectCompareCPU support · 627d1439
      Wojciech Macek 提交于
      Implement support for connectCompareCPU.
      627d1439
    • W
      bhyve: create capabilities submodule · b15a2bbd
      Wojciech Macek 提交于
      - Move all capabilities functions to separate file
      - Add initCPU
      b15a2bbd
    • W
      bhyve: support for connectBaselineCPU · 36cf8174
      Wojciech Macek 提交于
      Implement bhyveConnectBaselineCPU to support OpenStack/Nova
      36cf8174
    • L
      interface: dump inactive xml when interface isn't active · 7284c499
      Laine Stump 提交于
      Other drivers in libvirt (e.g. network, qemu) will automatically
      return the "inactive" (persistent configuration) XML of an object when
      that object is inactive. The netcf backend of the interface driver
      would always try to return the live status XML of the interface, even
      when it was down. Although netcf does return valid XML in that case,
      for bond interfaces it is missing almost all of its content, including
      the <bond> subelement itself, leading to this error message from
      "virsh iface-dumpxml" of a bond interface that is inactive:
      
        error: XML error: bond interface misses the bond element
      
      (this is because libvirt's validation of the XML returned by netcf
      always requires a <bond> element be present).
      
      This patch modifies the interface driver netcf backend to check if the
      interface is inactive, and in that case always return the inactive XML
      (which will always have a <bond> element, thus eliminating the error
      message, as well as making operation more in line with other drivers.
      
      This fixes the following bug:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=878394
      7284c499
    • E
      hash: add common utility functions · 09567144
      Eric Blake 提交于
      I almost wrote a hash value free function that just called
      VIR_FREE, then realized I couldn't be the first person to
      do that.  Sure enough, it was worth factoring into a common
      helper routine.
      
      * src/util/virhash.h (virHashValueFree): New function.
      * src/util/virhash.c (virHashValueFree): Implement it.
      * src/util/virobject.h (virObjectFreeHashData): New function.
      * src/libvirt_private.syms (virhash.h, virobject.h): Export them.
      * src/nwfilter/nwfilter_learnipaddr.c (virNWFilterLearnInit): Use
      common function.
      * src/qemu/qemu_capabilities.c (virQEMUCapsCacheNew): Likewise.
      * src/qemu/qemu_command.c (qemuDomainCCWAddressSetCreate):
      Likewise.
      * src/qemu/qemu_monitor.c (qemuMonitorGetBlockInfo): Likewise.
      * src/qemu/qemu_process.c (qemuProcessWaitForMonitor): Likewise.
      * src/util/virclosecallbacks.c (virCloseCallbacksNew): Likewise.
      * src/util/virkeyfile.c (virKeyFileParseGroup): Likewise.
      * tests/qemumonitorjsontest.c
      (testQemuMonitorJSONqemuMonitorJSONGetBlockInfo): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      09567144
    • J
      tests: build viridentitytest only WITH_ATTR. · cdc5f3f1
      Jincheng Miao 提交于
      Commit d7c4e003 assumed all SELinux tests depended upon
      securityselinuxhelper need xattr support, but forgot to
      move viridentitytest under WITH_ATTR.
      Reported-by: NNehal J Wani <nehaljw.kkd1@gmail.com>
      Signed-off-by: NJincheng Miao <jmiao@redhat.com>
      cdc5f3f1
    • P
      maint: Correctly detect wether "gluster" cli tool is accessible · 56746d8a
      Peter Krempa 提交于
      The configure definition previously always defined the GLUSTER_CLI macro
      and thus the code needing it wasn't compiled out if the tool wasn't
      accessible.
      56746d8a
    • G
      libvirt-guests: avoid bashism · 5a058657
      Guido Günther 提交于
      At least Debian uses dash to run the init scripts
      5a058657
    • A
      QoS: make tc filters match all traffic · d9de1443
      Antoni S. Puimedon 提交于
      Up until now the traffic control filters for the vNIC QoS were
      matching only ip traffic. For egress traffic that was unnoticed
      because the unmatched traffic would just go to the default htb class
      and be shaped anyway. For ingress, though, since the policing of the
      rate is done by the filter itself.
      
      The problem is solved by changing protocol to all and making anything
      match the filter.
      
      Bug-Url: https://bugzilla.redhat.com/1084444Signed-off-by: NAntoni S. Puimedon <asegurap@redhat.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      d9de1443
  3. 05 4月, 2014 6 次提交
    • R
      bhyve: add xml2argv tests for console · 4463e438
      Roman Bogorodskiy 提交于
      4463e438
    • 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
    • D
      bhyve: domain autostart support · 6318a801
      David Shane Holden 提交于
      Signed-off-by: NRoman Bogorodskiy <bogorodskiy@gmail.com>
      6318a801
    • 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
    • E
      tests: refactor virstoragetest for less stack space · d1a1d841
      Eric Blake 提交于
      I'm about to add fields to virStorageFileMetadata, which means
      also adding fields to the testFileData struct in virstoragetest.
      Alas, adding even one pointer on an x86_64 machine gave me a
      dreaded compiler error:
      
      virstoragetest.c:712:1: error: the frame size of 4208 bytes is larger than 4096 bytes [-Werror=frame-larger-than=]
      
      After some experimentation, I realized that each test was creating
      yet another testChainData (which contains testFileData) on the stack;
      forcing the reuse of one of these structures instead of creating a
      fresh one each time drastically reduces the size requirements.  While
      at it, I also got rid of a lot of intermediate structs, with some
      macro magic that lets me directly build up the destination chains
      inline.
      
      For a bit more insight into what this patch does:
      The old code uses an intermediate variable as a fixed-size array
      of structs:
      testFileData chain[] = { a, b };
      data.files = chain;
      
      In the new code, the use of VIR_FLATTEN_* allows the TEST_CHAIN()
      macro to still take a single argument for each chain, but now of
      the form '(a, b)', where it is turned into the var-args 'a, b'
      multiple arguments understood by TEST_ONE_CHAIN().  Thus, the
      new code avoids an intermediate variable, and directly provides
      the list of pointers to be assigned into array elements:
      data.files = { &a, &b };
      
      * tests/virstoragetest.c (mymain): Rewrite TEST_ONE_CHAIN to
      reuse the same struct for each test, and to take the data
      inline rather than via intermediate variables.
      (testChainData): Use bounded array of pointers instead of
      unlimited array of struct.
      (testStorageChain): Reflect struct change.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d1a1d841
    • E
      tests: use C99 initialization for storage test · 7da61b30
      Eric Blake 提交于
      Writing this test with C99 initializers will make it easier to test
      additions and deletions to struct members as I refactor the code.
      
      * tests/virstoragetest.c (mymain): Rewrite initializers.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7da61b30
  4. 04 4月, 2014 3 次提交
    • J
      NFS storage pool: Fix libvirtd crash due to refactor edit · 30283b86
      John Ferlan 提交于
      Commit id '18642d10' refactored the call to virCommandRunRegex()
      inside a new function virStorageBackendFileSystemNetFindNFSPoolSources(),
      but the cut-n-paste didn't remove the "&state".  Now that state is passed
      by reference, it results in a libvirtd core with a messages entry:
      
      "...internal error: unknown storage pool type Unknow"
      30283b86
    • O
      Define CPUINFO_FILE_LEN and fix maxlen of cpuinfo file for all uses · 82d858ce
      Olivia Yin 提交于
      For example, the file /proc/cpuinfo for 24 cores PowerPC platform is larger than
      the previous maximum size 2KB.
      It will fail to start libvirtd with the error message as below:
      virFileReadAll: Failed to read file '/proc/cpuinfo': Value too large for defined
      data type
      virSysinfoRead: internal error Failed to open /proc/cpuinfo
      
      This patch defines CPUINFO_FILE_LEN as 10KB which is enough for most architectures.
      Signed-off-by: NOlivia Yin <Hong-Hua.Yin@freescale.com>
      Signed-off-by: NJán Tomko <jtomko@redhat.com>
      82d858ce
    • N
      Fix Memory Leak in daemon/libvirtd.c · 34542473
      Nehal J Wani 提交于
      Fixes leak introduced by e562e82f
      
      ==4937== 64 bytes in 1 blocks are definitely lost in loss record 270 of 405
      ==4937==    at 0x4A06BE0: realloc (vg_replace_malloc.c:662)
      ==4937==    by 0x6FA41C4: __vasprintf_chk (vasprintf_chk.c:90)
      ==4937==    by 0x50C8D29: virVasprintfInternal (stdio2.h:199)
      ==4937==    by 0x50C8E3A: virAsprintfInternal (virstring.c:362)
      ==4937==    by 0x11D01A: main (libvirtd.c:1170)
      Signed-off-by: NJán Tomko <jtomko@redhat.com>
      34542473
  5. 03 4月, 2014 10 次提交
    • S
      libxl: Set disk format for empty cdrom device · 7a1452f5
      Stefan Bader 提交于
      The XML config for a CDROM device can be without a source path,
      indicating that there is no media present. Without this change
      the libxl driver fails to start a guest in that case because
      the libxl library checks for the LIBXL_DISK_FORMAT_EMPTY format
      type and tries to stat the NULL pointer that gets passed on.
      
      > libxl: error: libxl_device.c:265:libxl__device_disk_set_backend:
      > Disk vdev=hdc failed to stat: (null): Bad address
      Signed-off-by: NStefan Bader <stefan.bader@canonical.com>
      7a1452f5
    • S
      libxl: Use id from virDomainObj inside the driver · 0e0c1a74
      Stefan Bader 提交于
      There is a domain id in the virDomain structure as well as in the
      virDomainObj structure. While the former can become stale the latter
      is kept up to date. So it is safer to always (virDomainObjPtr)->def->id
      internally.
      
      This will fix issues seen when managing Xen guests through libvirt from
      virt-manager (not being able to get domain info after define or reboot).
      This was caused both though libxlDomainGetInfo() only but there were
      a lot of places that might potentially cause issues, too.
      Signed-off-by: NStefan Bader <stefan.bader@canonical.com>
      0e0c1a74
    • J
      Add redirdevs to ABI stability check · c9123fbe
      Ján Tomko 提交于
      Check the bus, type of the source device (tcp vs. spicevmc)
      and the device address visible in the guest.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1035128
      c9123fbe
    • J
      Use the force flag for mkfs -t xfs · 904e6e90
      Ján Tomko 提交于
      Without this, building an XFS pool on a formatted partition
      fails with --overwrite.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=927172
      904e6e90
    • L
      virsh: Make 'exit' action same as 'quit' · cc7e1503
      Li Yang 提交于
      For now 'virsh quit' action like this:
      --------------------------------
      [root@localhost /]# virsh quit
      [root@localhost /]#
      --------------------------------
      And 'virsh exit' action:
      --------------------------------
      [root@localhost /]# virsh exit
      
      [root@localhost /]#
      --------------------------------
      There is a small difference('/n') between them.
      According to manual said:
             quit, exit
                 quit this interactive terminal
      
      And in the code they all called cmdQuit func,
      They should get same actions.
      Signed-off-by: NLi Yang <liyang.fnst@cn.fujitsu.com>
      cc7e1503
    • M
      qemu: make sure agent returns error when required data are missing · 736e017e
      Martin Kletzander 提交于
      Commit 5b3492fa aimed to fix this and caught one error but exposed
      another one.  When agent command is being executed and the thread
      waiting for the reply is woken up by an event (e.g. EOF in case of
      shutdown), the command finishes with no data (rxObject == NULL), but
      no error is reported, since this might be desired by the caller
      (e.g. suspend through agent).  However, in other situations, when the
      data are required (e.g. getting vCPUs), we proceed to getting desired
      data out of the reply, but none of the virJSON*() functions works well
      with NULLs.  I chose the way of a new parameter for qemuAgentCommand()
      function that specifies whether reply is required and behaves
      according to that.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1058149Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      736e017e
    • J
      Include PCI address in the error in virDomainNetFindIdx · 246317d3
      Ján Tomko 提交于
      When looking up a net device by a MAC and PCI address, it is possible
      that we've got a match on the MAC address but failed to match the
      PCI address.
      
      In that case, outputting just the MAC address can be confusing.
      
      Partially resolves:
      https://bugzilla.redhat.com/show_bug.cgi?id=872028
      246317d3
    • J
      Move error reporting into virDomainNetFindIdx · 2fbae1b2
      Ján Tomko 提交于
      Every caller checked the return value and logged an error
      - one if no device with the specified MAC was found,
      other if there were multiple devices matching the MAC address
      (except for qemuDomainUpdateDeviceConfig which logged the same
       message in both cases).
      
      Move the error reporting into virDomainNetFindIdx, since in both cases,
      we couldn't find one single match - it's just the error messages that
      differ.
      2fbae1b2
    • E
      tests: simplify storage test cleanup · 8feec44a
      Eric Blake 提交于
      No need to spawn a child 'rm' process when we can do it ourselves.
      
      * tests/virstoragetest.c (testCleanupImages): Use dedicated
      helper.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      8feec44a
    • C
      storage: Report error from VolOpen by default · 138e65c3
      Cole Robinson 提交于
      Currently VolOpen notifies the user of a potentially non-fatal failure by
      returning -2 and logging a VIR_WARN or VIR_INFO. Unfortunately most
      callers treat -2 as fatal but don't actually report any message with
      the error APIs.
      
      Rename the VOL_OPEN_ERROR flag to VOL_OPEN_NOERROR. If NOERROR is specified,
      we preserve the current behavior of returning -2 (there's only one caller
      that wants this).
      
      However in the default case, only return -1, and actually use the error
      APIs. Fix up a couple callers as a result.
      138e65c3
  6. 02 4月, 2014 9 次提交
    • J
      Fix coverity-reported leak in virSecurityManagerGenLabel · 66050f0f
      Ján Tomko 提交于
      Coverity complains about a possible leak of seclabel if
      !sec_managers[i]->drv->domainGenSecurityLabel is true
      and the seclabel might be overwritten by the next iteration
      of the loop.
      
      This leak should never happen, because every security driver
      has domainGenSecurityLabel defined.
      66050f0f
    • E
      conf: modify tracking of encrypted images · 2279d560
      Eric Blake 提交于
      A future patch will merge virStorageFileMetadata and virStorageSource,
      but I found it easier to do if both structs use the same information
      for tracking whether a source file needs encryption keys.
      
      * src/util/virstoragefile.h (_virStorageFileMetadata): Prepare
      full encryption struct instead of just a bool.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
      Use transfer semantics.
      * src/storage/storage_backend_gluster.c
      (virStorageBackendGlusterRefreshVol): Likewise.
      * src/util/virstoragefile.c (virStorageFileGetMetadataInternal):
      Populate struct.
      (virStorageFileFreeMetadata): Adjust clients.
      * tests/virstoragetest.c (testStorageChain): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      2279d560
    • 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: 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
      phyp: fix logic error on volume creation · 93d4585e
      Eric Blake 提交于
      The phyp code claims that it wants a non-zero value, but actually
      enforces a capacity of zero.  It has been this way since commit
      ebc46fea in June 2010.  Bummer that it has my name as the committer
      - I guess I should have been much more stubborn about not blindly
      taking someone else's 1600-line patch.
      
      * src/phyp/phyp_driver.c (phypStorageVolCreateXML): Use correct
      logic.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      93d4585e