1. 30 7月, 2014 2 次提交
    • E
      blockcommit: track job type in xml · 232a31be
      Eric Blake 提交于
      A future patch is going to wire up qemu active block commit jobs;
      but as they have similar events and are canceled/pivoted in the
      same way as block copy jobs, it is easiest to track all bookkeeping
      for the commit job by reusing the <mirror> element.  This patch
      adds domain XML to track which job was responsible for creating a
      mirroring situation, and adds a job='copy' attribute to all
      existing uses of <mirror>.  Along the way, it also massages the
      qemu monitor backend to read the new field in order to generate
      the correct type of libvirt job (even though it requires a
      future patch to actually cause a qemu event that can be reported
      as an active commit).  It also prepares to update persistent XML
      to match changes made to live XML when a copy completes.
      
      * docs/schemas/domaincommon.rng: Enhance schema.
      * docs/formatdomain.html.in: Document it.
      * src/conf/domain_conf.h (_virDomainDiskDef): Add a field.
      * src/conf/domain_conf.c (virDomainBlockJobType): String conversion.
      (virDomainDiskDefParseXML): Parse job type.
      (virDomainDiskDefFormat): Output job type.
      * src/qemu/qemu_process.c (qemuProcessHandleBlockJob): Distinguish
      active from regular commit.
      * src/qemu/qemu_driver.c (qemuDomainBlockCopy): Set job type.
      (qemuDomainBlockPivot, qemuDomainBlockJobImpl): Clean up job type
      on completion.
      * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml:
      Update tests.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: Likewise.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-active-commit.xml: New
      file.
      * tests/qemuxml2xmltest.c (mymain): Drive new test.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      232a31be
    • E
      blockcopy: add more XML for state tracking · 9a212d67
      Eric Blake 提交于
      Doing a blockcopy operation across a libvirtd restart is not very
      robust at the moment.  In particular, we are clearing the <mirror>
      element prior to telling qemu to finish the job.  Also, thanks to the
      ability to request async completion, the user can easily regain
      control prior to qemu actually finishing the effort, and they should
      be able to poll the domain XML to see if the job is still going.
      
      A future patch will fix things to actually wait until qemu is done
      before modifying the XML to reflect the job completion.  But since
      qemu issues identical BLOCK_JOB_COMPLETE events regardless of whether
      the job was cancelled (kept the original disk) or completed (pivoted
      to the new disk), we have to track which of the two operations were
      used to end the job.  Furthermore, we'd like to avoid attempts to
      end a job where we are already waiting on an earlier request to qemu
      to end the job.  Likewise, if we miss the qemu event (perhaps because
      it arrived during a libvirtd restart), we still need enough state
      recorded to be able to determine how to modify the domain XML once
      we reconnect to qemu and manually learn whether the job still exists.
      
      Although this patch doesn't actually fix the problem, it is a
      preliminary step that makes it possible to track whether a job
      has already begun steps towards completion.
      
      * src/conf/domain_conf.h (virDomainDiskMirrorState): New enum.
      (_virDomainDiskDef): Convert bool mirroring to new enum.
      * src/conf/domain_conf.c (virDomainDiskDefParseXML)
      (virDomainDiskDefFormat): Handle new values.
      * src/qemu/qemu_process.c (qemuProcessHandleBlockJob): Adjust
      client.
      * src/qemu/qemu_driver.c (qemuDomainBlockPivot)
      (qemuDomainBlockJobImpl): Likewise.
      * docs/schemas/domaincommon.rng (diskMirror): Expose new values.
      * docs/formatdomain.html.in (elementsDisks): Document it.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: Test it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      9a212d67
  2. 29 7月, 2014 2 次提交
  3. 23 7月, 2014 1 次提交
    • C
      lxc: allow to keep or drop capabilities · 47e5b5ae
      Cédric Bosdonnat 提交于
      Added <capabilities> in the <features> section of LXC domains
      configuration. This section can contain elements named after the
      capabilities like:
      
        <mknod state="on"/>, keep CAP_MKNOD capability
        <sys_chroot state="off"/> drop CAP_SYS_CHROOT capability
      
      Users can restrict or give more capabilities than the default using
      this mechanism.
      47e5b5ae
  4. 18 7月, 2014 1 次提交
  5. 17 7月, 2014 5 次提交
  6. 02 7月, 2014 1 次提交
  7. 17 6月, 2014 1 次提交
    • E
      blockjob: don't remove older-style mirror XML · b50e1049
      Eric Blake 提交于
      Commit 7c6fc394 introduced a regression in the XML produced for older
      clients.  The argument at the time was that clients shouldn't be
      depending on output-only data for something that is only going to
      be triggered for a transient guest; but John Ferlan reported that
      the automated testsuite was such a client.  It's better to be safe
      than sorry by guaranteeing back-compat cruft.  Note that later
      patches will be using <mirror> for active block commit, but there
      we don't have to worry about back-compat.
      
      * src/conf/domain_conf.c (virDomainDiskDefFormat): Restore old
      style output when necessary.
      * docs/schemas/domaincommon.rng: Validate back-compat style.
      * docs/formatdomain.html.in: Update the documentation.
      * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml:
      Update tests.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b50e1049
  8. 07 6月, 2014 1 次提交
    • E
      conf: alter disk mirror xml output · 7c6fc394
      Eric Blake 提交于
      Now that we track a disk mirror as a virStorageSource, we might
      as well update the XML to theoretically allow any type of
      mirroring destination (not just a local file).  A later patch
      will also be reusing <mirror> to track the block commit of the
      top layer of a chain, which is another case where libvirt needs
      to update the backing chain after the job is finally pivoted,
      and since backing chains can have network backing files as the
      destination to commit into, it makes more sense to display that
      in the XML.
      
      This patch changes output-only XML; it was already documented
      that <mirror> does not affect a domain definition at this point
      (because qemu doesn't provide persistent bitmaps yet).  Any
      application that was starting a block copy job with older libvirt
      and then relying on the domain XML to determine if it was
      complete will no longer be able to access the file= and format=
      attributes of mirror that were previously used.  However, this is
      not going to be a problem in practice: the only time a block copy
      job works is on a transient domain, and any app that is managing
      a transient domain probably already does enough of its own
      bookkeeping to know which file it is mirroring into without
      having to re-read it from the libvirt XML.  The one thing that
      was likely to be used in a mirroring job was the ready=
      attribute, which is unchanged.  Meanwhile, I made sure the schema
      and parser still accept the old format, even if we no longer
      output it, so that upgrading from an older version of libvirt is
      seamless.
      
      * docs/schemas/domaincommon.rng (diskMirror): Alter definition.
      * src/conf/domain_conf.c (virDomainDiskDefParseXML): Parse two
      styles of mirror elements.
      (virDomainDiskDefFormat): Output new style.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror-old.xml: New
      file, copied from...
      * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: ...here
      before modernizing.
      * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old*: New
      files.
      * tests/qemuxml2xmltest.c (mymain): Test both styles.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7c6fc394
  9. 27 5月, 2014 1 次提交
  10. 24 4月, 2014 1 次提交
    • J
      conf: Output disk backing store details in domain XML · a2e369bc
      Jiri Denemark 提交于
      The XML for quite a longish backing chain is shown below:
      
        <disk type='network' device='disk'>
          <driver name='qemu' type='qcow2'/>
          <source protocol='nbd' name='bar'>
            <host transport='unix' socket='/var/run/nbdsock'/>
          </source>
          <backingStore type='block' index='1'>
            <format type='qcow2'/>
            <source dev='/dev/HostVG/QEMUGuest1'/>
            <backingStore type='file' index='2'>
              <format type='qcow2'/>
              <source file='/tmp/image2.qcow'/>
              <backingStore type='file' index='3'>
                <format type='qcow2'/>
                <source file='/tmp/image3.qcow'/>
                <backingStore type='file' index='4'>
                  <format type='qcow2'/>
                  <source file='/tmp/image4.qcow'/>
                  <backingStore type='file' index='5'>
                    <format type='qcow2'/>
                    <source file='/tmp/image5.qcow'/>
                    <backingStore type='file' index='6'>
                      <format type='raw'/>
                      <source file='/tmp/Fedora-17-x86_64-Live-KDE.iso'/>
                      <backingStore/>
                    </backingStore>
                  </backingStore>
                </backingStore>
              </backingStore>
            </backingStore>
          </backingStore>
          <target dev='vdb' bus='virtio'/>
        </disk>
      
      Various disk types and formats can be mixed in one chain. The
      <backingStore/> empty element marks the end of the backing chain and it
      is there mostly for future support of parsing the chain provided by a
      user. If it's missing, we are supposed to probe for the rest of the
      chain ourselves, otherwise complete chain was provided by the user. The
      index attributes of backingStore elements can be used to unambiguously
      identify a specific part of the image chain.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      a2e369bc
  11. 16 4月, 2014 3 次提交
    • E
      conf: fix omission of <driver> in domain dumpxml · 8fb44675
      Eric Blake 提交于
      I noticed that depending on the <driver> attributes the user passed
      in, the output may omit the <driver> element altogether.  For example,
      the rerror_policy has had this problem since commit 4bb4109f in Oct
      2011.  But in adding testsuite coverage to expose it, I found another
      problem: the C code is just fine without a driver name, but the
      XML validator required either a name or a cache mode.
      
      * src/conf/domain_conf.c (virDomainDiskDefFormat): Update
      conditional.
      * docs/schemas/domaincommon.rng (diskDriver): Simplify.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-drive-copy-on-read.xml:
      * tests/qemuxml2argvdata/qemuxml2argv-disk-drive-copy-on-read.args:
      New files.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-drive-discard.xml:
      Enhance test.
      * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-discard.xml:
      Likewise.
      * tests/qemuxml2argvtest.c (mymain): New test.
      * tests/qemuxml2xmltest.c (mymain): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      8fb44675
    • E
      conf: split <disk> schema into more pieces · fec1a939
      Eric Blake 提交于
      To make <disk> schema more maintainable and to allow for moving the
      pieces to a common file in the future. It relies on the ability to
      override definitions as part of an include, set up in the previous
      patch.
      
      The diff is a bit hard to read, because it mixes reindentation
      with refactoring; 'git diff -b --patience' may help.
      
      * docs/schemas/domaincommon.rng (disk): Refactor into pieces.
      (diskSource, diskSourceFile, diskSourceBlock, diskSourceDir)
      (diskSourceVolume: New defines.
      (diskSourceNetwork): Revise scope.
      * docs/schemas/domainsnapshot.rng (disksnapshot): Adjust.
      * tests/domainsnapshotxml2xmlin/disk-seclabel-invalid.xml,
      tests/domainsnapshotxml2xmlin/disk-network-seclabel-invalid.xml: New
      tests to check seclabel is forbidden in domain snapshot by schema.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      fec1a939
    • E
      conf: set up for per-grammar overrides in schemas · 369cdfa8
      Eric Blake 提交于
      This patch is my first experience playing with nested grammars,
      as documented in http://relaxng.org/tutorial-20011203.html#IDA3PZR.
      I plan on doing more overrides in order to make the RelaxNG
      grammar mirror the C code refactoring into a common
      virStorageSource, but where different clients of that source do
      not support the same subset of functionality.  By starting with
      something fairly easy to validate, I can make sure my later
      patches will be possible.
      
      This patch adds a use of the no-op <ref
      name='sourceStartupPolicy'/> to the disksnapshot definition, so
      that the snapshot version of a type='file' <source> more closely
      resembles the version in domaincommon.  A future patch will merge
      the two files into using a common define, but this patch is
      sufficient for testing that adding <source
      startupPolicy='optional'/> in any of the
      tests/domainsnapshotxml2xmlin/*.xml files still gets rejected
      unless it occurs within the <domain> subelement, because the
      definition of startupPolicy is empty outside of domain.rng.
      
      * docs/schemas/storagecommon.rng (storageStartupPolicy)
      (storageSourceExtra): Create no-op defaults.
      * docs/schemas/domainsnapshot.rng (domain): Use nested grammar
      to avoid restricting <domain>.
      (storageSourceExtra): Create new override.
      (disksnapshot): Access overrides through common names.
      * docs/schemas/domaincommon.rng (disk): Access overrides through
      common names.
      * docs/schemas/domain.rng (storageStartupPolicy)
      (storageSourceExtra): Create new overrides.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      369cdfa8
  12. 15 4月, 2014 2 次提交
    • E
      conf: move storage formats to common RNG file · 4f596a07
      Eric Blake 提交于
      We had incomplete RelaxNG support for storage formats listed
      in virstoragefile.h: commit 027bf2ea added 'vdi' but forgot
      to update the <volume> and <domain> xml lists; the <volume>
      list was also missing 'fat' and 'vhd'.  Maintaining two lists
      is a recipe for them getting out of sync, so make the list
      common so that both contexts benefit the next time we add a
      format in a single location.
      
      * docs/schemas/domaincommon.rng (storageFormat): Move...
      * docs/schemas/storagecommon.rng: ...here, and add vdi.
      * docs/schemas/storagevol.rng (formatfile): Use common list.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      4f596a07
    • E
      conf: better <disk> interleaving in schema · a9efe2d7
      Eric Blake 提交于
      In general, we try to make virt-xml-validate tolerant of input
      elements in any order when possible.  However, as written, the
      RNG grammar did not permit <source> unless there was an explicit
      type= attribute (even though the C code manages just fine by
      defaulting to type='file').  After making the attribute optional
      on the 'file' branch, I noticed that the use of diskspec was now
      redundant with the branch when no <source> was supplied.
      
      View this patch with 'git diff -b' for a better picture of the
      schema change.
      
      * docs/schemas/domaincommon.rng (disk): Hoist 'diskspec' out of
      choice, make type='file' default, and still preserve interleave.
      * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-source-pool.xml:
      * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-discard.xml:
      New files.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-source-pool.xml:
      * tests/qemuxml2argvdata/qemuxml2argv-disk-drive-discard.xml:
      Reorder XML.
      * tests/qemuxml2xmltest.c (mymain): Cover new files.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a9efe2d7
  13. 14 4月, 2014 1 次提交
    • E
      conf: create common storage RNG grammar file · 110c0db8
      Eric Blake 提交于
      Having two tiny files with a couple definitions didn't make
      as much sense as one common file, especially since I plan to
      add more definitions and use it in more places.
      
      * docs/schemas/storageencryption.rng: Merge this...
      * docs/schemas/storagefilefeatures.rng: ...and this, into...
      * docs/schemas/storagecommon.rng: ...this new file.
      * docs/schemas/Makefile.am (schema_DATA): Reflect renames.
      * docs/schemas/storagevol.rng: Likewise.
      * docs/schemas/domaincommon.rng: Likewise.
      * libvirt.spec.in: Likewise.
      * mingw-libvirt.spec.in: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      110c0db8
  14. 13 3月, 2014 1 次提交
  15. 19 2月, 2014 1 次提交
  16. 11 2月, 2014 1 次提交
  17. 10 2月, 2014 2 次提交
    • 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
      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
  18. 21 1月, 2014 1 次提交
    • F
      spice: expose the QEMU disable file transfer option · 08d07e5f
      Francesco Romani 提交于
      spice-server offers an API to disable file transfer messages
      on the agent channel between the client and the guest.
      This is supported in qemu through the disable-agent-file-xfer option.
      
      This patch exposes this option to libvirt.
      Adds a new element 'filetransfer', with one property,
      'enable', which accepts a boolean.
      Default is enabled, for backward compatibility.
      
      Depends on the capability exported in the first patch of the series.
      Signed-off-by: NFrancesco Romani <fromani@redhat.com>
      08d07e5f
  19. 20 1月, 2014 1 次提交
  20. 11 1月, 2014 1 次提交
    • E
      schema: fix idmap validation · dd0dda2e
      Eric Blake 提交于
      When idmap was added to LXC, we forgot to cover it in the testsuite.
      The schema was missing an <element> layer, and as a result,
      virt-xml-validate was failing on valid dumpxml output.
      
      Reported by Eduard - Gabriel Munteanu on IRC.
      
      * docs/schemas/domaincommon.rng (idmap): Include <idmap> element,
      and support interleaves.
      * tests/lxcxml2xmldata/lxc-idmap.xml: New file.
      * tests/lxcxml2xmltest.c (mymain): Test it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      dd0dda2e
  21. 07 1月, 2014 1 次提交
  22. 13 12月, 2013 2 次提交
  23. 06 12月, 2013 1 次提交
  24. 08 11月, 2013 2 次提交
  25. 15 10月, 2013 1 次提交
  26. 09 10月, 2013 1 次提交
    • J
      LXC: Fix handling of RAM filesystem size units · 3f029fb5
      Ján Tomko 提交于
      Since 76b644c3 when the support for RAM filesystems was introduced,
      libvirt accepted the following XML:
      <source usage='1024' unit='KiB'/>
      
      This was parsed correctly and internally stored in bytes, but it
      was formatted as (with an extra 's'):
      <source usage='1024' units='KiB'/>
      When read again, this was treated as if the units were missing,
      meaning libvirt was unable to parse its own XML correctly.
      
      The usage attribute was documented as being in KiB, but it was not
      scaled if the unit was missing. Transient domains still worked,
      because this was balanced by an extra 'k' in the mount options.
      
      This patch:
      Changes the parser to use 'units' instead of 'unit', as the latter
      was never documented (fixing persistent domains) and some programs
      (libvirt-glib, libvirt-sandbox) already parse the 'units' attribute.
      
      Removes the extra 'k' from the tmpfs mount options, which is needed
      because now we parse our own XML correctly.
      
      Changes the default input unit to KiB to match documentation, fixing:
      https://bugzilla.redhat.com/show_bug.cgi?id=1015689
      3f029fb5
  27. 25 9月, 2013 1 次提交
  28. 18 9月, 2013 1 次提交
    • D
      Allow <source> for type=block to have no dev · 4b5652d0
      Doug Goldstein 提交于
      Currently the XML parser already allows the following syntax:
        <disk type='block' device='cdrom'>
          <source startupPolicy='optional'/>
          <target dev='hda' bus='ide'/>
          <address type='drive' controller='0' bus='0' target='0' unit='0'/>
        </disk>
      
      But it if the dev value is NULL then it would not have the leading
      "<source ", resulting in invalid XML.
      4b5652d0