summary refs log tree commit diff stats
path: root/net/colo-compare.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-10-22 12:52:54 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2016-10-24 15:27:20 +0200
commitfbf3cc3a67a7131e258764aa1f19d5324e9e9f7a (patch)
tree9f44d614dacf94753dd7b7693b0175d24e8368f1 /net/colo-compare.c
parent7fa47e2a80e1c204533340f65909b7fc7c6b276f (diff)
downloadfocaccia-qemu-fbf3cc3a67a7131e258764aa1f19d5324e9e9f7a.tar.gz
focaccia-qemu-fbf3cc3a67a7131e258764aa1f19d5324e9e9f7a.zip
colo: claim in find_and_check_chardev
This factors out claiming of chardev, and changes the call to
non-fatal to return an error like the rest of the chardev checks.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20161022095318.17775-15-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'net/colo-compare.c')
-rw-r--r--net/colo-compare.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/net/colo-compare.c b/net/colo-compare.c
index efcd15e9ae..b11546520b 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -589,6 +589,13 @@ static int find_and_check_chardev(CharDriverState **chr,
                    chr_name);
         return 1;
     }
+
+    if (qemu_chr_fe_claim(*chr) < 0) {
+        error_setg(errp, "chardev \"%s\" cannot be claimed",
+                   chr_name);
+        return 1;
+    }
+
     return 0;
 }
 
@@ -646,12 +653,6 @@ static void colo_compare_complete(UserCreatable *uc, Error **errp)
         return;
     }
 
-    qemu_chr_fe_claim_no_fail(s->chr_pri_in.chr);
-
-    qemu_chr_fe_claim_no_fail(s->chr_sec_in.chr);
-
-    qemu_chr_fe_claim_no_fail(s->chr_out.chr);
-
     net_socket_rs_init(&s->pri_rs, compare_pri_rs_finalize);
     net_socket_rs_init(&s->sec_rs, compare_sec_rs_finalize);