From e1e9f24b67b0bfc329b706825bd1586b159e1924 Mon Sep 17 00:00:00 2001
Message-Id: <e1e9f24b67b0bfc329b706825bd1586b159e1924.1349175436.git.minovotn@redhat.com>
In-Reply-To: <94968b7fa9b14e71f004474d7ce77e189e6a2bf3.1349175436.git.minovotn@redhat.com>
References: <94968b7fa9b14e71f004474d7ce77e189e6a2bf3.1349175436.git.minovotn@redhat.com>
From: Amos Kong <akong@redhat.com>
Date: Mon, 1 Oct 2012 14:12:36 +0200
Subject: [PATCH 23/34] qerror: add five qerror strings

RH-Author: Amos Kong <akong@redhat.com>
Message-id: <1349100767-9066-4-git-send-email-akong@redhat.com>
Patchwork-id: 42562
O-Subject: [RHEL-6.4 qemu-kvm PATCH v7 03/14] qerror: add five qerror strings
Bugzilla: 680356
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>

Add five new qerror strings, they are about listen/connect socket:
  QERR_SOCKET_CONNECT_IN_PROGRESS
  QERR_SOCKET_CONNECT_FAILED
  QERR_SOCKET_LISTEN_FAILED
  QERR_SOCKET_BIND_FAILED
  QERR_SOCKET_CREATE_FAILED

(Cherry-picked from commit aed3d11df6d14ce63ac754601e4df965c608f6bd)

Conflicts:
    qerror.h

Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Amos Kong <akong@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 qerror.c |   20 ++++++++++++++++++++
 qerror.h |   15 +++++++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 qerror.c | 20 ++++++++++++++++++++
 qerror.h | 15 +++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/qerror.c b/qerror.c
index 3db387b..3e7f410 100644
--- a/qerror.c
+++ b/qerror.c
@@ -258,6 +258,26 @@ static const QErrorStringTable qerror_table[] = {
         .error_fmt = QERR_QGA_COMMAND_FAILED,
         .desc      = "Guest agent command failed, error was '%(message)'",
     },
+    {
+        .error_fmt = QERR_SOCKET_CONNECT_IN_PROGRESS,
+        .desc      = "Connection can not be completed immediately",
+    },
+    {
+        .error_fmt = QERR_SOCKET_CONNECT_FAILED,
+        .desc      = "Failed to connect to socket",
+    },
+    {
+        .error_fmt = QERR_SOCKET_LISTEN_FAILED,
+        .desc      = "Failed to set socket to listening mode",
+    },
+    {
+        .error_fmt = QERR_SOCKET_BIND_FAILED,
+        .desc      = "Failed to bind socket",
+    },
+    {
+        .error_fmt = QERR_SOCKET_CREATE_FAILED,
+        .desc      = "Failed to create socket",
+    },
     {}
 };
 
diff --git a/qerror.h b/qerror.h
index 3ac8c0c..5427664 100644
--- a/qerror.h
+++ b/qerror.h
@@ -214,4 +214,19 @@ QError *qobject_to_qerror(const QObject *obj);
 #define QERR_QGA_COMMAND_FAILED \
     "{ 'class': 'QgaCommandFailed', 'data': { 'message': %s } }"
 
+#define QERR_SOCKET_CONNECT_IN_PROGRESS \
+    "{ 'class': 'SockConnectInprogress', 'data': {} }"
+
+#define QERR_SOCKET_CONNECT_FAILED \
+    "{ 'class': 'SockConnectFailed', 'data': {} }"
+
+#define QERR_SOCKET_LISTEN_FAILED \
+    "{ 'class': 'SockListenFailed', 'data': {} }"
+
+#define QERR_SOCKET_BIND_FAILED \
+    "{ 'class': 'SockBindFailed', 'data': {} }"
+
+#define QERR_SOCKET_CREATE_FAILED \
+    "{ 'class': 'SockCreateFailed', 'data': {} }"
+
 #endif /* QERROR_H */
-- 
1.7.11.4

