Re: [Qemu-block] [PATCH 42/42] qemu-iotests: Test job-* with block jobs

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > This adds a test case that tests the new job-* QMP commands with > mirror and backup block jobs. > > Signed-off-by: Kevin Wolf > --- > tests/qemu-iotests/219 | 201 > tests/qemu-iotests/219.out | 327 >

Re: [Qemu-block] [Qemu-devel] [PATCH 21/42] job: Replace BlockJob.completed with job_is_completed()

2018-05-14 Thread John Snow
On 05/09/2018 12:26 PM, Kevin Wolf wrote: > Since we introduced an explicit status to block job, BlockJob.completed > is redundant because it can be derived from the status. Remove the field > from BlockJob and add a function to derive it from the status at the Job > level. > You're braver

Re: [Qemu-block] [Qemu-devel] [PATCH 20/42] job: Move pause/resume functions to Job

2018-05-14 Thread John Snow
On 05/09/2018 12:26 PM, Kevin Wolf wrote: > While we already moved the state related to job pausing to Job, the > functions to do were still BlockJob only. This commit moves them over to > Job. > > Signed-off-by: Kevin Wolf I'm slightly sad about the new callback, because it

Re: [Qemu-block] [PATCH 41/42] iotests: Move qmp_to_opts() to VM

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > qmp_to_opts() used to be a method of QMPTestCase, but recently we > started to add more Python test cases that don't make use of > QMPTestCase. In order to make the method usable there, move it to VM. > > Signed-off-by: Kevin Wolf > ---

Re: [Qemu-block] [PATCH 40/42] job: Add query-jobs QMP command

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > This adds a minimal query-jobs implementation that shouldn't pose many > design questions. It can later be extended to expose more information, > and especially job-specific information. > > Signed-off-by: Kevin Wolf > --- >

Re: [Qemu-block] [Qemu-devel] [PATCH 19/42] job: Add job_sleep_ns()

2018-05-14 Thread John Snow
On 05/09/2018 12:26 PM, Kevin Wolf wrote: > There is nothing block layer specific about block_job_sleep_ns(), so > move the function to Job. > > Signed-off-by: Kevin Wolf > --- > include/block/blockjob_int.h | 11 --- > include/qemu/job.h | 17

Re: [Qemu-block] [Qemu-devel] [PATCH 18/42] job: Move coroutine and related code to Job

2018-05-14 Thread John Snow
On 05/09/2018 12:26 PM, Kevin Wolf wrote: > This commit moves some core functions for dealing with the job coroutine > from BlockJob to Job. This includes primarily entering the coroutine > (both for the first and reentering) and yielding explicitly and at pause > points. > > Signed-off-by:

Re: [Qemu-block] [PATCH 39/42] job: Add lifecycle QMP commands

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > This adds QMP commands that control the transition between states of the > job lifecycle. > > Signed-off-by: Kevin Wolf > --- > qapi/job.json | 112 ++ > job-qmp.c | 140 >

Re: [Qemu-block] [Qemu-devel] [PATCH 17/42] job: Move defer_to_main_loop to Job

2018-05-14 Thread John Snow
On 05/09/2018 12:26 PM, Kevin Wolf wrote: > Signed-off-by: Kevin Wolf Hmm, this one is a bit more than just code motion due to the way the aio_context acquisition has changed. I think at a minimum a good commit message is warranted. > --- > include/block/blockjob.h |

Re: [Qemu-block] [PATCH 34/42] job: Add job_dismiss()

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > This moves block_job_dismiss() to the Job layer. > > Signed-off-by: Kevin Wolf > --- > include/block/blockjob.h | 9 - > include/qemu/job.h | 7 ++- > blockdev.c | 8 +--- > blockjob.c

Re: [Qemu-block] [PATCH 38/42] job: Add JOB_STATUS_CHANGE QMP event

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > This adds a QMP event that is emitted whenever a job transitions from > one status to another. For the event, a new qapi/job.json schema file is > created which will contain all job-related definitions that aren't tied > to the block layer. > >

Re: [Qemu-block] [Qemu-devel] [PATCH 16/42] job: Add Job.aio_context

2018-05-14 Thread John Snow
On 05/09/2018 12:26 PM, Kevin Wolf wrote: > When block jobs need an AioContext, they just take it from their main > block node. Generic jobs don't have a main block node, so we need to > assign them an AioContext explicitly. > > Signed-off-by: Kevin Wolf Nothing uses the

Re: [Qemu-block] [Qemu-devel] [PATCH 14/42] job: Add reference counting

2018-05-14 Thread John Snow
On 05/09/2018 12:26 PM, Kevin Wolf wrote: > This moves reference counting from BlockJob to Job. > > In order to keep calling the BlockJob cleanup code when the job is > deleted via job_unref(), introduce a new JobDriver.free callback. Every > block job must use block_job_free() for this

Re: [Qemu-block] [PATCH 37/42] job: Move progress fields to Job

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > BlockJob has fields .offset and .len, which are actually misnomers today > because they are no longer tied to block device sizes, but just progress > counters. As such they make a lot of sense in generic Jobs. > > This patch moves the fields to Job and

Re: [Qemu-block] [PATCH 36/42] job: Add job_transition_to_ready()

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > The transition to the READY state was still performed in the BlockJob > layer, in the same function that sent the BLOCK_JOB_READY QMP event. > > This patch brings the state transition to the Job layer and implements > the QMP event using a notifier called

Re: [Qemu-block] [PATCH 31/42] job: Move transactions to Job

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > This moves the logic that implements job transactions from BlockJob to > Job. > > Signed-off-by: Kevin Wolf > --- > include/block/blockjob.h | 54 -- > include/block/blockjob_int.h | 10 -- > include/qemu/job.h |

Re: [Qemu-block] [PATCH 35/42] job: Add job_is_ready()

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > Instead of having a 'bool ready' in BlockJob, add a function that > derives its value from the job status. > > At the same time, this fixes the behaviour to match what the QAPI > documentation promises for query-block-job: 'true if the job may be >

Re: [Qemu-block] [PATCH 34/42] job: Add job_dismiss()

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > This moves block_job_dismiss() to the Job layer. > > Signed-off-by: Kevin Wolf > --- > include/block/blockjob.h | 9 - > include/qemu/job.h | 7 ++- > blockdev.c | 8 +--- > blockjob.c

Re: [Qemu-block] [PATCH 33/42] job: Add job_yield()

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > This moves block_job_yield() to the Job layer. > > Signed-off-by: Kevin Wolf > --- > include/block/blockjob_int.h | 8 > include/qemu/job.h | 9 +++-- > block/backup.c | 2 +- > block/mirror.c

Re: [Qemu-block] [Qemu-devel] [PATCH 13/42] job: Move state transitions to Job

2018-05-14 Thread John Snow
On 05/09/2018 12:26 PM, Kevin Wolf wrote: > This moves BlockJob.status and the closely related functions > (block_)job_state_transition() and (block_)job_apply_verb to Job. The > two QAPI enums are renamed to JobStatus and JobVerb. > > Signed-off-by: Kevin Wolf In good faith

Re: [Qemu-block] [PATCH 32/42] job: Move completion and cancellation to Job

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > This moves the top-level job completion and cancellation functions from > BlockJob to Job. > > Signed-off-by: Kevin Wolf > --- > include/block/blockjob.h | 55 --- > include/block/blockjob_int.h | 18

Re: [Qemu-block] [Qemu-devel] [PATCH 12/42] job: Maintain a list of all jobs

2018-05-14 Thread John Snow
On 05/09/2018 12:26 PM, Kevin Wolf wrote: > This moves the job list from BlockJob to Job. Now we can check for > duplicate IDs in job_create(). > > Signed-off-by: Kevin Wolf Reviewed-by: John Snow

Re: [Qemu-block] [PATCH 31/42] job: Move transactions to Job

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > This moves the logic that implements job transactions from BlockJob to > Job. > > Signed-off-by: Kevin Wolf > --- > include/block/blockjob.h | 54 -- > include/block/blockjob_int.h | 10 -- > include/qemu/job.h |

Re: [Qemu-block] [Qemu-devel] [PATCH 10/42] job: Add JobDriver.job_type

2018-05-14 Thread John Snow
On 05/11/2018 06:53 PM, Max Reitz wrote: > On 2018-05-09 18:26, Kevin Wolf wrote: >> This moves the job_type field from BlockJobDriver to JobDriver. >> >> Signed-off-by: Kevin Wolf Reviewed-by: John Snow >> --- >> include/block/blockjob_int.h | 3 --- >>

Re: [Qemu-block] [Qemu-devel] [PATCH 09/42] job: Rename BlockJobType into JobType

2018-05-14 Thread John Snow
On 05/09/2018 12:26 PM, Kevin Wolf wrote: > QAPI types aren't externally visible, so we can rename them without > causing problems. Before we add a job type to Job, rename the enum > so it can be used for more than just block jobs. > So we will be registering all jobs in a central place. >

Re: [Qemu-block] [PATCH 30/42] job: Switch transactions to JobTxn

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > This doesn't actually move any transaction code to Job yet, but it > renames the type for transactions from BlockJobTxn to JobTxn and makes > them contain Jobs rather than BlockJobs > > Signed-off-by: Kevin Wolf > --- >

Re: [Qemu-block] [Qemu-devel] [PATCH 08/42] job: Create Job, JobDriver and job_create()

2018-05-14 Thread John Snow
On 05/09/2018 12:26 PM, Kevin Wolf wrote: > This is the first step towards creating an infrastructure for generic > background jobs that aren't tied to a block device. For now, Job only > stores its ID and JobDriver, the rest stays in BlockJob. > > The following patches will move over more

Re: [Qemu-block] [PATCH 29/42] job: Move job_finish_sync() to Job

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > block_job_finish_sync() doesn't contain anything block job specific any > more, so it can be moved to Job. > > Signed-off-by: Kevin Wolf > --- > include/qemu/job.h | 9 + > blockjob.c | 55 >

Re: [Qemu-block] [Qemu-devel] [PATCH 07/42] blockjob: Remove block_job_pause/resume_all()

2018-05-14 Thread John Snow
On 05/11/2018 06:30 PM, Max Reitz wrote: > On 2018-05-09 18:26, Kevin Wolf wrote: >> Commit 81193349 removed the only use of block_job_pause/resume_all(), >> which was in bdrv_drain_all(). The functions are now unused and can be >> removed. > > I have a strange liking for all-digit commit hash

Re: [Qemu-block] [Qemu-devel] [PATCH 06/42] blockjob: Add block_job_driver()

2018-05-14 Thread John Snow
On 05/09/2018 12:26 PM, Kevin Wolf wrote: > The backup block job directly accesses the driver field in BlockJob. Add > a wrapper for getting it. > > Signed-off-by: Kevin Wolf > Reviewed-by: Eric Blake I'm not too far into this series yet but I suppose it

Re: [Qemu-block] [PATCH 28/42] job: Move .complete callback to Job

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > This moves the .complete callback that tells a READY job to complete > from BlockJobDriver to JobDriver. The wrapper function job_complete() > doesn't require anything block job specific any more and can be moved > to Job. > > Signed-off-by: Kevin Wolf

Re: [Qemu-block] [Qemu-devel] [PATCH 05/42] blockjob: Introduce block_job_ratelimit_get_delay()

2018-05-14 Thread John Snow
On 05/09/2018 12:26 PM, Kevin Wolf wrote: > This gets us rid of more direct accesses to BlockJob fields from the > job drivers. > > Signed-off-by: Kevin Wolf > Reviewed-by: Eric Blake Reviewed-by: John Snow > --- >

Re: [Qemu-block] [Qemu-devel] [PATCH 04/42] blockjob: Implement block_job_set_speed() centrally

2018-05-14 Thread John Snow
On 05/09/2018 12:25 PM, Kevin Wolf wrote: > All block job drivers support .set_speed and all of them duplicate the > same code to implement it. Move that code to blockjob.c and remove the > now useless callback.  > > Signed-off-by: Kevin Wolf > Reviewed-by: Eric Blake

Re: [Qemu-block] [PATCH 27/42] job: Add job_drain()

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > block_job_drain() contains a blk_drain() call which cannot be moved to > Job, so add a new JobDriver callback JobDriver.drain which has a common > implementation for all BlockJobs. In addition to this we keep the > existing BlockJobDriver.drain callback

Re: [Qemu-block] [Qemu-devel] [PATCH 03/42] blockjob: Move RateLimit to BlockJob

2018-05-14 Thread John Snow
On 05/09/2018 12:25 PM, Kevin Wolf wrote: > Every block job has a RateLimit, and they all do the exact same thing > with it, so it should be common infrastructure. Move the struct field > for a start. > > Signed-off-by: Kevin Wolf > Reviewed-by: Eric Blake

Re: [Qemu-block] [Qemu-devel] [PATCH 02/42] blockjob: Wrappers for progress counter access

