Skip to content
Snippets Groups Projects
  1. Sep 10, 2019
  2. Aug 15, 2019
  3. Sep 25, 2018
  4. Aug 31, 2018
    • John Snow's avatar
      jobs: utilize job_exit shim · eb23654d
      John Snow authored
      
      Utilize the job_exit shim by not calling job_defer_to_main_loop, and
      where applicable, converting the deferred callback into the job_exit
      callback.
      
      This converts backup, stream, create, and the unit tests all at once.
      Most of these jobs do not see any changes to the order in which they
      clean up their resources, except the test-blockjob-txn test, which
      now puts down its bs before job_completed is called.
      
      This is safe for the same reason the reordering in the mirror job is
      safe, because job_completed no longer runs under two locks, making
      the unref safe even if it causes a flush.
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
      Message-id: 20180830015734.19765-7-jsnow@redhat.com
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      eb23654d
    • John Snow's avatar
      jobs: canonize Error object · 3d1f8b07
      John Snow authored
      
      Jobs presently use both an Error object in the case of the create job,
      and char strings in the case of generic errors elsewhere.
      
      Unify the two paths as just j->err, and remove the extra argument from
      job_completed. The integer error code for job_completed is kept for now,
      to be removed shortly in a separate patch.
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-id: 20180830015734.19765-3-jsnow@redhat.com
      [mreitz: Dropped a superfluous g_strdup()]
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      3d1f8b07
    • John Snow's avatar
      jobs: change start callback to run callback · f67432a2
      John Snow authored
      
      Presently we codify the entry point for a job as the "start" callback,
      but a more apt name would be "run" to clarify the idea that when this
      function returns we consider the job to have "finished," except for
      any cleanup which occurs in separate callbacks later.
      
      As part of this clarification, change the signature to include an error
      object and a return code. The error ptr is not yet used, and the return
      code while captured, will be overwritten by actions in the job_completed
      function.
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
      Message-id: 20180830015734.19765-2-jsnow@redhat.com
      Reviewed-by: default avatarJeff Cody <jcody@redhat.com>
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      f67432a2
  5. May 30, 2018
    • Kevin Wolf's avatar
      job: Add error message for failing jobs · 1266c9b9
      Kevin Wolf authored
      
      So far we relied on job->ret and strerror() to produce an error message
      for failed jobs. Not surprisingly, this tends to result in completely
      useless messages.
      
      This adds a Job.error field that can contain an error string for a
      failing job, and a parameter to job_completed() that sets the field. As
      a default, if NULL is passed, we continue to use strerror(job->ret).
      
      All existing callers are changed to pass NULL. They can be improved in
      separate patches.
      
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
      Reviewed-by: default avatarJeff Cody <jcody@redhat.com>
      1266c9b9
  6. May 23, 2018
  7. Mar 19, 2018
    • Liang Li's avatar
      block/mirror: change the semantic of 'force' of block-job-cancel · b76e4458
      Liang Li authored
      
      When doing drive mirror to a low speed shared storage, if there was heavy
      BLK IO write workload in VM after the 'ready' event, drive mirror block job
      can't be canceled immediately, it would keep running until the heavy BLK IO
      workload stopped in the VM.
      
      Libvirt depends on the current block-job-cancel semantics, which is that
      when used without a flag after the 'ready' event, the command blocks
      until data is in sync.  However, these semantics are awkward in other
      situations, for example, people may use drive mirror for realtime
      backups while still wanting to use block live migration.  Libvirt cannot
      start a block live migration while another drive mirror is in progress,
      but the user would rather abandon the backup attempt as broken and
      proceed with the live migration than be stuck waiting for the current
      drive mirror backup to finish.
      
      The drive-mirror command already includes a 'force' flag, which libvirt
      does not use, although it documented the flag as only being useful to
      quit a job which is paused.  However, since quitting a paused job has
      the same effect as abandoning a backup in a non-paused job (namely, the
      destination file is not in sync, and the command completes immediately),
      we can just improve the documentation to make the force flag obviously
      useful.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Jeff Cody <jcody@redhat.com>
      Cc: Kevin Wolf <kwolf@redhat.com>
      Cc: Max Reitz <mreitz@redhat.com>
      Cc: Eric Blake <eblake@redhat.com>
      Cc: John Snow <jsnow@redhat.com>
      Reported-by: default avatarHuaitong Han <huanhuaitong@didichuxing.com>
      Signed-off-by: default avatarHuaitong Han <huanhuaitong@didichuxing.com>
      Signed-off-by: default avatarLiang Li <liliangleo@didichuxing.com>
      Signed-off-by: default avatarJeff Cody <jcody@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      b76e4458
    • John Snow's avatar
      blockjobs: model single jobs as transactions · 75859b94
      John Snow authored
      
      model all independent jobs as single job transactions.
      
      It's one less case we have to worry about when we add more states to the
      transition machine. This way, we can just treat all job lifetimes exactly
      the same. This helps tighten assertions of the STM graph and removes some
      conditionals that would have been needed in the coming commits adding a
      more explicit job lifetime management API.
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      75859b94
  8. Nov 29, 2017
  9. May 24, 2017
  10. Apr 11, 2017
  11. Feb 28, 2017
  12. Feb 24, 2017
  13. Nov 15, 2016
    • John Snow's avatar
      blockjob: add block_job_start · 5ccac6f1
      John Snow authored
      
      Instead of automatically starting jobs at creation time via backup_start
      et al, we'd like to return a job object pointer that can be started
      manually at later point in time.
      
      For now, add the block_job_start mechanism and start the jobs
      automatically as we have been doing, with conversions job-by-job coming
      in later patches.
      
      Of note: cancellation of unstarted jobs will perform all the normal
      cleanup as if the job had started, particularly abort and clean. The
      only difference is that we will not emit any events, because the job
      never actually started.
      
      Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
      Message-id: 1478587839-9834-5-git-send-email-jsnow@redhat.com
      Signed-off-by: default avatarJeff Cody <jcody@redhat.com>
      5ccac6f1
  14. Nov 01, 2016
  15. Jul 13, 2016
    • Paolo Bonzini's avatar
      coroutine: move entry argument to qemu_coroutine_create · 0b8b8753
      Paolo Bonzini authored
      
      In practice the entry argument is always known at creation time, and
      it is confusing that sometimes qemu_coroutine_enter is used with a
      non-NULL argument to re-enter a coroutine (this happens in
      block/sheepdog.c and tests/test-coroutine.c).  So pass the opaque value
      at creation time, for consistency with e.g. aio_bh_new.
      
      Mostly done with the following semantic patch:
      
      @ entry1 @
      expression entry, arg, co;
      @@
      - co = qemu_coroutine_create(entry);
      + co = qemu_coroutine_create(entry, arg);
        ...
      - qemu_coroutine_enter(co, arg);
      + qemu_coroutine_enter(co);
      
      @ entry2 @
      expression entry, arg;
      identifier co;
      @@
      - Coroutine *co = qemu_coroutine_create(entry);
      + Coroutine *co = qemu_coroutine_create(entry, arg);
        ...
      - qemu_coroutine_enter(co, arg);
      + qemu_coroutine_enter(co);
      
      @ entry3 @
      expression entry, arg;
      @@
      - qemu_coroutine_enter(qemu_coroutine_create(entry), arg);
      + qemu_coroutine_enter(qemu_coroutine_create(entry, arg));
      
      @ reentry @
      expression co;
      @@
      - qemu_coroutine_enter(co, NULL);
      + qemu_coroutine_enter(co);
      
      except for the aforementioned few places where the semantic patch
      stumbled (as expected) and for test_co_queue, which would otherwise
      produce an uninitialized variable warning.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: default avatarFam Zheng <famz@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      0b8b8753
    • Alberto Garcia's avatar
      blockjob: Add 'job_id' parameter to block_job_create() · 7f0317cf
      Alberto Garcia authored
      
      When a new job is created, the job ID is taken from the device name of
      the BDS. This patch adds a new 'job_id' parameter to let the caller
      provide one instead.
      
      This patch also verifies that the ID is always unique and well-formed.
      This causes problems in a couple of places where no ID is being set,
      because the BDS does not have a device name.
      
      In the case of test_block_job_start() (from test-blockjob-txn.c) we
      can simply use this new 'job_id' parameter to set the missing ID.
      
      In the case of img_commit() (from qemu-img.c) we still don't have the
      API to make commit_active_start() set the job ID, so we solve it by
      setting a default value. We'll get rid of this as soon as we extend
      the API.
      
      Signed-off-by: default avatarAlberto Garcia <berto@igalia.com>
      Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
      Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      7f0317cf
  16. Jun 07, 2016
  17. May 25, 2016
  18. Mar 22, 2016
    • Markus Armbruster's avatar
      include/qemu/osdep.h: Don't include qapi/error.h · da34e65c
      Markus Armbruster authored
      
      Commit 57cb38b3 included qapi/error.h into qemu/osdep.h to get the
      Error typedef.  Since then, we've moved to include qemu/osdep.h
      everywhere.  Its file comment explains: "To avoid getting into
      possible circular include dependencies, this file should not include
      any other QEMU headers, with the exceptions of config-host.h,
      compiler.h, os-posix.h and os-win32.h, all of which are doing a
      similar job to this file and are under similar constraints."
      qapi/error.h doesn't do a similar job, and it doesn't adhere to
      similar constraints: it includes qapi-types.h.  That's in excess of
      100KiB of crap most .c files don't actually need.
      
      Add the typedef to qemu/typedefs.h, and include that instead of
      qapi/error.h.  Include qapi/error.h in .c files that need it and don't
      get it now.  Include qapi-types.h in qom/object.h for uint16List.
      
      Update scripts/clean-includes accordingly.  Update it further to match
      reality: replace config.h by config-target.h, add sysemu/os-posix.h,
      sysemu/os-win32.h.  Update the list of includes in the qemu/osdep.h
      comment quoted above similarly.
      
      This reduces the number of objects depending on qapi/error.h from "all
      of them" to less than a third.  Unfortunately, the number depending on
      qapi-types.h shrinks only a little.  More work is needed for that one.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      [Fix compilation without the spice devel packages. - Paolo]
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      da34e65c
  19. Feb 16, 2016
  20. Nov 12, 2015
Loading