1. 14 3月, 2012 1 次提交
  2. 13 3月, 2012 1 次提交
    • J
      qemu: Fix (managed)save and snapshots with host mode CPU · 041109af
      Jiri Denemark 提交于
      When host-model and host-passthrouh CPU modes were introduced, qemu
      driver was properly modify to update guest CPU definition during
      migration so that we use the right CPU at the destination. However,
      similar treatment is needed for (managed)save and snapshots since they
      need to save the exact CPU so that a domain can be properly restored.
      To avoid repetition of such situation, all places that need live XML
      share the code which generates it.
      
      As a side effect, this patch fixes error reporting from
      qemuDomainSnapshotWriteMetadata().
      041109af
  3. 27 2月, 2012 1 次提交
    • P
      qemu: Add ability to abort existing console while creating new one · 47161382
      Peter Krempa 提交于
      This patch fixes console corruption, that happens if two concurrent
      sessions are opened for a single console on a domain. Result of this
      corruption was that each of the console streams recieved just a part
      of the data written to the pipe so every console rendered unusable.
      
      New helper function for safe console handling is used to establish the
      console stream connection. This function ensures that no other libvirt
      client is using the console (with the ability to disconnect consoles of
      libvirt clients) and that no UUCP style lockfile is placed on the PTY
      device.
      
      * src/qemu/qemu_domain.h
              - add data structure to domain's private data dealing with
                console connections
      * src/qemu/qemu_domain.c:
              - allocate/free domain's console data structure
      * src/qemu/qemu_driver.c
              - use the new helper function for console handling
      47161382
  4. 01 2月, 2012 2 次提交
  5. 24 1月, 2012 1 次提交
    • D
      QEMU guest agent support · c160ce33
      Daniel P. Berrange 提交于
      There is now a standard QEMU guest agent that can be installed
      and given a virtio serial channel
      
          <channel type='unix'>
            <source mode='bind' path='/var/lib/libvirt/qemu/f16x86_64.agent'/>
            <target type='virtio' name='org.qemu.guest_agent.0'/>
          </channel>
      
      The protocol that runs over the guest agent is JSON based and
      very similar to the JSON monitor. We can't use exactly the same
      code because there are some odd differences in the way messages
      and errors are structured. The qemu_agent.c file is based on
      a combination and simplification of qemu_monitor.c and
      qemu_monitor_json.c
      
      * src/qemu/qemu_agent.c, src/qemu/qemu_agent.h: Support for
        talking to the agent for shutdown
      * src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Add thread
        helpers for talking to the agent
      * src/qemu/qemu_process.c: Connect to agent whenever starting
        a guest
      * src/qemu/qemu_monitor_json.c: Make variable static
      c160ce33
  6. 17 1月, 2012 2 次提交
    • J
      Taint domains configured with cpu mode=host-passthrough · c8506d66
      Jiri Denemark 提交于
      There are several reasons for doing this:
      
      - the CPU specification is out of libvirt's control so we cannot
        guarantee stable guest ABI
      - not every feature of a CPU may actually work as expected when
        advertised directly to a guest
      - migration between two machines with exactly the same CPU may work but
        no guarantees can be made
      - this mode is not supported and its use is at one's own risk
      c8506d66
    • J
      cpu: Update guest CPU in host-* mode · 277bc0dc
      Jiri Denemark 提交于
      VIR_DOMAIN_XML_UPDATE_CPU flag for virDomainGetXMLDesc may be used to
      get updated custom mode guest CPU definition in case it depends on host
      CPU. This patch implements the same behavior for host-model and
      host-passthrough CPU modes.
      277bc0dc
  7. 08 1月, 2012 1 次提交
    • L
      config: report error when script given for inappropriate interface type · 1734cdb9
      Laine Stump 提交于
      This fixes https://bugzilla.redhat.com/show_bug.cgi?id=638633
      
      Although scripts are not used by interfaces of type other than
      "ethernet" in qemu, due to the fact that the parser stores the script
      name in a union that is only valid when type is ethernet or bridge,
      there is no way for anyone except the parser itself to catch the
      problem of specifying an interface script for an inappropriate
      interface type (by the time the parsed data gets back to the code that
      called the parser, all evidence that a script was specified is
      forgotten).
      
      Since the parser itself should be agnostic to which type of interface
      allows scripts (an example of why: a script specified for an interface
      of type bridge is valid for xen domains, but not for qemu domains),
      the solution here is to move the script out of the union(s) in the
      DomainNetDef, always populate it when specified (regardless of
      interface type), and let the driver decide whether or not it is
      appropriate.
      
      Currently the qemu, xen, libxml, and uml drivers recognize the script
      parameter and do something with it (the uml driver only to report that
      it isn't supported). Those drivers have been updated to log a
      CONFIG_UNSUPPORTED error when a script is specified for an interface
      type that's inappropriate for that particular hypervisor.
      
      (NB: There was earlier discussion of solving this problem by adding a
      VALIDATE flag to all libvirt APIs that accept XML, which would cause
      the XML to be validated against the RNG files. One statement during
      that discussion was that the RNG shouldn't contain hypervisor-specific
      things, though, and a proper solution to this problem would require
      that (again, because a script for an interface of type "bridge" is
      accepted by xen, but not by qemu).
      1734cdb9
  8. 04 1月, 2012 1 次提交
  9. 19 12月, 2011 1 次提交
    • D
      Hide use of timers for domain event dispatch · 34ad1353
      Daniel P. Berrange 提交于
      Currently all drivers using domain events need to provide a callback
      for handling a timer to dispatch events in a clean stack. There is
      no technical reason for dispatch to go via driver specific code. It
      could trivially be dispatched directly from the domain event code,
      thus removing tedious boilerplate code from all drivers
      
      Also fix the libxl & xen drivers to pass 'true' when creating the
      virDomainEventState, since they run inside the daemon & thus always
      expect events to be present.
      
      * src/conf/domain_event.c, src/conf/domain_event.h: Internalize
        dispatch of events from timer callback
      * src/libxl/libxl_driver.c, src/lxc/lxc_driver.c,
        src/qemu/qemu_domain.c, src/qemu/qemu_driver.c,
        src/remote/remote_driver.c, src/test/test_driver.c,
        src/uml/uml_driver.c, src/vbox/vbox_tmpl.c,
        src/xen/xen_driver.c: Remove all timer dispatch functions
      34ad1353
  10. 30 11月, 2011 1 次提交
    • D
      Remove time APIs from src/util/util.h · a8bb75a3
      Daniel P. Berrange 提交于
      The virTimestamp and virTimeMs functions in src/util/util.h
      duplicate functionality from virtime.h, in a non-async signal
      safe manner. Remove them, and convert all code over to the new
      APIs.
      
      * src/util/util.c, src/util/util.h: Delete virTimeMs and virTimestamp
      * src/lxc/lxc_driver.c, src/qemu/qemu_domain.c,
        src/qemu/qemu_driver.c, src/qemu/qemu_migration.c,
        src/qemu/qemu_process.c, src/util/event_poll.c: Convert to use
        virtime APIs
      a8bb75a3
  11. 23 11月, 2011 1 次提交
    • P
      qemu: Avoid dereference of NULL pointer · c4b32641
      Peter Krempa 提交于
      If something fails while initializing qemu job object in
      qemuDomainObjPrivateAlloc(), memory to the private pointer is freed, but
      after that, the pointer is still dereferenced, which may result in a
      segfault.
      
      * qemuDomainObjPrivateAlloc() - Don't dereference NULL pointer.
      c4b32641
  12. 04 11月, 2011 1 次提交
    • D
      Fix naming of constant for disk event · 26ff8996
      Daniel P. Berrange 提交于
      All constants related to events should have a prefix of
      VIR_DOMAIN_EVENT_
      
      * include/libvirt/libvirt.h.in, src/qemu/qemu_domain.c:
        Rename VIR_DOMAIN_DISK_CHANGE_MISSING_ON_START to
        VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START
      26ff8996
  13. 31 10月, 2011 1 次提交
  14. 28 10月, 2011 1 次提交
  15. 25 10月, 2011 2 次提交
    • M
      startupPolicy: Emit event on disk source dropping · baf2ff7e
      Michal Privoznik 提交于
      If a disk source gets dropped because it is not accessible,
      mgmt application might want to be informed about this. Therefore
      we need to emit an event. The event presented in this patch
      is however a bit superset of what written above. The reason is simple:
      an intention to be easily expanded, e.g. on 'user ejected disk
      in guest' events. Therefore, callback gets source string and disk alias
      (which should be unique among a domain) and reason (an integer);
      baf2ff7e
    • M
      qemu: implement startupPolicy · 12ba4322
      Michal Privoznik 提交于
      This patch implements on_missing feature in qemu driver.
      Upon qemu startup process an accessibility of CDROMs
      and floppy disks is checked. The source might get dropped
      if unavailable and on_missing is set accordingly.
      No event is emit thought. Look for follow up patch.
      12ba4322
  16. 19 10月, 2011 1 次提交
  17. 14 10月, 2011 1 次提交
  18. 06 10月, 2011 1 次提交
    • E
      snapshot: use qemu-img on disks in use at time of snapshot · 70e015e1
      Eric Blake 提交于
      Once we know which set of disks belong to a snapshot, reverting or
      deleting that snapshot should visit just those disks, rather than
      also visiting disks that were hot-plugged in the meantime or
      skipping disks that were hot-unplugged in the meantime.
      
      * src/qemu/qemu_domain.c (qemuDomainSnapshotForEachQcow2): Use
      snapshot domain details when available.  Avoid NULL deref.
      70e015e1
  19. 04 10月, 2011 1 次提交
    • J
      qemu: Fix migration with dname · cdd5ef7b
      Jiri Denemark 提交于
      Destination libvirtd remembers the original name in the prepare phase
      and clears it in the finish phase. The original name is used when
      comparing domain name in migration cookie.
      cdd5ef7b
  20. 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
  21. 28 9月, 2011 1 次提交
  22. 22 9月, 2011 2 次提交
    • 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: 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
  23. 15 9月, 2011 1 次提交
  24. 06 9月, 2011 1 次提交
    • M
      qemu: Introduce job queue size limit · 3005cacb
      Michal Privoznik 提交于
      This patch creates an optional BeginJob queue size limit. When
      active, all other attempts above level will fail. To set this
      feature assign desired value to max_queued variable in qemu.conf.
      Setting it to 0 turns it off.
      3005cacb
  25. 01 8月, 2011 1 次提交
    • 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
  26. 28 7月, 2011 1 次提交
    • E
      qemu: fix nested job with driver lock held · d9fcd17e
      Eric Blake 提交于
      qemuMigrationUpdateJobStatus (called in a loop by migration
      and save tasks) uses qemuDomainObjEnterMonitorWithDriver;
      however, that function ended up starting a nested job without
      releasing the driver.
      
      Since no one else is making nested calls, we can inline the
      internal functions to properly track driver_locked.
      
      * src/qemu/qemu_domain.h (qemuDomainObjBeginNestedJob)
      (qemuDomainObjBeginNestedJobWithDriver)
      (qemuDomainObjEndNestedJob): Drop unused prototypes.
      * src/qemu/qemu_domain.c (qemuDomainObjEnterMonitorInternal):
      Reflect driver lock to nested job.
      (qemuDomainObjBeginNestedJob)
      (qemuDomainObjBeginNestedJobWithDriver)
      (qemuDomainObjEndNestedJob): Drop unused functions.
      d9fcd17e
  27. 27 7月, 2011 5 次提交
  28. 22 7月, 2011 1 次提交
    • E
      build: rename files.h to virfile.h · 8e22e089
      Eric Blake 提交于
      In preparation for a future patch adding new virFile APIs.
      
      * src/util/files.h, src/util/files.c: Move...
      * src/util/virfile.h, src/util/virfile.c: ...here, and rename
      functions to virFile prefix.  Macro names are intentionally
      left alone.
      * *.c: All '#include "files.h"' uses changed.
      * src/Makefile.am (UTIL_SOURCES): Reflect rename.
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_close): Likewise.
      * src/libvirt_private.syms: Likewise.
      * docs/hacking.html.in: Likewise.
      * HACKING: Regenerate.
      8e22e089
  29. 14 7月, 2011 1 次提交
    • E
      qemu: reject unknown flags · f548480b
      Eric Blake 提交于
      * src/qemu/qemu_driver.c (qemudOpen, qemuDomainScreenshot)
      (qemuDomainXMLFromNative, qemuDomainXMLToNative)
      (qemudDomainBlockPeek, qemuCPUCompare, qemuCPUBaseline): Reject
      unknown flags.
      * src/qemu/qemu_migration.c (qemuMigrationConfirm): Likewise.
      (_qemuMigrationCookie, qemuMigrationCookieXMLParse)
      (qemuMigrationCookieXMLParseStr, qemuMigrationBakeCookie)
      (qemuMigrationEatCookie): Make flags unsigned.
      * src/qemu/qemu_domain.h: (qemuDomainDefFormatXML)
      (qemuDomainFormatXML): Prefer unsigned flags.
      * src/qemu/qemu_domain.c (qemuDomainDefFormatXML)
      (qemuDomainFormatXML): Likewise.
      (qemuDomainOpenLogHelper, qemuDomainCreateLog): Rename variable.
      f548480b
  30. 13 7月, 2011 3 次提交