1. 19 1月, 2015 2 次提交
  2. 15 1月, 2015 1 次提交
    • J
      Fix vmdef usage while in monitor in qemu process · c749eda4
      Ján Tomko 提交于
      Make local copy of the disk alias in qemuProcessInitPasswords,
      instead of referencing the one in domain definition, which
      might get freed if the domain crashes while we're in monitor.
      
      Also copy the memballoon period value.
      c749eda4
  3. 14 1月, 2015 1 次提交
    • P
      qemu_process: detect updated video ram size values from QEMU · ce745914
      Pavel Hrdina 提交于
      QEMU internally updates the size of video memory if the domain XML had
      provided too low memory size or there are some dependencies for a QXL
      devices 'vgamem' and 'ram' size. We need to know about the changes and
      store them into the status XML to not break migration or managedsave
      through different libvirt versions.
      
      The values would be loaded only if the "vgamem_mb" property exists for
      the device.  The presence of the "vgamem_mb" also tells that the
      "ram_size" and "vram_size" exists for QXL devices.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      ce745914
  4. 21 12月, 2014 1 次提交
    • M
      qemu: completely rework reference counting · 540c339a
      Martin Kletzander 提交于
      There is one problem that causes various errors in the daemon.  When
      domain is waiting for a job, it is unlocked while waiting on the
      condition.  However, if that domain is for example transient and being
      removed in another API (e.g. cancelling incoming migration), it get's
      unref'd.  If the first call, that was waiting, fails to get the job, it
      unref's the domain object, and because it was the last reference, it
      causes clearing of the whole domain object.  However, when finishing the
      call, the domain must be unlocked, but there is no way for the API to
      know whether it was cleaned or not (unless there is some ugly temporary
      variable, but let's scratch that).
      
      The root cause is that our APIs don't ref the objects they are using and
      all use the implicit reference that the object has when it is in the
      domain list.  That reference can be removed when the API is waiting for
      a job.  And because each domain doesn't do its ref'ing, it results in
      the ugly checking of the return value of virObjectUnref() that we have
      everywhere.
      
      This patch changes qemuDomObjFromDomain() to ref the domain (using
      virDomainObjListFindByUUIDRef()) and adds qemuDomObjEndAPI() which
      should be the only function in which the return value of
      virObjectUnref() is checked.  This makes all reference counting
      deterministic and makes the code a bit clearer.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      540c339a
  5. 19 12月, 2014 2 次提交
    • D
      disable vCPU pinning with TCG mode · 65686e5a
      Daniel P. Berrange 提交于
      Although QMP returns info about vCPU threads in TCG mode, the
      data it returns is mostly lies. Only the first vCPU has a valid
      thread_id returned. The thread_id given for the other vCPUs is
      in fact the main emulator thread. All vCPUs actually run under
      the same thread in TCG mode.
      
      Our vCPU pinning code is not at all able to cope with this
      so if you try to set CPU affinity per-vCPU you end up with
      wierd errors
      
      error: Failed to start domain instance-00000007
      error: cannot set CPU affinity on process 24365: Invalid argument
      
      Since few people will care about the performance of TCG with
      strict CPU pinning, lets just disable that for now, so we get
      a clear error message
      
      error: Failed to start domain instance-00000007
      error: Requested operation is not valid: cpu affinity is not supported
      65686e5a
    • D
      Don't setup fake CPU pids for old QEMU · b07f3d82
      Daniel P. Berrange 提交于
      The code assumes that def->vcpus == nvcpupids, so when we setup
      fake CPU pids for old QEMU with nvcpupids == 1, we cause the
      later code to read off the end of the array. This has fun results
      like sche_setaffinity(0, ...) which changes libvirtd's own CPU
      affinity, or even better sched_setaffinity($RANDOM, ...) which
      changes the affinity of a random OS process.
      b07f3d82
  6. 16 12月, 2014 2 次提交
  7. 14 12月, 2014 2 次提交
    • L
      qemu: add a qemuInterfaceStopDevices(), called when guest CPUs stop · c5a54917
      Laine Stump 提交于
      We now have a qemuInterfaceStartDevices() which does the final
      activation needed for the host-side tap/macvtap devices that are used
      for qemu network connections. It will soon make sense to have the
      converse qemuInterfaceStopDevices() which will undo whatever was done
      during qemuInterfaceStartDevices().
      
      A function to "stop" a single device has also been added, and is
      called from the appropriate place in qemuDomainDetachNetDevice(),
      although this is currently unnecessary - the device is going to
      immediately be deleted anyway, so any extra "deactivation" will be for
      naught. The call is included for completeness, though, in anticipation
      that in the future there may be some required action that *isn't*
      nullified by deleting the device.
      
      This patch is a part of a more complete fix for:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1081461
      c5a54917
    • L
      qemu: always call qemuInterfaceStartDevices() when starting CPUs · 879c13d6
      Laine Stump 提交于
      The patch that added qemuInterfaceStartDevices() (upstream commit
      82977058) had an extra conditional to
      prevent calling it if the reason for starting the CPUs was
      VIR_DOMAIN_RUNNING_UNPAUSED or VIR_DOMAIN_RUNNING_SAVE_CANCELED.  This
      was put in by the author as the result of a reviewer asking if it was
      necessary to ifup the interfaces in *all* occasions (because these
      were the two cases where the CPU would have already been started (and
      stopped) once, so the interface would already be ifup'ed).
      
      It turns out that, as long as there is no corresponding
      qemuInterfaceStopDevices() to ifdown the interfaces anytime the CPUs
      are stopped, neglecting to ifup when reason is RUNNING_UNPAUSED or
      RUNNING_SAVE_CANCELED doesn't cause any problems (because it just
      happens that the interface will have already been ifup'ed by a prior
      call when the CPU was previously started for some other reason).
      
      However, it also doesn't *help*, and there will soon be a
      qemuInterfaceStopDevices() function which *will* ifdown these
      interfaces when the guest CPUs are stopped, and once that is done, the
      interfaces will be left down in some cases when they should be up (for
      example, if a domain is paused and then unpaused).
      
      So, this patch is removing the condition in favor of always calling
      qemuInterfaeStartDevices() when the guest CPUs are started.
      
      This patch (and the aforementioned patch) resolve:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=1081461
      879c13d6
  8. 11 12月, 2014 1 次提交
    • M
      network: Bring netdevs online later · 82977058
      Matthew Rosato 提交于
      Currently, MAC registration occurs during device creation, which is
      early enough that, during live migration, you end up with duplicate
      MAC addresses on still-running source and target devices, even though
      the target device isn't actually being used yet.
      This patch proposes to defer MAC registration until right before
      the guest can actually use the device -- In other words, right
      before starting guest CPUs.
      Signed-off-by: NMatthew Rosato <mjrosato@linux.vnet.ibm.com>
      Signed-off-by: NLaine Stump <laine@laine.org>
      82977058
  9. 04 12月, 2014 2 次提交
  10. 01 12月, 2014 2 次提交
  11. 28 11月, 2014 1 次提交
    • M
      qemu: Don't track quiesced state of FSs · 6085d917
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1160084
      
      As of b6d4dad1 (1.2.5) we are trying to keep the status of FSFreeze
      in the guest. Even though I've tried to fixed couple of corner cases
      (6ea54769), it occurred to me just recently, that the approach is
      broken by design. Firstly, there are many other ways to talk to
      qemu-ga (even through libvirt) that filesystems can be thawed (e.g.
      qemu-agent-command) without libvirt noticing. Moreover, there are
      plenty of ways to thaw filesystems without even qemu-ga noticing (yes,
      qemu-ga keeps internal track of FSFreeze status). So, instead of
      keeping the track ourselves, or asking qemu-ga for stale state, it's
      the best to let qemu-ga deal with that (and possibly let guest kernel
      propagate an error).
      
      Moreover, there's one bug with the following approach, if fsfreeze
      command failed, we've executed fsthaw subsequently. So issuing
      domfsfreeze in virsh gave the following result:
      
      virsh # domfsfreeze gentoo
      Froze 1 filesystem(s)
      
      virsh # domfsfreeze gentoo
      error: Unable to freeze filesystems
      error: internal error: unable to execute QEMU agent command 'guest-fsfreeze-freeze': The command guest-fsfreeze-freeze has been disabled for this instance
      
      virsh # domfsfreeze gentoo
      Froze 1 filesystem(s)
      
      virsh # domfsfreeze gentoo
      error: Unable to freeze filesystems
      error: internal error: unable to execute QEMU agent command 'guest-fsfreeze-freeze': The command guest-fsfreeze-freeze has been disabled for this instance
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      6085d917
  12. 24 11月, 2014 3 次提交
  13. 21 11月, 2014 4 次提交
    • P
      qemu: Add handling for VSERPORT_CHANGE event · 15bbaaf0
      Peter Krempa 提交于
      New qemu added a new event that is emitted when a virtio serial channel
      is opened in the guest OS. This allows us to update the state of the
      port in the output-only XML element.
      
      This patch implements the monitor callbacks and necessary handlers to
      update the state in the definition.
      15bbaaf0
    • P
      qemu: monitor: Rename and improve qemuMonitorGetPtyPaths · e9a45069
      Peter Krempa 提交于
      To unify future additions that require information from "query-chardev"
      rename qemuMonitorGetPtyPaths and friends to qemuMonitorGetChardevInfo
      and move the allocation of the returned hash into the top level
      function.
      e9a45069
    • P
      qemu: process: report useful error if alias formatting fails · 6692ba73
      Peter Krempa 提交于
      When retrieving the paths for PTY devices the alias gets formatted into
      a static string. If it doesn't fit we wouldn't report an error.
      6692ba73
    • P
      storage: qemu: Fix security labelling of new image chain elements · 7e130e8b
      Peter Krempa 提交于
      When creating a disk image snapshot the libvirt code would blindly copy
      the parents label to the newly created image. This runs into problems
      when you start a VM from an image hosted on NFS (or other storage system
      that doesn't support selinux labels) and the snapshot destination is on
      a storage system that does support selinux labels. Libvirt's code in
      that case generates a different security label for the image hosted on
      NFS. This label is valid only for NFS images and doesn't allow access in
      case of a locally stored image.
      
      To fix this issue libvirt needs to refrain from copying security
      information in cases where the default domain seclabel is a better
      choice.
      
      This patch repurposes the now unused @force argument of
      virStorageSourceInitChainElement to denote whether a copy of the
      security labelling stuff should be attempted or not. This allows to
      fine-control the copy operation for cases where we need to keep the
      label of the old disk vs. the cases where we need to keep the label
      unset to use the default domain imagelabel.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1151718
      7e130e8b
  14. 19 11月, 2014 1 次提交
  15. 15 11月, 2014 1 次提交
  16. 13 11月, 2014 2 次提交
  17. 06 11月, 2014 2 次提交
  18. 03 11月, 2014 1 次提交
  19. 31 10月, 2014 1 次提交
  20. 21 10月, 2014 1 次提交
    • Z
      qemu: move setting emulatorpin ahead of monitor showing up · 411cea63
      Zhou yimin 提交于
      If VM is configured with many devices(including passthrough devices)
      and large memory, libvirtd will take seconds(in the worst case) to
      wait for monitor. In this period the qemu process may run on any
      PCPU though I intend to pin emulator to the specified PCPU in xml
      configuration.
      
      Actually qemu process takes high cpu usage during vm startup.
      So this is not the strict CPU isolation in this case.
      Signed-off-by: NZhou yimin <zhouyimin@huawei.com>
      411cea63
  21. 07 10月, 2014 1 次提交
    • L
      qemu: setup infrastructure to handle NIC_RX_FILTER_CHANGED event · b6bdda45
      Laine Stump 提交于
      NIC_RX_FILTER_CHANGED is sent by qemu any time a NIC driver in the
      guest modified the NIC's RX Filter (for example, if the MAC address of
      the NIC is changed by the guest).
      
      This patch doesn't do anything useful with that event; it just sets up
      all the plumbing to get news of the event into a worker thread with
      all proper locking/reference counting, and provide an easy place to
      add in desired functionality.
      
      See src/qemu/EVENTHANDLERS.txt for information/instructions on adding
      a libvirt-internal handler for a qemu event (using
      NIC_RX_FILTER_CHANGED as an example).
      b6bdda45
  22. 02 10月, 2014 1 次提交
    • G
      qemu: use systemd's TerminateMachine to kill all processes · 4882618e
      Guido Günther 提交于
      If we don't properly clean up all processes in the
      machine-<vmname>.scope systemd won't remove the cgroup and subsequent vm
      starts fail with
      
        'CreateMachine: File exists'
      
      Additional processes can e.g. be added via
      
        echo $PID > /sys/fs/cgroup/systemd/machine.slice/machine-${VMNAME}.scope/tasks
      
      but there are other cases like
      
        http://bugs.debian.org/761521
      
      Invoke TerminateMachine to be on the safe side since systemd tracks the
      cgroup anyway. This is a noop if all processes have terminated already.
      4882618e
  23. 30 9月, 2014 1 次提交
    • J
      Don't verify CPU features with host-passthrough · ec5f817f
      Ján Tomko 提交于
      Commit fba6bc47 introduced the non-migratable invtsc feature,
      breaking save/migration with host-model and host-passthrough.
      
      On hosts with this feature present it was automatically included
      in the CPU definition, regardless of QEMU support.
      
      Commit de0aeafe stopped including it by default for host-model,
      but failed to fix host-passthrough.
      
      This commit ignores checking of CPU features with host-passthrough,
      since we don't pass them to QEMU (only -cpu host is passed),
      allowing domains using host-passthrough that were saved with
      the broken version of libvirtd to be restored.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1147584
      ec5f817f
  24. 26 9月, 2014 1 次提交
    • M
      qemuPrepareNVRAM: Save domain after NVRAM path generation · 3a3c3780
      Michal Privoznik 提交于
      On a domain startup, the variable store path is generated if needed.
      The path is intended to be generated only once. However, the updated
      domain definition is not saved into config dir rather than state XML
      only. So later, whenever the domain is destroyed and the daemon is
      restarted, the generated path is forgotten and the file may be left
      behind on virDomainUndefine() call.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      3a3c3780
  25. 24 9月, 2014 1 次提交
    • P
      qemu: Report better errors from broken backing chains · 639a0098
      Peter Krempa 提交于
      Request erroring out from the backing chain traveller and drop qemu's
      internal backing chain integrity tester.
      
      The backing chain traveller reports errors by itself with possibly more
      detail than qemuDiskChainCheckBroken ever could.
      
      We also need to make sure that we reconnect to existing qemu instances
      even at the cost of losing the backing chain info (this really should be
      stored in the XML rather than reloaded from disk, but that needs some
      work).
      639a0098
  26. 19 9月, 2014 2 次提交