1. 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
  2. 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
  3. 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
  4. 13 3月, 2014 1 次提交
  5. 19 2月, 2014 1 次提交
  6. 11 2月, 2014 1 次提交
  7. 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
  8. 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
  9. 20 1月, 2014 1 次提交
  10. 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
  11. 07 1月, 2014 1 次提交
  12. 13 12月, 2013 2 次提交
  13. 06 12月, 2013 1 次提交
  14. 08 11月, 2013 2 次提交
  15. 15 10月, 2013 1 次提交
  16. 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
  17. 25 9月, 2013 1 次提交
  18. 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
  19. 17 9月, 2013 3 次提交
  20. 03 9月, 2013 2 次提交
  21. 02 9月, 2013 1 次提交
    • F
      qemu: Support setting the 'removable' flag for USB disks · feba2feb
      Fred A. Kemp 提交于
      Add an attribute named 'removable' to the 'target' element of disks,
      which controls the removable flag. For instance, on a Linux guest it
      controls the value of /sys/block/$dev/removable. This option is only
      valid for USB disks (i.e. bus='usb'), and its default value is 'off',
      which is the same behaviour as before.
      
      To achieve this, 'removable=on' (or 'off') is appended to the '-device
      usb-storage' parameter sent to qemu when adding a USB disk via
      '-disk'. A capability flag QEMU_CAPS_USB_STORAGE_REMOVABLE was added
      to keep track if this option is supported by the qemu version used.
      
      Bug: https://bugzilla.redhat.com/show_bug.cgi?id=922495Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
      feba2feb
  22. 27 8月, 2013 3 次提交
    • J
      Add pcihole64 element to root PCI controllers · 01cda918
      Ján Tomko 提交于
      <controller type='pci' index='0' model='pci-root'>
        <pcihole64 unit='KiB'>1048576</pcihole64>
      </controller>
      
      It can be used to adjust (or disable) the size of the 64-bit
      PCI hole. The size attribute is in kilobytes (different unit
      can be specified on input), but it gets rounded up to
      the nearest GB by QEMU.
      
      Disabling it will be needed for guests that crash with the
      64-bit PCI hole (like Windows XP), see:
      https://bugzilla.redhat.com/show_bug.cgi?id=990418
      01cda918
    • A
      Add ftp protocol support for cdrom disk · 796513d7
      Aline Manera 提交于
      The ftp protocol is already recognized by qemu/KVM so add this support to
      libvirt as well.
      The xml should be as following:
      
           <disk type='network' device='cdrom'>
             <source protocol='ftp' name='/url/path'>
               <host name='host.name' port='21'/>
             </source>
           </disk>
      Signed-off-by: NAline Manera <alinefm@br.ibm.com>
      796513d7
    • A
      Add http protocol support for cdrom disk · 3485ce4e
      Aline Manera 提交于
      QEMU/KVM already allows a HTTP URL for the cdrom ISO image so add this support
      to libvirt as well.
      The xml should be as following:
      
          <disk type='network' device='cdrom'>
            <source protocol='http' name='/url/path'>
              <host name='host.name' port='80'/>
            </source>
          </disk>
      Signed-off-by: NAline Manera <alinefm@br.ibm.com>
      3485ce4e
  23. 26 8月, 2013 1 次提交
  24. 21 8月, 2013 1 次提交
    • E
      selinux: distinguish failure to label from request to avoid label · 0f082e69
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=924153
      
      Commit 904e05a2 (v0.9.9) added a per-<disk> seclabel element with
      an attribute relabel='no' in order to try and minimize the
      impact of shutdown delays when an NFS server disappears.  The idea
      was that if a disk is on NFS and can't be labeled in the first
      place, there is no need to attempt the (no-op) relabel on domain
      shutdown.  Unfortunately, the way this was implemented was by
      modifying the domain XML so that the optimization would survive
      libvirtd restart, but in a way that is indistinguishable from an
      explicit user setting.  Furthermore, once the setting is turned
      on, libvirt avoids attempts at labeling, even for operations like
      snapshot or blockcopy where the chain is being extended or pivoted
      onto non-NFS, where SELinux labeling is once again possible.  As
      a result, it was impossible to do a blockcopy to pivot from an
      NFS image file onto a local file.
      
      The solution is to separate the semantics of a chain that must
      not be labeled (which the user can set even on persistent domains)
      vs. the optimization of not attempting a relabel on cleanup (a
      live-only annotation), and using only the user's explicit notation
      rather than the optimization as the decision on whether to skip
      a label attempt in the first place.  When upgrading an older
      libvirtd to a newer, an NFS volume will still attempt the relabel;
      but as the avoidance of a relabel was only an optimization, this
      shouldn't cause any problems.
      
      In the ideal future, libvirt will eventually have XML describing
      EVERY file in the backing chain, with each file having a separate
      <seclabel> element.  At that point, libvirt will be able to track
      more closely which files need a relabel attempt at shutdown.  But
      until we reach that point, the single <seclabel> for the entire
      <disk> chain is treated as a hint - when a chain has only one
      file, then we know it is accurate; but if the chain has more than
      one file, we have to attempt relabel in spite of the attribute,
      in case part of the chain is local and SELinux mattered for that
      portion of the chain.
      
      * src/conf/domain_conf.h (_virSecurityDeviceLabelDef): Add new
      member.
      * src/conf/domain_conf.c (virSecurityDeviceLabelDefParseXML):
      Parse it, for live images only.
      (virSecurityDeviceLabelDefFormat): Output it.
      (virDomainDiskDefParseXML, virDomainChrSourceDefParseXML)
      (virDomainDiskSourceDefFormat, virDomainChrDefFormat)
      (virDomainDiskDefFormat): Pass flags on through.
      * src/security/security_selinux.c
      (virSecuritySELinuxRestoreSecurityImageLabelInt): Honor labelskip
      when possible.
      (virSecuritySELinuxSetSecurityFileLabel): Set labelskip, not
      norelabel, if labeling fails.
      (virSecuritySELinuxSetFileconHelper): Fix indentation.
      * docs/formatdomain.html.in (seclabel): Document new xml.
      * docs/schemas/domaincommon.rng (devSeclabel): Allow it in RNG.
      * tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.xml:
      * tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.args:
      * tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-*-labelskip.xml:
      New test files.
      * tests/qemuxml2argvtest.c (mymain): Run the new tests.
      * tests/qemuxml2xmltest.c (mymain): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      0f082e69
  25. 07 8月, 2013 1 次提交
  26. 06 8月, 2013 2 次提交
    • L
      qemu: add dmi-to-pci-bridge controller · 62ac6b43
      Laine Stump 提交于
      This PCI controller, named "dmi-to-pci-bridge" in the libvirt config,
      and implemented with qemu's "i82801b11-bridge" device, connects to a
      PCI Express slot (e.g. one of the slots provided by the pcie-root
      controller, aka "pcie.0" on the qemu commandline), and provides 31
      *non-hot-pluggable* PCI (*not* PCIe) slots, numbered 1-31.
      
      Any time a machine is defined which has a pcie-root controller
      (i.e. any q35-based machinetype), libvirt will automatically add a
      dmi-to-pci-bridge controller if one doesn't exist, and also add a
      pci-bridge controller. The reasoning here is that any useful domain
      will have either an immediate (startup time) or eventual (subsequent
      hot-plug) need for a standard PCI slot; since the pcie-root controller
      only provides PCIe slots, we need to connect a dmi-to-pci-bridge
      controller to it in order to get a non-hot-plug PCI slot that we can
      then use to connect a pci-bridge - the slots provided by the
      pci-bridge will be both standard PCI and hot-pluggable.
      
      Since pci-bridge devices themselves can not be hot-plugged into a
      running system (although you can hot-plug other devices into a
      pci-bridge's slots), any new pci-bridge controller that is added can
      (and will) be plugged into the dmi-to-pci-bridge as long as it has
      empty slots available.
      
      This patch is also changing the qemuxml2xml-pcie test from a "DO_TEST"
      to a "DO_DIFFERENT_TEST". This is so that the "before" xml can omit
      the automatically added dmi-to-pci-bridge and pci-bridge devices, and
      the "after" xml can include it - this way we are testing if libvirt is
      properly adding these devices.
      62ac6b43
    • L
      qemu: add pcie-root controller · 48a3f48a
      Laine Stump 提交于
      This controller is implicit on q35 machinetypes. It provides 31 PCIe
      (*not* PCI) slots as controller 0.
      
      Currently there are no devices that can connect to pcie-root, and no
      implicit pci controller on a q35 machine, so q35 is still
      unusable. For a usable q35 system, we need to add a
      "dmi-to-pci-bridge" pci controller, which can connect to pcie-root,
      and provides standard pci slots that can be used to connect other
      devices.
      48a3f48a
  27. 23 7月, 2013 1 次提交
    • J
      conf: Introduce new XML tag "mode" for disk source · c00b2f0d
      John Ferlan 提交于
      There are two ways to use a iSCSI LUN as disk source for qemu.
      
       * The LUN's path as it shows up on host, e.g.
         /dev/disk/by-path/ip-$ip:3260-iscsi-$iqn-fc18:iscsi.iscsi0-lun-1
      
       * The libiscsi URI from the storage pool source element host attribute, e.g.
         iscsi://demo.org:6000/iqn.1992-01.com.example/1
      
      For a "volume" type disk, if the specified "pool" is of iscsi
      type, we should support to use the LUN in either of above 2 ways.
      That's why to introduce a new XML tag "mode" for the disk source
      (libvirt should support iscsi pool with libiscsi, but it's another
      new feature, which should be done later).
      
      The "mode" can be either of "host" or "direct". Use "host" to indicate
      use of the LUN with the path as it shows up on host. Use "direct" to
      indicate to use it with the source pool host URI (future patches may support
      to use network type libvirt storage too, e.g. Ceph)
      c00b2f0d
  28. 16 7月, 2013 1 次提交