1. 30 12月, 2011 1 次提交
    • E
      schema: rewrite seclabel rng to match code · 116d6af9
      Eric Blake 提交于
      The RNG for <seclabel> was too strict - if it was present, then it
      had to have sub-elements, even if those didn't make sense for the
      given attributes.  Also, we didn't have any tests of <seclabel>
      parsing or XML output.
      
      In this patch, I added more parsing tests than output tests (since
      the output populates and/or reorders fields not present in certain
      inputs).  Making the RNG reliable is a precursor to using <seclabel>
      variants in more places in the XML in later patches.
      
      See also:
      http://berrange.com/posts/2011/09/29/two-small-improvements-to-svirt-guest-configuration-flexibility-with-kvmlibvirt/
      
      * docs/schemas/domaincommon.rng (seclabel): Tighten rules.
      * tests/qemuxml2argvtest.c (mymain): New tests.
      * tests/qemuxml2xmltest.c (mymain): Likewise.
      * tests/qemuxml2argvdata/qemuxml2argv-seclabel-*.*: New files.
      116d6af9
  2. 21 12月, 2011 1 次提交
  3. 10 12月, 2011 1 次提交
    • E
      network: allow '-' in model name · dad3c209
      Eric Blake 提交于
      In QEMU PPC64 we have a network device called "spapr-vlan". We can specify
      this using the existing syntax for network devices, however libvirt
      currently rejects "spapr-vlan" in virDomainNetDefParseXML() because of
      the "-". Fix the code to accept "-".
      
      * src/conf/domain_conf.c (virDomainNetDefParseXML): Allow '-' in
      model name, and be more efficient.
      * docs/schemas/domaincommon.rng: Limit valid model names to match code.
      Based on a patch by Michael Ellerman.
      dad3c209
  4. 08 12月, 2011 1 次提交
  5. 01 12月, 2011 1 次提交
  6. 30 11月, 2011 1 次提交
    • H
      blkiotune: add interface for blkiotune.device_weight · 6ac81c8e
      Hu Tao 提交于
      This adds per-device weights to <blkiotune>.  Note that the
      cgroups implementation only supports weights per block device,
      and not per-file within the device; hence this option must be
      global to the domain definition rather than tied to individual
      <devices>/<disk> entries:
      
      <domain ...>
        <blkiotune>
          <device>
            <path>/path/to/block</path>
            <weight>1000</weight>
          </device>
        </blkiotune>
      ..
      
      This patch also adds a parameter --device-weights to virsh command
      blkiotune for setting/getting blkiotune.weight_device for any
      hypervisor that supports it.  All <device> entries under
      <blkiotune> are concatenated into a single string attribute under
      virDomain{Get,Set}BlkioParameters, named "device_weight".
      Signed-off-by: NHu Tao <hutao@cn.fujitsu.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6ac81c8e
  7. 29 11月, 2011 1 次提交
  8. 18 11月, 2011 1 次提交
  9. 29 10月, 2011 2 次提交
  10. 25 10月, 2011 1 次提交
    • M
      conf: Introduce optional startupPolicy attribute for cdrom and floppy · e5a84d74
      Michal Privoznik 提交于
      This attribute says what to do with cdrom (or floppy) if
      the source is missing. It accepts:
      - mandatory - fail if missing for any reason (the default)
      - requisite - fail if missing on boot up, drop if missing on
                    migrate/restore/revert
      - optional  - drop if missing at any start attempt.
      
      However, this patch introduces only XML part of this new
      functionality.
      e5a84d74
  11. 18 10月, 2011 1 次提交
    • J
      Add AHCI support to qemu driver · c1bc3d89
      Jim Fehlig 提交于
      Tested with multiple AHCI controllers and multiple disks attached
      to a controller. E.g.,
      
          <disk type='file' device='disk'>
            <driver name='qemu' type='raw'/>
            <source file='/var/lib/libvirt/images/test/disk0.raw'/>
            <target dev='sda' bus='sata'/>
            <address type='drive' controller='0' bus='0' unit='0'/>
          </disk>
          <disk type='file' device='disk'>
            <driver name='qemu' type='raw'/>
            <source file='/var/lib/libvirt/images/test/disk1.raw'/>
            <target dev='sdb' bus='sata'/>
            <address type='drive' controller='0' bus='0' unit='1'/>
          </disk>
          <disk type='file' device='disk'>
            <driver name='qemu' type='raw'/>
            <source file='/var/lib/libvirt/images/test/disk2.raw'/>
            <target dev='sdc' bus='sata'/>
            <address type='drive' controller='1' bus='0' unit='0'/>
          </disk>
          <controller type='sata' index='0'>
            <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
          </controller>
          <controller type='sata' index='1'>
            <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
          </controller>
      c1bc3d89
  12. 13 10月, 2011 1 次提交
  13. 07 10月, 2011 1 次提交
    • L
      qemu: add separate rerror_policy for disk errors · 4bb4109f
      Laine Stump 提交于
      Previously libvirt's disk device XML only had a single attribute,
      error_policy, to control both read and write error policy, but qemu
      has separate options for controlling read and write. In one case
      (enospc) a policy is allowed for write errors but not read errors.
      
      This patch adds a separate attribute that sets only the read error
      policy. If just error_policy is set, it will apply to both read and
      write error policy (previous behavior), but if the new rerror_policy
      attribute is set, it will override error_policy for read errors only.
      Possible values for rerror_policy are "stop", "report", and "ignore"
      ("report" is the qemu-controlled default for rerror_policy when
      error_policy isn't specified).
      
      For consistency, the value "report" has been added to the possible
      values for error_policy as well.
      4bb4109f
  14. 01 10月, 2011 1 次提交
    • L
      qemu: make PCI multifunction support more manual · c329db71
      Laine Stump 提交于
      When support for was added for PCI multifunction cards (in commit
      9f8baf, first included in libvirt 0.9.3), it was done by always
      turning on the multifunction bit for all PCI devices. Since that time
      it has been realized that this is not an ideal solution, and that the
      multifunction bit must be selectively turned on. For example, see
      
        https://bugzilla.redhat.com/show_bug.cgi?id=728174
      
      and the discussion before and after
      
        https://www.redhat.com/archives/libvir-list/2011-September/msg01036.html
      
      This patch modifies multifunction support so that the multifunction=on
      option is only added to the qemu commandline for a device if its PCI
      <address> definition has the attribute "multifunction='on'", e.g.:
      
        <address type='pci' domain='0x0000' bus='0x00'
                 slot='0x04' function='0x0' multifunction='on'/>
      
      In practice, the multifunction bit should only be turned on if
      function='0' AND other functions will be used in the same slot - it
      usually isn't needed for functions 1-7 (although there are apparently
      some exceptions, e.g. the Intel X53 according to the QEMU source
      code), and should never be set if only function 0 will be used in the
      slot. The test cases have been changed accordingly to illustrate.
      
      With this patch in place, if a user attempts to assign multiple
      functions in a slot without setting the multifunction bit for function
      0, libvirt will issue an error when the domain is defined, and the
      define operation will fail. In the future, we may decide to detect
      this situation and automatically add multifunction=on to avoid the
      error; even then it will still be useful to have a manual method of
      turning on multifunction since, as stated above, there are some
      devices that excpect it to be turned on for all functions in a slot.
      
      A side effect of this patch is that attempts to use the same PCI
      address for two different devices will now log an error (previously
      this would cause the domain define operation to fail, but there would
      be no log message generated). Because the function doing this log was
      almost completely rewritten, I didn't think it worthwhile to make a
      separate patch for that fix (the entire patch would immediately be
      obsoleted).
      c329db71
  15. 27 9月, 2011 1 次提交
    • L
      qemu: add ability to set PCI device "rombar" on or off · dc79852a
      Laine Stump 提交于
      This patch was made in response to:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=738095
      
      In short, qemu's default for the rombar setting (which makes the
      firmware ROM of a PCI device visible/not on the guest) was previously
      0 (not visible), but they recently changed the default to 1
      (visible). Unfortunately, there are some PCI devices that fail in the
      guest when rombar is 1, so the setting must be exposed in libvirt to
      prevent a regression in behavior (it will still require explicitly
      setting <rom bar='off'/> in the guest XML).
      
      rombar is forced on/off by adding:
      
        <rom bar='on|off'/>
      
      inside a <hostdev> element that defines a PCI device. It is currently
      ignored for all other types of devices.
      
      At the moment there is no clean method to determine whether or not the
      rombar option is supported by QEMU - this patch uses the advice of a
      QEMU developer to assume support for qemu-0.12+. There is currently a
      patch in the works to put this information in the output of "qemu-kvm
      -device pci-assign,?", but of course if we switch to keying off that,
      we would lose support for setting rombar on all the versions of qemu
      between 0.12 and whatever version gets that patch.
      dc79852a
  16. 23 9月, 2011 1 次提交
    • O
      Add unsafe cache mode support for disk driver · f887334d
      Oskari Saarenmaa 提交于
      QEMU 0.13 introduced cache=unsafe for -drive, this patch exposes
      it in the libvirt layer.
      
        * Introduced a new QEMU capability flag ($prefix_CACHE_UNSAFE),
          as even if $prefix_CACHE_V2 is set, we can't know if unsafe
          is supported.
      
        * Improved the reliability of qemu cache type detection.
      f887334d
  17. 06 9月, 2011 1 次提交
    • M
      redirdev: allows to specify device address · 2e0dbaad
      Marc-André Lureau 提交于
      It is important to be able to attach USB redirected devices to a
      particular controller (one that supports USB2 for instance).
      Without this patch, only the default bus was used.
      
           <redirdev bus='usb' type='spicevmc'>
             <address type='usb' bus='0' port='4'/>
           </redirdev>
      2e0dbaad
  18. 05 9月, 2011 2 次提交
    • E
      snapshot: also support disks by path · 89b6284f
      Eric Blake 提交于
      I got confused when 'virsh domblkinfo dom disk' required the
      path to a disk (which can be ambiguous, since a single file
      can back multiple disks), rather than the unambiguous target
      device name that I was using in disk snapshots.  So, in true
      developer fashion, I went for the best of both worlds - all
      interfaces that operate on a disk (aka block) now accept
      either the target name or the unambiguous path to the backing
      file used by the disk.
      
      * src/conf/domain_conf.h (virDomainDiskIndexByName): Add
      parameter.
      (virDomainDiskPathByName): New prototype.
      * src/libvirt_private.syms (domain_conf.h): Export it.
      * src/conf/domain_conf.c (virDomainDiskIndexByName): Also allow
      searching by path, and decide whether ambiguity is okay.
      (virDomainDiskPathByName): New function.
      (virDomainDiskRemoveByName, virDomainSnapshotAlignDisks): Update
      callers.
      * src/qemu/qemu_driver.c (qemudDomainBlockPeek)
      (qemuDomainAttachDeviceConfig, qemuDomainUpdateDeviceConfig)
      (qemuDomainGetBlockInfo, qemuDiskPathToAlias): Likewise.
      * src/qemu/qemu_process.c (qemuProcessFindDomainDiskByPath):
      Likewise.
      * src/libxl/libxl_driver.c (libxlDomainAttachDeviceDiskLive)
      (libxlDomainDetachDeviceDiskLive, libxlDomainAttachDeviceConfig)
      (libxlDomainUpdateDeviceConfig): Likewise.
      * src/uml/uml_driver.c (umlDomainBlockPeek): Likewise.
      * src/xen/xend_internal.c (xenDaemonDomainBlockPeek): Likewise.
      * docs/formatsnapshot.html.in: Update documentation.
      * tools/virsh.pod (domblkstat, domblkinfo): Likewise.
      * docs/schemas/domaincommon.rng (diskTarget): Tighten pattern on
      disk targets.
      * docs/schemas/domainsnapshot.rng (disksnapshot): Update to match.
      * tests/domainsnapshotxml2xmlin/disk_snapshot.xml: Update test.
      89b6284f
    • E
      snapshot: additions to domain xml for disks · 47123530
      Eric Blake 提交于
      As discussed here:
      https://www.redhat.com/archives/libvir-list/2011-August/msg00361.html
      https://www.redhat.com/archives/libvir-list/2011-August/msg00552.html
      
      Adds snapshot attribute and transient sub-element:
      
      <devices>
        <disk type=... snapshot='no|internal|external'>
          ...
          <transient/>
        </disk>
      </devices>
      
      * docs/schemas/domaincommon.rng (snapshot): New define.
      (disk): Add snapshot and persistent attributes.
      * docs/formatdomain.html.in: Document them.
      * src/conf/domain_conf.h (virDomainDiskSnapshot): New enum.
      (_virDomainDiskDef): New fields.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-transient.xml: New
      test of rng, no args counterpart until qemu support is complete.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.args: New
      file, snapshot attribute does not affect args.
      * tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.xml: Likewise.
      * tests/qemuxml2argvtest.c (mymain): Run new test.
      47123530
  19. 03 9月, 2011 1 次提交
    • E
      snapshot: update rng to support full domain in xml · 2a95a3e9
      Eric Blake 提交于
      This patch will probably cause merge conflicts to those trying
      to do backports.  The end goal is simple - domaincommon.rng
      should be the state of domain.rng pre-patch, with a few lines
      tweaked in the header, while domain.rng post-patch is now just
      a shell that includes domaincommon.rng and sets the <start>.
      
      * docs/schemas/domain.rng: Move guts...
      * docs/schemas/domaincommon.rng: ...to new file.
      * docs/schemas/domainsnapshot.rng: Allow new xml.
      * docs/schemas/Makefile.am (schema_DATA): Distribute new file.
      * tests/domainsnapshotxml2xmlout/full_domain.xml: New test.
      * libvirt.spec.in (%files client): Ship new file.  Sort lines.
      * mingw32-libvirt.spec.in: Likewise.
      2a95a3e9
  20. 02 9月, 2011 8 次提交
  21. 15 8月, 2011 1 次提交
    • L
      qemu: support event_idx parameter for virtio disk and net devices · 73c0a148
      Laine Stump 提交于
      In some versions of qemu, both virtio-blk-pci and virtio-net-pci
      devices can have an event_idx setting that determines some details of
      event processing. When it is enabled, it "reduces the number of
      interrupts and exits for the guest". qemu will automatically enable
      this feature when it is available, but there may be cases where this
      new feature could actually make performance worse (NB: no such case
      has been found so far).
      
      As a safety switch in case such a situation is encountered in the
      field, this patch adds a new attribute "event_idx" to the <driver>
      element of both disk and interface devices. event_idx can be set to
      "on" (to force event_idx on in case qemu has it disabled by default)
      or "off" (for force event_idx off). In the case that event_idx support
      isn't present in qemu, the attribute is ignored (this on the advice of
      the qemu developer).
      
      docs/formatdomain.html.in: document the new flag (marking it as
         "don't mess with this!"
      docs/schemas/domain.rng: add event_idx in appropriate places
      src/conf/domain_conf.[ch]: add event_idx to parser and formatter
      src/libvirt_private.syms: export
         virDomainVirtioEventIdx(From|To)String
      src/qemu/qemu_capabilities.[ch]: detect and report event_idx in
         disk/net
      src/qemu/qemu_command.c: add event_idx parameter to qemu commandline
          when appropriate.
      tests/qemuxml2argvdata/qemuxml2argv-event_idx.args,
      tests/qemuxml2argvdata/qemuxml2argv-event_idx.xml,
      tests/qemuxml2argvtest.c,
      tests/qemuxml2xmltest.c: test cases for event_idx.
      73c0a148
  22. 29 7月, 2011 1 次提交
    • L
      conf: add <listen> subelement to domain <graphics> element · ef79fb5b
      Laine Stump 提交于
      Once it's plugged in, the <listen> element will be an optional
      replacement for the "listen" attribute that graphics elements already
      have. If the <listen> element is type='address', it will have an
      attribute called 'address' which will contain an IP address or dns
      name that the guest's display server should listen on. If, however,
      type='network', the <listen> element should have an attribute called
      'network' that will be set to the name of a network configuration to
      get the IP address from.
      
      * docs/schemas/domain.rng: updated to allow the <listen> element
      
      * docs/formatdomain.html.in: document the <listen> element and its
        attributes.
      
      * src/conf/domain_conf.[hc]:
      
        1) The domain parser, formatter, and data structure are modified to
           support 0 or more <listen> subelements to each <graphics>
           element. The old style "legacy" listen attribute is also still
           accepted, and will be stored internally just as if it were a
           separate <listen> element. On output (i.e. format), the address
           attribute of the first <listen> element of type 'address' will be
           duplicated in the legacy "listen" attribute of the <graphic>
           element.
      
        2) The "listenAddr" attribute has been removed from the unions in
           virDomainGRaphicsDef for graphics types vnc, rdp, and spice.
           This attribute is now in the <listen> subelement (aka
           virDomainGraphicsListenDef)
      
        3) Helper functions were written to provide simple access
           (both Get and Set) to the listen elements and their attributes.
      
      * src/libvirt_private.syms: export the listen helper functions
      
      * src/qemu/qemu_command.c, src/qemu/qemu_hotplug.c,
        src/qemu/qemu_migration.c, src/vbox/vbox_tmpl.c,
        src/vmx/vmx.c, src/xenxs/xen_sxpr.c, src/xenxs/xen_xm.c
      
        Modify all these files to use the listen helper functions rather
        than directly referencing the (now missing) listenAddr
        attribute. There can be multiple <listen> elements to a single
        <graphics>, but the drivers all currently only support one, so all
        replacements of direct access with a helper function indicate index
        "0".
      
      * tests/* - only 3 of these are new files added explicitly to test the
        new <listen> element. All the others have been modified to reflect
        the fact that any legacy "listen" attributes passed in to the domain
        parse will be saved in a <listen> element (i.e. one of the
        virDomainGraphicsListenDefs), and during the domain format function,
        both the <listen> element as well as the legacy attributes will be
        output.
      ef79fb5b
  23. 25 7月, 2011 1 次提交
    • M
      bandwidth: Define schema and create documentation · a8923162
      Michal Privoznik 提交于
      Define new 'bandwidth' element with possible child element 'inbound'
      and 'outbound' addressing incoming and outgoing traffic respectively:
      
      <bandwidth>
        <inbound average='1000' peak='2000' burst='5120'/>
        <outbound average='500'/>
      </bandwidth>
      
      Leaving any element out means not to shape traffic in that
      direction.
      The units for average and peak (rate) are in kilobytes per second,
      for burst (size) are just in kilobytes.
      This element can be inserted into domain's 'interface' and
      'network'.
      a8923162
  24. 22 7月, 2011 2 次提交
    • L
      conf: support abstracted interface info in domain interface XML · 07f41369
      Laine Stump 提交于
      the domain XML <interface> element is updated in the following ways:
      
      1) <virtualportprofile> can be specified when source type='network'
      (previously it was only valid for source type='direct')
      
      2) A new attribute "portgroup" has been added to the <source>
      element. When source type='network' (the only time portgroup is
      recognized), extra configuration information will be taken from the
      <portgroup> element of the given name in the network definition.
      
      3) Each virDomainNetDef now also potentially has a
      virDomainActualNetDef which is a private object (never
      exported/imported via the public API, and not defined in the RNG) that
      is used to maintain information about the physical device that was
      actually used for a NetDef of type VIR_DOMAIN_NET_TYPE_NETWORK.
      
      The virDomainActualNetDef will only be parsed/formatted if the
      parse/format function is called with the
      VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET flag set (which is only needed when
      saving/loading a running domain's state info to the stateDir).
      07f41369
    • L
      conf: put virtPortProfile struct / functions in a common location · a3d95b55
      Laine Stump 提交于
      virtPortProfiles are currently only used in the domain XML, but will
      soon also be used in the network XML. To prepare for that change, this
      patch moves the structure definition into util/network.h and the parse
      and format functions into util/network.c (I decided that this was a
      better choice than macvtap.h/c for something that needed to always be
      available on all platforms).
      a3d95b55
  25. 21 7月, 2011 1 次提交
    • W
      Update XML Schema for new entries · f27f62ca
      Wen Congyang 提交于
      Define the element cputune's child elements 'period' and 'quota':
      <cputune>
        <period>100000</period>
        <quota>50000</quota>
      </cputune>
      f27f62ca
  26. 11 7月, 2011 2 次提交
    • J
      Do not drop kernel cmdline for xen pv domains · eb314315
      Jim Fehlig 提交于
      Kernel cmdline args can be passed to xen pv domains even when a
      bootloader is specified.  The current config-to-sxpr mapping
      ignores cmdline when bootloader is present.
      
      Since the xend sub-driver is used with many xen toolstack versions,
      this patch takes conservative approach of adding an else block to
      existing !def->os.bootloader, and only appends sxpr if def->os.cmdline
      is non-NULL.
      
      V2: Fix existing testcase broken by this patch and add new testcases
      eb314315
    • M
      bios: Add support for SGA · 874e65aa
      Michal Privoznik 提交于
      This patch creates new <bios> element which, at this time has only the
      attribute useserial='yes|no'. This attribute allow users to use
      Serial Graphics Adapter and see BIOS messages from the very first moment
      domain boots up. Therefore, users can choose boot medium, set PXE, etc.
      874e65aa
  27. 08 7月, 2011 1 次提交
  28. 06 7月, 2011 1 次提交
    • L
      xml: create an RNG file for common types and move some definitions there · 0c97dc41
      Laine Stump 提交于
      domain.rng, network.rng, and interface.rng already use a few of the
      same types (or in some cases *should* but don't), and an upcoming code
      change will have them sharing even more. To prepare for that, this
      patch takes those common data type definitions and moves them into
      basictypes.rng.
      
      This may break some rule about the need to RNG files to be autonomous
      or something, but I saw that storageencryption.rng is used in this
      way, so I figured it must not be completely against the law...
      0c97dc41
  29. 04 7月, 2011 1 次提交
    • D
      Allow for resource relabelling with static labels · 6321fd97
      Daniel P. Berrange 提交于
      Add a new attribute to the <seclabel> XML to allow resource
      relabelling to be enabled with static label usage.
      
        <seclabel model='selinux' type='static' relabel='yes'>
          <label>system_u:system_r:svirt_t:s0:c392,c662</label>
        </seclabel>
      
      * docs/schemas/domain.rng: Add relabel attribute
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Parse
        the 'relabel' attribute
      * src/qemu/qemu_process.c: Unconditionally clear out the
        'imagelabel' attribute
      * src/security/security_apparmor.c: Skip based on 'relabel'
        attribute instead of label type
      * src/security/security_selinux.c: Skip based on 'relabel'
        attribute instead of label type and fill in <imagelabel>
        attribute if relabel is enabled.
      6321fd97