1. 23 2月, 2012 1 次提交
    • J
      qemu: Forbid migration with cache != none · d57485f7
      Jiri Denemark 提交于
      Migrating domains with disks using cache != none is unsafe unless the
      disk images are stored on coherent clustered filesystem. Thus we forbid
      migrating such domains unless VIR_MIGRATE_UNSAFE flags is used.
      d57485f7
  2. 16 2月, 2012 2 次提交
  3. 06 2月, 2012 1 次提交
    • J
      qemu: Fix seamless spice migration · d9d518b1
      Jiri Denemark 提交于
      Calling qemuDomainMigrateGraphicsRelocate notifies spice clients to
      connect to destination qemu so that they can seamlessly switch streams
      once migration is done. Unfortunately, current qemu is not able to
      accept any connections while incoming migration connection is open.
      Thus, we need to delay opening the migration connection to the point
      spice client is already connected to the destination qemu.
      d9d518b1
  4. 04 2月, 2012 1 次提交
  5. 17 1月, 2012 1 次提交
    • J
      Clarify semantics of virDomainMigrate{,ToURI}2 · 5e31e713
      Jiri Denemark 提交于
      Commit 5d784bd6 was a nice attempt to
      clarify the semantics by requiring domain name from dxml to either match
      original name or dname. However, setting dxml domain name to dname
      doesn't really work since destination host needs to know the original
      domain name to be able to use it in migration cookies. This patch
      requires domain name in dxml to match the original domain name. The
      change should be safe and backward compatible since migration would fail
      just a bit later in the process.
      5e31e713
  6. 11 1月, 2012 1 次提交
    • D
      Change security driver APIs to use virDomainDefPtr instead of virDomainObjPtr · 99be754a
      Daniel P. Berrange 提交于
      When sVirt is integrated with the LXC driver, it will be neccessary
      to invoke the security driver APIs using only a virDomainDefPtr
      since the lxc_container.c code has no virDomainObjPtr available.
      Aside from two functions which want obj->pid, every bit of the
      security driver code only touches obj->def. So we don't need to
      pass a virDomainObjPtr into the security drivers, a virDomainDefPtr
      is sufficient. Two functions also gain a 'pid_t pid' argument.
      
      * src/qemu/qemu_driver.c, src/qemu/qemu_hotplug.c,
        src/qemu/qemu_migration.c, src/qemu/qemu_process.c,
        src/security/security_apparmor.c,
        src/security/security_dac.c,
        src/security/security_driver.h,
        src/security/security_manager.c,
        src/security/security_manager.h,
        src/security/security_nop.c,
        src/security/security_selinux.c,
        src/security/security_stack.c: Change all security APIs to use a
        virDomainDefPtr instead of virDomainObjPtr
      99be754a
  7. 16 12月, 2011 1 次提交
    • P
      migration: Add more specific error code/message on migration abort · 8fb2aeb6
      Peter Krempa 提交于
      A generic error code was returned, if the user aborted a migration job.
      This made it hard to distinguish between a user requested abort and an
      error that might have occured. This patch introduces a new error code,
      which is returned in the specific case of a user abort, while leaving
      all other failures with their existing code. This makes it easier to
      distinguish between failure while mirgrating and an user requested
      abort.
      
       * include/libvirt/virterror.h: - add new error code
       * src/util/virterror.c: - add message for the new error code
       * src/qemu/qemu_migration.h: - Emit operation aborted error instead of
                                      operation failed, on migration abort
      8fb2aeb6
  8. 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
  9. 24 11月, 2011 2 次提交
  10. 19 11月, 2011 2 次提交
    • D
      Rename and split the macvtap.c file · 896104c9
      Daniel P. Berrange 提交于
      Rename the macvtap.c file to virnetdevmacvlan.c to reflect its
      functionality. Move the port profile association code out into
      virnetdevvportprofile.c. Make the APIs available unconditionally
      to callers
      
      * src/util/macvtap.h: rename to src/util/virnetdevmacvlan.h,
      * src/util/macvtap.c: rename to src/util/virnetdevmacvlan.c
      * src/util/virnetdevvportprofile.c, src/util/virnetdevvportprofile.h:
        Pull in vport association code
      * src/Makefile.am, src/conf/domain_conf.h, src/qemu/qemu_conf.c,
        src/qemu/qemu_conf.h, src/qemu/qemu_driver.c: Update include
        paths & remove conditional compilation
      896104c9
    • D
      Rename Macvtap management APIs · 43925db7
      Daniel P. Berrange 提交于
      In preparation for code re-organization, rename the Macvtap
      management APIs to have the following patterns
      
        virNetDevMacVLanXXXXX     - macvlan/macvtap interface management
        virNetDevVPortProfileXXXX - virtual port profile management
      
      * src/util/macvtap.c, src/util/macvtap.h: Rename APIs
      * src/conf/domain_conf.c, src/network/bridge_driver.c,
        src/qemu/qemu_command.c, src/qemu/qemu_command.h,
        src/qemu/qemu_driver.c, src/qemu/qemu_hotplug.c,
        src/qemu/qemu_migration.c, src/qemu/qemu_process.c,
        src/qemu/qemu_process.h: Update for renamed APIs
      43925db7
  11. 12 11月, 2011 1 次提交
    • E
      qemu: fix domjobabort regression · 61f2b6ba
      Eric Blake 提交于
      This reverts commit ef1065cf; see also this bug report:
      https://bugzilla.redhat.com/show_bug.cgi?id=751900
      
      In qemu 0.15.1 and earlier, during migration to file, the
      qemu_savevm_state_begin and qemu_savevm_state_iterate methods
      will both process as much migration data as possible until either
      
        1. The file descriptor returns EAGAIN
        2. The bandwidth rate limit is reached
      
      If we set the rate limit to ULONG_MAX, test 2 never becomes true. We're
      passing a plain file descriptor to QEMU and POSIX does not support EAGAIN on
      regular files / block devices, so test 1 never becomes true either.
      
      In the 'virsh save --bypass-cache' case, we pass a pipe instead of a
      regular fd, but using a pipe adds I/O overhead, so always passing a
      pipe just so qemu can see EAGAIN doesn't seem nice.
      
      The ultimate fix needs to come from qemu - background migration must
      respect asynchronous abort requests, or else periodically return
      control to the main handling loop without an EAGAIN and without
      waiting to hit an insanely large amount of data.  But until a
      version of qemu is fixed to support "unlimited" data rates while
      still allowing cancellation, the best we can do is avoid the
      automatic use of unlimited rates from within libvirt (users can
      still explicitly change the migration rates, if they are aware that
      they are giving up the ability to cancel a job).
      
      Reverting the lone use of QEMU_DOMAIN_FILE_MIG_BANDWIDTH_MAX is
      the simplest patch; this slows migration back down to a default
      32M/sec cap, but also ensures that the main qemu processing loop
      will still be responsive to cancellation requests.  Hopefully
      upstream qemu will provide us a means of safely using unlimited
      speed, including a runtime probe of that capability.
      
      * src/qemu/qemu_migration.c (qemuMigrationToFile): Revert attempt
      to use unlimited migration bandwidth when migrating to file.
      Signed-off-by: NDaniel Veillard <veillard@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      61f2b6ba
  12. 29 10月, 2011 1 次提交
  13. 21 10月, 2011 1 次提交
    • E
      snapshot: indent domain xml when nesting · 9cba3927
      Eric Blake 提交于
      <domainsnapshot> is the first public instance of <domain> being
      used as a sub-element, although we have two other private uses
      (runtime state, and migration cookie).  Although indentation has
      no effect on XML parsing, using it makes the output more consistent.
      
      This uses virBuffer auto-indentation to obtain the effect, for all
      but the portions of <domain> that are not generated a line at a
      time into the same virBuffer.  Further patches will clean up the
      remaining problems.
      
      * src/conf/domain_conf.h (virDomainDefFormatInternal): New prototype.
      * src/conf/domain_conf.c (virDomainDefFormatInternal): Export.
      (virDomainObjFormat, virDomainSnapshotDefFormat): Update callers.
      * src/libvirt_private.syms (domain_conf.h): Add new export.
      * src/qemu/qemu_migration.c (qemuMigrationCookieXMLFormat): Use
      new function.
      (qemuMigrationCookieXMLFormatStr): Update caller.
      9cba3927
  14. 15 10月, 2011 1 次提交
  15. 14 10月, 2011 1 次提交
  16. 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
  17. 29 9月, 2011 1 次提交
    • A
      qemu: add return value check · b6dd366a
      Alex Jia 提交于
      * src/qemu/qemu_migration.c: if 'vmdef' is NULL, the function
        virDomainSaveConfig still dereferences it, it doesn't make
        sense, so should add return value check to make sure 'vmdef'
        is non-NULL before calling virDomainSaveConfig, in addition,
        in order to debug later, also should record error information
        into log.
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      b6dd366a
  18. 28 9月, 2011 1 次提交
  19. 27 9月, 2011 1 次提交
  20. 22 9月, 2011 2 次提交
    • 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: 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
  21. 15 9月, 2011 2 次提交
    • J
      Use max bandwidth from qemuDomainObjPrivate struct when migrating · 0257ba8f
      Jim Fehlig 提交于
      Adjust qemuMigrationRun() to use migMaxBandwidth in qemuDomainObjPrivate
      structure when setting qemu migration speed.  Caller-specified 'resource'
      parameter overrides migMaxBandwidth.
      0257ba8f
    • J
      Set qemu migration speed unlimited when migrating to file · ef1065cf
      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.
      
      Tested with both json and text monitors.
      ef1065cf
  22. 14 9月, 2011 1 次提交
    • P
      xml: Clean up rest of virtual XML document names for XML strings · b998f1f7
      Peter Krempa 提交于
      Commit 498d7833 cleans up some of virtual file names for parsing strings
      in memory. This patch cleans up (hopefuly) the rest forgotten by the
      first patch.
      
      This patch also changes all of the previously modified "filenames" to
      valid URI's replacing spaces for underscores.
      
      Changes to v1:
      - Replace all spaces for underscores, so that the strings form valid
        URI's
      - Replace spaces in places changed by commit 498d7833
      b998f1f7
  23. 03 9月, 2011 1 次提交
    • E
      snapshot: prevent migration from stranding snapshot data · e2fb96d9
      Eric Blake 提交于
      Migration is another case of stranding metadata.  And since
      snapshot metadata is arbitrarily large, there's no way to
      shoehorn it into the migration cookie of migration v3.
      
      This patch consolidates two existing locations for migration
      validation into one helper function, then enhances that function
      to also do the new checks.  If we could always trust the source
      to validate migration, then the destination would not have to
      do anything; but since older servers that did not do checking
      can migrate to newer destinations, we have to repeat some of
      the same checks on the destination; meanwhile, we want to
      detect failures as soon as possible.  With migration v2, this
      means that validation will reject things at Prepare on the
      destination if the XML exposes the problem, otherwise at Perform
      on the source; with migration v3, this means that validation
      will reject things at Begin on the source, or if the source
      is old and the XML exposes the problem, then at Prepare on the
      destination.
      
      This patch is necessarily over-strict.  Once a later patch
      properly handles auto-cleanup of snapshot metadata on the
      death of a transient domain, then the only time we actually
      need snapshots to prevent migration is when using the
      --undefinesource flag on a persistent source domain.
      
      It is possible to recreate snapshot metadata on the destination
      with VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE and
      VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT.  But for now, that is limited,
      since if we delete the snapshot metadata prior to migration,
      then we won't know the name of the current snapshot to pass
      along; and if we delete the snapshot metadata after migration
      and use the v3 migration cookie to pass along the name of the
      current snapshot, then we need a way to bypass the fact that
      this patch refuses migration with snapshot metadata present.
      
      So eventually, we may have to introduce migration protocol v4
      that allows feature negotiation and an arbitrary number of
      handshake exchanges, so as to pass as many rpc calls as needed
      to transfer all the snapshot xml hierarchy.
      
      But all of that is thoughts for the future; for now, the best
      course of action is to quit early, rather than get into a
      funky state of stale metadata; then relax restrictions later.
      
      * src/qemu/qemu_migration.h (qemuMigrationIsAllowed): Make static.
      * src/qemu/qemu_migration.c (qemuMigrationIsAllowed): Alter
      signature, and allow checks for both outgoing and incoming.
      (qemuMigrationBegin, qemuMigrationPrepareAny)
      (qemuMigrationPerformJob): Update callers.
      e2fb96d9
  24. 02 9月, 2011 1 次提交
    • 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
  25. 30 8月, 2011 1 次提交
  26. 26 8月, 2011 4 次提交
    • K
      Fix persistent migration config save · 709b4c50
      KAMEZAWA Hiroyuki 提交于
      When a user migrates a domain by command as
      
      libvirt saves vm's domain XML config in destination host after migration.
      But it saves vm->def. Then, the saved XML contains some garbage.
      
        <domain type='kvm' id='50'>
                           ^^^^^^^^
        ...
         <console type='pty' tty='/dev/pts/5'>
                             ^^^^^^^^^^^^^^^^^
      
      Avoid saving unnecessary things by saving persistent vm definition.
      709b4c50
    • J
      qemu: Correctly label migration TCP socket · 855f7689
      Jiri Denemark 提交于
      855f7689
    • 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
    • A
      qemu: avoid dead store in doPeer2PeerMigrate3 · d69d3210
      Alex Jia 提交于
      * src/qemu/qemu_migration.c: avoid dead 'ret' assignment and silence
        clang warning.
      
      Detected by ccc-analyzer:
      
        CC     libvirt_driver_qemu_la-qemu_migration.lo
      qemu/qemu_migration.c:2046:5: warning: Value stored to 'ret' is never read
          ret = qemuMigrationConfirm(driver, sconn, vm,
          ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      d69d3210
  27. 19 8月, 2011 1 次提交
    • E
      maint: simplify lots of libxml2 clients · d89dd42d
      Eric Blake 提交于
      Repetitive patterns should be factored.  The sign of a good
      factorization is a change that kills 5x more lines than it adds :)
      
      * src/conf/domain_conf.c (virDomainDeviceDefParse)
      (virDomainSnapshotDefParseString): Use new convenience macros.
      * src/conf/storage_conf.c (virStoragePoolDefParseSourceString):
      Likewise.
      * src/cpu/cpu.c (cpuCompareXML, cpuBaselineXML): Likewise.
      * src/esx/esx_vi.c (esxVI_Context_Execute): Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationCookieXMLParseStr):
      Likewise.
      * src/security/virt-aa-helper.c (caps_mockup): Likewise.
      * src/test/test_driver.c (testOpenFromFile): Likewise.
      * tests/cputest.c (cpuTestLoadXML, cpuTestLoadMultiXML):
      Likewise.
      * tools/virsh.c (cmdFreecell, makeCloneXML, cmdVNCDisplay)
      (cmdTTYConsole, cmdDetachInterface, cmdDetachDisk)
      (cmdSnapshotCreate, cmdSnapshotCreateAs, cmdSnapshotCurrent)
      (cmdSnapshotList, cmdSnapshotParent): Likewise.
      d89dd42d
  28. 15 8月, 2011 4 次提交
  29. 06 8月, 2011 1 次提交