From patchwork Tue Nov 15 10:18:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cedric Bosdonnat X-Patchwork-Id: 9429339 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 8B5E760469 for ; Tue, 15 Nov 2016 10:22:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73950286B9 for ; Tue, 15 Nov 2016 10:22:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6867D286C2; Tue, 15 Nov 2016 10:22:10 +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 9BFD4286BF for ; Tue, 15 Nov 2016 10:22:08 +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 1c6aqX-0005VV-3N; Tue, 15 Nov 2016 10:20:09 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c6aqW-0005Q0-Dt for xen-devel@lists.xen.org; Tue, 15 Nov 2016 10:20:08 +0000 Received: from [85.158.139.211] by server-7.bemta-5.messagelabs.com id 4E/28-19310-751EA285; Tue, 15 Nov 2016 10:20:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42I53H6XVTfooVa Ewd69hhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa0bXbaeCZ84Vj7d/YG1gXGXYxcjFISSwhFFi yeEnrF2MnBxsAvYSXX+OMoHYIgLSEtc+X2YEKWIWOMEo0bNxMxtIQljAXeLQnCawIhYBVYljb 7+BNfMKWEr8WbeNEcSWEJCXuHD1FAuIzQkU/3n0KTuILSRgIbHkcjczRL2gxMmZT4BqOIAWqE usnycEEmYGam3eOpt5AiPvLCRVsxCqZiGpWsDIvIpRvTi1qCy1SNdEL6koMz2jJDcxM0fX0MB ULze1uDgxPTUnMalYLzk/dxMjMKAYgGAH460+50OMkhxMSqK8Qqu1IoT4kvJTKjMSizPii0pz UosPMcpwcChJ8Co8AMoJFqWmp1akZeYAQxsmLcHBoyTCGwOS5i0uSMwtzkyHSJ1iVJQS5w0AS QiAJDJK8+DaYPF0iVFWSpiXEegQIZ6C1KLczBJU+VeM4hyMSsK8GiBTeDLzSuCmvwJazAS0eJ e5BsjikkSElFQDY7Dawgsppqd3FC7g+3Y6a8W/Wj/dfXFy+zX8spnXSbeEpNl2/diYUN5n6m3 q6Xgppfieyc6bbjlNwjEHzsc4mV5jea49LYLdsHeCxhLH5tN/q+teTxI9lbs0Wr1188ubio/f iteq8+u+tLu7bVLu5qMnmQqY65r7Fvn+1eqU+T5jzdvb3IdtlViKMxINtZiLihMB6rwkDqICA AA= X-Env-Sender: cbosdonnat@suse.com X-Msg-Ref: server-9.tower-206.messagelabs.com!1479205202!70440409!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 23199 invoked from network); 15 Nov 2016 10:20:02 -0000 Received: from smtp.nue.novell.com (HELO smtp.nue.novell.com) (195.135.221.5) by server-9.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 15 Nov 2016 10:20:02 -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); Tue, 15 Nov 2016 11:20:01 +0100 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= To: xen-devel@lists.xen.org Date: Tue, 15 Nov 2016 11:18:49 +0100 Message-Id: <20161115101913.10396-12-cbosdonnat@suse.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161115101913.10396-1-cbosdonnat@suse.com> References: <20161115101913.10396-1-cbosdonnat@suse.com> MIME-Version: 1.0 Cc: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= , Wei Liu , Ian Jackson , =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Subject: [Xen-devel] [PATCH 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: Cédric Bosdonnat Use LOG*D logging functions where possible instead of the LOG* ones. Signed-off-by: Cédric Bosdonnat --- 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; }