strcpy(driver->vncListen, "127.0.0.1");
if (!(driver->vncTLSx509certdir = strdup(SYSCONF_DIR "/pki/libvirt-vnc"))) {
qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY,
- "vncTLSx509certdir");
+ "%s", _("failed to allocate vncTLSx509certdir"));
return -1;
}
free(driver->vncTLSx509certdir);
if (!(driver->vncTLSx509certdir = strdup(p->str))) {
qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY,
- "vncTLSx509certdir");
+ "%s", _("failed to allocate vncTLSx509certdir"));
virConfFree(conf);
return -1;
}
if (stat(binary, &sb) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Cannot find QEMU binary %s: %s", binary,
+ _("Cannot find QEMU binary %s: %s"), binary,
strerror(errno));
return -1;
}
!strcmp((const char *)device, "floppy") &&
strcmp((const char *)target, "fda") &&
strcmp((const char *)target, "fdb")) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "Invalid floppy device name: %s", target);
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("Invalid floppy device name: %s"), target);
goto error;
}
if (device &&
!strcmp((const char *)device, "cdrom") &&
strcmp((const char *)target, "hdc")) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "Invalid cdrom device name: %s", target);
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("Invalid cdrom device name: %s"), target);
goto error;
}
strcmp((const char *)target, "hdb") &&
strcmp((const char *)target, "hdc") &&
strcmp((const char *)target, "hdd")) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "Invalid harddisk device name: %s", target);
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("Invalid harddisk device name: %s"), target);
goto error;
}
else if (!strcmp((const char *)device, "floppy"))
disk->device = QEMUD_DISK_FLOPPY;
else {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "Invalid device type: %s", device);
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("Invalid device type: %s"), device);
goto error;
}
if (network == NULL) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "No <source> 'network' attribute specified with <interface type='network'/>");
+ "%s", _("No <source> 'network' attribute specified with <interface type='network'/>"));
goto error;
} else if ((len = xmlStrlen(network)) >= (QEMUD_MAX_NAME_LEN-1)) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Network name '%s' too long", network);
+ _("Network name '%s' too long"), network);
goto error;
} else {
strncpy(net->dst.network.name, (char *)network, len);
if (ifname != NULL) {
if ((len = xmlStrlen(ifname)) >= (BR_IFNAME_MAXLEN-1)) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "TAP interface name '%s' is too long", ifname);
+ _("TAP interface name '%s' is too long"),
+ ifname);
goto error;
} else {
strncpy(net->dst.network.ifname, (char *)ifname, len);
if (script != NULL) {
if ((len = xmlStrlen(script)) >= (PATH_MAX-1)) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "TAP script path '%s' is too long", script);
+ _("TAP script path '%s' is too long"), script);
goto error;
} else {
strncpy(net->dst.ethernet.script, (char *)script, len);
if (ifname != NULL) {
if ((len = xmlStrlen(ifname)) >= (BR_IFNAME_MAXLEN-1)) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "TAP interface name '%s' is too long", ifname);
+ _("TAP interface name '%s' is too long"),
+ ifname);
goto error;
} else {
strncpy(net->dst.ethernet.ifname, (char *)ifname, len);
if (bridge == NULL) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "No <source> 'dev' attribute specified with <interface type='bridge'/>");
+ "%s", _("No <source> 'dev' attribute specified with <interface type='bridge'/>"));
goto error;
} else if ((len = xmlStrlen(bridge)) >= (BR_IFNAME_MAXLEN-1)) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "TAP bridge path '%s' is too long", bridge);
+ _("TAP bridge path '%s' is too long"), bridge);
goto error;
} else {
strncpy(net->dst.bridge.brname, (char *)bridge, len);
if (ifname != NULL) {
if ((len = xmlStrlen(ifname)) >= (BR_IFNAME_MAXLEN-1)) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "TAP interface name '%s' is too long", ifname);
+ _("TAP interface name '%s' is too long"), ifname);
goto error;
} else {
strncpy(net->dst.bridge.ifname, (char *)ifname, len);
if (port == NULL) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "No <source> 'port' attribute specified with socket interface");
+ "%s", _("No <source> 'port' attribute specified with socket interface"));
goto error;
}
if (!(net->dst.socket.port = strtol((char*)port, &ret, 10)) &&
ret == (char*)port) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Cannot parse <source> 'port' attribute with socket interface");
+ "%s", _("Cannot parse <source> 'port' attribute with socket interface"));
goto error;
}
xmlFree(port);
if (net->type == QEMUD_NET_CLIENT ||
net->type == QEMUD_NET_MCAST) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "No <source> 'address' attribute specified with socket interface");
+ "%s", _("No <source> 'address' attribute specified with socket interface"));
goto error;
}
} else if ((len = xmlStrlen(address)) >= (BR_INET_ADDR_MAXLEN)) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "IP address '%s' is too long", address);
+ _("IP address '%s' is too long"), address);
goto error;
}
if (address == NULL) {
bus = xmlGetProp(node, BAD_CAST "bus");
if (!type) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "no type provide for input device");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("missing input device type"));
goto error;
}
} else if (!strcmp((const char *)type, "tablet")) {
input->type = QEMU_INPUT_TYPE_TABLET;
} else {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "unsupported input device type %s", (const char*)type);
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("unsupported input device type %s"),
+ (const char*)type);
goto error;
}
if (bus) {
if (!strcmp((const char*)bus, "ps2")) { /* Only allow mouse */
if (input->type == QEMU_INPUT_TYPE_TABLET) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "ps2 bus does not support %s input device", (const char*)type);
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("ps2 bus does not support %s input device"),
+ (const char*)type);
goto error;
}
input->bus = QEMU_INPUT_BUS_PS2;
} else if (!strcmp((const char *)bus, "usb")) { /* Allow mouse & keyboard */
input->bus = QEMU_INPUT_BUS_USB;
} else {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "unsupported input bus %s", (const char*)bus);
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("unsupported input bus %s"), (const char*)bus);
goto error;
}
} else {
struct qemud_vm_def *def;
if (!(def = calloc(1, sizeof(*def)))) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "xmlXPathContext");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for xmlXPathContext"));
return NULL;
}
/* Prepare parser / xpath context */
root = xmlDocGetRootElement(xml);
if ((root == NULL) || (!xmlStrEqual(root->name, BAD_CAST "domain"))) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "incorrect root element");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("incorrect root element"));
goto error;
}
ctxt = xmlXPathNewContext(xml);
if (ctxt == NULL) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "xmlXPathContext");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for xmlXPathContext"));
goto error;
}
/* Find out what type of QEMU virtualization to use */
if (!(prop = xmlGetProp(root, BAD_CAST "type"))) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "missing domain type attribute");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("missing domain type attribute"));
goto error;
}
else if (!strcmp((char *)prop, "kvm"))
def->virtType = QEMUD_VIRT_KVM;
else {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "invalid domain type attribute");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("invalid domain type attribute"));
goto error;
}
free(prop);
goto error;
}
if (strlen((const char *)obj->stringval) >= (QEMUD_MAX_NAME_LEN-1)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "domain name length too long");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("domain name length too long"));
goto error;
}
strcpy(def->name, (const char *)obj->stringval);
int err;
if ((err = virUUIDGenerate(def->uuid))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Failed to generate UUID: %s", strerror(err));
+ _("Failed to generate UUID: %s"), strerror(err));
goto error;
}
} else if (virUUIDParse((const char *)obj->stringval, def->uuid) < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "malformed uuid element");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("malformed uuid element"));
goto error;
}
xmlXPathFreeObject(obj);
obj = xmlXPathEval(BAD_CAST "string(/domain/memory[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) ||
(obj->stringval == NULL) || (obj->stringval[0] == 0)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "missing memory element");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("missing memory element"));
goto error;
} else {
conv = NULL;
def->maxmem = strtoll((const char*)obj->stringval, &conv, 10);
if (conv == (const char*)obj->stringval) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "malformed memory information");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("malformed memory information"));
goto error;
}
}
if (def->memory > def->maxmem)
def->memory = def->maxmem;
if (conv == (const char*)obj->stringval) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "malformed memory information");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("malformed memory information"));
goto error;
}
}
conv = NULL;
def->vcpus = strtoll((const char*)obj->stringval, &conv, 10);
if (conv == (const char*)obj->stringval) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "malformed vcpu information");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("malformed vcpu information"));
goto error;
}
}
obj = xmlXPathEval(BAD_CAST "string(/domain/os/type[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) ||
(obj->stringval == NULL) || (obj->stringval[0] == 0)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OS_TYPE, "no OS type");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_OS_TYPE,
+ "%s", _("no OS type"));
goto error;
}
if (!virCapabilitiesSupportsGuestOSType(driver->caps, (const char*)obj->stringval)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OS_TYPE, "%s", obj->stringval);
+ qemudReportError(conn, NULL, NULL, VIR_ERR_OS_TYPE,
+ "%s", obj->stringval);
goto error;
}
strcpy(def->os.type, (const char *)obj->stringval);
(obj->stringval == NULL) || (obj->stringval[0] == 0)) {
const char *defaultArch = virCapabilitiesDefaultGuestArch(driver->caps, def->os.type);
if (defaultArch == NULL) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "unsupported architecture");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("unsupported architecture"));
goto error;
}
if (strlen(defaultArch) >= (QEMUD_OS_TYPE_MAX_LEN-1)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "architecture type too long");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("architecture type too long"));
goto error;
}
strcpy(def->os.arch, defaultArch);
} else {
if (strlen((const char *)obj->stringval) >= (QEMUD_OS_TYPE_MAX_LEN-1)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "architecture type too long");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("architecture type too long"));
goto error;
}
strcpy(def->os.arch, (const char *)obj->stringval);
def->os.type,
def->os.arch);
if (defaultMachine == NULL) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "unsupported architecture");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("unsupported architecture"));
goto error;
}
if (strlen(defaultMachine) >= (QEMUD_OS_MACHINE_MAX_LEN-1)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "machine type too long");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("machine type too long"));
goto error;
}
strcpy(def->os.machine, defaultMachine);
} else {
if (strlen((const char *)obj->stringval) >= (QEMUD_OS_MACHINE_MAX_LEN-1)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "architecture type too long");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("architecture type too long"));
goto error;
}
strcpy(def->os.machine, (const char *)obj->stringval);
if ((obj != NULL) && (obj->type == XPATH_STRING) &&
(obj->stringval != NULL) && (obj->stringval[0] != 0)) {
if (strlen((const char *)obj->stringval) >= (PATH_MAX-1)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "kernel path too long");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("kernel path too long"));
goto error;
}
strcpy(def->os.kernel, (const char *)obj->stringval);
if ((obj != NULL) && (obj->type == XPATH_STRING) &&
(obj->stringval != NULL) && (obj->stringval[0] != 0)) {
if (strlen((const char *)obj->stringval) >= (PATH_MAX-1)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "initrd path too long");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("initrd path too long"));
goto error;
}
strcpy(def->os.initrd, (const char *)obj->stringval);
if ((obj != NULL) && (obj->type == XPATH_STRING) &&
(obj->stringval != NULL) && (obj->stringval[0] != 0)) {
if (strlen((const char *)obj->stringval) >= (PATH_MAX-1)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "cmdline arguments too long");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("cmdline arguments too long"));
goto error;
}
strcpy(def->os.cmdline, (const char *)obj->stringval);
def->os.bootDevs[def->os.nBootDevs++] = QEMUD_BOOT_NET;
} else {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "unknown boot dev \'%s\'", (char*)prop);
+ _("unknown boot device \'%s\'"), (char*)prop);
goto error;
}
xmlFree(prop);
def->os.arch,
type);
if (!emulator) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "unsupported guest type");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("unsupported guest type"));
goto error;
}
strcpy(def->os.binary, emulator);
} else {
if (strlen((const char *)obj->stringval) >= (PATH_MAX-1)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "emulator path too long");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("emulator path too long"));
goto error;
}
strcpy(def->os.binary, (const char *)obj->stringval);
} else if (!strcmp((char *)prop, "sdl")) {
def->graphicsType = QEMUD_GRAPHICS_SDL;
} else {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "Unsupported graphics type %s", prop);
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("Unsupported graphics type %s"), prop);
goto error;
}
xmlFree(prop);
for (i = 0; i < obj->nodesetval->nodeNr; i++) {
struct qemud_vm_disk_def *disk = calloc(1, sizeof(*disk));
if (!disk) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "disk");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for disk string"));
goto error;
}
if (qemudParseDiskXML(conn, disk, obj->nodesetval->nodeTab[i]) < 0) {
for (i = 0; i < obj->nodesetval->nodeNr; i++) {
struct qemud_vm_net_def *net = calloc(1, sizeof(*net));
if (!net) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "net");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for net string"));
goto error;
}
if (qemudParseInterfaceXML(conn, net, obj->nodesetval->nodeTab[i]) < 0) {
for (i = 0; i < obj->nodesetval->nodeNr; i++) {
struct qemud_vm_input_def *input = calloc(1, sizeof(*input));
if (!input) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "input");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for input string"));
goto error;
}
if (qemudParseInputXML(conn, input, obj->nodesetval->nodeTab[i]) < 0) {
if (!hasPS2mouse) {
input = calloc(1, sizeof(*input));
if (!input) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "input");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for input string"));
goto error;
}
input->type = QEMU_INPUT_TYPE_MOUSE;
if (net->type == QEMUD_NET_NETWORK) {
if (!(network = qemudFindNetworkByName(driver, net->dst.network.name))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Network '%s' not found", net->dst.network.name);
+ _("Network '%s' not found"),
+ net->dst.network.name);
goto error;
} else if (network->bridge[0] == '\0') {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Network '%s' not active", net->dst.network.name);
+ _("Network '%s' not active"),
+ net->dst.network.name);
goto error;
}
brname = network->bridge;
ifname = net->dst.bridge.ifname;
} else {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Network type %d is not supported", net->type);
+ _("Network type %d is not supported"), net->type);
goto error;
}
if (!driver->brctl && (err = brInit(&driver->brctl))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot initialize bridge support: %s", strerror(err));
+ _("cannot initialize bridge support: %s"),
+ strerror(err));
goto error;
}
if ((err = brAddTap(driver->brctl, brname,
ifname, BR_IFNAME_MAXLEN, &tapfd))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Failed to add tap interface '%s' to bridge '%s' : %s",
+ _("Failed to add tap interface '%s' to bridge '%s' : %s"),
ifname, brname, strerror(err));
goto error;
}
return retval;
no_memory:
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "tapfds");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for tapfds string"));
error:
free(retval);
if (tapfd != -1)
*/
if (stat(vm->def->os.binary, &sb) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Cannot find QEMU binary %s: %s", vm->def->os.binary,
+ _("Cannot find QEMU binary %s: %s"),
+ vm->def->os.binary,
strerror(errno));
return -1;
}
return 0;
no_memory:
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "argv");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for argv string"));
error:
if (vm->tapfds) {
for (i = 0; vm->tapfds[i] != -1; i++)
O_WRONLY | O_CREAT | O_TRUNC,
S_IRUSR | S_IWUSR )) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot create config file %s: %s",
+ _("cannot create config file %s: %s"),
vm->configFile, strerror(errno));
goto cleanup;
}
towrite = strlen(xml);
if (safewrite(fd, xml, towrite) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot write config file %s: %s",
+ _("cannot write config file %s: %s"),
vm->configFile, strerror(errno));
goto cleanup;
}
if (close(fd) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot save config file %s: %s",
+ _("cannot save config file %s: %s"),
vm->configFile, strerror(errno));
goto cleanup;
}
node = xmlDocGetRootElement(xml);
if (node == NULL) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_XML_ERROR, "missing root element");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_XML_ERROR,
+ "%s", _("missing root element"));
goto error;
}
if (xmlStrEqual(node->name, BAD_CAST "disk")) {
dev->type = QEMUD_DEVICE_DISK;
qemudParseInputXML(conn, &(dev->data.input), node);
} else {
- qemudReportError(conn, NULL, NULL, VIR_ERR_XML_ERROR, "unknown device type");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_XML_ERROR,
+ "%s", _("unknown device type"));
goto error;
}
}
if (!(vm = calloc(1, sizeof(*vm)))) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "vm");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for vm string"));
return NULL;
}
if ((err = virFileMakePath(driver->configDir))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot create config directory %s: %s",
+ _("cannot create config directory %s: %s"),
driver->configDir, strerror(err));
return -1;
}
if (virFileBuildPath(driver->configDir, def->name, ".xml",
vm->configFile, PATH_MAX) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot construct config file path");
+ "%s", _("cannot construct config file path"));
return -1;
}
if (virFileBuildPath(driver->autostartDir, def->name, ".xml",
vm->autostartLink, PATH_MAX) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot construct autostart link path");
+ "%s", _("cannot construct autostart link path"));
vm->configFile[0] = '\0';
return -1;
}
if ((err = virFileMakePath(driver->networkConfigDir))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot create config directory %s: %s",
+ _("cannot create config directory %s: %s"),
driver->networkConfigDir, strerror(err));
goto cleanup;
}
O_WRONLY | O_CREAT | O_TRUNC,
S_IRUSR | S_IWUSR )) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot create config file %s: %s",
+ _("cannot create config file %s: %s"),
network->configFile, strerror(errno));
goto cleanup;
}
towrite = strlen(xml);
if (safewrite(fd, xml, towrite) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot write config file %s: %s",
+ _("cannot write config file %s: %s"),
network->configFile, strerror(errno));
goto cleanup;
}
if (close(fd) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot save config file %s: %s",
+ _("cannot save config file %s: %s"),
network->configFile, strerror(errno));
goto cleanup;
}
}
if (!(range = calloc(1, sizeof(*range)))) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "range");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for range string"));
return 0;
}
struct qemud_network_def *def;
if (!(def = calloc(1, sizeof(*def)))) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "network_def");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for network_def string"));
return NULL;
}
/* Prepare parser / xpath context */
root = xmlDocGetRootElement(xml);
if ((root == NULL) || (!xmlStrEqual(root->name, BAD_CAST "network"))) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "incorrect root element");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("incorrect root element"));
goto error;
}
ctxt = xmlXPathNewContext(xml);
if (ctxt == NULL) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "xmlXPathContext");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for xmlXPathContext string"));
goto error;
}
goto error;
}
if (strlen((const char *)obj->stringval) >= (QEMUD_MAX_NAME_LEN-1)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "network name length too long");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("network name length too long"));
goto error;
}
strcpy(def->name, (const char *)obj->stringval);
int err;
if ((err = virUUIDGenerate(def->uuid))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Failed to generate UUID: %s", strerror(err));
+ _("Failed to generate UUID: %s"), strerror(err));
goto error;
}
} else if (virUUIDParse((const char *)obj->stringval, def->uuid) < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "malformed uuid element");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("malformed uuid element"));
goto error;
}
xmlXPathFreeObject(obj);
if (!def->ipAddress[0] ||
!def->netmask[0]) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Forwarding requested, but no IPv4 address/netmask provided");
+ "%s", _("Forwarding requested, but no IPv4 address/netmask provided"));
goto error;
}
int len;
if ((len = xmlStrlen(tmp->stringval)) >= (BR_IFNAME_MAXLEN-1)) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "forward device name '%s' is too long",
+ _("forward device name '%s' is too long"),
(char*)tmp->stringval);
goto error;
}
}
if (!(network = calloc(1, sizeof(*network)))) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "network");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for network string"));
return NULL;
}
if ((err = virFileMakePath(driver->networkConfigDir))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot create config directory %s: %s",
+ _("cannot create config directory %s: %s"),
driver->networkConfigDir, strerror(err));
return -1;
}
if (virFileBuildPath(driver->networkConfigDir, def->name, ".xml",
network->configFile, PATH_MAX) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot construct config file path");
+ "%s", _("cannot construct config file path"));
return -1;
}
if (virFileBuildPath(driver->networkAutostartDir, def->name, ".xml",
network->autostartLink, PATH_MAX) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot construct autostart link path");
+ "%s", _("cannot construct autostart link path"));
network->configFile[0] = '\0';
return -1;
}
break;
}
if (!type) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "unexpected domain type %d", def->virtType);
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("unexpected domain type %d"), def->virtType);
goto cleanup;
}
return virBufferContentAndFree (buf);
no_memory:
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "xml");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to generate XML: out of memory"));
cleanup:
if (buf) virBufferFree (buf);
return NULL;
return virBufferContentAndFree (buf);
no_memory:
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "xml");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to generate XML: out of memory"));
if (buf) virBufferFree (buf);
return NULL;
}
const char *configFile,
const char *name) {
if (!configFile[0]) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "no config file for %s", name);
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("no config file for %s"), name);
return -1;
}
if (unlink(configFile) < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "cannot remove config for %s", name);
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("cannot remove config for %s"), name);
return -1;
}