2018-05-14 Thread John Snow
On 05/09/2018 12:25 PM, Kevin Wolf wrote: > Block job drivers are not expected to mess with the internals of the > BlockJob object, so provide wrapper functions for one of the cases where > they still do it: Updating the progress counter. > > Signed-off-by: Kevin Wolf >

Re: [Qemu-block] [PATCH 26/42] job: Convert block_job_cancel_async() to Job

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > block_job_cancel_async() did two things that were still block job > specific: > > * Setting job->force. This field makes sense on the Job level, so we can > just move it. While at it, rename it to job->force_cancel to make its > purpose more obvious. >

Re: [Qemu-block] [PATCH 25/42] job: Move single job finalisation to Job

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > This moves the finalisation of a single job from BlockJob to Job. > > Some part of this code depends on job transactions, and job transactions > call this code, we introduce some temporary calls from Job functions to > BlockJob ones. This will be fixed

Re: [Qemu-block] [PATCH 24/42] job: Add job_event_*()

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > Go through the Job layer in order to send QMP events. For the moment, > these functions only call a notifier in the BlockJob layer that sends > the existing commands. > > This uses notifiers rather than JobDriver callbacks because internal > users of jobs

Re: [Qemu-block] [PATCH 23/42] blockjob: Split block_job_event_pending()

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > block_job_event_pending() doesn't only send a QMP event, but it also > transitions to the PENDING state. Split the function so that we get one > part only sending the event (like other block_job_event_* functions) and > another part than does the state

Re: [Qemu-block] [PULL 0/8] Block patches

2018-05-14 Thread Peter Maydell
On 12 May 2018 at 10:28, Stefan Hajnoczi wrote: > The following changes since commit e5cd695266c5709308aa95b1baae499e4b5d4544: > > Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into > staging (2018-05-08 17:05:58 +0100) > > are available in the Git

Re: [Qemu-block] [PATCH 22/42] job: Move BlockJobCreateFlags to Job

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > This renames the BlockJobCreateFlags constants, moves a few JOB_INTERNAL > checks to job_create() and the auto_{finalize,dismiss} fields from > BlockJob to Job. > > Signed-off-by: Kevin Wolf > --- > include/block/blockjob.h | 17

Re: [Qemu-block] [PATCH 21/42] job: Replace BlockJob.completed with job_is_completed()

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > Since we introduced an explicit status to block job, BlockJob.completed > is redundant because it can be derived from the status. Remove the field > from BlockJob and add a function to derive it from the status at the Job > level. > > Signed-off-by: Kevin

Re: [Qemu-block] [PATCH 20/42] job: Move pause/resume functions to Job

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > While we already moved the state related to job pausing to Job, the > functions to do were still BlockJob only. This commit moves them over to > Job. > > Signed-off-by: Kevin Wolf > --- > include/block/blockjob.h | 32

Re: [Qemu-block] [PATCH 19/42] job: Add job_sleep_ns()

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > There is nothing block layer specific about block_job_sleep_ns(), so > move the function to Job. > > Signed-off-by: Kevin Wolf > --- > include/block/blockjob_int.h | 11 --- > include/qemu/job.h | 17 +

Re: [Qemu-block] [PATCH 18/42] job: Move coroutine and related code to Job

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > This commit moves some core functions for dealing with the job coroutine > from BlockJob to Job. This includes primarily entering the coroutine > (both for the first and reentering) and yielding explicitly and at pause > points. > > Signed-off-by: Kevin

Re: [Qemu-block] [PULL 0/8] Block patches

2018-05-14 Thread Peter Maydell
On 14 May 2018 at 14:15, Peter Maydell wrote: > On 12 May 2018 at 10:28, Stefan Hajnoczi wrote: >> The following changes since commit e5cd695266c5709308aa95b1baae499e4b5d4544: >> >> Merge remote-tracking branch

Re: [Qemu-block] [PATCH 17/42] job: Move defer_to_main_loop to Job

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > Signed-off-by: Kevin Wolf > --- > include/block/blockjob.h | 5 > include/block/blockjob_int.h | 19 --- > include/qemu/job.h | 20 > block/backup.c | 7 +++--- >

Re: [Qemu-block] [RFC 10/10] python: futurize -f lib2to3.fixes.fix_numliterals

2018-05-14 Thread Philippe Mathieu-Daudé
On 05/11/2018 07:20 PM, Eduardo Habkost wrote: > Convert octal literals into the new syntax. > > This is necessary for Python 3 compatibility. > > Done using: > > $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ > sort -u | grep -v README.sh4) > $ futurize -w

