On Mon, Jan 23, 2012 at 14:30:54 +0100, Jiri Denemark wrote:
We already provide ways to detect when a domain has been paused as a
result of I/O error, but there was no way of getting the exact error or
even the device that experienced it. This new API may be used for both.
...
+
+/**
+ * virDomainGetIoError:
+ * @dom: a domain object
+ * @dev: disk device to be inspected or NULL
+ * @flags: extra flags; not used yet, so callers should always pass 0
+ *
+ * The @disk parameter is either the device target (the dev attribute of
+ * target subelement), such as "vda", or NULL, in which case all disks will
be
+ * inspected for errors. If only one disk experienced an I/O error, that error
+ * will be returned. However, if there are more disks with I/O errors, this
+ * function will fail and return -2, requiring the caller to check every
+ * device explicitly.
+ *
+ * Returns -2 if @dev is NULL and there are multiple disks with errors, -1 if
+ * the function fails to do its job, the I/O error (virDomainIoError) observed
+ * on the specified disk (or any disk if @dev is NULL). Namely, 0 is returned
+ * when there is no error on the disk.
+ */
+int
+virDomainGetIoError(virDomainPtr dom,
+ const char *dev,
+ unsigned int flags)
Actually, after talking a bit more about this with Federico on IRC, this API
should rather provide a list of disks with error codes.
I'll create a v2, in which I will also address Michal's comments.
Jirka