All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Bosdonnat" <cbosdonnat@suse.com>
To: xen-devel@lists.xen.org
Cc: Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Cedric Bosdonnat <cbosdonnat@suse.com>
Subject: [PATCH v2 17/35] libxl/libxl_dom_suspend.c: used LOG*D functions
Date: Thu, 17 Nov 2016 18:35:59 +0100	[thread overview]
Message-ID: <20161117173617.6697-18-cbosdonnat@suse.com> (raw)
In-Reply-To: <20161117173617.6697-1-cbosdonnat@suse.com>

From: Cedric Bosdonnat <cbosdonnat@suse.com>

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
---
 tools/libxl/libxl_dom_suspend.c | 45 ++++++++++++++++++++---------------------
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/tools/libxl/libxl_dom_suspend.c b/tools/libxl/libxl_dom_suspend.c
index 0648919..d258a1c 100644
--- a/tools/libxl/libxl_dom_suspend.c
+++ b/tools/libxl/libxl_dom_suspend.c
@@ -54,7 +54,7 @@ int libxl__domain_suspend_init(libxl__egc *egc,
                                     domid, port, &dsps->guest_evtchn_lockfd);
 
         if (dsps->guest_evtchn.port < 0) {
-            LOG(WARN, "Suspend event channel initialization failed");
+            LOGD(WARN, domid, "Suspend event channel initialization failed");
             rc = ERROR_FAIL;
             goto out;
         }
