]> git.proxmox.com Git - mirror_qemu.git/commitdiff
block jobs: Improve error message for missing job ID
authorKevin Wolf <kwolf@redhat.com>
Tue, 12 Jul 2016 16:15:49 +0000 (18:15 +0200)
committerKevin Wolf <kwolf@redhat.com>
Mon, 5 Sep 2016 17:06:48 +0000 (19:06 +0200)
If a block job is started with a node name rather than a device name and
no explicit job ID is passed, it was reported that '' isn't a
well-formed ID. Which is correct, but we can make the message a little
bit nicer.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
blockjob.c

index a5ba3bee523eb5053b06a65d599ca35f0939ae7a..a167f96fd47926eadae1d14013567ac2f145a344 100644 (file)
@@ -132,6 +132,10 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
 
     if (job_id == NULL) {
         job_id = bdrv_get_device_name(bs);
+        if (!*job_id) {
+            error_setg(errp, "An explicit job ID is required for this node");
+            return NULL;
+        }
     }
 
     if (!id_wellformed(job_id)) {