From patchwork Fri Dec 2 15:08:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cedric Bosdonnat X-Patchwork-Id: 9458691 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1C9A960236 for ; Fri, 2 Dec 2016 15:11:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FAC928542 for ; Fri, 2 Dec 2016 15:11:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 049EF2856B; Fri, 2 Dec 2016 15:11:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 15BC42855C for ; Fri, 2 Dec 2016 15:11:17 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cCpSe-00031g-KV; Fri, 02 Dec 2016 15:09:16 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cCpSc-0002yK-S7 for xen-devel@lists.xen.org; Fri, 02 Dec 2016 15:09:14 +0000 Received: from [85.158.143.35] by server-10.bemta-6.messagelabs.com id 2A/55-28971-A9E81485; Fri, 02 Dec 2016 15:09:14 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAIsWRWlGSWpSXmKPExsVyuP0uq+7MPsc Ig3cHJSyWfFzM4sDocXT3b6YAxijWzLyk/IoE1owdRw+zFHS4VMyffo6xgfGEYRcjF4eQwBJG iQ9zXjN3MXJysAnYS3T9OcoEYosISEtc+3yZEcRmFiiRaDrXCVYjLOAlsfLaLFYQm0VAVeJ3+ 36wOK+ApcTMZ0dZQGwJAXmJheePgM3hBIo/aLkONkdIwEKi+cYdFoh6QYmTM58A2RxA89Ul1s 8TglglL9G8dTbzBEbeWUiqZiFUzUJStYCReRWjRnFqUVlqka6RiV5SUWZ6RkluYmaOrqGBmV5 uanFxYnpqTmJSsV5yfu4mRmBIMQDBDsaV6wIPMUpyMCmJ8prmOEYI8SXlp1RmJBZnxBeV5qQW H2KU4eBQkuBt7gXKCRalpqdWpGXmAIMbJi3BwaMkwqsKkuYtLkjMLc5Mh0idYlSUEuc9ApIQA ElklObBtcEi6hKjrJQwLyPQIUI8BalFuZklqPKvGMU5GJWEeZ1BpvBk5pXATX8FtJgJaHHHdX uQxSWJCCmpBsa6/d8334yI0Tym7RpeVaif1+m1dIbUpsqKcJN9acXr/qhe3bldKCD88YktPNr r7u4PTPgk8vTBxmuzz2Xt4J3KxV/54qClXIahsua5gpWa+nV8THtater9NnD83eG3TC2p69SO KxOcn52/UKg7f7qj33+z+vcTPl8s0HlhtsOl2jq9TG4PMERYijMSDbWYi4oTAQYHFE6jAgAA X-Env-Sender: cbosdonnat@suse.com X-Msg-Ref: server-16.tower-21.messagelabs.com!1480691352!41870892!1 X-Originating-IP: [195.135.221.5] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.0.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 9542 invoked from network); 2 Dec 2016 15:09:13 -0000 Received: from smtp.nue.novell.com (HELO smtp.nue.novell.com) (195.135.221.5) by server-16.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 2 Dec 2016 15:09:13 -0000 Received: from laptop.vms (mhy71-2-88-167-63-197.fbx.proxad.net [88.167.63.197]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Fri, 02 Dec 2016 16:09:12 +0100 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= To: xen-devel@lists.xen.org Date: Fri, 2 Dec 2016 16:08:17 +0100 Message-Id: <20161202150841.31227-12-cbosdonnat@suse.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161202150841.31227-1-cbosdonnat@suse.com> References: <20161202150841.31227-1-cbosdonnat@suse.com> MIME-Version: 1.0 Cc: Ian Jackson , Wei Liu , Cedric Bosdonnat Subject: [Xen-devel] [PATCH v2 11/35] libxl/libxl_colo_restore.c: used LOG*D functions X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Cedric Bosdonnat Use LOG*D logging functions where possible instead of the LOG* ones. Signed-off-by: Cédric Bosdonnat Acked-by: Wei Liu --- tools/libxl/libxl_colo_restore.c | 57 ++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/tools/libxl/libxl_colo_restore.c b/tools/libxl/libxl_colo_restore.c index 3483f39..6a96328 100644 --- a/tools/libxl/libxl_colo_restore.c +++ b/tools/libxl/libxl_colo_restore.c @@ -63,7 +63,7 @@ static void colo_enable_logdirty(libxl__colo_restore_state *crs, libxl__egc *egc if (xc_shadow_control(CTX->xch, domid, XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY, NULL, 0, NULL, 0, NULL) < 0) { - LOG(ERROR, "cannot enable secondary vm's logdirty"); + LOGD(ERROR, domid, "cannot enable secondary vm's logdirty"); lds->callback(egc, lds, ERROR_FAIL); return; } @@ -91,7 +91,7 @@ static void colo_disable_logdirty(libxl__colo_restore_state *crs, /* we need to know which pages are dirty to restore the guest */ if (xc_shadow_control(CTX->xch, domid, XEN_DOMCTL_SHADOW_OP_OFF, NULL, 0, NULL, 0, NULL) < 0) - LOG(WARN, "cannot disable secondary vm's logdirty"); + LOGD(WARN, domid, "cannot disable secondary vm's logdirty"); if (crs->hvm) { libxl__domain_common_switch_qemu_logdirty(egc, domid, 0, lds); @@ -118,14 +118,15 @@ static void colo_resume_vm(libxl__egc *egc, if (restore_device_model) { rc = libxl__qmp_restore(gc, crs->domid, crcs->state_file); if (rc) { - LOG(ERROR, "cannot restore device model for secondary vm"); + LOGD(ERROR, crs->domid, + "cannot restore device model for secondary vm"); crcs->callback(egc, crcs, rc); return; } } rc = libxl__domain_resume(gc, crs->domid, 0); if (rc) - LOG(ERROR, "cannot resume secondary vm"); + LOGD(ERROR, crs->domid, "cannot resume secondary vm"); crcs->callback(egc, crcs, rc); return; @@ -317,7 +318,7 @@ void libxl__colo_restore_teardown(libxl__egc *egc, void *dcs_void, if (ret == 0 && retval == 0) rc = 0; - LOG(INFO, "%s", rc ? "colo fails" : "failover"); + LOGD(INFO, crs->domid, "%s", rc ? "colo fails" : "failover"); libxl__stream_write_abort(egc, &crcs->sws, 1); if (crs->saved_cb) { @@ -351,8 +352,8 @@ static void colo_restore_teardown_devices_done(libxl__egc *egc, EGC_GC; if (rc) - LOG(ERROR, "COLO: failed to teardown device for guest with domid %u," - " rc %d", cds->domid, rc); + LOGD(ERROR, cds->domid, "COLO: failed to teardown device for guest," + " rc %d", rc); if (crcs->teardown_devices) cleanup_device_subkind(cds); @@ -387,7 +388,7 @@ static void do_failover(libxl__egc *egc, libxl__colo_restore_state *crs) * is not called. In this case, the migration is not finished, * so we cannot do failover. */ - LOG(ERROR, "migration fails"); + LOGD(ERROR, crs->domid, "migration fails"); crcs->callback(egc, crcs, ERROR_FAIL); return; case LIBXL_COLO_SUSPENDED: @@ -397,7 +398,7 @@ static void do_failover(libxl__egc *egc, libxl__colo_restore_state *crs) colo_disable_logdirty(crs, egc); return; default: - LOG(ERROR, "invalid status: %d", status); + LOGD(ERROR, crs->domid, "invalid status: %d", status); crcs->callback(egc, crcs, ERROR_FAIL); } } @@ -414,7 +415,7 @@ static void do_failover_done(libxl__egc *egc, EGC_GC; if (rc) - LOG(ERROR, "cannot do failover"); + LOGD(ERROR, crs->domid, "cannot do failover"); libxl__colo_restore_teardown_done(egc, crs, rc); } @@ -428,7 +429,7 @@ static void colo_disable_logdirty_done(libxl__egc *egc, EGC_GC; if (rc) - LOG(WARN, "cannot disable logdirty"); + LOGD(WARN, crcs->crs->domid, "cannot disable logdirty"); if (crcs->status == LIBXL_COLO_SUSPENDED) { /* @@ -601,13 +602,13 @@ static void colo_restore_preresume_cb(libxl__egc *egc, EGC_GC; if (rc) { - LOG(ERROR, "preresume fails"); + LOGD(ERROR, crs->domid, "preresume fails"); goto out; } if (crs->qdisk_setuped) { if (libxl__qmp_do_checkpoint(gc, crs->domid)) { - LOG(ERROR, "doing checkpoint fails"); + LOGD(ERROR, crs->domid, "doing checkpoint fails"); goto out; } } @@ -644,7 +645,7 @@ static void colo_resume_vm_done(libxl__egc *egc, EGC_GC; if (rc) { - LOG(ERROR, "cannot resume secondary vm"); + LOGD(ERROR, crs->domid, "cannot resume secondary vm"); goto out; } @@ -719,7 +720,7 @@ static void colo_reenable_logdirty(libxl__egc *egc, EGC_GC; if (rc) { - LOG(ERROR, "cannot enable logdirty"); + LOGD(ERROR, crs->domid, "cannot enable logdirty"); goto out; } @@ -745,7 +746,7 @@ static void colo_reenable_logdirty_done(libxl__egc *egc, EGC_GC; if (rc) { - LOG(ERROR, "cannot enable logdirty"); + LOGD(ERROR, crcs->crs->domid, "cannot enable logdirty"); goto out; } @@ -782,8 +783,7 @@ static void colo_setup_checkpoint_devices(libxl__egc *egc, crs->cps.ao = ao; if (colo_proxy_setup(&crs->cps)) { - LOG(ERROR, "COLO: failed to setup colo proxy for guest with domid %u", - cds->domid); + LOGD(ERROR, cds->domid, "COLO: failed to setup colo proxy for guest"); goto out; } @@ -813,14 +813,13 @@ static void colo_restore_setup_cds_done(libxl__egc *egc, EGC_GC; if (rc) { - LOG(ERROR, "COLO: failed to setup device for guest with domid %u", - cds->domid); + LOGD(ERROR, cds->domid, "COLO: failed to setup device for guest"); goto out; } if (crs->qdisk_used && !crs->qdisk_setuped) { if (libxl__qmp_start_replication(gc, crs->domid, false)) { - LOG(ERROR, "starting replication fails"); + LOGD(ERROR, cds->domid, "starting replication fails"); goto out; } crs->qdisk_setuped = true; @@ -849,7 +848,7 @@ static void colo_unpause_svm(libxl__egc *egc, /* We have enabled secondary vm's logdirty, so we can unpause it now */ rc = libxl_domain_unpause(CTX, domid); if (rc) { - LOG(ERROR, "cannot unpause secondary vm"); + LOGD(ERROR, domid, "cannot unpause secondary vm"); goto out; } @@ -894,7 +893,7 @@ static void colo_restore_commit_cb(libxl__egc *egc, EGC_GC; if (rc) { - LOG(ERROR, "commit fails"); + LOGD(ERROR, crs->domid, "commit fails"); goto out; } @@ -918,7 +917,7 @@ static void colo_stream_read_done(libxl__egc *egc, EGC_GC; if (id != CHECKPOINT_NEW) { - LOG(ERROR, "invalid section: %d", id); + LOGD(ERROR, crcs->crs->domid, "invalid section: %d", id); goto out; } @@ -974,14 +973,14 @@ static void colo_suspend_vm_done(libxl__egc *egc, EGC_GC; if (rc) { - LOG(ERROR, "cannot suspend secondary vm"); + LOGD(ERROR, crs->domid, "cannot suspend secondary vm"); goto out; } crcs->status = LIBXL_COLO_SUSPENDED; if (libxl__qmp_get_replication_error(gc, crs->domid)) { - LOG(ERROR, "replication error occurs when secondary vm is running"); + LOGD(ERROR, crs->domid, "replication error occurs when secondary vm is running"); goto out; } @@ -1006,7 +1005,7 @@ static void colo_restore_postsuspend_cb(libxl__egc *egc, EGC_GC; if (rc) { - LOG(ERROR, "postsuspend fails"); + LOGD(ERROR, crs->domid, "postsuspend fails"); goto out; } @@ -1035,7 +1034,7 @@ static void colo_common_write_stream_done(libxl__egc *egc, if (rc < 0) { /* TODO: it may be a internal error, but we don't know */ - LOG(ERROR, "sending data fails"); + LOGD(ERROR, crcs->crs->domid, "sending data fails"); ok = 2; goto out; } @@ -1066,7 +1065,7 @@ static void colo_common_read_stream_done(libxl__egc *egc, if (rc < 0) { /* TODO: it may be a internal error, but we don't know */ - LOG(ERROR, "reading data fails"); + LOGD(ERROR, crcs->crs->domid, "reading data fails"); ok = 2; goto out; }