diff mbox

[17/35] libxl/libxl_dom_suspend.c: used LOG*D functions

Message ID 20161115101913.10396-18-cbosdonnat@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Cedric Bosdonnat Nov. 15, 2016, 10:18 a.m. UTC
From: Cédric Bosdonnat <cedric.bosdonnat@free.fr>

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 mbox

Patch

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: