Devel
Threads by month
- ----- 2026 -----
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- 17 participants
- 40169 discussions
[Libvir] [PATCH 4/9] qemudReportError: mark for translation string args to this function
by Jim Meyering 28 Mar '08
by Jim Meyering 28 Mar '08
28 Mar '08
qemudReportError: mark for translation string args to this function
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
Makefile.maint | 2 +-
src/qemu_conf.c | 248 +++++++++++++++++++++++++++++++++--------------------
src/qemu_driver.c | 27 ++++--
3 files changed, 174 insertions(+), 103 deletions(-)
diff --git a/Makefile.maint b/Makefile.maint
index ccf6f5d..6e4868e 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -314,11 +314,11 @@ msg_gen_function += remoteDispatchError
msg_gen_function += virStorageLog
msg_gen_function += xenXMError
msg_gen_function += ReportError
+msg_gen_function += qemudReportError
# msg_gen_function += virXenError
# msg_gen_function += testError
# msg_gen_function += openvzLog
-# msg_gen_function += qemudReportError
# msg_gen_function += error
func_or := $(shell printf '$(msg_gen_function)'|tr -s '[[:space:]]' '|')
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index f6ae06b..bafea8c 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -82,7 +82,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
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;
}
@@ -117,7 +117,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
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;
}
@@ -530,7 +530,7 @@ int qemudExtractVersion(virConnectPtr conn,
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;
}
@@ -613,14 +613,16 @@ static int qemudParseDiskXML(virConnectPtr conn,
!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;
}
@@ -633,7 +635,8 @@ static int qemudParseDiskXML(virConnectPtr conn,
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;
}
@@ -653,7 +656,8 @@ static int qemudParseDiskXML(virConnectPtr conn,
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;
}
@@ -795,11 +799,11 @@ static int qemudParseInterfaceXML(virConnectPtr conn,
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);
@@ -814,7 +818,8 @@ static int qemudParseInterfaceXML(virConnectPtr conn,
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);
@@ -829,7 +834,7 @@ static int qemudParseInterfaceXML(virConnectPtr conn,
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);
@@ -841,7 +846,8 @@ static int qemudParseInterfaceXML(virConnectPtr conn,
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);
@@ -854,11 +860,11 @@ static int qemudParseInterfaceXML(virConnectPtr conn,
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);
@@ -871,7 +877,7 @@ static int qemudParseInterfaceXML(virConnectPtr conn,
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);
@@ -887,13 +893,13 @@ static int qemudParseInterfaceXML(virConnectPtr conn,
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);
@@ -903,12 +909,12 @@ static int qemudParseInterfaceXML(virConnectPtr conn,
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) {
@@ -950,7 +956,8 @@ static int qemudParseInputXML(virConnectPtr conn,
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;
}
@@ -959,21 +966,26 @@ static int qemudParseInputXML(virConnectPtr conn,
} 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 {
@@ -1016,27 +1028,31 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
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;
}
@@ -1047,7 +1063,8 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
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);
@@ -1062,7 +1079,8 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
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);
@@ -1076,11 +1094,12 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
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);
@@ -1090,13 +1109,15 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
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;
}
}
@@ -1114,7 +1135,8 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
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;
}
}
@@ -1129,7 +1151,8 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
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;
}
}
@@ -1175,11 +1198,13 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
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);
@@ -1191,17 +1216,20 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
(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);
@@ -1215,17 +1243,20 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
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);
@@ -1237,7 +1268,8 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
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);
@@ -1249,7 +1281,8 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
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);
@@ -1261,7 +1294,8 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
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);
@@ -1286,7 +1320,7 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
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);
@@ -1311,13 +1345,15 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
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);
@@ -1351,7 +1387,8 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
} 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);
@@ -1367,7 +1404,8 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
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) {
@@ -1395,7 +1433,8 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
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) {
@@ -1422,7 +1461,8 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
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) {
@@ -1462,7 +1502,8 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
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;
@@ -1505,11 +1546,13 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
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;
@@ -1529,20 +1572,21 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
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;
}
@@ -1564,7 +1608,8 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
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)
@@ -1597,7 +1642,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
*/
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;
}
@@ -1938,7 +1984,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
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++)
@@ -1972,7 +2019,7 @@ static int qemudSaveConfig(virConnectPtr conn,
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;
}
@@ -1980,14 +2027,14 @@ static int qemudSaveConfig(virConnectPtr conn,
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;
}
@@ -2021,7 +2068,8 @@ qemudParseVMDeviceDef(virConnectPtr conn,
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")) {
@@ -2034,7 +2082,8 @@ qemudParseVMDeviceDef(virConnectPtr conn,
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;
}
@@ -2093,7 +2142,8 @@ qemudAssignVMDef(virConnectPtr conn,
}
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;
}
@@ -2147,7 +2197,7 @@ qemudSaveVMDef(virConnectPtr conn,
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;
}
@@ -2155,14 +2205,14 @@ qemudSaveVMDef(virConnectPtr conn,
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;
}
@@ -2186,7 +2236,7 @@ static int qemudSaveNetworkConfig(virConnectPtr conn,
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;
}
@@ -2195,7 +2245,7 @@ static int qemudSaveNetworkConfig(virConnectPtr conn,
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;
}
@@ -2203,14 +2253,14 @@ static int qemudSaveNetworkConfig(virConnectPtr conn,
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;
}
@@ -2292,7 +2342,8 @@ static int qemudParseDhcpRangesXML(virConnectPtr conn,
}
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;
}
@@ -2384,20 +2435,23 @@ static struct qemud_network_def *qemudParseNetworkXML(virConnectPtr conn,
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;
}
@@ -2410,7 +2464,8 @@ static struct qemud_network_def *qemudParseNetworkXML(virConnectPtr conn,
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);
@@ -2424,11 +2479,12 @@ static struct qemud_network_def *qemudParseNetworkXML(virConnectPtr conn,
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);
@@ -2460,7 +2516,7 @@ static struct qemud_network_def *qemudParseNetworkXML(virConnectPtr conn,
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;
}
@@ -2471,7 +2527,7 @@ static struct qemud_network_def *qemudParseNetworkXML(virConnectPtr conn,
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;
}
@@ -2542,7 +2598,8 @@ qemudAssignNetworkDef(virConnectPtr conn,
}
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;
}
@@ -2590,7 +2647,7 @@ qemudSaveNetworkDef(virConnectPtr conn,
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;
}
@@ -2598,14 +2655,14 @@ qemudSaveNetworkDef(virConnectPtr conn,
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;
}
@@ -2801,7 +2858,8 @@ char *qemudGenerateXML(virConnectPtr conn,
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;
}
@@ -3069,7 +3127,8 @@ char *qemudGenerateXML(virConnectPtr conn,
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;
@@ -3160,7 +3219,8 @@ char *qemudGenerateNetworkXML(virConnectPtr conn,
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;
}
@@ -3171,12 +3231,14 @@ int qemudDeleteConfig(virConnectPtr conn,
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;
}
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 34abe14..d68f079 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -916,7 +916,8 @@ qemudBuildDnsmasqArgv(virConnectPtr conn,
free((*argv)[i]);
free(*argv);
}
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "dnsmasq argv");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for dnsmasq argv"));
return -1;
}
@@ -954,7 +955,8 @@ qemudAddIptablesRules(virConnectPtr conn,
int err;
if (!driver->iptables && !(driver->iptables = iptablesContextNew())) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "iptables support");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for IP tables support"));
return 1;
}
@@ -1492,7 +1494,8 @@ static char *qemudGetCapabilities(virConnectPtr conn) {
char *xml;
if ((xml = virCapabilitiesFormatXML(driver->caps)) == NULL) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "capabilities");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for capabilities support"));
return NULL;
}
@@ -1764,7 +1767,8 @@ static char *qemudDomainGetOSType(virDomainPtr dom) {
}
if (!(type = strdup(vm->def->os.type))) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_MEMORY, "ostype");
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for ostype"));
return NULL;
}
return type;
@@ -2194,7 +2198,8 @@ static int qemudListDefinedDomains(virConnectPtr conn,
while (vm && got < nnames) {
if (!qemudIsActiveVM(vm)) {
if (!(names[got] = strdup(vm->def->name))) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "names");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for VM name string"));
goto cleanup;
}
got++;
@@ -2706,7 +2711,8 @@ static int qemudListNetworks(virConnectPtr conn, char **const names, int nnames)
while (network && got < nnames) {
if (qemudIsActiveNetwork(network)) {
if (!(names[got] = strdup(network->def->name))) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "names");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for VM name string"));
goto cleanup;
}
got++;
@@ -2733,7 +2739,8 @@ static int qemudListDefinedNetworks(virConnectPtr conn, char **const names, int
while (network && got < nnames) {
if (!qemudIsActiveNetwork(network)) {
if (!(names[got] = strdup(network->def->name))) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "names");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for VM name string"));
goto cleanup;
}
got++;
@@ -2866,13 +2873,15 @@ static char *qemudNetworkGetBridgeName(virNetworkPtr net) {
struct qemud_network *network = qemudFindNetworkByUUID(driver, net->uuid);
char *bridge;
if (!network) {
- qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK, "no network with matching id");
+ qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK,
+ "%s", _("no network with matching id"));
return NULL;
}
bridge = strdup(network->bridge);
if (!bridge) {
- qemudReportError(net->conn, NULL, net, VIR_ERR_NO_MEMORY, "bridge");
+ qemudReportError(net->conn, NULL, net, VIR_ERR_NO_MEMORY,
+ "%s", _("failed to allocate space for network bridge string"));
return NULL;
}
return bridge;
--
1.5.5.rc0.22.g467c
2
4
[Libvir] [PATCH 8/9] testError: mark most string arguments for translation
by Jim Meyering 28 Mar '08
by Jim Meyering 28 Mar '08
28 Mar '08
testError: mark most string arguments for translation
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
Makefile.maint | 5 +++--
src/test.c | 30 +++++++++++++++---------------
2 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/Makefile.maint b/Makefile.maint
index 55a9677..518e59b 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -317,9 +317,10 @@ msg_gen_function += ReportError
msg_gen_function += qemudReportError
msg_gen_function += openvzLog
-# Uncomment this after adjusting remaining diagnostics to be translatable.
+# Uncomment the following and run "make syntax-check" to see diagnostics
+# that are not yet marked for translation, but that need to be rewritten
+# so that they are translatable.
# msg_gen_function += error
-
# msg_gen_function += virXenError
# msg_gen_function += testError
diff --git a/src/test.c b/src/test.c
index f401d7d..6cf3fda 100644
--- a/src/test.c
+++ b/src/test.c
@@ -1307,31 +1307,31 @@ static int testDomainSave(virDomainPtr domain,
xml = testDomainDumpXML(domain, 0);
if (xml == NULL) {
testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot allocate space for metadata");
+ _("cannot allocate space for metadata"));
return (-1);
}
if ((fd = open(path, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) {
testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot save domain");
+ _("cannot save domain"));
return (-1);
}
len = strlen(xml);
if (safewrite(fd, TEST_SAVE_MAGIC, sizeof(TEST_SAVE_MAGIC)) < 0) {
testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot write header");
+ _("cannot write header"));
close(fd);
return (-1);
}
if (safewrite(fd, (char*)&len, sizeof(len)) < 0) {
testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot write metadata length");
+ _("cannot write metadata length"));
close(fd);
return (-1);
}
if (safewrite(fd, xml, len) < 0) {
testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot write metadata");
+ _("cannot write metadata"));
free(xml);
close(fd);
return (-1);
@@ -1339,7 +1339,7 @@ static int testDomainSave(virDomainPtr domain,
free(xml);
if (close(fd) < 0) {
testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot save domain data");
+ _("cannot save domain data"));
close(fd);
return (-1);
}
@@ -1363,30 +1363,30 @@ static int testDomainRestore(virConnectPtr conn,
if ((fd = open(path, O_RDONLY)) < 0) {
testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot read domain image");
+ _("cannot read domain image"));
return (-1);
}
if (read(fd, magic, sizeof(magic)) != sizeof(magic)) {
testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "incomplete save header");
+ _("incomplete save header"));
close(fd);
return (-1);
}
if (memcmp(magic, TEST_SAVE_MAGIC, sizeof(magic))) {
testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "mismatched header magic");
+ _("mismatched header magic"));
close(fd);
return (-1);
}
if (read(fd, (char*)&len, sizeof(len)) != sizeof(len)) {
testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to read metadata length");
+ _("failed to read metadata length"));
close(fd);
return (-1);
}
if (len < 1 || len > 8192) {
testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "length of metadata out of range");
+ _("length of metadata out of range"));
close(fd);
return (-1);
}
@@ -1398,7 +1398,7 @@ static int testDomainRestore(virConnectPtr conn,
}
if (read(fd, xml, len) != len) {
testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "incomplete metdata");
+ _("incomplete metdata"));
close(fd);
return (-1);
}
@@ -1419,18 +1419,18 @@ static int testDomainCoreDump(virDomainPtr domain,
if ((fd = open(to, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) {
testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot save domain core");
+ _("cannot save domain core"));
return (-1);
}
if (safewrite(fd, TEST_SAVE_MAGIC, sizeof(TEST_SAVE_MAGIC)) < 0) {
testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot write header");
+ _("cannot write header"));
close(fd);
return (-1);
}
if (close(fd) < 0) {
testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot save domain data");
+ _("cannot save domain data"));
close(fd);
return (-1);
}
--
1.5.5.rc0.22.g467c
2
2
[Libvir] [PATCH 9/9] lxcError: mark a string and add to the list of nearly-checked functions
by Jim Meyering 28 Mar '08
by Jim Meyering 28 Mar '08
28 Mar '08
lxcError: mark a string and add to the list of nearly-checked functions
* Makefile.maint (msg_gen_function): Add, but commented-out.
* src/lxc_conf.c (lxcParseXML): Mark a diagnostic for translation.
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
Makefile.maint | 1 +
src/lxc_conf.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Makefile.maint b/Makefile.maint
index 518e59b..a357d74 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -323,6 +323,7 @@ msg_gen_function += openvzLog
# msg_gen_function += error
# msg_gen_function += virXenError
# msg_gen_function += testError
+# msg_gen_function += lxcError
func_or := $(shell printf '$(msg_gen_function)'|tr -s '[[:space:]]' '|')
func_re := ($(func_or))
diff --git a/src/lxc_conf.c b/src/lxc_conf.c
index e0896ec..3923807 100644
--- a/src/lxc_conf.c
+++ b/src/lxc_conf.c
@@ -398,7 +398,7 @@ static lxc_vm_def_t * lxcParseXML(virConnectPtr conn, xmlDocPtr docPtr)
if ((xmlProp = xmlGetProp(rootNodePtr, BAD_CAST "id"))) {
if (0 > virStrToLong_i((char*)xmlProp, NULL, 10, &(containerDef->id))) {
lxcError(conn, NULL, VIR_ERR_INTERNAL_ERROR,
- "invalid domain id");
+ _("invalid domain id"));
goto error;
}
} else {
--
1.5.5.rc0.22.g467c
2
1
[Libvir] [PATCH 7/9] openvzLog: mark its string arguments for translation
by Jim Meyering 28 Mar '08
by Jim Meyering 28 Mar '08
28 Mar '08
openvzLog: mark its string arguments for translation
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
Makefile.maint | 2 +-
src/openvz_conf.c | 35 ++++++++++++++++++++++-------------
src/openvz_driver.c | 25 +++++++++++++------------
3 files changed, 36 insertions(+), 26 deletions(-)
diff --git a/Makefile.maint b/Makefile.maint
index fce59b4..55a9677 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -315,13 +315,13 @@ msg_gen_function += virStorageLog
msg_gen_function += xenXMError
msg_gen_function += ReportError
msg_gen_function += qemudReportError
+msg_gen_function += openvzLog
# Uncomment this after adjusting remaining diagnostics to be translatable.
# msg_gen_function += error
# msg_gen_function += virXenError
# msg_gen_function += testError
-# msg_gen_function += openvzLog
func_or := $(shell printf '$(msg_gen_function)'|tr -s '[[:space:]]' '|')
func_re := ($(func_or))
diff --git a/src/openvz_conf.c b/src/openvz_conf.c
index 4a2b037..65344c5 100644
--- a/src/openvz_conf.c
+++ b/src/openvz_conf.c
@@ -237,8 +237,9 @@ openvzAssignVMDef(virConnectPtr conn,
}
else
{
- openvzLog(OPENVZ_ERR, "Error already an active OPENVZ VM having id '%s'",
- def->name);
+ openvzLog(OPENVZ_ERR,
+ _("Error already an active OPENVZ VM having id '%s'"),
+ def->name);
openvzFreeVMDef(def);
return NULL; /* can't redefine an active domain */
}
@@ -383,8 +384,9 @@ static struct openvz_vm_def
obj = xmlXPathEval(BAD_CAST"string(/domain/container/network/ipaddress[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) || (obj->stringval == NULL)
|| (obj->stringval[0] == 0)) {
- openvzLog(OPENVZ_WARN, "No IP address in the given xml config file '%s'",
- xml->name);
+ openvzLog(OPENVZ_WARN,
+ _("No IP address in the given xml config file '%s'"),
+ xml->name);
}
if (xmlStrlen(obj->stringval) >= (OPENVZ_IP_MAX)) {
char errorMessage[OPENVZ_MAX_ERROR_LEN];
@@ -395,7 +397,8 @@ static struct openvz_vm_def
goto bail_out;
}
if (!(ovzIp = calloc(1, sizeof(*ovzIp)))) {
- openvzLog(OPENVZ_ERR, "Failed to Create Memory for 'ovz_ip' structure");
+ openvzLog(OPENVZ_ERR,
+ _("Failed to Create Memory for 'ovz_ip' structure"));
goto bail_out;
}
strncpy(ovzIp->ip, (const char *) obj->stringval, OPENVZ_IP_MAX);
@@ -406,8 +409,9 @@ static struct openvz_vm_def
obj = xmlXPathEval(BAD_CAST "string(/domain/container/network/netmask[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING)
|| (obj->stringval == NULL) || (obj->stringval[0] == 0))
- openvzLog(OPENVZ_WARN, "No Netmask address in the given xml config file '%s'",
- xml->name);
+ openvzLog(OPENVZ_WARN,
+ _("No Netmask address in the given xml config file '%s'"),
+ xml->name);
if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
char errorMessage[OPENVZ_MAX_ERROR_LEN];
@@ -424,7 +428,9 @@ static struct openvz_vm_def
obj = xmlXPathEval(BAD_CAST "string(/domain/container/network/hostname[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) || (obj->stringval == NULL)
|| (obj->stringval[0] == 0))
- openvzLog(OPENVZ_WARN, "No hostname in the given xml config file '%s'", xml->name);
+ openvzLog(OPENVZ_WARN,
+ _("No hostname in the given xml config file '%s'"),
+ xml->name);
if (strlen((const char *) obj->stringval) >= (OPENVZ_HOSTNAME_MAX - 1)) {
char errorMessage[OPENVZ_MAX_ERROR_LEN];
@@ -441,8 +447,9 @@ static struct openvz_vm_def
obj = xmlXPathEval(BAD_CAST"string(/domain/container/network/gateway[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) || (obj->stringval == NULL)
|| (obj->stringval[0] == 0))
- openvzLog(OPENVZ_WARN, "No Gateway address in the given xml config file '%s'",
- xml->name);
+ openvzLog(OPENVZ_WARN,
+ _("No Gateway address in the given xml config file '%s'"),
+ xml->name);
if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
char errorMessage[OPENVZ_MAX_ERROR_LEN];
@@ -459,8 +466,9 @@ static struct openvz_vm_def
obj = xmlXPathEval(BAD_CAST "string(/domain/container/network/nameserver[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) || (obj->stringval == NULL)
|| (obj->stringval[0] == 0))
- openvzLog(OPENVZ_WARN, "No Nameserver address inthe given xml config file '%s'",
- xml->name);
+ openvzLog(OPENVZ_WARN,
+ _("No Nameserver address inthe given xml config file '%s'"),
+ xml->name);
if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
char errorMessage[OPENVZ_MAX_ERROR_LEN];
@@ -471,7 +479,8 @@ static struct openvz_vm_def
goto bail_out;
}
if (!(ovzNs = calloc(1, sizeof(*ovzNs)))) {
- openvzLog(OPENVZ_ERR, "Failed to Create Memory for 'ovz_ns' structure");
+ openvzLog(OPENVZ_ERR,
+ _("Failed to Create Memory for 'ovz_ns' structure"));
goto bail_out;
}
strncpy(ovzNs->ip, (const char *) obj->stringval, OPENVZ_IP_MAX);
diff --git a/src/openvz_driver.c b/src/openvz_driver.c
index 0e94d02..1db3c60 100644
--- a/src/openvz_driver.c
+++ b/src/openvz_driver.c
@@ -253,7 +253,7 @@ static int openvzDomainShutdown(virDomainPtr dom) {
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
{
- openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
+ openvzLog(OPENVZ_ERR, "%s", _("Error in parsing Options to OPENVZ"));
goto bail_out;
}
@@ -298,7 +298,7 @@ static int openvzDomainReboot(virDomainPtr dom,
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
{
- openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
+ openvzLog(OPENVZ_ERR, "%s", _("Error in parsing Options to OPENVZ"));
goto bail_out1;
}
ret = virExec(dom->conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
@@ -328,13 +328,13 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
vm = openvzFindVMByID(driver, strtoI(vmdef->name));
if (vm) {
- openvzLog(OPENVZ_ERR, "Already an OPENVZ VM active with the id '%s'",
- vmdef->name);
+ openvzLog(OPENVZ_ERR, _("Already an OPENVZ VM active with the id '%s'"),
+ vmdef->name);
goto bail_out2;
}
if (!(vm = openvzAssignVMDef(conn, driver, vmdef))) {
openvzFreeVMDef(vmdef);
- openvzLog(OPENVZ_ERR, "Error creating OPENVZ VM");
+ openvzLog(OPENVZ_ERR, "%s", _("Error creating OPENVZ VM"));
}
snprintf(cmdbuf, CMDBUF_LEN - 1, VZCTL " create %s", vmdef->name);
@@ -357,7 +357,7 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
{
- openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
+ openvzLog(OPENVZ_ERR, "%s", _("Error in parsing Options to OPENVZ"));
goto bail_out2;
}
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
@@ -395,12 +395,13 @@ openvzDomainCreateLinux(virConnectPtr conn, const char *xml,
vm = openvzFindVMByID(driver, strtoI(vmdef->name));
if (vm) {
openvzFreeVMDef(vmdef);
- openvzLog(OPENVZ_ERR, "Already an OPENVZ VM defined with the id '%d'",
+ openvzLog(OPENVZ_ERR,
+ _("Already an OPENVZ VM defined with the id '%d'"),
strtoI(vmdef->name));
return NULL;
}
if (!(vm = openvzAssignVMDef(conn, driver, vmdef))) {
- openvzLog(OPENVZ_ERR, "Error creating OPENVZ VM");
+ openvzLog(OPENVZ_ERR, "%s", _("Error creating OPENVZ VM"));
return NULL;
}
@@ -424,7 +425,7 @@ openvzDomainCreateLinux(virConnectPtr conn, const char *xml,
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
{
- openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
+ openvzLog(OPENVZ_ERR, "%s", _("Error in parsing Options to OPENVZ"));
goto bail_out3;
}
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
@@ -440,7 +441,7 @@ openvzDomainCreateLinux(virConnectPtr conn, const char *xml,
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
{
- openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
+ openvzLog(OPENVZ_ERR, "%s", _("Error in parsing Options to OPENVZ"));
goto bail_out3;
}
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
@@ -494,7 +495,7 @@ openvzDomainCreate(virDomainPtr dom)
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
{
- openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
+ openvzLog(OPENVZ_ERR, "%s", _("Error in parsing Options to OPENVZ"));
goto bail_out4;
}
ret = virExec(dom->conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
@@ -537,7 +538,7 @@ openvzDomainUndefine(virDomainPtr dom)
if((ret = convCmdbufExec(cmdbuf, cmdExec)) == -1)
{
- openvzLog(OPENVZ_ERR, "Error in parsing Options to OPENVZ");
+ openvzLog(OPENVZ_ERR, "%s", _("Error in parsing Options to OPENVZ"));
goto bail_out5;
}
ret = virExec(conn, (char **)cmdExec, &pid, -1, &outfd, &errfd);
--
1.5.5.rc0.22.g467c
2
1
28 Mar '08
error: mark most string arguments for translation
Also mark some arguments to __virRaiseError.
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
Makefile.maint | 4 +-
po/POTFILES.in | 2 +
src/openvz_conf.c | 42 +++++++++++--------
src/openvz_driver.c | 31 +++++++++-----
src/remote_internal.c | 108 ++++++++++++++++++++++++++++---------------------
5 files changed, 110 insertions(+), 77 deletions(-)
diff --git a/Makefile.maint b/Makefile.maint
index 6e4868e..fce59b4 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -316,10 +316,12 @@ msg_gen_function += xenXMError
msg_gen_function += ReportError
msg_gen_function += qemudReportError
+# Uncomment this after adjusting remaining diagnostics to be translatable.
+# msg_gen_function += error
+
# msg_gen_function += virXenError
# msg_gen_function += testError
# msg_gen_function += openvzLog
-# msg_gen_function += error
func_or := $(shell printf '$(msg_gen_function)'|tr -s '[[:space:]]' '|')
func_re := ($(func_or))
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 54cb077..dfdb583 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -8,6 +8,8 @@ src/iptables.c
src/libvirt.c
src/lxc_conf.c
src/lxc_driver.c
+src/openvz_conf.c
+src/openvz_driver.c
src/proxy_internal.c
src/qemu_conf.c
src/qemu_driver.c
diff --git a/src/openvz_conf.c b/src/openvz_conf.c
index 364cb25..4a2b037 100644
--- a/src/openvz_conf.c
+++ b/src/openvz_conf.c
@@ -307,7 +307,7 @@ static struct openvz_vm_def
root = xmlDocGetRootElement(xml);
if ((root == NULL) || (!xmlStrEqual(root->name, BAD_CAST "domain"))) {
- error(conn, VIR_ERR_INTERNAL_ERROR, "incorrect root element");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("incorrect root element"));
goto bail_out;
}
@@ -319,12 +319,12 @@ static struct openvz_vm_def
/* Find out what type of OPENVZ virtualization to use */
if (!(prop = xmlGetProp(root, BAD_CAST "type"))) {
- error(conn, VIR_ERR_INTERNAL_ERROR, "missing domain type attribute");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("missing domain type attribute"));
goto bail_out;
}
if (strcmp((char *)prop, "openvz")){
- error(conn, VIR_ERR_INTERNAL_ERROR, "invalid domain type attribute");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("invalid domain type attribute"_));
goto bail_out;
}
free(prop);
@@ -334,14 +334,14 @@ static struct openvz_vm_def
obj = xmlXPathEval(BAD_CAST "string(/domain/name[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) ||
(obj->stringval == NULL) || (obj->stringval[0] == 0)) {
- error(conn, VIR_ERR_INTERNAL_ERROR,"invalid domain name");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("invalid domain name"));
goto bail_out;
}
/* rejecting VPS ID <= OPENVZ_RSRV_VM_LIMIT for they are reserved */
if (strtoI((const char *) obj->stringval) <= OPENVZ_RSRV_VM_LIMIT) {
error(conn, VIR_ERR_INTERNAL_ERROR,
- "VPS ID Error (must be an integer greater than 100");
+ _("VPS ID Error (must be an integer greater than 100"));
goto bail_out;
}
strncpy(def->name, (const char *) obj->stringval, OPENVZ_NAME_MAX);
@@ -354,11 +354,11 @@ static struct openvz_vm_def
int err;
if ((err = virUUIDGenerate(def->uuid))) {
- error(conn, VIR_ERR_INTERNAL_ERROR, "Failed to generate UUID");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("Failed to generate UUID"));
goto bail_out;
}
} else if (virUUIDParse((const char *)obj->stringval, def->uuid) < 0) {
- error(conn, VIR_ERR_INTERNAL_ERROR, "malformed uuid element");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("malformed uuid element"));
goto bail_out;
}
xmlXPathFreeObject(obj);
@@ -389,7 +389,8 @@ static struct openvz_vm_def
if (xmlStrlen(obj->stringval) >= (OPENVZ_IP_MAX)) {
char errorMessage[OPENVZ_MAX_ERROR_LEN];
- snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "ipaddress length too long");
+ snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s",
+ _("ipaddress length too long"));
error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
goto bail_out;
}
@@ -411,7 +412,8 @@ static struct openvz_vm_def
if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
char errorMessage[OPENVZ_MAX_ERROR_LEN];
- snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "netmask length too long");
+ snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s",
+ _("netmask length too long"));
error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
goto bail_out;
}
@@ -427,7 +429,8 @@ static struct openvz_vm_def
if (strlen((const char *) obj->stringval) >= (OPENVZ_HOSTNAME_MAX - 1)) {
char errorMessage[OPENVZ_MAX_ERROR_LEN];
- snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "hostname length too long");
+ snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1,
+ "%s", _("hostname length too long"));
error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
goto bail_out;
}
@@ -444,7 +447,8 @@ static struct openvz_vm_def
if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
char errorMessage[OPENVZ_MAX_ERROR_LEN];
- snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "gateway length too long");
+ snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1,
+ "%s", _("gateway length too long"));
error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
goto bail_out;
}
@@ -461,7 +465,8 @@ static struct openvz_vm_def
if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
char errorMessage[OPENVZ_MAX_ERROR_LEN];
- snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "nameserver length too long");
+ snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1,
+ "%s", _("nameserver length too long"));
error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
goto bail_out;
}
@@ -483,7 +488,8 @@ static struct openvz_vm_def
if (strlen((const char *) obj->stringval) >= (OPENVZ_PROFILE_MAX - 1)) {
char errorMessage[OPENVZ_MAX_ERROR_LEN];
- snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "profile length too long");
+ snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1,
+ "%s", _("profile length too long"));
error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
goto bail_out;
}
@@ -519,14 +525,14 @@ openvzGetVPSInfo(virConnectPtr conn) {
driver->num_inactive = 0;
if((fp = popen(VZLIST " -a -ovpsid,status -H 2>/dev/null", "r")) == NULL) {
- error(conn, VIR_ERR_INTERNAL_ERROR, "popen failed");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("popen failed"));
return NULL;
}
pnext = &vm;
while(!feof(fp)) {
*pnext = calloc(1, sizeof(**pnext));
if(!*pnext) {
- error(conn, VIR_ERR_INTERNAL_ERROR, "calloc failed");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("calloc failed"));
goto error;
}
@@ -535,7 +541,7 @@ openvzGetVPSInfo(virConnectPtr conn) {
if (fscanf(fp, "%d %s\n", &veid, status) != 2) {
error(conn, VIR_ERR_INTERNAL_ERROR,
- "Failed to parse vzlist output");
+ _("Failed to parse vzlist output"));
goto error;
}
if(strcmp(status, "stopped")) {
@@ -555,7 +561,7 @@ openvzGetVPSInfo(virConnectPtr conn) {
vmdef = calloc(1, sizeof(*vmdef));
if(!vmdef) {
- error(conn, VIR_ERR_INTERNAL_ERROR, "calloc failed");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("calloc failed"));
goto error;
}
@@ -565,7 +571,7 @@ openvzGetVPSInfo(virConnectPtr conn) {
if(ret == -1) {
error(conn, VIR_ERR_INTERNAL_ERROR,
- "UUID in config file malformed");
+ _("UUID in config file malformed"));
free(vmdef);
goto error;
}
diff --git a/src/openvz_driver.c b/src/openvz_driver.c
index 29cb244..0e94d02 100644
--- a/src/openvz_driver.c
+++ b/src/openvz_driver.c
@@ -146,7 +146,7 @@ static virDomainPtr openvzDomainLookupByID(virConnectPtr conn,
virDomainPtr dom;
if (!vm) {
- error(conn, VIR_ERR_INTERNAL_ERROR, "no domain with matching id");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("no domain with matching id"));
return NULL;
}
@@ -174,7 +174,7 @@ static virDomainPtr openvzDomainLookupByUUID(virConnectPtr conn,
virDomainPtr dom;
if (!vm) {
- error(conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+ error(conn, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
return NULL;
}
@@ -195,7 +195,7 @@ static virDomainPtr openvzDomainLookupByName(virConnectPtr conn,
virDomainPtr dom;
if (!vm) {
- error(conn, VIR_ERR_INTERNAL_ERROR, "no domain with matching name");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("no domain with matching name"));
return NULL;
}
@@ -215,7 +215,8 @@ static int openvzDomainGetInfo(virDomainPtr dom,
struct openvz_vm *vm = openvzFindVMByUUID(driver, dom->uuid);
if (!vm) {
- error(dom->conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+ error(dom->conn, VIR_ERR_INVALID_DOMAIN,
+ _("no domain with matching uuid"));
return -1;
}
@@ -238,12 +239,14 @@ static int openvzDomainShutdown(virDomainPtr dom) {
struct openvz_vm *vm = openvzFindVMByID(driver, dom->id);
if (!vm) {
- error(dom->conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching id");
+ error(dom->conn, VIR_ERR_INVALID_DOMAIN,
+ _("no domain with matching id"));
return -1;
}
if (vm->status != VIR_DOMAIN_RUNNING) {
- error(dom->conn, VIR_ERR_OPERATION_DENIED, "domain is not in running state");
+ error(dom->conn, VIR_ERR_OPERATION_DENIED,
+ _("domain is not in running state"));
return -1;
}
snprintf(cmdbuf, CMDBUF_LEN - 1, VZCTL " stop %d ", dom->id);
@@ -281,12 +284,14 @@ static int openvzDomainReboot(virDomainPtr dom,
struct openvz_vm *vm = openvzFindVMByID(driver, dom->id);
if (!vm) {
- error(dom->conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching id");
+ error(dom->conn, VIR_ERR_INVALID_DOMAIN,
+ _("no domain with matching id"));
return -1;
}
if (vm->status != VIR_DOMAIN_RUNNING) {
- error(dom->conn, VIR_ERR_OPERATION_DENIED, "domain is not in running state");
+ error(dom->conn, VIR_ERR_OPERATION_DENIED,
+ _("domain is not in running state"));
return -1;
}
snprintf(cmdbuf, CMDBUF_LEN - 1, VZCTL " restart %d ", dom->id);
@@ -473,12 +478,14 @@ openvzDomainCreate(virDomainPtr dom)
struct openvz_vm_def *vmdef;
if (!vm) {
- error(dom->conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching id");
+ error(dom->conn, VIR_ERR_INVALID_DOMAIN,
+ _("no domain with matching id"));
return -1;
}
if (vm->status != VIR_DOMAIN_SHUTOFF) {
- error(dom->conn, VIR_ERR_OPERATION_DENIED, "domain is not in shutoff state");
+ error(dom->conn, VIR_ERR_OPERATION_DENIED,
+ _("domain is not in shutoff state"));
return -1;
}
@@ -518,12 +525,12 @@ openvzDomainUndefine(virDomainPtr dom)
struct openvz_vm *vm = openvzFindVMByUUID(driver, dom->uuid);
if (!vm) {
- error(conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+ error(conn, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
return -1;
}
if (openvzIsActiveVM(vm)) {
- error(conn, VIR_ERR_INTERNAL_ERROR, "cannot delete active domain");
+ error(conn, VIR_ERR_INTERNAL_ERROR, _("cannot delete active domain"));
return -1;
}
snprintf(cmdbuf, CMDBUF_LEN - 1, VZCTL " destroy %s ", vm->vmdef->name);
diff --git a/src/remote_internal.c b/src/remote_internal.c
index 8d2d9e5..be4c573 100644
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -879,7 +879,7 @@ check_cert_file (virConnectPtr conn, const char *type, const char *file)
if (stat(file, &sb) < 0) {
__virRaiseError (conn, NULL, NULL, VIR_FROM_REMOTE, VIR_ERR_RPC,
VIR_ERR_ERROR, LIBVIRT_CACERT, NULL, NULL, 0, 0,
- "Cannot access %s '%s': %s (%d)",
+ _("Cannot access %s '%s': %s (%d)"),
type, file, strerror(errno), errno);
return -1;
}
@@ -1018,7 +1018,7 @@ negotiate_gnutls_on_connection (virConnectPtr conn,
}
if (len != 1 || buf[0] != '\1') {
error (conn, VIR_ERR_RPC,
- "server verification (of our certificate or IP address) failed\n");
+ _("server verification (of our certificate or IP address) failed\n"));
return NULL;
}
@@ -1117,7 +1117,7 @@ verify_certificate (virConnectPtr conn ATTRIBUTE_UNUSED,
VIR_FROM_REMOTE, VIR_ERR_RPC,
VIR_ERR_ERROR, priv->hostname, NULL, NULL,
0, 0,
- "Certificate's owner does not match the hostname (%s)",
+ _("Certificate's owner does not match the hostname (%s)"),
priv->hostname);
gnutls_x509_crt_deinit (cert);
return -1;
@@ -3473,8 +3473,9 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv, int in_open,
want = REMOTE_AUTH_POLKIT;
} else {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "unknown authentication type %s", authtype);
+ VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
+ NULL, NULL, NULL, 0, 0,
+ _("unknown authentication type %s"), authtype);
return -1;
}
for (i = 0 ; i < ret.types.types_len ; i++) {
@@ -3484,7 +3485,8 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv, int in_open,
if (type == REMOTE_AUTH_NONE) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "requested authentication type %s rejected", authtype);
+ _("requested authentication type %s rejected"),
+ authtype);
return -1;
}
} else {
@@ -3522,8 +3524,10 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv, int in_open,
default:
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "unsupported authentication type %d", ret.types.types_val[0]);
+ VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
+ NULL, NULL, NULL, 0, 0,
+ _("unsupported authentication type %d"),
+ ret.types.types_val[0]);
free(ret.types.types_val);
return -1;
}
@@ -3550,15 +3554,18 @@ static char *addrToString(struct sockaddr_storage *sa, socklen_t salen)
port, sizeof(port),
NI_NUMERICHOST | NI_NUMERICSERV)) != 0) {
__virRaiseError (NULL, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_NO_MEMORY, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "Cannot resolve address %d: %s", err, gai_strerror(err));
+ VIR_ERR_NO_MEMORY, VIR_ERR_ERROR,
+ NULL, NULL, NULL, 0, 0,
+ _("Cannot resolve address %d: %s"),
+ err, gai_strerror(err));
return NULL;
}
addr = malloc(strlen(host) + 1 + strlen(port) + 1);
if (!addr) {
__virRaiseError (NULL, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_NO_MEMORY, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
+ VIR_ERR_NO_MEMORY, VIR_ERR_ERROR,
+ NULL, NULL, NULL, 0, 0,
"address");
return NULL;
}
@@ -3769,7 +3776,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
if (err != SASL_OK) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "failed to initialize SASL library: %d (%s)",
+ _("failed to initialize SASL library: %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
goto cleanup;
}
@@ -3779,7 +3786,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
if (getsockname(priv->sock, (struct sockaddr*)&sa, &salen) < 0) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "failed to get sock address %d (%s)",
+ _("failed to get sock address %d (%s)"),
socket_errno (), strerror(socket_errno ()));
goto cleanup;
}
@@ -3791,7 +3798,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
if (getpeername(priv->sock, (struct sockaddr*)&sa, &salen) < 0) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "failed to get peer address %d (%s)",
+ _("failed to get peer address %d (%s)"),
socket_errno (), strerror(socket_errno ()));
goto cleanup;
}
@@ -3817,7 +3824,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
if (err != SASL_OK) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "Failed to create SASL client context: %d (%s)",
+ _("Failed to create SASL client context: %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
goto cleanup;
}
@@ -3830,7 +3837,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
if (!(ssf = (sasl_ssf_t)gnutls_cipher_get_key_size(cipher))) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "invalid cipher size for TLS session");
+ "%s", _("invalid cipher size for TLS session"));
goto cleanup;
}
ssf *= 8; /* key size is bytes, sasl wants bits */
@@ -3840,7 +3847,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
if (err != SASL_OK) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "cannot set external SSF %d (%s)",
+ _("cannot set external SSF %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
goto cleanup;
}
@@ -3859,7 +3866,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
if (err != SASL_OK) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "cannot set security props %d (%s)",
+ _("cannot set security props %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
goto cleanup;
}
@@ -3876,8 +3883,10 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
if (wantmech) {
if (strstr(mechlist, wantmech) == NULL) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "SASL mechanism %s not supported by server", wantmech);
+ VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
+ NULL, NULL, NULL, 0, 0,
+ _("SASL mechanism %s not supported by server"),
+ wantmech);
free(iret.mechlist);
goto cleanup;
}
@@ -3895,7 +3904,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
if (err != SASL_OK && err != SASL_CONTINUE && err != SASL_INTERACT) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "Failed to start SASL negotiation: %d (%s)",
+ _("Failed to start SASL negotiation: %d (%s)"),
err, sasl_errdetail(saslconn));
free(iret.mechlist);
goto cleanup;
@@ -3911,8 +3920,9 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
if ((ncred =
remoteAuthMakeCredentials(interact, &cred)) < 0) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
- VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "Failed to make auth credentials");
+ VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
+ NULL, NULL, NULL, 0, 0,
+ "%s", _("Failed to make auth credentials"));
free(iret.mechlist);
goto cleanup;
}
@@ -3936,7 +3946,8 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
if (clientoutlen > REMOTE_AUTH_SASL_DATA_MAX) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "SASL negotiation data too long: %d bytes", clientoutlen);
+ _("SASL negotiation data too long: %d bytes"),
+ clientoutlen);
goto cleanup;
}
/* NB, distinction of NULL vs "" is *critical* in SASL */
@@ -3975,7 +3986,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
if (err != SASL_OK && err != SASL_CONTINUE && err != SASL_INTERACT) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "Failed SASL step: %d (%s)",
+ _("Failed SASL step: %d (%s)"),
err, sasl_errdetail(saslconn));
goto cleanup;
}
@@ -3989,7 +4000,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
if ((ncred = remoteAuthMakeCredentials(interact, &cred)) < 0) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "Failed to make auth credentials");
+ "%s", _("Failed to make auth credentials"));
goto cleanup;
}
/* Run the authentication callback */
@@ -4053,7 +4064,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
if (err != SASL_OK) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "cannot query SASL ssf on connection %d (%s)",
+ _("cannot query SASL ssf on connection %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
goto cleanup;
}
@@ -4062,7 +4073,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
if (ssf < 56) { /* 56 == DES level, good for Kerberos */
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "negotiation SSF %d was not strong enough", ssf);
+ _("negotiation SSF %d was not strong enough"), ssf);
goto cleanup;
}
}
@@ -4116,7 +4127,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open,
if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) {
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "Failed to collect auth credentials");
+ _("Failed to collect auth credentials"));
return -1;
}
} else {
@@ -4183,7 +4194,7 @@ call (virConnectPtr conn, struct private_data *priv,
xdrmem_create (&xdr, buffer, sizeof buffer, XDR_ENCODE);
if (!xdr_remote_message_header (&xdr, &hdr)) {
error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
- VIR_ERR_RPC, "xdr_remote_message_header");
+ VIR_ERR_RPC, _("xdr_remote_message_header failed"));
return -1;
}
@@ -4205,7 +4216,8 @@ call (virConnectPtr conn, struct private_data *priv,
/* Encode the length word. */
xdrmem_create (&xdr, buffer2, sizeof buffer2, XDR_ENCODE);
if (!xdr_int (&xdr, &len)) {
- error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, VIR_ERR_RPC, _("xdr_int (length word)"));
+ error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, VIR_ERR_RPC,
+ _("xdr_int (length word)"));
return -1;
}
xdr_destroy (&xdr);
@@ -4222,7 +4234,7 @@ call (virConnectPtr conn, struct private_data *priv,
xdrmem_create (&xdr, buffer2, sizeof buffer2, XDR_DECODE);
if (!xdr_int (&xdr, &len)) {
error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
- VIR_ERR_RPC, "xdr_int (length word, reply)");
+ VIR_ERR_RPC, _("xdr_int (length word, reply)"));
return -1;
}
xdr_destroy (&xdr);
@@ -4232,7 +4244,7 @@ call (virConnectPtr conn, struct private_data *priv,
if (len < 0 || len > REMOTE_MESSAGE_MAX) {
error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
- VIR_ERR_RPC, "packet received from server too large");
+ VIR_ERR_RPC, _("packet received from server too large"));
return -1;
}
@@ -4244,22 +4256,24 @@ call (virConnectPtr conn, struct private_data *priv,
xdrmem_create (&xdr, buffer, len, XDR_DECODE);
if (!xdr_remote_message_header (&xdr, &hdr)) {
error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
- VIR_ERR_RPC, "xdr_remote_message_header (reply)");
+ VIR_ERR_RPC, _("invalid header in reply"));
return -1;
}
/* Check program, version, etc. are what we expect. */
if (hdr.prog != REMOTE_PROGRAM) {
- __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
+ __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
+ NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "unknown program (received %x, expected %x)",
+ _("unknown program (received %x, expected %x)"),
hdr.prog, REMOTE_PROGRAM);
return -1;
}
if (hdr.vers != REMOTE_PROTOCOL_VERSION) {
- __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
+ __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
+ NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "unknown protocol version (received %x, expected %x)",
+ _("unknown protocol version (received %x, expected %x)"),
hdr.vers, REMOTE_PROTOCOL_VERSION);
return -1;
}
@@ -4269,23 +4283,25 @@ call (virConnectPtr conn, struct private_data *priv,
* message being received at this point.
*/
if (hdr.proc != proc_nr) {
- __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
+ __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
+ NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "unknown procedure (received %x, expected %x)",
+ _("unknown procedure (received %x, expected %x)"),
hdr.proc, proc_nr);
return -1;
}
if (hdr.direction != REMOTE_REPLY) {
- __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
+ __virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
+ NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "unknown direction (received %x, expected %x)",
+ _("unknown direction (received %x, expected %x)"),
hdr.direction, REMOTE_REPLY);
return -1;
}
if (hdr.serial != serial) {
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "unknown serial (received %x, expected %x)",
+ _("unknown serial (received %x, expected %x)"),
hdr.serial, serial);
return -1;
}
@@ -4328,7 +4344,7 @@ call (virConnectPtr conn, struct private_data *priv,
default:
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
- "unknown status (received %x)",
+ _("unknown status (received %x)"),
hdr.status);
xdr_destroy (&xdr);
return -1;
@@ -4437,7 +4453,7 @@ really_read_buf (virConnectPtr conn, struct private_data *priv,
}
if (err == 0) {
error (in_open ? NULL : conn,
- VIR_ERR_RPC, "socket closed unexpectedly");
+ VIR_ERR_RPC, _("socket closed unexpectedly"));
return -1;
}
return err;
@@ -4454,7 +4470,7 @@ really_read_buf (virConnectPtr conn, struct private_data *priv,
}
if (err == 0) {
error (in_open ? NULL : conn,
- VIR_ERR_RPC, "socket closed unexpectedly");
+ VIR_ERR_RPC, _("socket closed unexpectedly"));
return -1;
}
return err;
--
1.5.5.rc0.22.g467c
2
1
[Libvir] [PATCH 5/9] Convert diagnostics like "VAR > MAX_VAR" to translatable messages.
by Jim Meyering 28 Mar '08
by Jim Meyering 28 Mar '08
28 Mar '08
Convert diagnostics like "VAR > MAX_VAR" to translatable messages.
* src/remote_internal.c (errorf): New function.
(remoteListDomains, remoteDomainPinVcpu, remoteDomainGetVcpus):
(remoteListDefinedDomains, remoteListNetworks):
(remoteListDefinedNetworks):
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
src/remote_internal.c | 79 +++++++++++++++++++++++++++++++++++++++---------
1 files changed, 64 insertions(+), 15 deletions(-)
diff --git a/src/remote_internal.c b/src/remote_internal.c
index 0909481..8d2d9e5 100644
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -146,6 +146,8 @@ static int remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int
virConnectAuthPtr auth);
#endif /* HAVE_POLKIT */
static void error (virConnectPtr conn, virErrorNumber code, const char *info);
+static void errorf (virConnectPtr conn, virErrorNumber code,
+ const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 3, 4);
static void server_error (virConnectPtr conn, remote_error *err);
static virDomainPtr get_nonnull_domain (virConnectPtr conn, remote_nonnull_domain domain);
static virNetworkPtr get_nonnull_network (virConnectPtr conn, remote_nonnull_network network);
@@ -1330,7 +1332,9 @@ remoteListDomains (virConnectPtr conn, int *ids, int maxids)
GET_PRIVATE (conn, -1);
if (maxids > REMOTE_DOMAIN_ID_LIST_MAX) {
- error (conn, VIR_ERR_RPC, _("maxids > REMOTE_DOMAIN_ID_LIST_MAX"));
+ errorf (conn, VIR_ERR_RPC,
+ _("too many remote domain IDs: %d > %d"),
+ maxids, REMOTE_DOMAIN_ID_LIST_MAX);
return -1;
}
args.maxids = maxids;
@@ -1342,7 +1346,9 @@ remoteListDomains (virConnectPtr conn, int *ids, int maxids)
return -1;
if (ret.ids.ids_len > maxids) {
- error (conn, VIR_ERR_RPC, _("ret.ids.ids_len > maxids"));
+ errorf (conn, VIR_ERR_RPC,
+ _("too many remote domain IDs: %d > %d"),
+ ret.ids.ids_len, maxids);
xdr_free ((xdrproc_t) xdr_remote_list_domains_ret, (char *) &ret);
return -1;
}
@@ -1714,7 +1720,9 @@ remoteDomainPinVcpu (virDomainPtr domain,
GET_PRIVATE (domain->conn, -1);
if (maplen > REMOTE_CPUMAP_MAX) {
- error (domain->conn, VIR_ERR_RPC, _("maplen > REMOTE_CPUMAP_MAX"));
+ errorf (domain->conn, VIR_ERR_RPC,
+ _("map length greater than maximum: %d > %d"),
+ maplen, REMOTE_CPUMAP_MAX);
return -1;
}
@@ -1744,12 +1752,15 @@ remoteDomainGetVcpus (virDomainPtr domain,
GET_PRIVATE (domain->conn, -1);
if (maxinfo > REMOTE_VCPUINFO_MAX) {
- error (domain->conn, VIR_ERR_RPC, _("maxinfo > REMOTE_VCPUINFO_MAX"));
+ errorf (domain->conn, VIR_ERR_RPC,
+ _("vCPU count exceeds maximum: %d > %d"),
+ maxinfo, REMOTE_VCPUINFO_MAX);
return -1;
}
if (maxinfo * maplen > REMOTE_CPUMAPS_MAX) {
- error (domain->conn, VIR_ERR_RPC,
- _("maxinfo * maplen > REMOTE_CPUMAPS_MAX"));
+ errorf (domain->conn, VIR_ERR_RPC,
+ _("vCPU map buffer length exceeds maximum: %d > %d"),
+ maxinfo * maplen, REMOTE_CPUMAPS_MAX);
return -1;
}
@@ -1764,13 +1775,16 @@ remoteDomainGetVcpus (virDomainPtr domain,
return -1;
if (ret.info.info_len > maxinfo) {
- error (domain->conn, VIR_ERR_RPC, _("ret.info.info_len > maxinfo"));
+ errorf (domain->conn, VIR_ERR_RPC,
+ _("host reports too many vCPUs: %d > %d"),
+ ret.info.info_len, maxinfo);
xdr_free ((xdrproc_t) xdr_remote_domain_get_vcpus_ret, (char *) &ret);
return -1;
}
if (ret.cpumaps.cpumaps_len > maxinfo * maplen) {
- error (domain->conn, VIR_ERR_RPC,
- _("ret.cpumaps.cpumaps_len > maxinfo * maplen"));
+ errorf (domain->conn, VIR_ERR_RPC,
+ _("host reports map buffer length exceeds maximum: %d > %d"),
+ ret.cpumaps.cpumaps_len, maxinfo * maplen);
xdr_free ((xdrproc_t) xdr_remote_domain_get_vcpus_ret, (char *) &ret);
return -1;
}
@@ -1930,7 +1944,9 @@ remoteListDefinedDomains (virConnectPtr conn, char **const names, int maxnames)
GET_PRIVATE (conn, -1);
if (maxnames > REMOTE_DOMAIN_NAME_LIST_MAX) {
- error (conn, VIR_ERR_RPC, _("maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"));
+ errorf (conn, VIR_ERR_RPC,
+ _("too many remote domain names: %d > %d"),
+ maxnames, REMOTE_DOMAIN_NAME_LIST_MAX);
return -1;
}
args.maxnames = maxnames;
@@ -1942,7 +1958,9 @@ remoteListDefinedDomains (virConnectPtr conn, char **const names, int maxnames)
return -1;
if (ret.names.names_len > maxnames) {
- error (conn, VIR_ERR_RPC, _("ret.names.names_len > maxnames"));
+ errorf (conn, VIR_ERR_RPC,
+ _("too many remote domain names: %d > %d"),
+ ret.names.names_len, maxnames);
xdr_free ((xdrproc_t) xdr_remote_list_defined_domains_ret, (char *) &ret);
return -1;
}
@@ -2390,7 +2408,9 @@ remoteListNetworks (virConnectPtr conn, char **const names, int maxnames)
GET_NETWORK_PRIVATE (conn, -1);
if (maxnames > REMOTE_NETWORK_NAME_LIST_MAX) {
- error (conn, VIR_ERR_RPC, _("maxnames > REMOTE_NETWORK_NAME_LIST_MAX"));
+ errorf (conn, VIR_ERR_RPC,
+ _("too many remote networks: %d > %d"),
+ maxnames, REMOTE_NETWORK_NAME_LIST_MAX);
return -1;
}
args.maxnames = maxnames;
@@ -2402,7 +2422,9 @@ remoteListNetworks (virConnectPtr conn, char **const names, int maxnames)
return -1;
if (ret.names.names_len > maxnames) {
- error (conn, VIR_ERR_RPC, _("ret.names.names_len > maxnames"));
+ errorf (conn, VIR_ERR_RPC,
+ _("too many remote networks: %d > %d"),
+ ret.names.names_len, maxnames);
xdr_free ((xdrproc_t) xdr_remote_list_networks_ret, (char *) &ret);
return -1;
}
@@ -2445,7 +2467,9 @@ remoteListDefinedNetworks (virConnectPtr conn,
GET_NETWORK_PRIVATE (conn, -1);
if (maxnames > REMOTE_NETWORK_NAME_LIST_MAX) {
- error (conn, VIR_ERR_RPC, _("maxnames > REMOTE_NETWORK_NAME_LIST_MAX"));
+ errorf (conn, VIR_ERR_RPC,
+ _("too many remote networks: %d > %d"),
+ maxnames, REMOTE_NETWORK_NAME_LIST_MAX);
return -1;
}
args.maxnames = maxnames;
@@ -2457,7 +2481,9 @@ remoteListDefinedNetworks (virConnectPtr conn,
return -1;
if (ret.names.names_len > maxnames) {
- error (conn, VIR_ERR_RPC, _("ret.names.names_len > maxnames"));
+ errorf (conn, VIR_ERR_RPC,
+ _("too many remote networks: %d > %d"),
+ ret.names.names_len, maxnames);
xdr_free ((xdrproc_t) xdr_remote_list_defined_networks_ret, (char *) &ret);
return -1;
}
@@ -4518,6 +4544,29 @@ error (virConnectPtr conn, virErrorNumber code, const char *info)
errmsg, info);
}
+/* For errors internal to this library.
+ Identical to the above, but with a format string and optional params. */
+static void
+errorf (virConnectPtr conn, virErrorNumber code, const char *fmt, ...)
+{
+ const char *errmsg;
+ va_list args;
+ char errorMessage[256];
+
+ if (fmt) {
+ va_start(args, fmt);
+ vsnprintf(errorMessage, sizeof errorMessage - 1, fmt, args);
+ va_end(args);
+ } else {
+ errorMessage[0] = '\0';
+ }
+
+ errmsg = __virErrorMsg (code, errorMessage);
+ __virRaiseError (conn, NULL, NULL, VIR_FROM_REMOTE,
+ code, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
+ "%s", errmsg);
+}
+
/* For errors generated on the server side and sent back to us. */
static void
server_error (virConnectPtr conn, remote_error *err)
--
1.5.5.rc0.22.g467c
2
1
[Libvir] [PATCH 3/9] ReportError: mark for translation string args to this function
by Jim Meyering 28 Mar '08
by Jim Meyering 28 Mar '08
28 Mar '08
ReportError: mark for translation string args to this function
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
Makefile.maint | 2 +-
src/util.c | 21 +++++++++++----------
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/Makefile.maint b/Makefile.maint
index ff09660..ccf6f5d 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -313,9 +313,9 @@ msg_gen_function += qemudLog
msg_gen_function += remoteDispatchError
msg_gen_function += virStorageLog
msg_gen_function += xenXMError
+msg_gen_function += ReportError
# msg_gen_function += virXenError
-# msg_gen_function += ReportError
# msg_gen_function += testError
# msg_gen_function += openvzLog
# msg_gen_function += qemudReportError
diff --git a/src/util.c b/src/util.c
index 188b7a8..0667780 100644
--- a/src/util.c
+++ b/src/util.c
@@ -106,21 +106,22 @@ _virExec(virConnectPtr conn,
int pipeerr[2] = {-1,-1};
if ((null = open(_PATH_DEVNULL, O_RDONLY)) < 0) {
- ReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "cannot open %s : %s",
- _PATH_DEVNULL, strerror(errno));
+ ReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("cannot open %s: %s"),
+ _PATH_DEVNULL, strerror(errno));
goto cleanup;
}
if ((outfd != NULL && pipe(pipeout) < 0) ||
(errfd != NULL && pipe(pipeerr) < 0)) {
- ReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "cannot create pipe : %s",
- strerror(errno));
+ ReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("cannot create pipe: %s"), strerror(errno));
goto cleanup;
}
if ((pid = fork()) < 0) {
- ReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "cannot fork child process : %s",
- strerror(errno));
+ ReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("cannot fork child process: %s"), strerror(errno));
goto cleanup;
}
@@ -131,11 +132,11 @@ _virExec(virConnectPtr conn,
if(non_block)
if(virSetNonBlock(pipeout[0]) == -1)
ReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Failed to set non-blocking file descriptor flag");
+ _("Failed to set non-blocking file descriptor flag"));
if(virSetCloseExec(pipeout[0]) == -1)
ReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Failed to set close-on-exec file descriptor flag");
+ _("Failed to set close-on-exec file descriptor flag"));
*outfd = pipeout[0];
}
if (errfd) {
@@ -143,11 +144,11 @@ _virExec(virConnectPtr conn,
if(non_block)
if(virSetNonBlock(pipeerr[0]) == -1)
ReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Failed to set non-blocking file descriptor flag");
+ _("Failed to set non-blocking file descriptor flag"));
if(virSetCloseExec(pipeerr[0]) == -1)
ReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Failed to set close-on-exec file descriptor flag");
+ _("Failed to set close-on-exec file descriptor flag"));
*errfd = pipeerr[0];
}
*retpid = pid;
--
1.5.5.rc0.22.g467c
2
1
[Libvir] [PATCH 2/9] xenXMError: mark for translation string args to this function
by Jim Meyering 28 Mar '08
by Jim Meyering 28 Mar '08
28 Mar '08
xenXMError: mark for translation string args to this function
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
Makefile.maint | 2 +-
src/xm_internal.c | 81 +++++++++++++++++++++++++++++++++-------------------
2 files changed, 52 insertions(+), 31 deletions(-)
diff --git a/Makefile.maint b/Makefile.maint
index d870bfd..ff09660 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -312,8 +312,8 @@ msg_gen_function += virLog
msg_gen_function += qemudLog
msg_gen_function += remoteDispatchError
msg_gen_function += virStorageLog
+msg_gen_function += xenXMError
-# msg_gen_function += xenXMError
# msg_gen_function += virXenError
# msg_gen_function += ReportError
# msg_gen_function += testError
diff --git a/src/xm_internal.c b/src/xm_internal.c
index 55684e7..f609029 100644
--- a/src/xm_internal.c
+++ b/src/xm_internal.c
@@ -1904,26 +1904,30 @@ virConfPtr xenXMParseXMLToConfig(virConnectPtr conn, const char *xml) {
XML_PARSE_NOENT | XML_PARSE_NONET |
XML_PARSE_NOERROR | XML_PARSE_NOWARNING);
if (doc == NULL) {
- xenXMError(conn, VIR_ERR_XML_ERROR, "cannot read XML domain definition");
+ xenXMError(conn, VIR_ERR_XML_ERROR,
+ _("cannot read XML domain definition"));
return (NULL);
}
node = xmlDocGetRootElement(doc);
if ((node == NULL) || (!xmlStrEqual(node->name, BAD_CAST "domain"))) {
- xenXMError(conn, VIR_ERR_XML_ERROR, "missing top level domain element");
+ xenXMError(conn, VIR_ERR_XML_ERROR,
+ _("missing top level domain element"));
goto error;
}
prop = xmlGetProp(node, BAD_CAST "type");
if (prop != NULL) {
if (!xmlStrEqual(prop, BAD_CAST "xen")) {
- xenXMError(conn, VIR_ERR_XML_ERROR, "domain type is invalid");
+ xenXMError(conn, VIR_ERR_XML_ERROR,
+ _("domain type is invalid"));
goto error;
}
xmlFree(prop);
prop = NULL;
}
if (!(ctxt = xmlXPathNewContext(doc))) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR, "cannot create XPath context");
+ xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("cannot create XPath context"));
goto error;
}
if (!(conf = virConfNew()))
@@ -2117,7 +2121,7 @@ virConfPtr xenXMParseXMLToConfig(virConnectPtr conn, const char *xml) {
if ((obj != NULL) && (obj->type == XPATH_NODESET) &&
(obj->nodesetval != NULL) && (obj->nodesetval->nodeNr >= 0)) {
if (!(vfb = malloc(sizeof(*vfb)))) {
- xenXMError(conn, VIR_ERR_NO_MEMORY, "config");
+ xenXMError(conn, VIR_ERR_NO_MEMORY, _("config"));
goto error;
}
vfb->type = VIR_CONF_LIST;
@@ -2183,7 +2187,7 @@ virConfPtr xenXMParseXMLToConfig(virConnectPtr conn, const char *xml) {
virConfValuePtr disp;
if (!(disp = malloc(sizeof(*disp)))) {
free(val);
- xenXMError(conn, VIR_ERR_NO_MEMORY, "config");
+ xenXMError(conn, VIR_ERR_NO_MEMORY, _("config"));
goto error;
}
disp->type = VIR_CONF_STRING;
@@ -2204,7 +2208,7 @@ virConfPtr xenXMParseXMLToConfig(virConnectPtr conn, const char *xml) {
(obj->nodesetval != NULL) && (obj->nodesetval->nodeNr >= 0)) {
virConfValuePtr disks;
if (!(disks = malloc(sizeof(*disks)))) {
- xenXMError(conn, VIR_ERR_NO_MEMORY, "config");
+ xenXMError(conn, VIR_ERR_NO_MEMORY, _("config"));
goto error;
}
disks->type = VIR_CONF_LIST;
@@ -2217,7 +2221,7 @@ virConfPtr xenXMParseXMLToConfig(virConnectPtr conn, const char *xml) {
if (disk) {
if (!(thisDisk = malloc(sizeof(*thisDisk)))) {
free(disk);
- xenXMError(conn, VIR_ERR_NO_MEMORY, "config");
+ xenXMError(conn, VIR_ERR_NO_MEMORY, _("config"));
goto error;
}
thisDisk->type = VIR_CONF_STRING;
@@ -2236,7 +2240,7 @@ virConfPtr xenXMParseXMLToConfig(virConnectPtr conn, const char *xml) {
(obj->nodesetval != NULL) && (obj->nodesetval->nodeNr >= 0)) {
virConfValuePtr vifs;
if (!(vifs = malloc(sizeof(*vifs)))) {
- xenXMError(conn, VIR_ERR_NO_MEMORY, "config");
+ xenXMError(conn, VIR_ERR_NO_MEMORY, _("config"));
goto error;
}
vifs->type = VIR_CONF_LIST;
@@ -2248,7 +2252,7 @@ virConfPtr xenXMParseXMLToConfig(virConnectPtr conn, const char *xml) {
goto error;
if (!(thisVif = malloc(sizeof(*thisVif)))) {
free(vif);
- xenXMError(conn, VIR_ERR_NO_MEMORY, "config");
+ xenXMError(conn, VIR_ERR_NO_MEMORY, _("config"));
goto error;
}
thisVif->type = VIR_CONF_STRING;
@@ -2324,7 +2328,8 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
if (!(value = virConfGetValue(conf, "name")) ||
value->type != VIR_CONF_STRING ||
value->str == NULL) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR, "name config parameter is missing");
+ xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("name config parameter is missing"));
goto error;
}
@@ -2332,17 +2337,20 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
/* domain exists, we will overwrite it */
if (!(oldfilename = (char *)virHashLookup(nameConfigMap, value->str))) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR, "can't retrieve config filename for domain to overwrite");
+ xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("can't retrieve config filename for domain to overwrite"));
goto error;
}
if (!(entry = virHashLookup(configCache, oldfilename))) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR, "can't retrieve config entry for domain to overwrite");
+ xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("can't retrieve config entry for domain to overwrite"));
goto error;
}
if (xenXMConfigGetUUID(entry->conf, "uuid", uuid) < 0) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR, "uuid config parameter is missing");
+ xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("uuid config parameter is missing"));
goto error;
}
@@ -2351,13 +2359,15 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
/* Remove the name -> filename mapping */
if (virHashRemoveEntry(nameConfigMap, value->str, NULL) < 0) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR, "failed to remove old domain from config map");
+ xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("failed to remove old domain from config map"));
goto error;
}
/* Remove the config record itself */
if (virHashRemoveEntry(configCache, oldfilename, xenXMConfigFree) < 0) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR, "failed to remove old domain from config map");
+ xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("failed to remove old domain from config map"));
goto error;
}
@@ -2365,7 +2375,8 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
}
if ((strlen(configDir) + 1 + strlen(value->str) + 1) > PATH_MAX) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR, "config file name is too long");
+ xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("config file name is too long"));
goto error;
}
@@ -2374,17 +2385,19 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
strcat(filename, value->str);
if (virConfWriteFile(filename, conf) < 0) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR, "unable to write config file");
+ xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("unable to write config file"));
goto error;
}
if (!(entry = calloc(1, sizeof(*entry)))) {
- xenXMError(conn, VIR_ERR_NO_MEMORY, "config");
+ xenXMError(conn, VIR_ERR_NO_MEMORY, _("config"));
goto error;
}
if ((entry->refreshedAt = time(NULL)) == ((time_t)-1)) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR, "unable to get current time");
+ xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("unable to get current time"));
goto error;
}
@@ -2392,18 +2405,21 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) {
entry->conf = conf;
if (xenXMConfigGetUUID(conf, "uuid", uuid) < 0) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR, "uuid config parameter is missing");
+ xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("uuid config parameter is missing"));
goto error;
}
if (virHashAddEntry(configCache, filename, entry) < 0) {
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR, "unable to store config file handle");
+ xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("unable to store config file handle"));
goto error;
}
if (virHashAddEntry(nameConfigMap, value->str, entry->filename) < 0) {
virHashRemoveEntry(configCache, filename, NULL);
- xenXMError(conn, VIR_ERR_INTERNAL_ERROR, "unable to store config file handle");
+ xenXMError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("unable to store config file handle"));
goto error;
}
@@ -2570,11 +2586,13 @@ xenXMDomainAttachDevice(virDomainPtr domain, const char *xml) {
XML_PARSE_NOENT | XML_PARSE_NONET |
XML_PARSE_NOERROR | XML_PARSE_NOWARNING);
if (!doc) {
- xenXMError(domain->conn, VIR_ERR_XML_ERROR, "cannot read XML domain definition");
+ xenXMError(domain->conn, VIR_ERR_XML_ERROR,
+ _("cannot read XML domain definition"));
goto cleanup;
}
if (!(ctxt = xmlXPathNewContext(doc))) {
- xenXMError(domain->conn, VIR_ERR_INTERNAL_ERROR, "cannot create XPath context");
+ xenXMError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ _("cannot create XPath context"));
goto cleanup;
}
obj = xmlXPathEval(BAD_CAST "string(/domain/os/type)", ctxt);
@@ -2591,12 +2609,12 @@ xenXMDomainAttachDevice(virDomainPtr domain, const char *xml) {
XML_PARSE_NOERROR | XML_PARSE_NOWARNING);
if (!doc) {
xenXMError(domain->conn, VIR_ERR_XML_ERROR,
- "cannot read XML domain definition");
+ _("cannot read XML domain definition"));
goto cleanup;
}
if (!(ctxt = xmlXPathNewContext(doc))) {
xenXMError(domain->conn, VIR_ERR_INTERNAL_ERROR,
- "cannot create XPath context");
+ _("cannot create XPath context"));
goto cleanup;
}
@@ -2607,7 +2625,8 @@ xenXMDomainAttachDevice(virDomainPtr domain, const char *xml) {
if (xenXMAttachInterface(domain, ctxt, hvm, node, entry))
goto cleanup;
} else {
- xenXMError(domain->conn, VIR_ERR_XML_ERROR, "unknown device");
+ xenXMError(domain->conn, VIR_ERR_XML_ERROR,
+ _("unknown device"));
goto cleanup;
}
@@ -2989,11 +3008,13 @@ xenXMDomainDetachDevice(virDomainPtr domain, const char *xml) {
XML_PARSE_NOENT | XML_PARSE_NONET |
XML_PARSE_NOERROR | XML_PARSE_NOWARNING);
if (!doc) {
- xenXMError(domain->conn, VIR_ERR_XML_ERROR, "cannot read XML domain definition");
+ xenXMError(domain->conn, VIR_ERR_XML_ERROR,
+ _("cannot read XML domain definition"));
goto cleanup;
}
if (!(ctxt = xmlXPathNewContext(doc))) {
- xenXMError(domain->conn, VIR_ERR_INTERNAL_ERROR, "cannot create XPath context");
+ xenXMError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ _("cannot create XPath context"));
goto cleanup;
}
--
1.5.5.rc0.22.g467c
2
1
Mark many more strings for translation.
* Makefile.maint (err_func_re): Add to the list and make it readable.
* po/POTFILES.in: Add src/util.c and src/xm_internal.c, and sort.
Signed-off-by: Jim Meyering <meyering(a)redhat.com>
---
Makefile.maint | 33 +++++++-
po/POTFILES.in | 10 ++-
qemud/remote.c | 197 +++++++++++++++++++++++++------------------------
src/qemu_driver.c | 137 ++++++++++++++++++++--------------
src/storage_backend.c | 2 +-
src/util.c | 2 +-
src/virsh.c | 11 ++-
src/xm_internal.c | 16 +++--
8 files changed, 233 insertions(+), 175 deletions(-)
diff --git a/Makefile.maint b/Makefile.maint
index 879f211..d870bfd 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -298,8 +298,31 @@ sc_two_space_separator_in_usage:
echo "$(ME): an option and its description"; \
1>&2; exit 1; } || :
-err_func_re = \
-(DISABLE_fprintf|qemudLog|(xmlRpc|vir(Xend|XML|Hash|Conf|Test|LibConn|StorageReport|lxc))Error)
+msg_gen_function =
+msg_gen_function += DISABLE_fprintf
+msg_gen_function += virXendError
+msg_gen_function += virXMLError
+msg_gen_function += virHashError
+msg_gen_function += virConfError
+msg_gen_function += virTestError
+msg_gen_function += virLibConnError
+msg_gen_function += virStorageReportError
+msg_gen_function += virxmlRpcError
+msg_gen_function += virLog
+msg_gen_function += qemudLog
+msg_gen_function += remoteDispatchError
+msg_gen_function += virStorageLog
+
+# msg_gen_function += xenXMError
+# msg_gen_function += virXenError
+# msg_gen_function += ReportError
+# msg_gen_function += testError
+# msg_gen_function += openvzLog
+# msg_gen_function += qemudReportError
+# msg_gen_function += error
+
+func_or := $(shell printf '$(msg_gen_function)'|tr -s '[[:space:]]' '|')
+func_re := ($(func_or))
# Look for diagnostics that aren't marked for translation.
# This won't find any for which error's format string is on a separate line.
@@ -308,12 +331,12 @@ err_func_re = \
# "%s", _("no storage vol w..."
sc_unmarked_diagnostics:
@grep -nE \
- '\<(vshError|error) \([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
+ '\<$(func_re) \([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
| grep -v '_''(' && \
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
exit 1; } || :
- @{ grep -nE '\<$(err_func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \
- grep -A1 -nE '\<$(err_func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \
+ @{ grep -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \
+ grep -A1 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \
| sed 's/_("[^"][^"]*"//;s/[ ]"%s"//' \
| grep '[ ]"' && \
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 25e38ea..54cb077 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,6 +1,6 @@
gnulib/lib/gai_strerror.c
-qemud/remote.c
qemud/qemud.c
+qemud/remote.c
src/conf.c
src/console.c
src/hash.c
@@ -12,20 +12,22 @@ src/proxy_internal.c
src/qemu_conf.c
src/qemu_driver.c
src/remote_internal.c
+src/sexpr.c
src/storage_backend.c
+src/storage_backend_disk.c
src/storage_backend_fs.c
-src/storage_backend_logical.c
src/storage_backend_iscsi.c
-src/storage_backend_disk.c
+src/storage_backend_logical.c
src/storage_conf.c
src/storage_driver.c
-src/sexpr.c
src/test.c
+src/util.c
src/uuid.c
src/virsh.c
src/virterror.c
src/xen_internal.c
src/xend_internal.c
+src/xm_internal.c
src/xml.c
src/xmlrpc.c
src/xs_internal.c
diff --git a/qemud/remote.c b/qemud/remote.c
index c7db5fa..82b8dce 100644
--- a/qemud/remote.c
+++ b/qemud/remote.c
@@ -101,32 +101,34 @@ remoteDispatchClientRequest (struct qemud_server *server,
xdrmem_create (&xdr, client->buffer, client->bufferLength, XDR_DECODE);
if (!xdr_remote_message_header (&xdr, &req)) {
- remoteDispatchError (client, NULL, "xdr_remote_message_header");
+ remoteDispatchError (client, NULL, "%s", _("xdr_remote_message_header"));
xdr_destroy (&xdr);
return;
}
/* Check version, etc. */
if (req.prog != REMOTE_PROGRAM) {
- remoteDispatchError (client, &req, "program mismatch (actual %x, expected %x)",
+ remoteDispatchError (client, &req,
+ _("program mismatch (actual %x, expected %x)"),
req.prog, REMOTE_PROGRAM);
xdr_destroy (&xdr);
return;
}
if (req.vers != REMOTE_PROTOCOL_VERSION) {
- remoteDispatchError (client, &req, "version mismatch (actual %x, expected %x)",
+ remoteDispatchError (client, &req,
+ _("version mismatch (actual %x, expected %x)"),
req.vers, REMOTE_PROTOCOL_VERSION);
xdr_destroy (&xdr);
return;
}
if (req.direction != REMOTE_CALL) {
- remoteDispatchError (client, &req, "direction (%d) != REMOTE_CALL",
+ remoteDispatchError (client, &req, _("direction (%d) != REMOTE_CALL"),
(int) req.direction);
xdr_destroy (&xdr);
return;
}
if (req.status != REMOTE_OK) {
- remoteDispatchError (client, &req, "status (%d) != REMOTE_OK",
+ remoteDispatchError (client, &req, _("status (%d) != REMOTE_OK"),
(int) req.status);
xdr_destroy (&xdr);
return;
@@ -142,7 +144,7 @@ remoteDispatchClientRequest (struct qemud_server *server,
req.proc != REMOTE_PROC_AUTH_SASL_STEP &&
req.proc != REMOTE_PROC_AUTH_POLKIT
) {
- remoteDispatchError (client, &req, "authentication required");
+ remoteDispatchError (client, &req, "%s", _("authentication required"));
xdr_destroy (&xdr);
return;
}
@@ -155,7 +157,7 @@ remoteDispatchClientRequest (struct qemud_server *server,
#include "remote_dispatch_proc_switch.h"
default:
- remoteDispatchError (client, &req, "unknown procedure: %d",
+ remoteDispatchError (client, &req, _("unknown procedure: %d"),
req.proc);
xdr_destroy (&xdr);
return;
@@ -163,7 +165,7 @@ remoteDispatchClientRequest (struct qemud_server *server,
/* Parse args. */
if (!(*args_filter) (&xdr, args)) {
- remoteDispatchError (client, &req, "parse args failed");
+ remoteDispatchError (client, &req, "%s", _("parse args failed"));
xdr_destroy (&xdr);
return;
}
@@ -178,7 +180,8 @@ remoteDispatchClientRequest (struct qemud_server *server,
* an internal error.
*/
if (rv < -2 || rv > 0) {
- remoteDispatchError (client, &req, "internal error - dispatch function returned invalid code %d", rv);
+ remoteDispatchError (client, &req,
+ _("internal error - dispatch function returned invalid code %d"), rv);
return;
}
@@ -200,14 +203,14 @@ remoteDispatchClientRequest (struct qemud_server *server,
len = 0; /* We'll come back and write this later. */
if (!xdr_int (&xdr, &len)) {
- remoteDispatchError (client, &req, "dummy length");
+ remoteDispatchError (client, &req, "%s", _("dummy length"));
xdr_destroy (&xdr);
if (rv == 0) xdr_free (ret_filter, ret);
return;
}
if (!xdr_remote_message_header (&xdr, &rep)) {
- remoteDispatchError (client, &req, "serialise reply header");
+ remoteDispatchError (client, &req, "%s", _("serialise reply header"));
xdr_destroy (&xdr);
if (rv == 0) xdr_free (ret_filter, ret);
return;
@@ -216,7 +219,7 @@ remoteDispatchClientRequest (struct qemud_server *server,
/* If OK, serialise return structure, if error serialise error. */
if (rv == 0) {
if (!(*ret_filter) (&xdr, ret)) {
- remoteDispatchError (client, &req, "serialise return struct");
+ remoteDispatchError (client, &req, "%s", _("serialise return struct"));
xdr_destroy (&xdr);
return;
}
@@ -271,7 +274,7 @@ remoteDispatchClientRequest (struct qemud_server *server,
}
if (!xdr_remote_error (&xdr, &error)) {
- remoteDispatchError (client, &req, "serialise return error");
+ remoteDispatchError (client, &req, "%s", _("serialise return error"));
xdr_destroy (&xdr);
return;
}
@@ -280,13 +283,13 @@ remoteDispatchClientRequest (struct qemud_server *server,
/* Write the length word. */
len = xdr_getpos (&xdr);
if (xdr_setpos (&xdr, 0) == 0) {
- remoteDispatchError (client, &req, "xdr_setpos");
+ remoteDispatchError (client, &req, "%s", _("xdr_setpos"));
xdr_destroy (&xdr);
return;
}
if (!xdr_int (&xdr, &len)) {
- remoteDispatchError (client, &req, "serialise return length");
+ remoteDispatchError (client, &req, "%s", _("serialise return length"));
xdr_destroy (&xdr);
return;
}
@@ -420,7 +423,7 @@ remoteDispatchOpen (struct qemud_server *server ATTRIBUTE_UNUSED,
/* Already opened? */
if (client->conn) {
- remoteDispatchError (client, req, "connection already open");
+ remoteDispatchError (client, req, "%s", _("connection already open"));
return -2;
}
@@ -446,7 +449,7 @@ remoteDispatchOpen (struct qemud_server *server ATTRIBUTE_UNUSED,
#define CHECK_CONN(client) \
if (!client->conn) { \
- remoteDispatchError (client, req, "connection not open"); \
+ remoteDispatchError (client, req, "%s", _("connection not open")); \
return -2; \
}
@@ -493,7 +496,7 @@ remoteDispatchGetType (struct qemud_server *server ATTRIBUTE_UNUSED,
*/
ret->type = strdup (type);
if (!ret->type) {
- remoteDispatchError (client, req, "out of memory in strdup");
+ remoteDispatchError (client, req, "%s", _("out of memory in strdup"));
return -2;
}
@@ -607,7 +610,7 @@ remoteDispatchDomainGetSchedulerType (struct qemud_server *server ATTRIBUTE_UNUS
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -638,19 +641,19 @@ remoteDispatchDomainGetSchedulerParameters (struct qemud_server *server ATTRIBUT
nparams = args->nparams;
if (nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) {
- remoteDispatchError (client, req, "nparams too large");
+ remoteDispatchError (client, req, "%s", _("nparams too large"));
return -2;
}
params = malloc (sizeof (*params) * nparams);
if (params == NULL) {
- remoteDispatchError (client, req, "out of memory allocating array");
+ remoteDispatchError (client, req, "%s", _("out of memory allocating array"));
return -2;
}
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
free (params);
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -669,7 +672,7 @@ remoteDispatchDomainGetSchedulerParameters (struct qemud_server *server ATTRIBUT
virDomainFree(dom);
free (params);
remoteDispatchError (client, req,
- "out of memory allocating return array");
+ "%s", _("out of memory allocating return array"));
return -2;
}
@@ -680,7 +683,7 @@ remoteDispatchDomainGetSchedulerParameters (struct qemud_server *server ATTRIBUT
virDomainFree(dom);
free (params);
remoteDispatchError (client, req,
- "out of memory allocating return array");
+ "%s", _("out of memory allocating return array"));
return -2;
}
ret->params.params_val[i].value.type = params[i].type;
@@ -700,7 +703,7 @@ remoteDispatchDomainGetSchedulerParameters (struct qemud_server *server ATTRIBUT
default:
virDomainFree(dom);
free (params);
- remoteDispatchError (client, req, "unknown type");
+ remoteDispatchError (client, req, "%s", _("unknown type"));
return -2;
}
}
@@ -725,12 +728,12 @@ remoteDispatchDomainSetSchedulerParameters (struct qemud_server *server ATTRIBUT
nparams = args->params.params_len;
if (nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) {
- remoteDispatchError (client, req, "nparams too large");
+ remoteDispatchError (client, req, "%s", _("nparams too large"));
return -2;
}
params = malloc (sizeof (*params) * nparams);
if (params == NULL) {
- remoteDispatchError (client, req, "out of memory allocating array");
+ remoteDispatchError (client, req, "%s", _("out of memory allocating array"));
return -2;
}
@@ -759,7 +762,7 @@ remoteDispatchDomainSetSchedulerParameters (struct qemud_server *server ATTRIBUT
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
free (params);
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -785,7 +788,7 @@ remoteDispatchDomainBlockStats (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
path = args->path;
@@ -816,7 +819,7 @@ remoteDispatchDomainInterfaceStats (struct qemud_server *server ATTRIBUTE_UNUSED
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
path = args->path;
@@ -848,7 +851,7 @@ remoteDispatchDomainAttachDevice (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -872,7 +875,7 @@ remoteDispatchDomainCreate (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -934,7 +937,7 @@ remoteDispatchDomainDestroy (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -956,7 +959,7 @@ remoteDispatchDomainDetachDevice (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -981,7 +984,7 @@ remoteDispatchDomainDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -1007,7 +1010,7 @@ remoteDispatchDomainGetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -1032,7 +1035,7 @@ remoteDispatchDomainGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -1064,7 +1067,7 @@ remoteDispatchDomainGetMaxMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -1089,7 +1092,7 @@ remoteDispatchDomainGetMaxVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -1114,7 +1117,7 @@ remoteDispatchDomainGetOsType (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -1143,19 +1146,19 @@ remoteDispatchDomainGetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
if (args->maxinfo > REMOTE_VCPUINFO_MAX) {
virDomainFree(dom);
- remoteDispatchError (client, req, "maxinfo > REMOTE_VCPUINFO_MAX");
+ remoteDispatchError (client, req, "%s", _("maxinfo > REMOTE_VCPUINFO_MAX"));
return -2;
}
if (args->maxinfo * args->maplen > REMOTE_CPUMAPS_MAX) {
virDomainFree(dom);
- remoteDispatchError (client, req, "maxinfo * maplen > REMOTE_CPUMAPS_MAX");
+ remoteDispatchError (client, req, "%s", _("maxinfo * maplen > REMOTE_CPUMAPS_MAX"));
return -2;
}
@@ -1243,7 +1246,7 @@ remoteDispatchDomainMigratePerform (struct qemud_server *server ATTRIBUTE_UNUSED
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -1292,7 +1295,7 @@ remoteDispatchListDefinedDomains (struct qemud_server *server ATTRIBUTE_UNUSED,
if (args->maxnames > REMOTE_DOMAIN_NAME_LIST_MAX) {
remoteDispatchError (client, req,
- "maxnames > REMOTE_DOMAIN_NAME_LIST_MAX");
+ "%s", _("maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"));
return -2;
}
@@ -1389,13 +1392,13 @@ remoteDispatchDomainPinVcpu (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
if (args->cpumap.cpumap_len > REMOTE_CPUMAP_MAX) {
virDomainFree(dom);
- remoteDispatchError (client, req, "cpumap_len > REMOTE_CPUMAP_MAX");
+ remoteDispatchError (client, req, "%s", _("cpumap_len > REMOTE_CPUMAP_MAX"));
return -2;
}
@@ -1422,7 +1425,7 @@ remoteDispatchDomainReboot (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -1461,7 +1464,7 @@ remoteDispatchDomainResume (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -1485,7 +1488,7 @@ remoteDispatchDomainSave (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -1509,7 +1512,7 @@ remoteDispatchDomainCoreDump (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -1533,7 +1536,7 @@ remoteDispatchDomainSetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -1557,7 +1560,7 @@ remoteDispatchDomainSetMaxMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -1581,7 +1584,7 @@ remoteDispatchDomainSetMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -1605,7 +1608,7 @@ remoteDispatchDomainSetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -1629,7 +1632,7 @@ remoteDispatchDomainShutdown (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -1653,7 +1656,7 @@ remoteDispatchDomainSuspend (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -1677,7 +1680,7 @@ remoteDispatchDomainUndefine (struct qemud_server *server ATTRIBUTE_UNUSED,
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "domain not found");
+ remoteDispatchError (client, req, "%s", _("domain not found"));
return -2;
}
@@ -1700,7 +1703,7 @@ remoteDispatchListDefinedNetworks (struct qemud_server *server ATTRIBUTE_UNUSED,
if (args->maxnames > REMOTE_NETWORK_NAME_LIST_MAX) {
remoteDispatchError (client, req,
- "maxnames > REMOTE_NETWORK_NAME_LIST_MAX");
+ "%s", _("maxnames > REMOTE_NETWORK_NAME_LIST_MAX"));
return -2;
}
@@ -1726,7 +1729,7 @@ remoteDispatchListDomains (struct qemud_server *server ATTRIBUTE_UNUSED,
if (args->maxids > REMOTE_DOMAIN_ID_LIST_MAX) {
remoteDispatchError (client, req,
- "maxids > REMOTE_DOMAIN_ID_LIST_MAX");
+ "%s", _("maxids > REMOTE_DOMAIN_ID_LIST_MAX"));
return -2;
}
@@ -1751,7 +1754,7 @@ remoteDispatchListNetworks (struct qemud_server *server ATTRIBUTE_UNUSED,
if (args->maxnames > REMOTE_NETWORK_NAME_LIST_MAX) {
remoteDispatchError (client, req,
- "maxnames > REMOTE_NETWORK_NAME_LIST_MAX");
+ "%s", _("maxnames > REMOTE_NETWORK_NAME_LIST_MAX"));
return -2;
}
@@ -1778,7 +1781,7 @@ remoteDispatchNetworkCreate (struct qemud_server *server ATTRIBUTE_UNUSED,
net = get_nonnull_network (client->conn, args->net);
if (net == NULL) {
- remoteDispatchError (client, req, "network not found");
+ remoteDispatchError (client, req, "%s", _("network not found"));
return -2;
}
@@ -1838,7 +1841,7 @@ remoteDispatchNetworkDestroy (struct qemud_server *server ATTRIBUTE_UNUSED,
net = get_nonnull_network (client->conn, args->net);
if (net == NULL) {
- remoteDispatchError (client, req, "network not found");
+ remoteDispatchError (client, req, "%s", _("network not found"));
return -2;
}
@@ -1862,7 +1865,7 @@ remoteDispatchNetworkDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED,
net = get_nonnull_network (client->conn, args->net);
if (net == NULL) {
- remoteDispatchError (client, req, "network not found");
+ remoteDispatchError (client, req, "%s", _("network not found"));
return -2;
}
@@ -1888,7 +1891,7 @@ remoteDispatchNetworkGetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED,
net = get_nonnull_network (client->conn, args->net);
if (net == NULL) {
- remoteDispatchError (client, req, "network not found");
+ remoteDispatchError (client, req, "%s", _("network not found"));
return -2;
}
@@ -1912,7 +1915,7 @@ remoteDispatchNetworkGetBridgeName (struct qemud_server *server ATTRIBUTE_UNUSED
net = get_nonnull_network (client->conn, args->net);
if (net == NULL) {
- remoteDispatchError (client, req, "network not found");
+ remoteDispatchError (client, req, "%s", _("network not found"));
return -2;
}
@@ -1974,7 +1977,7 @@ remoteDispatchNetworkSetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED,
net = get_nonnull_network (client->conn, args->net);
if (net == NULL) {
- remoteDispatchError (client, req, "network not found");
+ remoteDispatchError (client, req, "%s", _("network not found"));
return -2;
}
@@ -1998,7 +2001,7 @@ remoteDispatchNetworkUndefine (struct qemud_server *server ATTRIBUTE_UNUSED,
net = get_nonnull_network (client->conn, args->net);
if (net == NULL) {
- remoteDispatchError (client, req, "network not found");
+ remoteDispatchError (client, req, "%s", _("network not found"));
return -2;
}
@@ -2089,13 +2092,14 @@ static char *addrToString(struct qemud_client *client,
port, sizeof(port),
NI_NUMERICHOST | NI_NUMERICSERV)) != 0) {
remoteDispatchError(client, req,
- "Cannot resolve address %d: %s", err, gai_strerror(err));
+ _("Cannot resolve address %d: %s"),
+ err, gai_strerror(err));
return NULL;
}
addr = malloc(strlen(host) + 1 + strlen(port) + 1);
if (!addr) {
- remoteDispatchError(client, req, "cannot allocate address");
+ remoteDispatchError(client, req, "%s", _("cannot allocate address"));
return NULL;
}
@@ -2137,7 +2141,8 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED,
/* Get local address in form IPADDR:PORT */
salen = sizeof(sa);
if (getsockname(client->fd, (struct sockaddr*)&sa, &salen) < 0) {
- remoteDispatchError(client, req, "failed to get sock address %d (%s)",
+ remoteDispatchError(client, req,
+ _("failed to get sock address %d (%s)"),
errno, strerror(errno));
return -2;
}
@@ -2148,7 +2153,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED,
/* Get remote address in form IPADDR:PORT */
salen = sizeof(sa);
if (getpeername(client->fd, (struct sockaddr*)&sa, &salen) < 0) {
- remoteDispatchError(client, req, "failed to get peer address %d (%s)",
+ remoteDispatchError(client, req, _("failed to get peer address %d (%s)"),
errno, strerror(errno));
free(localAddr);
return -2;
@@ -2413,7 +2418,8 @@ remoteDispatchAuthSaslStart (struct qemud_server *server,
if (serverout) {
ret->data.data_val = malloc(serveroutlen);
if (!ret->data.data_val) {
- remoteDispatchError (client, req, "out of memory allocating array");
+ remoteDispatchError (client, req,
+ "%s", _("out of memory allocating array"));
return -2;
}
memcpy(ret->data.data_val, serverout, serveroutlen);
@@ -2493,7 +2499,8 @@ remoteDispatchAuthSaslStep (struct qemud_server *server,
if (serverout) {
ret->data.data_val = malloc(serveroutlen);
if (!ret->data.data_val) {
- remoteDispatchError (client, req, "out of memory allocating array");
+ remoteDispatchError (client, req,
+ "%s", _("out of memory allocating array"));
return -2;
}
memcpy(ret->data.data_val, serverout, serveroutlen);
@@ -2737,7 +2744,7 @@ remoteDispatchListDefinedStoragePools (struct qemud_server *server ATTRIBUTE_UNU
if (args->maxnames > REMOTE_NETWORK_NAME_LIST_MAX) {
remoteDispatchError (client, req,
- "maxnames > REMOTE_NETWORK_NAME_LIST_MAX");
+ "%s", _("maxnames > REMOTE_NETWORK_NAME_LIST_MAX"));
return -2;
}
@@ -2763,7 +2770,7 @@ remoteDispatchListStoragePools (struct qemud_server *server ATTRIBUTE_UNUSED,
if (args->maxnames > REMOTE_STORAGE_POOL_NAME_LIST_MAX) {
remoteDispatchError (client, req,
- "maxnames > REMOTE_STORAGE_POOL_NAME_LIST_MAX");
+ "%s", _("maxnames > REMOTE_STORAGE_POOL_NAME_LIST_MAX"));
return -2;
}
@@ -2790,7 +2797,7 @@ remoteDispatchStoragePoolCreate (struct qemud_server *server ATTRIBUTE_UNUSED,
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "storage_pool not found");
+ remoteDispatchError (client, req, "%s", _("storage_pool not found"));
return -2;
}
@@ -2850,7 +2857,7 @@ remoteDispatchStoragePoolBuild (struct qemud_server *server ATTRIBUTE_UNUSED,
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "storage_pool not found");
+ remoteDispatchError (client, req, "%s", _("storage_pool not found"));
return -2;
}
@@ -2875,7 +2882,7 @@ remoteDispatchStoragePoolDestroy (struct qemud_server *server ATTRIBUTE_UNUSED,
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "storage_pool not found");
+ remoteDispatchError (client, req, "%s", _("storage_pool not found"));
return -2;
}
@@ -2899,7 +2906,7 @@ remoteDispatchStoragePoolDelete (struct qemud_server *server ATTRIBUTE_UNUSED,
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "storage_pool not found");
+ remoteDispatchError (client, req, "%s", _("storage_pool not found"));
return -2;
}
@@ -2923,7 +2930,7 @@ remoteDispatchStoragePoolRefresh (struct qemud_server *server ATTRIBUTE_UNUSED,
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "storage_pool not found");
+ remoteDispatchError (client, req, "%s", _("storage_pool not found"));
return -2;
}
@@ -2948,7 +2955,7 @@ remoteDispatchStoragePoolGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "storage_pool not found");
+ remoteDispatchError (client, req, "%s", _("storage_pool not found"));
return -2;
}
@@ -2979,7 +2986,7 @@ remoteDispatchStoragePoolDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED,
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "storage_pool not found");
+ remoteDispatchError (client, req, "%s", _("storage_pool not found"));
return -2;
}
@@ -3005,7 +3012,7 @@ remoteDispatchStoragePoolGetAutostart (struct qemud_server *server ATTRIBUTE_UNU
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "storage_pool not found");
+ remoteDispatchError (client, req, "%s", _("storage_pool not found"));
return -2;
}
@@ -3088,7 +3095,7 @@ remoteDispatchStoragePoolSetAutostart (struct qemud_server *server ATTRIBUTE_UNU
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "storage_pool not found");
+ remoteDispatchError (client, req, "%s", _("storage_pool not found"));
return -2;
}
@@ -3112,7 +3119,7 @@ remoteDispatchStoragePoolUndefine (struct qemud_server *server ATTRIBUTE_UNUSED,
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "storage_pool not found");
+ remoteDispatchError (client, req, "%s", _("storage_pool not found"));
return -2;
}
@@ -3166,13 +3173,13 @@ remoteDispatchStoragePoolListVolumes (struct qemud_server *server ATTRIBUTE_UNUS
if (args->maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX) {
remoteDispatchError (client, req,
- "maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX");
+ "%s", _("maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX"));
return -2;
}
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "storage_pool not found");
+ remoteDispatchError (client, req, "%s", _("storage_pool not found"));
return -2;
}
@@ -3201,7 +3208,7 @@ remoteDispatchStoragePoolNumOfVolumes (struct qemud_server *server ATTRIBUTE_UNU
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "storage_pool not found");
+ remoteDispatchError (client, req, "%s", _("storage_pool not found"));
return -2;
}
@@ -3232,7 +3239,7 @@ remoteDispatchStorageVolCreateXml (struct qemud_server *server ATTRIBUTE_UNUSED,
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "storage_pool not found");
+ remoteDispatchError (client, req, "%s", _("storage_pool not found"));
return -2;
}
@@ -3258,7 +3265,7 @@ remoteDispatchStorageVolDelete (struct qemud_server *server ATTRIBUTE_UNUSED,
vol = get_nonnull_storage_vol (client->conn, args->vol);
if (vol == NULL) {
- remoteDispatchError (client, req, "storage_vol not found");
+ remoteDispatchError (client, req, "%s", _("storage_vol not found"));
return -2;
}
@@ -3283,7 +3290,7 @@ remoteDispatchStorageVolGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
vol = get_nonnull_storage_vol (client->conn, args->vol);
if (vol == NULL) {
- remoteDispatchError (client, req, "storage_vol not found");
+ remoteDispatchError (client, req, "%s", _("storage_vol not found"));
return -2;
}
@@ -3313,7 +3320,7 @@ remoteDispatchStorageVolDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED,
vol = get_nonnull_storage_vol (client->conn, args->vol);
if (vol == NULL) {
- remoteDispatchError (client, req, "storage_vol not found");
+ remoteDispatchError (client, req, "%s", _("storage_vol not found"));
return -2;
}
@@ -3340,7 +3347,7 @@ remoteDispatchStorageVolGetPath (struct qemud_server *server ATTRIBUTE_UNUSED,
vol = get_nonnull_storage_vol (client->conn, args->vol);
if (vol == NULL) {
- remoteDispatchError (client, req, "storage_vol not found");
+ remoteDispatchError (client, req, "%s", _("storage_vol not found"));
return -2;
}
@@ -3368,7 +3375,7 @@ remoteDispatchStorageVolLookupByName (struct qemud_server *server ATTRIBUTE_UNUS
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "storage_pool not found");
+ remoteDispatchError (client, req, "%s", _("storage_pool not found"));
return -2;
}
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 4a65a08..34abe14 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -474,12 +474,12 @@ static int qemudOpenMonitor(virConnectPtr conn,
}
if (qemudSetCloseExec(monfd) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Unable to set monitor close-on-exec flag"));
+ "%s", _("Unable to set monitor close-on-exec flag"));
goto error;
}
if (qemudSetNonBlock(monfd) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Unable to put monitor into non-blocking mode"));
+ "%s", _("Unable to put monitor into non-blocking mode"));
goto error;
}
@@ -608,7 +608,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
if (qemudIsActiveVM(vm)) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("VM is already active"));
+ "%s", _("VM is already active"));
return -1;
}
@@ -616,7 +616,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
int port = qemudNextFreeVNCPort(driver);
if (port < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Unable to find an unused VNC port"));
+ "%s", _("Unable to find an unused VNC port"));
return -1;
}
vm->def->vncActivePort = port;
@@ -930,7 +930,7 @@ dhcpStartDhcpDaemon(virConnectPtr conn,
if (network->def->ipAddress[0] == '\0') {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot start dhcp daemon without IP address for server"));
+ "%s", _("cannot start dhcp daemon without IP address for server"));
return -1;
}
@@ -1142,7 +1142,7 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if (qemudIsActiveNetwork(network)) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("network is already active"));
+ "%s", _("network is already active"));
return -1;
}
@@ -1666,14 +1666,16 @@ static int qemudDomainSuspend(virDomainPtr dom) {
return -1;
}
if (!qemudIsActiveVM(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, _("domain is not running"));
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
+ "%s", _("domain is not running"));
return -1;
}
if (vm->state == VIR_DOMAIN_PAUSED)
return 0;
if (qemudMonitorCommand(driver, vm, "stop", &info) < 0) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, _("suspend operation failed"));
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
+ "%s", _("suspend operation failed"));
return -1;
}
vm->state = VIR_DOMAIN_PAUSED;
@@ -1688,17 +1690,20 @@ static int qemudDomainResume(virDomainPtr dom) {
char *info;
struct qemud_vm *vm = qemudFindVMByID(driver, dom->id);
if (!vm) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching id %d"), dom->id);
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
+ _("no domain with matching id %d"), dom->id);
return -1;
}
if (!qemudIsActiveVM(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, _("domain is not running"));
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
+ "%s", _("domain is not running"));
return -1;
}
if (vm->state == VIR_DOMAIN_RUNNING)
return 0;
if (qemudMonitorCommand(driver, vm, "cont", &info) < 0) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, _("resume operation failed"));
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
+ "%s", _("resume operation failed"));
return -1;
}
vm->state = VIR_DOMAIN_RUNNING;
@@ -1721,7 +1726,7 @@ static int qemudDomainShutdown(virDomainPtr dom) {
if (qemudMonitorCommand(driver, vm, "system_powerdown", &info) < 0) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("shutdown operation failed"));
+ "%s", _("shutdown operation failed"));
return -1;
}
return 0;
@@ -1754,7 +1759,7 @@ static char *qemudDomainGetOSType(virDomainPtr dom) {
if (!vm) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- _("no domain with matching uuid"));
+ "%s", _("no domain with matching uuid"));
return NULL;
}
@@ -1791,7 +1796,7 @@ static int qemudDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) {
if (newmax < vm->def->memory) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- _("cannot set max memory lower than current memory"));
+ "%s", _("cannot set max memory lower than current memory"));
return -1;
}
@@ -1811,13 +1816,13 @@ static int qemudDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
if (qemudIsActiveVM(vm)) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot set memory of an active domain"));
+ "%s", _("cannot set memory of an active domain"));
return -1;
}
if (newmem > vm->def->maxmem) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- _("cannot set memory higher than max memory"));
+ "%s", _("cannot set memory higher than max memory"));
return -1;
}
@@ -1830,7 +1835,8 @@ static int qemudDomainGetInfo(virDomainPtr dom,
struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
if (!vm) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
+ "%s", _("no domain with matching uuid"));
return -1;
}
@@ -1967,7 +1973,7 @@ static int qemudDomainSave(virDomainPtr dom,
if (!qemudIsActiveVM(vm)) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("domain is not running"));
+ "%s", _("domain is not running"));
return -1;
}
@@ -1976,7 +1982,7 @@ static int qemudDomainSave(virDomainPtr dom,
header.was_running = 1;
if (qemudDomainSuspend(dom) != 0) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to pause domain"));
+ "%s", _("failed to pause domain"));
return -1;
}
}
@@ -1985,7 +1991,7 @@ static int qemudDomainSave(virDomainPtr dom,
xml = qemudGenerateXML(dom->conn, driver, vm, vm->def, 0);
if (!xml) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to get domain xml"));
+ "%s", _("failed to get domain xml"));
return -1;
}
header.xml_len = strlen(xml) + 1;
@@ -2000,7 +2006,7 @@ static int qemudDomainSave(virDomainPtr dom,
if (safewrite(fd, &header, sizeof(header)) != sizeof(header)) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to write save header"));
+ "%s", _("failed to write save header"));
close(fd);
free(xml);
return -1;
@@ -2008,7 +2014,7 @@ static int qemudDomainSave(virDomainPtr dom,
if (safewrite(fd, xml, header.xml_len) != header.xml_len) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to write xml"));
+ "%s", _("failed to write xml"));
close(fd);
free(xml);
return -1;
@@ -2021,14 +2027,14 @@ static int qemudDomainSave(virDomainPtr dom,
safe_path = qemudEscapeShellArg(path);
if (!safe_path) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("out of memory"));
+ "%s", _("out of memory"));
return -1;
}
if (asprintf (&command, "migrate \"exec:"
"dd of='%s' oflag=append conv=notrunc 2>/dev/null"
"\"", safe_path) == -1) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("out of memory"));
+ "%s", _("out of memory"));
free(safe_path);
return -1;
}
@@ -2036,7 +2042,7 @@ static int qemudDomainSave(virDomainPtr dom,
if (qemudMonitorCommand(driver, vm, command, &info) < 0) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("migrate operation failed"));
+ "%s", _("migrate operation failed"));
free(command);
return -1;
}
@@ -2066,20 +2072,20 @@ static int qemudDomainRestore(virConnectPtr conn,
/* Verify the header and read the XML */
if ((fd = open(path, O_RDONLY)) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("cannot read domain image"));
+ "%s", _("cannot read domain image"));
return -1;
}
if (saferead(fd, &header, sizeof(header)) != sizeof(header)) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to read qemu header"));
+ "%s", _("failed to read qemu header"));
close(fd);
return -1;
}
if (memcmp(header.magic, QEMUD_SAVE_MAGIC, sizeof(header.magic)) != 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("image magic is incorrect"));
+ "%s", _("image magic is incorrect"));
close(fd);
return -1;
}
@@ -2094,14 +2100,14 @@ static int qemudDomainRestore(virConnectPtr conn,
if ((xml = (char *)malloc(header.xml_len)) == NULL) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("out of memory"));
+ "%s", _("out of memory"));
close(fd);
return -1;
}
if (saferead(fd, xml, header.xml_len) != header.xml_len) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to read XML"));
+ "%s", _("failed to read XML"));
close(fd);
free(xml);
return -1;
@@ -2110,7 +2116,7 @@ static int qemudDomainRestore(virConnectPtr conn,
/* Create a domain from this XML */
if (!(def = qemudParseVMDef(conn, driver, xml, NULL))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to parse XML"));
+ "%s", _("failed to parse XML"));
close(fd);
free(xml);
return -1;
@@ -2129,7 +2135,7 @@ static int qemudDomainRestore(virConnectPtr conn,
if (!(vm = qemudAssignVMDef(conn, driver, def))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to assign new VM"));
+ "%s", _("failed to assign new VM"));
qemudFreeVMDef(def);
close(fd);
return -1;
@@ -2144,7 +2150,7 @@ static int qemudDomainRestore(virConnectPtr conn,
vm->stdin = -1;
if (ret < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to start VM"));
+ "%s", _("failed to start VM"));
if (!vm->configFile[0])
qemudRemoveInactiveVM(driver, vm);
return -1;
@@ -2155,7 +2161,7 @@ static int qemudDomainRestore(virConnectPtr conn,
char *info;
if (qemudMonitorCommand(driver, vm, "cont", &info) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to resume domain"));
+ "%s", _("failed to resume domain"));
return -1;
}
free(info);
@@ -2171,7 +2177,8 @@ static char *qemudDomainDumpXML(virDomainPtr dom,
struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
if (!vm) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
+ "%s", _("no domain with matching uuid"));
return NULL;
}
@@ -2215,7 +2222,7 @@ static int qemudDomainStart(virDomainPtr dom) {
if (!vm) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- _("no domain with matching uuid"));
+ "%s", _("no domain with matching uuid"));
return -1;
}
@@ -2252,12 +2259,14 @@ static int qemudDomainUndefine(virDomainPtr dom) {
struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
if (!vm) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
+ "%s", _("no domain with matching uuid"));
return -1;
}
if (qemudIsActiveVM(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, _("cannot delete active domain"));
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("cannot delete active domain"));
return -1;
}
@@ -2287,7 +2296,7 @@ static int qemudDomainChangeCDROM(virDomainPtr dom,
safe_path = qemudEscapeMonitorArg(newdisk->src);
if (!safe_path) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("out of memory"));
+ "%s", _("out of memory"));
return -1;
}
if (asprintf (&cmd, "change %s \"%s\"",
@@ -2295,7 +2304,7 @@ static int qemudDomainChangeCDROM(virDomainPtr dom,
/* olddisk->dst */ "cdrom",
safe_path) == -1) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("out of memory"));
+ "%s", _("out of memory"));
free(safe_path);
return -1;
}
@@ -2303,12 +2312,13 @@ static int qemudDomainChangeCDROM(virDomainPtr dom,
} else if (asprintf(&cmd, "eject cdrom") == -1) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("out of memory"));
+ "%s", _("out of memory"));
return -1;
}
if (qemudMonitorCommand(driver, vm, cmd, &reply) < 0) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, _("cannot change cdrom media"));
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
+ "%s", _("cannot change cdrom media"));
free(cmd);
return -1;
}
@@ -2327,12 +2337,14 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
struct qemud_vm_disk_def *disk;
if (!vm) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
+ "%s", _("no domain with matching uuid"));
return -1;
}
if (!qemudIsActiveVM(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, _("cannot attach device on inactive domain"));
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("cannot attach device on inactive domain"));
return -1;
}
@@ -2342,7 +2354,8 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
}
if (dev->type != QEMUD_DEVICE_DISK || dev->data.disk.device != QEMUD_DISK_CDROM) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT, _("only CDROM disk devices can be attached"));
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
+ "%s", _("only CDROM disk devices can be attached"));
free(dev);
return -1;
}
@@ -2356,7 +2369,8 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
}
if (!disk) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT, _("CDROM not attached, cannot change media"));
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
+ "%s", _("CDROM not attached, cannot change media"));
free(dev);
return -1;
}
@@ -2376,7 +2390,8 @@ static int qemudDomainGetAutostart(virDomainPtr dom,
struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
if (!vm) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
+ "%s", _("no domain with matching uuid"));
return -1;
}
@@ -2391,7 +2406,8 @@ static int qemudDomainSetAutostart(virDomainPtr dom,
struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
if (!vm) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
+ "%s", _("no domain with matching uuid"));
return -1;
}
@@ -2590,13 +2606,13 @@ qemudDomainInterfaceStats (virDomainPtr dom,
if (!qemudIsActiveVM(vm)) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("domain is not running"));
+ "%s", _("domain is not running"));
return -1;
}
if (!path || path[0] == '\0') {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- _("NULL or empty path"));
+ "%s", _("NULL or empty path"));
return -1;
}
@@ -2638,7 +2654,8 @@ static virNetworkPtr qemudNetworkLookupByUUID(virConnectPtr conn ATTRIBUTE_UNUSE
virNetworkPtr net;
if (!network) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_NETWORK, _("no network with matching uuid"));
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_NETWORK,
+ "%s", _("no network with matching uuid"));
return NULL;
}
@@ -2652,7 +2669,8 @@ static virNetworkPtr qemudNetworkLookupByName(virConnectPtr conn ATTRIBUTE_UNUSE
virNetworkPtr net;
if (!network) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_NETWORK, _("no network with matching name"));
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_NETWORK,
+ "%s", _("no network with matching name"));
return NULL;
}
@@ -2781,7 +2799,8 @@ static int qemudNetworkUndefine(virNetworkPtr net) {
struct qemud_network *network = qemudFindNetworkByUUID(driver, net->uuid);
if (!network) {
- qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_DOMAIN, _("no network with matching uuid"));
+ qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_DOMAIN,
+ "%s", _("no network with matching uuid"));
return -1;
}
@@ -2806,7 +2825,7 @@ static int qemudNetworkStart(virNetworkPtr net) {
if (!network) {
qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK,
- _("no network with matching uuid"));
+ "%s", _("no network with matching uuid"));
return -1;
}
@@ -2820,7 +2839,7 @@ static int qemudNetworkDestroy(virNetworkPtr net) {
if (!network) {
qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK,
- _("no network with matching uuid"));
+ "%s", _("no network with matching uuid"));
return -1;
}
@@ -2835,7 +2854,7 @@ static char *qemudNetworkDumpXML(virNetworkPtr net, int flags ATTRIBUTE_UNUSED)
if (!network) {
qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK,
- _("no network with matching uuid"));
+ "%s", _("no network with matching uuid"));
return NULL;
}
@@ -2865,7 +2884,8 @@ static int qemudNetworkGetAutostart(virNetworkPtr net,
struct qemud_network *network = qemudFindNetworkByUUID(driver, net->uuid);
if (!network) {
- qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK, _("no network with matching uuid"));
+ qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK,
+ "%s", _("no network with matching uuid"));
return -1;
}
@@ -2880,7 +2900,8 @@ static int qemudNetworkSetAutostart(virNetworkPtr net,
struct qemud_network *network = qemudFindNetworkByUUID(driver, net->uuid);
if (!network) {
- qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK, _("no network with matching uuid"));
+ qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK,
+ "%s", _("no network with matching uuid"));
return -1;
}
diff --git a/src/storage_backend.c b/src/storage_backend.c
index 4a58cb6..92aecfd 100644
--- a/src/storage_backend.c
+++ b/src/storage_backend.c
@@ -1,5 +1,5 @@
/*
- * storage_backend.h: internal storage driver backend contract
+ * storage_backend.c: internal storage driver backend contract
*
* Copyright (C) 2007-2008 Red Hat, Inc.
* Copyright (C) 2007-2008 Daniel P. Berrange
diff --git a/src/util.c b/src/util.c
index 69e899f..188b7a8 100644
--- a/src/util.c
+++ b/src/util.c
@@ -461,7 +461,7 @@ int
virFileLinkPointsTo (const char *checkLink ATTRIBUTE_UNUSED,
const char *checkDest ATTRIBUTE_UNUSED)
{
- virLog ("%s: not implemented", __FUNCTION__);
+ virLog (_("%s: not implemented"), __FUNCTION__);
return 0;
}
diff --git a/src/virsh.c b/src/virsh.c
index c541f88..e7189e2 100644
--- a/src/virsh.c
+++ b/src/virsh.c
@@ -1723,13 +1723,14 @@ cmdVcpupin(vshControl * ctl, vshCmd * cmd)
vcpu = vshCommandOptInt(cmd, "vcpu", &vcpufound);
if (!vcpufound) {
- vshError(ctl, FALSE, _("vcpupin: Invalid or missing vCPU number."));
+ vshError(ctl, FALSE, "%s",
+ _("vcpupin: Invalid or missing vCPU number."));
virDomainFree(dom);
return FALSE;
}
if (!(cpulist = vshCommandOptString(cmd, "cpulist", NULL))) {
- vshError(ctl, FALSE, _("vcpupin: Missing cpulist"));
+ vshError(ctl, FALSE, "%s", _("vcpupin: Missing cpulist"));
virDomainFree(dom);
return FALSE;
}
@@ -1740,7 +1741,7 @@ cmdVcpupin(vshControl * ctl, vshCmd * cmd)
}
if (virDomainGetInfo(dom, &info) != 0) {
- vshError(ctl, FALSE, _("vcpupin: Invalid vCPU number."));
+ vshError(ctl, FALSE, "%s", _("vcpupin: Invalid vCPU number."));
virDomainFree(dom);
return FALSE;
}
@@ -4475,7 +4476,7 @@ cmdAttachDevice(vshControl * ctl, vshCmd * cmd)
from = vshCommandOptString(cmd, "file", &found);
if (!found) {
- vshError(ctl, FALSE, _("attach-device: Missing <file> option"));
+ vshError(ctl, FALSE, "%s", _("attach-device: Missing <file> option"));
virDomainFree(dom);
return FALSE;
}
@@ -4532,7 +4533,7 @@ cmdDetachDevice(vshControl * ctl, vshCmd * cmd)
from = vshCommandOptString(cmd, "file", &found);
if (!found) {
- vshError(ctl, FALSE, _("detach-device: Missing <file> option"));
+ vshError(ctl, FALSE, "%s", _("detach-device: Missing <file> option"));
virDomainFree(dom);
return FALSE;
}
diff --git a/src/xm_internal.c b/src/xm_internal.c
index 6b4b4d7..55684e7 100644
--- a/src/xm_internal.c
+++ b/src/xm_internal.c
@@ -434,7 +434,8 @@ static int xenXMConfigCacheRefresh (virConnectPtr conn) {
virHashRemoveEntry(configCache, path, NULL);
}
free(entry);
- xenXMError (conn, VIR_ERR_INTERNAL_ERROR, "xenXMConfigCacheRefresh: name");
+ xenXMError (conn, VIR_ERR_INTERNAL_ERROR,
+ _("xenXMConfigCacheRefresh: name"));
goto cleanup;
}
@@ -444,7 +445,8 @@ static int xenXMConfigCacheRefresh (virConnectPtr conn) {
if (virHashAddEntry(configCache, entry->filename, entry) < 0) {
virConfFree(entry->conf);
free(entry);
- xenXMError (conn, VIR_ERR_INTERNAL_ERROR, "xenXMConfigCacheRefresh: virHashAddEntry");
+ xenXMError (conn, VIR_ERR_INTERNAL_ERROR,
+ _("xenXMConfigCacheRefresh: virHashAddEntry"));
goto cleanup;
}
}
@@ -1254,21 +1256,23 @@ int xenXMDomainPinVcpu(virDomainPtr domain,
return -1;
}
if (domain->conn->flags & VIR_CONNECT_RO) {
- xenXMError (domain->conn, VIR_ERR_INVALID_ARG, "read only connection");
+ xenXMError (domain->conn, VIR_ERR_INVALID_ARG,
+ _("read only connection"));
return -1;
}
if (domain->id != -1) {
- xenXMError (domain->conn, VIR_ERR_INVALID_ARG, "not inactive domain");
+ xenXMError (domain->conn, VIR_ERR_INVALID_ARG,
+ _("not inactive domain"));
return -1;
}
if (!(filename = virHashLookup(nameConfigMap, domain->name))) {
- xenXMError (domain->conn, VIR_ERR_INTERNAL_ERROR, "virHashLookup");
+ xenXMError (domain->conn, VIR_ERR_INTERNAL_ERROR, _("virHashLookup"));
return -1;
}
if (!(entry = virHashLookup(configCache, filename))) {
xenXMError (domain->conn, VIR_ERR_INTERNAL_ERROR,
- "can't retrieve config file for domain");
+ _("can't retrieve config file for domain"));
return -1;
}
--
1.5.5.rc0.22.g467c
2
1
On my system, libvirt-0.4.0-2ubuntu6 added the following rule to allow
my virtual hosts NATted access to the outside world:
> Chain POSTROUTING (policy ACCEPT 33904 packets, 2146K bytes)
> pkts bytes target prot opt in out source destination
> 779 102K MASQUERADE all -- * * 192.168.65.0/24 0.0.0.0/0
This resulted in *all* traffic being masqueraded, even between two
different VMs -- preventing hostbased authentication between these VMs.
To temporarily resolve this, I added an additional rule, as follows:
> Chain POSTROUTING (policy ACCEPT 34049 packets, 2160K bytes)
> pkts bytes target prot opt in out source destination
> 156 9752 ACCEPT all -- * * 192.168.65.0/24 192.168.65.0/24
> 865 109K MASQUERADE all -- * * 192.168.65.0/24 0.0.0.0/0
The network definition being used was as follows:
> <network>
> <name>default</name>
> <uuid>a7c5b18c-9d38-40ed-9b12-8b1a27013b85</uuid>
> <bridge name="virbr%d" />
> <forward/>
> <ip address="192.168.65.253" netmask="255.255.255.0"/>
> </network>
I'm frankly unclear on why the packets attempted to forward through .253
in any event -- the routing tables on both VMs refer to 192.168.65.0/24
as part of the local network, so my expectation is that no attempt to
route through the default gateway should have occurred.
In any event, having libvirt extend the MASQUERADE rule to avoid
impacting traffic between hosts on the virtual network -- or adding a
paired ACCEPT, as I did above -- would probably be a Good Thing.
2
4
This patch contains the shutdown and destroy domain support for Linux Containers.
A shutdown of the container is requested by sending a SIGINT to the container
root process.
A container is destroyed by sending a SIGKILL to the container root process.
When this process exits, it takes all container child processes with it.
Thanks!
--
Best Regards,
Dave Leskovec
IBM Linux Technology Center
Open Virtualization
2
2
Sorry - I should have mentioned that the two lxc patches I just posted are built
on Dan B's patch. The order is this:
Dan's patch
lxc_start.patch
lxc_stop.patch
Thanks!
--
Best Regards,
Dave Leskovec
IBM Linux Technology Center
Open Virtualization
3
3
Hi!
I am trying to build Ruby bindings for libvirt 0.4.1.
I have checked out ruby-libvirt from mercurial repository, but it
fails during the build:
# rake build
(in /home/lord/tmp/ruby-libvirt)
make
gcc -I. -I/usr/lib/ruby/1.8/i386-linux -I/usr/lib/ruby/1.8/i386-linux -
I. -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -
fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -
mtune=generic -fasynchronous-unwind-tables -Wall -fPIC -c _libvirt.c
_libvirt.c:165: error: expected Б─≤,Б─≥ or Б─≤;Б─≥ before Б─≤{Б─≥ token
make: *** [_libvirt.o] Error 1
rake aborted!
Command failed with status (2): [make...]
/home/lord/tmp/ruby-libvirt/Rakefile:52
(See full trace by running task with --trace)
The offending line is:
NORETURN(static void vir_error(virConnectPtr conn, const char *fn)) {
rb_raise(rb_eSystemCallError, "libvir call %s failed", fn);
}
removing NORETURN macro around function definition eliminates the
error and all tests pass:
# rake test
(in /home/lord/tmp/ruby-libvirt)
Loaded suite /usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/
rake_test_loader
Started
.....
Finished in 0.006453 seconds.
5 tests, 58 assertions, 0 failures, 0 errors
Here is some information about my system:
# gcc --version
gcc (GCC) 4.1.2 20070626 (Red Hat 4.1.2-14)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There
is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
# cat /etc/redhat-release
CentOS release 5 (Final)
# arch
i686
Sincerely,
Vadim
2
3
This patch adds the lxc_driver source files.
--
Best Regards,
Dave Leskovec
IBM Linux Technology Center
Open Virtualization
4
11
This patch marks the error messages in qemu_driver.c as translatable,
some of them were marked as such already. Please apply.
-- Guido
---
src/qemu_driver.c | 200 ++++++++++++++++++++++++++--------------------------
1 files changed, 100 insertions(+), 100 deletions(-)
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index af5fc40..719f46e 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -392,7 +392,7 @@ qemudReadMonitorOutput(virConnectPtr conn,
ret = read(fd, buf+got, buflen-got-1);
if (ret == 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "QEMU quit during %s startup\n%s", what, buf);
+ _("QEMU quit during %s startup\n%s"), what, buf);
return -1;
}
if (ret < 0) {
@@ -402,7 +402,7 @@ qemudReadMonitorOutput(virConnectPtr conn,
if (errno != EAGAIN) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Failure while reading %s startup output: %s",
+ _("Failure while reading %s startup output: %s"),
what, strerror(errno));
return -1;
}
@@ -410,12 +410,12 @@ qemudReadMonitorOutput(virConnectPtr conn,
ret = poll(&pfd, 1, MONITOR_TIMEOUT);
if (ret == 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Timed out while reading %s startup output", what);
+ _("Timed out while reading %s startup output"), what);
return -1;
} else if (ret == -1) {
if (errno != EINTR) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Failure while reading %s startup output: %s",
+ _("Failure while reading %s startup output: %s"),
what, strerror(errno));
return -1;
}
@@ -426,7 +426,7 @@ qemudReadMonitorOutput(virConnectPtr conn,
continue;
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Failure while reading %s startup output", what);
+ _("Failure while reading %s startup output"), what);
return -1;
}
} else {
@@ -438,7 +438,7 @@ qemudReadMonitorOutput(virConnectPtr conn,
}
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Out of space while reading %s startup output", what);
+ _("Out of space while reading %s startup output"), what);
return -1;
#undef MONITOR_TIMEOUT
@@ -469,17 +469,17 @@ static int qemudOpenMonitor(virConnectPtr conn,
if (!(monfd = open(monitor, O_RDWR))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Unable to open monitor path %s", monitor);
+ _("Unable to open monitor path %s"), monitor);
return -1;
}
if (qemudSetCloseExec(monfd) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Unable to set monitor close-on-exec flag");
+ _("Unable to set monitor close-on-exec flag"));
goto error;
}
if (qemudSetNonBlock(monfd) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Unable to put monitor into non-blocking mode");
+ _("Unable to put monitor into non-blocking mode"));
goto error;
}
@@ -608,7 +608,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
if (qemudIsActiveVM(vm)) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "VM is already active");
+ _("VM is already active"));
return -1;
}
@@ -616,7 +616,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
int port = qemudNextFreeVNCPort(driver);
if (port < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Unable to find an unused VNC port");
+ _("Unable to find an unused VNC port"));
return -1;
}
vm->def->vncActivePort = port;
@@ -629,7 +629,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
4 + /* suffix .log */
1 /* NULL */) > PATH_MAX) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "config file path too long: %s/%s.log",
+ _("config file path too long: %s/%s.log"),
driver->logDir, vm->def->name);
return -1;
}
@@ -640,7 +640,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
if (virFileMakePath(driver->logDir) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot create log directory %s: %s",
+ _("cannot create log directory %s: %s"),
driver->logDir, strerror(errno));
return -1;
}
@@ -648,13 +648,13 @@ static int qemudStartVMDaemon(virConnectPtr conn,
if ((vm->logfile = open(logfile, O_CREAT | O_TRUNC | O_WRONLY,
S_IRUSR | S_IWUSR)) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to create logfile %s: %s",
+ _("failed to create logfile %s: %s"),
logfile, strerror(errno));
return -1;
}
if (qemudSetCloseExec(vm->logfile) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "Unable to set VM logfile close-on-exec flag %s",
+ _("Unable to set VM logfile close-on-exec flag %s"),
strerror(errno));
close(vm->logfile);
vm->logfile = -1;
@@ -930,7 +930,7 @@ dhcpStartDhcpDaemon(virConnectPtr conn,
if (network->def->ipAddress[0] == '\0') {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot start dhcp daemon without IP address for server");
+ _("cannot start dhcp daemon without IP address for server"));
return -1;
}
@@ -962,14 +962,14 @@ qemudAddIptablesRules(virConnectPtr conn,
/* allow DHCP requests through to dnsmasq */
if ((err = iptablesAddTcpInput(driver->iptables, network->bridge, 67))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to allow DHCP requests from '%s' : %s\n",
+ _("failed to add iptables rule to allow DHCP requests from '%s' : %s\n"),
network->bridge, strerror(err));
goto err1;
}
if ((err = iptablesAddUdpInput(driver->iptables, network->bridge, 67))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to allow DHCP requests from '%s' : %s\n",
+ _("failed to add iptables rule to allow DHCP requests from '%s' : %s\n"),
network->bridge, strerror(err));
goto err2;
}
@@ -977,14 +977,14 @@ qemudAddIptablesRules(virConnectPtr conn,
/* allow DNS requests through to dnsmasq */
if ((err = iptablesAddTcpInput(driver->iptables, network->bridge, 53))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to allow DNS requests from '%s' : %s\n",
+ _("failed to add iptables rule to allow DNS requests from '%s' : %s\n"),
network->bridge, strerror(err));
goto err3;
}
if ((err = iptablesAddUdpInput(driver->iptables, network->bridge, 53))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to allow DNS requests from '%s' : %s\n",
+ _("failed to add iptables rule to allow DNS requests from '%s' : %s\n"),
network->bridge, strerror(err));
goto err4;
}
@@ -994,14 +994,14 @@ qemudAddIptablesRules(virConnectPtr conn,
if ((err = iptablesAddForwardRejectOut(driver->iptables, network->bridge))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to block outbound traffic from '%s' : %s\n",
+ _("failed to add iptables rule to block outbound traffic from '%s' : %s\n"),
network->bridge, strerror(err));
goto err5;
}
if ((err = iptablesAddForwardRejectIn(driver->iptables, network->bridge))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to block inbound traffic to '%s' : %s\n",
+ _("failed to add iptables rule to block inbound traffic to '%s' : %s\n"),
network->bridge, strerror(err));
goto err6;
}
@@ -1009,7 +1009,7 @@ qemudAddIptablesRules(virConnectPtr conn,
/* Allow traffic between guests on the same bridge */
if ((err = iptablesAddForwardAllowCross(driver->iptables, network->bridge))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to allow cross bridge traffic on '%s' : %s\n",
+ _("failed to add iptables rule to allow cross bridge traffic on '%s' : %s\n"),
network->bridge, strerror(err));
goto err7;
}
@@ -1027,7 +1027,7 @@ qemudAddIptablesRules(virConnectPtr conn,
network->bridge,
network->def->forwardDev))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to allow forwarding from '%s' : %s\n",
+ _("failed to add iptables rule to allow forwarding from '%s' : %s\n"),
network->bridge, strerror(err));
goto err8;
}
@@ -1038,7 +1038,7 @@ qemudAddIptablesRules(virConnectPtr conn,
network->bridge,
network->def->forwardDev))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to allow forwarding to '%s' : %s\n",
+ _("failed to add iptables rule to allow forwarding to '%s' : %s\n"),
network->bridge, strerror(err));
goto err9;
}
@@ -1048,7 +1048,7 @@ qemudAddIptablesRules(virConnectPtr conn,
network->def->network,
network->def->forwardDev))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to add iptables rule to enable masquerading : %s\n",
+ _("failed to add iptables rule to enable masquerading : %s\n"),
strerror(err));
goto err10;
}
@@ -1142,13 +1142,13 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if (qemudIsActiveNetwork(network)) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "network is already active");
+ _("network is already active"));
return -1;
}
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));
return -1;
}
@@ -1161,7 +1161,7 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if ((err = brAddBridge(driver->brctl, name, network->bridge, sizeof(network->bridge)))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot create bridge '%s' : %s", name, strerror(err));
+ _("cannot create bridge '%s' : %)"), name, strerror(err));
return -1;
}
@@ -1169,14 +1169,14 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if (network->def->forwardDelay &&
(err = brSetForwardDelay(driver->brctl, network->bridge, network->def->forwardDelay))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to set bridge forward delay to %d\n",
+ _("failed to set bridge forward delay to %d\n"),
network->def->forwardDelay);
goto err_delbr;
}
if ((err = brSetEnableSTP(driver->brctl, network->bridge, network->def->disableSTP ? 0 : 1))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to set bridge STP to %s\n",
+ _("failed to set bridge STP to %s\n"),
network->def->disableSTP ? "off" : "on");
goto err_delbr;
}
@@ -1184,7 +1184,7 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if (network->def->ipAddress[0] &&
(err = brSetInetAddress(driver->brctl, network->bridge, network->def->ipAddress))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot set IP address on bridge '%s' to '%s' : %s\n",
+ _("cannot set IP address on bridge '%s' to '%s' : %s\n"),
network->bridge, network->def->ipAddress, strerror(err));
goto err_delbr;
}
@@ -1192,7 +1192,7 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if (network->def->netmask[0] &&
(err = brSetInetNetmask(driver->brctl, network->bridge, network->def->netmask))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot set netmask on bridge '%s' to '%s' : %s\n",
+ _("cannot set netmask on bridge '%s' to '%s' : %s\n"),
network->bridge, network->def->netmask, strerror(err));
goto err_delbr;
}
@@ -1200,7 +1200,7 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if (network->def->ipAddress[0] &&
(err = brSetInterfaceUp(driver->brctl, network->bridge, 1))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to bring the bridge '%s' up : %s\n",
+ _("failed to bring the bridge '%s' up : %s\n"),
network->bridge, strerror(err));
goto err_delbr;
}
@@ -1211,7 +1211,7 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if (network->def->forward &&
!qemudEnableIpForwarding()) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "failed to enable IP forwarding : %s\n", strerror(err));
+ _("failed to enable IP forwarding : %s\n"), strerror(err));
goto err_delbr2;
}
@@ -1662,18 +1662,18 @@ static int qemudDomainSuspend(virDomainPtr dom) {
char *info;
struct qemud_vm *vm = qemudFindVMByID(driver, dom->id);
if (!vm) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching id %d", dom->id);
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching id %d"), dom->id);
return -1;
}
if (!qemudIsActiveVM(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, "domain is not running");
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, _("domain is not running"));
return -1;
}
if (vm->state == VIR_DOMAIN_PAUSED)
return 0;
if (qemudMonitorCommand(driver, vm, "stop", &info) < 0) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, "suspend operation failed");
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, _("suspend operation failed"));
return -1;
}
vm->state = VIR_DOMAIN_PAUSED;
@@ -1688,17 +1688,17 @@ static int qemudDomainResume(virDomainPtr dom) {
char *info;
struct qemud_vm *vm = qemudFindVMByID(driver, dom->id);
if (!vm) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching id %d", dom->id);
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching id %d"), dom->id);
return -1;
}
if (!qemudIsActiveVM(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, "domain is not running");
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, _("domain is not running"));
return -1;
}
if (vm->state == VIR_DOMAIN_RUNNING)
return 0;
if (qemudMonitorCommand(driver, vm, "cont", &info) < 0) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, "resume operation failed");
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, _("resume operation failed"));
return -1;
}
vm->state = VIR_DOMAIN_RUNNING;
@@ -1715,13 +1715,13 @@ static int qemudDomainShutdown(virDomainPtr dom) {
if (!vm) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "no domain with matching id %d", dom->id);
+ _("no domain with matching id %d"), dom->id);
return -1;
}
if (qemudMonitorCommand(driver, vm, "system_powerdown", &info) < 0) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "shutdown operation failed");
+ _("shutdown operation failed"));
return -1;
}
return 0;
@@ -1735,7 +1735,7 @@ static int qemudDomainDestroy(virDomainPtr dom) {
if (!vm) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "no domain with matching id %d", dom->id);
+ _("no domain with matching id %d"), dom->id);
return -1;
}
@@ -1754,7 +1754,7 @@ static char *qemudDomainGetOSType(virDomainPtr dom) {
if (!vm) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "no domain with matching uuid");
+ _("no domain with matching uuid"));
return NULL;
}
@@ -1830,7 +1830,7 @@ static int qemudDomainGetInfo(virDomainPtr dom,
struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
if (!vm) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
return -1;
}
@@ -1840,7 +1840,7 @@ static int qemudDomainGetInfo(virDomainPtr dom,
info->cpuTime = 0;
} else {
if (qemudGetProcessInfo(&(info->cpuTime), vm->pid) < 0) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, "cannot read cputime for domain");
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, ("cannot read cputime for domain"));
return -1;
}
}
@@ -1961,13 +1961,13 @@ static int qemudDomainSave(virDomainPtr dom,
if (!vm) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "no domain with matching id %d", dom->id);
+ _("no domain with matching id %d"), dom->id);
return -1;
}
if (!qemudIsActiveVM(vm)) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "domain is not running");
+ _("domain is not running"));
return -1;
}
@@ -1976,7 +1976,7 @@ static int qemudDomainSave(virDomainPtr dom,
header.was_running = 1;
if (qemudDomainSuspend(dom) != 0) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "failed to pause domain");
+ _("failed to pause domain"));
return -1;
}
}
@@ -1985,7 +1985,7 @@ static int qemudDomainSave(virDomainPtr dom,
xml = qemudGenerateXML(dom->conn, driver, vm, vm->def, 0);
if (!xml) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "failed to get domain xml");
+ _("failed to get domain xml"));
return -1;
}
header.xml_len = strlen(xml) + 1;
@@ -1993,14 +1993,14 @@ static int qemudDomainSave(virDomainPtr dom,
/* Write header to file, followed by XML */
if ((fd = open(path, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "failed to create '%s'", path);
+ _("failed to create '%s'"), path);
free(xml);
return -1;
}
if (safewrite(fd, &header, sizeof(header)) != sizeof(header)) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "failed to write save header");
+ _("failed to write save header"));
close(fd);
free(xml);
return -1;
@@ -2008,7 +2008,7 @@ static int qemudDomainSave(virDomainPtr dom,
if (safewrite(fd, xml, header.xml_len) != header.xml_len) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "failed to write xml");
+ _("failed to write xml"));
close(fd);
free(xml);
return -1;
@@ -2021,14 +2021,14 @@ static int qemudDomainSave(virDomainPtr dom,
safe_path = qemudEscapeShellArg(path);
if (!safe_path) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "out of memory");
+ _("out of memory"));
return -1;
}
if (asprintf (&command, "migrate \"exec:"
"dd of='%s' oflag=append conv=notrunc 2>/dev/null"
"\"", safe_path) == -1) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "out of memory");
+ _("out of memory"));
free(safe_path);
return -1;
}
@@ -2036,7 +2036,7 @@ static int qemudDomainSave(virDomainPtr dom,
if (qemudMonitorCommand(driver, vm, command, &info) < 0) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "migrate operation failed");
+ _("migrate operation failed"));
free(command);
return -1;
}
@@ -2066,27 +2066,27 @@ static int qemudDomainRestore(virConnectPtr conn,
/* Verify the header and read the XML */
if ((fd = open(path, O_RDONLY)) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "cannot read domain image");
+ _("cannot read domain image"));
return -1;
}
if (saferead(fd, &header, sizeof(header)) != sizeof(header)) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "failed to read qemu header");
+ _("failed to read qemu header"));
close(fd);
return -1;
}
if (memcmp(header.magic, QEMUD_SAVE_MAGIC, sizeof(header.magic)) != 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "image magic is incorrect");
+ _("image magic is incorrect"));
close(fd);
return -1;
}
if (header.version > QEMUD_SAVE_VERSION) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "image version is not supported (%d > %d)",
+ _("image version is not supported (%d > %d)"),
header.version, QEMUD_SAVE_VERSION);
close(fd);
return -1;
@@ -2094,14 +2094,14 @@ static int qemudDomainRestore(virConnectPtr conn,
if ((xml = (char *)malloc(header.xml_len)) == NULL) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "out of memory");
+ _("out of memory"));
close(fd);
return -1;
}
if (saferead(fd, xml, header.xml_len) != header.xml_len) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "failed to read XML");
+ _("failed to read XML"));
close(fd);
free(xml);
return -1;
@@ -2110,7 +2110,7 @@ static int qemudDomainRestore(virConnectPtr conn,
/* Create a domain from this XML */
if (!(def = qemudParseVMDef(conn, driver, xml, NULL))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "failed to parse XML");
+ _("failed to parse XML"));
close(fd);
free(xml);
return -1;
@@ -2122,14 +2122,14 @@ static int qemudDomainRestore(virConnectPtr conn,
if (!vm) vm = qemudFindVMByName(driver, def->name);
if (vm && qemudIsActiveVM(vm)) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "domain is already active as '%s'", vm->def->name);
+ _("domain is already active as '%s'"), vm->def->name);
close(fd);
return -1;
}
if (!(vm = qemudAssignVMDef(conn, driver, def))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "failed to assign new VM");
+ _("failed to assign new VM"));
qemudFreeVMDef(def);
close(fd);
return -1;
@@ -2144,7 +2144,7 @@ static int qemudDomainRestore(virConnectPtr conn,
vm->stdin = -1;
if (ret < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "failed to start VM");
+ _("failed to start VM"));
if (!vm->configFile[0])
qemudRemoveInactiveVM(driver, vm);
return -1;
@@ -2155,7 +2155,7 @@ static int qemudDomainRestore(virConnectPtr conn,
char *info;
if (qemudMonitorCommand(driver, vm, "cont", &info) < 0) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "failed to resume domain");
+ _("failed to resume domain"));
return -1;
}
free(info);
@@ -2171,7 +2171,7 @@ static char *qemudDomainDumpXML(virDomainPtr dom,
struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
if (!vm) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
return NULL;
}
@@ -2215,7 +2215,7 @@ static int qemudDomainStart(virDomainPtr dom) {
if (!vm) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "no domain with matching uuid");
+ _("no domain with matching uuid"));
return -1;
}
@@ -2252,12 +2252,12 @@ static int qemudDomainUndefine(virDomainPtr dom) {
struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
if (!vm) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
return -1;
}
if (qemudIsActiveVM(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, "cannot delete active domain");
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, _("cannot delete active domain"));
return -1;
}
@@ -2287,7 +2287,7 @@ static int qemudDomainChangeCDROM(virDomainPtr dom,
safe_path = qemudEscapeMonitorArg(newdisk->src);
if (!safe_path) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "out of memory");
+ _("out of memory"));
return -1;
}
if (asprintf (&cmd, "change %s \"%s\"",
@@ -2295,7 +2295,7 @@ static int qemudDomainChangeCDROM(virDomainPtr dom,
/* olddisk->dst */ "cdrom",
safe_path) == -1) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "out of memory");
+ _("out of memory"));
free(safe_path);
return -1;
}
@@ -2303,12 +2303,12 @@ static int qemudDomainChangeCDROM(virDomainPtr dom,
} else if (asprintf(&cmd, "eject cdrom") == -1) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "out of memory");
+ _("out of memory"));
return -1;
}
if (qemudMonitorCommand(driver, vm, cmd, &reply) < 0) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, "cannot change cdrom media");
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, _("cannot change cdrom media"));
free(cmd);
return -1;
}
@@ -2327,12 +2327,12 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
struct qemud_vm_disk_def *disk;
if (!vm) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
return -1;
}
if (!qemudIsActiveVM(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, "cannot attach device on inactive domain");
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, _("cannot attach device on inactive domain"));
return -1;
}
@@ -2342,7 +2342,7 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
}
if (dev->type != QEMUD_DEVICE_DISK || dev->data.disk.device != QEMUD_DISK_CDROM) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT, "only CDROM disk devices can be attached");
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT, _("only CDROM disk devices can be attached"));
free(dev);
return -1;
}
@@ -2356,7 +2356,7 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
}
if (!disk) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT, "CDROM not attached, cannot change media");
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT, _("CDROM not attached, cannot change media"));
free(dev);
return -1;
}
@@ -2376,7 +2376,7 @@ static int qemudDomainGetAutostart(virDomainPtr dom,
struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
if (!vm) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
return -1;
}
@@ -2391,7 +2391,7 @@ static int qemudDomainSetAutostart(virDomainPtr dom,
struct qemud_vm *vm = qemudFindVMByUUID(driver, dom->uuid);
if (!vm) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+ qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
return -1;
}
@@ -2405,21 +2405,21 @@ static int qemudDomainSetAutostart(virDomainPtr dom,
if ((err = virFileMakePath(driver->autostartDir))) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- "cannot create autostart directory %s: %s",
+ _("cannot create autostart directory %s: %s"),
driver->autostartDir, strerror(err));
return -1;
}
if (symlink(vm->configFile, vm->autostartLink) < 0) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- "Failed to create symlink '%s' to '%s': %s",
+ _("Failed to create symlink '%s' to '%s': %s"),
vm->autostartLink, vm->configFile, strerror(errno));
return -1;
}
} else {
if (unlink(vm->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- "Failed to delete symlink '%s': %s",
+ _("Failed to delete symlink '%s': %s"),
vm->autostartLink, strerror(errno));
return -1;
}
@@ -2584,19 +2584,19 @@ qemudDomainInterfaceStats (virDomainPtr dom,
if (!vm) {
qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "no domain with matching id %d", dom->id);
+ _("no domain with matching id %d"), dom->id);
return -1;
}
if (!qemudIsActiveVM(vm)) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "domain is not running");
+ _("domain is not running"));
return -1;
}
if (!path || path[0] == '\0') {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- "NULL or empty path");
+ _("NULL or empty path"));
return -1;
}
@@ -2619,7 +2619,7 @@ qemudDomainInterfaceStats (virDomainPtr dom,
}
qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- "invalid path, '%s' is not a known interface", path);
+ _("invalid path, '%s' is not a known interface"), path);
return -1;
ok:
@@ -2638,7 +2638,7 @@ static virNetworkPtr qemudNetworkLookupByUUID(virConnectPtr conn ATTRIBUTE_UNUSE
virNetworkPtr net;
if (!network) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_NETWORK, "no network with matching uuid");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_NETWORK, _("no network with matching uuid"));
return NULL;
}
@@ -2652,7 +2652,7 @@ static virNetworkPtr qemudNetworkLookupByName(virConnectPtr conn ATTRIBUTE_UNUSE
virNetworkPtr net;
if (!network) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_NETWORK, "no network with matching name");
+ qemudReportError(conn, NULL, NULL, VIR_ERR_NO_NETWORK, _("no network with matching name"));
return NULL;
}
@@ -2781,7 +2781,7 @@ static int qemudNetworkUndefine(virNetworkPtr net) {
struct qemud_network *network = qemudFindNetworkByUUID(driver, net->uuid);
if (!network) {
- qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_DOMAIN, "no network with matching uuid");
+ qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_DOMAIN, _("no network with matching uuid"));
return -1;
}
@@ -2806,7 +2806,7 @@ static int qemudNetworkStart(virNetworkPtr net) {
if (!network) {
qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK,
- "no network with matching uuid");
+ _("no network with matching uuid"));
return -1;
}
@@ -2820,7 +2820,7 @@ static int qemudNetworkDestroy(virNetworkPtr net) {
if (!network) {
qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK,
- "no network with matching uuid");
+ _("no network with matching uuid"));
return -1;
}
@@ -2835,7 +2835,7 @@ static char *qemudNetworkDumpXML(virNetworkPtr net, int flags ATTRIBUTE_UNUSED)
if (!network) {
qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK,
- "no network with matching uuid");
+ _("no network with matching uuid"));
return NULL;
}
@@ -2865,7 +2865,7 @@ static int qemudNetworkGetAutostart(virNetworkPtr net,
struct qemud_network *network = qemudFindNetworkByUUID(driver, net->uuid);
if (!network) {
- qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK, "no network with matching uuid");
+ qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK, _("no network with matching uuid"));
return -1;
}
@@ -2880,7 +2880,7 @@ static int qemudNetworkSetAutostart(virNetworkPtr net,
struct qemud_network *network = qemudFindNetworkByUUID(driver, net->uuid);
if (!network) {
- qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK, "no network with matching uuid");
+ qemudReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK, _("no network with matching uuid"));
return -1;
}
@@ -2894,21 +2894,21 @@ static int qemudNetworkSetAutostart(virNetworkPtr net,
if ((err = virFileMakePath(driver->networkAutostartDir))) {
qemudReportError(net->conn, NULL, net, VIR_ERR_INTERNAL_ERROR,
- "cannot create autostart directory %s: %s",
+ _("cannot create autostart directory %s: %s"),
driver->networkAutostartDir, strerror(err));
return -1;
}
if (symlink(network->configFile, network->autostartLink) < 0) {
qemudReportError(net->conn, NULL, net, VIR_ERR_INTERNAL_ERROR,
- "Failed to create symlink '%s' to '%s': %s",
+ _("Failed to create symlink '%s' to '%s': %s"),
network->autostartLink, network->configFile, strerror(errno));
return -1;
}
} else {
if (unlink(network->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR) {
qemudReportError(net->conn, NULL, net, VIR_ERR_INTERNAL_ERROR,
- "Failed to delete symlink '%s': %s",
+ _("Failed to delete symlink '%s': %s"),
network->autostartLink, strerror(errno));
return -1;
}
--
1.5.4.3
3
5
[Libvir] [PATCH]: Make the iscsi backend work with updated iscsiadm tools
by Chris Lalancette 27 Mar '08
by Chris Lalancette 27 Mar '08
27 Mar '08
All,
Updated versions of the iscsi-initiator-utils changed the output structure
from the "iscsiadm -m session -P 3" command, which is being used in
storage_backend_iscsi.c to gather the scsi devices available in a pool and
present them as volumes. Consequently, when starting an iSCSI pool on a machine
with a newer version of the iscsi tools, you can successfully define the pool,
but will fail to find any LUNs on it.
The attached patch lessens our dependency on this command by groping around
sysfs for the information, instead of parsing it from the iscsiadm command. We
still parse the command to get target, channel, id, and lun numbers, but then we
cruise through sysfs looking for the corresponding /dev/sd? devices ourselves.
This makes the libvirt iSCSI backend work for both older iscsiadm and newer
iscsiadm.
After much wrangling with iscsiadm and friends, I came to the conclusion that
this is the best we can do with the current state of the iscsi tools; from what
I can tell, there is no (simple) way to get away from parsing the iscsiadm output.
This is a repost of a patch I had originally posted on 2/21; this patch
incorporates Jim's comments at that time, and also adds better error checking
and error strings. Please review and commit as appropriate.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
2
1
[Libvir] error : could not connect to xen:///; error: failed to connect to the hypervisor
by Felix Krohn 26 Mar '08
by Felix Krohn 26 Mar '08
26 Mar '08
I can't find the reason for the following error:
# virsh
libvir: error : could not connect to xen:///
error: failed to connect to the hypervisor
# virsh -c ///var/lib/xend/xend-socket
libvir: error : could not connect to ///var/lib/xend/xend-socket
error: failed to connect to the hypervisor
# lsof|grep xend-socket
python 3655 root 18u unix 0xffff88001edce340 11774 /var/lib/xend/xend-socket
system:
Debian etch on amd64
Xen version 3.2.0 (compiled from sources)
Linux 2.6.21 (patched Sources from redhat git)
libvirtd and xend are running, `xm list` etc works fine
# virsh -v
0.4.0
(installed from etch-backports)
Output from `strace -s 1024 -f virsh list --all` is here:
http://krohnjob.de/files/virsh.strace
Can't see the reason for the above mentioned error in there...
Kind regards,
Felix Krohn
--
Felix Krohn / After silence, that which comes ]
|-> smtp, xmpp: felix(a)kro.hn / nearest to expressing the inexpres-]
|-> gpg: 0x1C246E3B / sible is music. [Aldous Huxley]
|-> https://kro.hn / http://www.flickr.com/kro_royal ]
5
8
While testing against Xen-3.2 I found out that the Xen hypercalls
failed, this patches fixes it by checking the newer sysctl versions
when initializing the driver. I also merged the associated debugging
with the DEBUG from libvirt.c, to allow easier debugging of this issue.
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard(a)redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
4
5
I am using libvir 0.4.1 with Xen 3.2.0. It might be an obvious
question, but if there is a way to get list
of inactive/suspended domains via C API?
virsh # list --all
Id Name State
----------------------------------
0 Domain-0 running
6 centos51 blocked
virsh # domstate centos52
paused
As you can see 'centos52' is not shown, although it is known.
In general, could somebody explain to me how libvirt is managing
information about inactive
domains?
Thanks!
Vadim
3
6
diff -urN libvirt.orig/po/lt.po libvirt/po/lt.po
--- libvirt.orig/po/lt.po 2008-03-14 11:57:02.000000000 -0400
+++ libvirt/po/lt.po 2008-03-25 13:00:57.000000000 -0400
@@ -1880,7 +1880,7 @@
msgstr "node cpu mhz"
#: src/test.c:780
-mseid "node memory"
+msgid "node memory"
msgstr "node memory"
#: src/test.c:786
--
Elizabeth Kon (Beth)
IBM Linux Technology Center
Open Hypervisor Team
email: eak(a)us.ibm.com
2
1
This patch adds a new backend to the storage driver supporting SCSI HBAs.
With this you can now enumerate physical disks provided by FibreChannel,
internal SCSI / PATA / SATA / USB adapters.
The implemention uses HAL to enumerate the volumes asssociated with an HBA.
It is common for most boxes to support multiple HBAs. eg on my Linux laptop
$ ls /sys/class/scsi_host/
host0 host1 host2 host3
These HBA names are used to identify the host when defining the XML:
<pool type="scsi">
<name>hba0</name>
<source>
<adapter name="host0"/>
</source>
<target>
<path>/dev/disk/by-path</path>
</target>
</pool>
This does not provide any means of discovering HBA names - that's a later
piece of broader work on host device discovery. It also does not support
multipath devices (eg with FibreChannel the same storage volume can appear
on the host multiple times)
Example using the first host adapter which is my internal SATA controller
with a single disk attached:
# ./src/virsh pool-create /root/hba0.xml
Pool hba0 created from /root/hba0.xml
# ./src/virsh vol-list hba0
Name Path
-----------------------------------------
0:0:0:0 /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
# ./src/virsh vol-info /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
Name: 0:0:0:0
Type: block
Capacity: 153.39 GB
Allocation: 153.39 GB
# ./src/virsh vol-dumpxml /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
libvir: Storage error : no storage vol with matching key
<volume>
<name>0:0:0:0</name>
<key>SATA_HDT722516DLA380_VDK91GTE0WPLER</key>
<source>
</source>
<capacity>164696555520</capacity>
<allocation>164696555520</allocation>
<target>
<path>/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0</path>
<permissions>
<mode>060640</mode>
<owner>0</owner>
<group>6</group>
<label>system_u:object_r:fixed_disk_device_t</label>
</permissions>
</target>
</volume>
This also does not deal with the problem of HBAs being created on the fly,
eg the NPIV case where you can add/remove adapters at will. I'm still working
on how to deal with this. If you have your virtual NPIV adapters already
defined though, it can enumerate them fine.
Aside from the bit where I map from the short HBA name (eg 'host0') into the
HAL device name, this should be portable to Solaris as-is.
Dan.
--
|: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
2
3
25 Mar '08
__virErrorMsg is a mix of tabs and spaces which makes it a bit
hard to read. This patch cleans this up. Please apply.
-- Guido
---
src/virterror.c | 318 +++++++++++++++++++++++++++---------------------------
1 files changed, 159 insertions(+), 159 deletions(-)
diff --git a/src/virterror.c b/src/virterror.c
index 1e39be4..f16a43c 100644
--- a/src/virterror.c
+++ b/src/virterror.c
@@ -425,18 +425,18 @@ __virErrorMsg(virErrorNumber error, const char *info)
return (NULL);
case VIR_ERR_INTERNAL_ERROR:
if (info != NULL)
- errmsg = _("internal error %s");
+ errmsg = _("internal error %s");
else
- errmsg = _("internal error");
+ errmsg = _("internal error");
break;
case VIR_ERR_NO_MEMORY:
errmsg = _("out of memory");
break;
case VIR_ERR_NO_SUPPORT:
if (info == NULL)
- errmsg = _("this function is not supported by the hypervisor");
- else
- errmsg = _("this function is not supported by the hypervisor: %s");
+ errmsg = _("this function is not supported by the hypervisor");
+ else
+ errmsg = _("this function is not supported by the hypervisor: %s");
break;
case VIR_ERR_NO_CONNECT:
if (info == NULL)
@@ -446,21 +446,21 @@ __virErrorMsg(virErrorNumber error, const char *info)
break;
case VIR_ERR_INVALID_CONN:
if (info == NULL)
- errmsg = _("invalid connection pointer in");
- else
- errmsg = _("invalid connection pointer in %s");
+ errmsg = _("invalid connection pointer in");
+ else
+ errmsg = _("invalid connection pointer in %s");
break;
case VIR_ERR_INVALID_DOMAIN:
if (info == NULL)
- errmsg = _("invalid domain pointer in");
- else
- errmsg = _("invalid domain pointer in %s");
+ errmsg = _("invalid domain pointer in");
+ else
+ errmsg = _("invalid domain pointer in %s");
break;
case VIR_ERR_INVALID_ARG:
if (info == NULL)
- errmsg = _("invalid argument in");
- else
- errmsg = _("invalid argument in %s");
+ errmsg = _("invalid argument in");
+ else
+ errmsg = _("invalid argument in %s");
break;
case VIR_ERR_OPERATION_FAILED:
if (info != NULL)
@@ -485,9 +485,9 @@ __virErrorMsg(virErrorNumber error, const char *info)
break;
case VIR_ERR_UNKNOWN_HOST:
if (info != NULL)
- errmsg = _("unknown host %s");
- else
- errmsg = _("unknown host");
+ errmsg = _("unknown host %s");
+ else
+ errmsg = _("unknown host");
break;
case VIR_ERR_SEXPR_SERIAL:
if (info != NULL)
@@ -501,7 +501,7 @@ __virErrorMsg(virErrorNumber error, const char *info)
else
errmsg = _("could not use Xen hypervisor entry %s");
break;
- case VIR_ERR_NO_XENSTORE:
+ case VIR_ERR_NO_XENSTORE:
if (info == NULL)
errmsg = _("could not connect to Xen Store");
else
@@ -567,150 +567,150 @@ __virErrorMsg(virErrorNumber error, const char *info)
else
errmsg = _("library call %s failed, possibly not supported");
break;
- case VIR_ERR_XML_ERROR:
- if (info == NULL)
- errmsg = _("XML description not well formed or invalid");
- else
- errmsg = _("XML description for %s is not well formed or invalid");
- break;
- case VIR_ERR_DOM_EXIST:
- if (info == NULL)
- errmsg = _("this domain exists already");
- else
- errmsg = _("domain %s exists already");
- break;
- case VIR_ERR_OPERATION_DENIED:
- if (info == NULL)
- errmsg = _("operation forbidden for read only access");
- else
- errmsg = _("operation %s forbidden for read only access");
- break;
- case VIR_ERR_OPEN_FAILED:
- if (info == NULL)
- errmsg = _("failed to open configuration file for reading");
- else
- errmsg = _("failed to open %s for reading");
- break;
- case VIR_ERR_READ_FAILED:
- if (info == NULL)
- errmsg = _("failed to read configuration file");
- else
- errmsg = _("failed to read configuration file %s");
- break;
- case VIR_ERR_PARSE_FAILED:
- if (info == NULL)
- errmsg = _("failed to parse configuration file");
- else
- errmsg = _("failed to parse configuration file %s");
- break;
- case VIR_ERR_CONF_SYNTAX:
- if (info == NULL)
- errmsg = _("configuration file syntax error");
- else
- errmsg = _("configuration file syntax error: %s");
- break;
- case VIR_ERR_WRITE_FAILED:
- if (info == NULL)
- errmsg = _("failed to write configuration file");
- else
- errmsg = _("failed to write configuration file: %s");
- break;
- case VIR_ERR_XML_DETAIL:
- if (info == NULL)
- errmsg = _("parser error");
- else
- errmsg = "%s";
+ case VIR_ERR_XML_ERROR:
+ if (info == NULL)
+ errmsg = _("XML description not well formed or invalid");
+ else
+ errmsg = _("XML description for %s is not well formed or invalid");
+ break;
+ case VIR_ERR_DOM_EXIST:
+ if (info == NULL)
+ errmsg = _("this domain exists already");
+ else
+ errmsg = _("domain %s exists already");
+ break;
+ case VIR_ERR_OPERATION_DENIED:
+ if (info == NULL)
+ errmsg = _("operation forbidden for read only access");
+ else
+ errmsg = _("operation %s forbidden for read only access");
+ break;
+ case VIR_ERR_OPEN_FAILED:
+ if (info == NULL)
+ errmsg = _("failed to open configuration file for reading");
+ else
+ errmsg = _("failed to open %s for reading");
+ break;
+ case VIR_ERR_READ_FAILED:
+ if (info == NULL)
+ errmsg = _("failed to read configuration file");
+ else
+ errmsg = _("failed to read configuration file %s");
+ break;
+ case VIR_ERR_PARSE_FAILED:
+ if (info == NULL)
+ errmsg = _("failed to parse configuration file");
+ else
+ errmsg = _("failed to parse configuration file %s");
+ break;
+ case VIR_ERR_CONF_SYNTAX:
+ if (info == NULL)
+ errmsg = _("configuration file syntax error");
+ else
+ errmsg = _("configuration file syntax error: %s");
+ break;
+ case VIR_ERR_WRITE_FAILED:
+ if (info == NULL)
+ errmsg = _("failed to write configuration file");
+ else
+ errmsg = _("failed to write configuration file: %s");
+ break;
+ case VIR_ERR_XML_DETAIL:
+ if (info == NULL)
+ errmsg = _("parser error");
+ else
+ errmsg = "%s";
break;
case VIR_ERR_INVALID_NETWORK:
if (info == NULL)
- errmsg = _("invalid network pointer in");
- else
- errmsg = _("invalid network pointer in %s");
- break;
- case VIR_ERR_NETWORK_EXIST:
- if (info == NULL)
- errmsg = _("this network exists already");
- else
- errmsg = _("network %s exists already");
- break;
- case VIR_ERR_SYSTEM_ERROR:
- if (info == NULL)
- errmsg = _("system call error");
- else
- errmsg = "%s";
- break;
- case VIR_ERR_RPC:
- if (info == NULL)
- errmsg = _("RPC error");
- else
- errmsg = "%s";
- break;
- case VIR_ERR_GNUTLS_ERROR:
- if (info == NULL)
- errmsg = _("GNUTLS call error");
- else
- errmsg = "%s";
- break;
- case VIR_WAR_NO_NETWORK:
- if (info == NULL)
- errmsg = _("Failed to find the network");
- else
- errmsg = _("Failed to find the network: %s");
- break;
- case VIR_ERR_NO_DOMAIN:
- if (info == NULL)
- errmsg = _("Domain not found");
- else
- errmsg = _("Domain not found: %s");
- break;
- case VIR_ERR_NO_NETWORK:
- if (info == NULL)
- errmsg = _("Network not found");
- else
- errmsg = _("Network not found: %s");
- break;
- case VIR_ERR_INVALID_MAC:
- if (info == NULL)
- errmsg = _("invalid MAC address");
- else
- errmsg = _("invalid MAC address: %s");
- break;
- case VIR_ERR_AUTH_FAILED:
- if (info == NULL)
- errmsg = _("authentication failed");
- else
- errmsg = _("authentication failed: %s");
- break;
- case VIR_ERR_NO_STORAGE_POOL:
- if (info == NULL)
- errmsg = _("Storage pool not found");
- else
- errmsg = _("Storage pool not found: %s");
- break;
- case VIR_ERR_NO_STORAGE_VOL:
- if (info == NULL)
- errmsg = _("Storage volume not found");
- else
- errmsg = _("Storage volume not found: %s");
- break;
- case VIR_ERR_INVALID_STORAGE_POOL:
- if (info == NULL)
- errmsg = _("invalid storage pool pointer in");
- else
- errmsg = _("invalid storage pool pointer in %s");
- break;
- case VIR_ERR_INVALID_STORAGE_VOL:
- if (info == NULL)
- errmsg = _("invalid storage volume pointer in");
- else
- errmsg = _("invalid storage volume pointer in %s");
- break;
- case VIR_WAR_NO_STORAGE:
- if (info == NULL)
- errmsg = _("Failed to find a storage driver");
- else
- errmsg = _("Failed to find a storage driver: %s");
- break;
+ errmsg = _("invalid network pointer in");
+ else
+ errmsg = _("invalid network pointer in %s");
+ break;
+ case VIR_ERR_NETWORK_EXIST:
+ if (info == NULL)
+ errmsg = _("this network exists already");
+ else
+ errmsg = _("network %s exists already");
+ break;
+ case VIR_ERR_SYSTEM_ERROR:
+ if (info == NULL)
+ errmsg = _("system call error");
+ else
+ errmsg = "%s";
+ break;
+ case VIR_ERR_RPC:
+ if (info == NULL)
+ errmsg = _("RPC error");
+ else
+ errmsg = "%s";
+ break;
+ case VIR_ERR_GNUTLS_ERROR:
+ if (info == NULL)
+ errmsg = _("GNUTLS call error");
+ else
+ errmsg = "%s";
+ break;
+ case VIR_WAR_NO_NETWORK:
+ if (info == NULL)
+ errmsg = _("Failed to find the network");
+ else
+ errmsg = _("Failed to find the network: %s");
+ break;
+ case VIR_ERR_NO_DOMAIN:
+ if (info == NULL)
+ errmsg = _("Domain not found");
+ else
+ errmsg = _("Domain not found: %s");
+ break;
+ case VIR_ERR_NO_NETWORK:
+ if (info == NULL)
+ errmsg = _("Network not found");
+ else
+ errmsg = _("Network not found: %s");
+ break;
+ case VIR_ERR_INVALID_MAC:
+ if (info == NULL)
+ errmsg = _("invalid MAC address");
+ else
+ errmsg = _("invalid MAC address: %s");
+ break;
+ case VIR_ERR_AUTH_FAILED:
+ if (info == NULL)
+ errmsg = _("authentication failed");
+ else
+ errmsg = _("authentication failed: %s");
+ break;
+ case VIR_ERR_NO_STORAGE_POOL:
+ if (info == NULL)
+ errmsg = _("Storage pool not found");
+ else
+ errmsg = _("Storage pool not found: %s");
+ break;
+ case VIR_ERR_NO_STORAGE_VOL:
+ if (info == NULL)
+ errmsg = _("Storage volume not found");
+ else
+ errmsg = _("Storage volume not found: %s");
+ break;
+ case VIR_ERR_INVALID_STORAGE_POOL:
+ if (info == NULL)
+ errmsg = _("invalid storage pool pointer in");
+ else
+ errmsg = _("invalid storage pool pointer in %s");
+ break;
+ case VIR_ERR_INVALID_STORAGE_VOL:
+ if (info == NULL)
+ errmsg = _("invalid storage volume pointer in");
+ else
+ errmsg = _("invalid storage volume pointer in %s");
+ break;
+ case VIR_WAR_NO_STORAGE:
+ if (info == NULL)
+ errmsg = _("Failed to find a storage driver");
+ else
+ errmsg = _("Failed to find a storage driver: %s");
+ break;
}
return (errmsg);
}
--
1.5.4.3
2
4
Hi,
I am watching through the virsh code for same type bug check.
http://git.et.redhat.com/?p=libvirt.git;a=commit;h=c857ace66df5a5068ed561aa…
And I found another point it should report error.
Thanks,
Shigeki Sakamoto.
Index: src/virsh.c
===================================================================
RCS file: /data/cvs/libvirt/src/virsh.c,v
retrieving revision 1.135
diff -u -p -r1.135 virsh.c
--- src/virsh.c 4 Mar 2008 19:59:56 -0000 1.135
+++ src/virsh.c 7 Mar 2008 07:03:12 -0000
@@ -1729,6 +1729,7 @@ cmdVcpupin(vshControl * ctl, vshCmd * cm
}
if (!(cpulist = vshCommandOptString(cmd, "cpulist", NULL))) {
+ vshError(ctl, FALSE, _("vcpupin: Invalid value of cpulist"));
virDomainFree(dom);
return FALSE;
}
@@ -1744,6 +1745,7 @@ cmdVcpupin(vshControl * ctl, vshCmd * cm
}
if (vcpu >= info.nrVirtCpu) {
+ vshError(ctl, FALSE, _("vcpupin: Invalid vCPU number."));
virDomainFree(dom);
return FALSE;
}
@@ -4473,6 +4475,7 @@ cmdAttachDevice(vshControl * ctl, vshCmd
from = vshCommandOptString(cmd, "file", &found);
if (!found) {
+ vshError(ctl, FALSE, _("attach-device: Invalid value of <file> option"));
virDomainFree(dom);
return FALSE;
}
@@ -4529,6 +4532,7 @@ cmdDetachDevice(vshControl * ctl, vshCmd
from = vshCommandOptString(cmd, "file", &found);
if (!found) {
+ vshError(ctl, FALSE, _("detach-device: Invalid value of <file> option"));
virDomainFree(dom);
return FALSE;
}
2
9
Hi,
I add the Xen Scheduler APIs to xenDaemonDriver.
- xenDaemonGetSchedulerType
- xenDaemonGetSchedulerParameters
- xenDaemonSetSchedulerParameters
We will have the following improvements by this patch:
1) xenDaemonDriver of Schedulr is usable
when xenHypervisorDriver failed.
2) Show the Scheduler information with non-root user.
3) Set the Scheduler parameters for inactive domain.
(Unfortunately not right now, because we need this fix.
http://lists.xensource.com/archives/html/xen-devel/2008-03/msg00301.html)
And I have a few things to note:
- Currently, implemented for the Xen-credit scheduler only.
- xenDaemonGetSchedulerType is supported in xendConfigVersion >= 4,
because we can get "xen_scheduler" from xend after Cset13394 of
Xen (i.e. xendConfigVersion is four or later).
- For the above reason, xenDaemonGetSchedulerParameters and
xenDaemonSetSchedulerParameters are also supported in
xendConfigVersion >= 4, because they are using xenDaemonGetSchedulerType
to get the scheduler type.
- At xenDaemonSetSchedulerParameters, there are restrictions
which depends on Xend-version.
a) We cannot set the "cap" value by xend before Cset15476 of Xen,
because xend does not support the "cap" value
at xend/server/SrvDomain.py
b) We cannot set the scheduler parameters for inactive domain
without the following patch.
http://lists.xensource.com/archives/html/xen-devel/2008-03/msg00301.html
If the above patch is committed, this API will be available
for inactive domain.
Regards,
Saori Fukuta
2
5
Most of the error messages don't pass a final newline. Strip the ones
that still do so for consistency. Please apply.
-- Guido
---
src/qemu_driver.c | 40 ++++++++++++++++++++--------------------
1 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 719f46e..adb33a7 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -962,14 +962,14 @@ qemudAddIptablesRules(virConnectPtr conn,
/* allow DHCP requests through to dnsmasq */
if ((err = iptablesAddTcpInput(driver->iptables, network->bridge, 67))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("failed to add iptables rule to allow DHCP requests from '%s' : %s\n"),
+ _("failed to add iptables rule to allow DHCP requests from '%s' : %s"),
network->bridge, strerror(err));
goto err1;
}
if ((err = iptablesAddUdpInput(driver->iptables, network->bridge, 67))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("failed to add iptables rule to allow DHCP requests from '%s' : %s\n"),
+ _("failed to add iptables rule to allow DHCP requests from '%s' : %s"),
network->bridge, strerror(err));
goto err2;
}
@@ -977,14 +977,14 @@ qemudAddIptablesRules(virConnectPtr conn,
/* allow DNS requests through to dnsmasq */
if ((err = iptablesAddTcpInput(driver->iptables, network->bridge, 53))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("failed to add iptables rule to allow DNS requests from '%s' : %s\n"),
+ _("failed to add iptables rule to allow DNS requests from '%s' : %s"),
network->bridge, strerror(err));
goto err3;
}
if ((err = iptablesAddUdpInput(driver->iptables, network->bridge, 53))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("failed to add iptables rule to allow DNS requests from '%s' : %s\n"),
+ _("failed to add iptables rule to allow DNS requests from '%s' : %s"),
network->bridge, strerror(err));
goto err4;
}
@@ -994,14 +994,14 @@ qemudAddIptablesRules(virConnectPtr conn,
if ((err = iptablesAddForwardRejectOut(driver->iptables, network->bridge))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("failed to add iptables rule to block outbound traffic from '%s' : %s\n"),
+ _("failed to add iptables rule to block outbound traffic from '%s' : %s"),
network->bridge, strerror(err));
goto err5;
}
if ((err = iptablesAddForwardRejectIn(driver->iptables, network->bridge))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("failed to add iptables rule to block inbound traffic to '%s' : %s\n"),
+ _("failed to add iptables rule to block inbound traffic to '%s' : %s"),
network->bridge, strerror(err));
goto err6;
}
@@ -1009,7 +1009,7 @@ qemudAddIptablesRules(virConnectPtr conn,
/* Allow traffic between guests on the same bridge */
if ((err = iptablesAddForwardAllowCross(driver->iptables, network->bridge))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("failed to add iptables rule to allow cross bridge traffic on '%s' : %s\n"),
+ _("failed to add iptables rule to allow cross bridge traffic on '%s' : %s"),
network->bridge, strerror(err));
goto err7;
}
@@ -1027,7 +1027,7 @@ qemudAddIptablesRules(virConnectPtr conn,
network->bridge,
network->def->forwardDev))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("failed to add iptables rule to allow forwarding from '%s' : %s\n"),
+ _("failed to add iptables rule to allow forwarding from '%s' : %s"),
network->bridge, strerror(err));
goto err8;
}
@@ -1038,7 +1038,7 @@ qemudAddIptablesRules(virConnectPtr conn,
network->bridge,
network->def->forwardDev))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("failed to add iptables rule to allow forwarding to '%s' : %s\n"),
+ _("failed to add iptables rule to allow forwarding to '%s' : %s"),
network->bridge, strerror(err));
goto err9;
}
@@ -1048,7 +1048,7 @@ qemudAddIptablesRules(virConnectPtr conn,
network->def->network,
network->def->forwardDev))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("failed to add iptables rule to enable masquerading : %s\n"),
+ _("failed to add iptables rule to enable masquerading : %s"),
strerror(err));
goto err10;
}
@@ -1169,14 +1169,14 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if (network->def->forwardDelay &&
(err = brSetForwardDelay(driver->brctl, network->bridge, network->def->forwardDelay))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("failed to set bridge forward delay to %d\n"),
+ _("failed to set bridge forward delay to %d"),
network->def->forwardDelay);
goto err_delbr;
}
if ((err = brSetEnableSTP(driver->brctl, network->bridge, network->def->disableSTP ? 0 : 1))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("failed to set bridge STP to %s\n"),
+ _("failed to set bridge STP to %s"),
network->def->disableSTP ? "off" : "on");
goto err_delbr;
}
@@ -1184,7 +1184,7 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if (network->def->ipAddress[0] &&
(err = brSetInetAddress(driver->brctl, network->bridge, network->def->ipAddress))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot set IP address on bridge '%s' to '%s' : %s\n"),
+ _("cannot set IP address on bridge '%s' to '%s' : %s"),
network->bridge, network->def->ipAddress, strerror(err));
goto err_delbr;
}
@@ -1192,7 +1192,7 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if (network->def->netmask[0] &&
(err = brSetInetNetmask(driver->brctl, network->bridge, network->def->netmask))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot set netmask on bridge '%s' to '%s' : %s\n"),
+ _("cannot set netmask on bridge '%s' to '%s' : %s"),
network->bridge, network->def->netmask, strerror(err));
goto err_delbr;
}
@@ -1200,7 +1200,7 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if (network->def->ipAddress[0] &&
(err = brSetInterfaceUp(driver->brctl, network->bridge, 1))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("failed to bring the bridge '%s' up : %s\n"),
+ _("failed to bring the bridge '%s' up : %s"),
network->bridge, strerror(err));
goto err_delbr;
}
@@ -1211,7 +1211,7 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
if (network->def->forward &&
!qemudEnableIpForwarding()) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("failed to enable IP forwarding : %s\n"), strerror(err));
+ _("failed to enable IP forwarding : %s"), strerror(err));
goto err_delbr2;
}
@@ -1238,7 +1238,7 @@ static int qemudStartNetworkDaemon(virConnectPtr conn,
err_delbr:
if ((err = brDeleteBridge(driver->brctl, network->bridge))) {
- qemudLog(QEMUD_WARN, _("Failed to delete bridge '%s' : %s\n"),
+ qemudLog(QEMUD_WARN, _("Failed to delete bridge '%s' : %s"),
network->bridge, strerror(err));
}
@@ -1263,12 +1263,12 @@ static int qemudShutdownNetworkDaemon(virConnectPtr conn ATTRIBUTE_UNUSED,
if (network->def->ipAddress[0] &&
(err = brSetInterfaceUp(driver->brctl, network->bridge, 0))) {
- qemudLog(QEMUD_WARN, _("Failed to bring down bridge '%s' : %s\n"),
+ qemudLog(QEMUD_WARN, _("Failed to bring down bridge '%s' : %s"),
network->bridge, strerror(err));
}
if ((err = brDeleteBridge(driver->brctl, network->bridge))) {
- qemudLog(QEMUD_WARN, _("Failed to delete bridge '%s' : %s\n"),
+ qemudLog(QEMUD_WARN, _("Failed to delete bridge '%s' : %s"),
network->bridge, strerror(err));
}
@@ -1277,7 +1277,7 @@ static int qemudShutdownNetworkDaemon(virConnectPtr conn ATTRIBUTE_UNUSED,
kill(network->dnsmasqPid, SIGKILL);
if (waitpid(network->dnsmasqPid, NULL, 0) != network->dnsmasqPid)
qemudLog(QEMUD_WARN,
- "%s", _("Got unexpected pid for dnsmasq\n"));
+ "%s", _("Got unexpected pid for dnsmasq"));
}
network->bridge[0] = '\0';
--
1.5.4.3
2
1