1. 15 6月, 2010 1 次提交
    • 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
  2. 04 6月, 2010 2 次提交
  3. 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
  4. 04 5月, 2010 1 次提交
  5. 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
  6. 13 3月, 2010 1 次提交
  7. 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
  8. 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
  9. 26 12月, 2009 1 次提交
  10. 04 12月, 2009 7 次提交
  11. 03 12月, 2009 1 次提交
  12. 30 11月, 2009 1 次提交
  13. 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
  14. 13 11月, 2009 2 次提交
  15. 28 10月, 2009 8 次提交
  16. 15 10月, 2009 1 次提交
  17. 05 10月, 2009 4 次提交
  18. 12 9月, 2009 3 次提交