From b1bbd97c00891e7daff55fce80850531fae80100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Date: Tue, 4 Oct 2016 10:59:04 +0200 Subject: [PATCH] libxl: format the domain id in log messages In order to allow consuming applications demux log messages by domain, we need a constant and parsable way to display the domid in the libxl logs. This commit adds the domid where possible in the log and makes sure it is shown in the "Domain %"PRIu32":" format. --- tools/libxl/libxl.c | 420 ++++++++++++++++++++++++++++------------------------ 1 file changed, 225 insertions(+), 195 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 6a50e49..8aa551b 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -393,13 +393,13 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid, if (!trans) { trans = our_trans = xs_transaction_start(ctx->xsh); if (!our_trans) { - LOGEV(ERROR, errno, "create xs transaction for domain (re)name"); + LOGEV(ERROR, errno, "Domain %"PRIu32": create xs transaction for domain (re)name", domid); goto x_fail; } } if (!new_name) { - LOG(ERROR, "new domain name not specified"); + LOG(ERROR, "Domain %"PRIu32": new domain name not specified", domid); rc = ERROR_INVAL; goto x_rc; } @@ -411,14 +411,14 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid, if (rc == ERROR_INVAL) { /* no such domain, good */ } else if (rc != 0) { - LOG(ERROR, "unexpected error checking for existing domain"); + LOG(ERROR, "Domain %"PRIu32":unexpected error checking for existing domain", domid); goto x_rc; } else if (domid_e == domid) { /* domain already has this name, ok (but we do still * need the rest of the code as we may need to check * old_name, for example). */ } else { - LOG(ERROR, "domain with name \"%s\" already exists.", new_name); + LOG(ERROR, "Domain %"PRIu32": domain with name \"%s\" already exists.", domid, new_name); rc = ERROR_INVAL; goto x_rc; } @@ -428,14 +428,14 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid, got_old_name = xs_read(ctx->xsh, trans, name_path, &got_old_len); if (!got_old_name) { LOGEV(ERROR, errno, - "check old name for domain %"PRIu32" allegedly named `%s'", + "Domain %"PRIu32": check old name for domain allegedly named `%s'", domid, old_name); goto x_fail; } if (strcmp(old_name, got_old_name)) { LOG(ERROR, - "domain %"PRIu32" allegedly named " + "Domain %"PRIu32": allegedly named " "`%s' is actually named `%s' - racing ?", domid, old_name, @@ -448,10 +448,10 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid, if (!xs_write(ctx->xsh, trans, name_path, new_name, strlen(new_name))) { LOG(ERROR, - "failed to write new name `%s'" - " for domain %"PRIu32" previously named `%s'", - new_name, + "Domain %"PRIu32": failed to write new name `%s'" + " for domain previously named `%s'", domid, + new_name, old_name); goto x_fail; } @@ -472,7 +472,7 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid, stub_dm_new_name, trans); if (rc) { - LOGE(ERROR, "unable to rename stub-domain"); + LOGE(ERROR, "Domain %"PRIu32": unable to rename stub-domain", domid); goto x_rc; } } @@ -482,16 +482,16 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid, trans = our_trans = 0; if (errno != EAGAIN) { LOG(ERROR, - "failed to commit new name `%s'" - " for domain %"PRIu32" previously named `%s'", - new_name, + "Domain %"PRIu32": failed to commit new name `%s'" + " for domain previously named `%s'", domid, + new_name, old_name); goto x_fail; } LOG(DEBUG, - "need to retry rename transaction" - " for domain %"PRIu32" (name_path=\"%s\", new_name=\"%s\")", + "Domain %"PRIu32": need to retry rename transaction" + " for domain (name_path=\"%s\", new_name=\"%s\")", domid, name_path, new_name); @@ -677,7 +677,7 @@ int libxl_domain_info(libxl_ctx *ctx, libxl_dominfo *info_r, ret = xc_domain_getinfolist(ctx->xch, domid, 1, &xcinfo); if (ret<0) { - LOGE(ERROR, "getting domain info list"); + LOGE(ERROR, "Domain %"PRIu32": getting domain info list", domid); GC_FREE; return ERROR_FAIL; } @@ -841,7 +841,7 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, /* The caller must set this defbool */ if (libxl_defbool_is_default(info->colo)) { - LOG(ERROR, "colo mode must be enabled/disabled"); + LOG(ERROR, "Domain %"PRIu32": colo mode must be enabled/disabled", domid); rc = ERROR_FAIL; goto out; } @@ -855,7 +855,9 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, if (libxl_defbool_val(info->colo) && libxl_defbool_val(info->compression)) { - LOG(ERROR, "cannot use memory checkpoint compression in COLO mode"); + LOG(ERROR, "Domain %"PRIu32": cannot use memory checkpoint " + "compression in COLO mode", + domid); rc = ERROR_FAIL; goto out; } @@ -864,8 +866,9 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, (libxl_defbool_val(info->blackhole) || !libxl_defbool_val(info->netbuf) || !libxl_defbool_val(info->diskbuf))) { - LOG(ERROR, "Unsafe mode must be enabled to replicate to /dev/null," - "disable network buffering and disk replication"); + LOG(ERROR, "Domain %"PRIu32": Unsafe mode must be enabled to replicate to /dev/null," + "disable network buffering and disk replication", + domid); rc = ERROR_FAIL; goto out; } @@ -968,7 +971,7 @@ int libxl_domain_pause(libxl_ctx *ctx, uint32_t domid) GC_INIT(ctx); ret = xc_domain_pause(ctx->xch, domid); if (ret<0) { - LOGE(ERROR, "pausing domain %d", domid); + LOGE(ERROR, "Domain %"PRIu32": pausing domain", domid); GC_FREE; return ERROR_FAIL; } @@ -985,7 +988,7 @@ int libxl_domain_core_dump(libxl_ctx *ctx, uint32_t domid, ret = xc_domain_dumpcore(ctx->xch, domid, filename); if (ret<0) { - LOGE(ERROR, "core dumping domain %d to %s", domid, filename); + LOGE(ERROR, "Domain %"PRIu32": core dumping domain to %s", domid, filename); rc = ERROR_FAIL; goto out; } @@ -1014,7 +1017,7 @@ int libxl_domain_unpause(libxl_ctx *ctx, uint32_t domid) LIBXL_DEVICE_MODEL_VERSION_NONE) { rc = libxl__domain_resume_device_model(gc, domid); if (rc < 0) { - LOG(ERROR, "failed to unpause device model for domain %u:%d", + LOG(ERROR, "Domain %"PRIu32": failed to unpause device model for domain:%d", domid, rc); goto out; } @@ -1022,7 +1025,7 @@ int libxl_domain_unpause(libxl_ctx *ctx, uint32_t domid) } ret = xc_domain_unpause(ctx->xch, domid); if (ret<0) { - LOGE(ERROR, "unpausing domain %d", domid); + LOGE(ERROR, "Domain %"PRIu32": unpausing domain", domid); rc = ERROR_FAIL; } out: @@ -1046,7 +1049,7 @@ int libxl__domain_pvcontrol_available(libxl__gc *gc, uint32_t domid) ret = xc_hvm_param_get(ctx->xch, domid, HVM_PARAM_CALLBACK_IRQ, &pvdriver); if (ret<0) { - LOGE(ERROR, "getting HVM callback IRQ"); + LOGE(ERROR, "Domain %"PRIu32": getting HVM callback IRQ", domid); return ERROR_FAIL; } return !!pvdriver; @@ -1129,7 +1132,7 @@ static void domain_death_occurred(libxl__egc *egc, EGC_GC; libxl_evgen_domain_death *const evg = *evg_upd; - LOG(DEBUG, "%s", why); + LOG(DEBUG, "Domain %"PRIu32": %s", evg->domid, why); libxl_evgen_domain_death *evg_next = LIBXL_TAILQ_NEXT(evg, entry); *evg_upd = evg_next; @@ -1169,8 +1172,8 @@ static void domain_death_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch *w, } gotend = &domaininfos[rc]; - LOG(DEBUG, "[evg=%p:%"PRIu32"] nentries=%d rc=%d %ld..%ld", - evg, evg->domid, nentries, rc, + LOG(DEBUG, "Domain %"PRIu32": [evg=%p] nentries=%d rc=%d %ld..%ld", + evg->domid, evg, nentries, rc, rc>0 ? (long)domaininfos[0].domain : 0, rc>0 ? (long)domaininfos[rc-1].domain : 0); @@ -1180,9 +1183,9 @@ static void domain_death_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch *w, goto all_reported; } - LOG(DEBUG, "[evg=%p:%"PRIu32"]" + LOG(DEBUG, "Domain %"PRIu32": [evg=%p]" " got=domaininfos[%d] got->domain=%ld", - evg, evg->domid, (int)(got - domaininfos), + evg->domid, evg, (int)(got - domaininfos), got < gotend ? (long)got->domain : -1L); if (!rc) { @@ -1208,8 +1211,8 @@ static void domain_death_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch *w, } assert(evg->domid == got->domain); - LOG(DEBUG, " exists shutdown_reported=%d"" dominf.flags=%x", - evg->shutdown_reported, got->flags); + LOG(DEBUG, "Domain %"PRIu32": exists shutdown_reported=%d"" dominf.flags=%x", + evg->domid, evg->shutdown_reported, got->flags); if (got->flags & XEN_DOMINF_dying) { domain_death_occurred(egc, &evg, "dying"); @@ -1459,7 +1462,7 @@ static void domain_destroy_cb(libxl__egc *egc, libxl__domain_destroy_state *dds, STATE_AO_GC(dds->ao); if (rc) - LOG(ERROR, "destruction of domain %u failed", dds->domid); + LOG(ERROR, "Domain %"PRIu32": destruction of domain failed", dds->domid); libxl__ao_complete(egc, ao, rc); } @@ -1508,7 +1511,9 @@ static void stubdom_destroy_callback(libxl__egc *egc, const char *savefile; if (rc) { - LOG(ERROR, "unable to destroy stubdom with domid %u", dis->domid); + LOG(ERROR, "Domain %"PRIu32": unable to destroy stubdom with domid %u", + dds->domain.domid, + dis->domid); dds->rc = rc; } @@ -1516,7 +1521,9 @@ static void stubdom_destroy_callback(libxl__egc *egc, savefile = libxl__device_model_savefile(gc, dis->domid); rc = libxl__remove_file(gc, savefile); if (rc) { - LOG(ERROR, "failed to remove device-model savefile %s", savefile); + LOG(ERROR, "Domain %"PRIu32": failed to remove device-model savefile %s", + dds->domain.domid, + savefile); } destroy_finish_check(egc, dds); @@ -1530,7 +1537,7 @@ static void domain_destroy_callback(libxl__egc *egc, libxl__domain_destroy_state *dds = CONTAINER_OF(dis, *dds, domain); if (rc) { - LOG(ERROR, "unable to destroy guest with domid %u", dis->domid); + LOG(ERROR, "Domain %"PRIu32": unable to destroy guest", dis->domid); dds->rc = rc; } @@ -1571,7 +1578,7 @@ void libxl__destroy_domid(libxl__egc *egc, libxl__destroy_domid_state *dis) case 0: break; case ERROR_DOMAIN_NOTFOUND: - LOG(ERROR, "non-existant domain %d", domid); + LOG(ERROR, "Domain %"PRIu32": non-existant domain", domid); default: goto out; } @@ -1600,14 +1607,14 @@ void libxl__destroy_domid(libxl__egc *egc, libxl__destroy_domid_state *dis) } if (libxl__device_pci_destroy_all(gc, domid) < 0) - LOG(ERROR, "pci shutdown failed for domid %d", domid); + LOG(ERROR, "Domain %"PRIu32": pci shutdown failed", domid); rc = xc_domain_pause(ctx->xch, domid); if (rc < 0) { - LOGEV(ERROR, rc, "xc_domain_pause failed for %d", domid); + LOGEV(ERROR, rc, "Domain %"PRIu32": xc_domain_pause failed", domid); } if (dm_present) { if (libxl__destroy_device_model(gc, domid) < 0) - LOG(ERROR, "libxl__destroy_device_model failed for %d", domid); + LOG(ERROR, "Domain %"PRIu32": libxl__destroy_device_model failed", domid); libxl__qmp_cleanup(gc, domid); } @@ -1643,15 +1650,15 @@ static void devices_destroy_cb(libxl__egc *egc, } if (rc < 0) - LOG(ERROR, "libxl__devices_destroy failed for %d", domid); + LOG(ERROR, "Domain %"PRIu32": libxl__devices_destroy failed", domid); vm_path = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/vm", dom_path)); if (vm_path) if (!xs_rm(ctx->xsh, XBT_NULL, vm_path)) - LOGE(ERROR, "xs_rm failed for %s", vm_path); + LOGE(ERROR, "Domain %"PRIu32": xs_rm failed for %s", domid, vm_path); if (!xs_rm(ctx->xsh, XBT_NULL, dom_path)) - LOGE(ERROR, "xs_rm failed for %s", dom_path); + LOGE(ERROR, "Domain %"PRIu32": xs_rm failed for %s", domid, dom_path); xs_rm(ctx->xsh, XBT_NULL, libxl__xs_libxl_path(gc, domid)); xs_rm(ctx->xsh, XBT_NULL, GCSPRINTF( "/local/domain/%d/hvmloader", domid)); @@ -1703,12 +1710,12 @@ static void devices_destroy_cb(libxl__egc *egc, _exit(errno); } else { LOGE(ERROR, - "xc_domain_destroy failed for %d (with difficult errno value %d)", + "Domain %"PRIu32": xc_domain_destroy failed (with difficult errno value %d)", domid, errno); _exit(-1); } } - LOG(DEBUG, "forked pid %ld for destroy of domain %d", (long)rc, domid); + LOG(DEBUG, "Domain %"PRIu32": forked pid %ld for destroy of domain", domid, (long)rc); return; @@ -1728,7 +1735,7 @@ static void domain_destroy_domid_cb(libxl__egc *egc, if (status) { if (WIFEXITED(status) && WEXITSTATUS(status)<126) { LOGEV(ERROR, WEXITSTATUS(status), - "xc_domain_destroy failed for %"PRIu32"", dis->domid); + "Domain %"PRIu32": xc_domain_destroy failed", dis->domid); } else { libxl_report_child_exitstatus(CTX, XTL_ERROR, "async domain destroy", pid, status); @@ -1821,13 +1828,14 @@ int libxl_console_get_tty(libxl_ctx *ctx, uint32_t domid, int cons_num, rc = libxl__console_tty_path(gc, domid, cons_num, type, &tty_path); if (rc) { - LOG(ERROR, "Failed to get tty path for domain %d\n", domid); + LOG(ERROR, "Domain %"PRIu32": Failed to get tty path\n", domid); goto out; } tty = libxl__xs_read(gc, XBT_NULL, tty_path); if (!tty || tty[0] == '\0') { - LOGE(ERROR,"unable to read console tty path `%s'",tty_path); + LOGE(ERROR,"Domain %"PRIu32": unable to read console tty path `%s'", + domid, tty_path); rc = ERROR_FAIL; goto out; } @@ -1918,7 +1926,7 @@ int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass) GCSPRINTF( "/local/domain/%d/console/vnc-port", domid)); if (!vnc_port) { - LOG(ERROR, "Cannot get vnc-port of domain %d", domid); + LOG(ERROR, "Domain %"PRIu32": Cannot get vnc-port", domid); goto x_fail; } @@ -1945,13 +1953,13 @@ int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass) char tmpname[] = "/tmp/vncautopass.XXXXXX"; autopass_fd = mkstemp(tmpname); if ( autopass_fd < 0 ) { - LOGE(ERROR, "mkstemp %s failed", tmpname); + LOGE(ERROR, "Domain %"PRIu32": mkstemp %s failed", domid, tmpname); goto x_fail; } if ( unlink(tmpname) ) { /* should never happen */ - LOGE(ERROR, "unlink %s failed", tmpname); + LOGE(ERROR, "Domain %"PRIu32": unlink %s failed", domid, tmpname); goto x_fail; } @@ -1960,7 +1968,7 @@ int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass) goto x_fail; if ( lseek(autopass_fd, SEEK_SET, 0) ) { - LOGE(ERROR, "rewind %s (autopass) failed", tmpname); + LOGE(ERROR, "Domain %"PRIu32": rewind %s (autopass) failed", domid, tmpname); goto x_fail; } @@ -2002,7 +2010,8 @@ void device_addrm_aocomplete(libxl__egc *egc, libxl__ao_device *aodev) if (aodev->rc) { if (aodev->dev) { - LOG(ERROR, "unable to %s %s with id %u", + LOG(ERROR, "Domain %"PRIu32": unable to %s %s with id %u", + aodev->dev->domid, libxl__device_action_to_string(aodev->action), libxl__device_kind_to_string(aodev->dev->kind), aodev->dev->devid); @@ -2067,7 +2076,8 @@ int libxl__device_disk_setdefault(libxl__gc *gc, libxl_device_disk *disk, LIBXL_DEVICE_MODEL_VERSION_NONE) { if (!(disk->backend == LIBXL_DISK_BACKEND_QDISK || disk->backend == LIBXL_DISK_BACKEND_UNKNOWN)) { - LOG(ERROR, "Backend for CD devices on HVM guests must be Qdisk"); + LOG(ERROR, "Domain %"PRIu32": Backend for CD devices on HVM guests must be Qdisk", + domid); return ERROR_FAIL; } disk->backend = LIBXL_DISK_BACKEND_QDISK; @@ -2085,8 +2095,8 @@ int libxl__device_from_disk(libxl__gc *gc, uint32_t domid, devid = libxl__device_disk_dev_number(disk->vdev, NULL, NULL); if (devid==-1) { - LOG(ERROR, "Invalid or unsupported"" virtual disk identifier %s", - disk->vdev); + LOG(ERROR, "Domain %"PRIu32": Invalid or unsupported"" virtual disk identifier %s", + domid, disk->vdev); return ERROR_INVAL; } @@ -2104,7 +2114,8 @@ int libxl__device_from_disk(libxl__gc *gc, uint32_t domid, device->backend_kind = LIBXL__DEVICE_KIND_QDISK; break; default: - LOG(ERROR, "unrecognized disk backend type: %d", disk->backend); + LOG(ERROR, "Domain %"PRIu32": unrecognized disk backend type: %d", + domid, disk->backend); return ERROR_INVAL; } @@ -2200,15 +2211,15 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid, GCNEW(device); rc = libxl__device_from_disk(gc, domid, disk, device); if (rc != 0) { - LOG(ERROR, "Invalid or unsupported"" virtual disk identifier %s", - disk->vdev); + LOG(ERROR, "Domain %"PRIu32": Invalid or unsupported"" virtual disk identifier %s", + domid, disk->vdev); goto out; } rc = libxl__device_exists(gc, t, device); if (rc < 0) goto out; if (rc == 1) { /* already exists in xenstore */ - LOG(ERROR, "device already exists in xenstore"); + LOG(ERROR, "Domain %"PRIu32": device already exists in xenstore", domid); aodev->action = LIBXL__DEVICE_ACTION_ADD; /* for error message */ rc = ERROR_DEVICE_EXISTS; goto out; @@ -2234,7 +2245,8 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid, dev = libxl__blktap_devpath(gc, disk->pdev_path, disk->format); if (!dev) { - LOG(ERROR, "failed to get blktap devpath for %p", + LOG(ERROR, "Domain %"PRIu32": failed to get blktap devpath for %p", + domid, disk->pdev_path); rc = ERROR_FAIL; goto out; @@ -2270,8 +2282,8 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid, assert(device->backend_kind == LIBXL__DEVICE_KIND_QDISK); break; default: - LOG(ERROR, "unrecognized disk backend type: %d", - disk->backend); + LOG(ERROR, "Domain %"PRIu32": unrecognized disk backend type: %d", + domid, disk->backend); rc = ERROR_INVAL; goto out; } @@ -2654,26 +2666,30 @@ int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, goto out; } if (type != LIBXL_DOMAIN_TYPE_HVM) { - LOG(ERROR, "cdrom-insert requires an HVM domain"); + LOG(ERROR, "Domain %"PRIu32": cdrom-insert requires an HVM domain", + domid); rc = ERROR_INVAL; goto out; } if (libxl_get_stubdom_id(ctx, domid) != 0) { - LOG(ERROR, "cdrom-insert doesn't work for stub domains"); + LOG(ERROR, "Domain %"PRIu32": cdrom-insert doesn't work for stub domains", + domid); rc = ERROR_INVAL; goto out; } dm_ver = libxl__device_model_version_running(gc, domid); if (dm_ver == -1) { - LOG(ERROR, "cannot determine device model version"); + LOG(ERROR, "Domain %"PRIu32": cannot determine device model version", + domid); rc = ERROR_FAIL; goto out; } if (dm_ver == LIBXL_DEVICE_MODEL_VERSION_NONE) { - LOG(ERROR, "Guests without a device model cannot use cd-insert"); + LOG(ERROR, "Domain %"PRIu32": Guests without a device model cannot use cd-insert", + domid); rc = ERROR_FAIL; goto out; } @@ -2688,7 +2704,7 @@ int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, } } if (i == num) { - LOG(ERROR, "Virtual device not found"); + LOG(ERROR, "Domain %"PRIu32": Virtual device not found", domid); rc = ERROR_FAIL; goto out; } @@ -2748,8 +2764,8 @@ int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, tmp = libxl__xs_read(gc, t, GCSPRINTF("%s/frontend", libxl_path)); if (!tmp) { - LOG(ERROR, "Internal error: %s does not exist", - GCSPRINTF("%s/frontend", libxl_path)); + LOG(ERROR, "Domain %"PRIu32": Internal error: %s does not exist", + domid, GCSPRINTF("%s/frontend", libxl_path)); rc = ERROR_FAIL; goto out; } @@ -2787,8 +2803,8 @@ int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, tmp = libxl__xs_read(gc, t, GCSPRINTF("%s/frontend", libxl_path)); if (!tmp) { - LOG(ERROR, "Internal error: %s does not exist", - GCSPRINTF("%s/frontend", libxl_path)); + LOG(ERROR, "Domain %"PRIu32": Internal error: %s does not exist", + domid, GCSPRINTF("%s/frontend", libxl_path)); rc = ERROR_FAIL; goto out; } @@ -2908,8 +2924,8 @@ char *libxl__device_disk_find_local_path(libxl__gc *gc, int rc; LOG(DEBUG, - "Run from a script; checking for physical-device-path (vdev %s)", - disk->vdev); + "Domain %"PRIu32": Run from a script; checking for physical-device-path (vdev %s)", + guest_domid, disk->vdev); rc = libxl__device_from_disk(gc, guest_domid, disk, &device); if (rc < 0) @@ -2919,13 +2935,13 @@ char *libxl__device_disk_find_local_path(libxl__gc *gc, pdpath = libxl__sprintf(gc, "%s/physical-device-path", be_path); - LOG(DEBUG, "Attempting to read node %s", pdpath); + LOG(DEBUG, "Domain %"PRIu32": Attempting to read node %s", guest_domid, pdpath); path = libxl__xs_read(gc, XBT_NULL, pdpath); if (path) - LOG(DEBUG, "Accessing cooked block device %s", path); + LOG(DEBUG, "Domain %"PRIu32": Accessing cooked block device %s", guest_domid, path); else - LOG(DEBUG, "No physical-device-path, can't access locally."); + LOG(DEBUG, "Domain %"PRIu32": No physical-device-path, can't access locally.", guest_domid); goto out; } @@ -3066,7 +3082,8 @@ static void local_device_detach_cb(libxl__egc *egc, libxl__ao_device *aodev) int rc; if (aodev->rc) { - LOGE(ERROR, "unable to %s %s with id %u", + LOGE(ERROR, "Domain %"PRIu32": unable to %s %s with id %u", + aodev->dev->domid, libxl__device_action_to_string(aodev->action), libxl__device_kind_to_string(aodev->dev->kind), aodev->dev->devid); @@ -3099,7 +3116,7 @@ int libxl__device_console_add(libxl__gc *gc, uint32_t domid, goto out; } if (!console->devid && (console->name || console->path)) { - LOG(ERROR, "Primary console has invalid configuration"); + LOG(ERROR, "Domain %"PRIu32": Primary console has invalid configuration", domid); rc = ERROR_INVAL; goto out; } @@ -3337,7 +3354,7 @@ libxl_device_channel *libxl_device_channel_list(libxl_ctx *ctx, return channels; out_err: - LOG(ERROR, "Unable to list channels"); + LOG(ERROR, "Domain %"PRIu32": Unable to list channels", domid); while (*num) { (*num)--; libxl_device_channel_dispose(&channels[*num]); @@ -3449,7 +3466,7 @@ int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb, rc = libxl__device_vkb_add(gc, domid, vkb); if (rc) { - LOG(ERROR, "unable to add vkb device"); + LOG(ERROR, "Domain %"PRIu32": unable to add vkb device", domid); goto out; } @@ -3549,7 +3566,7 @@ int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb, rc = libxl__device_vfb_add(gc, domid, vfb); if (rc) { - LOG(ERROR, "unable to add vfb device"); + LOG(ERROR, "Domain %"PRIu32": unable to add vfb device", domid); goto out; } @@ -3730,7 +3747,7 @@ static void qdisk_spawn_outcome(libxl__egc *egc, libxl__dm_spawn_state *dmss, { STATE_AO_GC(dmss->spawn.ao); - LOG(DEBUG, "qdisk backend spawn for domain %u %s", dmss->guest_domid, + LOG(DEBUG, "Domain %"PRIu32": qdisk backend spawn %s", dmss->guest_domid, rc ? "failed" : "succeed"); libxl__nested_ao_free(dmss->spawn.ao); @@ -3884,7 +3901,7 @@ static void backend_watch_callback(libxl__egc *egc, libxl__ev_xswatch *watch, dguest->domid = dev->domid; LIBXL_SLIST_INIT(&dguest->devices); LIBXL_SLIST_INSERT_HEAD(&ddomain->guests, dguest, next); - LOG(DEBUG, "added domain %u to the list of active guests", + LOG(DEBUG, "Domain %"PRIu32": added domain to the list of active guests", dguest->domid); } ddev = search_for_device(dguest, dev); @@ -3902,7 +3919,8 @@ static void backend_watch_callback(libxl__egc *egc, libxl__ev_xswatch *watch, ddev = libxl__zalloc(NOGC, sizeof(*ddev)); ddev->dev = dev; LIBXL_SLIST_INSERT_HEAD(&dguest->devices, ddev, next); - LOG(DEBUG, "added device %s to the list of active devices", path); + LOG(DEBUG, "Domain %"PRIu32": added device %s to the list of active devices", + dev->domid, path); rc = add_device(egc, nested_ao, dguest, ddev); if (rc > 0) free_ao = true; @@ -3916,7 +3934,8 @@ static void backend_watch_callback(libxl__egc *egc, libxl__ev_xswatch *watch, */ LIBXL_SLIST_REMOVE(&dguest->devices, ddev, libxl__ddomain_device, next); - LOG(DEBUG, "removed device %s from the list of active devices", path); + LOG(DEBUG, "Domain %"PRIu32": removed device %s from the list of active devices", + dev->domid, path); rc = remove_device(egc, nested_ao, dguest, ddev); if (rc > 0) free_ao = true; @@ -3927,7 +3946,7 @@ static void backend_watch_callback(libxl__egc *egc, libxl__ev_xswatch *watch, if (num_devs == 0) { LIBXL_SLIST_REMOVE(&ddomain->guests, dguest, libxl__ddomain_guest, next); - LOG(DEBUG, "removed domain %u from the list of active guests", + LOG(DEBUG, "Domain %"PRIu32": removed domain from the list of active guests", dguest->domid); /* Clear any leftovers in libxl/ */ libxl__xs_rm_checked(gc, XBT_NULL, @@ -4037,24 +4056,27 @@ int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t domid, uint64_t max_memkb) mem = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/memory/target", dompath)); if (!mem) { - LOGE(ERROR, "cannot get memory info from %s/memory/target", dompath); + LOGE(ERROR, "Domain %"PRIu32": cannot get memory info from %s/memory/target", + domid, dompath); goto out; } memorykb = strtoull(mem, &endptr, 10); if (*endptr != '\0') { - LOGE(ERROR, "invalid memory %s from %s/memory/target\n", mem, dompath); + LOGE(ERROR, "Domain %"PRIu32": invalid memory %s from %s/memory/target\n", + domid, mem, dompath); goto out; } if (max_memkb < memorykb) { LOGE(ERROR, - "memory_static_max must be greater than or or equal to memory_dynamic_max"); + "Domain %"PRIu32": memory_static_max must be greater than or or equal to memory_dynamic_max", + domid); goto out; } rc = xc_domain_setmaxmem(ctx->xch, domid, max_memkb + LIBXL_MAXMEM_CONSTANT); if (rc != 0) { LOGE(ERROR, - "xc_domain_setmaxmem domid=%d memkb=%"PRIu64" failed ""rc=%d\n", + "Domain %"PRIu32": xc_domain_setmaxmem memkb=%"PRIu64" failed ""rc=%d\n", domid, max_memkb + LIBXL_MAXMEM_CONSTANT, rc); goto out; } @@ -4094,7 +4116,7 @@ retry_transaction: if (target) { *target_memkb = strtoull(target, &endptr, 10); if (*endptr != '\0') { - LOGE(ERROR, "invalid memory target %s from %s\n", target, + LOGE(ERROR, "Domain %"PRIu32": invalid memory target %s from %s\n", 0, target, target_path); rc = ERROR_FAIL; goto out; @@ -4104,7 +4126,8 @@ retry_transaction: if (staticmax) { *max_memkb = strtoull(staticmax, &endptr, 10); if (*endptr != '\0') { - LOGE(ERROR, "invalid memory static-max %s from %s\n", staticmax, + LOGE(ERROR, "Domain %"PRIu32": invalid memory static-max %s from %s\n", 0, + staticmax, max_path); rc = ERROR_FAIL; goto out; @@ -4183,16 +4206,16 @@ retry_transaction: if (lrc < 0) { rc = ERROR_FAIL; goto out_no_transaction; } goto retry_transaction; } else if (!target) { - LOGE(ERROR, "cannot get target memory info from %s/memory/target", - dompath); + LOGE(ERROR, "Domain %"PRIu32": cannot get target memory info from %s/memory/target", + domid, dompath); abort_transaction = 1; rc = ERROR_FAIL; goto out; } else { current_target_memkb = strtoull(target, &endptr, 10); if (*endptr != '\0') { - LOGE(ERROR, "invalid memory target %s from %s/memory/target\n", - target, dompath); + LOGE(ERROR, "Domain %"PRIu32": invalid memory target %s from %s/memory/target\n", + domid, target, dompath); abort_transaction = 1; rc = ERROR_FAIL; goto out; @@ -4200,16 +4223,16 @@ retry_transaction: } memmax = libxl__xs_read(gc, t, GCSPRINTF("%s/memory/static-max", dompath)); if (!memmax) { - LOGE(ERROR, "cannot get memory info from %s/memory/static-max", - dompath); + LOGE(ERROR, "Domain %"PRIu32": cannot get memory info from %s/memory/static-max", + domid, dompath); abort_transaction = 1; rc = ERROR_FAIL; goto out; } memorykb = strtoull(memmax, &endptr, 10); if (*endptr != '\0') { - LOGE(ERROR, "invalid max memory %s from %s/memory/static-max\n", - memmax, dompath); + LOGE(ERROR, "Domain %"PRIu32": invalid max memory %s from %s/memory/static-max\n", + domid, memmax, dompath); abort_transaction = 1; rc = ERROR_FAIL; goto out; @@ -4228,8 +4251,8 @@ retry_transaction: new_target_memkb = target_memkb - videoram; if (new_target_memkb > memorykb) { LOG(ERROR, - "memory_dynamic_max must be less than or equal to" - " memory_static_max\n"); + "Domain %"PRIu32": memory_dynamic_max must be less than or equal to" + " memory_static_max\n", domid); abort_transaction = 1; rc = ERROR_INVAL; goto out; @@ -4237,8 +4260,8 @@ retry_transaction: if (!domid && new_target_memkb < LIBXL_MIN_DOM0_MEM) { LOG(ERROR, - "new target %"PRIu64" for dom0 is below the minimum threshold", - new_target_memkb); + "Domain %"PRIu32": new target %"PRIu64" for dom0 is below the minimum threshold", + domid, new_target_memkb); abort_transaction = 1; rc = ERROR_INVAL; goto out; @@ -4250,7 +4273,7 @@ retry_transaction: LIBXL_MAXMEM_CONSTANT); if (r != 0) { LOGE(ERROR, - "xc_domain_setmaxmem domid=%u memkb=%"PRIu64" failed ""rc=%d\n", + "Domain %"PRIu32": xc_domain_setmaxmem memkb=%"PRIu64" failed ""rc=%d\n", domid, memorykb + LIBXL_MAXMEM_CONSTANT, r); @@ -4264,7 +4287,7 @@ retry_transaction: (new_target_memkb + LIBXL_MAXMEM_CONSTANT) / 4, NULL, NULL, NULL); if (r != 0) { LOGE(ERROR, - "xc_domain_set_pod_target domid=%d, memkb=%"PRIu64" failed rc=%d\n", + "Domain %"PRIu32": xc_domain_set_pod_target, memkb=%"PRIu64" failed rc=%d\n", domid, new_target_memkb / 4, r); @@ -4319,25 +4342,26 @@ static int libxl__get_memory_target(libxl__gc *gc, uint32_t domid, if (rc < 0) goto out; } else if (!target) { - LOGE(ERROR, "cannot get target memory info from %s/memory/target", - dompath); + LOGE(ERROR, "Domain %"PRIu32": cannot get target memory info from %s/memory/target", + domid, dompath); goto out; } else if (!static_max) { LOGE(ERROR, - "cannot get target memory info from %s/memory/static-max", - dompath); + "Domain %"PRIu32": cannot get target memory info from %s/memory/static-max", + domid, dompath); goto out; } else { target_memkb = strtoull(target, &endptr, 10); if (*endptr != '\0') { - LOGE(ERROR, "invalid memory target %s from %s/memory/target\n", - target, dompath); + LOGE(ERROR, "Domain %"PRIu32": invalid memory target %s from %s/memory/target\n", + domid, target, dompath); goto out; } max_memkb = strtoull(static_max, &endptr, 10); if (*endptr != '\0') { LOGE(ERROR, - "invalid memory target %s from %s/memory/static-max\n", + "Domain %"PRIu32": invalid memory target %s from %s/memory/static-max\n", + domid, static_max, dompath); goto out; @@ -4831,7 +4855,7 @@ libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, uint32_t domid, xc_vcpuinfo_t vcpuinfo; if (xc_domain_getinfolist(ctx->xch, domid, 1, &domaininfo) != 1) { - LOGE(ERROR, "getting infolist"); + LOGE(ERROR, "Domain %"PRIu32": getting infolist", domid); GC_FREE; return NULL; } @@ -4855,14 +4879,14 @@ libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, uint32_t domid, if (libxl_cpu_bitmap_alloc(ctx, &ptr->cpumap_soft, 0)) goto err; if (xc_vcpu_getinfo(ctx->xch, domid, *nr_vcpus_out, &vcpuinfo) == -1) { - LOGE(ERROR, "getting vcpu info"); + LOGE(ERROR, "Domain %"PRIu32": getting vcpu info", domid); goto err; } if (xc_vcpu_getaffinity(ctx->xch, domid, *nr_vcpus_out, ptr->cpumap.map, ptr->cpumap_soft.map, XEN_VCPUAFFINITY_SOFT|XEN_VCPUAFFINITY_HARD) == -1) { - LOGE(ERROR, "getting vcpu affinity"); + LOGE(ERROR, "Domain %"PRIu32": getting vcpu affinity", domid); goto err; } ptr->vcpuid = *nr_vcpus_out; @@ -4926,7 +4950,7 @@ static int libxl__set_vcpuaffinity(libxl_ctx *ctx, uint32_t domid, cpumap_hard ? hard.map : NULL, cpumap_soft ? soft.map : NULL, flags)) { - LOGE(ERROR, "setting vcpu affinity"); + LOGE(ERROR, "Domain %"PRIu32": setting vcpu affinity", domid); rc = ERROR_FAIL; goto out; } @@ -4938,20 +4962,20 @@ static int libxl__set_vcpuaffinity(libxl_ctx *ctx, uint32_t domid, */ if (cpumap_hard && !libxl_bitmap_equal(cpumap_hard, &hard, 0)) - LOG(DEBUG, "New hard affinity for vcpu %d has unreachable cpus", - vcpuid); + LOG(DEBUG, "Domain %"PRIu32": New hard affinity for vcpu %d has unreachable cpus", + domid, vcpuid); /* * Soft affinity can both be different from what asked and empty. Check * for (and report) both. */ if (cpumap_soft) { if (!libxl_bitmap_equal(cpumap_soft, &soft, 0)) - LOG(DEBUG, "New soft affinity for vcpu %d has unreachable cpus", - vcpuid); + LOG(DEBUG, "Domain %"PRIu32": New soft affinity for vcpu %d has unreachable cpus", + domid, vcpuid); if (libxl_bitmap_is_empty(&soft)) - LOG(WARN, "all cpus in soft affinity of vcpu %d are unreachable." + LOG(WARN, "Domain %"PRIu32": all cpus in soft affinity of vcpu %d are unreachable." " Only hard affinity will be considered for scheduling", - vcpuid); + domid, vcpuid); } rc = 0; @@ -4989,7 +5013,7 @@ int libxl_set_vcpuaffinity_all(libxl_ctx *ctx, uint32_t domid, for (i = 0; i < max_vcpus; i++) { if (libxl_set_vcpuaffinity(ctx, domid, i, cpumap_hard, cpumap_soft)) { - LOG(WARN, "failed to set affinity for %d", i); + LOG(WARN, "Domain %"PRIu32": failed to set affinity for %d", domid, i); rc = ERROR_FAIL; } } @@ -5003,7 +5027,7 @@ int libxl_domain_set_nodeaffinity(libxl_ctx *ctx, uint32_t domid, { GC_INIT(ctx); if (xc_domain_node_setaffinity(ctx->xch, domid, nodemap->map)) { - LOGE(ERROR, "setting node affinity"); + LOGE(ERROR, "Domain %"PRIu32": setting node affinity", domid); GC_FREE; return ERROR_FAIL; } @@ -5016,7 +5040,7 @@ int libxl_domain_get_nodeaffinity(libxl_ctx *ctx, uint32_t domid, { GC_INIT(ctx); if (xc_domain_node_getaffinity(ctx->xch, domid, nodemap->map)) { - LOGE(ERROR, "getting node affinity"); + LOGE(ERROR, "Domain %"PRIu32": getting node affinity", domid); GC_FREE; return ERROR_FAIL; } @@ -5064,7 +5088,7 @@ static int libxl__set_vcpuonline_qmp(libxl__gc *gc, uint32_t domid, libxl_bitmap_set_none(¤t_map); rc = libxl__qmp_query_cpus(gc, domid, ¤t_map); if (rc) { - LOG(ERROR, "failed to query cpus for domain %d", domid); + LOG(ERROR, "Domain %"PRIu32": failed to query cpus", domid); goto out; } @@ -5076,7 +5100,7 @@ static int libxl__set_vcpuonline_qmp(libxl__gc *gc, uint32_t domid, libxl_for_each_set_bit(i, final_map) { rc = libxl__qmp_cpu_add(gc, domid, i); if (rc) { - LOG(ERROR, "failed to add cpu %d to domain %d", i, domid); + LOG(ERROR, "Domain %"PRIu32": failed to add cpu %d", domid, i); goto out; } } @@ -5098,15 +5122,15 @@ int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_bitmap *cpumap) rc = libxl_domain_info(CTX, &info, domid); if (rc < 0) { - LOGE(ERROR, "getting domain info list"); + LOGE(ERROR, "Domain %"PRIu32": getting domain info list", domid); goto out; } maxcpus = libxl_bitmap_count_set(cpumap); if (maxcpus > info.vcpu_max_id + 1) { - LOGE(ERROR, "Requested %d VCPUs, however maxcpus is %d!", - maxcpus, info.vcpu_max_id + 1); + LOGE(ERROR, "Domain %"PRIu32": Requested %d VCPUs, however maxcpus is %d!", + domid, maxcpus, info.vcpu_max_id + 1); rc = ERROR_FAIL; goto out; } @@ -5167,7 +5191,7 @@ static int sched_credit_domain_get(libxl__gc *gc, uint32_t domid, rc = xc_sched_credit_domain_get(CTX->xch, domid, &sdom); if (rc != 0) { - LOGE(ERROR, "getting domain sched credit"); + LOGE(ERROR, "Domain %"PRIu32": getting domain sched credit", domid); return ERROR_FAIL; } @@ -5188,7 +5212,7 @@ static int sched_credit_domain_set(libxl__gc *gc, uint32_t domid, rc = xc_domain_getinfolist(CTX->xch, domid, 1, &domaininfo); if (rc < 0) { - LOGE(ERROR, "getting domain info list"); + LOGE(ERROR, "Domain %"PRIu32": getting domain info list", domid); return ERROR_FAIL; } if (rc != 1 || domaininfo.domain != domid) @@ -5196,14 +5220,14 @@ static int sched_credit_domain_set(libxl__gc *gc, uint32_t domid, rc = xc_sched_credit_domain_get(CTX->xch, domid, &sdom); if (rc != 0) { - LOGE(ERROR, "getting domain sched credit"); + LOGE(ERROR, "Domain %"PRIu32": getting domain sched credit", domid); return ERROR_FAIL; } if (scinfo->weight != LIBXL_DOMAIN_SCHED_PARAM_WEIGHT_DEFAULT) { if (scinfo->weight < 1 || scinfo->weight > 65535) { - LOG(ERROR, "Cpu weight out of range, " - "valid values are within range from 1 to 65535"); + LOG(ERROR, "Domain %"PRIu32": Cpu weight out of range, " + "valid values are within range from 1 to 65535", domid); return ERROR_INVAL; } sdom.weight = scinfo->weight; @@ -5212,9 +5236,9 @@ static int sched_credit_domain_set(libxl__gc *gc, uint32_t domid, if (scinfo->cap != LIBXL_DOMAIN_SCHED_PARAM_CAP_DEFAULT) { if (scinfo->cap < 0 || scinfo->cap > (domaininfo.max_vcpu_id + 1) * 100) { - LOG(ERROR, "Cpu cap out of range, " + LOG(ERROR, "Domain %"PRIu32": Cpu cap out of range, " "valid range is from 0 to %d for specified number of vcpus", - ((domaininfo.max_vcpu_id + 1) * 100)); + domid, ((domaininfo.max_vcpu_id + 1) * 100)); return ERROR_INVAL; } sdom.cap = scinfo->cap; @@ -5222,7 +5246,7 @@ static int sched_credit_domain_set(libxl__gc *gc, uint32_t domid, rc = xc_sched_credit_domain_set(CTX->xch, domid, &sdom); if ( rc < 0 ) { - LOGE(ERROR, "setting domain sched credit"); + LOGE(ERROR, "Domain %"PRIu32": setting domain sched credit", domid); return ERROR_FAIL; } @@ -5302,7 +5326,7 @@ static int sched_credit2_domain_get(libxl__gc *gc, uint32_t domid, rc = xc_sched_credit2_domain_get(CTX->xch, domid, &sdom); if (rc != 0) { - LOGE(ERROR, "getting domain sched credit2"); + LOGE(ERROR, "Domain %"PRIu32": getting domain sched credit2", domid); return ERROR_FAIL; } @@ -5321,14 +5345,14 @@ static int sched_credit2_domain_set(libxl__gc *gc, uint32_t domid, rc = xc_sched_credit2_domain_get(CTX->xch, domid, &sdom); if (rc != 0) { - LOGE(ERROR, "getting domain sched credit2"); + LOGE(ERROR, "Domain %"PRIu32": getting domain sched credit2", domid); return ERROR_FAIL; } if (scinfo->weight != LIBXL_DOMAIN_SCHED_PARAM_WEIGHT_DEFAULT) { if (scinfo->weight < 1 || scinfo->weight > 65535) { - LOG(ERROR, "Cpu weight out of range, " - "valid values are within range from 1 to 65535"); + LOG(ERROR, "Domain %"PRIu32": Cpu weight out of range, " + "valid values are within range from 1 to 65535", domid); return ERROR_INVAL; } sdom.weight = scinfo->weight; @@ -5336,7 +5360,7 @@ static int sched_credit2_domain_set(libxl__gc *gc, uint32_t domid, rc = xc_sched_credit2_domain_set(CTX->xch, domid, &sdom); if ( rc < 0 ) { - LOGE(ERROR, "setting domain sched credit2"); + LOGE(ERROR, "Domain %"PRIu32": setting domain sched credit2", domid); return ERROR_FAIL; } @@ -5381,7 +5405,7 @@ static int sched_rtds_vcpu_get(libxl__gc *gc, uint32_t domid, r = xc_domain_getinfo(CTX->xch, domid, 1, &info); if (r < 0) { - LOGE(ERROR, "getting domain info"); + LOGE(ERROR, "Domain %"PRIu32": getting domain info", domid); rc = ERROR_FAIL; goto out; } @@ -5395,9 +5419,9 @@ static int sched_rtds_vcpu_get(libxl__gc *gc, uint32_t domid, for (i = 0; i < num_vcpus; i++) { if (scinfo->vcpus[i].vcpuid < 0 || scinfo->vcpus[i].vcpuid > info.max_vcpu_id) { - LOG(ERROR, "VCPU index is out of range, " + LOG(ERROR, "Domain %"PRIu32": VCPU index is out of range, " "valid values are within range from 0 to %d", - info.max_vcpu_id); + domid, info.max_vcpu_id); rc = ERROR_INVAL; goto out; } @@ -5407,7 +5431,7 @@ static int sched_rtds_vcpu_get(libxl__gc *gc, uint32_t domid, r = xc_sched_rtds_vcpu_get(CTX->xch, domid, vcpus, num_vcpus); if (r != 0) { - LOGE(ERROR, "getting vcpu sched rtds"); + LOGE(ERROR, "Domain %"PRIu32": getting vcpu sched rtds", domid); rc = ERROR_FAIL; goto out; } @@ -5433,7 +5457,7 @@ static int sched_rtds_vcpu_get_all(libxl__gc *gc, uint32_t domid, r = xc_domain_getinfo(CTX->xch, domid, 1, &info); if (r < 0) { - LOGE(ERROR, "getting domain info"); + LOGE(ERROR, "Domain %"PRIu32": getting domain info", domid); rc = ERROR_FAIL; goto out; } @@ -5450,7 +5474,7 @@ static int sched_rtds_vcpu_get_all(libxl__gc *gc, uint32_t domid, r = xc_sched_rtds_vcpu_get(CTX->xch, domid, vcpus, num_vcpus); if (r != 0) { - LOGE(ERROR, "getting vcpu sched rtds"); + LOGE(ERROR, "Domain %"PRIu32": getting vcpu sched rtds", domid); rc = ERROR_FAIL; goto out; } @@ -5481,7 +5505,7 @@ static int sched_rtds_vcpu_set(libxl__gc *gc, uint32_t domid, r = xc_domain_getinfo(CTX->xch, domid, 1, &info); if (r < 0) { - LOGE(ERROR, "getting domain info"); + LOGE(ERROR, "Domain %"PRIu32": getting domain info", domid); rc = ERROR_FAIL; goto out; } @@ -5494,8 +5518,8 @@ static int sched_rtds_vcpu_set(libxl__gc *gc, uint32_t domid, for (i = 0; i < scinfo->num_vcpus; i++) { if (scinfo->vcpus[i].vcpuid < 0 || scinfo->vcpus[i].vcpuid > max_vcpuid) { - LOG(ERROR, "Invalid VCPU %d: valid range is [0, %d]", - scinfo->vcpus[i].vcpuid, max_vcpuid); + LOG(ERROR, "Domain %"PRIu32": Invalid VCPU %d: valid range is [0, %d]", + domid, scinfo->vcpus[i].vcpuid, max_vcpuid); rc = ERROR_INVAL; goto out; } @@ -5516,7 +5540,7 @@ static int sched_rtds_vcpu_set(libxl__gc *gc, uint32_t domid, r = xc_sched_rtds_vcpu_set(CTX->xch, domid, vcpus, scinfo->num_vcpus); if (r != 0) { - LOGE(ERROR, "setting vcpu sched rtds"); + LOGE(ERROR, "Domain %"PRIu32": setting vcpu sched rtds", domid); rc = ERROR_FAIL; goto out; } @@ -5538,7 +5562,7 @@ static int sched_rtds_vcpu_set_all(libxl__gc *gc, uint32_t domid, r = xc_domain_getinfo(CTX->xch, domid, 1, &info); if (r < 0) { - LOGE(ERROR, "getting domain info"); + LOGE(ERROR, "Domain %"PRIu32": getting domain info", domid); rc = ERROR_FAIL; goto out; } @@ -5564,7 +5588,7 @@ static int sched_rtds_vcpu_set_all(libxl__gc *gc, uint32_t domid, r = xc_sched_rtds_vcpu_set(CTX->xch, domid, vcpus, num_vcpus); if (r != 0) { - LOGE(ERROR, "setting vcpu sched rtds"); + LOGE(ERROR, "Domain %"PRIu32": setting vcpu sched rtds", domid); rc = ERROR_FAIL; goto out; } @@ -5581,7 +5605,7 @@ static int sched_rtds_domain_get(libxl__gc *gc, uint32_t domid, rc = xc_sched_rtds_domain_get(CTX->xch, domid, &sdom); if (rc != 0) { - LOGE(ERROR, "getting domain sched rtds"); + LOGE(ERROR, "Domain %"PRIu32": getting domain sched rtds", domid); return ERROR_FAIL; } @@ -5602,7 +5626,7 @@ static int sched_rtds_domain_set(libxl__gc *gc, uint32_t domid, rc = xc_sched_rtds_domain_get(CTX->xch, domid, &sdom); if (rc != 0) { - LOGE(ERROR, "getting domain sched rtds"); + LOGE(ERROR, "Domain %"PRIu32": getting domain sched rtds", domid); return ERROR_FAIL; } if (scinfo->period != LIBXL_DOMAIN_SCHED_PARAM_PERIOD_DEFAULT) @@ -5614,7 +5638,7 @@ static int sched_rtds_domain_set(libxl__gc *gc, uint32_t domid, rc = xc_sched_rtds_domain_set(CTX->xch, domid, &sdom); if (rc < 0) { - LOGE(ERROR, "setting domain sched rtds"); + LOGE(ERROR, "Domain %"PRIu32": setting domain sched rtds", domid); return ERROR_FAIL; } @@ -5633,7 +5657,7 @@ int libxl_domain_sched_params_set(libxl_ctx *ctx, uint32_t domid, switch (sched) { case LIBXL_SCHEDULER_SEDF: - LOG(ERROR, "SEDF scheduler no longer available"); + LOG(ERROR, "Domain %"PRIu32": SEDF scheduler no longer available", domid); ret=ERROR_FEATURE_REMOVED; break; case LIBXL_SCHEDULER_CREDIT: @@ -5649,7 +5673,7 @@ int libxl_domain_sched_params_set(libxl_ctx *ctx, uint32_t domid, ret=sched_rtds_domain_set(gc, domid, scinfo); break; default: - LOG(ERROR, "Unknown scheduler"); + LOG(ERROR, "Domain %"PRIu32": Unknown scheduler", domid); ret=ERROR_INVAL; break; } @@ -5670,20 +5694,21 @@ int libxl_vcpu_sched_params_set(libxl_ctx *ctx, uint32_t domid, switch (sched) { case LIBXL_SCHEDULER_SEDF: - LOG(ERROR, "SEDF scheduler no longer available"); + LOG(ERROR, "Domain %"PRIu32": SEDF scheduler no longer available", domid); rc = ERROR_FEATURE_REMOVED; break; case LIBXL_SCHEDULER_CREDIT: case LIBXL_SCHEDULER_CREDIT2: case LIBXL_SCHEDULER_ARINC653: - LOG(ERROR, "per-VCPU parameter setting not supported for this scheduler"); + LOG(ERROR, "Domain %"PRIu32": per-VCPU parameter setting not supported for this scheduler", + domid); rc = ERROR_INVAL; break; case LIBXL_SCHEDULER_RTDS: rc = sched_rtds_vcpu_set(gc, domid, scinfo); break; default: - LOG(ERROR, "Unknown scheduler"); + LOG(ERROR, "Domain %"PRIu32": Unknown scheduler", domid); rc = ERROR_INVAL; break; } @@ -5704,20 +5729,21 @@ int libxl_vcpu_sched_params_set_all(libxl_ctx *ctx, uint32_t domid, switch (sched) { case LIBXL_SCHEDULER_SEDF: - LOG(ERROR, "SEDF scheduler no longer available"); + LOG(ERROR, "Domain %"PRIu32": SEDF scheduler no longer available", domid); rc = ERROR_FEATURE_REMOVED; break; case LIBXL_SCHEDULER_CREDIT: case LIBXL_SCHEDULER_CREDIT2: case LIBXL_SCHEDULER_ARINC653: - LOG(ERROR, "per-VCPU parameter setting not supported for this scheduler"); + LOG(ERROR, "Domain %"PRIu32": per-VCPU parameter setting not supported for this scheduler", + domid); rc = ERROR_INVAL; break; case LIBXL_SCHEDULER_RTDS: rc = sched_rtds_vcpu_set_all(gc, domid, scinfo); break; default: - LOG(ERROR, "Unknown scheduler"); + LOG(ERROR, "Domain %"PRIu32": Unknown scheduler", domid); rc = ERROR_INVAL; break; } @@ -5738,7 +5764,7 @@ int libxl_domain_sched_params_get(libxl_ctx *ctx, uint32_t domid, switch (scinfo->sched) { case LIBXL_SCHEDULER_SEDF: - LOG(ERROR, "SEDF scheduler no longer available"); + LOG(ERROR, "Domain %"PRIu32": SEDF scheduler no longer available", domid); ret=ERROR_FEATURE_REMOVED; break; case LIBXL_SCHEDULER_CREDIT: @@ -5751,7 +5777,7 @@ int libxl_domain_sched_params_get(libxl_ctx *ctx, uint32_t domid, ret=sched_rtds_domain_get(gc, domid, scinfo); break; default: - LOG(ERROR, "Unknown scheduler"); + LOG(ERROR, "Domain %"PRIu32": Unknown scheduler", domid); ret=ERROR_INVAL; break; } @@ -5770,20 +5796,21 @@ int libxl_vcpu_sched_params_get(libxl_ctx *ctx, uint32_t domid, switch (scinfo->sched) { case LIBXL_SCHEDULER_SEDF: - LOG(ERROR, "SEDF scheduler is no longer available"); + LOG(ERROR, "Domain %"PRIu32": SEDF scheduler is no longer available", domid); rc = ERROR_FEATURE_REMOVED; break; case LIBXL_SCHEDULER_CREDIT: case LIBXL_SCHEDULER_CREDIT2: case LIBXL_SCHEDULER_ARINC653: - LOG(ERROR, "per-VCPU parameter getting not supported for this scheduler"); + LOG(ERROR, "Domain %"PRIu32": per-VCPU parameter getting not supported for this scheduler", + domid); rc = ERROR_INVAL; break; case LIBXL_SCHEDULER_RTDS: rc = sched_rtds_vcpu_get(gc, domid, scinfo); break; default: - LOG(ERROR, "Unknown scheduler"); + LOG(ERROR, "Domain %"PRIu32": Unknown scheduler", domid); rc = ERROR_INVAL; break; } @@ -5802,20 +5829,20 @@ int libxl_vcpu_sched_params_get_all(libxl_ctx *ctx, uint32_t domid, switch (scinfo->sched) { case LIBXL_SCHEDULER_SEDF: - LOG(ERROR, "SEDF scheduler is no longer available"); + LOG(ERROR, "Domain %"PRIu32": SEDF scheduler is no longer available", domid); rc = ERROR_FEATURE_REMOVED; break; case LIBXL_SCHEDULER_CREDIT: case LIBXL_SCHEDULER_CREDIT2: case LIBXL_SCHEDULER_ARINC653: - LOG(ERROR, "per-VCPU parameter getting not supported for this scheduler"); + LOG(ERROR, "Domain %"PRIu32": per-VCPU parameter getting not supported for this scheduler", domid); rc = ERROR_INVAL; break; case LIBXL_SCHEDULER_RTDS: rc = sched_rtds_vcpu_get_all(gc, domid, scinfo); break; default: - LOG(ERROR, "Unknown scheduler"); + LOG(ERROR, "Domain %"PRIu32": Unknown scheduler", domid); rc = ERROR_INVAL; break; } @@ -5887,8 +5914,8 @@ int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid, } if (rc != 0) { - LOGE(ERROR, "Send trigger '%s' failed", - libxl_trigger_to_string(trigger)); + LOGE(ERROR, "Domain %"PRIu32": Send trigger '%s' failed", + domid, libxl_trigger_to_string(trigger)); rc = ERROR_FAIL; } @@ -5996,7 +6023,7 @@ uint32_t libxl_vm_get_start_time(libxl_ctx *ctx, uint32_t domid) start_time = libxl__xs_read( gc, XBT_NULL, GCSPRINTF("%s/start_time", vm_path)); if (start_time == NULL) { - LOGEV(ERROR, -1, "Can't get start time of domain '%d'", domid); + LOGEV(ERROR, -1, "Domain %"PRIu32": Can't get start time of domain", domid); ret = -1; }else{ ret = strtoul(start_time, NULL, 10); @@ -6014,7 +6041,7 @@ char *libxl_tmem_list(libxl_ctx *ctx, uint32_t domid, int use_long) r = xc_tmem_control(ctx->xch, -1, XEN_SYSCTL_TMEM_OP_LIST, domid, 32768, use_long, _buf); if (r < 0) { - LOGE(ERROR, "Can not get tmem list"); + LOGE(ERROR, "Domain %"PRIu32": Can not get tmem list", domid); GC_FREE; return NULL; } @@ -6031,7 +6058,7 @@ int libxl_tmem_freeze(libxl_ctx *ctx, uint32_t domid) r = xc_tmem_control(ctx->xch, -1, XEN_SYSCTL_TMEM_OP_FREEZE, domid, 0, 0, NULL); if (r < 0) { - LOGE(ERROR, "Can not freeze tmem pools"); + LOGE(ERROR, "Domain %"PRIu32": Can not freeze tmem pools", domid); rc = ERROR_FAIL; goto out; } @@ -6050,7 +6077,7 @@ int libxl_tmem_thaw(libxl_ctx *ctx, uint32_t domid) r = xc_tmem_control(ctx->xch, -1, XEN_SYSCTL_TMEM_OP_THAW, domid, 0, 0, NULL); if (r < 0) { - LOGE(ERROR, "Can not thaw tmem pools"); + LOGE(ERROR, "Domain %"PRIu32": Can not thaw tmem pools", domid); rc = ERROR_FAIL; goto out; } @@ -6080,13 +6107,14 @@ int libxl_tmem_set(libxl_ctx *ctx, uint32_t domid, char* name, uint32_t set) GC_INIT(ctx); if (subop == -1) { - LOGEV(ERROR, -1, "Invalid set, valid sets are "); + LOGEV(ERROR, -1, "Domain %"PRIu32": Invalid set, valid sets are ", + domid); rc = ERROR_INVAL; goto out; } r = xc_tmem_control(ctx->xch, -1, subop, domid, set, 0, NULL); if (r < 0) { - LOGE(ERROR, "Can not set tmem %s", name); + LOGE(ERROR, "Domain %"PRIu32": Can not set tmem %s", domid, name); rc = ERROR_FAIL; goto out; } @@ -6105,7 +6133,7 @@ int libxl_tmem_shared_auth(libxl_ctx *ctx, uint32_t domid, r = xc_tmem_auth(ctx->xch, domid, uuid, auth); if (r < 0) { - LOGE(ERROR, "Can not set tmem shared auth"); + LOGE(ERROR, "Domain %"PRIu32": Can not set tmem shared auth", domid); rc = ERROR_FAIL; goto out; } @@ -6450,7 +6478,8 @@ int libxl_cpupool_movedomain(libxl_ctx *ctx, uint32_t poolid, uint32_t domid) rc = xc_cpupool_movedomain(ctx->xch, poolid, domid); if (rc) { - LOGEV(ERROR, rc, "Error moving domain to cpupool"); + LOGEV(ERROR, rc, "Domain %"PRIu32": Error moving domain to cpupool", + domid); GC_FREE; return ERROR_FAIL; } @@ -6578,7 +6607,7 @@ static int libxl__update_avail_vcpus_qmp(libxl__gc *gc, uint32_t domid, rc = libxl__qmp_query_cpus(gc, domid, map); if (rc) { - LOG(ERROR, "fail to get number of cpus for domain %d", domid); + LOG(ERROR, "Domain %"PRIu32": fail to get number of cpus", domid); goto out; } @@ -6632,7 +6661,7 @@ int libxl_retrieve_domain_configuration(libxl_ctx *ctx, uint32_t domid, rc = libxl__get_domain_configuration(gc, domid, d_config); if (rc) { - LOG(ERROR, "fail to get domain configuration for domain %d", domid); + LOG(ERROR, "Domain %"PRIu32": fail to get domain configuration", domid); rc = ERROR_FAIL; goto out; } @@ -6642,7 +6671,7 @@ int libxl_retrieve_domain_configuration(libxl_ctx *ctx, uint32_t domid, char *domname; domname = libxl_domid_to_name(ctx, domid); if (!domname) { - LOG(ERROR, "fail to get domain name for domain %d", domid); + LOG(ERROR, "Domain %"PRIu32": fail to get domain name", domid); goto out; } free(d_config->c_info.name); @@ -6655,7 +6684,7 @@ int libxl_retrieve_domain_configuration(libxl_ctx *ctx, uint32_t domid, libxl_dominfo_init(&info); rc = libxl_domain_info(ctx, &info, domid); if (rc) { - LOG(ERROR, "fail to get domain info for domain %d", domid); + LOG(ERROR, "Domain %"PRIu32": fail to get domain info", domid); libxl_dominfo_dispose(&info); goto out; } @@ -6701,7 +6730,7 @@ int libxl_retrieve_domain_configuration(libxl_ctx *ctx, uint32_t domid, } if (rc) { - LOG(ERROR, "fail to update available cpu map for domain %d", domid); + LOG(ERROR, "Domain %"PRIu32": fail to update available cpu map", domid); goto out; } } @@ -6723,7 +6752,7 @@ int libxl_retrieve_domain_configuration(libxl_ctx *ctx, uint32_t domid, /* "target" */ rc = libxl__get_memory_target(gc, domid, &target_memkb, &max_memkb); if (rc) { - LOG(ERROR, "fail to get memory target for domain %d", domid); + LOG(ERROR, "Domain %"PRIu32": fail to get memory target", domid); goto out; } @@ -6774,8 +6803,8 @@ int libxl_retrieve_domain_configuration(libxl_ctx *ctx, uint32_t domid, num_dev = libxl__device_type_get_num(dt, d_config); p = dt->list(CTX, domid, &num); if (p == NULL) { - LOG(DEBUG, "no %s from xenstore for domain %d", - dt->type, domid); + LOG(DEBUG, "Domain %"PRIu32": no %s from xenstore", + domid, dt->type); } devs = libxl__device_type_get_ptr(dt, d_config); @@ -6793,7 +6822,8 @@ int libxl_retrieve_domain_configuration(libxl_ctx *ctx, uint32_t domid, dt->merge(ctx, p + dt->dev_elem_size * j, q); } else { /* not found in xenstore */ LOG(WARN, - "Device present in JSON but not in xenstore, ignored"); + "Domain %"PRIu32": Device present in JSON but not in xenstore, ignored", + domid); dt->dispose(q); -- 2.10.0