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,8 +157,8 @@ 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__, \
|
||||
#define qemuReportError(code, fmt...) \
|
||||
virReportErrorHelper(NULL, VIR_FROM_QEMU, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, fmt)
|
||||
|
||||
|
||||
|
@ -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,7 +240,7 @@ 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,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Monitor path %s too big for destination"), monitor);
|
||||
goto error;
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ qemuMonitorOpenPty(const char *monitor)
|
|||
int monfd;
|
||||
|
||||
if ((monfd = open(monitor, O_RDWR)) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unable to open monitor path %s"), monitor);
|
||||
return -1;
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ qemuMonitorOpen(virDomainObjPtr vm,
|
|||
qemuMonitorPtr mon;
|
||||
|
||||
if (!cb || !cb->eofNotify) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("EOF notify callback must be supplied"));
|
||||
return NULL;
|
||||
}
|
||||
|
@ -580,13 +580,13 @@ qemuMonitorOpen(virDomainObjPtr vm,
|
|||
}
|
||||
|
||||
if (virMutexInit(&mon->lock) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
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",
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cannot initialize monitor condition"));
|
||||
virMutexDestroy(&mon->lock);
|
||||
VIR_FREE(mon);
|
||||
|
@ -610,7 +610,7 @@ qemuMonitorOpen(virDomainObjPtr vm,
|
|||
break;
|
||||
|
||||
default:
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unable to handle monitor type: %s"),
|
||||
virDomainChrTypeToString(config->type));
|
||||
goto cleanup;
|
||||
|
@ -619,12 +619,12 @@ qemuMonitorOpen(virDomainObjPtr vm,
|
|||
if (mon->fd == -1) goto cleanup;
|
||||
|
||||
if (virSetCloseExec(mon->fd) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
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,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("Unable to put monitor into non-blocking mode"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -636,7 +636,7 @@ qemuMonitorOpen(virDomainObjPtr vm,
|
|||
VIR_EVENT_HANDLE_READABLE,
|
||||
qemuMonitorIO,
|
||||
mon, NULL)) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("unable to register monitor events"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
|
|
@ -215,7 +215,7 @@ qemuMonitorJSONCommandWithFd(qemuMonitorPtr mon,
|
|||
|
||||
if (ret == 0) {
|
||||
if (!((*reply) = virJSONValueFromString(msg.rxBuffer))) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot parse JSON doc '%s'"), msg.rxBuffer);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -269,13 +269,13 @@ 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,
|
||||
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,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("error running QEMU command '%s': %s ('%s')"),
|
||||
cmdstr, detail, replystr);
|
||||
VIR_FREE(detail);
|
||||
|
@ -289,7 +289,7 @@ 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,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("error running QEMU command '%s': '%s'"), cmdstr, replystr);
|
||||
VIR_FREE(cmdstr);
|
||||
VIR_FREE(replystr);
|
||||
|
@ -380,7 +380,7 @@ qemuMonitorJSONMakeCommand(const char *cmdname,
|
|||
char type;
|
||||
|
||||
if (strlen(key) < 3) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("argument key '%s' is too short, missing type prefix"),
|
||||
key);
|
||||
goto error;
|
||||
|
@ -429,7 +429,7 @@ qemuMonitorJSONMakeCommand(const char *cmdname,
|
|||
ret = virJSONValueObjectAppendNull(jargs, key);
|
||||
} break;
|
||||
default:
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unsupported data type '%c' for arg '%s'"), type, key - 2);
|
||||
goto error;
|
||||
}
|
||||
|
@ -551,19 +551,19 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr reply,
|
|||
int ncpus;
|
||||
|
||||
if (!(data = virJSONValueObjectGet(reply, "return"))) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
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",
|
||||
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",
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cpu information was empty"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -578,25 +578,25 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr reply,
|
|||
int cpu;
|
||||
int thread;
|
||||
if (!entry) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
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",
|
||||
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",
|
||||
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,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected cpu index %d expecting %d"),
|
||||
i, cpu);
|
||||
goto cleanup;
|
||||
|
@ -676,14 +676,14 @@ int qemuMonitorJSONGetBalloonInfo(qemuMonitorPtr mon,
|
|||
unsigned long long mem;
|
||||
|
||||
if (!(data = virJSONValueObjectGet(reply, "return"))) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
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",
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("info balloon reply was missing balloon data"));
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
|
@ -733,7 +733,7 @@ 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",
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("blockstats reply was missing device list"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -743,13 +743,13 @@ 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",
|
||||
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",
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("blockstats device entry was not in expected format"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -760,31 +760,31 @@ 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",
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot read %s statistic"),
|
||||
"wr_operations");
|
||||
goto cleanup;
|
||||
|
@ -792,7 +792,7 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (!found) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find statistics for device '%s'"), devname);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1007,19 +1007,19 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
|
|||
const char *statusstr;
|
||||
|
||||
if (!(ret = virJSONValueObjectGet(reply, "return"))) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
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",
|
||||
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,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected migration status in %s"), statusstr);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1027,23 +1027,23 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
|
|||
if (*status == QEMU_MONITOR_MIGRATION_STATUS_ACTIVE) {
|
||||
virJSONValuePtr ram = virJSONValueObjectGet(ret, "ram");
|
||||
if (!ram) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
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",
|
||||
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",
|
||||
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",
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("migration was active, but RAM 'total' data was missing"));
|
||||
return -1;
|
||||
}
|
||||
|
@ -1299,31 +1299,31 @@ qemuMonitorJSONGetGuestPCIAddress(virJSONValuePtr reply,
|
|||
|
||||
addr = virJSONValueObjectGet(reply, "return");
|
||||
if (!addr || addr->type != VIR_JSON_TYPE_OBJECT) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
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",
|
||||
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",
|
||||
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",
|
||||
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",
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("pci_add reply was missing device function number"));
|
||||
return -1;
|
||||
}
|
||||
|
@ -1589,13 +1589,13 @@ static int qemuMonitorJSONExtractPtyPaths(virJSONValuePtr reply,
|
|||
int i;
|
||||
|
||||
if (!(data = virJSONValueObjectGet(reply, "return"))) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
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",
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("character device information was not an array"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1605,19 +1605,19 @@ static int qemuMonitorJSONExtractPtyPaths(virJSONValuePtr reply,
|
|||
const char *type;
|
||||
const char *id;
|
||||
if (!entry) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
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",
|
||||
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",
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("character device information was missing filename"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1630,7 +1630,7 @@ static int qemuMonitorJSONExtractPtyPaths(virJSONValuePtr reply,
|
|||
}
|
||||
|
||||
if (virHashAddEntry(paths, id, path) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to save chardev path '%s'"), path);
|
||||
VIR_FREE(path);
|
||||
goto cleanup;
|
||||
|
@ -1718,19 +1718,19 @@ qemuMonitorJSONGetGuestDriveAddress(virJSONValuePtr reply,
|
|||
|
||||
addr = virJSONValueObjectGet(reply, "return");
|
||||
if (!addr || addr->type != VIR_JSON_TYPE_OBJECT) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
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",
|
||||
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",
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("drive_add reply was missing device unit number"));
|
||||
return -1;
|
||||
}
|
||||
|
@ -1781,7 +1781,7 @@ int qemuMonitorJSONAttachDrive(qemuMonitorPtr mon,
|
|||
int qemuMonitorJSONGetAllPCIAddresses(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
qemuMonitorPCIAddress **addrs ATTRIBUTE_UNUSED)
|
||||
{
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("query-pci not suppported in JSON mode"));
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -366,7 +366,7 @@ qemuMonitorTextStopCPUs(qemuMonitorPtr mon) {
|
|||
char *info;
|
||||
|
||||
if (qemuMonitorCommand(mon, "stop", &info) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("cannot stop CPU execution"));
|
||||
return -1;
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ int qemuMonitorTextSystemPowerdown(qemuMonitorPtr mon) {
|
|||
char *info;
|
||||
|
||||
if (qemuMonitorCommand(mon, "system_powerdown", &info) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("system shutdown operation failed"));
|
||||
return -1;
|
||||
}
|
||||
|
@ -398,7 +398,7 @@ int qemuMonitorTextGetCPUInfo(qemuMonitorPtr mon,
|
|||
size_t ncpupids = 0;
|
||||
|
||||
if (qemuMonitorCommand(mon, "info cpus", &qemucpus) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot run monitor command to fetch CPU thread info"));
|
||||
return -1;
|
||||
}
|
||||
|
@ -550,7 +550,7 @@ int qemuMonitorTextGetBalloonInfo(qemuMonitorPtr mon,
|
|||
char *offset;
|
||||
|
||||
if (qemuMonitorCommand(mon, "info balloon", &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("could not query memory balloon allocation"));
|
||||
return -1;
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ 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,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("could not parse memory balloon allocation from '%s'"), reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -587,7 +587,7 @@ int qemuMonitorTextGetMemoryStats(qemuMonitorPtr mon,
|
|||
char *offset;
|
||||
|
||||
if (qemuMonitorCommand(mon, "info balloon", &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("could not query memory balloon statistics"));
|
||||
return -1;
|
||||
}
|
||||
|
@ -618,7 +618,7 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
|
|||
int devnamelen = strlen(devname);
|
||||
|
||||
if (qemuMonitorCommand (mon, "info blockstats", &info) < 0) {
|
||||
qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("'info blockstats' command failed"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -629,7 +629,7 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
|
|||
* to detect if qemu supports the command.
|
||||
*/
|
||||
if (strstr(info, "\ninfo ")) {
|
||||
qemudReportError (NULL, NULL, NULL, VIR_ERR_NO_SUPPORT,
|
||||
qemuReportError(VIR_ERR_NO_SUPPORT,
|
||||
"%s",
|
||||
_("'info blockstats' not supported by this qemu"));
|
||||
goto cleanup;
|
||||
|
@ -694,7 +694,7 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
/* If we reach here then the device was not found. */
|
||||
qemudReportError (NULL, NULL, NULL, VIR_ERR_INVALID_ARG,
|
||||
qemuReportError (VIR_ERR_INVALID_ARG,
|
||||
_("no stats found for device %s"), devname);
|
||||
|
||||
cleanup:
|
||||
|
@ -741,7 +741,7 @@ int qemuMonitorTextSetVNCPassword(qemuMonitorPtr mon,
|
|||
qemuMonitorSendVNCPassphrase,
|
||||
(char *)password,
|
||||
-1, &info) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("setting VNC password failed"));
|
||||
return -1;
|
||||
}
|
||||
|
@ -770,7 +770,7 @@ int qemuMonitorTextSetBalloon(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("could not balloon memory allocation"));
|
||||
VIR_FREE(cmd);
|
||||
return -1;
|
||||
|
@ -803,7 +803,7 @@ int qemuMonitorTextEjectMedia(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("could not eject media on %s"), devname);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -812,7 +812,7 @@ 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,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("could not eject media on %s: %s"), devname, reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -847,7 +847,7 @@ int qemuMonitorTextChangeMedia(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("could not eject media on %s"), devname);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -856,7 +856,7 @@ 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,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("could not eject media on %s: %s"), devname, reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -892,7 +892,7 @@ static int qemuMonitorTextSaveMemory(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("could save memory region to '%s'"), path);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -939,7 +939,7 @@ int qemuMonitorTextSetMigrationSpeed(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &info) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("could restrict migration speed"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -974,7 +974,7 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
|
|||
*total = 0;
|
||||
|
||||
if (qemuMonitorCommand(mon, "info migrate", &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("cannot query migration status"));
|
||||
return -1;
|
||||
}
|
||||
|
@ -985,7 +985,7 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
|
|||
*end = '\0';
|
||||
|
||||
if ((*status = qemuMonitorMigrationStatusTypeFromString(tmp)) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected migration status in %s"), reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -998,7 +998,7 @@ 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,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot parse migration data transferred statistic %s"), tmp);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1009,7 +1009,7 @@ 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,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot parse migration data remaining statistic %s"), tmp);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1020,7 +1020,7 @@ 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,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot parse migration data total statistic %s"), tmp);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1064,21 +1064,21 @@ static int qemuMonitorTextMigrate(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &info) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
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,
|
||||
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,
|
||||
qemuReportError(VIR_ERR_NO_SUPPORT,
|
||||
_("migration to '%s' not supported by this qemu: %s"), dest, info);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1175,7 +1175,7 @@ int qemuMonitorTextMigrateCancel(qemuMonitorPtr mon)
|
|||
char *info = NULL;
|
||||
|
||||
if (qemuMonitorCommand(mon, "migrate_cancel", &info) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot run monitor command to cancel migration"));
|
||||
return -1;
|
||||
}
|
||||
|
@ -1204,7 +1204,7 @@ int qemuMonitorTextAddUSBDisk(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &info) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("cannot run monitor command to add usb disk"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1212,7 +1212,7 @@ int qemuMonitorTextAddUSBDisk(qemuMonitorPtr mon,
|
|||
/* If the command failed qemu prints:
|
||||
* Could not add ... */
|
||||
if (strstr(info, "Could not add ")) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("unable to add USB disk %s: %s"), path, info);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1239,7 +1239,7 @@ static int qemuMonitorTextAddUSBDevice(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("cannot attach usb device"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1247,7 +1247,7 @@ static int qemuMonitorTextAddUSBDevice(qemuMonitorPtr mon,
|
|||
/* If the command failed qemu prints:
|
||||
* Could not add ... */
|
||||
if (strstr(reply, "Could not add ")) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("adding usb device failed"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1380,19 +1380,19 @@ int qemuMonitorTextAddPCIHostDevice(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
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",
|
||||
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,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("parsing pci_add reply failed: %s"), reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1431,7 +1431,7 @@ try_command:
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("cannot attach %s disk %s"), bus, path);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1444,7 +1444,7 @@ try_command:
|
|||
goto try_command;
|
||||
}
|
||||
|
||||
qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("adding %s disk failed %s: %s"), bus, path, reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1473,13 +1473,13 @@ int qemuMonitorTextAddPCINetwork(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
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,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("parsing pci_add reply failed: %s"), reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1517,7 +1517,7 @@ try_command:
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
"%s", _("failed to remove PCI device"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1536,7 +1536,7 @@ 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,
|
||||
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,7 +1565,7 @@ int qemuMonitorTextSendFileHandle(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommandWithFd(mon, cmd, fd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to pass fd to qemu with '%s'"), cmd);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1573,7 +1573,7 @@ int qemuMonitorTextSendFileHandle(qemuMonitorPtr mon,
|
|||
/* 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,
|
||||
qemuReportError(VIR_ERR_NO_SUPPORT,
|
||||
_("qemu does not support sending of file handles: %s"),
|
||||
reply);
|
||||
goto cleanup;
|
||||
|
@ -1601,7 +1601,7 @@ int qemuMonitorTextCloseFileHandle(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to close fd in qemu with '%s'"), cmd);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1609,7 +1609,7 @@ int qemuMonitorTextCloseFileHandle(qemuMonitorPtr mon,
|
|||
/* 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,
|
||||
qemuReportError(VIR_ERR_NO_SUPPORT,
|
||||
_("qemu does not support closing of file handles: %s"),
|
||||
reply);
|
||||
goto cleanup;
|
||||
|
@ -1637,7 +1637,7 @@ int qemuMonitorTextAddHostNetwork(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to close fd in qemu with '%s'"), cmd);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1667,7 +1667,7 @@ int qemuMonitorTextRemoveHostNetwork(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to remove host network in qemu with '%s'"), cmd);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1702,7 +1702,7 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
|
|||
int ret = -1;
|
||||
|
||||
if (qemuMonitorCommand(mon, "info chardev", &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "%s",
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||
_("failed to retrieve chardev info in qemu with 'info chardev'"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1753,7 +1753,7 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (virHashAddEntry(paths, id, path) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to save chardev path '%s'"),
|
||||
path);
|
||||
VIR_FREE(path);
|
||||
|
@ -1787,7 +1787,7 @@ try_command:
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("cannot attach %s disk controller"), bus);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1800,7 +1800,7 @@ try_command:
|
|||
goto try_command;
|
||||
}
|
||||
|
||||
qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("adding %s disk controller failed: %s"), bus, reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1887,7 +1887,7 @@ try_command:
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("failed to close fd in qemu with '%s'"), cmd);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1899,7 +1899,7 @@ try_command:
|
|||
tryOldSyntax = 1;
|
||||
goto try_command;
|
||||
}
|
||||
qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("adding %s disk failed: %s"), drivestr, reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1954,7 +1954,7 @@ 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, \
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED, \
|
||||
_("cannot parse value for %s"), #val); \
|
||||
break; \
|
||||
}
|
||||
|
@ -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,13 +2064,13 @@ int qemuMonitorTextAddDevice(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("cannot attach %s device"), devicestr);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (STRNEQ(reply, "")) {
|
||||
qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("adding %s device failed: %s"), devicestr, reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -2107,7 +2107,7 @@ int qemuMonitorTextAddDrive(qemuMonitorPtr mon,
|
|||
}
|
||||
|
||||
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
|
||||
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
|
||||
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