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 15/35] libxl/libxl_dm.c: used LOG*D functions
Date: Thu, 17 Nov 2016 18:35:57 +0100	[thread overview]
Message-ID: <20161117173617.6697-16-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_dm.c | 111 ++++++++++++++++++++++++++-----------------------
 1 file changed, 59 insertions(+), 52 deletions(-)

diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index ad366a8..be928ad 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -455,7 +455,7 @@ static int libxl__build_device_model_args_old(libxl__gc *gc,
         if (vnc->listen) {
             if (strchr(vnc->listen, ':') != NULL) {
                 if (vnc->display) {
-                    LOG(ERROR, "vncdisplay set, vnclisten contains display");
+                    LOGD(ERROR, domid, "vncdisplay set, vnclisten contains display");
                     return ERROR_INVAL;
                 }
                 vncarg = vnc->listen;
@@ -502,15 +502,15 @@ static int libxl__build_device_model_args_old(libxl__gc *gc,
         char *s;
 
         if (b_info->kernel) {
-            LOG(ERROR, "HVM direct kernel boot is not supported by "
-                "qemu-xen-traditional");
+            LOGD(ERROR, domid, "HVM direct kernel boot is not supported by "
+                 "qemu-xen-traditional");
             return ERROR_INVAL;
         }
 
         if (b_info->u.hvm.serial || b_info->u.hvm.serial_list) {
             if ( b_info->u.hvm.serial && b_info->u.hvm.serial_list )
             {
-                LOG(ERROR, "Both serial and serial_list set");
+                LOGD(ERROR, domid, "Both serial and serial_list set");
                 return ERROR_INVAL;
             }
             if (b_info->u.hvm.serial) {
@@ -550,7 +550,7 @@ static int libxl__build_device_model_args_old(libxl__gc *gc,
         case LIBXL_VGA_INTERFACE_TYPE_QXL:
             break;
         default:
-            LOG(ERROR, "Invalid emulated video card specified");
+            LOGD(ERROR, domid, "Invalid emulated video card specified");
             return ERROR_INVAL;
         }
 
@@ -562,7 +562,7 @@ static int libxl__build_device_model_args_old(libxl__gc *gc,
             || b_info->u.hvm.usbdevice_list) {
             if ( b_info->u.hvm.usbdevice && b_info->u.hvm.usbdevice_list )
             {
-                LOG(ERROR, "Both usbdevice and usbdevice_list set");
+                LOGD(ERROR, domid, "Both usbdevice and usbdevice_list set");
                 return ERROR_INVAL;
             }
             flexarray_append(dm_args, "-usb");
@@ -632,7 +632,7 @@ static int libxl__build_device_model_args_old(libxl__gc *gc,
                 flexarray_append(dm_args, "-gfx_passthru");
                 break;
             default:
-                LOG(ERROR, "unsupported gfx_passthru_kind.");
+                LOGD(ERROR, domid, "unsupported gfx_passthru_kind.");
                 return ERROR_INVAL;
             }
         }
@@ -970,7 +970,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
                 break;
             default:
                 /* We've forgotten to add the clause */
-                LOG(ERROR, "%s: unknown channel connection %d",
+                LOGD(ERROR, guest_domid, "%s: unknown channel connection %d",
                     __func__, connection);
                 return ERROR_INVAL;
         }
@@ -1014,7 +1014,8 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
         if (vnc->listen) {
             if (strchr(vnc->listen, ':') != NULL) {
                 if (vnc->display) {
-                    LOG(ERROR, "vncdisplay set, vnclisten contains display");
+                    LOGD(ERROR, guest_domid,
+                         "vncdisplay set, vnclisten contains display");
                     return ERROR_INVAL;
                 }
                 vncarg = vnc->listen;
@@ -1075,7 +1076,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
         if (b_info->u.hvm.serial || b_info->u.hvm.serial_list) {
             if ( b_info->u.hvm.serial && b_info->u.hvm.serial_list )
             {
-                LOG(ERROR, "Both serial and serial_list set");
+                LOGD(ERROR, guest_domid, "Both serial and serial_list set");
                 return ERROR_INVAL;
             }
             if (b_info->u.hvm.serial) {
@@ -1133,7 +1134,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
                 (b_info->video_memkb/2/1024), (b_info->video_memkb/2/1024) ) );
             break;
         default:
-            LOG(ERROR, "Invalid emulated video card specified");
+            LOGD(ERROR, guest_domid, "Invalid emulated video card specified");
             return ERROR_INVAL;
         }
 
@@ -1146,7 +1147,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
             || b_info->u.hvm.usbdevice_list) {
             if ( b_info->u.hvm.usbdevice && b_info->u.hvm.usbdevice_list )
             {
-                LOG(ERROR, "Both usbdevice and usbdevice_list set");
+                LOGD(ERROR, guest_domid, "Both usbdevice and usbdevice_list set");
                 return ERROR_INVAL;
             }
             flexarray_append(dm_args, "-usb");
@@ -1183,7 +1184,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
                     "-device", "nec-usb-xhci,id=usb", NULL);
                 break;
             default:
-                LOG(ERROR, "usbversion parameter is invalid, "
+                LOGD(ERROR, guest_domid, "usbversion parameter is invalid, "
                     "must be between 1 and 3");
                 return ERROR_INVAL;
             }
@@ -1196,7 +1197,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
                         GCSPRINTF("usb-redir,chardev=usbrc%d,"
                         "id=usbrc%d", i, i), NULL);
             } else {
-                LOG(ERROR, "usbredirection parameter is invalid, "
+                LOGD(ERROR, guest_domid, "usbredirection parameter is invalid, "
                     "it must be between 1 and 4");
                 return ERROR_INVAL;
             }
@@ -1282,8 +1283,8 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
                 (b_info->u.hvm.mmio_hole_memkb << 10);
 
             if (max_ram_below_4g > HVM_BELOW_4G_MMIO_START) {
-                LOG(WARN, "mmio_hole_memkb=%"PRIu64
-                    " invalid ignored.\n",
+                LOGD(WARN, guest_domid, "mmio_hole_memkb=%"PRIu64
+                     " invalid ignored.\n",
                     b_info->u.hvm.mmio_hole_memkb);
             } else {
                 machinearg = GCSPRINTF("%s,max-ram-below-4g=%"PRIu64,
@@ -1299,10 +1300,10 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
                 machinearg = GCSPRINTF("%s,igd-passthru=on", machinearg);
                 break;
             case LIBXL_GFX_PASSTHRU_KIND_DEFAULT:
-                LOG(ERROR, "unable to detect required gfx_passthru_kind");
+                LOGD(ERROR, guest_domid, "unable to detect required gfx_passthru_kind");
                 return ERROR_FAIL;
             default:
-                LOG(ERROR, "invalid value for gfx_passthru_kind");
+                LOGD(ERROR, guest_domid, "invalid value for gfx_passthru_kind");
                 return ERROR_INVAL;
             }
         }
@@ -1332,8 +1333,8 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
             int colo_mode;
 
             if (dev_number == -1) {
-                LOG(WARN, "unable to determine"" disk number for %s",
-                    disks[i].vdev);
+                LOGD(WARN, guest_domid, "unable to determine"" disk number for %s",
+                     disks[i].vdev);
                 continue;
             }
 
@@ -1348,17 +1349,17 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
 
             if (disks[i].format == LIBXL_DISK_FORMAT_EMPTY) {
                 if (!disks[i].is_cdrom) {
-                    LOG(WARN, "Cannot support empty disk format for %s",
-                        disks[i].vdev);
+                    LOGD(WARN, guest_domid, "Cannot support empty disk format for %s",
+                         disks[i].vdev);
                     continue;
                 }
             } else {
                 if (format == NULL) {
-                    LOG(WARN,
-                        "Unable to determine disk image format: %s\n"
-                        "Disk will be available via PV drivers but not as an"
-                        "emulated disk.",
-                        disks[i].vdev);
+                    LOGD(WARN, guest_domid,
+                         "Unable to determine disk image format: %s\n"
+                         "Disk will be available via PV drivers but not as an"
+                         "emulated disk.",
+                         disks[i].vdev);
                     continue;
                 }
 
@@ -1378,10 +1379,10 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
                                                  guest_domid, &disks[i], true);
 
                 if (!target_path) {
-                    LOG(WARN, "No way to get local access disk to image: %s\n"
-                        "Disk will be available via PV drivers but not as an"
-                        "emulated disk.",
-                        disks[i].vdev);
+                    LOGD(WARN, guest_domid, "No way to get local access disk to image: %s\n"
+                         "Disk will be available via PV drivers but not as an"
+                         "emulated disk.",
+                         disks[i].vdev);
                     continue;
                 }
             }
@@ -1426,7 +1427,8 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
                                                         colo_mode);
                 } else if (disk < 6 && b_info->u.hvm.hdtype == LIBXL_HDTYPE_AHCI) {
                     if (!disks[i].readwrite) {
-                        LOG(ERROR, "qemu-xen doesn't support read-only AHCI disk drivers");
+                        LOGD(ERROR, guest_domid,
+                             "qemu-xen doesn't support read-only AHCI disk drivers");
                         return ERROR_INVAL;
                     }
                     flexarray_vappend(dm_args, "-drive",
@@ -1437,7 +1439,8 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
                     continue;
                 } else if (disk < 4) {
                     if (!disks[i].readwrite) {
-                        LOG(ERROR, "qemu-xen doesn't support read-only IDE disk drivers");
+                        LOGD(ERROR, guest_domid,
+                             "qemu-xen doesn't support read-only IDE disk drivers");
                         return ERROR_INVAL;
                     }
                     if (colo_mode == LIBXL__COLO_SECONDARY) {
@@ -1490,14 +1493,14 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
         if (ret < 0)
             return ret;
         if (ret > 0) {
-            LOG(WARN, "Could not find user %s%d, falling back to %s",
+            LOGD(WARN, guest_domid, "Could not find user %s%d, falling back to %s",
                     LIBXL_QEMU_USER_BASE, guest_domid, LIBXL_QEMU_USER_SHARED);
             goto end_search;
         }
 
         user = NULL;
-        LOG(DEBUG, "Could not find user %s, starting QEMU as root",
-            LIBXL_QEMU_USER_SHARED);
+        LOGD(DEBUG, guest_domid, "Could not find user %s, starting QEMU as root",
+             LIBXL_QEMU_USER_SHARED);
 
 end_search:
         if (user != NULL && strcmp(user, "root")) {
@@ -1536,8 +1539,8 @@ static int libxl__build_device_model_args(libxl__gc *gc,
                                                   args, envs,
                                                   state, dm_state_fd);
     default:
-        LOGE(ERROR, "unknown device model version %d",
-             guest_config->b_info.device_model_version);
+        LOGED(ERROR, guest_domid, "unknown device model version %d",
+              guest_config->b_info.device_model_version);
         return ERROR_INVAL;
     }
 }
@@ -1764,7 +1767,8 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
                      "%d", guest_domid);
     ret = xc_domain_set_target(ctx->xch, dm_domid, guest_domid);
     if (ret<0) {
-        LOGE(ERROR, "setting target domain %d -> %d", dm_domid, guest_domid);
+        LOGED(ERROR, guest_domid, "setting target domain %d -> %d",
+              dm_domid, guest_domid);
         ret = ERROR_FAIL;
         goto out;
     }
@@ -1814,7 +1818,7 @@ static void spawn_stub_launch_dm(libxl__egc *egc,
     uint32_t dm_domid = sdss->pvqemu.guest_domid;
 
     if (ret) {
-        LOG(ERROR, "error connecting disk devices");
+        LOGD(ERROR, guest_domid, "error connecting disk devices");
         goto out;
      }
 
@@ -1929,7 +1933,8 @@ static void stubdom_pvqemu_cb(libxl__egc *egc,
     libxl__xswait_init(&sdss->xswait);
 
     if (rc) {
-        LOGE(ERROR, "error connecting nics devices");
+        LOGED(ERROR, sdss->dm.guest_domid,
+              "error connecting nics devices");
         goto out;
     }
 
@@ -1960,7 +1965,8 @@ static void stubdom_xswait_cb(libxl__egc *egc, libxl__xswait_state *xswait,
 
     if (rc) {
         if (rc == ERROR_TIMEDOUT)
-            LOG(ERROR, "%s: startup timed out", xswait->what);
+            LOGD(ERROR, sdss->dm.guest_domid,
+                 "%s: startup timed out", xswait->what);
         goto out;
     }
 
@@ -2021,7 +2027,7 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss)
         goto out;
     }
     if (access(dm, X_OK) < 0) {
-        LOGE(ERROR, "device model %s is not executable", dm);
+        LOGED(ERROR, domid, "device model %s is not executable", dm);
         rc = ERROR_FAIL;
         goto out;
     }
@@ -2064,7 +2070,7 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss)
     }
     null = open("/dev/null", O_RDONLY);
     if (null < 0) {
-        LOGE(ERROR, "unable to open /dev/null");
+        LOGED(ERROR, domid, "unable to open /dev/null");
         rc = ERROR_FAIL;
         goto out_close;
     }
@@ -2091,13 +2097,13 @@ retry_transaction:
         }
     }
 
-    LOG(DEBUG, "Spawning device-model %s with arguments:", dm);
+    LOGD(DEBUG, domid, "Spawning device-model %s with arguments:", dm);
     for (arg = args; *arg; arg++)
-        LOG(DEBUG, "  %s", *arg);
+        LOGD(DEBUG, domid, "  %s", *arg);
     if (*envs) {
-        LOG(DEBUG, "Spawning device-model %s with additional environment:", dm);
+        LOGD(DEBUG, domid, "Spawning device-model %s with additional environment:", dm);
         for (arg = envs; *arg; arg += 2)
-            LOG(DEBUG, "  %s=%s", arg[0], arg[1]);
+            LOGD(DEBUG, domid, "  %s=%s", arg[0], arg[1]);
     }
 
     spawn->what = GCSPRINTF("domain %d device model", domid);
@@ -2186,14 +2192,15 @@ static void device_model_spawn_outcome(libxl__egc *egc,
     int ret2;
 
     if (rc)
-        LOG(ERROR, "%s: spawn failed (rc=%d)", dmss->spawn.what, rc);
+        LOGD(ERROR, dmss->guest_domid,
+             "%s: spawn failed (rc=%d)", dmss->spawn.what, rc);
 
     libxl__domain_build_state *state = dmss->build_state;
 
     if (state->saved_state) {
         ret2 = unlink(state->saved_state);
         if (ret2) {
-            LOGE(ERROR, "%s: failed to remove device-model state %s",
+            LOGED(ERROR, dmss->guest_domid, "%s: failed to remove device-model state %s",
                  dmss->spawn.what, state->saved_state);
             rc = ERROR_FAIL;
             goto out;
@@ -2339,7 +2346,7 @@ int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid)
 {
     char *path = DEVICE_MODEL_XS_PATH(gc, LIBXL_TOOLSTACK_DOMID, domid, "");
     if (!xs_rm(CTX->xsh, XBT_NULL, path))
-        LOG(ERROR, "xs_rm failed for %s", path);
+        LOGD(ERROR, domid, "xs_rm failed for %s", path);
     /* We should try to destroy the device model anyway. */
     return kill_device_model(gc,
                 GCSPRINTF("/local/domain/%d/image/device-model-pid", domid));
@@ -2420,7 +2427,7 @@ int libxl__dm_check_start(libxl__gc *gc, libxl_domain_config *d_config,
     if (!rc)
         return 0;
 
-    LOG(ERROR, "device model required but not running");
+    LOGD(ERROR, domid, "device model required but not running");
     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 ` Cédric Bosdonnat [this message]
2016-11-17 17:35 ` [PATCH v2 16/35] libxl/libxl_dom_save.c: " Cédric Bosdonnat
2016-11-17 17:35 ` [PATCH v2 17/35] libxl/libxl_dom_suspend.c: " Cédric Bosdonnat
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 15/35] libxl/libxl_dm.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-16-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.