1. 02 4月, 2014 6 次提交
    • E
      conf: move storage secret type to util/ · c05d9dca
      Eric Blake 提交于
      This one is a relatively easy move.  We don't ever convert the
      enum to or from strings (it is inferred from other elements in
      the xml, rather than directly represented).
      
      * src/conf/domain_conf.h (virDomainDiskSecretType): Move...
      * src/util/virstoragefile.h (virStorageSecreteType): ...and
      rename.
      * src/conf/domain_conf.c (virDomainDiskSecretType): Drop unused
      enum conversion.
      (virDomainDiskAuthClear, virDomainDiskDefParseXML)
      (virDomainDiskDefFormat): Adjust clients.
      * src/qemu/qemu_command.c (qemuGetSecretString): Likewise.
      * src/qemu/qemu_conf.c (qemuTranslateDiskSourcePoolAuth):
      Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c05d9dca
    • E
      conf: move source pool type to util/ · b6edf2bf
      Eric Blake 提交于
      Another struct being moved to util.  This one doesn't have as
      much use yet, thankfully.
      
      * src/conf/domain_conf.h (virDomainDiskSourcePoolMode)
      (virDomainDiskSourcePoolDef): Move...
      * src/util/virstoragefile.h (virStorageSourcePoolMode)
      (virStorageSourcePoolDef): ...and rename.
      * src/conf/domain_conf.c (virDomainDiskSourcePoolDefFree)
      (virDomainDiskSourceDefClear, virDomainDiskSourcePoolDefParse)
      (virDomainDiskDefParseXML, virDomainDiskSourceDefParse)
      (virDomainDiskSourceDefFormatInternal)
      (virDomainDiskDefForeachPath, virDomainDiskSourceIsBlockType):
      Adjust clients.
      * src/qemu/qemu_conf.c (qemuTranslateDiskSourcePool): Likewise.
      * src/libvirt_private.syms (domain_conf.h): Move symbols...
      (virstoragefile.h): ...as appropriate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b6edf2bf
    • E
      conf: move network disk protocol type to util/ · 4220f76a
      Eric Blake 提交于
      Another enum moved to util/, this time the fallout from renaming
      is not quite as large.
      
      * src/conf/domain_conf.h (virDomainDiskProtocol): Move...
      * src/util/virstoragefile.h (virStorageNetProtocol): ...and
      rename.
      * src/conf/domain_conf.c: Update clients.
      * src/qemu/qemu_command.c: Likewise.
      * src/qemu/qemu_conf.c: Likewise.
      * src/qemu/qemu_driver.c: Likewise.
      * src/qemu/qemu_migration.c: Likewise.
      * src/storage/storage_backend.c: Likewise.
      * src/storage/storage_backend_gluster.c: Likewise.
      * src/libvirt_private.syms (domain_conf.h): Move symbols...
      (virstoragefile.h): ...as appropriate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      4220f76a
    • E
      conf: move host disk type to util/ · 16ac4c9d
      Eric Blake 提交于
      A continuation of the migration of disk details to virstoragefile.
      This patch moves a single enum, but converting the name has quite
      a bit of fallout.
      
      * src/conf/domain_conf.h (virDomainDiskType): Move...
      * src/util/virstoragefile.h (virStorageType): ...and rename.
      * src/bhyve/bhyve_command.c (bhyveBuildDiskArgStr)
      (virBhyveProcessBuildLoadCmd): Update clients.
      * src/conf/domain_conf.c (virDomainDiskSourceDefParse)
      (virDomainDiskDefParseXML, virDomainDiskSourceDefFormatInternal)
      (virDomainDiskDefFormat, virDomainDiskGetActualType)
      (virDomainDiskDefForeachPath, virDomainDiskSourceIsBlockType):
      Likewise.
      * src/conf/snapshot_conf.h (_virDomainSnapshotDiskDef): Likewise.
      * src/conf/snapshot_conf.c (virDomainSnapshotDiskDefParseXML)
      (virDomainSnapshotAlignDisks, virDomainSnapshotDiskDefFormat):
      Likewise.
      * src/esx/esx_driver.c (esxAutodetectSCSIControllerModel)
      (esxDomainDefineXML): Likewise.
      * src/locking/domain_lock.c (virDomainLockManagerAddDisk):
      Likewise.
      * src/lxc/lxc_controller.c
      (virLXCControllerSetupLoopDeviceDisk)
      (virLXCControllerSetupNBDDeviceDisk)
      (virLXCControllerSetupLoopDevices, virLXCControllerSetupDisk):
      Likewise.
      * src/parallels/parallels_driver.c (parallelsGetHddInfo):
      Likewise.
      * src/phyp/phyp_driver.c (phypDiskType): Likewise.
      * src/qemu/qemu_command.c (qemuGetDriveSourceString)
      (qemuDomainDiskGetSourceString, qemuBuildDriveStr)
      (qemuBuildCommandLine, qemuParseCommandLineDisk)
      (qemuParseCommandLine): Likewise.
      * src/qemu/qemu_conf.c (qemuCheckSharedDevice)
      (qemuTranslateDiskSourcePool)
      (qemuTranslateSnapshotDiskSourcePool): Likewise.
      * src/qemu/qemu_domain.c (qemuDomainDeviceDefPostParse)
      (qemuDomainDetermineDiskChain): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainGetBlockInfo)
      (qemuDomainSnapshotPrepareDiskExternalBackingInactive)
      (qemuDomainSnapshotPrepareDiskExternalBackingActive)
      (qemuDomainSnapshotPrepareDiskExternalOverlayActive)
      (qemuDomainSnapshotPrepareDiskExternalOverlayInactive)
      (qemuDomainSnapshotPrepareDiskInternal)
      (qemuDomainSnapshotPrepare)
      (qemuDomainSnapshotCreateSingleDiskActive): Likewise.
      * src/qemu/qemu_hotplug.c (qemuDomainChangeEjectableMedia):
      Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationIsSafe): Likewise.
      * src/security/security_apparmor.c
      (AppArmorRestoreSecurityImageLabel)
      (AppArmorSetSecurityImageLabel): Likewise.
      * src/security/security_dac.c (virSecurityDACSetSecurityImageLabel)
      (virSecurityDACRestoreSecurityImageLabelInt)
      (virSecurityDACSetSecurityAllLabel): Likewise.
      * src/security/security_selinux.c
      (virSecuritySELinuxRestoreSecurityImageLabelInt)
      (virSecuritySELinuxSetSecurityImageLabel)
      (virSecuritySELinuxSetSecurityAllLabel): Likewise.
      * src/storage/storage_backend.c (virStorageFileBackendForType):
      Likewise.
      * src/storage/storage_backend_fs.c (virStorageFileBackendFile)
      (virStorageFileBackendBlock): Likewise.
      * src/storage/storage_backend_gluster.c
      (virStorageFileBackendGluster): Likewise.
      * src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc, vboxAttachDrives)
      (vboxDomainAttachDeviceImpl, vboxDomainDetachDevice): Likewise.
      * src/vmware/vmware_conf.c (vmwareVmxPath): Likewise.
      * src/vmx/vmx.c (virVMXParseDisk, virVMXFormatDisk)
      (virVMXFormatFloppy): Likewise.
      * src/xenxs/xen_sxpr.c (xenParseSxprDisks, xenParseSxpr)
      (xenFormatSxprDisk): Likewise.
      * src/xenxs/xen_xm.c (xenParseXM, xenFormatXMDisk): Likewise.
      * tests/securityselinuxlabeltest.c (testSELinuxLoadDef):
      Likewise.
      * src/libvirt_private.syms (domain_conf.h): Move symbols...
      (virstoragefile.h): ...as appropriate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      16ac4c9d
    • E
      conf: split network host structs to util/ · 52fb5311
      Eric Blake 提交于
      Continuing the refactoring of host-side storage descriptions out
      of conf/domain_conf and into util/virstoragefile, this patch
      focuses on details about a host name/port/transport as used by
      a network storage volume.
      
      * src/conf/domain_conf.h (virDomainDiskProtocolTransport)
      (virDomainDiskHostDef, virDomainDiskHostDefClear)
      (virDomainDiskHostDefFree, virDomainDiskHostDefCopy): Move...
      * src/util/virstoragefile.h (virStorageNetHostTransport)
      (virStorageNetHostDef, virStorageNetHostDefClear)
      (virStorageNetHostDefFree, virStorageNetHostDefCopy): ...here,
      with better names.
      * src/util/virstoragefile.c (virStorageNetHostDefClear)
      (virStorageNetHostDefFree, virStorageNetHostDefCopy): Moved from...
      * src/conf/domain_conf.c (virDomainDiskHostDefClear)
      (virDomainDiskHostDefFree, virDomainDiskHostDefCopy): ...here.
      (virDomainDiskSourceDefClear, virDomainDiskSourceDefParse)
      (virDomainDiskSourceDefFormatInternal): Adjust callers.
      * src/conf/snapshot_conf.h (_virDomainSnapshotDiskDef): Likewise.
      * src/conf/snapshot_conf.c (virDomainSnapshotDiskDefClear):
      Likewise.
      * src/qemu/qemu_command.c (qemuAddRBDHost)
      (qemuParseDriveURIString, qemuParseNBDString)
      (qemuBuildNetworkDriveURI, qemuParseCommandLineDisk)
      (qemuParseCommandLine, qemuGetDriveSourceString): Likewise.
      * src/qemu/qemu_command.h: Likewise.
      * src/qemu/qemu_conf.c (qemuAddISCSIPoolSourceHost)
      (qemuTranslateDiskSourcePool): Likewise.
      * src/qemu/qemu_driver.c
      (qemuDomainSnapshotCreateSingleDiskActive)
      (qemuDomainSnapshotUndoSingleDiskActive): Likewise.
      * src/storage/storage_backend_gluster.c
      (virStorageFileBackendGlusterInit): Likewise.
      * src/storage/storage_driver.c (virStorageFileFree)
      (virStorageFileInitInternal): Likewise.
      * src/storage/storage_driver.h (_virStorageFile): Likewise.
      * src/libvirt_private.syms (domain_conf.h): Move symbols...
      (virstoragefile.h): ...as appropriate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      52fb5311
    • E
      conf: split security label structs to util/ · 3e929386
      Eric Blake 提交于
      In order to reuse the newly-created host-side disk struct in
      the virstoragefile backing chain code, I first have to move
      it to util/.  This starts the process, by first moving the
      security label structures.
      
      * src/conf/domain_conf.h (virDomainDefGenSecurityLabelDef)
      (virDomainDiskDefGenSecurityLabelDef, virSecurityLabelDefFree)
      (virSecurityDeviceLabelDefFree, virSecurityLabelDef)
      (virSecurityDeviceLabelDef): Move...
      * src/util/virseclabel.h: ...to new file.
      (virSecurityLabelDefNew, virSecurityDeviceLabelDefNew): Rename the
      GenSecurity functions.
      * src/qemu/qemu_process.c (qemuProcessAttach): Adjust callers.
      * src/security/security_manager.c (virSecurityManagerGenLabel):
      Likewise.
      * src/security/security_selinux.c
      (virSecuritySELinuxSetSecurityFileLabel): Likewise.
      * src/util/virseclabel.c: New file.
      * src/conf/domain_conf.c: Move security code, and fix fallout.
      * src/Makefile.am (UTIL_SOURCES): Build new file.
      * src/libvirt_private.syms (domain_conf.h): Move symbols...
      (virseclabel.h): ...to new section.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      3e929386
  2. 26 3月, 2014 1 次提交
    • J
      Treat zero cpu shares as a valid value · bdffab0d
      Ján Tomko 提交于
      Currently, <cputune><shares>0</shares></cputune> is treated
      as if it were not specified.
      
      Treat is as a valid value if it was explicitly specified
      and write it to the cgroups.
      bdffab0d
  3. 25 3月, 2014 4 次提交
    • J
      Indent top-level labels by one space in src/conf/ · df2013fa
      Ján Tomko 提交于
      df2013fa
    • E
      conf: prepare to track multiple host source files per <disk> · 4f202266
      Eric Blake 提交于
      It's finally time to start tracking disk backing chains in
      <domain> XML.  The first step is to start refactoring code
      so that we have an object more convenient for representing
      each host source resource in the context of a single guest
      <disk>.  Ultimately, I plan to move the new type into src/util
      where it can be reused by virStorageFile, but to make the
      transition easier to review, this patch just creates the
      new type then fixes everything until it compiles again.
      
      * src/conf/domain_conf.h (_virDomainDiskDef): Split...
      (_virDomainDiskSourceDef): ...to new struct.
      (virDomainDiskAuthClear): Use new type.
      * src/conf/domain_conf.c (virDomainDiskDefFree): Split...
      (virDomainDiskSourceDefClear): ...to new function.
      (virDomainDiskGetType, virDomainDiskSetType)
      (virDomainDiskGetSource, virDomainDiskSetSource)
      (virDomainDiskGetDriver, virDomainDiskSetDriver)
      (virDomainDiskGetFormat, virDomainDiskSetFormat)
      (virDomainDiskAuthClear, virDomainDiskGetActualType)
      (virDomainDiskDefParseXML, virDomainDiskSourceDefFormat)
      (virDomainDiskDefFormat, virDomainDiskDefForeachPath)
      (virDomainDiskDefGetSecurityLabelDef)
      (virDomainDiskSourceIsBlockType): Adjust all users.
      * src/lxc/lxc_controller.c (virLXCControllerSetupDisk):
      Likewise.
      * src/lxc/lxc_driver.c (lxcDomainAttachDeviceMknodHelper):
      Likewise.
      * src/qemu/qemu_command.c (qemuAddRBDHost, qemuParseRBDString)
      (qemuParseDriveURIString, qemuParseGlusterString)
      (qemuParseISCSIString, qemuParseNBDString)
      (qemuDomainDiskGetSourceString, qemuBuildDriveStr)
      (qemuBuildCommandLine, qemuParseCommandLineDisk)
      (qemuParseCommandLine): Likewise.
      * src/qemu/qemu_conf.c (qemuCheckSharedDevice)
      (qemuAddISCSIPoolSourceHost, qemuTranslateDiskSourcePool):
      Likewise.
      * src/qemu/qemu_driver.c (qemuDomainUpdateDeviceConfig)
      (qemuDomainPrepareDiskChainElement)
      (qemuDomainSnapshotCreateInactiveExternal)
      (qemuDomainSnapshotPrepareDiskExternalBackingInactive)
      (qemuDomainSnapshotPrepareDiskInternal)
      (qemuDomainSnapshotPrepare)
      (qemuDomainSnapshotCreateSingleDiskActive)
      (qemuDomainSnapshotUndoSingleDiskActive)
      (qemuDomainBlockPivot, qemuDomainBlockJobImpl)
      (qemuDomainBlockCopy, qemuDomainBlockCommit): Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationIsSafe): Likewise.
      * src/qemu/qemu_process.c (qemuProcessGetVolumeQcowPassphrase)
      (qemuProcessInitPasswords): Likewise.
      * src/security/security_selinux.c
      (virSecuritySELinuxSetSecurityFileLabel): Likewise.
      * src/storage/storage_driver.c (virStorageFileInitFromDiskDef):
      Likewise.
      * tests/securityselinuxlabeltest.c (testSELinuxLoadDef):
      Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      4f202266
    • E
      conf: use disk source accessors in conf/ · a9ab99ca
      Eric Blake 提交于
      Part of a series of cleanups to use new accessor methods.
      
      Several places in domain_conf.c still open-code raw field access,
      but that code will be touched later with the diskDef struct split
      so I'm avoiding churn here.
      
      * src/conf/domain_audit.c (virDomainAuditStart): Use accessors.
      * src/conf/domain_conf.c (virDomainDiskIndexByName)
      (virDomainDiskPathByName, virDomainDiskDefForeachPath)
      (virDomainDiskSourceIsBlockType): Likewise.
      * src/conf/snapshot_conf.c (virDomainSnapshotAlignDisks):
      Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a9ab99ca
    • E
      conf: accessors for common source information · 1014c34e
      Eric Blake 提交于
      A future patch will split virDomainDiskDef, in order to track
      multiple host resources per guest <disk>.  To reduce the size
      of that patch, I've factored out the four most common accesses
      into functions, so that I can incrementally upgrade the code
      base to use the accessors, and so that code that doesn't care
      about the distinction of per-file details won't have to be
      changed when the struct changes.
      
      * src/conf/domain_conf.h (virDomainDiskGetType)
      (virDomainDiskSetType, virDomainDiskGetSource)
      (virDomainDiskSetSource, virDomainDiskGetDriver)
      (virDomainDiskSetDriver, virDomainDiskGetFormat)
      (virDomainDiskSetFormat): New prototypes.
      * src/conf/domain_conf.c (virDomainDiskGetType)
      (virDomainDiskSetType, virDomainDiskGetSource)
      (virDomainDiskSetSource, virDomainDiskGetDriver)
      (virDomainDiskSetDriver, virDomainDiskGetFormat)
      (virDomainDiskSetFormat): Implement them.
      * src/libvirt_private.syms (domain_conf.h): Export them.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1014c34e
  4. 21 3月, 2014 4 次提交
  5. 18 3月, 2014 4 次提交
    • D
      Add virLogSource variables to all source files · 2835c1e7
      Daniel P. Berrange 提交于
      Any source file which calls the logging APIs now needs
      to have a VIR_LOG_INIT("source.name") declaration at
      the start of the file. This provides a static variable
      of the virLogSource type.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      2835c1e7
    • M
      Explicitly cast some switch parameters to enum · 2bc46827
      Martin Kletzander 提交于
      This patch is not trying to fix every switch, just the ones I worked
      with last time, because some of these were especially unreadable.
      Covers enums virDomainGraphicsType and virDomainChrType (where
      applicable).
      
      Also sort its cases by their value.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      2bc46827
    • M
      123a881d
    • N
      Fix memory leak in virDomainChrSourceDefClear() · 24b3fcf9
      Nehal J Wani 提交于
      While running qemuxml2xmltest, it was found that valgrind pointed out
      the following memory leak:
      
      ==21905== 26 bytes in 1 blocks are definitely lost in loss record 23 of 69
      ==21905==    at 0x4A069EE: malloc (vg_replace_malloc.c:270)
      ==21905==    by 0x3E782A754D: xmlStrndup (in /usr/lib64/libxml2.so.2.7.6)
      ==21905==    by 0x4CD986D: virDomainChrSourceDefParseXML (domain_conf.c:7233)
      ==21905==    by 0x4CE4199: virDomainChrDefParseXML (domain_conf.c:7512)
      ==21905==    by 0x4CFAF3F: virDomainDefParseXML (domain_conf.c:12303)
      ==21905==    by 0x4CFB46E: virDomainDefParseNode (domain_conf.c:13031)
      ==21905==    by 0x4CFB5E9: virDomainDefParse (domain_conf.c:12973)
      ==21905==    by 0x41E9D8: testCompareXMLToXMLFiles (qemuxml2xmltest.c:40)
      ==21905==    by 0x41EBAA: testCompareXMLToXMLHelper (qemuxml2xmltest.c:93)
      ==21905==    by 0x421D21: virtTestRun (testutils.c:199)
      ==21905==    by 0x41FCE9: mymain.part.0 (qemuxml2xmltest.c:244)
      ==21905==    by 0x42249D: virtTestMain (testutils.c:782)
      ==21905==
      ... and 7 more
      24b3fcf9
  6. 14 3月, 2014 1 次提交
    • L
      conf: eliminate hardcoded indent from domain xml · ca6dc7b5
      Laine Stump 提交于
      Many of the domain xml format functions (including all of the device
      format functions) had hard-coded spaces, which made for incorrect
      indentation when those functions were called in a different context
      (for example, commit 2122cf39 added <interface> XML into the document
      provided to a network hook script, and in this case it should have
      been indented by 2 spaces, but was instead indented by 6 spaces).
      
      To make it possible to insert a properly indented device anywhere into
      an XML document, this patch removes hardcoded spaces from the
      formatting functions, and calls virBufferAdjustIndent() at appropriate
      places instead. (a regex search of domain_conf.c was done to assure
      that all occurrences of hardcoded spaces were removed).
      
      virDomainDiskSourceDefFormatInternal() is also called from
      snapshot_conf.c, so two virBufferAdjustIndent() calls were temporarily
      added around that call - those functions will have hardcoded spaces
      removed in a separate patch.
      
      This could cause some conflicts when backporting future changes to the
      formatting functions to older branches, but fortunately the changes
      are almost all trivial, so conflict resolution will be obvious.
      ca6dc7b5
  7. 13 3月, 2014 2 次提交
  8. 10 3月, 2014 1 次提交
    • M
      conf: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT · 2133441a
      Michal Privoznik 提交于
      This fixes a possible double free. In virNetworkAssignDef() if
      virBitmapNew() fails, then virNetworkObjFree(network) is called.
      However, with network->def pointing to actual @def. So if caller
      frees @def again, ...
      
      Moreover, this fixes one possible memory leak too. In
      virInterfaceAssignDef() if appending to the list of interfaces
      fails, we ought to call virInterfaceObjFree() instead of bare
      VIR_FREE().
      
      Although, in order to do that some array size variables needs
      to be turned into size_t rather than int.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      2133441a
  9. 25 2月, 2014 5 次提交
    • L
      conf: output actual netdev status in <interface> XML · 7d5bf484
      Laine Stump 提交于
      Until now, the "live" XML status of an <interface type='network'>
      device would always show the network information, rather than the
      exact hardware device that was used. It would also show the name of
      any portgroup the interface belonged to, rather than providing the
      configuration that was derived from that portgroup. As an example,
      given the following network definition:
      
      [A]
        <network>
          <name>testnet</name>
          <forward type='bridge' dev='p4p1_0'>
            <interface dev='p4p1_0'/>
            <interface dev='p4p1_1'/>
            <interface dev='p4p1_2'/>
            <interface dev='p4p1_3'/>
          </forward>
          <portgroup name='admin'>
            <bandwidth>
                <inbound average='1000' peak='5000' burst='1024'/>
                <outbound average='128' peak='256' burst='256'/>
            </bandwidth>
          </portgroup>
        </network>
      
      and the following domain <interface>:
      
      [B]
        <interface type='network'>
          <source network='testnet' portgroup='admin'/>
        </interface>
      
      the output of "virsh dumpxml $domain" while the domain was running
      would yield something like this:
      
      [C]
        <interface type='network'>
          <source network='testnet' portgroup='admin'/>
          <target dev='macvtap0'/>
          <alias name='net0'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
        </interface>
      
      In order to learn the exact bandwidth information of the interface, a
      management application would need to retrieve the XML for testnet,
      then search for the portgroup named "admin". Even worse, there was no
      simple and standard way to learn which host physdev the macvtap0
      device is attached to.
      
      Internally, libvirt has always kept this information in the
      virDomainDef that is held in memory, as well as storing it in the
      (libvirt-internal-only) domain status XML (in
      /var/run/libvirt/qemu/$domain.xml). In order to not confuse the runtime
      "actual state" with the config of the device, it's internally stored
      like this:
      
      [D]
        <interface type='network'>
          <source network='testnet' portgroup='admin'/>
          <actual type='direct'>
            <source dev='p4p1_0' mode='bridge'/>
            <bandwidth>
                <inbound average='1000' peak='5000' burst='1024'/>
                <outbound average='128' peak='256' burst='256'/>
            </bandwidth>
          </actual>
          <target dev='macvtap0'/>
          <alias name='net0'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
        </interface>
      
      This was never exposed outside of libvirt though, because I thought it
      would be too awkward for a management application to need to look in
      two places for the same information, but I also wasn't sure that it
      would be okay to overwrite the config info (in this case "<source
      network='testnet' portgroup='admin'/>") with the actual runtime info
      (everything inside <actual> above).
      
      Now we have a need for this information to be made available to
      management applications (in particular, so that a network "plugged"
      hook will have full information about the device that is being plugged
      in), so it's time to take the leap and decide that it is acceptable
      for the config info to be replaced with actual runtime state (but
      *only* when reporting domain live status, *not* when saving state in
      /var/run/libvirt/qemu/$domain.xml - that remains the same so that
      there is no loss of information). That is what this patch does - once
      applied, the output of "virsh dumpxml $domain" when the domain is
      running will contain something like this:
      
      [E]
        <interface type='direct'>
          <source dev='p4p1_0' mode='bridge'/>
          <bandwidth>
              <inbound average='1000' peak='5000' burst='1024'/>
              <outbound average='128' peak='256' burst='256'/>
          </bandwidth>
          <target dev='macvtap0'/>
          <alias name='net0'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
        </interface>
      
      In effect, everything that is internally stored within <actual> is
      moved up a level to where a management application will expect
      it. This means that the management application will only look in a
      single place to learn - the type of interface in use, the name of the
      physdev (if relevant), the <bandwidth>, <vlan>, and <virtualport>
      settings in use.
      
      The potential downside is that a management app looking at this output
      will not see that the physdev 'p4p1_0' was actually allocated from the
      network named 'testnet', or that the bandwidth numbers were taken from
      the portgroup 'admin'. However, if they are interested in that info,
      they can always get the "inactive" XML for the domain.
      
      An example of where this could cause problems is in virt-manager's
      network device display, which shows the status of the device, but
      allows you to edit that status info and save it as the new
      config. Previously virt-manager would always display the information
      in example [C] above, and allow editing that. With this patch, it will
      instead display what is in [E] and allow editing it directly, which
      could lead to some confusion. I would suggest that virt-manager have
      an "edit" button which would change the display from the "live" xml to
      the "inactive" xml, so that editing would be done on that; such a
      change would both handle the new situation, and also be compatible
      with older releases.
      7d5bf484
    • L
      conf: new function virDomainActualNetDefContentsFormat · 9da98aa5
      Laine Stump 提交于
      This function is currently only called from one place, but in a
      subsequent patch will be called from a 2nd place.
      
      The new function exactly replicates the original behavior of the part
      of virDomainActualNetDefFormat() that it replaces, but takes a
      virDomainNetDefPtr instead of virDomainActualNetDefPtr, and uses the
      virDomainNetGetActual*() functions whenever possible, rather than
      reaching into def->data.network.actual - this is to be sure that we
      are reporting exactly what is being used internally, just in case
      there are any discrepancies (there shouldn't be).
      9da98aa5
    • L
      conf: re-situate <bandwidth> element in <interface> · 65487c0f
      Laine Stump 提交于
      This moves the call to virNetDevBandwidthFormat() in
      virDomainNetDefFormat() to be called right after the call to
      virNetDevVPortProfileFormat(), so that a single chunk of that function
      can be placed inside an if that conditionally calls
      virDomainActualNetDefContentsFormat() instead (next patch). The
      re-ordering necessitates modifying a couple of test data files.
      65487c0f
    • L
      conf: make virDomainNetDefFormat a public function · 7c39214c
      Laine Stump 提交于
      We will need to call virDomainNetDefFormat() from the network hook (in
      the network driver).
      7c39214c
    • L
      conf: clarify what is returned for actual bandwidth and vlan · 6d4ffae4
      Laine Stump 提交于
      In practice, if a virDomainNetDef has a virDomainActualNetDef
      allocated, the ActualNetDef will *always* contain the bandwidth and
      vlan data from the NetDef (unless there was also a portgroup involved
      - see networkAllocateActualDevice()).
      
      However, virDomainNetGetActual(Bandwidth|Vlan)() were coded to make it
      appear as if it might be possible to have a valid bandwidth/vlan in
      the NetDef, but a NULL in the ActualNetDef. Believing this un-truth
      could lead to writing unnecessarily defensive code when dealing with
      the virDomainGetActual*() functions, so this patch makes it more
      obvious:
      
         If there is an ActualNetDef, it will always have a copy of the
         various appropriate bits from its parent NetDef, and the
         virDomainGetActual* function will *always* return the data from the
         ActualNetDef, not from the NetDef.
      
      The reason for this effective-NOP patch is that a subsequent patch to
      change virDomainNetDefFormat will rely on the above rule.
      6d4ffae4
  10. 20 2月, 2014 1 次提交
  11. 19 2月, 2014 4 次提交
  12. 17 2月, 2014 2 次提交
  13. 14 2月, 2014 1 次提交
  14. 11 2月, 2014 1 次提交
  15. 10 2月, 2014 3 次提交
    • P
      qemu: hyperv: Add support for timer enlightenments · 600bca59
      Peter Krempa 提交于
      Add a new <timer> for the HyperV reference time counter enlightenment
      and the iTSC reference page for Windows guests.
      
      This feature provides a paravirtual approach to track timer events for
      the guest (similar to kvmclock) with the option to use real hardware
      clock on systems with a iTSC with compensation across various hosts.
      600bca59
    • P
      conf: Enforce supported options for certain timers · 8ffaa42d
      Peter Krempa 提交于
      According to the documentation various timer options are only supported
      by certain timer types. Add a post parse check to verify that the user
      didn't specify invalid options.
      
      Also fix the qemu command line parsing function to set correct default
      values for the kvmclock timer so that it passes the new check.
      8ffaa42d
    • P
      schema: Fix guest timer specification schema according to the docs · bbd392ff
      Peter Krempa 提交于
      According to the documentation describing various tunables for domain
      timers not all the fields are supported by all the driver types. Express
      these in the RNG:
      
      - rtc, platform: Only these support the "track" attribute.
      - tsc: only one to support "frequency" and "mode" attributes
      - hpet, pit: tickpolicy/catchup attribute/element
      - kvmclock: no extra attributes are supported
      
      Additionally the attributes of the <catchup> element for
      tickpolicy='catchup' are optional according to the parsing code. Express
      this in the XML and fix a spurious space added while formatting the
      <catchup> element and add tests for it.
      bbd392ff