1. 30 9月, 2011 1 次提交
    • M
      qemu: Check for outstanding async job too · a111b9e2
      Michal Privoznik 提交于
      Currently, qemuDomainGetXMLDesc and qemudDomainGetInfo check for
      outstanding synchronous job before (eventual) monitor entering.
      However, there can be already async job set, e.g. migration.
      a111b9e2
  2. 29 9月, 2011 4 次提交
  3. 28 9月, 2011 5 次提交
  4. 27 9月, 2011 3 次提交
    • 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
    • J
      qemu: Relax -no-shutdown check to [0.14.0, 0.15.50) · 75e31492
      Jiri Denemark 提交于
      SIGTERM handling for -no-shutdown is already fixed in qemu git and
      libvirt can safely use it. The downside is that 0.15.50 version of qemu
      can be any qemu compiled from git, even that without the fix for
      SIGTERM. However, I think this patch is worth it since excluding 0.15.50
      from the check makes testing current qemu with libvirt much easier and
      someone running qemu from git should be able to rebuild fixed qemu from
      git if they hit the problem with a hang on shutdown.
      75e31492
    • M
      debug: Annotate some variables as unused · 45ad3d69
      Michal Privoznik 提交于
      as they are not used with debugging turned off.
      45ad3d69
  5. 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
  6. 22 9月, 2011 6 次提交
    • M
      qemu: Transfer inactive XML among cookie · c42e1c39
      Michal Privoznik 提交于
      If a domain has inactive XML we want to transfer it to destination
      when migrating with VIR_MIGRATE_PERSIST_DEST. In order to harm
      the migration protocol as least as possible, a optional cookie was
      chosen.
      c42e1c39
    • E
      snapshot: also delete empty directory · 61dbee0e
      Eric Blake 提交于
      The previous patch removed all snapshots, but not the directory
      where the snapshots lived, which is still a form of stale data.
      
      * src/qemu/qemu_domain.c (qemuDomainRemoveInactive): Wipe any
      snapshot directory.
      61dbee0e
    • E
      snapshot: remove snapshot metadata on transient exit · e485dcc9
      Eric Blake 提交于
      Commit 282fe1f0 documented that transient domains will auto-delete
      any snapshot metadata when the last reference to the domain is
      removed, and that management apps are in charge of grabbing any
      snapshot metadata prior to that point.  However, this was not
      actually implemented for qemu until now.
      
      * src/qemu/qemu_driver.c (qemudDomainCreate)
      (qemuDomainDestroyFlags, qemuDomainSaveInternal)
      (qemudDomainCoreDump, qemuDomainRestoreFlags, qemudDomainDefine)
      (qemuDomainUndefineFlags, qemuDomainMigrateConfirm3)
      (qemuDomainRevertToSnapshot): Clean up snapshot metadata.
      * src/qemu/qemu_migration.c (qemuMigrationPrepareAny)
      (qemuMigrationPerformJob, qemuMigrationPerformPhase)
      (qemuMigrationFinish): Likewise.
      * src/qemu/qemu_process.c (qemuProcessHandleMonitorEOF)
      (qemuProcessReconnect, qemuProcessReconnectHelper)
      (qemuProcessAutoDestroyDom): Likewise.
      e485dcc9
    • E
      snapshot: prepare to remove transient snapshot metadata · bcf974b9
      Eric Blake 提交于
      This patch is mostly code motion - moving some functions out
      of qemu_driver and into qemu_domain so they can be reused by
      multiple qemu_* files (since qemu_driver.h must not grow).
      It also adds a new helper function, qemuDomainRemoveInactive,
      which will be used in the next patch.
      
      * src/qemu/qemu_domain.h (qemuFindQemuImgBinary)
      (qemuDomainSnapshotWriteMetadata, qemuDomainSnapshotForEachQcow2)
      (qemuDomainSnapshotDiscard, qemuDomainSnapshotDiscardAll)
      (qemuDomainRemoveInactive): New prototypes.
      (struct qemu_snap_remove): New struct.
      * src/qemu/qemu_domain.c (qemuDomainRemoveInactive)
      (qemuDomainSnapshotDiscardAllMetadata): New functions.
      (qemuFindQemuImgBinary, qemuDomainSnapshotWriteMetadata)
      (qemuDomainSnapshotForEachQcow2, qemuDomainSnapshotDiscard)
      (qemuDomainSnapshotDiscardAll): Move here...
      * src/qemu/qemu_driver.c (qemuFindQemuImgBinary)
      (qemuDomainSnapshotWriteMetadata, qemuDomainSnapshotForEachQcow2)
      (qemuDomainSnapshotDiscard, qemuDomainSnapshotDiscardAll): ...from
      here.
      (qemuDomainUndefineFlags): Update caller.
      * src/conf/domain_conf.c (virDomainRemoveInactive): Doc fixes.
      bcf974b9
    • E
      snapshot: fix logic bug in qemu undefine · e6966fa7
      Eric Blake 提交于
      Commit 19f8c980 introduced VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA,
      with the intent that omitting the flag makes undefine fail, and
      including the flag deletes metadata.  But it used the wrong logic.
      Also, hoist the transient domain sooner, so that we don't
      accidentally remove metadata of a transient domain.
      
      * src/qemu/qemu_driver.c (qemuDomainUndefineFlags): Check correct
      flag value.
      e6966fa7
    • A
      qemu: avoid dereferencing a NULL pointer · d93a08eb
      Alex Jia 提交于
      * src/qemu/qemu_process.c: Taking if (qemuDomainObjEndJob(driver, obj) == 0)
        true branch then 'obj' is NULL, virDomainObjIsActive(obj) and
        virDomainObjUnref(obj) will dereference NULL pointer.
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      d93a08eb
  7. 21 9月, 2011 3 次提交
    • J
      qemu: Avoid loop of fake reboots · 3abadf82
      Jiri Denemark 提交于
      Once virDomainReboot is called for a domain, guest OS initiated shutdown
      would always result in reboot instead of shutdown. Only
      virDomainShutdown would actually shutd such domain down. That's because
      we forgot to reset fakeReboot flag once we asked the domain to reboot.
      3abadf82
    • J
      qemu: Fix shutdown regression with buggy qemu · f84aedad
      Jiri Denemark 提交于
      The commit that prevents disk corruption on domain shutdown
      (96fc4784) causes regression with QEMU
      0.14.* and 0.15.* because of a regression bug in QEMU that was fixed
      only recently in QEMU git. The affected versions of QEMU do not quit on
      SIGTERM if started with -no-shutdown, which we use to implement fake
      reboot. Since -no-shutdown tells QEMU not to quit automatically on guest
      shutdown, domains started using the affected QEMU cannot be shutdown
      properly and stay in a paused state.
      
      This patch disables fake reboot feature on such QEMU by not using
      -no-shutdown, which makes shutdown work as expected. However,
      virDomainReboot will not work in this case and it will report "Requested
      operation is not valid: Reboot is not supported with this QEMU binary".
      f84aedad
    • E
      build: silence warning on 32-bit build · ad4036c3
      Eric Blake 提交于
      gcc warns when building libvirt 0.9.5 on a 32-bit machine:
      
      qemu/qemu_migration.c: In function 'qemuMigrationToFile':
      qemu/qemu_migration.c:2727:38: error: large integer implicitly truncated to unsigned type [-Woverflow]
      
      * src/qemu/qemu_domain.h (QEMU_DOMAIN_FILE_MIG_BANDWIDTH_MAX): Cap
      to long when building for 32-bit platform.
      ad4036c3
  8. 20 9月, 2011 2 次提交
    • P
      virsh: doc: Fix supported driver types for attach-disk command · 2ad83bf4
      Peter Krempa 提交于
      Virsh man page lists driver types to be used with attach-device
      command, but does not specify that those are usable only with the XEN
      Hypervisor.
      
      This patch adds statement, that those options specified are applicable
      only on the Xen hypervisor and adds option usable with qemu emulator.
      
      This patch also changes type of error returned by QEMU driver if the
      user specifies incompatible driver type from VIR_ERR_INTERNAL_ERROR to
      VIR_ERR_CONFIG_UNSUPPORTED.
      2ad83bf4
    • A
      qemu: avoid memory leak · db3b32c4
      ajia@redhat.com 提交于
      Leak introduced in commit 036ad505, affects only error case.
      
      * src/qemu/qemu_command.c: fix memory leak.
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      db3b32c4
  9. 17 9月, 2011 3 次提交
    • E
      snapshot: allow disk snapshots of qcow2 disks · 43c2641c
      Eric Blake 提交于
      For all types of disks other than qcow2, we were requesting that
      SELinux labeling visit the new file as if it were qcow2, which
      means labeling would try to find the backing files of an empty file.
      And for a pre-existing qcow2 disk, we were passing NULL, which meant
      that labelling tried to probe the file type (and if probing is
      disabled, per the default qemu.conf, this made snapshots fail).
      What we really want is to make SELinux labeling visit the new
      file as raw; it will later be converted to qcow2 if qemu successfully
      made the snapshot.
      
      * src/qemu/qemu_driver.c
      (qemuDomainSnapshotCreateSingleDiskActive): Force SELinux labeling
      to avoid probe of new file.
      43c2641c
    • E
      snapshot: affect persistent xml after disk snapshot · 2895905a
      Eric Blake 提交于
      For external snapshots to be useful on persistent domains, we must
      alter the persistent definition alongside the running definition.
      Thanks to the possibility of disk hotplug as well as of edits that
      only affect the persistent xml, we can't assume that vm->def and
      vm->newDef have the same disk at the same index, so we can only
      update the persistent copy if the device destination matches up.
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateDiskActive)
      (qemuDomainSnapshotCreateSingleDiskActive): Also affect newDef, if
      present.
      2895905a
    • A
      qemu: add return value check · 14c22b3b
      Alex Jia 提交于
      * src/qemu/qemu_command.c: missing return value check.
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      14c22b3b
  10. 16 9月, 2011 6 次提交
    • J
      qemu: Introduce shutdown reason for paused state · d2d67763
      Jiri Denemark 提交于
      Qemu sends STOP event as part of the shutdown process. Detect such STOP
      event and consider shutdown to be reason of emitting such event. That's
      the best we can do until qemu provides us the reason directly in STOP
      event. This allows us to report shutdown reason for paused state so that
      apps can detect domains that failed to finish the shutdown process
      (e.g., because qemu is buggy and doesn't exit on SIGTERM or it is
      blocked in flushing disk buffers).
      d2d67763
    • J
      qemu: Prevent disk corruption on domain shutdown · 96fc4784
      Jiri Denemark 提交于
      Ever since we introduced fake reboot, we call qemuProcessKill as a
      reaction to SHUTDOWN event. Unfortunately, qemu doesn't guarantee it
      flushed all internal buffers before sending SHUTDOWN, in which case
      killing the process forcibly may result in (virtual) disk corruption.
      
      By sending just SIGTERM without SIGKILL we give qemu time to to flush
      all buffers and exit. Once qemu exits, we will see an EOF on monitor
      connection and tear down the domain. In case qemu ignores SIGTERM or
      just hangs there, the process stays running but that's not any different
      from a possible hang anytime during the shutdown process so I think it's
      just fine.
      
      Also qemu (since 0.14 until it's fixed) has a bug in SIGTERM processing
      which causes it not to exit but instead send new SHUTDOWN event and keep
      waiting. I think the best we can do is to ignore duplicate SHUTDOWN
      events to avoid a SHUTDOWN-SIGTERM loop and leave the domain in paused
      state.
      96fc4784
    • J
      qemu: Properly detect crash of a rebooted domain · c2e9fab2
      Jiri Denemark 提交于
      When a domain is rebooted using libvirt API, we use fake reboot
      consisting of shutting down and resetting the domain. Thus we see a
      SHUTDOWN event and set gotShutdown flag. But we never reset it back and
      if the domain crashes after it was rebooted this way, we consider it was
      a normal shutdown and not a crash.
      c2e9fab2
    • J
      qemu: Fix shutoff reason when domain crashes · 3acb664c
      Jiri Denemark 提交于
      Commit 4454a9ef changed shutoff reason
      from VIR_DOMAIN_SHUTOFF_CRASHED to VIR_DOMAIN_SHUTOFF_FAILED in case we
      see an unexpected EOF on monitor connection. But FAILED reason is
      dedicated for domains that fail to start. CRASHED reason is the right
      one to use in this situation.
      3acb664c
    • S
      Fix buzzilla 738778 · 3f2cb3ab
      Stefan Berger 提交于
      This patch fixes the bug shown in bugzilla 738778. It's not an nwfilter problem but a connection sharing / closure issue.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=738778
      
      Depending on the speed / #CPUs of the machine you are using you may not see this bug all the time.
      3f2cb3ab
    • P
      Avoid using "devname" as an identifier. · 79cf07af
      Peter Krempa 提交于
      /usr/lib/stdlib.h in Mac OS X and probably also in BSD's
      exports this symbol :(
      79cf07af
  11. 15 9月, 2011 6 次提交