1. 25 7月, 2011 1 次提交
    • B
      Wrap recv to avoid warnings · 00aa0040
      Blue Swirl 提交于
      Avoid warnings like these by wrapping recv():
        CC    slirp/ip_icmp.o
      /src/qemu/slirp/ip_icmp.c: In function 'icmp_receive':
      /src/qemu/slirp/ip_icmp.c:418:5: error: passing argument 2 of 'recv' from incompatible pointer type [-Werror]
      /usr/local/lib/gcc/i686-mingw32msvc/4.6.0/../../../../i686-mingw32msvc/include/winsock2.h:547:32: note: expected 'char *' but argument is of type 'struct icmp *'
      
      Remove also casts used to avoid warnings.
      Reviewed-by: NAnthony Liguori <aliguori@us.ibm.com>
      Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
      00aa0040
  2. 16 6月, 2011 1 次提交
    • J
      Reset system before loadvm · 5a8a49d7
      Jan Kiszka 提交于
      In case we load the vmstate during incoming migration, we start from a
      clean, default machine state as we went through system reset before. But
      if we load from a snapshot, the machine can be in any state. That can
      cause troubles if loading an older image which does not carry all state
      information the executing QEMU requires. Hardly any device takes care of
      this scenario.
      
      However, fixing this is trivial. We just need to issue a system reset
      during loadvm as well.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      5a8a49d7
  3. 08 6月, 2011 1 次提交
  4. 16 4月, 2011 2 次提交
  5. 22 3月, 2011 1 次提交
  6. 21 3月, 2011 2 次提交
    • P
      change all other clock references to use nanosecond resolution accessors · 74475455
      Paolo Bonzini 提交于
      This was done with:
      
          sed -i 's/qemu_get_clock\>/qemu_get_clock_ns/' \
              $(git grep -l 'qemu_get_clock\>' )
          sed -i 's/qemu_new_timer\>/qemu_new_timer_ns/' \
              $(git grep -l 'qemu_new_timer\>' )
      
      after checking that get_clock and new_timer never occur twice
      on the same line.  There were no missed occurrences; however, even
      if there had been, they would have been caught by the compiler.
      
      There was exactly one false positive in qemu_run_timers:
      
           -    current_time = qemu_get_clock (clock);
           +    current_time = qemu_get_clock_ns (clock);
      
      which is of course not in this patch.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      74475455
    • P
      change all rt_clock references to use millisecond resolution accessors · 7bd427d8
      Paolo Bonzini 提交于
      This was done with:
      
          sed -i '/get_clock\>.*rt_clock/s/get_clock\>/get_clock_ms/' \
              $(git grep -l 'get_clock\>.*rt_clock' )
          sed -i '/new_timer\>.*rt_clock/s/new_timer\>/new_timer_ms/' \
              $(git grep -l 'new_timer\>.*rt_clock' )
      
      after checking that get_clock and new_timer never occur twice
      on the same line.  There were no missed occurrences; however, even
      if there had been, they would have been caught by the compiler.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7bd427d8
  7. 15 3月, 2011 1 次提交
  8. 11 3月, 2011 3 次提交
  9. 14 2月, 2011 1 次提交
  10. 04 2月, 2011 1 次提交
  11. 31 1月, 2011 1 次提交
    • M
      blockdev: Fix regression in -drive if=scsi,index=N · 27d6bf40
      Markus Armbruster 提交于
      Before commit 622b520f, index=12 meant bus=1,unit=5.
      
      Since the commit, it means bus=0,unit=12.  The drive is created, but
      not the guest device.  That's because the controllers we use with
      if=scsi drives (lsi53c895a and esp) support only 7 units, and
      scsi_bus_legacy_handle_cmdline() ignores drives with unit numbers
      exceeding that limit.
      
      Changing the mapping of index to bus, unit is a regression.  Breaking
      -drive invocations that used to work just makes it worse.
      
      Revert the part of commit 622b520f that causes this, and clean up
      some.
      
      Note that the fix only affects if=scsi.  You can still put more than 7
      units on a SCSI bus with -device & friends.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      27d6bf40
  12. 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
  13. 09 12月, 2010 1 次提交
  14. 03 12月, 2010 1 次提交
  15. 01 11月, 2010 1 次提交
  16. 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
  17. 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
  18. 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
  19. 11 8月, 2010 1 次提交
  20. 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
  21. 31 7月, 2010 1 次提交
  22. 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
  23. 06 7月, 2010 2 次提交
  24. 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
  25. 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
  26. 04 6月, 2010 2 次提交
  27. 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
  28. 04 5月, 2010 1 次提交
  29. 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
  30. 13 3月, 2010 1 次提交