1. 03 9月, 2011 4 次提交
    • E
      snapshot: properly revert qemu to offline snapshots · 25fb3ef1
      Eric Blake 提交于
      Commit 5e47785b broke reverts to offline system checkpoint snapshots
      with older qemu, since there is no longer any code path to use
      qemu -loadvm on next boot.  Meanwhile, reverts to offline system
      checkpoints have been broken for newer qemu, both before and
      after that commit, since -loadvm no longer works to revert to
      disk state without accompanying vm state.  Fix both of these by
      using qemu-img to revert disk state.
      
      Meanwhile, consolidate the (now 3) clients of a qemu-img iteration
      over all disks of a VM into one function, so that any future
      algorithmic fixes to the FIXMEs in that function after partial
      loop iterations are dealt with at once.  That does mean that this
      patch doesn't handle partial reverts very well, but we're not
      making the situation any worse in this patch.
      
      * src/qemu/qemu_driver.c (qemuDomainRevertToSnapshot): Use
      qemu-img rather than 'qemu -loadvm' to revert to offline snapshot.
      (qemuDomainSnapshotRevertInactive): New helper.
      (qemuDomainSnapshotCreateInactive): Factor guts...
      (qemuDomainSnapshotForEachQcow2): ...into new helper.
      (qemuDomainSnapshotDiscard): Use it.
      25fb3ef1
    • E
      snapshot: improve reverting to qemu paused snapshots · 88fe7a4b
      Eric Blake 提交于
      If you take a checkpoint snapshot of a running domain, then pause
      qemu, then restore the snapshot, the result should be a running
      domain, but the code was leaving things paused.  Furthermore, if
      you take a checkpoint of a paused domain, then run, then restore,
      there was a brief but non-deterministic window of time where the
      domain was running rather than paused.  Fix both of these
      discrepancies by always pausing before restoring.
      
      Also, check that the VM is active every time lock is dropped
      between two monitor calls.
      
      Finally, straighten out the events that get emitted on each
      transition.
      
      * src/qemu/qemu_driver.c (qemuDomainRevertToSnapshot): Always
      pause before reversion, and improve events.
      88fe7a4b
    • E
      snapshot: fine-tune qemu saved images starting paused · 7381aaff
      Eric Blake 提交于
      Implement the new running/paused overrides for saved state management.
      
      Unfortunately, for virDomainSaveImageDefineXML, the saved state
      updates are write-only - I don't know of any way to expose a way
      to query the current run/pause setting of an existing save image
      file to the user without adding a new API or modifying the domain
      xml of virDomainSaveImageGetXMLDesc to include a new element to
      reflect the state bit encoded into the save image.  However, I
      don't think this is a show-stopper, since the API is designed to
      leave the state bit alone unless an explicit flag is used to
      change it.
      
      * src/qemu/qemu_driver.c (qemuDomainSaveInternal)
      (qemuDomainSaveImageOpen): Adjust signature.
      (qemuDomainSaveFlags, qemuDomainManagedSave)
      (qemuDomainRestoreFlags, qemuDomainSaveImageGetXMLDesc)
      (qemuDomainSaveImageDefineXML, qemuDomainObjRestore): Adjust
      callers.
      7381aaff
    • E
      snapshot: better events when starting paused · c1ff5dc6
      Eric Blake 提交于
      There are two classes of management apps that track events - one
      that only cares about on/off (and only needs to track EVENT_STARTED
      and EVENT_STOPPED), and one that cares about paused/running (also
      tracks EVENT_SUSPENDED/EVENT_RESUMED).  To keep both classes happy,
      any transition that can go from inactive to paused must emit two
      back-to-back events - one for started and one for suspended (since
      later resuming of the domain will only send RESUMED, but the first
      class isn't tracking that).
      
      This also fixes a bug where virDomainCreateWithFlags with the
      VIR_DOMAIN_START_PAUSED flag failed to start paused when restoring
      from a managed save image.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_EVENT_SUSPENDED_RESTORED)
      (VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT)
      (VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT): New sub-events.
      * src/qemu/qemu_driver.c (qemuDomainRevertToSnapshot): Use them.
      (qemuDomainSaveImageStartVM): Likewise, and add parameter.
      (qemudDomainCreate, qemuDomainObjStart): Send suspended event when
      starting paused.
      (qemuDomainObjRestore): Add parameter.
      (qemuDomainObjStart, qemuDomainRestoreFlags): Update callers.
      * examples/domain-events/events-c/event-test.c
      (eventDetailToString): Map new detail strings.
      c1ff5dc6
  2. 02 9月, 2011 5 次提交
    • M
      Add "redirdev" redirection device · 162efa1a
      Marc-André Lureau 提交于
      - create a new "redirdev" element for this purpose
      162efa1a
    • E
      snapshot: fix corner case on OOM during creation · c554f6e1
      Eric Blake 提交于
      Commit 6766ff10 introduced a corner case bug with snapshot creation:
      if a snapshot is created, but then we hit OOM while trying to
      create the return value of the function, then we have polluted the
      internal directory with the snapshot metadata with no way to clean
      it up from the running libvirtd.
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): Don't
      write metadata file on OOM condition.
      c554f6e1
    • E
      qemu: detect incomplete save files · 55d88def
      Eric Blake 提交于
      Several users have reported problems with 'virsh start' failing because
      it was encountering a managed save situation where the managed save file
      was incomplete.  Be more robust to this by using two different magic
      numbers, so that newer libvirt can gracefully handle an incomplete file
      differently than a complete one, while older libvirt will at least fail
      up front rather than trying to load only to have qemu fail at the end.
      
      Managed save is a convenience - it exists to preserve as much state
      as possible; if the state was not preserved, it is reasonable to just
      log that fact, then proceed with a fresh boot.  On the other hand,
      user saves are under user control, so we must fail, but by making
      the failure message distinct, the user can better decide how to handle
      the situation of an incomplete save file.
      
      * src/qemu/qemu_driver.c (QEMUD_SAVE_PARTIAL): New define.
      (qemuDomainSaveInternal): Use it to mark incomplete images.
      (qemuDomainSaveImageOpen, qemuDomainObjRestore): Add parameter
      that controls what to do with partial images.
      (qemuDomainRestoreFlags, qemuDomainSaveImageGetXMLDesc)
      (qemuDomainSaveImageDefineXML, qemuDomainObjStart): Update callers.
      Based on an initial idea by Osier Yang.
      55d88def
    • E
      qemu: refactor file opening · 449ae9c2
      Eric Blake 提交于
      In a SELinux or root-squashing NFS environment, libvirt has to go
      through some hoops to create a new file that qemu can then open()
      by name.  Snapshots are a case where we want to guarantee an empty
      file that qemu can open; also, reopening a save file to convert it
      from being marked partial to complete requires a reopen to avoid
      O_DIRECT headaches.  Refactor some existing code to make it easier
      to reuse in later patches.
      
      * src/qemu/qemu_migration.h (qemuMigrationToFile): Drop parameter.
      * src/qemu/qemu_migration.c (qemuMigrationToFile): Let cgroup do
      the stat, rather than asking caller to do it and pass info down.
      * src/qemu/qemu_driver.c (qemuOpenFile): New function, pulled from...
      (qemuDomainSaveInternal): ...here.
      (doCoreDump, qemuDomainSaveImageOpen): Use it here as well.
      449ae9c2
    • A
      BlockPull: Set initial bandwidth limit if specified · d4b9e062
      Adam Litke 提交于
      The libvirt BlockPull API supports the use of an initial bandwidth limit but the
      qemu block_stream API does not.  To get the desired behavior we use the two APIs
      strung together: first BlockPull, then BlockJobSetSpeed.  We can do this at the
      driver level to avoid duplicated code in each monitor path.
      Signed-off-by: NAdam Litke <agl@us.ibm.com>
      d4b9e062
  3. 01 9月, 2011 1 次提交
  4. 31 8月, 2011 1 次提交
    • E
      snapshot: forbid snapshot on autodestroy domain · 173015be
      Eric Blake 提交于
      There is no reason to forbid pausing an autodestroy domain
      (not to mention that 'virsh start --paused --autodestroy'
      succeeds in creating a paused autodestroy domain).
      
      Meanwhile, qemu was failing to enforce the API documentation that
      autodestroy domains cannot be saved.  And while the original
      documentation only mentioned save/restore, snapshots are another
      form of saving that are close enough in semantics as to make no
      sense on one-shot domains.
      
      * src/qemu/qemu_driver.c (qemudDomainSuspend): Drop bogus check.
      (qemuDomainSaveInternal, qemuDomainSnapshotCreateXML): Forbid
      saves of autodestroy domains.
      * src/libvirt.c (virDomainCreateWithFlags, virDomainCreateXML):
      Document snapshot interaction.
      173015be
  5. 30 8月, 2011 1 次提交
    • E
      start: allow discarding managed save · 27c85260
      Eric Blake 提交于
      There have been several instances of people having problems with
      a broken managed save file, and not aware that they could use
      'virsh managedsave-remove dom' to fix things.  Making it possible
      to do this as part of starting a domain makes the same functionality
      easier to find, and one less API call.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_START_FORCE_BOOT): New
      flag.
      * src/libvirt.c (virDomainCreateWithFlags): Document it.
      * src/qemu/qemu_driver.c (qemuDomainObjStart): Alter signature.
      (qemuAutostartDomain, qemuDomainStartWithFlags): Update callers.
      * tools/virsh.c (cmdStart): Expose it in virsh.
      * tools/virsh.pod (start): Document it.
      27c85260
  6. 26 8月, 2011 4 次提交
    • D
      Fix keymap used to talk with QEMU · ce93f64b
      Daniel P. Berrange 提交于
      The QEMU 'sendkey' command expects keys to be encoded in the same
      way as the RFB extended keycode set. Specifically it wants extended
      keys to have the high bit of the first byte set, while the Linux
      XT KBD driver codeset uses the low bit of the second byte. To deal
      with this we introduce a new keymap 'RFB' and use that in the QEMU
      driver
      
      * include/libvirt/libvirt.h.in: Add VIR_KEYCODE_SET_RFB
      * src/qemu/qemu_driver.c: Use RFB keycode set instead of XT KBD
      * src/util/virkeycode-mapgen.py: Auto-generate the RFB keycode
        set from the XT KBD set
      * src/util/virkeycode.c: Add RFB keycode entry to table. Add a
        verify check on cardinality of the codeOffset table
      ce93f64b
    • E
      snapshot: track current snapshot across restarts · 6766ff10
      Eric Blake 提交于
      Audit all changes to the qemu vm->current_snapshot, and make them
      update the saved xml file for both the previous and the new
      snapshot, so that there is always at most one snapshot with
      <active>1</active> in the xml, and that snapshot is used as the
      current snapshot even across libvirtd restarts.
      
      This patch does not fix the case of virDomainSnapshotDelete(,CHILDREN)
      where one of the children is the current snapshot; that will be later.
      
      * src/conf/domain_conf.h (_virDomainSnapshotDef): Alter member
      type and name.
      * src/conf/domain_conf.c (virDomainSnapshotDefParseString)
      (virDomainSnapshotDefFormat): Update clients.
      * docs/schemas/domainsnapshot.rng: Tighten rng.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotLoad): Reload current
      snapshot.
      (qemuDomainSnapshotCreateXML, qemuDomainRevertToSnapshot)
      (qemuDomainSnapshotDiscard): Track current snapshot.
      6766ff10
    • E
      snapshot: only pass snapshot to qemu command line when reverting · 5e47785b
      Eric Blake 提交于
      Changing the current vm, and writing that change to the file
      system, all before a new qemu starts, is risky; it's hard to
      roll back if starting the new qemu fails for some reason.
      Instead of abusing vm->current_snapshot and making the command
      line generator decide whether the current snapshot warrants
      using -loadvm, it is better to just directly pass a snapshot all
      the way through the call chain if it is to be loaded.
      
      This frees up the last use of snapshot->def->active for qemu's
      use, so the next patch can repurpose that field for tracking
      which snapshot is current.
      
      * src/qemu/qemu_command.c (qemuBuildCommandLine): Don't use active
      field of snapshot.
      * src/qemu/qemu_process.c (qemuProcessStart): Add a parameter.
      * src/qemu/qemu_process.h (qemuProcessStart): Update prototype.
      * src/qemu/qemu_migration.c (qemuMigrationPrepareAny): Update
      callers.
      * src/qemu/qemu_driver.c (qemudDomainCreate)
      (qemuDomainSaveImageStartVM, qemuDomainObjStart)
      (qemuDomainRevertToSnapshot): Likewise.
      (qemuDomainSnapshotSetCurrentActive)
      (qemuDomainSnapshotSetCurrentInactive): Delete unused functions.
      5e47785b
    • E
      snapshot: don't leak resources on qemu snapshot failure · 861dc84b
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=727709
      mentions that if qemu fails to create the snapshot (such as what
      happens on Fedora 15 qemu, which has qmp but where savevm is only
      in hmp, and where libvirt is old enough to not try the hmp fallback),
      then 'virsh snapshot-list dom' will show a garbage snapshot entry,
      and the libvirt internal directory for storing snapshot metadata
      will have a bogus file.
      
      This fixes the fallout bug of polluting the snapshot-list with
      garbage on failure (the root cause of the F15 bug of not having
      fallback to hmp has already been fixed in newer libvirt releases).
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): Allocate
      memory before making snapshot, and cleanup on failure.  Don't
      dereference NULL if transient domain exited during snapshot creation.
      861dc84b
  7. 24 8月, 2011 1 次提交
    • E
      maint: fix comment typos · 3a52b864
      Eric Blake 提交于
      * src/qemu/qemu_driver.c (qemuDomainSaveInternal): Fix typo.
      * src/conf/domain_event.c (virDomainEventDispatchMatchCallback):
      Likewise.
      * daemon/libvirtd.c (daemonRunStateInit): Likewise.
      * src/lxc/lxc_container.c (lxcContainerChildMountSort): Likewise.
      * src/util/virterror.c (virCopyError, virRaiseErrorFull): Likewise.
      * src/xenxs/xen_sxpr.c (xenParseSxprSound): Likewise.
      3a52b864
  8. 23 8月, 2011 1 次提交
    • O
      qemu: Cleanup improper VIR_ERR_NO_SUPPORT use · 4340b3ba
      Osier Yang 提交于
      * src/qemu/qemu_command.c: s/VIR_ERR_NO_SUPPORT/VIR_ERR_CONFIG_UNSUPPORTED/
      
      * src/qemu/qemu_driver.c: s/VIR_ERR_NO_SUPPORT/VIR_ERR_OPERATION_INVALID/
      
      * src/qemu/qemu_process.c: s/VIR_ERR_NO_SUPPORT/VIR_ERR_OPERATION_INVALID/
      4340b3ba
  9. 19 8月, 2011 1 次提交
  10. 12 8月, 2011 1 次提交
    • E
      qemu: silence clang false positive · 398ce48d
      Eric Blake 提交于
      Our logic throws off analyzer tools:
      
      ptr var = NULL;
      if (flags == 0) flags = live ? _LIVE : _CONFIG;
      if (flags & _LIVE) do stuff
      if (flags & _CONFIG) var = non-null;
      if (flags & _LIVE) do more stuff
      else if (flags & _CONFIG) use var
      
      the tools keep thinking that var can still be NULL in the last
      if clause, adding the hint shuts them up.
      
      * src/qemu/qemu_driver.c (qemuDomainSetBlkioParameters): Add a
      static analysis hint.
      398ce48d
  11. 11 8月, 2011 1 次提交
    • E
      managedsave: prohibit use on transient domains · 0de75e85
      Eric Blake 提交于
      Transient domains reject attempts to set autostart, and using
      virDomainCreate to restart a domain only works on persistent
      domains.  Therefore, managed save makes no sense on transient
      domains, and should be rejected up front rather than creating
      an otherwise unrecoverable managed save file.
      
      Besides, transient domains imply that a lot more management is
      being done by the upper layer; this includes the assumption
      that the upper layer is okay managing the saved state file
      created by virDomainSave, and does not need to use managed save.
      
      * src/libvirt.c: Document that transient domains are incompatible
      with managed save.
      * src/qemu/qemu_driver.c (qemuDomainManagedSave): Enforce it.
      * src/libxl/libxl_driver.c (libxlDomainManagedSave): Likewise.
      0de75e85
  12. 10 8月, 2011 2 次提交
    • E
      qemu: minor formatting cleanup · cdbb27e3
      Eric Blake 提交于
      I noticed some inconsistent use of 'else'.
      
      * src/qemu/qemu_driver.c (qemuCPUCompare)
      (qemuDomainSnapshotCreateXML, qemuDomainRevertToSnapshot)
      (qemuDomainSnapshotDiscard): Match coding conventions.
      cdbb27e3
    • P
      Fix memory leak while scanning snapshots · 839a5295
      Philipp Hahn 提交于
      If a snapshot with the name already exists, virDomainSnapshotAssignDef()
      just returns NULL, in which case the snapshot definition is leaked.
      Currently this leak is not a big problem, since qemuDomainSnapshotLoad()
      is only called once during initial startup of libvirtd.
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      839a5295
  13. 03 8月, 2011 5 次提交
    • E
      qemu: silence coverity false positives · f768b4c3
      Eric Blake 提交于
      Coverity gets confused by our logic.  Add some hints to silence
      false positives.
      
      * src/qemu/qemu_driver.c (qemudDomainGetVcpuPinInfo): Add hint.
      (qemuDomainGetMemoryParameters): Likewise.
      f768b4c3
    • E
      qemu: plug child process leak on domain core dump · 0c1813f4
      Eric Blake 提交于
      Detected by Coverity.  Leak introduced by typo in commit 58e668d2.
      
      * src/qemu/qemu_driver.c (doCoreDump): Use correct function.
      0c1813f4
    • E
      fdstream: drop delete argument · 00ef048f
      Eric Blake 提交于
      Revert 6a1f5f56.  Now that libvirt_iohelper takes fds by
      inheritance rather than by open() (commit 1eb66479), there is
      no longer a race where the parent can unlink() a file prior to
      the iohelper open()ing the same file.  From there, it makes
      more sense to have the callers both create and unlink, rather
      than the caller create and the stream unlink, since the latter
      was only needed when iohelper had to do the unlink.
      
      * src/fdstream.h (virFDStreamOpenFile, virFDStreamCreateFile):
      Callers are responsible for deletion.
      * src/fdstream.c (virFDStreamOpenFileInternal): Don't leak created
      file on failure.
      (virFDStreamOpenFile, virFDStreamCreateFile): Drop parameter.
      * src/lxc/lxc_driver.c (lxcDomainOpenConsole): Update callers.
      * src/qemu/qemu_driver.c (qemuDomainScreenshot)
      (qemuDomainOpenConsole): Likewise.
      * src/storage/storage_driver.c (storageVolumeDownload)
      (storageVolumeUpload): Likewise.
      * src/uml/uml_driver.c (umlDomainOpenConsole): Likewise.
      * src/vbox/vbox_tmpl.c (vboxDomainScreenshot): Likewise.
      * src/xen/xen_driver.c (xenUnifiedDomainOpenConsole): Likewise.
      00ef048f
    • E
      screenshot: don't unlink bogus file · 440d6b6a
      Eric Blake 提交于
      The previous qemu patch could end up calling unlink(tmp) before
      tmp was the name of a valid file (unlinking a fileXXXXXX template
      instead), or calling unlink(tmp) twice on success (once here,
      and once at the end of the stream).  Meanwhile, vbox also suffered
      from the same leaked tmp file bug.
      
      * src/qemu/qemu_driver.c (qemuDomainScreenshot): Don't unlink on
      success, or on invalid name.
      * src/vbox/vbox_tmpl.c (vboxDomainScreenshot): Don't leak temp file.
      440d6b6a
    • M
      qemu: Unlink temporary file on failure · d68b97c8
      Michal Privoznik 提交于
      Although virFDStreamOpenFile will unlink it once opened, when we hit
      error path, we must unlink it by hand.
      d68b97c8
  14. 01 8月, 2011 4 次提交
    • E
      qemu: fix crash when mixing sync and async monitor jobs · 193cd0f3
      Eric Blake 提交于
      Currently, we attempt to run sync job and async job at the same time. It
      means that the monitor commands for two jobs can be run in any order.
      
      In the function qemuDomainObjEnterMonitorInternal():
          if (priv->job.active == QEMU_JOB_NONE && priv->job.asyncJob) {
              if (qemuDomainObjBeginNestedJob(driver, obj) < 0)
      We check whether the caller is an async job by priv->job.active and
      priv->job.asynJob. But when an async job is running, and a sync job is
      also running at the time of the check, then priv->job.active is not
      QEMU_JOB_NONE. So we cannot check whether the caller is an async job
      in the function qemuDomainObjEnterMonitorInternal(), and must instead
      put the burden on the caller to tell us when an async command wants
      to do a nested job.
      
      Once the burden is on the caller, then only async monitor enters need
      to worry about whether the VM is still running; for sync monitor enter,
      the internal return is always 0, so lots of ignore_value can be dropped.
      
      * src/qemu/THREADS.txt: Reflect new rules.
      * src/qemu/qemu_domain.h (qemuDomainObjEnterMonitorAsync): New
      prototype.
      * src/qemu/qemu_process.h (qemuProcessStartCPUs)
      (qemuProcessStopCPUs): Add parameter.
      * src/qemu/qemu_migration.h (qemuMigrationToFile): Likewise.
      (qemuMigrationWaitForCompletion): Make static.
      * src/qemu/qemu_domain.c (qemuDomainObjEnterMonitorInternal): Add
      parameter.
      (qemuDomainObjEnterMonitorAsync): New function.
      (qemuDomainObjEnterMonitor, qemuDomainObjEnterMonitorWithDriver):
      Update callers.
      * src/qemu/qemu_driver.c (qemuDomainSaveInternal)
      (qemudDomainCoreDump, doCoreDump, processWatchdogEvent)
      (qemudDomainSuspend, qemudDomainResume, qemuDomainSaveImageStartVM)
      (qemuDomainSnapshotCreateActive, qemuDomainRevertToSnapshot):
      Likewise.
      * src/qemu/qemu_process.c (qemuProcessStopCPUs)
      (qemuProcessFakeReboot, qemuProcessRecoverMigration)
      (qemuProcessRecoverJob, qemuProcessStart): Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationToFile)
      (qemuMigrationWaitForCompletion, qemuMigrationUpdateJobStatus)
      (qemuMigrationJobStart, qemuDomainMigrateGraphicsRelocate)
      (doNativeMigrate, doTunnelMigrate, qemuMigrationPerformJob)
      (qemuMigrationPerformPhase, qemuMigrationFinish)
      (qemuMigrationConfirm): Likewise.
      * src/qemu/qemu_hotplug.c: Drop unneeded ignore_value.
      193cd0f3
    • A
      qemu: fix return value issue · c03f7f13
      Alex Jia 提交于
      whether or not previous return value is -1, the following codes will be
      executed for a inactive guest in src/qemu/qemu_driver.c:
      ret = virDomainSaveConfig(driver->configDir, persistentDef);
      and if everything is okay, 'ret' is assigned to 0, the previous 'ret'
      will be overwritten, this patch will fix this issue.
      
      * src/qemu/qemu_driver.c: avoid return value is overwritten when give a argument
        in out of blkio weight range for a inactive guest.
      
      * how to reproduce?
        % virsh blkiotune ${guestname} --weight 10
        % echo $?
      
        Note: guest must be inactive, argument 10 in out of blkio weight range,
        and can get a error information by checking libvirtd.log, however,
        virsh hasn't raised any error information, and return value is 0.
      
        https://bugzilla.redhat.com/show_bug.cgi?id=726304Signed-off-by: NAlex Jia <ajia@redhat.com>
      c03f7f13
    • A
      qemu: fix return value issue in qemuDomainSetMemoryParameters · 868453db
      Alex Jia 提交于
      whether or not previous return value is -1, the following codes will be
      executed for a inactive guest in qemuDomainSetMemoryParameters:
      ret = virDomainSaveConfig(driver->configDir, persistentDef);
      and if everything is okay, 'ret' is assigned to 0, the previous 'ret'
      will be overwritten, this patch will fix this issue.
      
      * src/qemu/qemu_driver.c: avoid return value is overwritten when set
        min_guarante value to a inactive guest.
      
      * how to reproduce?
        % virsh memtune ${guestname} --min_guarante 1024
        % echo $?
      
        Note: guest must be inactive, in fact, 'min_guarante' hasn't been implemented
        in memory tunable, and I can get the error when check actual libvirtd.log,
        however, virsh hasn't raised any error information, and return value is 0.
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      868453db
    • O
      qemu: Fix a regression of domjobabort · f362a99a
      Osier Yang 提交于
      Introduced by f9a837da, the condition is not changed after
      the else clause is removed. So now it quit with "domain is not
      running" when the domain is running. However, when the domain is
      not running, it reports "no job is active".
      
      How to reproduce:
      
      1)
      % virsh start $domain
      % virsh domjobabort $domain
      error: Requested operation is not valid: domain is not running
      
      2)
      % virsh destroy $domain
      % virsh domjobabort $domain
      error: Requested operation is not valid: no job is active on the domain
      
      3)
      % virsh save $domain /tmp/$domain.save
      
      Before above commands finished, try to abort job in another terminal
      
      % virsh domabortjob $domain
      error: Requested operation is not valid: domain is not running
      f362a99a
  15. 29 7月, 2011 2 次提交
    • E
      save: let qemu driver manipulate save files · f0a5eaf3
      Eric Blake 提交于
      The goal here is that save-image-dumpxml fed back to
      save-image-define should not change the save file; anywhere that
      this is not the case is probably a bug in domain_conf.c.
      
      * src/qemu/qemu_driver.c (qemuDomainSaveImageGetXMLDesc)
      (qemuDomainSaveImageDefineXML): New functions.
      (qemuDomainSaveImageOpen): Add parameter.
      (qemuDomainRestoreFlags, qemuDomainObjRestore): Adjust clients.
      f0a5eaf3
    • E
      save: support qemu modifying xml on domain save/restore · 0ea479f8
      Eric Blake 提交于
      With this, it is possible to update the path to a disk backing
      image on either the save or restore action, without having to
      binary edit the XML embedded in the state file.
      
      This also modifies virDomainSave to output a smaller xml (only
      the inactive xml, which is all the more virDomainRestore parses),
      while still guaranteeing padding for most typical abi-compatible
      xml replacements, necessary so that the next patch for
      virDomainSaveImageDefineXML will not cause unnecessary
      modifications to the save image file.
      
      * src/qemu/qemu_driver.c (qemuDomainSaveInternal): Add parameter,
      only use inactive state, and guarantee padding.
      (qemuDomainSaveImageOpen): Add parameter.
      (qemuDomainSaveFlags, qemuDomainManagedSave)
      (qemuDomainRestoreFlags, qemuDomainObjRestore): Update callers.
      0ea479f8
  16. 28 7月, 2011 2 次提交
    • M
      qemu: Fix memory leak on metadata fetching · 09d7eba9
      Michal Privoznik 提交于
      As written in virStorageFileGetMetadataFromFD decription, caller
      must free metadata after use. Qemu driver miss this and therefore
      leak metadata which can grow to huge mem leak if somebody query
      for blockInfo a lot.
      09d7eba9
    • O
      qemu: Improve docs for virsh dump format · 01e1ea12
      Osier Yang 提交于
      The error in getCompressionType will never be reported, change
      the errors codes into warning (VIR_WARN("%s", _(foo)); doesn't break
      syntax-check rule), and also improve the docs in qemu.conf to tell
      user the truth.
      01e1ea12
  17. 27 7月, 2011 4 次提交