@@ -77,7 +77,7 @@ int libxl__domain_suspend_device_model(libxl__gc *gc,
 
     switch (libxl__device_model_version_running(gc, domid)) {
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: {
-        LOG(DEBUG, "Saving device model state to %s", filename);
+        LOGD(DEBUG, domid, "Saving device model state to %s", filename);
         libxl__qemu_traditional_cmd(gc, domid, "save");
         libxl__wait_for_device_model_deprecated(gc, domid, "paused", NULL, NULL, NULL);
         break;
@@ -154,11 +154,11 @@ static void domain_suspend_callback_common(libxl__egc *egc,
     }
 
     if ((hvm_s_state == 0) && (dsps->guest_evtchn.port >= 0)) {
-        LOG(DEBUG, "issuing %s suspend request via event channel",
+        LOGD(DEBUG, domid, "issuing %s suspend request via event channel",
             dsps->type == LIBXL_DOMAIN_TYPE_HVM ? "PVHVM" : "PV");
         ret = xenevtchn_notify(CTX->xce, dsps->guest_evtchn.port);
         if (ret < 0) {
-            LOG(ERROR, "xenevtchn_notify failed ret=%d", ret);
+            LOGD(ERROR, domid, "xenevtchn_notify failed ret=%d", ret);
             rc = ERROR_FAIL;
             goto err;
         }
@@ -176,10 +176,10 @@ static void domain_suspend_callback_common(libxl__egc *egc,
     }
 
     if (dsps->type == LIBXL_DOMAIN_TYPE_HVM && (!hvm_pvdrv || hvm_s_state)) {
-        LOG(DEBUG, "Calling xc_domain_shutdown on HVM domain");
+        LOGD(DEBUG, domid, "Calling xc_domain_shutdown on HVM domain");
         ret = xc_domain_shutdown(CTX->xch, domid, SHUTDOWN_suspend);
         if (ret < 0) {
-            LOGE(ERROR, "xc_domain_shutdown failed");
+            LOGED(ERROR, domid, "xc_domain_shutdown failed");
             rc = ERROR_FAIL;
             goto err;
         }
@@ -189,7 +189,7 @@ static void domain_suspend_callback_common(libxl__egc *egc,
         return;
     }
 
-    LOG(DEBUG, "issuing %s suspend request via XenBus control node",
+    LOGD(DEBUG, domid, "issuing %s suspend request via XenBus control node",
         dsps->type == LIBXL_DOMAIN_TYPE_HVM ? "PVHVM" : "PV");
 
     libxl__domain_pvcontrol_write(gc, XBT_NULL, domid, "suspend");
@@ -260,8 +260,8 @@ static void domain_suspend_common_pvcontrol_suspending(libxl__egc *egc,
 
             rc = libxl__xs_transaction_commit(gc, &t);
             if (!rc) {
-                LOG(ERROR,
-                    "guest didn't acknowledge suspend, cancelling request");
+                LOGD(ERROR, dsps->domid,
+                     "guest didn't acknowledge suspend, cancelling request");
                 goto err;
             }
             if (rc<0) goto err;
@@ -272,7 +272,7 @@ static void domain_suspend_common_pvcontrol_suspending(libxl__egc *egc,
     }
 
     assert(domain_suspend_pvcontrol_acked(state));
-    LOG(DEBUG, "guest acknowledged suspend request");
+    LOGD(DEBUG, dsps->domid, "guest acknowledged suspend request");
 
     libxl__xs_transaction_abort(gc, &t);
     dsps->guest_responded = 1;
@@ -291,7 +291,7 @@ static void domain_suspend_common_wait_guest(libxl__egc *egc,
     STATE_AO_GC(dsps->ao);
     int rc;
 
-    LOG(DEBUG, "wait for the guest to suspend");
+    LOGD(DEBUG, dsps->domid, "wait for the guest to suspend");
 
     rc = libxl__ev_xswatch_register(gc, &dsps->guest_watch,
                                     suspend_common_wait_guest_watch,
@@ -328,13 +328,12 @@ static void suspend_common_wait_guest_check(libxl__egc *egc,
 
     ret = xc_domain_getinfolist(CTX->xch, domid, 1, &info);
     if (ret < 0) {
-        LOGE(ERROR, "unable to check for status of guest %"PRId32"", domid);
+        LOGED(ERROR, domid, "unable to check for status of guest");
         goto err;
     }
 
     if (!(ret == 1 && info.domain == domid)) {
-        LOGE(ERROR, "guest %"PRId32" we were suspending has been destroyed",
-             domid);
+        LOGED(ERROR, domid, "guest we were suspending has been destroyed");
         goto err;
     }
 
@@ -345,12 +344,12 @@ static void suspend_common_wait_guest_check(libxl__egc *egc,
     shutdown_reason = (info.flags >> XEN_DOMINF_shutdownshift)
         & XEN_DOMINF_shutdownmask;
     if (shutdown_reason != SHUTDOWN_suspend) {
-        LOG(DEBUG, "guest %"PRId32" we were suspending has shut down"
-            " with unexpected reason code %d", domid, shutdown_reason);
+        LOGD(DEBUG, domid, "guest we were suspending has shut down"
+             " with unexpected reason code %d", shutdown_reason);
         goto err;
     }
 
-    LOG(DEBUG, "guest has suspended");
+    LOGD(DEBUG, domid, "guest has suspended");
     domain_suspend_common_guest_suspended(egc, dsps);
     return;
 
@@ -364,7 +363,7 @@ static void suspend_common_wait_guest_timeout(libxl__egc *egc,
     libxl__domain_suspend_state *dsps = CONTAINER_OF(ev, *dsps, guest_timeout);
     STATE_AO_GC(dsps->ao);
     if (rc == ERROR_TIMEDOUT) {
-        LOG(ERROR, "guest did not suspend, timed out");
+        LOGD(ERROR, dsps->domid, "guest did not suspend, timed out");
         rc = ERROR_GUEST_TIMEDOUT;
     }
     domain_suspend_common_done(egc, dsps, rc);
@@ -383,7 +382,8 @@ static void domain_suspend_common_guest_suspended(libxl__egc *egc,
     if (dsps->type == LIBXL_DOMAIN_TYPE_HVM) {
         rc = libxl__domain_suspend_device_model(gc, dsps);
         if (rc) {
-            LOG(ERROR, "libxl__domain_suspend_device_model failed ret=%d", rc);
+            LOGD(ERROR, dsps->domid,
+                 "libxl__domain_suspend_device_model failed ret=%d", rc);
             domain_suspend_common_done(egc, dsps, rc);
             return;
         }
@@ -457,7 +457,7 @@ int libxl__domain_resume(libxl__gc *gc, uint32_t domid, int suspend_cancel)
     int rc = 0;
 
     if (xc_domain_resume(CTX->xch, domid, suspend_cancel)) {
-        LOGE(ERROR, "xc_domain_resume failed for domain %u", domid);
+        LOGED(ERROR, domid, "xc_domain_resume failed");
         rc = ERROR_FAIL;
         goto out;
     }
@@ -471,14 +471,13 @@ int libxl__domain_resume(libxl__gc *gc, uint32_t domid, int suspend_cancel)
     if (type == LIBXL_DOMAIN_TYPE_HVM) {
         rc = libxl__domain_resume_device_model(gc, domid);
         if (rc) {
-            LOG(ERROR, "failed to resume device model for domain %u:%d",
-                domid, rc);
+            LOGD(ERROR, domid, "failed to resume device model:%d", rc);
             goto out;
         }
     }
 
     if (!xs_resume_domain(CTX->xsh, domid)) {
-        LOGE(ERROR, "xs_resume_domain failed for domain %u", domid);
+        LOGED(ERROR, domid, "xs_resume_domain failed");
         rc = ERROR_FAIL;
     }
 out:
-- 
2.10.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-11-17 17:35 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-17 17:35 [PATCH v2 00/35] libxl LOG*D functions Cédric Bosdonnat
2016-11-17 17:35 ` [PATCH v2 01/35] libxl: add LIBXL_LOGD_* and LOG*D function families Cédric Bosdonnat
2016-11-17 17:35 ` [PATCH v2 02/35] libxl.c: switch to LOG*D use Cédric Bosdonnat
2016-11-17 17:35 ` [PATCH v2 03/35] libxl.c: switch to LOG*D use (refactored messages) Cédric Bosdonnat
2016-11-17 17:35 ` [PATCH v2 04/35] libxl.c: switch to LOG*D use Cédric Bosdonnat
2016-11-17 17:35 ` [PATCH v2 05/35] libxl/libxl_bootloader.c: used LOG*D functions Cédric Bosdonnat
2016-11-17 17:35 ` [PATCH v2 06/35] libxl/libxl_checkpoint_device.c: " Cédric Bosdonnat
2016-11-17 17:35 ` [PATCH v2 07/35] libxl/libxl_colo.h: " Cédric Bosdonnat
2016-11-17 17:35 ` [PATCH v2 08/35] libxl/libxl_colo_nic.c: " Cédric Bosdonnat
2016-11-17 17:35 ` [PATCH v2 09/35] libxl/libxl_colo_proxy.c: " Cédric Bosdonnat
2016-11-17 17:35 ` [PATCH v2 10/35] libxl/libxl_colo_qdisk.c: " Cédric Bosdonnat
2016-11-17 17:35 ` [PATCH v2 11/35] libxl/libxl_colo_restore.c: " Cédric Bosdonnat
2016-11-17 17:35 ` [PATCH v2 12/35] libxl/libxl_colo_save.c: " Cédric Bosdonnat
2016-11-17 17:35 ` [PATCH v2 13/35] libxl/libxl_create.c: " Cédric Bosdonnat
2016-11-17 17:35 ` [PATCH v2 14/35] libxl/libxl_device.c: " Cédric Bosdonnat
2016-11-17 17:35 ` [PATCH v2 15/35] libxl/libxl_dm.c: " Cédric Bosdonnat
2016-11-17 17:35 ` [PATCH v2 16/35] libxl/libxl_dom_save.c: " Cédric Bosdonnat
2016-11-17 17:35 ` Cédric Bosdonnat [this message]
2016-11-17 17:36 ` [PATCH v2 18/35] libxl/libxl_freebsd.c: " Cédric Bosdonnat
2016-11-17 17:36 ` [PATCH v2 19/35] libxl/libxl_internal.c: " Cédric Bosdonnat
2016-11-17 17:36 ` [PATCH v2 20/35] libxl/libxl_linux.c: " Cédric Bosdonnat
2016-11-17 17:36 ` [PATCH v2 21/35] libxl/libxl_netbsd.c: " Cédric Bosdonnat
2016-11-17 17:36 ` [PATCH v2 22/35] libxl/libxl_netbuffer.c: " Cédric Bosdonnat
2016-11-17 17:36 ` [PATCH v2 23/35] libxl/libxl_nic.c: " Cédric Bosdonnat
2016-11-17 17:36 ` [PATCH v2 24/35] libxl/libxl_no_colo.c: " Cédric Bosdonnat
2016-11-17 17:36 ` [PATCH v2 25/35] libxl/libxl_pci.c: " Cédric Bosdonnat
2016-11-17 17:36 ` [PATCH v2 26/35] libxl/libxl_psr.c: " Cédric Bosdonnat
2016-11-17 17:36 ` [PATCH v2 27/35] libxl/libxl_pvusb.c: " Cédric Bosdonnat
2016-11-17 17:36 ` [PATCH v2 28/35] libxl/libxl_qmp.c: " Cédric Bosdonnat
2016-11-17 17:36 ` [PATCH v2 29/35] libxl/libxl_remus.c: " Cédric Bosdonnat
2016-11-17 17:36 ` [PATCH v2 30/35] libxl/libxl_save_callout.c: " Cédric Bosdonnat
2016-11-17 17:36 ` [PATCH v2 31/35] libxl/libxl_stream_write.c: " Cédric Bosdonnat
2016-11-17 17:36 ` [PATCH v2 32/35] libxl/libxl_vnuma.c: " Cédric Bosdonnat
2016-11-17 17:36 ` [PATCH v2 33/35] libxl/libxl_vtpm.c: " Cédric Bosdonnat
2016-11-17 17:36 ` [PATCH v2 34/35] libxl/libxl_x86.c: " Cédric Bosdonnat
2016-11-17 17:36 ` [PATCH v2 35/35] libxl/libxl_xshelp.c: " Cédric Bosdonnat
2016-11-18 15:59 ` [PATCH v2 00/35] libxl " Wei Liu
2016-12-01 14:32   ` Wei Liu
2016-12-02 15:08 Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 17/35] libxl/libxl_dom_suspend.c: used " Cédric Bosdonnat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161117173617.6697-18-cbosdonnat@suse.com \
    --to=cbosdonnat@suse.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.