Patchwork [v1,2/10] Qemu: Error classes for hostcache setting and data sync failures

login
register
mail settings
Submitter Supriya Kannery
Date June 15, 2012, 8:47 p.m.
Message ID <20120615204716.9853.24941.sendpatchset@skannery.in.ibm.com>
Download mbox | patch
Permalink /patch/165222/
State New
Headers show

Comments

Supriya Kannery - June 15, 2012, 8:47 p.m.
New error classes defined for hostcache setting and data 
sync error

Signed-off-by: Supriya Kannery <supriyak@linux.vnet.ibm.com>

---
 qerror.c |    8 ++++++++
 qerror.h |    6 ++++++
 2 files changed, 14 insertions(+)
Kevin Wolf - July 9, 2012, 2:47 p.m.
Am 15.06.2012 22:47, schrieb Supriya Kannery:
> New error classes defined for hostcache setting and data 
> sync error
> 
> Signed-off-by: Supriya Kannery <supriyak@linux.vnet.ibm.com>
> 
> ---
>  qerror.c |    8 ++++++++
>  qerror.h |    6 ++++++
>  2 files changed, 14 insertions(+)
> 
> Index: qemu/qerror.c
> ===================================================================
> --- qemu.orig/qerror.c
> +++ qemu/qerror.c
> @@ -80,6 +80,10 @@ static const QErrorStringTable qerror_ta
>          .desc      = "The command %(name) has not been found",
>      },
>      {
> +        .error_fmt = QERR_DATA_SYNC_FAILED,
> +        .desc      = "Syncing of data failed for device '%(device)'",
> +    },
> +    {
>          .error_fmt = QERR_DEVICE_ENCRYPTED,
>          .desc      = "Device '%(device)' is encrypted",
>      },
> @@ -152,6 +156,10 @@ static const QErrorStringTable qerror_ta
>          .desc      = "The feature '%(name)' is not enabled",
>      },
>      {
> +        .error_fmt = QERR_HOSTCACHE_NOT_CHANGED,
> +        .desc      = "Could not change hostcache setting for '%(device)'",
> +    },
> +    {
>          .error_fmt = QERR_INVALID_BLOCK_FORMAT,
>          .desc      = "Invalid block format '%(name)'",
>      },
> Index: qemu/qerror.h
> ===================================================================
> --- qemu.orig/qerror.h
> +++ qemu/qerror.h
> @@ -82,6 +82,9 @@ QError *qobject_to_qerror(const QObject 
>  #define QERR_COMMAND_NOT_FOUND \
>      "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
>  
> +#define QERR_DATA_SYNC_FAILED \
> +    "{ 'class': 'DataSyncFailed', 'data': { 'device': %s } }"
> +
>  #define QERR_DEVICE_ENCRYPTED \
>      "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s, 'filename': %s } }"
>  
> @@ -136,6 +139,9 @@ QError *qobject_to_qerror(const QObject 
>  #define QERR_FEATURE_DISABLED \
>      "{ 'class': 'FeatureDisabled', 'data': { 'name': %s } }"
>  
> +#define QERR_HOSTCACHE_NOT_CHANGED \
> +    "{ 'class': 'HostcacheNotChanged', 'data': { 'device': %s } }"
> +
>  #define QERR_INVALID_BLOCK_FORMAT \
>      "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"

In the light of the recent error handling discussion: Do we really need
two separate errors? Can we just reuse an existing one? Just
QERR_IO_ERROR could be good enough.

Kevin
Supriya Kannery - July 29, 2012, 6:58 a.m.
On 07/09/2012 08:17 PM, Kevin Wolf wrote:
> Am 15.06.2012 22:47, schrieb Supriya Kannery:
>> New error classes defined for hostcache setting and data
>> sync error
>>
>> Signed-off-by: Supriya Kannery<supriyak@linux.vnet.ibm.com>
>>
>> ---
>>   qerror.c |    8 ++++++++
>>   qerror.h |    6 ++++++
>>   2 files changed, 14 insertions(+)
>>
>> Index: qemu/qerror.c
>> ===================================================================
>> --- qemu.orig/qerror.c
>> +++ qemu/qerror.c
>> @@ -80,6 +80,10 @@ static const QErrorStringTable qerror_ta
>>           .desc      = "The command %(name) has not been found",
>>       },
>>       {
>> +        .error_fmt = QERR_DATA_SYNC_FAILED,
>> +        .desc      = "Syncing of data failed for device '%(device)'",
>> +    },
>> +    {
>>           .error_fmt = QERR_DEVICE_ENCRYPTED,
>>           .desc      = "Device '%(device)' is encrypted",
>>       },
>> @@ -152,6 +156,10 @@ static const QErrorStringTable qerror_ta
>>           .desc      = "The feature '%(name)' is not enabled",
>>       },
>>       {
>> +        .error_fmt = QERR_HOSTCACHE_NOT_CHANGED,
>> +        .desc      = "Could not change hostcache setting for '%(device)'",
>> +    },
>> +    {
>>           .error_fmt = QERR_INVALID_BLOCK_FORMAT,
>>           .desc      = "Invalid block format '%(name)'",
>>       },
>> Index: qemu/qerror.h
>> ===================================================================
>> --- qemu.orig/qerror.h
>> +++ qemu/qerror.h
>> @@ -82,6 +82,9 @@ QError *qobject_to_qerror(const QObject
>>   #define QERR_COMMAND_NOT_FOUND \
>>       "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
>>
>> +#define QERR_DATA_SYNC_FAILED \
>> +    "{ 'class': 'DataSyncFailed', 'data': { 'device': %s } }"
>> +
>>   #define QERR_DEVICE_ENCRYPTED \
>>       "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s, 'filename': %s } }"
>>
>> @@ -136,6 +139,9 @@ QError *qobject_to_qerror(const QObject
>>   #define QERR_FEATURE_DISABLED \
>>       "{ 'class': 'FeatureDisabled', 'data': { 'name': %s } }"
>>
>> +#define QERR_HOSTCACHE_NOT_CHANGED \
>> +    "{ 'class': 'HostcacheNotChanged', 'data': { 'device': %s } }"
>> +
>>   #define QERR_INVALID_BLOCK_FORMAT \
>>       "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"
>
> In the light of the recent error handling discussion: Do we really need
> two separate errors? Can we just reuse an existing one? Just
> QERR_IO_ERROR could be good enough.
>
> Kevin
>

Yes, will use QERR_IO_ERROR instead of these two new errors.

-thanks, Supriya

Patch

Index: qemu/qerror.c
===================================================================
--- qemu.orig/qerror.c
+++ qemu/qerror.c
@@ -80,6 +80,10 @@  static const QErrorStringTable qerror_ta
         .desc      = "The command %(name) has not been found",
     },
     {
+        .error_fmt = QERR_DATA_SYNC_FAILED,
+        .desc      = "Syncing of data failed for device '%(device)'",
+    },
+    {
         .error_fmt = QERR_DEVICE_ENCRYPTED,
         .desc      = "Device '%(device)' is encrypted",
     },
@@ -152,6 +156,10 @@  static const QErrorStringTable qerror_ta
         .desc      = "The feature '%(name)' is not enabled",
     },
     {
+        .error_fmt = QERR_HOSTCACHE_NOT_CHANGED,
+        .desc      = "Could not change hostcache setting for '%(device)'",
+    },
+    {
         .error_fmt = QERR_INVALID_BLOCK_FORMAT,
         .desc      = "Invalid block format '%(name)'",
     },
Index: qemu/qerror.h
===================================================================
--- qemu.orig/qerror.h
+++ qemu/qerror.h
@@ -82,6 +82,9 @@  QError *qobject_to_qerror(const QObject 
 #define QERR_COMMAND_NOT_FOUND \
     "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }"
 
+#define QERR_DATA_SYNC_FAILED \
+    "{ 'class': 'DataSyncFailed', 'data': { 'device': %s } }"
+
 #define QERR_DEVICE_ENCRYPTED \
     "{ 'class': 'DeviceEncrypted', 'data': { 'device': %s, 'filename': %s } }"
 
@@ -136,6 +139,9 @@  QError *qobject_to_qerror(const QObject 
 #define QERR_FEATURE_DISABLED \
     "{ 'class': 'FeatureDisabled', 'data': { 'name': %s } }"
 
+#define QERR_HOSTCACHE_NOT_CHANGED \
+    "{ 'class': 'HostcacheNotChanged', 'data': { 'device': %s } }"
+
 #define QERR_INVALID_BLOCK_FORMAT \
     "{ 'class': 'InvalidBlockFormat', 'data': { 'name': %s } }"