1. 03 10月, 2014 2 次提交
    • C
      qemu: Don't compare CPU against host for TCG · 445a09bd
      Cole Robinson 提交于
      Right now when building the qemu command line, we try to do various
      unconditional validations of the guest CPU against the host CPU. However
      this checks are overly applied. The only time we should use the checks
      are:
      
      - The user requests host-model/host-passthrough, or
      
      - When KVM is requsted. CPU features requested in TCG mode are always
        emulated by qemu and are independent of the host CPU, so no host CPU
        checks should be performed.
      
      Right now if trying to specify a CPU for arm on an x86 host, it attempts
      to do non-sensical validation and falls over.
      
      Switch all the test cases that were intending to test CPU validation to
      use KVM, so they continue to test the intended code.
      
      Amend some aarch64 XML tests with a CPU model, to ensure things work
      correctly.
      445a09bd
    • C
      qemu_command: Split qemuBuildCpuArgStr · 3bc6dda6
      Cole Robinson 提交于
      Move the CPU mode/model handling to its own function. This is just
      code movement and re-indentation.
      3bc6dda6
  2. 24 9月, 2014 1 次提交
  3. 23 9月, 2014 2 次提交
  4. 22 9月, 2014 1 次提交
  5. 19 9月, 2014 1 次提交
  6. 18 9月, 2014 3 次提交
    • R
      Fix build in qemu_command · e29d28e7
      Roman Bogorodskiy 提交于
      Currently, build with clang fails with:
      
        CC       qemu/libvirt_driver_qemu_impl_la-qemu_command.lo
      qemu/qemu_command.c:6580:58: error: implicit conversion from enumeration type
      'virMemAccess' to different enumeration type 'virTristateSwitch'
      [-Werror,-Wenum-conversion]
              virTristateSwitch memAccess = def->cpu->cells[i].memAccess;
                                ~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~^~~~~~~~~
      1 error generated.
      
      Fix that by using virMemAccess instead of virTristateSwitch.
      e29d28e7
    • M
      qemu: Honor hugepages for UMA domains · 281f7001
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1135396
      
      There are two ways how to tell qemu to use huge pages. The first one
      is suitable for domains with NUMA nodes: the path to hugetlbfs mount
      is appended to NUMA node definition on the command line. The second
      one is suitable for UMA domains: here there's this global '-mem-path'
      argument that accepts path to the hugetlbfs mount point. However, the
      latter case was not used for all the cases that it should be. For
      instance:
      
        <memoryBacking>
          <hugepages>
            <page size='2048' unit='KiB' nodeset='0'/>
          </hugepages>
        </memoryBacking>
      
      didn't trigger the '-mem-path' so the huge pages - despite being
      configured - were not used at all.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      281f7001
    • M
      conf: Disallow nonexistent NUMA nodes for hugepages · ec982f6d
      Michal Privoznik 提交于
      As of 136ad497 it is possible to specify different huge pages per
      guest NUMA node. However, there's no check if nodeset specified in
      ./hugepages/page contains only those guest NUMA nodes that exist.
      In other words with current code it is possible to define meaningless
      combination:
      
        <memoryBacking>
          <hugepages>
            <page size='1048576' unit='KiB' nodeset='0,2-3'/>
            <page size='2048' unit='KiB' nodeset='1,4'/>
          </hugepages>
        </memoryBacking>
        <vcpu placement='static'>4</vcpu>
        <cpu>
          <numa>
            <cell id='0' cpus='0' memory='1048576'/>
            <cell id='1' cpus='1' memory='1048576'/>
            <cell id='2' cpus='2' memory='1048576'/>
            <cell id='3' cpus='3' memory='1048576'/>
          </numa>
        </cpu>
      
      Notice the node 4 in <hugepages/>?
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      ec982f6d
  7. 17 9月, 2014 2 次提交
  8. 16 9月, 2014 1 次提交
    • J
      Wire up the interface backend options · b20d39a5
      Ján Tomko 提交于
      Pass the user-specified tun path down when creating tap device
      when called from the qemu driver.
      
      Also honor the vhost device path specified by user.
      b20d39a5
  9. 11 9月, 2014 2 次提交
  10. 10 9月, 2014 2 次提交
    • M
      qemu: Implement extended loader and nvram · 54289916
      Michal Privoznik 提交于
      QEMU now supports UEFI with the following command line:
      
        -drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on \
        -drive file=/usr/share/OVMF/OVMF_VARS.fd,if=pflash,format=raw,unit=1 \
      
      where the first line reflects <loader> and the second one <nvram>.
      Moreover, these two lines obsolete the -bios argument.
      
      Note that UEFI is unusable without ACPI. This is handled properly now.
      Among with this extension, the variable file is expected to be
      writable and hence we need security drivers to label it.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Acked-by: NLaszlo Ersek <lersek@redhat.com>
      54289916
    • M
      conf: Extend <loader/> and introduce <nvram/> · 68bf13db
      Michal Privoznik 提交于
      Up to now, users can configure BIOS via the <loader/> element. With
      the upcoming implementation of UEFI this is not enough as BIOS and
      UEFI are conceptually different. For instance, while BIOS is ROM, UEFI
      is programmable flash (although all writes to code section are
      denied). Therefore we need new attribute @type which will
      differentiate the two. Then, new attribute @readonly is introduced to
      reflect the fact that some images are RO.
      
      Moreover, the OVMF (which is going to be used mostly), works in two
      modes:
      1) Code and UEFI variable store is mixed in one file.
      2) Code and UEFI variable store is separated in two files
      
      The latter has advantage of updating the UEFI code without losing the
      configuration. However, in order to represent the latter case we need
      yet another XML element: <nvram/>. Currently, it has no additional
      attributes, it's just a bare element containing path to the variable
      store file.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Acked-by: NLaszlo Ersek <lersek@redhat.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      68bf13db
  11. 08 9月, 2014 1 次提交
  12. 04 9月, 2014 1 次提交
    • E
      maint: use consistent if-else braces in qemu · 44e30277
      Eric Blake 提交于
      I'm about to add a syntax check that enforces our documented
      HACKING style of always using matching {} on if-else statements.
      
      This commit focuses on the qemu driver.
      
      * src/qemu/qemu_command.c (qemuParseISCSIString)
      (qemuParseCommandLineDisk, qemuParseCommandLine)
      (qemuBuildSmpArgStr, qemuBuildCommandLine)
      (qemuParseCommandLineDisk, qemuParseCommandLineSmp): Correct use
      of {}.
      * src/qemu/qemu_capabilities.c (virQEMUCapsProbeCPUModels):
      Likewise.
      * src/qemu/qemu_driver.c (qemuDomainCoreDumpWithFormat)
      (qemuDomainRestoreFlags, qemuDomainGetInfo)
      (qemuDomainMergeBlkioDevice): Likewise.
      * src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
      * src/qemu/qemu_monitor_text.c (qemuMonitorTextCreateSnapshot)
      (qemuMonitorTextLoadSnapshot, qemuMonitorTextDeleteSnapshot):
      Likewise.
      * src/qemu/qemu_process.c (qemuProcessStop): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      44e30277
  13. 02 9月, 2014 1 次提交
  14. 29 8月, 2014 2 次提交
    • J
      qemu: Allow use of iothreads for disk definitions · ef8da2ad
      John Ferlan 提交于
      For virtio-blk-pci disks with the disk iothread attribute that are
      running the correct emulator, add the "iothread=iothread#" to the
      -device command line in order to enable iothreads for the disk as
      long as the command is available, the disk iothread value provided is
      valid, and is supported for the disk device being added
      ef8da2ad
    • J
      qemu: Add support for iothreads · 72edaae7
      John Ferlan 提交于
      Add a new capability to ensure the iothreads feature exists for the qemu
      emulator being run - requires the "query-iothreads" QMP command. Using the
      domain XML add correspoding command argument in order to generate the
      threads. The iothreads will use a name space "iothread#" where, the
      future patch to add support for using an iothread to a disk definition to
      merely define which of the available threads to use.
      
      Add tests to ensure the xml/argv processing is correct.  Note that no
      change was made to qemuargv2xmltest.c as processing the -object element
      would require knowing more than just iothreads.
      72edaae7
  15. 28 8月, 2014 3 次提交
    • J
      qemu_command: Resolve Coverity DEADCODE · 84bfb11b
      John Ferlan 提交于
      One useless warning, but the other one rather pertinent. On entry
      the 'trans' variable is initialized to VIR_DOMAIN_DISK_TRANS_DEFAULT.
      When the "trans" was found in the parsing loop it def->geometry.trans
      was assigned to the return from virDomainDiskGeometryTransTypeFromString
      and then 'trans' was used to do the comparison to see if it was valid.
      
      So remove 'trans' and use def->geometry.trans properly
      84bfb11b
    • J
      qemu_command: Resolve Coverity RESOURCE_LEAK · 461fb555
      John Ferlan 提交于
      In qemuParseISCSIString() if an error was returned, then the call
      to qemuParseDriveURIString() where the uri is free'd wouldn't be run
      461fb555
    • J
      qemu_command: Resolve Coverity REVERSE_INULL · 39b9c121
      John Ferlan 提交于
      In qemuNetworkIfaceConnect() a call to virNetDevBandwidthSet() is
      made where the function prototype requires the first parameter
      (net->ifname) to be non NULL.  Coverity complains that the subsequent
      non NULL check for net->ifname prior to the next call gets flagged as
      an unnecessary check.  Resolve by removing the extra check
      39b9c121
  16. 26 8月, 2014 2 次提交
    • E
      blkdeviotune: check for overflow when parsing XML · 2f0944de
      Erik Skultety 提交于
      According to docs/schemas/domaincommon.rng and _virDomainBlockIoTuneInfo
      all the iotune values are interpreted as unsigned long long, however
      according to qemu_monitor_json.c, qemu silently truncates numbers
      larger than LLONG_MAX. There's really not much of a usage for such
      large numbers anyway yet. This patch provides the same overflow
      check during a domain start as it does during setting
      a blkdeviotune element in qemu_driver.c and thus reports an error when
      a larger number than LLONG_MAX is detected.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1131876
      2f0944de
    • A
      Add new 'kvm' domain feature and ability to hide KVM signature · d0711642
      Alex Williamson 提交于
      QEMU 2.1 added support for the kvm=off option to the -cpu command,
      allowing the KVM hypervisor signature to be hidden from the guest.
      This enables disabling of some paravirualization features in the
      guest as well as allowing certain drivers which test for the
      hypervisor to load.  Domain XML syntax is as follows:
      
      <domain type='kvm>
        ...
        <features>
          ...
          <kvm>
            <hidden state='on'/>
          </kvm>
        </features>
        ...
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      d0711642
  17. 25 8月, 2014 1 次提交
  18. 21 8月, 2014 1 次提交
    • J
      Perform disk config validity checking for attach-device config · 33188c9f
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1078126
      
      Using 'virsh attach-device --config' (or --persistent) to attach a
      file backed lun device will succeed; however, subsequent domain restarts
      will result in failure because the configuration of a file backed lun
      is not supported.
      
      Although allowing 'illegal configurations' is something that can be
      allowed, it may not be practical in this case. Generally, when attaching
      a device to a domain means the domain must be running. A way around
      this is using the --config (or --persistent) option. When an attach
      is done to a running domain, a temporary configuration is modified
      first followed by the live update. The live update will make a number
      of disk validity checks when building the qemu command to attach the
      disk. If any fail, then change is rejected.
      
      Rather than allow a potentially illegal combination, adjust the code
      in the configuration path to make the same checks as the running path
      will make with respect to disk validity checks. This way we avoid
      having the potential for some subsequent start/reboot to fail because
      an illegal combination was allowed.
      
      NB: The live path still checks the configuration since it is possible
      to just do --live guest modification...
      33188c9f
  19. 20 8月, 2014 3 次提交
    • M
      qemu: Label all TAP FDs · cf976d9d
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1095636
      
      When starting up the domain the domain's NICs are allocated. As of
      1f24f682 (v1.0.6) we are able to use multiqueue feature on virtio
      NICs. It breaks network processing into multiple queues which can be
      processed in parallel by different host CPUs. The queues are, however,
      created by opening /dev/net/tun several times. Unfortunately, only the
      first FD in the row is labelled so when turning the multiqueue feature
      on in the guest, qemu will get AVC denial. Make sure we label all the
      FDs needed.
      
      Moreover, the default label of /dev/net/tun doesn't allow
      attaching a queue:
      
          type=AVC msg=audit(1399622478.790:893): avc:  denied  { attach_queue }
          for  pid=7585 comm="qemu-kvm"
          scontext=system_u:system_r:svirt_t:s0:c638,c877
          tcontext=system_u:system_r:virtd_t:s0-s0:c0.c1023
          tclass=tun_socket
      
      And as suggested by SELinux maintainers, the tun FD should be labeled
      as svirt_t. Therefore, we don't need to adjust any range (as done
      previously by Guannan in ae368ebf) rather set the seclabel of the
      domain directly.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      cf976d9d
    • P
      conf: Pass virStorageSource into virDomainDiskSourceIsBlockType · 1cc6bdc2
      Peter Krempa 提交于
      All checks are based on the storage source, thus there's no need to pass
      the complete disk def.
      1cc6bdc2
    • G
      qemu_command: fix block indentation · 62df8ce0
      Giuseppe Scrivano 提交于
      Signed-off-by: NGiuseppe Scrivano <gscrivan@redhat.com>
      62df8ce0
  20. 19 8月, 2014 1 次提交
  21. 08 8月, 2014 1 次提交
  22. 07 8月, 2014 1 次提交
  23. 04 8月, 2014 1 次提交
    • J
      Don't overwrite errors from virNetDevBandwidthSet · 6dac5d06
      Ján Tomko 提交于
      Otherwise this beautiful error would be overwritten when
      the function is called with a really high rate number:
      
      2014-07-28 12:51:47.920+0000: 2304: error : virCommandWait:2399 :
      internal error: Child process (/sbin/tc class add dev vnet0 parent 1:
      classid 1:1 htb rate 4294968kbps) unexpected exit status 1: Illegal "rate"
      Usage: ... qdisc add ... htb [default N] [r2q N]
       default  minor id of class to which unclassified packets are sent {0}
       r2q      DRR quantums are computed as rate in Bps/r2q {10}
       debug    string of 16 numbers each 0-3 {0}
      
      ... class add ... htb rate R1 [burst B1] [mpu B] [overhead O]
                            [prio P] [slot S] [pslot PS]
                            [ceil R2] [cburst B2] [mtu MTU] [quantum Q]
       rate     rate allocated to this class (class can still borrow)
       burst    max bytes burst which can be accumulated during idle period {computed}
       mpu      minimum packet size used in rate computations
       overhead per-packet size overhead used in rate computations
       linklay  adapting to a linklayer e.g. atm
       ceil     definite upper class rate (no borrows) {rate}
       cburst   burst but for ceil {computed}
       mtu      max packet size we create rate map for {1600}
       prio     priority of leaf; lowe
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1043735
      6dac5d06
  24. 29 7月, 2014 4 次提交
    • H
      qemu: error out if PCI passthrough type is not supported · c5b02b67
      Hu Tao 提交于
      If PCI passthrough type is not supported, we should error out rather than
      continue building the command line.
      
      When starting a domain, the type has been already checked by
      qemuPrepareHostdevPCICheckSupport() before building qemu command line,
      so the problem doesn't emerge.
      
      But when coverting a domain xml without specifying passthrough type explictly
      to qemu arg, we will get a malformed command line.
      
      the xml:
      
          <hostdev mode='subsystem' type='pci' managed='yes'>
            <source>
              <address domain='0x0001' bus='0x03' slot='0x00' function='0x0'/>
            </source>
            <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
          </hostdev>
      
      the converted command line:
      
        -device ,host=0001:03:00.0,id=hostdev0,bus=pci.0,addr=0x5
      
      After this patch, virsh gives an error message:
      
        virsh domxml-to-native qemu-argv /tmp/tmp.xml
        error: internal error: invalid PCI passthrough type 'default'
      Signed-off-by: NHu Tao <hutao@cn.fujitsu.com>
      c5b02b67
    • M
    • M
      domain: Introduce ./hugepages/page/[@size, @unit, @nodeset] · 136ad497
      Michal Privoznik 提交于
        <memoryBacking>
          <hugepages>
            <page size="1" unit="G" nodeset="0-3,5"/>
            <page size="2" unit="M" nodeset="4"/>
          </hugepages>
        </memoryBacking>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      136ad497
    • M
      qemu: Utilize virFileFindHugeTLBFS · 725a211f
      Michal Privoznik 提交于
      Use better detection of hugetlbfs mount points. Yes, there can be
      multiple mount points each serving different huge page size.
      
      Since we already have ability to override the mount point in the
      qemu.conf file, this crazy backward compatibility code is brought in.
      Now we allow multiple mount points, so the "hugetlbfs_mount" option
      must take an list of strings (mount points). But previously, it was
      just a string, so we must accept both types now.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      725a211f