From patchwork Thu Nov 17 17:35:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cedric Bosdonnat X-Patchwork-Id: 9434801 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 04C9260755 for ; Thu, 17 Nov 2016 17:38:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBD9629689 for ; Thu, 17 Nov 2016 17:38:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0CBB2968C; Thu, 17 Nov 2016 17:38:29 +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 4477C2968F for ; Thu, 17 Nov 2016 17:38:29 +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 1c7Qc5-0008Jd-Hq; Thu, 17 Nov 2016 17:36:41 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c7Qc4-0008DX-OI for xen-devel@lists.xen.org; Thu, 17 Nov 2016 17:36:40 +0000 Received: from [85.158.137.68] by server-9.bemta-3.messagelabs.com id 43/B5-08915-8AAED285; Thu, 17 Nov 2016 17:36:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42I53H6XVXf5K90 Ig/8zlS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oxLP6+wFzxwrvg5cz5jA+MSwy5GLg4hgSWM Eqcf9DF2MXJysAnYS3T9OcoEYosISEtc+3wZLM4sUCKx92kHmC0s4CWx8tosVhCbRUBVov/Te jCbV8BCYsKnQ8wgtoSAvMSFq6dYQGxOoPiBw+fA4kIC5hJv3ixggqgXlDg58wlQDQfQfHWJ9f OEIFbJSzRvnc08gZF3FpKqWQhVs5BULWBkXsWoXpxaVJZapGuql1SUmZ5RkpuYmaNraGCsl5t aXJyYnpqTmFSsl5yfu4kRGFD1DAyMOxgvf3U6xCjJwaQkysv8UjdCiC8pP6UyI7E4I76oNCe1 +BCjDAeHkgTvG5CcYFFqempFWmYOMLRh0hIcPEoivJIgad7igsTc4sx0iNQpRkUpcd7TIAkBk ERGaR5cGyyeLjHKSgnzMjIwMAjxFKQW5WaWoMq/YhTnYFQS5l0EMoUnM68EbvoroMVMQIv3CO iALC5JREhJNTAWTmjbXe6wUvnp1+1tK96feTbn1tbYQz37ZZdtzVqxO4pzf+bPdyH+6x74hf3 12e3BH+vVevbpxvtX1MwU68XOnLHOv7T439RP2okPyq9de3VGk+9D7AVN8btpOfy6z8v2rauX v7cxa/njBNUL8x/9f77kZ1ykJusfiQDZCcE5C87xqU48LftGWImlOCPRUIu5qDgRAHsAhPKiA gAA X-Env-Sender: cbosdonnat@suse.com X-Msg-Ref: server-4.tower-31.messagelabs.com!1479404197!13449321!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 850 invoked from network); 17 Nov 2016 17:36:37 -0000 Received: from smtp.nue.novell.com (HELO smtp.nue.novell.com) (195.135.221.5) by server-4.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 17 Nov 2016 17:36:37 -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); Thu, 17 Nov 2016 18:36:37 +0100 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= To: xen-devel@lists.xen.org Date: Thu, 17 Nov 2016 18:35:53 +0100 Message-Id: <20161117173617.6697-12-cbosdonnat@suse.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161117173617.6697-1-cbosdonnat@suse.com> References: <20161117173617.6697-1-cbosdonnat@suse.com> MIME-Version: 1.0 Cc: Wei Liu , Ian Jackson , 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 --- 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; }