Re: [Qemu-block] [RFC 04/10] python: futurize -f lib2to3.fixes.fix_has_key

2018-05-14 Thread Philippe Mathieu-Daudé
On 05/11/2018 07:20 PM, Eduardo Habkost wrote: > Change "dict.has_key(key)" to "key in dict" > > This is necessary for Python 3 compatibility. > > Done using: > > $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ > sort -u | grep -v README.sh4) > $ futurize -w

Re: [Qemu-block] [PATCH 16/42] job: Add Job.aio_context

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > When block jobs need an AioContext, they just take it from their main > block node. Generic jobs don't have a main block node, so we need to > assign them an AioContext explicitly. > > Signed-off-by: Kevin Wolf > --- >

Re: [Qemu-block] [RFC PATCH 07/12] qcow2-bitmap: add basic bitmaps info

2018-05-14 Thread Vladimir Sementsov-Ogievskiy
12.05.2018 04:25, John Snow wrote: Add functions for querying the basic information inside of bitmaps. Restructure the bitmaps flags masks to facilitate providing a list of flags belonging to the bitmap(s) being queried. Signed-off-by: John Snow --- block/qcow2-bitmap.c |

Re: [Qemu-block] [PATCH 15/42] job: Move cancelled to Job

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > We cannot yet move the whole logic around job cancelling to Job because > it depends on quite a few other things that are still only in BlockJob, > but we can move the cancelled field at least. > > Signed-off-by: Kevin Wolf > --- >

Re: [Qemu-block] [RFC 10/10] python: futurize -f lib2to3.fixes.fix_numliterals

2018-05-14 Thread Stefan Hajnoczi
On Fri, May 11, 2018 at 07:20:52PM -0300, Eduardo Habkost wrote: > Convert octal literals into the new syntax. > > This is necessary for Python 3 compatibility. > > Done using: > > $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ > sort -u | grep -v README.sh4) >

Re: [Qemu-block] [RFC 08/10] python: futurize -f lib2to3.fixes.fix_renames

2018-05-14 Thread Stefan Hajnoczi
On Fri, May 11, 2018 at 07:20:50PM -0300, Eduardo Habkost wrote: > Change sys.maxint to sys.maxsize. > > This is necessary for Python 3 compatibility. > > Done using: > > $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ > sort -u | grep -v README.sh4) > $

Re: [Qemu-block] [RFC PATCH 06/12] qapi: add bitmap info

2018-05-14 Thread Vladimir Sementsov-Ogievskiy
12.05.2018 04:25, John Snow wrote: Add some of the necessary scaffolding for reporting bitmap information. Signed-off-by: John Snow --- qapi/block-core.json | 60 +++- 1 file changed, 59 insertions(+), 1 deletion(-) diff

Re: [Qemu-block] [PATCH 14/42] job: Add reference counting

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > This moves reference counting from BlockJob to Job. > > In order to keep calling the BlockJob cleanup code when the job is > deleted via job_unref(), introduce a new JobDriver.free callback. Every > block job must use block_job_free() for this callback,

Re: [Qemu-block] [Qemu-devel] [RFC 09/10] python: futurize -f lib2to3.fixes.fix_except

2018-05-14 Thread Stefan Hajnoczi
On Fri, May 11, 2018 at 07:20:51PM -0300, Eduardo Habkost wrote: > Convert "except X, T" to "except X as T". > > This is necessary for Python 3 compatibility. > > Done using: > > $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ > sort -u | grep -v README.sh4) >

Re: [Qemu-block] [PATCH v3] qcow2: fix preallocation with metadata on bare block device

2018-05-14 Thread Ivan Ren
> Oh, yes, there is no doubt that the result will be correct. My point is > that people aren't usually interested so much in the physical layout of > the clusters, but more about the fact that no metadata updates and no > COW is necessary when you write to a cluster for the first time (i.e. >

Re: [Qemu-block] [Qemu-devel] [RFC 05/10] python: futurize -f lib2to3.fixes.fix_standarderror

2018-05-14 Thread Stefan Hajnoczi
On Fri, May 11, 2018 at 07:20:47PM -0300, Eduardo Habkost wrote: > Rename StandardError to Exception. > > This is necessary for Python 3 compatibility. > > Done using: > > $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ > sort -u | grep -v README.sh4) > $

Re: [Qemu-block] [Qemu-devel] [RFC 06/10] python: futurize -f lib2to3.fixes.fix_reduce

