if (!cmdname) {
vshCmdDef *def;
- vshPrint(ctl, _("Commands:\n\n"));
+ vshPrint(ctl, "%s", _("Commands:\n\n"));
for (def = commands; def->name; def++)
vshPrint(ctl, " %-15s %s\n", def->name,
N_(vshCmddefGetInfo(def, "help")));
if (ctl->conn) {
if (virConnectClose(ctl->conn) != 0) {
- vshError(ctl, FALSE,
+ vshError(ctl, FALSE, "%s",
_("Failed to disconnect from the hypervisor"));
return FALSE;
}
}
if (!ctl->conn)
- vshError(ctl, FALSE, _("Failed to connect to the hypervisor"));
+ vshError(ctl, FALSE, "%s", _("Failed to connect to the hypervisor"));
return ctl->conn ? TRUE : FALSE;
}
if (vshRunConsole((const char *)obj->stringval) == 0)
ret = TRUE;
} else {
- vshPrintExtra(ctl, _("No console available for domain\n"));
+ vshPrintExtra(ctl, "%s", _("No console available for domain\n"));
}
xmlXPathFreeObject(obj);
static int
cmdConsole(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
{
- vshError (ctl, FALSE, _("console not implemented on this platform"));
+ vshError (ctl, FALSE, "%s", _("console not implemented on this platform"));
return FALSE;
}
if (active) {
maxid = virConnectNumOfDomains(ctl->conn);
if (maxid < 0) {
- vshError(ctl, FALSE, _("Failed to list active domains"));
+ vshError(ctl, FALSE, "%s", _("Failed to list active domains"));
return FALSE;
}
if (maxid) {
ids = vshMalloc(ctl, sizeof(int) * maxid);
if ((maxid = virConnectListDomains(ctl->conn, &ids[0], maxid)) < 0) {
- vshError(ctl, FALSE, _("Failed to list active domains"));
+ vshError(ctl, FALSE, "%s", _("Failed to list active domains"));
free(ids);
return FALSE;
}
if (inactive) {
maxname = virConnectNumOfDefinedDomains(ctl->conn);
if (maxname < 0) {
- vshError(ctl, FALSE, _("Failed to list inactive domains"));
+ vshError(ctl, FALSE, "%s", _("Failed to list inactive domains"));
if (ids)
free(ids);
return FALSE;
names = vshMalloc(ctl, sizeof(char *) * maxname);
if ((maxname = virConnectListDefinedDomains(ctl->conn, names, maxname)) < 0) {
- vshError(ctl, FALSE, _("Failed to list inactive domains"));
+ vshError(ctl, FALSE, "%s", _("Failed to list inactive domains"));
if (ids)
free(ids);
free(names);
return FALSE;
if (virDomainGetID(dom) != (unsigned int)-1) {
- vshError(ctl, FALSE, _("Domain is already active"));
+ vshError(ctl, FALSE, "%s", _("Domain is already active"));
virDomainFree(dom);
return FALSE;
}
if(vshCommandOptBool(cmd, "weight")) {
weight = vshCommandOptInt(cmd, "weight", &weightfound);
if (!weightfound) {
- vshError(ctl, FALSE, _("Invalid value of weight"));
+ vshError(ctl, FALSE, "%s", _("Invalid value of weight"));
goto cleanup;
} else {
nr_inputparams++;
if(vshCommandOptBool(cmd, "cap")) {
cap = vshCommandOptInt(cmd, "cap", &capfound);
if (!capfound) {
- vshError(ctl, FALSE, _("Invalid value of cap"));
+ vshError(ctl, FALSE, "%s", _("Invalid value of cap"));
goto cleanup;
} else {
nr_inputparams++;
}
} else {
if (info.state == VIR_DOMAIN_SHUTOFF) {
- vshError(ctl, FALSE,
+ vshError(ctl, FALSE, "%s",
_("Domain shut off, virtual CPUs not present."));
}
ret = FALSE;
* numbers and give an intelligent error message if not.
*/
if (cpulist[0] == '\0') {
- vshError(ctl, FALSE, _("cpulist: Invalid format. Empty string."));
+ vshError(ctl, FALSE, "%s", _("cpulist: Invalid format. Empty string."));
virDomainFree (dom);
return FALSE;
}
count = vshCommandOptInt(cmd, "count", &count);
if (count <= 0) {
- vshError(ctl, FALSE, _("Invalid number of virtual CPUs."));
+ vshError(ctl, FALSE, "%s", _("Invalid number of virtual CPUs."));
virDomainFree(dom);
return FALSE;
}
}
if (count > maxcpu) {
- vshError(ctl, FALSE, _("Too many virtual CPUs."));
+ vshError(ctl, FALSE, "%s", _("Too many virtual CPUs."));
virDomainFree(dom);
return FALSE;
}
if (virDomainGetInfo(dom, &info) != 0) {
virDomainFree(dom);
- vshError(ctl, FALSE, _("Unable to verify MaxMemorySize"));
+ vshError(ctl, FALSE, "%s", _("Unable to verify MaxMemorySize"));
return FALSE;
}
if (virDomainGetInfo(dom, &info) != 0) {
virDomainFree(dom);
- vshError(ctl, FALSE, _("Unable to verify current MemorySize"));
+ vshError(ctl, FALSE, "%s", _("Unable to verify current MemorySize"));
return FALSE;
}
if (kilobytes < info.memory) {
if (virDomainSetMemory(dom, kilobytes) != 0) {
virDomainFree(dom);
- vshError(ctl, FALSE, _("Unable to shrink current MemorySize"));
+ vshError(ctl, FALSE, "%s", _("Unable to shrink current MemorySize"));
return FALSE;
}
}
if (virDomainSetMaxMemory(dom, kilobytes) != 0) {
- vshError(ctl, FALSE, _("Unable to change MaxMemorySize"));
+ vshError(ctl, FALSE, "%s", _("Unable to change MaxMemorySize"));
ret = FALSE;
}
return FALSE;
if (virNodeGetInfo(ctl->conn, &info) < 0) {
- vshError(ctl, FALSE, _("failed to get node information"));
+ vshError(ctl, FALSE, "%s", _("failed to get node information"));
return FALSE;
}
vshPrint(ctl, "%-20s %s\n", _("CPU model:"), info.model);
return FALSE;
if ((caps = virConnectGetCapabilities (ctl->conn)) == NULL) {
- vshError(ctl, FALSE, _("failed to get capabilities"));
+ vshError(ctl, FALSE, "%s", _("failed to get capabilities"));
return FALSE;
}
vshPrint (ctl, "%s\n", caps);
if (virDomainGetUUIDString(dom, uuid) != -1)
vshPrint(ctl, "%s\n", uuid);
else
- vshError(ctl, FALSE, _("failed to get domain UUID"));
+ vshError(ctl, FALSE, "%s", _("failed to get domain UUID"));
return TRUE;
}
desturi = vshCommandOptString (cmd, "desturi", &found);
if (!found) {
- vshError (ctl, FALSE, _("migrate: Missing desturi"));
+ vshError (ctl, FALSE, "%s", _("migrate: Missing desturi"));
goto done;
}
if (active) {
maxactive = virConnectNumOfNetworks(ctl->conn);
if (maxactive < 0) {
- vshError(ctl, FALSE, _("Failed to list active networks"));
+ vshError(ctl, FALSE, "%s", _("Failed to list active networks"));
return FALSE;
}
if (maxactive) {
if ((maxactive = virConnectListNetworks(ctl->conn, activeNames,
maxactive)) < 0) {
- vshError(ctl, FALSE, _("Failed to list active networks"));
+ vshError(ctl, FALSE, "%s", _("Failed to list active networks"));
free(activeNames);
return FALSE;
}
if (inactive) {
maxinactive = virConnectNumOfDefinedNetworks(ctl->conn);
if (maxinactive < 0) {
- vshError(ctl, FALSE, _("Failed to list inactive networks"));
+ vshError(ctl, FALSE, "%s", _("Failed to list inactive networks"));
if (activeNames)
free(activeNames);
return FALSE;
inactiveNames = vshMalloc(ctl, sizeof(char *) * maxinactive);
if ((maxinactive = virConnectListDefinedNetworks(ctl->conn, inactiveNames, maxinactive)) < 0) {
- vshError(ctl, FALSE, _("Failed to list inactive networks"));
+ vshError(ctl, FALSE, "%s", _("Failed to list inactive networks"));
if (activeNames)
free(activeNames);
free(inactiveNames);
if (virNetworkGetUUIDString(network, uuid) != -1)
vshPrint(ctl, "%s\n", uuid);
else
- vshError(ctl, FALSE, _("failed to get network UUID"));
+ vshError(ctl, FALSE, "%s", _("failed to get network UUID"));
return TRUE;
}
hvType = virConnectGetType(ctl->conn);
if (hvType == NULL) {
- vshError(ctl, FALSE, _("failed to get hypervisor type"));
+ vshError(ctl, FALSE, "%s", _("failed to get hypervisor type"));
return FALSE;
}
ret = virGetVersion(&libVersion, hvType, &apiVersion);
if (ret < 0) {
- vshError(ctl, FALSE, _("failed to get the library version"));
+ vshError(ctl, FALSE, "%s", _("failed to get the library version"));
return FALSE;
}
major = libVersion / 1000000;
ret = virConnectGetVersion(ctl->conn, &hvVersion);
if (ret < 0) {
- vshError(ctl, FALSE, _("failed to get the hypervisor version"));
+ vshError(ctl, FALSE, "%s", _("failed to get the hypervisor version"));
return FALSE;
}
if (hvVersion == 0) {
hostname = virConnectGetHostname (ctl->conn);
if (hostname == NULL) {
- vshError(ctl, FALSE, _("failed to get hostname"));
+ vshError(ctl, FALSE, "%s", _("failed to get hostname"));
return FALSE;
}
uri = virConnectGetURI (ctl->conn);
if (uri == NULL) {
- vshError(ctl, FALSE, _("failed to get URI"));
+ vshError(ctl, FALSE, "%s", _("failed to get URI"));
return FALSE;
}
XML_PARSE_NOWARNING);
free(doc);
if (!xml) {
- vshError(ctl, FALSE, _("Failed to get interface information"));
+ vshError(ctl, FALSE, "%s", _("Failed to get interface information"));
goto cleanup;
}
ctxt = xmlXPathNewContext(xml);
if (!ctxt) {
- vshError(ctl, FALSE, _("Failed to get interface information"));
+ vshError(ctl, FALSE, "%s", _("Failed to get interface information"));
goto cleanup;
}
hit:
xml_buf = xmlBufferCreate();
if (!xml_buf) {
- vshError(ctl, FALSE, _("Failed to allocate memory"));
+ vshError(ctl, FALSE, "%s", _("Failed to allocate memory"));
goto cleanup;
}
if(xmlNodeDump(xml_buf, xml, obj->nodesetval->nodeTab[i], 0, 0) < 0){
- vshError(ctl, FALSE, _("Failed to create XML"));
+ vshError(ctl, FALSE, "%s", _("Failed to create XML"));
goto cleanup;
}
XML_PARSE_NOWARNING);
free(doc);
if (!xml) {
- vshError(ctl, FALSE, _("Failed to get disk information"));
+ vshError(ctl, FALSE, "%s", _("Failed to get disk information"));
goto cleanup;
}
ctxt = xmlXPathNewContext(xml);
if (!ctxt) {
- vshError(ctl, FALSE, _("Failed to get disk information"));
+ vshError(ctl, FALSE, "%s", _("Failed to get disk information"));
goto cleanup;
}
obj = xmlXPathEval(BAD_CAST "/domain/devices/disk", ctxt);
if ((obj == NULL) || (obj->type != XPATH_NODESET) ||
(obj->nodesetval == NULL) || (obj->nodesetval->nodeNr == 0)) {
- vshError(ctl, FALSE, _("Failed to get disk information"));
+ vshError(ctl, FALSE, "%s", _("Failed to get disk information"));
goto cleanup;
}
hit:
xml_buf = xmlBufferCreate();
if (!xml_buf) {
- vshError(ctl, FALSE, _("Failed to allocate memory"));
+ vshError(ctl, FALSE, "%s", _("Failed to allocate memory"));
goto cleanup;
}
if(xmlNodeDump(xml_buf, xml, obj->nodesetval->nodeTab[i], 0, 0) < 0){
- vshError(ctl, FALSE, _("Failed to create XML"));
+ vshError(ctl, FALSE, "%s", _("Failed to create XML"));
goto cleanup;
}
int id;
if (!(n = vshCommandOptString(cmd, optname, NULL))) {
- vshError(ctl, FALSE, _("undefined domain name or id"));
+ vshError(ctl, FALSE, "%s", _("undefined domain name or id"));
return NULL;
}
char *n;
if (!(n = vshCommandOptString(cmd, optname, NULL))) {
- vshError(ctl, FALSE, _("undefined network name"));
+ vshError(ctl, FALSE, "%s", _("undefined network name"));
return NULL;
}
sz++;
}
if (quote) {
- vshError(ctl, FALSE, _("missing \""));
+ vshError(ctl, FALSE, "%s", _("missing \""));
return VSH_TK_ERROR;
}
if (tkstr == NULL || *tkstr == '\0' || p == NULL)
*/
if (!conn) {
if (showerror)
- vshError(ctl, FALSE, _("no valid connection"));
+ vshError(ctl, FALSE, "%s", _("no valid connection"));
return FALSE;
}
return TRUE;
* such as "help".
*/
if (!ctl->conn) {
- vshError(ctl, FALSE, _("failed to connect to the hypervisor"));
+ vshError(ctl, FALSE, "%s", _("failed to connect to the hypervisor"));
return FALSE;
}
case ENOENT:
break;
default:
- vshError(ctl, TRUE, _("failed to get the log file information"));
+ vshError(ctl, TRUE, "%s",
+ _("failed to get the log file information"));
break;
}
} else {
if (!S_ISREG(st.st_mode)) {
- vshError(ctl, TRUE, _("the log path is not a file"));
+ vshError(ctl, TRUE, "%s", _("the log path is not a file"));
}
}
/* log file open */
if ((ctl->log_fd = open(ctl->logfile, LOGFILE_FLAGS, FILE_MODE)) < 0) {
- vshError(ctl, TRUE, _("failed to open the log file. check the log file path"));
+ vshError(ctl, TRUE, "%s",
+ _("failed to open the log file. check the log file path"));
}
}
/* write log */
if (write(ctl->log_fd, msg_buf, strlen(msg_buf)) == -1) {
vshCloseLogFile(ctl);
- vshError(ctl, FALSE, _("failed to write the log file"));
+ vshError(ctl, FALSE, "%s", _("failed to write the log file"));
}
}
" %-15s %s\n", cmd->name, N_(vshCmddefGetInfo(cmd,
"help")));
- fprintf(stdout,
+ fprintf(stdout, "%s",
_("\n (specify help <command> for details about the command)\n\n"));
return;
}
vshPrint(ctl,
_("Welcome to %s, the virtualization interactive terminal.\n\n"),
progname);
- vshPrint(ctl,
+ vshPrint(ctl, "%s",
_("Type: 'help' for help with commands\n"
" 'quit' to quit\n\n"));
}