aboutsummaryrefslogtreecommitdiff
path: root/migration/qemu-file.h
diff options
context:
space:
mode:
authorYury Kotov <yury-kotov@yandex-team.ru>2019-04-22 13:34:20 +0300
committerDr. David Alan Gilbert <dgilbert@redhat.com>2019-08-14 17:33:14 +0100
commit3d661c8ab18ad2013992c622ab307422ace891a2 (patch)
treed1b1ab46d8d0d3b0d3824655e661a469d5caa62b /migration/qemu-file.h
parentf28ed74fd116491e31329044d140fde4aa23b2a0 (diff)
downloadqemu-3d661c8ab18ad2013992c622ab307422ace891a2.zip
qemu-3d661c8ab18ad2013992c622ab307422ace891a2.tar.gz
qemu-3d661c8ab18ad2013992c622ab307422ace891a2.tar.bz2
migration: Add error_desc for file channel errors
Currently, there is no information about error if outgoing migration was failed because of file channel errors. Example (QMP session): -> { "execute": "migrate", "arguments": { "uri": "exec:head -c 1" }} <- { "return": {} } ... -> { "execute": "query-migrate" } <- { "return": { "status": "failed" }} // There is not error's description And even in the QEMU's output there is nothing. This patch 1) Adds errp for the most of QEMUFileOps 2) Adds qemu_file_get_error_obj/qemu_file_set_error_obj 3) And finally using of qemu_file_get_error_obj in migration.c And now, the status for the mentioned fail will be: -> { "execute": "query-migrate" } <- { "return": { "status": "failed", "error-desc": "Unable to write to command: Broken pipe" }} Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru> Message-Id: <20190422103420.15686-1-yury-kotov@yandex-team.ru> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'migration/qemu-file.h')
-rw-r--r--migration/qemu-file.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/migration/qemu-file.h b/migration/qemu-file.h
index 13baf89..eb886db 100644
--- a/migration/qemu-file.h
+++ b/migration/qemu-file.h
@@ -32,7 +32,8 @@
* bytes actually read should be returned.
*/
typedef ssize_t (QEMUFileGetBufferFunc)(void *opaque, uint8_t *buf,
- int64_t pos, size_t size);
+ int64_t pos, size_t size,
+ Error **errp);
/* Close a file
*
@@ -41,7 +42,7 @@ typedef ssize_t (QEMUFileGetBufferFunc)(void *opaque, uint8_t *buf,
* The meaning of return value on success depends on the specific back-end being
* used.
*/
-typedef int (QEMUFileCloseFunc)(void *opaque);
+typedef int (QEMUFileCloseFunc)(void *opaque, Error **errp);
/* Called to return the OS file descriptor associated to the QEMUFile.
*/
@@ -49,14 +50,15 @@ typedef int (QEMUFileGetFD)(void *opaque);
/* Called to change the blocking mode of the file
*/
-typedef int (QEMUFileSetBlocking)(void *opaque, bool enabled);
+typedef int (QEMUFileSetBlocking)(void *opaque, bool enabled, Error **errp);
/*
* This function writes an iovec to file. The handler must write all
* of the data or return a negative errno value.
*/
typedef ssize_t (QEMUFileWritevBufferFunc)(void *opaque, struct iovec *iov,
- int iovcnt, int64_t pos);
+ int iovcnt, int64_t pos,
+ Error **errp);
/*
* This function provides hooks around different
@@ -97,7 +99,8 @@ typedef QEMUFile *(QEMURetPathFunc)(void *opaque);
* Existing blocking reads/writes must be woken
* Returns 0 on success, -err on error
*/
-typedef int (QEMUFileShutdownFunc)(void *opaque, bool rd, bool wr);
+typedef int (QEMUFileShutdownFunc)(void *opaque, bool rd, bool wr,
+ Error **errp);
typedef struct QEMUFileOps {
QEMUFileGetBufferFunc *get_buffer;
@@ -149,6 +152,8 @@ void qemu_update_position(QEMUFile *f, size_t size);
void qemu_file_reset_rate_limit(QEMUFile *f);
void qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate);
int64_t qemu_file_get_rate_limit(QEMUFile *f);
+int qemu_file_get_error_obj(QEMUFile *f, Error **errp);
+void qemu_file_set_error_obj(QEMUFile *f, int ret, Error *err);
void qemu_file_set_error(QEMUFile *f, int ret);
int qemu_file_shutdown(QEMUFile *f);
QEMUFile *qemu_file_get_return_path(QEMUFile *f);