2018-05-14 Thread Stefan Hajnoczi
On Fri, May 11, 2018 at 07:20:48PM -0300, Eduardo Habkost wrote: > Handle the move of reduce() to functools.reduce(). > > This is necessary for Python 3 compatibility. > > Done using: > > $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ > sort -u | grep -v

Re: [Qemu-block] [RFC 04/10] python: futurize -f lib2to3.fixes.fix_has_key

2018-05-14 Thread Stefan Hajnoczi
On Fri, May 11, 2018 at 07:20:46PM -0300, Eduardo Habkost wrote: > Change "dict.has_key(key)" to "key in dict" > > This is necessary for Python 3 compatibility. > > Done using: > > $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ > sort -u | grep -v README.sh4) >

Re: [Qemu-block] [RFC 07/10] python: futurize -f lib2to3.fixes.fix_tuple_params

2018-05-14 Thread Stefan Hajnoczi
On Fri, May 11, 2018 at 07:20:49PM -0300, Eduardo Habkost wrote: > Remove implicit tuple parameter unpacking. > > This is necessary for Python 3 compatibility. > > Done using: > > $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ > sort -u | grep -v README.sh4) >

Re: [Qemu-block] [RFC 03/10] python: futurize -f libfuturize.fixes.fix_next_call

2018-05-14 Thread Stefan Hajnoczi
On Fri, May 11, 2018 at 07:20:45PM -0300, Eduardo Habkost wrote: > Change obj.next() calls to next(obj). > > This is necessary for Python 3 compatibility. > > Done using: > > $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ > sort -u | grep -v README.sh4) > $

Re: [Qemu-block] [RFC 02/10] python: futurize -f libfuturize.fixes.fix_absolute_import

2018-05-14 Thread Stefan Hajnoczi
On Fri, May 11, 2018 at 07:20:44PM -0300, Eduardo Habkost wrote: > diff --git a/tests/image-fuzzer/qcow2/layout.py > b/tests/image-fuzzer/qcow2/layout.py > index 63e801f4e8..df2131a855 100644 > --- a/tests/image-fuzzer/qcow2/layout.py > +++ b/tests/image-fuzzer/qcow2/layout.py > @@ -1,3 +1,4 @@ >

Re: [Qemu-block] [PATCH 13/42] job: Move state transitions to Job

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > This moves BlockJob.status and the closely related functions > (block_)job_state_transition() and (block_)job_apply_verb to Job. The > two QAPI enums are renamed to JobStatus and JobVerb. > > Signed-off-by: Kevin Wolf > --- >

Re: [Qemu-block] [RFC 01/10] python: futurize -f libfuturize.fixes.fix_print_with_import

2018-05-14 Thread Stefan Hajnoczi
On Fri, May 11, 2018 at 07:20:43PM -0300, Eduardo Habkost wrote: > Change all Python code to use print as a function. > > This is necessary for Python 3 compatibility. > > Done using: > > $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ > sort -u | grep -v

Re: [Qemu-block] [PATCH 12/42] job: Maintain a list of all jobs

2018-05-14 Thread Max Reitz
On 2018-05-09 18:26, Kevin Wolf wrote: > This moves the job list from BlockJob to Job. Now we can check for > duplicate IDs in job_create(). > > Signed-off-by: Kevin Wolf > --- > include/block/blockjob.h | 3 --- > include/qemu/job.h | 19 +++ >

Re: [Qemu-block] [Qemu-devel] Some question about savem/qcow2 incremental snapshot

2018-05-14 Thread Stefan Hajnoczi
On Fri, May 11, 2018 at 07:25:31PM +0200, Kevin Wolf wrote: > Am 10.05.2018 um 10:26 hat Stefan Hajnoczi geschrieben: > > On Wed, May 09, 2018 at 07:54:31PM +0200, Max Reitz wrote: > > > On 2018-05-09 12:16, Stefan Hajnoczi wrote: > > > > On Tue, May 08, 2018 at 05:03:09PM +0200, Kevin Wolf wrote:

Re: [Qemu-block] [PULL 0/8] Block patches

2018-05-14 Thread Peter Maydell
On 12 May 2018 at 10:28, Stefan Hajnoczi wrote: > The following changes since commit e5cd695266c5709308aa95b1baae499e4b5d4544: > > Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into > staging (2018-05-08 17:05:58 +0100) > > are available in the Git

