qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] iscsi: add error handling for qmp_query_uuid
@ 2013-11-05  0:08 Amos Kong
  2013-11-05  0:33 ` [Qemu-devel] [PATCH v2] " Amos Kong
  2013-11-05  9:03 ` [Qemu-devel] [PATCH] " Paolo Bonzini
  0 siblings, 2 replies; 7+ messages in thread
From: Amos Kong @ 2013-11-05  0:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, pbonzini, lersek

We can't assume that qmp_query_uuid() always returns available value.

Signed-off-by: Amos Kong <akong@redhat.com>
---
 block/iscsi.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/block/iscsi.c b/block/iscsi.c
index a2a961e..1fc1da4 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1059,6 +1059,7 @@ static char *parse_initiator_name(const char *target)
     const char *name;
     char *iscsi_name;
     UuidInfo *uuid_info;
+    Error *errp = NULL;
 
     list = qemu_find_opts("iscsi");
     if (list) {
@@ -1074,8 +1075,10 @@ static char *parse_initiator_name(const char *target)
         }
     }
 
-    uuid_info = qmp_query_uuid(NULL);
-    if (strcmp(uuid_info->UUID, UUID_NONE) == 0) {
+    uuid_info = qmp_query_uuid(&errp);
+    if (error_is_set(&errp)) {
+        name = qemu_get_vm_name();
+    } else if (strcmp(uuid_info->UUID, UUID_NONE) == 0) {
         name = qemu_get_vm_name();
     } else {
         name = uuid_info->UUID;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-11-05 15:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-05  0:08 [Qemu-devel] [PATCH] iscsi: add error handling for qmp_query_uuid Amos Kong
2013-11-05  0:33 ` [Qemu-devel] [PATCH v2] " Amos Kong
2013-11-05  7:52   ` Laszlo Ersek
2013-11-05 13:17   ` Stefan Hajnoczi
2013-11-05 13:44     ` Paolo Bonzini
2013-11-05  9:03 ` [Qemu-devel] [PATCH] " Paolo Bonzini
2013-11-05 15:05   ` Amos Kong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).