blockjobs: hide internal jobs from management API

If jobs are not created directly by the user, do not allow them to be
seen by the user/management utility. At the moment, 'internal' jobs are
those that do not have an ID. As of this patch it is impossible to
create such jobs.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1477584421-1399-2-git-send-email-jsnow@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
This commit is contained in:
John Snow 2016-10-27 12:06:55 -04:00 committed by Jeff Cody
parent 53d9837fb8
commit 559b935f8c
3 changed files with 57 additions and 13 deletions

View file

@ -3946,13 +3946,22 @@ BlockJobInfoList *qmp_query_block_jobs(Error **errp)
BlockJob *job;
for (job = block_job_next(NULL); job; job = block_job_next(job)) {
BlockJobInfoList *elem = g_new0(BlockJobInfoList, 1);
AioContext *aio_context = blk_get_aio_context(job->blk);
BlockJobInfoList *elem;
AioContext *aio_context;
if (block_job_is_internal(job)) {
continue;
}
elem = g_new0(BlockJobInfoList, 1);
aio_context = blk_get_aio_context(job->blk);
aio_context_acquire(aio_context);
elem->value = block_job_query(job);
elem->value = block_job_query(job, errp);
aio_context_release(aio_context);
if (!elem->value) {
g_free(elem);
qapi_free_BlockJobInfoList(head);
return NULL;
}
*p_next = elem;
p_next = &elem->next;
}