[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libvir] [PATCH] mark error messages as translatable



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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]