qemuMonitorDiscardPendingData(vm);
- VIR_DEBUG("Send '%s'", cmd);
+ VIR_DEBUG("cmd='%s' extraPrompt='%s'", cmd, NULLSTR(extraPrompt));
if (qemuMonitorSend(vm, cmd, scm_fd) < 0)
return -1;
(foundPrompt = strstr(buf, extraPrompt)) != NULL) {
char *promptEnd;
+ DEBUG("prompt='%s' handler=%p", extraPrompt, extraHandler);
if (extraHandler(vm, buf, foundPrompt, handlerData) < 0)
return -1;
/* Discard output so far, necessary to detect whether
}
}
*reply = buf;
+ DEBUG("reply='%s'", buf);
return 0;
error:
const virDomainObjPtr vm) {
char *reply;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s", vm, vm->pid, vm->def->id, vm->def->name);
+
if (qemuMonitorCommandWithHandler(vm, "cont", ") is encrypted.",
qemuMonitorSendVolumePassphrase, conn,
-1, &reply) < 0)
return -1;
- qemudDebug ("%s: cont reply: %s", vm->def->name, info);
+
VIR_FREE(reply);
return 0;
}
qemuMonitorStopCPUs(const virDomainObjPtr vm) {
char *info;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s", vm, vm->pid, vm->def->id, vm->def->name);
+
if (qemuMonitorCommand(vm, "stop", &info) < 0) {
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
"%s", _("cannot stop CPU execution"));
int qemuMonitorSystemPowerdown(const virDomainObjPtr vm) {
char *info;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s", vm, vm->pid, vm->def->id, vm->def->name);
+
if (qemuMonitorCommand(vm, "system_powerdown", &info) < 0) {
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
"%s", _("system shutdown operation failed"));
pid_t *cpupids = NULL;
size_t ncpupids = 0;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s", vm, vm->pid, vm->def->id, vm->def->name);
+
if (qemuMonitorCommand(vm, "info cpus", &qemucpus) < 0) {
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot run monitor command to fetch CPU thread info"));
if (VIR_REALLOC_N(cpupids, ncpupids+1) < 0)
goto error;
+ DEBUG("vcpu=%d pid=%d", vcpu, tid);
cpupids[ncpupids++] = tid;
lastVcpu = vcpu;
int ret = -1;
char *offset;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s", vm, vm->pid, vm->def->id, vm->def->name);
+
if (qemuMonitorCommand(vm, "info balloon", &reply) < 0) {
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
"%s", _("could not query memory balloon allocation"));
return -1;
}
- DEBUG ("%s: balloon reply: '%s'", vm->def->name, reply);
if ((offset = strstr(reply, BALLOON_PREFIX)) != NULL) {
unsigned int memMB;
char *end;
const char *p, *eol;
int devnamelen = strlen(devname);
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s dev=%s",
+ vm, vm->pid, vm->def->id, vm->def->name, devname);
+
if (qemuMonitorCommand (vm, "info blockstats", &info) < 0) {
qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
"%s", _("'info blockstats' command failed"));
goto cleanup;
}
- DEBUG ("%s: info blockstats reply: %s", vm->def->name, info);
/* If the command isn't supported then qemu prints the supported
* info commands, so the output starts "info ". Since this is
const char *password)
{
char *info = NULL;
+
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s", vm, vm->pid, vm->def->id, vm->def->name);
+
if (qemuMonitorCommandExtra(vm, "change vnc password",
password,
QEMU_PASSWD_PROMPT,
char *reply = NULL;
int ret = -1;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s newmem=%lu",
+ vm, vm->pid, vm->def->id, vm->def->name, newmem);
+
/*
* 'newmem' is in KB, QEMU monitor works in MB, and we all wish
* we just worked in bytes with unsigned long long everywhere.
/* If the command failed qemu prints: 'unknown command'
* No message is printed on success it seems */
- DEBUG ("%s: balloon reply: %s", vm->def->name, reply);
if (strstr(reply, "\nunknown command:")) {
/* Don't set error - it is expected memory balloon fails on many qemu */
ret = 0;
char *reply = NULL;
int ret = -1;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s devname=%s",
+ vm, vm->pid, vm->def->id, vm->def->name, devname);
+
if (virAsprintf(&cmd, "eject %s", devname) < 0) {
virReportOOMError(NULL);
goto cleanup;
/* If the command failed qemu prints:
* device not found, device is locked ...
* No message is printed on success it seems */
- DEBUG ("%s: ejectable media change reply: %s", vm->def->name, reply);
if (strstr(reply, "\ndevice ")) {
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
_("could not eject media on %s: %s"), devname, reply);
char *safepath = NULL;
int ret = -1;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s devname=%s newmedia=%s",
+ vm, vm->pid, vm->def->id, vm->def->name, devname, newmedia);
+
if (!(safepath = qemuMonitorEscapeArg(newmedia))) {
virReportOOMError(NULL);
goto cleanup;
/* If the command failed qemu prints:
* device not found, device is locked ...
* No message is printed on success it seems */
- DEBUG ("%s: ejectable media change reply: %s", vm->def->name, reply);
if (strstr(reply, "\ndevice ")) {
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
_("could not eject media on %s: %s"), devname, reply);
size_t length,
const char *path)
{
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s offset=%llu length=%zu path=%s",
+ vm, vm->pid, vm->def->id, vm->def->name, offset, length, path);
+
return qemuMonitorSaveMemory(vm, "memsave", offset, length, path);
}
size_t length,
const char *path)
{
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s offset=%llu length=%zu path=%s",
+ vm, vm->pid, vm->def->id, vm->def->name, offset, length, path);
+
return qemuMonitorSaveMemory(vm, "pmemsave", offset, length, path);
}
char *info = NULL;
int ret = -1;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s bandwidth=%lu",
+ vm, vm->pid, vm->def->id, vm->def->name, bandwidth);
+
if (virAsprintf(&cmd, "migrate_set_speed %lum", bandwidth) < 0) {
virReportOOMError(NULL);
goto cleanup;
goto cleanup;
}
- DEBUG("%s: migrate_set_speed reply: %s", vm->def->name, info);
ret = 0;
cleanup:
char *end;
int ret = -1;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s", vm, vm->pid, vm->def->id, vm->def->name);
+
*status = QEMU_MONITOR_MIGRATION_STATUS_INACTIVE;
*transferred = 0;
*remaining = 0;
goto cleanup;
}
- DEBUG ("%s: migrate reply: %s", vm->def->name, info);
-
/* Now check for "fail" in the output string */
if (strstr(info, "fail") != NULL) {
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
char *uri = NULL;
int ret;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s hostname=%s port=%d",
+ vm, vm->pid, vm->def->id, vm->def->name, hostname, port);
+
if (virAsprintf(&uri, "tcp:%s:%d", hostname, port) < 0) {
virReportOOMError(NULL);
return -1;
int ret = -1;
char *safe_target = NULL;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s argv=%p target=%s",
+ vm, vm->pid, vm->def->id, vm->def->name, argv, target);
+
argstr = virArgvToString(argv);
if (!argstr) {
virReportOOMError(NULL);
int ret = -1;
char *info = NULL;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s path=%s",
+ vm, vm->pid, vm->def->id, vm->def->name, path);
+
safepath = qemuMonitorEscapeArg(path);
if (!safepath) {
virReportOOMError(NULL);
goto cleanup;
}
- DEBUG ("%s: usb_add reply: %s", vm->def->name, info);
/* If the command failed qemu prints:
* Could not add ... */
if (strstr(info, "Could not add ")) {
goto cleanup;
}
- DEBUG ("%s: attach_usb reply: %s", vm->def->name, reply);
/* If the command failed qemu prints:
* Could not add ... */
if (strstr(reply, "Could not add ")) {
int ret;
char *addr;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s bus=%d dev=%d",
+ vm, vm->pid, vm->def->id, vm->def->name, bus, dev);
+
if (virAsprintf(&addr, "host:%.3d.%.3d", bus, dev) < 0) {
virReportOOMError(NULL);
return -1;
int ret;
char *addr;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s vendor=%d product=%d",
+ vm, vm->pid, vm->def->id, vm->def->name, vendor, product);
+
if (virAsprintf(&addr, "host:%.4x:%.4x", vendor, product) < 0) {
virReportOOMError(NULL);
return -1;
char *reply = NULL;
int ret = -1;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s domain=%d bus=%d slot=%d function=%d",
+ vm, vm->pid, vm->def->id, vm->def->name,
+ hostDomain, hostBus, hostSlot, hostFunction);
+
*guestDomain = *guestBus = *guestSlot = 0;
/* XXX hostDomain */
int tryOldSyntax = 0;
int ret = -1;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s path=%s bus=%s",
+ vm, vm->pid, vm->def->id, vm->def->name, path, bus);
+
safe_path = qemuMonitorEscapeArg(path);
if (!safe_path) {
virReportOOMError(NULL);
char *reply = NULL;
int ret = -1;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s nicstr=%s",
+ vm, vm->pid, vm->def->id, vm->def->name, nicstr);
+
if (virAsprintf(&cmd, "pci_add pci_addr=auto nic %s", nicstr) < 0) {
virReportOOMError(NULL);
return -1;
int tryOldSyntax = 0;
int ret = -1;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s domain=%d bus=%d slot=%d",
+ vm, vm->pid, vm->def->id, vm->def->name, guestDomain, guestBus, guestSlot);
+
try_command:
if (tryOldSyntax) {
if (virAsprintf(&cmd, "pci_del 0 %.2x", guestSlot) < 0) {
goto cleanup;
}
- DEBUG ("%s: pci_del reply: %s",vm->def->name, reply);
-
/* Syntax changed when KVM merged PCI hotplug upstream to QEMU,
* so check for an error message from old KVM indicating the
* need to try the old syntax */
char *reply = NULL;
int ret = -1;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s fdname=%s fd=%d",
+ vm, vm->pid, vm->def->id, vm->def->name, fdname, fd);
+
if (virAsprintf(&cmd, "getfd %s", fdname) < 0) {
virReportOOMError(NULL);
return -1;
goto cleanup;
}
- DEBUG("%s: getfd reply: %s", vm->def->name, reply);
-
/* If the command isn't supported then qemu prints:
* unknown command: getfd" */
if (strstr(reply, "unknown command:")) {
char *reply = NULL;
int ret = -1;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s fdname=%s",
+ vm, vm->pid, vm->def->id, vm->def->name, fdname);
+
if (virAsprintf(&cmd, "closefd %s", fdname) < 0) {
virReportOOMError(NULL);
return -1;
goto cleanup;
}
- DEBUG("%s: closefd reply: %s", vm->def->name, reply);
-
/* If the command isn't supported then qemu prints:
* unknown command: getfd" */
if (strstr(reply, "unknown command:")) {
char *reply = NULL;
int ret = -1;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s netstr=%s",
+ vm, vm->pid, vm->def->id, vm->def->name, netstr);
+
if (virAsprintf(&cmd, "host_net_add %s", netstr) < 0) {
virReportOOMError(NULL);
return -1;
goto cleanup;
}
- DEBUG("%s: host_net_add reply: %s", vm->def->name, reply);
-
/* XXX error messages here ? */
ret = 0;
char *reply = NULL;
int ret = -1;
+ DEBUG("vm=%p, pid=%d, id=%d, name=%s netname=%s",
+ vm, vm->pid, vm->def->id, vm->def->name, netname);
+
if (virAsprintf(&cmd, "host_net_remove %d %s", vlan, netname) < 0) {
virReportOOMError(NULL);
return -1;
goto cleanup;
}
- DEBUG("%s: host_net_remove reply: %s", vm->def->name, reply);
-
/* XXX error messages here ? */
ret = 0;