Re: [Qemu-block] [RFC PATCH 04/12] qcow2/dirty-bitmaps: load IN_USE bitmaps if disk is RO

2018-05-14 Thread Vladimir Sementsov-Ogievskiy
12.05.2018 04:25, John Snow wrote: For the purposes of qemu-img manipulation and querying of bitmaps, load bitmaps that are "in use" -- if the image is read only. This will allow us to diagnose problems with this flag using the qemu-img tool. It looks unsafe.. We can load them, then reopen rw

Re: [Qemu-block] [PATCH 08/42] job: Create Job, JobDriver and job_create()

2018-05-14 Thread Kevin Wolf
Am 12.05.2018 um 00:46 hat Max Reitz geschrieben: > On 2018-05-09 18:26, Kevin Wolf wrote: > > This is the first step towards creating an infrastructure for generic > > background jobs that aren't tied to a block device. For now, Job only > > stores its ID and JobDriver, the rest stays in

Re: [Qemu-block] [RFC PATCH 03/12] block/qcow2-bitmap: avoid adjusting bm->flags for RO bitmaps

2018-05-14 Thread Vladimir Sementsov-Ogievskiy
12.05.2018 04:25, John Snow wrote: Instead of always setting IN_USE, handle whether or not the bitmap is read-only instead of a two-loop pass. This will allow us to show the flags exactly as they appear for bitmaps in `qemu-img info`. Signed-off-by: John Snow ---

Re: [Qemu-block] [RFC PATCH 02/12] qcow2/dirty-bitmap: cache loaded bitmaps

2018-05-14 Thread Vladimir Sementsov-Ogievskiy
12.05.2018 04:25, John Snow wrote: For bitmaps that we succeeded in loading, we can cache a reference to that object. This will let us iterate over the more convenient form of in-memory bitmaps for qemu-img bitmap manipulation tools. Signed-off-by: John Snow ---

Re: [Qemu-block] [RFC PATCH 01/12] qcow2-bitmap: cache bm_list

2018-05-14 Thread Vladimir Sementsov-Ogievskiy
14.05.2018 14:55, Vladimir Sementsov-Ogievskiy wrote: 12.05.2018 04:25, John Snow wrote: We don't need to re-read this list every time, exactly. We can keep it cached and delete our copy when we flush to disk. Why not simply delete cache only on close (unconditionally)? Why do we need to

Re: [Qemu-block] [RFC PATCH 01/12] qcow2-bitmap: cache bm_list

2018-05-14 Thread Vladimir Sementsov-Ogievskiy
12.05.2018 04:25, John Snow wrote: We don't need to re-read this list every time, exactly. We can keep it cached and delete our copy when we flush to disk. Why not simply delete cache only on close (unconditionally)? Why do we need to remove it after flush? Actually, I think we need to

Re: [Qemu-block] [PATCH v9 6/9] file-posix: support BDRV_REQ_ALLOCATE

2018-05-14 Thread Alberto Garcia
On Tue 08 May 2018 04:58:13 PM CEST, Anton Nefedov wrote: > Current write_zeroes implementation is good enough to satisfy this flag too > > Signed-off-by: Anton Nefedov Reviewed-by: Alberto Garcia Berto

Re: [Qemu-block] [PATCH v2 0/2] qemu-iotests: post-QEMU 2.12 fixes for 185

2018-05-14 Thread Jeff Cody
On Tue, May 08, 2018 at 02:54:34PM +0100, Stefan Hajnoczi wrote: > v2: > * Rebase onto Jeff's block tree to get mirror ratelimit fix [Jeff, Vladimir] > * Update comments in 185 since drain no longer causes a spurious iteration > > The 185 qemu-iotests test case was in a bad state for the QEMU

Re: [Qemu-block] [RFC PATCH 00/12] qemu-img: add bitmap queries

2018-05-14 Thread Vladimir Sementsov-Ogievskiy
12.05.2018 04:25, John Snow wrote: Allow qemu-img to show information about bitmaps stored in qcow2 images. Add a 'bitmap' meta-command with 'dump' sub-command to retrieve a list of dirty regions in bitmaps stored in a qcow2 image. RFC: - I am not 1000% convinced the bm_list caching is

Re: [Qemu-block] [PATCH 10/42] job: Add JobDriver.job_type

