1. 18 1月, 2011 1 次提交
    • A
      savevm: Fix no_migrate · dc912121
      Alex Williamson 提交于
      The no_migrate save state flag is currently only checked in the
      last phase of migration.  This means that we potentially waste
      a lot of time and bandwidth with the live state handlers before
      we ever check the no_migrate flags.  The error message printed
      when we catch a non-migratable device doesn't get printed for
      a detached migration.  And, no_migrate does nothing to prevent
      an incoming migration to a target that includes a non-migratable
      device.  This attempts to fix all of these.
      
      One notable difference in behavior is that an outgoing migration
      now checks for non-migratable devices before ever connecting to
      the target system.  This means the target will remain listening
      rather than exit from failure.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      dc912121
  2. 09 12月, 2010 1 次提交
  3. 03 12月, 2010 1 次提交
  4. 01 11月, 2010 1 次提交
  5. 14 10月, 2010 1 次提交
    • B
      Delete write only variables · 49a2942d
      Blue Swirl 提交于
      Compiling with GCC 4.6.0 20100925 produced warnings like:
      /src/qemu/net/tap-win32.c: In function 'tap_win32_open':
      /src/qemu/net/tap-win32.c:582:12: error: variable 'hThread' set but not used [-Werror=unused-but-set-variable]
      
      Fix by removing the unused variables.
      Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
      49a2942d
  6. 10 9月, 2010 1 次提交
    • B
      Fix OpenBSD build warning · d7d9b528
      Blue Swirl 提交于
      Fix this warning:
        CC    savevm.o
      /src/qemu/savevm.c: In function `do_savevm':
      /src/qemu/savevm.c:1900: warning: passing arg 1 of `localtime_r' from incompatible pointer type
      
      It looks like on OpenBSD the type of tv_sec in struct timeval is still
      'long' instead of time_t as in most other OS. Fix by adding a cast.
      Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
      d7d9b528
  7. 31 8月, 2010 2 次提交
    • M
      savevm: Generate a name when run without one · 7d631a11
      Miguel Di Ciurcio Filho 提交于
      When savevm is run without a name, the name stays blank and the snapshot is
      saved anyway.
      
      The new behavior is when savevm is run without parameters a name will be
      created automaticaly, so the snapshot is accessible to the user without needing
      the id when loadvm is run.
      
      (qemu) savevm
      (qemu) info snapshots
      ID        TAG                 VM SIZE                DATE       VM CLOCK
      1         vm-20100728134640      978K 2010-07-28 13:46:40   00:00:08.603
      
      We use a name with the format 'vm-YYYYMMDDHHMMSS'.
      
      This is a first step to hide the internal id, because I don't see a reason to
      expose this kind of internals to the user.
      Signed-off-by: NMiguel Di Ciurcio Filho <miguel.filho@gmail.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      7d631a11
    • M
      monitor: make 'info snapshots' show only fully available snapshots · f9209915
      Miguel Di Ciurcio Filho 提交于
      The output generated by 'info snapshots' shows only snapshots that exist on the
      block device that saves the VM state. This output can cause an user to
      erroneously try to load an snapshot that is not available on all block devices.
      
      $ qemu-img snapshot -l xxtest.qcow2
      Snapshot list:
      ID        TAG                 VM SIZE                DATE       VM CLOCK
      1                                1.5M 2010-07-26 16:51:52   00:00:08.599
      2                                1.5M 2010-07-26 16:51:53   00:00:09.719
      3                                1.5M 2010-07-26 17:26:49   00:00:13.245
      4                                1.5M 2010-07-26 19:01:00   00:00:46.763
      
      $ qemu-img snapshot -l xxtest2.qcow2
      Snapshot list:
      ID        TAG                 VM SIZE                DATE       VM CLOCK
      3                                   0 2010-07-26 17:26:49   00:00:13.245
      4                                   0 2010-07-26 19:01:00   00:00:46.763
      
      Current output:
      $ qemu -hda xxtest.qcow2 -hdb xxtest2.qcow2 -monitor stdio -vnc :0
      QEMU 0.12.4 monitor - type 'help' for more information
      (qemu) info snapshots
      Snapshot devices: ide0-hd0
      Snapshot list (from ide0-hd0):
      ID        TAG                 VM SIZE                DATE       VM CLOCK
      1                                1.5M 2010-07-26 16:51:52   00:00:08.599
      2                                1.5M 2010-07-26 16:51:53   00:00:09.719
      3                                1.5M 2010-07-26 17:26:49   00:00:13.245
      4                                1.5M 2010-07-26 19:01:00   00:00:46.763
      
      Snapshots 1 and 2 do not exist on xxtest2.qcow, but they are displayed anyway.
      
      This patch sumarizes the output to only show fully available snapshots.
      
      New output:
      (qemu) info snapshots
      ID        TAG                 VM SIZE                DATE       VM CLOCK
      3                                1.5M 2010-07-26 17:26:49   00:00:13.245
      4                                1.5M 2010-07-26 19:01:00   00:00:46.763
      Signed-off-by: NMiguel Di Ciurcio Filho <miguel.filho@gmail.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      f9209915
  8. 11 8月, 2010 1 次提交
  9. 03 8月, 2010 1 次提交
    • M
      loadvm: improve tests before bdrv_snapshot_goto() · f0aa7a8b
      Miguel Di Ciurcio Filho 提交于
      This patch improves the resilience of the load_vmstate() function, doing
      further and better ordered tests.
      
      In load_vmstate(), if there is any error on bdrv_snapshot_goto(), except if the
      error is on VM state device, load_vmstate() will return zero and the VM will be
      started with major corruption chances.
      
      The current process:
      - test if there is any writable device without snapshot support
          - if exists return -error
      - get the device that saves the VM state, possible return -error but unlikely
      because it was tested earlier
      - flush I/O
      - run bdrv_snapshot_goto() on devices
          - if fails, give an warning and goes to the next (not good!)
          - if fails on the VM state device, return zero (not good!)
      - check if the requested snapshot exists on the device that saves the VM state
      and the state is not zero
          - if fails return -error
      - open the file with the VM state
          - if fails return -error
      - load the VM state
          - if fails return -error
      - return zero
      
      New behavior:
      - get the device that saves the VM state
          - if fails return -error
      - check if the requested snapshot exists on the device that saves the VM state
      and the state is not zero
          - if fails return -error
      - test if there is any writable device without snapshot support
          - if exists return -error
      - test if the devices with snapshot support have the requested snapshot
          - if anyone fails, return -error
      - flush I/O
      - run snapshot_goto() on devices
          - if anyone fails, return -error
      - open the file with the VM state
          - if fails return -error
      - load the VM state
          - if fails return -error
      - return zero
      
      do_loadvm must not call vm_start if any error has occurred in load_vmstate.
      Signed-off-by: NMiguel Di Ciurcio Filho <miguel.filho@gmail.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      f0aa7a8b
  10. 31 7月, 2010 1 次提交
  11. 27 7月, 2010 1 次提交
    • J
      vmstate: add subsections code · 811814bd
      Juan Quintela 提交于
      This commit adds subsections for each device section.
      Subsections is the way to handle information that don't need to be sent
      to de destination of a migration because its values are not needed.  It is
      the way to handle optional information.  Notice that only the source can
      decide if the information is optional or not.  The destination needs to
      understand all subsections that it receives to have a sucessful load.
      Signed-off-by: NJuan Quintela <quintela@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      811814bd
  12. 06 7月, 2010 2 次提交
  13. 02 7月, 2010 1 次提交
    • M
      savevm: Survive hot-unplug of snapshot device · f9092b10
      Markus Armbruster 提交于
      savevm.c keeps a pointer to the snapshot block device.  If you manage
      to get that device deleted, the pointer dangles, and the next snapshot
      operation will crash & burn.  Unplugging a guest device that uses it
      does the trick:
      
          $ MALLOC_PERTURB_=234 qemu-system-x86_64 [...]
          QEMU 0.12.50 monitor - type 'help' for more information
          (qemu) info snapshots
          No available block device supports snapshots
          (qemu) drive_add auto if=none,file=tmp.qcow2
          OK
          (qemu) device_add usb-storage,id=foo,drive=none1
          (qemu) info snapshots
          Snapshot devices: none1
          Snapshot list (from none1):
          ID        TAG                 VM SIZE                DATE       VM CLOCK
          (qemu) device_del foo
          (qemu) info snapshots
          Snapshot devices:
          Segmentation fault (core dumped)
      
      Move management of that pointer to block.c, and zap it when the device
      it points becomes unusable.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      f9092b10
  14. 15 6月, 2010 2 次提交
    • M
      block: Decouple savevm from DriveInfo · dbc13590
      Markus Armbruster 提交于
      We find snapshots by iterating over the list of drives defined with
      drive_init().  This misses host block devices defined by other means.
      Such means don't exist now, but will be introduced later in this
      series.
      
      Iterate over all host block devices instead, with bdrv_next().
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      dbc13590
    • M
      savevm: Really verify if a drive supports snapshots · feeee5ac
      Miguel Di Ciurcio Filho 提交于
      Both bdrv_can_snapshot() and bdrv_has_snapshot() does not work as advertized.
      
      First issue: Their names implies different porpouses, but they do the same thing
      and have exactly the same code. Maybe copied and pasted and forgotten?
      bdrv_has_snapshot() is called in various places for actually checking if there
      is snapshots or not.
      
      Second issue: the way bdrv_can_snapshot() verifies if a block driver supports or
      not snapshots does not catch all cases. E.g.: a raw image.
      
      So when do_savevm() is called, first thing it does is to set a global
      BlockDriverState to save the VM memory state calling get_bs_snapshots().
      
      static BlockDriverState *get_bs_snapshots(void)
      {
          BlockDriverState *bs;
          DriveInfo *dinfo;
      
          if (bs_snapshots)
              return bs_snapshots;
          QTAILQ_FOREACH(dinfo, &drives, next) {
              bs = dinfo->bdrv;
              if (bdrv_can_snapshot(bs))
                  goto ok;
          }
          return NULL;
       ok:
          bs_snapshots = bs;
          return bs;
      }
      
      bdrv_can_snapshot() may return a BlockDriverState that does not support
      snapshots and do_savevm() goes on.
      
      Later on in do_savevm(), we find:
      
          QTAILQ_FOREACH(dinfo, &drives, next) {
              bs1 = dinfo->bdrv;
              if (bdrv_has_snapshot(bs1)) {
                  /* Write VM state size only to the image that contains the state */
                  sn->vm_state_size = (bs == bs1 ? vm_state_size : 0);
                  ret = bdrv_snapshot_create(bs1, sn);
                  if (ret < 0) {
                      monitor_printf(mon, "Error while creating snapshot on '%s'\n",
                                     bdrv_get_device_name(bs1));
                  }
              }
          }
      
      bdrv_has_snapshot(bs1) is not checking if the device does support or has
      snapshots as explained above. Only in bdrv_snapshot_create() the device is
      actually checked for snapshot support.
      
      So, in cases where the first device supports snapshots, and the second does not,
      the snapshot on the first will happen anyways. I believe this is not a good
      behavior. It should be an all or nothing process.
      
      This patch addresses these issues by making bdrv_can_snapshot() actually do
      what it must do and enforces better tests to avoid errors in the middle of
      do_savevm(). bdrv_has_snapshot() is removed and replaced by bdrv_can_snapshot()
      where appropriate.
      
      bdrv_can_snapshot() was moved from savevm.c to block.c. It makes more sense to me.
      
      The loadvm_state() function was updated too to enforce that when loading a VM at
      least all writable devices must support snapshots too.
      Signed-off-by: NMiguel Di Ciurcio Filho <miguel.filho@gmail.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      feeee5ac
  15. 04 6月, 2010 2 次提交
  16. 15 5月, 2010 2 次提交
    • J
      vmstate: Add support for alias ID · 4d2ffa08
      Jan Kiszka 提交于
      Some legacy users (mostly PC devices) of vmstate_register manage
      instance IDs on their own, and that unfortunately in a way that is
      incompatible with automatically generated ones. This so far prevents
      switching those users to vmstates that are registered by qdev.
      
      To establish a migration path, this patch introduces the concept of
      alias IDs. They can be passed to an extended vmstate registration
      service, and qdev provides a set service to be used during device init.
      find_se will consider the alias in addition to the default ID. We can
      then start generating the default ID automatically and writing it on
      vmsave, thus converting that format without breaking support for upward
      migration.
      
      The user is required specify the highest vmstate version for which the
      alias is required. Once this version falls behind the minimum required
      for a specific vmstate, an assertion triggers to motivate cleaning up
      the obsolete alias.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
      4d2ffa08
    • J
      vmstate: Drop unused post_save handler · ec86f3e1
      Jan Kiszka 提交于
      No device makes use of it anymore.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
      ec86f3e1
  17. 04 5月, 2010 1 次提交
  18. 16 3月, 2010 2 次提交
    • M
      error: Replace qemu_error() by error_report() · 1ecda02b
      Markus Armbruster 提交于
      error_report() terminates the message with a newline.  Strip it it
      from its arguments.
      
      This fixes a few error messages lacking a newline:
      net_handle_fd_param()'s "No file descriptor named %s found", and
      tap_open()'s "vnet_hdr=1 requested, but no kernel support for
      IFF_VNET_HDR available" (all three versions).
      
      There's one place that passes arguments without newlines
      intentionally: load_vmstate().  Fix it up.
      1ecda02b
    • M
      savevm: Fix -loadvm to report errors to stderr, not the monitor · 03cd4655
      Markus Armbruster 提交于
      A monitor may not even exist.
      
      Change load_vmstate() to use qemu_error() instead of monitor_printf().
      Parameter mon is now unused, remove it.
      03cd4655
  19. 13 3月, 2010 1 次提交
  20. 04 3月, 2010 1 次提交
    • J
      KVM: Rework VCPU state writeback API · ea375f9a
      Jan Kiszka 提交于
      This grand cleanup drops all reset and vmsave/load related
      synchronization points in favor of four(!) generic hooks:
      
      - cpu_synchronize_all_states in qemu_savevm_state_complete
        (initial sync from kernel before vmsave)
      - cpu_synchronize_all_post_init in qemu_loadvm_state
        (writeback after vmload)
      - cpu_synchronize_all_post_init in main after machine init
      - cpu_synchronize_all_post_reset in qemu_system_reset
        (writeback after system reset)
      
      These writeback points + the existing one of VCPU exec after
      cpu_synchronize_state map on three levels of writeback:
      
      - KVM_PUT_RUNTIME_STATE (during runtime, other VCPUs continue to run)
      - KVM_PUT_RESET_STATE   (on synchronous system reset, all VCPUs stopped)
      - KVM_PUT_FULL_STATE    (on init or vmload, all VCPUs stopped as well)
      
      This level is passed to the arch-specific VCPU state writing function
      that will decide which concrete substates need to be written. That way,
      no writer of load, save or reset functions that interact with in-kernel
      KVM states will ever have to worry about synchronization again. That
      also means that a lot of reasons for races, segfaults and deadlocks are
      eliminated.
      
      cpu_synchronize_state remains untouched, just as Anthony suggested. We
      continue to need it before reading or writing of VCPU states that are
      also tracked by in-kernel KVM subsystems.
      
      Consequently, this patch removes many cpu_synchronize_state calls that
      are now redundant, just like remaining explicit register syncs.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      ea375f9a
  21. 27 1月, 2010 1 次提交
    • M
      fix savevm command without id or tag · f139a412
      Marcelo Tosatti 提交于
      savevm without id or tag segfaults in:
      
      (gdb) bt
      #0  0x00007f600a83bf8a in __strcmp_sse42 () from /lib64/libc.so.6
      #1  0x00000000004745b6 in bdrv_snapshot_find (bs=<value optimized out>,
          sn_info=0x7fff996be280, name=0x0) at savevm.c:1631
      #2  0x0000000000475c80 in del_existing_snapshots (name=<value optimized out>,
          mon=<value optimized out>) at savevm.c:1654
      #3  do_savevm (name=<value optimized out>, mon=<value optimized out>)
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      f139a412
  22. 26 12月, 2009 1 次提交
  23. 04 12月, 2009 7 次提交
  24. 03 12月, 2009 1 次提交
  25. 30 11月, 2009 1 次提交
  26. 17 11月, 2009 1 次提交
    • L
      Block live migration · c163b5ca
      lirans@il.ibm.com 提交于
      This patch introduces block migration called during live migration. Block
      are being copied to the destination in an async way. First the code will
      transfer the whole disk and then transfer all dirty blocks accumulted during
      the migration.
      Still need to improve transition from the iterative phase of migration to the
      end phase. For now transition will take place when all blocks transfered once,
      all the dirty blocks will be transfered during the end phase (guest is
      suspended).
      
      Changes from v4:
      - Global variabels moved to a global state structure allocated dynamically.
      - Minor coding style issues.
      - Poll block.c for tracking of dirty blocks instead of manage it here.
      Signed-off-by: NLiran Schour <lirans@il.ibm.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      c163b5ca
  27. 13 11月, 2009 2 次提交