Patchwork [3/8] QError: Add QMP mode-oriented errors

login
register
mail settings
Submitter Luiz Capitulino
Date Jan. 28, 2010, 1:42 p.m.
Message ID <1264686180-29845-4-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/43862/
State New
Headers show

Comments

Luiz Capitulino - Jan. 28, 2010, 1:42 p.m.
Two new errors:

- QERR_QMP_INVALID_MODE_NAME
- QERR_QMP_INVALID_MODE_TRANSITION

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 qerror.c |    8 ++++++++
 qerror.h |    6 ++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
Anthony Liguori - Jan. 28, 2010, 10:49 p.m.
On 01/28/2010 07:42 AM, Luiz Capitulino wrote:
> Two new errors:
>
> - QERR_QMP_INVALID_MODE_NAME
> - QERR_QMP_INVALID_MODE_TRANSITION
>
> Signed-off-by: Luiz Capitulino<lcapitulino@redhat.com>
> ---
>   qerror.c |    8 ++++++++
>   qerror.h |    6 ++++++
>   2 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/qerror.c b/qerror.c
> index 6c2aba0..d01354d 100644
> --- a/qerror.c
> +++ b/qerror.c
> @@ -113,6 +113,14 @@ static const QErrorStringTable qerror_table[] = {
>           .desc      = "Bad QMP input object",
>       },
>       {
> +        .error_fmt = QERR_QMP_INVALID_MODE_NAME,
> +        .desc      = "Mode name %(name) is invalid",
> +    },
>    

This is basically, invalid parameter, no?

Regards,

Anthony Liguori
Luiz Capitulino - Jan. 29, 2010, 12:38 a.m.
On Thu, 28 Jan 2010 16:49:00 -0600
Anthony Liguori <anthony@codemonkey.ws> wrote:

> On 01/28/2010 07:42 AM, Luiz Capitulino wrote:
> > Two new errors:
> >
> > - QERR_QMP_INVALID_MODE_NAME
> > - QERR_QMP_INVALID_MODE_TRANSITION
> >
> > Signed-off-by: Luiz Capitulino<lcapitulino@redhat.com>
> > ---
> >   qerror.c |    8 ++++++++
> >   qerror.h |    6 ++++++
> >   2 files changed, 14 insertions(+), 0 deletions(-)
> >
> > diff --git a/qerror.c b/qerror.c
> > index 6c2aba0..d01354d 100644
> > --- a/qerror.c
> > +++ b/qerror.c
> > @@ -113,6 +113,14 @@ static const QErrorStringTable qerror_table[] = {
> >           .desc      = "Bad QMP input object",
> >       },
> >       {
> > +        .error_fmt = QERR_QMP_INVALID_MODE_NAME,
> > +        .desc      = "Mode name %(name) is invalid",
> > +    },
> >    
> 
> This is basically, invalid parameter, no?

 Yeah.
Markus Armbruster - Feb. 1, 2010, 5:03 p.m.
Luiz Capitulino <lcapitulino@redhat.com> writes:

> On Thu, 28 Jan 2010 16:49:00 -0600
> Anthony Liguori <anthony@codemonkey.ws> wrote:
>
>> On 01/28/2010 07:42 AM, Luiz Capitulino wrote:
>> > Two new errors:
>> >
>> > - QERR_QMP_INVALID_MODE_NAME
>> > - QERR_QMP_INVALID_MODE_TRANSITION
>> >
>> > Signed-off-by: Luiz Capitulino<lcapitulino@redhat.com>
>> > ---
>> >   qerror.c |    8 ++++++++
>> >   qerror.h |    6 ++++++
>> >   2 files changed, 14 insertions(+), 0 deletions(-)
>> >
>> > diff --git a/qerror.c b/qerror.c
>> > index 6c2aba0..d01354d 100644
>> > --- a/qerror.c
>> > +++ b/qerror.c
>> > @@ -113,6 +113,14 @@ static const QErrorStringTable qerror_table[] = {
>> >           .desc      = "Bad QMP input object",
>> >       },
>> >       {
>> > +        .error_fmt = QERR_QMP_INVALID_MODE_NAME,
>> > +        .desc      = "Mode name %(name) is invalid",
>> > +    },
>> >    
>> 
>> This is basically, invalid parameter, no?
>
>  Yeah.

Then let's use that.

Patch

diff --git a/qerror.c b/qerror.c
index 6c2aba0..d01354d 100644
--- a/qerror.c
+++ b/qerror.c
@@ -113,6 +113,14 @@  static const QErrorStringTable qerror_table[] = {
         .desc      = "Bad QMP input object",
     },
     {
+        .error_fmt = QERR_QMP_INVALID_MODE_NAME,
+        .desc      = "Mode name %(name) is invalid",
+    },
+    {
+        .error_fmt = QERR_QMP_INVALID_MODE_TRANSITION,
+        .desc      = "Invalid mode transition",
+    },
+    {
         .error_fmt = QERR_SET_PASSWD_FAILED,
         .desc      = "Could not set password",
     },
diff --git a/qerror.h b/qerror.h
index 57c5b97..41154b1 100644
--- a/qerror.h
+++ b/qerror.h
@@ -94,6 +94,12 @@  QError *qobject_to_qerror(const QObject *obj);
 #define QERR_QMP_BAD_INPUT_OBJECT \
     "{ 'class': 'QMPBadInputObject', 'data': { 'expected': %s } }"
 
+#define QERR_QMP_INVALID_MODE_NAME \
+    "{ 'class': 'QMPInvalidModeName', 'data': { 'name': %s } }"
+
+#define QERR_QMP_INVALID_MODE_TRANSITION \
+    "{ 'class': 'QMPInvalidModeTransition', 'data': {} }"
+
 #define QERR_SET_PASSWD_FAILED \
     "{ 'class': 'SetPasswdFailed', 'data': {} }"