2018-05-14 Thread Kevin Wolf
Am 12.05.2018 um 00:53 hat Max Reitz geschrieben: > On 2018-05-09 18:26, Kevin Wolf wrote: > > This moves the job_type field from BlockJobDriver to JobDriver. > > > > Signed-off-by: Kevin Wolf > > --- > > include/block/blockjob_int.h | 3 --- > > include/qemu/job.h

Re: [Qemu-block] [PATCH v9 4/9] block: introduce BDRV_REQ_ALLOCATE flag

2018-05-14 Thread Alberto Garcia
On Tue 08 May 2018 04:58:11 PM CEST, Anton Nefedov wrote: > The flag is supposed to indicate that the region of the disk image has > to be sufficiently allocated so it reads as zeroes. > > The call with the flag set must return -ENOTSUP if allocation cannot > be done efficiently. > This has to be

Re: [Qemu-block] Restoring bitmaps after failed/cancelled migration

2018-05-14 Thread Vladimir Sementsov-Ogievskiy
14.05.2018 13:09, Vladimir Sementsov-Ogievskiy wrote: 14.05.2018 09:41, Fam Zheng wrote: On Wed, 04/18 17:00, Vladimir Sementsov-Ogievskiy wrote: Hi all. We now have the following problem: If dirty-bitmaps migration capability is enabled, persistance flag is dropped for all migrated bitmaps,

Re: [Qemu-block] [PATCH 02/42] blockjob: Wrappers for progress counter access

2018-05-14 Thread Kevin Wolf
Am 12.05.2018 um 00:12 hat Max Reitz geschrieben: > On 2018-05-09 18:25, Kevin Wolf wrote: > > Block job drivers are not expected to mess with the internals of the > > BlockJob object, so provide wrapper functions for one of the cases where > > they still do it: Updating the progress counter. > >

Re: [Qemu-block] Restoring bitmaps after failed/cancelled migration

2018-05-14 Thread Vladimir Sementsov-Ogievskiy
14.05.2018 09:41, Fam Zheng wrote: On Wed, 04/18 17:00, Vladimir Sementsov-Ogievskiy wrote: Hi all. We now have the following problem: If dirty-bitmaps migration capability is enabled, persistance flag is dropped for all migrated bitmaps, to prevent their storing to the storage on inactivate.

Re: [Qemu-block] [Qemu-devel] Restoring bitmaps after failed/cancelled migration

2018-05-14 Thread Vladimir Sementsov-Ogievskiy
12.05.2018 00:23, John Snow wrote: On 04/18/2018 10:00 AM, Vladimir Sementsov-Ogievskiy wrote: Hi all. We now have the following problem: If dirty-bitmaps migration capability is enabled, persistance flag is dropped for all migrated bitmaps, to prevent their storing to the storage on

Re: [Qemu-block] [RFC 00/10] [TESTING NEEDED] python: futurize --stage1 (Python 3 compatibility)

2018-05-14 Thread Dr. David Alan Gilbert
* Eduardo Habkost (ehabk...@redhat.com) wrote: > TESTING NEEDED: Due to the amount of changes, I didn't test all > scripts touched by this series. If you are responsible for any > of the touched files, I would appreciate help on testing the > series. Running the 'analyze-migration.py' script on

Re: [Qemu-block] [Qemu-devel] [PATCH v2 2/2] blockjob: do not cancel timer in resume

2018-05-14 Thread QingFeng Hao
在 2018/5/8 21:54, Stefan Hajnoczi 写道: > Currently the timer is cancelled and the block job is entered by > block_job_resume(). This behavior causes drain to run extra blockjob > iterations when the job was sleeping due to the ratelimit. > > This patch leaves the job asleep when

Re: [Qemu-block] Restoring bitmaps after failed/cancelled migration

2018-05-14 Thread Fam Zheng
On Wed, 04/18 17:00, Vladimir Sementsov-Ogievskiy wrote: > Hi all. > > We now have the following problem: > > If dirty-bitmaps migration capability is enabled, persistance flag is > dropped for all migrated bitmaps, to prevent their storing to the storage on > inactivate. Why do we prevent

Re: [Qemu-block] [PATCH v3] qcow2: fix preallocation with metadata on bare block device

2018-05-14 Thread Kevin Wolf
Am 13.05.2018 um 15:37 hat Ivan Ren geschrieben: > > Doesn't this defeat the purpose of preallocation? Usually, the idea with > > preallocation is that you don't need to update any metadata on the first > > write, but if you set QCOW_OFLAG_ZERO, we do need a metadata update > > again. > > > > So