1. 11 10月, 2012 1 次提交
    • 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
  2. 21 9月, 2012 1 次提交
  3. 13 9月, 2012 1 次提交
    • D
      Turn QEMU capabilities object into a full virObjectPtr · beac09fd
      Daniel P. Berrange 提交于
      The current qemu capabilities are stored in a virBitmapPtr
      object, whose type is exposed to callers. We want to store
      more data besides just the flags, so we need to move to a
      struct type. This object will also need to be reference
      counted, since we'll be maintaining a cache of data per
      binary. This change introduces a 'qemuCapsPtr' virObject
      class. Most of the change is just renaming types and
      variables in all the callers
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      beac09fd
  4. 24 8月, 2012 1 次提交
    • E
      snapshot: split snapshot conf code into own file · 6478ec16
      Eric Blake 提交于
      This has several benefits:
      1. Future snapshot-related code has a definite place to go (and I
      _will_ be adding some)
      2. Snapshot errors now use the VIR_FROM_DOMAIN_SNAPSHOT error
      classification, which has been underutilized (previously only in
      libvirt.c)
      
      * src/conf/domain_conf.h, domain_conf.c: Split...
      * src/conf/snapshot_conf.h, snapshot_conf.c: ...into new files.
      * src/Makefile.am (DOMAIN_CONF_SOURCES): Build new files.
      * po/POTFILES.in: Mark new file for translation.
      * src/vbox/vbox_tmpl.c: Update caller.
      * src/esx/esx_driver.c: Likewise.
      * src/qemu/qemu_command.c: Likewise.
      * src/qemu/qemu_domain.h: Likewise.
      6478ec16
  5. 09 8月, 2012 1 次提交
    • J
      qemu: Migrate at unlimited speed by default · 6cfdeaac
      Jiri Denemark 提交于
      Previously, qemu did not respond to monitor commands during migration if
      the limit was too high. This prevented us from raising the limit
      earlier. The qemu issue seems to be fixed (according to my testing) and
      we may remove the 32Mb/s limit.
      6cfdeaac
  6. 07 8月, 2012 1 次提交
  7. 23 7月, 2012 1 次提交
    • O
      Desert the FSF address in copyright · f9ce7dad
      Osier Yang 提交于
      Per the FSF address could be changed from time to time, and GNU
      recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html)
      
        You should have received a copy of the GNU General Public License
        along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
      
      This patch removes the explicit FSF address, and uses above instead
      (of course, with inserting 'Lesser' before 'General').
      
      Except a bunch of files for security driver, all others are changed
      automatically, the copyright for securify files are not complete,
      that's why to do it manually:
      
        src/security/security_selinux.h
        src/security/security_driver.h
        src/security/security_selinux.c
        src/security/security_apparmor.h
        src/security/security_apparmor.c
        src/security/security_driver.c
      f9ce7dad
  8. 15 6月, 2012 1 次提交
  9. 07 5月, 2012 1 次提交
    • J
      qemu: Emit compatible XML when migrating a domain · 409b5f54
      Jiri Denemark 提交于
      When we added the default USB controller into domain XML, we efficiently
      broke migration to older versions of libvirt that didn't support USB
      controllers at all (0.9.4 and earlier) even for domains that don't use
      anything that the older libvirt can't provide. We still want to present
      the default USB controller in any XML seen by a user/app but we can
      safely remove it from the domain XML used during migration. If we are
      migrating to a new enough libvirt, it will add the controller XML back,
      while older libvirt won't be confused with it although it will still
      tell qemu to create the controller.
      
      Similar approach can be used in the future whenever we find out we
      always enabled some kind of device without properly advertising it in
      domain XML.
      409b5f54
  10. 05 5月, 2012 1 次提交
  11. 11 4月, 2012 2 次提交
    • J
      qemu: Track job owner for better debugging · 08ec1d78
      Jiri Denemark 提交于
      In case an API fails with "cannot acquire state change lock", searching
      for the API that possibly forgot to end its job is not always easy.
      Let's keep track of the job owner and print it out for easier
      identification.
      08ec1d78
    • J
      qemu: Avoid excessive calls to qemuDomainObjSaveJob() · 31796e2c
      Jiri Denemark 提交于
      As reported by Daniel Berrangé, we have a huge performance regression
      for virDomainGetInfo() due to the change which makes virDomainEndJob()
      save the XML status file every time it is called. Previous to that
      change, 2000 calls to virDomainGetInfo() took ~2.5 seconds. After that
      change, 2000 calls to virDomainGetInfo() take 2 *minutes* 45 secs.
      
      We made the change to be able to recover from libvirtd restart in the
      middle of a job. However, only destroy and async jobs are taken care of.
      Thus it makes more sense to only save domain state XML when these jobs
      are started/stopped.
      31796e2c
  12. 22 3月, 2012 3 次提交
    • J
      qemu: Avoid dangling migration-in job on shutoff domains · 4f061ea6
      Jiri Denemark 提交于
      Destination daemon should not rely on the client or source daemon
      (depending on the type of migration) to call Finish when migration
      fails, because the client may crash before it can do so. The domain
      prepared for incoming migration is set to be destroyed (and migration
      job cleaned up) when connection with the client closes but this is not
      enough. If the associated qemu process crashes after Prepare step and
      the domain is cleaned up before the connection gets closed, autodestroy
      is not called for the domain and migration jobs remains set. In case the
      domain is defined on destination host (i.e., it is not completely
      removed once destroyed) we keep the job set for ever. To fix this, we
      register a cleanup callback which is responsible to clean migration-in
      job when a domain dies anywhere between Prepare and Finish steps. Note
      that we can't blindly clean any job when spotting EOF on monitor since
      normally an API is running at that time.
      4f061ea6
    • J
      qemu: Add support for domain cleanup callbacks · bf9f0a97
      Jiri Denemark 提交于
      Add support for registering cleanup callbacks to be run when a domain
      transitions to shutoff state.
      bf9f0a97
    • J
      qemu: Use unlimited speed when migrating to file · 9f71368d
      Jiri Denemark 提交于
      This reverts commit 61f2b6ba and most of
      commit d8916dc8, which effectively
      brings back commit ef1065cf written by
      Jim Fehlig:
      
      The qemu migration speed default is 32MiB/s as defined in migration.c
      
      /* Migration speed throttling */
      static int64_t max_throttle = (32 << 20);
      
      There's no need to throttle migration when targeting a file, so set
      migration speed to unlimited prior to migration, and restore to libvirt
      default value after migration.
      
      Default units is MB for migrate_set_speed monitor command, so
      (INT64_MAX / (1024 * 1024)) is used for unlimited migration speed.
      
      This was reverted because migration to file could not be canceled and
      even monitored since qemu was not processing any monitor commands until
      the migration finished. This is now different as we make sure the
      file descriptor we pass to qemu is able to properly report EAGAIN.
      Recent qemu changes might have helped as well.
      
      I tested managedsave with this patch in and indeed, it is 10x faster
      while I can still monitor its progress.
      9f71368d
  13. 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
  14. 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
  15. 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
  16. 16 12月, 2011 1 次提交
    • J
      Fix default migration speed in qemu driver · d8916dc8
      Jim Fehlig 提交于
      In commit 6f84e110 I mistakenly set default migration speed to
      33554432 Mb!  The units of migMaxBandwidth is Mb, with conversion
      handled in qemuMonitor{JSON,Text}SetMigrationSpeed().
      
      Also, remove definition of QEMU_DOMAIN_FILE_MIG_BANDWIDTH_MAX since
      it is no longer used after reverting commit ef1065cf.
      d8916dc8
  17. 12 12月, 2011 1 次提交
    • J
      qemu: Disable EOF processing during qemuDomainDestroy · 5547d2b8
      Jiri Denemark 提交于
      When destroying a domain qemuDomainDestroy kills its qemu process and
      starts a new job, which means it unlocks the domain object and locks it
      again after some time. Although the object is usually unlocked for a
      pretty short time, chances are another thread processing an EOF event on
      qemu monitor is able to lock the object first and does all the cleanup
      by itself. This leads to wrong shutoff reason and lifecycle event detail
      and virDomainDestroy API incorrectly reporting failure to destroy an
      inactive domain.
      
      Reported by Charlie Smurthwaite.
      5547d2b8
  18. 25 10月, 2011 1 次提交
    • 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
  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 1 次提交
    • 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. 21 9月, 2011 1 次提交
    • 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
  24. 15 9月, 2011 1 次提交
  25. 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
  26. 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
  27. 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
  28. 27 7月, 2011 7 次提交
  29. 14 7月, 2011 2 次提交
    • E
      build: avoid ATTRIBUTE_UNUSED in headers · 088473b2
      Eric Blake 提交于
      The compiler might optimize based on our declaration that something
      is unused.  Putting that declaration in the header risks getting
      out of sync with the actual implementation, so it belongs better
      only in the .c files.  We were mostly compliant, and a new syntax
      check will help us in the future.
      
      * cfg.mk (sc_avoid_attribute_unused_in_header): New syntax check.
      * src/nodeinfo.h (nodeGetCPUStats, nodeGetMemoryStats): Delete
      attribute already present in .c file.
      * src/qemu/qemu_domain.h (qemuDomainEventFlush): Likewise.
      * src/util/virterror_internal.h (virReportErrorHelper): Parameters
      are actually used by .c file.
      * src/xenxs/xen_sxpr.h (xenFormatSxprDisk): Adjust prototype.
      * src/xenxs/xen_sxpr.c (xenFormatSxprDisk): Delete unused argument.
      (xenFormatSxpr): Adjust caller.
      * src/xen/xend_internal.c (xenDaemonAttachDeviceFlags)
      (xenDaemonUpdateDeviceFlags): Likewise.
      Suggested by Daniel Veillard.
      088473b2
    • 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 1 次提交
    • J
      qemu: Add support for job phase · 5b2d0bbc
      Jiri Denemark 提交于
      Asynchronous jobs may take long time to finish and may consist of
      several phases which we need to now about to help with recovery/rollback
      after libvirtd restarts.
      5b2d0bbc