1. 17 10月, 2012 3 次提交
    • M
      qemu: Pin the emulator when only cpuset is specified · ba63d8f7
      Martin Kletzander 提交于
      According to our recent changes (clarifications), we should be pinning
      qemu's emulator processes using the <vcpu> 'cpuset' attribute in case
      there is no <emulatorpin> specified.  This however doesn't work
      entirely as expected and this patch should resolve all the remaining
      issues.
      ba63d8f7
    • J
      qemu: Clear async job when p2p migration fails early · 837993d8
      Jiri Denemark 提交于
      When p2p migration fails early because qemuMigrationIsAllowed or
      qemuMigrationIsSafe say migration should be cancelled, we fail to clear
      the migration-out async job. As a result of that, further APIs called
      for the same domain may fail with Timed out during operation: cannot
      acquire state change lock.
      
      Reported by Guido Winkelmann.
      837993d8
    • G
      selinux: fix wrong tapfd relablling · 89b63f0a
      Guannan Ren 提交于
      It should relabel tapfd of virtual network of type VIR_DOMAIN_NET_TYPE_DIRECT
      rather than VIR_DOMAIN_NET_TYPE_NETWORK and VIR_DOMAIN_NET_TYPE_BRIDGE
      (commit ae368ebf introduced this bug)
      
      Caution: The context of the two hunks is identical other than indentation.
      Please be extremely cautious of where the patch gets applied.
      89b63f0a
  2. 15 10月, 2012 8 次提交
    • E
      maint: drop spurious semicolons · 2cfa14bc
      Eric Blake 提交于
      Detected with:
      git grep ';;$' -- '**/*.[ch]'
      
      * src/network/bridge_driver.c (networkRadvdConfContents): Fix
      harmless typo.
      * src/phyp/phyp_driver.c (phypUUIDTable_Pull): Likewise.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONDriveDel):
      Likewise.
      2cfa14bc
    • G
      selinux: add security selinux function to label tapfd · ae368ebf
      Guannan Ren 提交于
      BZ:https://bugzilla.redhat.com/show_bug.cgi?id=851981
      When using macvtap, a character device gets first created by
      kernel with name /dev/tapN, its selinux context is:
      system_u:object_r:device_t:s0
      
      Shortly, when udev gets notification when new file is created
      in /dev, it will then jump in and relabel this file back to the
      expected default context:
      system_u:object_r:tun_tap_device_t:s0
      
      There is a time gap happened.
      Sometimes, it will have migration failed, AVC error message:
      type=AVC msg=audit(1349858424.233:42507): avc:  denied  { read write } for
      pid=19926 comm="qemu-kvm" path="/dev/tap33" dev=devtmpfs ino=131524
      scontext=unconfined_u:system_r:svirt_t:s0:c598,c908
      tcontext=system_u:object_r:device_t:s0 tclass=chr_file
      
      This patch will label the tapfd device before qemu process starts:
      system_u:object_r:tun_tap_device_t:MCS(MCS from seclabel->label)
      ae368ebf
    • M
      Add support for SUSPEND_DISK event · 7ba5defb
      Martin Kletzander 提交于
      This patch adds support for SUSPEND_DISK event; both lifecycle and
      separated.  The support is added for QEMU, machines are changed to
      PMSUSPENDED, but as QEMU sends SHUTDOWN afterwards, the state changes
      to shut-off.  This and much more needs to be done in order for libvirt
      to work with transient devices, wake-ups etc.  This patch is not
      aiming for that functionality.
      7ba5defb
    • L
      qemu: reorganize qemuDomainChangeNet and qemuDomainChangeNetBridge · 6bde0a1a
      Laine Stump 提交于
      This patch resolves:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=805071
      
      to the extent that it can be resolved with current qemu functionality.
      It attempts to detect as many situations as possible when the simple
      operation of disconnecting an existing tap device from one bridge and
      attaching it to another will satisfy the change requested in
      virDomainUpdateDeviceFlags() for a network device. Before this patch,
      that situation could only be detected if the pre-change interface
      *and* the post-change interface definition were both "type='bridge'".
      After this patch, it can also be detected if the before or after
      interfaces are any combination of type='bridge' and type='network'
      (the networks can be <forward mode='nat|route|bridge'>, as long as
      they use a Linux host bridge and not macvtap connections).
      
      This extra effort is especially useful since the recent discovery that
      a netdev_del+netdev_add combo (to reconnect the network device with
      completely different hostside configuration) doesn't work properly
      with current qemu (1.2) unless it is accompanied by the matching
      device_del+device_add - see this mailing list message for details:
      
        http://lists.nongnu.org/archive/html/qemu-devel/2012-10/msg02355.html
      
      (A slight modification of the patch referenced there has been prepared
      to apply on top of this patch, but won't be pushed until qemu can be
      made to work with it.)
      
      * qemuDomainChangeNet needs access to the virDomainDeviceDef that
      holds the new netdef (so that it can clear out the virDomainDeviceDef
      if it ends up using the NetDef to replace the original), so the
      virDomainNetDefPtr arg is replaced with a virDomainDeviceDefPtr.
      
      * qemuDomainChangeNet previously checked for *some* changes to the
      interface config, but this check was by no means complete. It was also
      a bit disorganized.
      
      This refactoring of the code is (I believe) complete in its check of
      all NetDef attributes that might be changed, and either returns a
      failure (for changes that are simply impossible), or sets one of three
      flags:
      
        needLinkStateChange - if the device link state needs to go up/down
        needBridgeChange    - if everything else is the same, but it needs
                              to be connected to a difference linux host
                              bridge
        needReconnect       - if the entire host side of the device needs
                              to be torn down and reconstructed (currently
                              non-working, as mentioned above)
      
      Note that this function will refuse to make any change that requires
      the *guest* side of the device to be detached (e.g. changing the PCI
      address or mac address). Those would be disruptive enough to the guest
      that it's reasonable to require an explicit detach/attach sequence
      from the management application.
      
      * As mentioned above, qemuDomainChangeNet also does its best to
      understand when a simple change in attached bridge for the existing
      tap device will work vs. the need to completely tear down/reconstruct
      the host side of the device (including tap device).
      
      This patch *does not* implement the "reconnect" code anyway - there is
      a placeholder that turns that into an error. Rather, the purpose of
      this patch is to replicate existing behavior with code that is ready
      to have that functionality plugged in in a later patch.
      
      * The expanded uses for qemuDomainChangeNetBridge meant that it needed
      to be enhanced as well - it no longer replaces the original brname
      string in olddev with the new brname; instead, it relies on the
      caller to replace the *entire* olddev with newdev (since we've gone
      to great lengths to assure they are functionally identical other
      than the name of the bridge, this is now not only safe, but more
      correct). Additionally, qemuDomainNetChangeBridge can now set the
      bridge for type='network' interfaces as well as plain type='bridge'
      interfaces. (Note that I had to make this change simultaneous to the
      reorganization of qemuDomainChangeNet because the two are too
      closely intertwined to separate).
      6bde0a1a
    • G
      Fix tab vs space · a2b80edb
      Guido Günther 提交于
      that broke "make syntax-check"
      
      found by http://honk.sigxcpu.org:8001/job/libvirt-syntax-check/157/
      
      Pushed under the build breaker rule.
      a2b80edb
    • O
      qemu: Ignore def->cpumask if emulatorpin is specified · 3635b41e
      Osier Yang 提交于
      If the vcpu placement is "static", it's just fine to ignore the
      def->cpumask if emulatorpin is specified.
      3635b41e
    • O
      qemu: Initialize cpuset for hotplugged vcpu as def->cpuset · 0df1a790
      Osier Yang 提交于
      The onlined vcpu pinning policy should inherit def->cpuset if
      it's not specified explicitly, and the affinity should be set
      in this case. Oppositely, the offlined vcpu pinning policy should
      be free()'ed.
      0df1a790
    • O
      qemu: Create or remove cgroup when doing vcpu hotpluging · a9bfe887
      Osier Yang 提交于
      Various APIs use cgroup to either set or get the statistics of
      host or guest. Hotplug or hot unplug new vcpus without creating
      or removing the cgroup for the vcpus could cause problems for
      those APIs. E.g.
      
      % virsh vcpucount dom
      maximum      config        10
      maximum      live          10
      current      config         1
      current      live           1
      
      % virsh setvcpu dom 2
      
      % virsh schedinfo dom --set vcpu_quota=1000
      Scheduler      : posix
      error: Unable to find vcpu cgroup for rhel6.2(vcpu: 1): No such file or
      directory
      
      This patch fixes the problem by creating cgroups for each of the
      onlined vcpus, and destroying cgroups for each of the offlined
      vcpus.
      a9bfe887
  3. 12 10月, 2012 1 次提交
  4. 11 10月, 2012 7 次提交
    • P
      qemu: Fix misleading comment for qemuDomainObjBeginJobWithDriver() · 36f7dbf4
      Peter Krempa 提交于
      The comment stated that you may call qemuDomainObjBeginJobWithDriver
      without passing qemud_driver to signal it's not locked.
      qemuDomainObjBeginJobWithDriver still accesses the qemud_driver
      structure and the lock singaling is done through a separate parameter.
      36f7dbf4
    • J
      qemu: Make save/restore with USB devices usable · bd1282d6
      Jiri Denemark 提交于
      Save/restore with passed through USB devices currently only works if the
      USB device can be found at the same USB address where it used to be
      before saving a domain. This makes sense in case a user explicitly
      configure the USB address in domain XML. However, if the device was
      found automatically by vendor/product identification, we should try to
      search for that device when restoring the domain and use any device we
      find as long as there is only one available. In other words, the USB
      device can now be removed and plugged again or the host can be rebooted
      between saving and restoring the domain.
      bd1282d6
    • J
      Add MIGRATABLE flag for virDomainGetXMLDesc · 28f8dfdc
      Jiri Denemark 提交于
      Using VIR_DOMAIN_XML_MIGRATABLE flag, one can request domain's XML
      configuration that is suitable for migration or save/restore. Such XML
      may contain extra run-time stuff internal to libvirt and some default
      configuration may be removed for better compatibility of the XML with
      older libvirt releases.
      
      This flag may serve as an easy way to get the XML that can be passed
      (after desired modifications) to APIs that accept custom XMLs, such as
      virDomainMigrate{,ToURI}2 or virDomainSaveFlags.
      28f8dfdc
    • J
      edc9269a
    • J
      qemu: Add option to treat missing USB devices as success · 059aff6b
      Jiri Denemark 提交于
      All USB device lookup functions emit an error when they cannot find the
      requested device. With this patch, their caller can choose if a missing
      device is an error or normal condition.
      059aff6b
    • J
      qemu: Introduce qemuFindHostdevUSBDevice · 7bcc7278
      Jiri Denemark 提交于
      The code which looks up a USB device specified by hostdev is duplicated
      in two places. This patch creates a dedicated function that can be
      called in both places.
      7bcc7278
    • J
      locking: Pass hypervisor driver name when acquiring locks · d236f3fc
      Jiri Denemark 提交于
      This is required in case a lock manager needs to contact libvirtd in
      case of an unexpected event.
      d236f3fc
  5. 10 10月, 2012 1 次提交
    • D
      Change qemuSetSchedularParameters to use AFFECT_CURRENT · 4da9b2c1
      Daniel P. Berrange 提交于
      When adding variants of parameter setting APIs which accepted
      flags, the existing APIs were all adapted internally to pass
      VIR_DOMAIN_AFFECT_CURRENT to the new API. The QEMU impl
      qemuSetSchedularParameters was an exception, which instead
      used VIR_DOMAIN_AFFECT_LIVE. Change this to match other
      compatibility scenarios, so that calling
      
         virDomainSetSchedularParameters(dom, params, nparams);
      
      Has the same semantics as
      
         virDomainSetSchedularParametersFlags(dom, params, nparams, 0);
      
      And
      
         virDomainSetSchedularParametersFlags(dom, params, nparams, VIR_DOMAIN_AFFECT_CURRENT);
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      4da9b2c1
  6. 09 10月, 2012 3 次提交
    • M
      doc: update description about user/group in qemu.conf · 60dea2c6
      Marcelo Cerri 提交于
      As a side effect of changes in the functions virGetUserID and
      virGetGroupID, the user and group configurations for DAC in qemu.conf
      are now able to accept both names and IDs, supporting a leading plus
      sign to ensure that a numeric value will not be interpreted as a name.
      
      This patch updates the comments in qemu.conf, including a description of
      this new behavior.
      60dea2c6
    • J
      qemu: Fix QMP detection of QXL graphics · 844cdf22
      Jiri Denemark 提交于
      With the recent introduction of QMP capabilities probing, libvirt failed
      to detect support for QXL graphics in QEMU 1.2 and newer. In addition to
      fixing that, this patch also causes libvirt to detect QXL support for
      qemu-kvm-0.13.0, which doesn't advertise it in -help output but mentions
      it in device list. Since qemu-kvm-0.13.0 supported -spice, it looks like
      not having qxl in -help was a bug.
      844cdf22
    • M
      fix kvm_pv_eoi with kvmclock · 5d692cc7
      Martin Kletzander 提交于
      When both kvmclock and kvm_pv_eoi are configured (either disabled or
      enabled) libvirt will generate invalid CPU specification due to the
      fact that even though kvmclock causes the CPU to be specified, it
      doesn't set have_cpu flag to true (and the new kvm_pv_eoi as well).
      This patch fixes the issue and adds a test exactly for that to show
      that it is fixed correctly (and also to keep it that way in the future
      of course).
      5d692cc7
  7. 02 10月, 2012 3 次提交
    • E
      build: fix typo in debug message · 2b804cfa
      Eric Blake 提交于
      Introduced in commit 0caccb58.
      
        CC     libvirt_driver_qemu_impl_la-qemu_capabilities.lo
      ../../src/qemu/qemu_capabilities.c: In function 'qemuCapsInitQMP':
      ../../src/qemu/qemu_capabilities.c:2327:13: error: format '%d' expects argument of type 'int', but argument 8 has type 'const char *' [-Werror=format]
      
      * src/qemu/qemu_capabilities.c (qemuCapsInitQMP): Use correct format.
      2b804cfa
    • J
      qemu: Kill processes used for QMP caps probing · 0caccb58
      Jiri Denemark 提交于
      Since libvirt switched to QMP capabilities probing recently, it starts
      QEMU process used for this probing with -daemonize, which means
      virCommandAbort can no longer reach these processes. As a result of
      that, restarting libvirtd will leave several new QEMU processes behind.
      Let's use QEMU's -pidfile and use it to kill the process when QMP caps
      probing is done.
      0caccb58
    • P
      qemu: Use proper agent entering function when freezing filesystems · e0316b5e
      Peter Krempa 提交于
      When doing snapshots, the filesystem freeze function used the agent
      entering function that expects the qemud_driver unlocked. This might
      cause a deadlock of the qemu driver if the agent does not respond.
      
      The only call path of this function has the qemud_driver locked, so this
      patch changes the entering functions to those expecting the driver
      locked.
      e0316b5e
  8. 28 9月, 2012 7 次提交
  9. 27 9月, 2012 7 次提交