Patchwork [V4,2/3] qerror: Add error telling that block dev usage prevents migration

login
register
mail settings
Submitter Benoit Canet
Date July 23, 2012, 2:22 p.m.
Message ID <1343053380-12133-3-git-send-email-benoit@irqsave.net>
Download mbox | patch
Permalink /patch/172696/
State New
Headers show

Comments

Benoit Canet - July 23, 2012, 2:22 p.m.
From: Benoît Canet <benoit@irqsave.net>

Signed-off-by: Benoit Canet <benoit@irqsave.net>
---
 qerror.c |    4 ++++
 qerror.h |    3 +++
 2 files changed, 7 insertions(+)
Luiz Capitulino - July 23, 2012, 5:09 p.m.
On Mon, 23 Jul 2012 16:22:59 +0200
benoit.canet@gmail.com wrote:

> From: Benoît Canet <benoit@irqsave.net>
> 
> Signed-off-by: Benoit Canet <benoit@irqsave.net>
> ---
>  qerror.c |    4 ++++
>  qerror.h |    3 +++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/qerror.c b/qerror.c
> index 92c4eff..d2e76ca 100644
> --- a/qerror.c
> +++ b/qerror.c
> @@ -283,6 +283,10 @@ static const QErrorStringTable qerror_table[] = {
>          .desc      = "Could not set password",
>      },
>      {
> +        .error_fmt = QERR_BLOCK_DEV_IN_USE_MIGRATION_PREVENTED,
> +        .desc      = "Block device in use migration prevented",
> +    },

Let's avoid an specific error. We have two options:

 1. Use QERR_MIGRATION_NOT_SUPPORTED

 2. Add QERR_MIGRATION_BLOCKED

> +    {
>          .error_fmt = QERR_TOO_MANY_FILES,
>          .desc      = "Too many open files",
>      },
> diff --git a/qerror.h b/qerror.h
> index b4c8758..2ef40b5 100644
> --- a/qerror.h
> +++ b/qerror.h
> @@ -233,6 +233,9 @@ QError *qobject_to_qerror(const QObject *obj);
>  #define QERR_SET_PASSWD_FAILED \
>      "{ 'class': 'SetPasswdFailed', 'data': {} }"
>  
> +#define QERR_BLOCK_DEV_IN_USE_MIGRATION_PREVENTED \
> +    "{ 'class': 'BlockDevInUseMigrationPrevented', 'data': {} }"
> +
>  #define QERR_TOO_MANY_FILES \
>      "{ 'class': 'TooManyFiles', 'data': {} }"
>

Patch

diff --git a/qerror.c b/qerror.c
index 92c4eff..d2e76ca 100644
--- a/qerror.c
+++ b/qerror.c
@@ -283,6 +283,10 @@  static const QErrorStringTable qerror_table[] = {
         .desc      = "Could not set password",
     },
     {
+        .error_fmt = QERR_BLOCK_DEV_IN_USE_MIGRATION_PREVENTED,
+        .desc      = "Block device in use migration prevented",
+    },
+    {
         .error_fmt = QERR_TOO_MANY_FILES,
         .desc      = "Too many open files",
     },
diff --git a/qerror.h b/qerror.h
index b4c8758..2ef40b5 100644
--- a/qerror.h
+++ b/qerror.h
@@ -233,6 +233,9 @@  QError *qobject_to_qerror(const QObject *obj);
 #define QERR_SET_PASSWD_FAILED \
     "{ 'class': 'SetPasswdFailed', 'data': {} }"
 
+#define QERR_BLOCK_DEV_IN_USE_MIGRATION_PREVENTED \
+    "{ 'class': 'BlockDevInUseMigrationPrevented', 'data': {} }"
+
 #define QERR_TOO_MANY_FILES \
     "{ 'class': 'TooManyFiles', 'data': {} }"