mirror of https://gitee.com/openkylin/libvirt.git
Remove passing of virConnectPtr throughout QEMU driver
This commit is contained in:
parent
d47ef780f2
commit
caa805ea64
File diff suppressed because it is too large
Load Diff
|
@ -157,9 +157,9 @@ typedef qemuDomainPCIAddressSet *qemuDomainPCIAddressSetPtr;
|
|||
/* Config type for XML import/export conversions */
|
||||
#define QEMU_CONFIG_FORMAT_ARGV "qemu-argv"
|
||||
|
||||
#define qemudReportError(conn, dom, net, code, fmt...) \
|
||||
virReportErrorHelper(conn, VIR_FROM_QEMU, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, fmt)
|
||||
#define qemuReportError(code, fmt...) \
|
||||
virReportErrorHelper(NULL, VIR_FROM_QEMU, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, fmt)
|
||||
|
||||
|
||||
int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
|
@ -191,15 +191,13 @@ int qemudBuildCommandLine (virConnectPtr conn,
|
|||
const char *migrateFrom);
|
||||
|
||||
/* With vlan == -1, use netdev syntax, else old hostnet */
|
||||
char * qemuBuildHostNetStr(virConnectPtr conn,
|
||||
virDomainNetDefPtr net,
|
||||
char * qemuBuildHostNetStr(virDomainNetDefPtr net,
|
||||
char type_sep,
|
||||
int vlan,
|
||||
const char *tapfd);
|
||||
|
||||
/* Legacy, pre device support */
|
||||
char * qemuBuildNicStr(virConnectPtr conn,
|
||||
virDomainNetDefPtr net,
|
||||
char * qemuBuildNicStr(virDomainNetDefPtr net,
|
||||
const char *prefix,
|
||||
int vlan);
|
||||
|
||||
|
@ -213,8 +211,7 @@ char *qemuBuildDriveStr(virDomainDiskDefPtr disk,
|
|||
int qemuCmdFlags);
|
||||
|
||||
/* Current, best practice */
|
||||
char * qemuBuildDriveDevStr(virConnectPtr conn,
|
||||
virDomainDiskDefPtr disk);
|
||||
char * qemuBuildDriveDevStr(virDomainDiskDefPtr disk);
|
||||
/* Current, best practice */
|
||||
char * qemuBuildControllerDevStr(virDomainControllerDefPtr def);
|
||||
|
||||
|
@ -258,12 +255,10 @@ int qemudProbeCPUModels (const char *qemu,
|
|||
int qemudCanonicalizeMachine (struct qemud_driver *driver,
|
||||
virDomainDefPtr def);
|
||||
|
||||
virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
|
||||
virCapsPtr caps,
|
||||
virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
|
||||
const char **progenv,
|
||||
const char **progargv);
|
||||
virDomainDefPtr qemuParseCommandLineString(virConnectPtr conn,
|
||||
virCapsPtr caps,
|
||||
virDomainDefPtr qemuParseCommandLineString(virCapsPtr caps,
|
||||
const char *args);
|
||||
|
||||
qemuDomainPCIAddressSetPtr qemuDomainPCIAddressSetCreate(virDomainDefPtr def);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -240,8 +240,8 @@ qemuMonitorOpenUnix(const char *monitor)
|
|||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sun_family = AF_UNIX;
|
||||
if (virStrcpyStatic(addr.sun_path, monitor) == NULL) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("Monitor path %s too big for destination"), monitor);
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Monitor path %s too big for destination"), monitor);
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -282,8 +282,8 @@ qemuMonitorOpenPty(const char *monitor)
|
|||
int monfd;
|
||||
|
||||
if ((monfd = open(monitor, O_RDWR)) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unable to open monitor path %s"), monitor);
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unable to open monitor path %s"), monitor);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -569,8 +569,8 @@ qemuMonitorOpen(virDomainObjPtr vm,
|
|||
qemuMonitorPtr mon;
|
||||
|
||||
if (!cb || !cb->eofNotify) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("EOF notify callback must be supplied"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("EOF notify callback must be supplied"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -580,14 +580,14 @@ qemuMonitorOpen(virDomainObjPtr vm,
|
|||
}
|
||||
|
||||
if (virMutexInit(&mon->lock) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cannot initialize monitor mutex"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cannot initialize monitor mutex"));
|
||||
VIR_FREE(mon);
|
||||
return NULL;
|
||||
}
|
||||
if (virCondInit(&mon->notify) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cannot initialize monitor condition"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cannot initialize monitor condition"));
|
||||
virMutexDestroy(&mon->lock);
|
||||
VIR_FREE(mon);
|
||||
return NULL;
|
||||
|
@ -610,22 +610,22 @@ qemuMonitorOpen(virDomainObjPtr vm,
|
|||
break;
|
||||
|
||||
default:
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("unable to handle monitor type: %s"),
|
||||
virDomainChrTypeToString(config->type));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unable to handle monitor type: %s"),
|
||||
virDomainChrTypeToString(config->type));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (mon->fd == -1) goto cleanup;
|
||||
|
||||
if (virSetCloseExec(mon->fd) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("Unable to set monitor close-on-exec flag"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("Unable to set monitor close-on-exec flag"));
|
||||
goto cleanup;
|
||||
}
|
||||
if (virSetNonBlock(mon->fd) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("Unable to put monitor into non-blocking mode"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("Unable to put monitor into non-blocking mode"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -636,8 +636,8 @@ qemuMonitorOpen(virDomainObjPtr vm,
|
|||
VIR_EVENT_HANDLE_READABLE,
|
||||
qemuMonitorIO,
|
||||
mon, NULL)) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("unable to register monitor events"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("unable to register monitor events"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
|
|
@ -215,8 +215,8 @@ qemuMonitorJSONCommandWithFd(qemuMonitorPtr mon,
|
|||
|
||||
if (ret == 0) {
|
||||
if (!((*reply) = virJSONValueFromString(msg.rxBuffer))) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot parse JSON doc '%s'"), msg.rxBuffer);
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot parse JSON doc '%s'"), msg.rxBuffer);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
@ -269,15 +269,15 @@ qemuMonitorJSONCheckError(virJSONValuePtr cmd,
|
|||
if (!error) {
|
||||
VIR_DEBUG("Saw a JSON error, but value is null for %s: %s",
|
||||
cmdstr, replystr);
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("error running QEMU command '%s': '%s'"),
|
||||
cmdstr, replystr);
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("error running QEMU command '%s': '%s'"),
|
||||
cmdstr, replystr);
|
||||
} else {
|
||||
VIR_DEBUG("Got a JSON error set for %s", cmdstr);
|
||||
char *detail = qemuMonitorJSONStringifyError(error);
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("error running QEMU command '%s': %s ('%s')"),
|
||||
cmdstr, detail, replystr);
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("error running QEMU command '%s': %s ('%s')"),
|
||||
cmdstr, detail, replystr);
|
||||
VIR_FREE(detail);
|
||||
}
|
||||
VIR_FREE(cmdstr);
|
||||
|
@ -289,8 +289,8 @@ qemuMonitorJSONCheckError(virJSONValuePtr cmd,
|
|||
|
||||
VIR_DEBUG("Neither 'return' nor 'error' is set in the JSON reply %s: %s",
|
||||
cmdstr, replystr);
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("error running QEMU command '%s': '%s'"), cmdstr, replystr);
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("error running QEMU command '%s': '%s'"), cmdstr, replystr);
|
||||
VIR_FREE(cmdstr);
|
||||
VIR_FREE(replystr);
|
||||
return -1;
|
||||
|
@ -380,9 +380,9 @@ qemuMonitorJSONMakeCommand(const char *cmdname,
|
|||
char type;
|
||||
|
||||
if (strlen(key) < 3) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("argument key '%s' is too short, missing type prefix"),
|
||||
key);
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("argument key '%s' is too short, missing type prefix"),
|
||||
key);
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -429,8 +429,8 @@ qemuMonitorJSONMakeCommand(const char *cmdname,
|
|||
ret = virJSONValueObjectAppendNull(jargs, key);
|
||||
} break;
|
||||
default:
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("unsupported data type '%c' for arg '%s'"), type, key - 2);
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unsupported data type '%c' for arg '%s'"), type, key - 2);
|
||||
goto error;
|
||||
}
|
||||
if (ret < 0)
|
||||
|
@ -551,20 +551,20 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr reply,
|
|||
int ncpus;
|
||||
|
||||
if (!(data = virJSONValueObjectGet(reply, "return"))) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cpu reply was missing return data"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cpu reply was missing return data"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (data->type != VIR_JSON_TYPE_ARRAY) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cpu information was not an array"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cpu information was not an array"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ((ncpus = virJSONValueArraySize(data)) <= 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cpu information was empty"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cpu information was empty"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -578,27 +578,27 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr reply,
|
|||
int cpu;
|
||||
int thread;
|
||||
if (!entry) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("character device information was missing aray element"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("character device information was missing aray element"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virJSONValueObjectGetNumberInt(entry, "CPU", &cpu) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cpu information was missing cpu number"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cpu information was missing cpu number"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virJSONValueObjectGetNumberInt(entry, "thread_id", &thread) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cpu information was missing thread ID"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cpu information was missing thread ID"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (cpu != i) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected cpu index %d expecting %d"),
|
||||
i, cpu);
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected cpu index %d expecting %d"),
|
||||
i, cpu);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -676,15 +676,15 @@ int qemuMonitorJSONGetBalloonInfo(qemuMonitorPtr mon,
|
|||
unsigned long long mem;
|
||||
|
||||
if (!(data = virJSONValueObjectGet(reply, "return"))) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("info balloon reply was missing return data"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("info balloon reply was missing return data"));
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virJSONValueObjectGetNumberUlong(data, "balloon", &mem) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("info balloon reply was missing balloon data"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("info balloon reply was missing balloon data"));
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -733,8 +733,8 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
|
|||
|
||||
devices = virJSONValueObjectGet(reply, "return");
|
||||
if (!devices || devices->type != VIR_JSON_TYPE_ARRAY) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("blockstats reply was missing device list"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("blockstats reply was missing device list"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -743,14 +743,14 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
|
|||
virJSONValuePtr stats;
|
||||
const char *thisdev;
|
||||
if (!dev || dev->type != VIR_JSON_TYPE_OBJECT) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("blockstats device entry was not in expected format"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("blockstats device entry was not in expected format"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ((thisdev = virJSONValueObjectGetString(dev, "device")) == NULL) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("blockstats device entry was not in expected format"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("blockstats device entry was not in expected format"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -760,40 +760,40 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
|
|||
found = 1;
|
||||
if ((stats = virJSONValueObjectGet(dev, "stats")) == NULL ||
|
||||
stats->type != VIR_JSON_TYPE_OBJECT) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("blockstats stats entry was not in expected format"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("blockstats stats entry was not in expected format"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virJSONValueObjectGetNumberLong(stats, "rd_bytes", rd_bytes) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot read %s statistic"),
|
||||
"rd_bytes");
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot read %s statistic"),
|
||||
"rd_bytes");
|
||||
goto cleanup;
|
||||
}
|
||||
if (virJSONValueObjectGetNumberLong(stats, "rd_operations", rd_req) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot read %s statistic"),
|
||||
"rd_operations");
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot read %s statistic"),
|
||||
"rd_operations");
|
||||
goto cleanup;
|
||||
}
|
||||
if (virJSONValueObjectGetNumberLong(stats, "wr_bytes", wr_bytes) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot read %s statistic"),
|
||||
"wr_bytes");
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot read %s statistic"),
|
||||
"wr_bytes");
|
||||
goto cleanup;
|
||||
}
|
||||
if (virJSONValueObjectGetNumberLong(stats, "wr_operations", wr_req) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot read %s statistic"),
|
||||
"wr_operations");
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot read %s statistic"),
|
||||
"wr_operations");
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find statistics for device '%s'"), devname);
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find statistics for device '%s'"), devname);
|
||||
goto cleanup;
|
||||
}
|
||||
ret = 0;
|
||||
|
@ -1007,44 +1007,44 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
|
|||
const char *statusstr;
|
||||
|
||||
if (!(ret = virJSONValueObjectGet(reply, "return"))) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("info migration reply was missing return data"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("info migration reply was missing return data"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(statusstr = virJSONValueObjectGetString(ret, "status"))) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("info migration reply was missing return status"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("info migration reply was missing return status"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((*status = qemuMonitorMigrationStatusTypeFromString(statusstr)) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected migration status in %s"), statusstr);
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected migration status in %s"), statusstr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (*status == QEMU_MONITOR_MIGRATION_STATUS_ACTIVE) {
|
||||
virJSONValuePtr ram = virJSONValueObjectGet(ret, "ram");
|
||||
if (!ram) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("migration was active, but no RAM info was set"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("migration was active, but no RAM info was set"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virJSONValueObjectGetNumberUlong(ram, "transferred", transferred) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("migration was active, but RAM 'transferred' data was missing"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("migration was active, but RAM 'transferred' data was missing"));
|
||||
return -1;
|
||||
}
|
||||
if (virJSONValueObjectGetNumberUlong(ram, "remaining", remaining) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("migration was active, but RAM 'remaining' data was missing"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("migration was active, but RAM 'remaining' data was missing"));
|
||||
return -1;
|
||||
}
|
||||
if (virJSONValueObjectGetNumberUlong(ram, "total", total) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("migration was active, but RAM 'total' data was missing"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("migration was active, but RAM 'total' data was missing"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -1299,32 +1299,32 @@ qemuMonitorJSONGetGuestPCIAddress(virJSONValuePtr reply,
|
|||
|
||||
addr = virJSONValueObjectGet(reply, "return");
|
||||
if (!addr || addr->type != VIR_JSON_TYPE_OBJECT) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("pci_add reply was missing device address"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("pci_add reply was missing device address"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virJSONValueObjectGetNumberUint(addr, "domain", &guestAddr->domain) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("pci_add reply was missing device domain number"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("pci_add reply was missing device domain number"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virJSONValueObjectGetNumberUint(addr, "bus", &guestAddr->bus) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("pci_add reply was missing device bus number"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("pci_add reply was missing device bus number"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virJSONValueObjectGetNumberUint(addr, "slot", &guestAddr->slot) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("pci_add reply was missing device slot number"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("pci_add reply was missing device slot number"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virJSONValueObjectGetNumberUint(addr, "function", &guestAddr->function) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("pci_add reply was missing device function number"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("pci_add reply was missing device function number"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1589,14 +1589,14 @@ static int qemuMonitorJSONExtractPtyPaths(virJSONValuePtr reply,
|
|||
int i;
|
||||
|
||||
if (!(data = virJSONValueObjectGet(reply, "return"))) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("character device reply was missing return data"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("character device reply was missing return data"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (data->type != VIR_JSON_TYPE_ARRAY) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("character device information was not an array"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("character device information was not an array"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1605,20 +1605,20 @@ static int qemuMonitorJSONExtractPtyPaths(virJSONValuePtr reply,
|
|||
const char *type;
|
||||
const char *id;
|
||||
if (!entry) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("character device information was missing aray element"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("character device information was missing aray element"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(type = virJSONValueObjectGetString(entry, "filename"))) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("character device information was missing filename"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("character device information was missing filename"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(id = virJSONValueObjectGetString(entry, "label"))) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("character device information was missing filename"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("character device information was missing filename"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1630,8 +1630,8 @@ static int qemuMonitorJSONExtractPtyPaths(virJSONValuePtr reply,
|
|||
}
|
||||
|
||||
if (virHashAddEntry(paths, id, path) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to save chardev path '%s'"), path);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to save chardev path '%s'"), path);
|
||||
VIR_FREE(path);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1718,20 +1718,20 @@ qemuMonitorJSONGetGuestDriveAddress(virJSONValuePtr reply,
|
|||
|
||||
addr = virJSONValueObjectGet(reply, "return");
|
||||
if (!addr || addr->type != VIR_JSON_TYPE_OBJECT) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("drive_add reply was missing device address"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("drive_add reply was missing device address"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virJSONValueObjectGetNumberUint(addr, "bus", &driveAddr->bus) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("drive_add reply was missing device bus number"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("drive_add reply was missing device bus number"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virJSONValueObjectGetNumberUint(addr, "unit", &driveAddr->unit) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("drive_add reply was missing device unit number"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("drive_add reply was missing device unit number"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1781,8 +1781,8 @@ int qemuMonitorJSONAttachDrive(qemuMonitorPtr mon,
|
|||
int qemuMonitorJSONGetAllPCIAddresses(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
qemuMonitorPCIAddress **addrs ATTRIBUTE_UNUSED)
|
||||
{
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("query-pci not suppported in JSON mode"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("query-pci not suppported in JSON mode"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -366,8 +366,8 @@ qemuMonitorTextStopCPUs(qemuMonitorPtr mon) {
|
|||
char *info;
|
||||
|
||||
if (qemuMonitorCommand(mon, "stop", &info) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("cannot stop CPU execution"));
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("cannot stop CPU execution"));
|
||||
return -1;
|
||||
}
|
||||
VIR_FREE(info);
|
||||
|
@ -379,8 +379,8 @@ int qemuMonitorTextSystemPowerdown(qemuMonitorPtr mon) {
|
|||
char *info;
|
||||
|
||||
if (qemuMonitorCommand(mon, "system_powerdown", &info) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("system shutdown operation failed"));
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("system shutdown operation failed"));
|
||||
return -1;
|
||||
}
|
||||
VIR_FREE(info);
|
||||
|
@ -398,8 +398,8 @@ int qemuMonitorTextGetCPUInfo(qemuMonitorPtr mon,
|
|||
size_t ncpupids = 0;
|
||||
|
||||
if (qemuMonitorCommand(mon, "info cpus", &qemucpus) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot run monitor command to fetch CPU thread info"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot run monitor command to fetch CPU thread info"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -550,8 +550,8 @@ int qemuMonitorTextGetBalloonInfo(qemuMonitorPtr mon,
|
|||
char *offset;
|
||||
|
||||
if (qemuMonitorCommand(mon, "info balloon", &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("could not query memory balloon allocation"));
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("could not query memory balloon allocation"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -560,8 +560,8 @@ int qemuMonitorTextGetBalloonInfo(qemuMonitorPtr mon,
|
|||
char *end;
|
||||
offset += strlen(BALLOON_PREFIX);
|
||||
if (virStrToLong_ui(offset, &end, 10, &memMB) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("could not parse memory balloon allocation from '%s'"), reply);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("could not parse memory balloon allocation from '%s'"), reply);
|
||||
goto cleanup;
|
||||
}
|
||||
*currmem = memMB * 1024;
|
||||
|
@ -587,8 +587,8 @@ int qemuMonitorTextGetMemoryStats(qemuMonitorPtr mon,
|
|||
char *offset;
|
||||
|
||||
if (qemuMonitorCommand(mon, "info balloon", &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("could not query memory balloon statistics"));
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("could not query memory balloon statistics"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -618,8 +618,8 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
|
|||
int devnamelen = strlen(devname);
|
||||
|
||||
if (qemuMonitorCommand (mon, "info blockstats", &info) < 0) {
|
||||
qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("'info blockstats' command failed"));
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("'info blockstats' command failed"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -629,9 +629,9 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
|
|||
* to detect if qemu supports the command.
|
||||
*/
|
||||
if (strstr(info, "\ninfo ")) {
|
||||
qemudReportError (NULL, NULL, NULL, VIR_ERR_NO_SUPPORT,
|
||||
"%s",
|
||||
_("'info blockstats' not supported by this qemu"));
|
||||
qemuReportError(VIR_ERR_NO_SUPPORT,
|
||||
"%s",
|
||||
_("'info blockstats' not supported by this qemu"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -694,8 +694,8 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
/* If we reach here then the device was not found. */
|
||||
qemudReportError (NULL, NULL, NULL, VIR_ERR_INVALID_ARG,
|
||||
_("no stats found for device %s"), devname);
|
||||
qemuReportError (VIR_ERR_INVALID_ARG,
|
||||
_("no stats found for device %s"), devname);
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(info);
|
||||
|
@ -741,8 +741,8 @@ int qemuMonitorTextSetVNCPassword(qemuMonitorPtr mon,
|
|||
qemuMonitorSendVNCPassphrase,
|
||||
(char *)password,
|
||||
-1, &info) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("setting VNC password failed"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("setting VNC password failed"));
|
||||
return -1;
|
||||
}
|
||||
VIR_FREE(info);
|
||||
|
@ -770,8 +770,8 @@ int qemuMonitorTextSetBalloon(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("could not balloon memory allocation"));
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("could not balloon memory allocation"));
|
||||
VIR_FREE(cmd);
|
||||
return -1;
|
||||
}
|
||||
|
@ -803,8 +803,8 @@ int qemuMonitorTextEjectMedia(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("could not eject media on %s"), devname);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("could not eject media on %s"), devname);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -812,8 +812,8 @@ int qemuMonitorTextEjectMedia(qemuMonitorPtr mon,
|
|||
* device not found, device is locked ...
|
||||
* No message is printed on success it seems */
|
||||
if (strstr(reply, "\ndevice ")) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("could not eject media on %s: %s"), devname, reply);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("could not eject media on %s: %s"), devname, reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -847,8 +847,8 @@ int qemuMonitorTextChangeMedia(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("could not eject media on %s"), devname);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("could not eject media on %s"), devname);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -856,8 +856,8 @@ int qemuMonitorTextChangeMedia(qemuMonitorPtr mon,
|
|||
* device not found, device is locked ...
|
||||
* No message is printed on success it seems */
|
||||
if (strstr(reply, "\ndevice ")) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("could not eject media on %s: %s"), devname, reply);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("could not eject media on %s: %s"), devname, reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -892,8 +892,8 @@ static int qemuMonitorTextSaveMemory(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("could save memory region to '%s'"), path);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("could save memory region to '%s'"), path);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -939,8 +939,8 @@ int qemuMonitorTextSetMigrationSpeed(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &info) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("could restrict migration speed"));
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("could restrict migration speed"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -974,8 +974,8 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
|
|||
*total = 0;
|
||||
|
||||
if (qemuMonitorCommand(mon, "info migrate", &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("cannot query migration status"));
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("cannot query migration status"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -985,8 +985,8 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
|
|||
*end = '\0';
|
||||
|
||||
if ((*status = qemuMonitorMigrationStatusTypeFromString(tmp)) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected migration status in %s"), reply);
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected migration status in %s"), reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -998,8 +998,8 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
|
|||
tmp += strlen(MIGRATION_TRANSFER_PREFIX);
|
||||
|
||||
if (virStrToLong_ull(tmp, NULL, 10, transferred) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot parse migration data transferred statistic %s"), tmp);
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot parse migration data transferred statistic %s"), tmp);
|
||||
goto cleanup;
|
||||
}
|
||||
*transferred *= 1024;
|
||||
|
@ -1009,8 +1009,8 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
|
|||
tmp += strlen(MIGRATION_REMAINING_PREFIX);
|
||||
|
||||
if (virStrToLong_ull(tmp, NULL, 10, remaining) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot parse migration data remaining statistic %s"), tmp);
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot parse migration data remaining statistic %s"), tmp);
|
||||
goto cleanup;
|
||||
}
|
||||
*remaining *= 1024;
|
||||
|
@ -1020,8 +1020,8 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
|
|||
tmp += strlen(MIGRATION_TOTAL_PREFIX);
|
||||
|
||||
if (virStrToLong_ull(tmp, NULL, 10, total) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot parse migration data total statistic %s"), tmp);
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot parse migration data total statistic %s"), tmp);
|
||||
goto cleanup;
|
||||
}
|
||||
*total *= 1024;
|
||||
|
@ -1064,22 +1064,22 @@ static int qemuMonitorTextMigrate(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &info) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
_("unable to start migration to %s"), dest);
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unable to start migration to %s"), dest);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Now check for "fail" in the output string */
|
||||
if (strstr(info, "fail") != NULL) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("migration to '%s' failed: %s"), dest, info);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("migration to '%s' failed: %s"), dest, info);
|
||||
goto cleanup;
|
||||
}
|
||||
/* If the command isn't supported then qemu prints:
|
||||
* unknown command: migrate" */
|
||||
if (strstr(info, "unknown command:")) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SUPPORT,
|
||||
_("migration to '%s' not supported by this qemu: %s"), dest, info);
|
||||
qemuReportError(VIR_ERR_NO_SUPPORT,
|
||||
_("migration to '%s' not supported by this qemu: %s"), dest, info);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1175,8 +1175,8 @@ int qemuMonitorTextMigrateCancel(qemuMonitorPtr mon)
|
|||
char *info = NULL;
|
||||
|
||||
if (qemuMonitorCommand(mon, "migrate_cancel", &info) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot run monitor command to cancel migration"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot run monitor command to cancel migration"));
|
||||
return -1;
|
||||
}
|
||||
VIR_FREE(info);
|
||||
|
@ -1204,16 +1204,16 @@ int qemuMonitorTextAddUSBDisk(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &info) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot run monitor command to add usb disk"));
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot run monitor command to add usb disk"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* If the command failed qemu prints:
|
||||
* Could not add ... */
|
||||
if (strstr(info, "Could not add ")) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("unable to add USB disk %s: %s"), path, info);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("unable to add USB disk %s: %s"), path, info);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1239,16 +1239,16 @@ static int qemuMonitorTextAddUSBDevice(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("cannot attach usb device"));
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("cannot attach usb device"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* If the command failed qemu prints:
|
||||
* Could not add ... */
|
||||
if (strstr(reply, "Could not add ")) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("adding usb device failed"));
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("adding usb device failed"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1380,20 +1380,20 @@ int qemuMonitorTextAddPCIHostDevice(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("cannot attach host pci device"));
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("cannot attach host pci device"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (strstr(reply, "invalid type: host")) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SUPPORT, "%s",
|
||||
_("PCI device assignment is not supported by this version of qemu"));
|
||||
qemuReportError(VIR_ERR_NO_SUPPORT, "%s",
|
||||
_("PCI device assignment is not supported by this version of qemu"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (qemuMonitorTextParsePciAddReply(mon, reply, guestAddr) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("parsing pci_add reply failed: %s"), reply);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("parsing pci_add reply failed: %s"), reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1431,8 +1431,8 @@ try_command:
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("cannot attach %s disk %s"), bus, path);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("cannot attach %s disk %s"), bus, path);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1444,8 +1444,8 @@ try_command:
|
|||
goto try_command;
|
||||
}
|
||||
|
||||
qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("adding %s disk failed %s: %s"), bus, path, reply);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("adding %s disk failed %s: %s"), bus, path, reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1473,14 +1473,14 @@ int qemuMonitorTextAddPCINetwork(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to add NIC with '%s'"), cmd);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to add NIC with '%s'"), cmd);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (qemuMonitorTextParsePciAddReply(mon, reply, guestAddr) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("parsing pci_add reply failed: %s"), reply);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("parsing pci_add reply failed: %s"), reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1517,8 +1517,8 @@ try_command:
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("failed to remove PCI device"));
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("failed to remove PCI device"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1536,9 +1536,9 @@ try_command:
|
|||
* nothing is printed on success */
|
||||
if (strstr(reply, "invalid slot") ||
|
||||
strstr(reply, "Invalid pci address")) {
|
||||
qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to detach PCI device, invalid address %.4x:%.2x:%.2x: %s"),
|
||||
guestAddr->domain, guestAddr->bus, guestAddr->slot, reply);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to detach PCI device, invalid address %.4x:%.2x:%.2x: %s"),
|
||||
guestAddr->domain, guestAddr->bus, guestAddr->slot, reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1565,17 +1565,17 @@ int qemuMonitorTextSendFileHandle(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommandWithFd(mon, cmd, fd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to pass fd to qemu with '%s'"), cmd);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to pass fd to qemu with '%s'"), cmd);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* If the command isn't supported then qemu prints:
|
||||
* unknown command: getfd" */
|
||||
if (strstr(reply, "unknown command:")) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SUPPORT,
|
||||
_("qemu does not support sending of file handles: %s"),
|
||||
reply);
|
||||
qemuReportError(VIR_ERR_NO_SUPPORT,
|
||||
_("qemu does not support sending of file handles: %s"),
|
||||
reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1601,17 +1601,17 @@ int qemuMonitorTextCloseFileHandle(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to close fd in qemu with '%s'"), cmd);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to close fd in qemu with '%s'"), cmd);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* If the command isn't supported then qemu prints:
|
||||
* unknown command: getfd" */
|
||||
if (strstr(reply, "unknown command:")) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SUPPORT,
|
||||
_("qemu does not support closing of file handles: %s"),
|
||||
reply);
|
||||
qemuReportError(VIR_ERR_NO_SUPPORT,
|
||||
_("qemu does not support closing of file handles: %s"),
|
||||
reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1637,8 +1637,8 @@ int qemuMonitorTextAddHostNetwork(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to close fd in qemu with '%s'"), cmd);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to close fd in qemu with '%s'"), cmd);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1667,8 +1667,8 @@ int qemuMonitorTextRemoveHostNetwork(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to remove host network in qemu with '%s'"), cmd);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to remove host network in qemu with '%s'"), cmd);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1702,8 +1702,8 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
|
|||
int ret = -1;
|
||||
|
||||
if (qemuMonitorCommand(mon, "info chardev", &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "%s",
|
||||
_("failed to retrieve chardev info in qemu with 'info chardev'"));
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||
_("failed to retrieve chardev info in qemu with 'info chardev'"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1753,9 +1753,9 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (virHashAddEntry(paths, id, path) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to save chardev path '%s'"),
|
||||
path);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to save chardev path '%s'"),
|
||||
path);
|
||||
VIR_FREE(path);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1787,8 +1787,8 @@ try_command:
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("cannot attach %s disk controller"), bus);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("cannot attach %s disk controller"), bus);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1800,8 +1800,8 @@ try_command:
|
|||
goto try_command;
|
||||
}
|
||||
|
||||
qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("adding %s disk controller failed: %s"), bus, reply);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("adding %s disk controller failed: %s"), bus, reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1887,8 +1887,8 @@ try_command:
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to close fd in qemu with '%s'"), cmd);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to close fd in qemu with '%s'"), cmd);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1899,8 +1899,8 @@ try_command:
|
|||
tryOldSyntax = 1;
|
||||
goto try_command;
|
||||
}
|
||||
qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("adding %s disk failed: %s"), drivestr, reply);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("adding %s disk failed: %s"), drivestr, reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1954,8 +1954,8 @@ cleanup:
|
|||
(p) += strlen(lbl);
|
||||
#define GET_INT(p, base, val) \
|
||||
if (virStrToLong_ui((p), &(p), (base), &(val)) < 0) { \
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, \
|
||||
_("cannot parse value for %s"), #val); \
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED, \
|
||||
_("cannot parse value for %s"), #val); \
|
||||
break; \
|
||||
}
|
||||
#define SKIP_SPACE(p) \
|
||||
|
@ -1972,7 +1972,7 @@ int qemuMonitorTextGetAllPCIAddresses(qemuMonitorPtr mon,
|
|||
*retaddrs = NULL;
|
||||
|
||||
if (qemuMonitorCommand(mon, "info pci", &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("cannot query PCI addresses"));
|
||||
return -1;
|
||||
}
|
||||
|
@ -2064,14 +2064,14 @@ int qemuMonitorTextAddDevice(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("cannot attach %s device"), devicestr);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("cannot attach %s device"), devicestr);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (STRNEQ(reply, "")) {
|
||||
qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("adding %s device failed: %s"), devicestr, reply);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("adding %s device failed: %s"), devicestr, reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -2107,8 +2107,8 @@ int qemuMonitorTextAddDrive(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to close fd in qemu with '%s'"), cmd);
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to close fd in qemu with '%s'"), cmd);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|||
if (virtTestLoadFile(xml, &expectxml, MAX_FILE) < 0)
|
||||
goto fail;
|
||||
|
||||
if (!(vmdef = qemuParseCommandLineString(NULL, driver.caps, cmd)))
|
||||
if (!(vmdef = qemuParseCommandLineString(driver.caps, cmd)))
|
||||
goto fail;
|
||||
|
||||
if (!(actualxml = virDomainDefFormat(NULL, vmdef, 0)))
|
||||
|
|
Loading…
Reference in New Issue