Devel
Threads by month
- ----- 2026 -----
- July
- June
- May
- 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
- 10 participants
- 40391 discussions
[libvirt] VIR_WARN and VIR_WARN0: many diags were not marked for translation
by Jim Meyering 19 May '10
by Jim Meyering 19 May '10
19 May '10
I noticed some VIR_WARN* uses with unmarked (for translation)
strings. It turns out there are more than 50:
$ g grep -E 'VIR_WARN0?\(".*"[,)]'|wc -l
128
Here's a sample:
src/phyp/phyp_driver.c: VIR_WARN0("Unable to stat local file.");
src/phyp/phyp_driver.c: VIR_WARN0("Unable to open local file.");
src/qemu/qemu_conf.c: VIR_WARN0("Failed to get host CPU");
Affected files:
$ g grep -l -E 'VIR_WARN0?\(".*"\)'
daemon/remote.c
src/esx/esx_driver.c
src/lxc/lxc_conf.c
src/lxc/lxc_controller.c
src/phyp/phyp_driver.c
src/qemu/qemu_conf.c
src/qemu/qemu_driver.c
src/qemu/qemu_monitor_json.c
src/remote/remote_driver.c
src/storage/storage_backend_logical.c
src/uml/uml_conf.c
src/uml/uml_driver.c
src/util/pci.c
src/util/util.c
src/xen/proxy_internal.c
This change ensures that no new ones will sneak in:
diff --git a/cfg.mk b/cfg.mk
index 96d6953..49300a0 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -358,6 +358,8 @@ msg_gen_function += virXendError
msg_gen_function += xenapiSessionErrorHandler
msg_gen_function += xenUnifiedError
msg_gen_function += xenXMError
+msg_gen_function += VIR_WARN
+msg_gen_function += VIR_WARN0
# Uncomment the following and run "make syntax-check" to see diagnostics
# that are not yet marked for translation, but that need to be rewritten
Running these commands fixes the vast majority:
git grep -l -E 'VIR_WARN0 *\(".*?"\)'|xargs perl -pi -e \
's/(VIR_WARN0\s*)\((".*")\)/$1(_($2))/'
git grep -l -E 'VIR_WARN *\(".*?",'|xargs perl -pi -e \
's/(VIR_WARN\s*)\((".*"),/$1(_($2),/'
Addressing the remaining problems showed some abuses
(e.g., VIR_WARN(_("%s"), "untranslated string") that should be
VIR_WARN(_("untranslated string")) )
Finally, since the above introduced translatable strings into
three files that previously had none, I have to add them
to po/POTFILES.in (which I also sorted):
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 88218bd..3346654 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,4 +1,5 @@
daemon/dispatch.c
+daemon/event.c
daemon/libvirtd.c
daemon/remote.c
daemon/stream.c
@@ -18,6 +19,7 @@ src/cpu/cpu_generic.c
src/cpu/cpu_map.c
src/cpu/cpu_x86.c
src/datatypes.c
+src/driver.c
src/esx/esx_driver.c
src/esx/esx_util.c
src/esx/esx_vi.c
@@ -27,6 +29,7 @@ src/esx/esx_vmx.c
src/interface/netcf_driver.c
src/internal.h
src/libvirt.c
+src/lxc/lxc_conf.c
src/lxc/lxc_container.c
src/lxc/lxc_controller.c
src/lxc/lxc_driver.c
@@ -53,8 +56,8 @@ src/qemu/qemu_monitor_text.c
src/qemu/qemu_security_dac.c
src/remote/remote_driver.c
src/secret/secret_driver.c
-src/security/security_driver.c
src/security/security_apparmor.c
+src/security/security_driver.c
src/security/security_selinux.c
src/security/virt-aa-helper.c
src/storage/storage_backend.c
@@ -89,10 +92,10 @@ src/util/xml.c
src/vbox/vbox_driver.c
src/vbox/vbox_tmpl.c
src/xen/proxy_internal.c
-src/xen/xend_internal.c
src/xen/xen_driver.c
src/xen/xen_hypervisor.c
src/xen/xen_inotify.c
+src/xen/xend_internal.c
src/xen/xm_internal.c
src/xen/xs_internal.c
src/xenapi/xenapi_driver.c
Here are the three separate changes:
- the first is 100% automatically generated, so probably not worth much
review effort
- the 2nd was all manual, so would benefit from a 2nd pair of eyes
- the 3rd is tiny and trivial
>From ca5fc870b68d09fdd14144ce67a4c0e1add45a34 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 18 May 2010 16:12:41 +0200
Subject: [PATCH 1/3] maint: mark VIR_WARN and VIR_WARN0 diagnostics for translation
Running these commands fixes the vast majority:
git grep -l -E 'VIR_WARN0 *\(".*?"\)'|xargs perl -pi -e \
's/(VIR_WARN0\s*)\((".*")\)/$1(_($2))/'
git grep -l -E 'VIR_WARN *\(".*?",'|xargs perl -pi -e \
's/(VIR_WARN\s*)\((".*"),/$1(_($2),/'
---
daemon/event.c | 8 ++--
daemon/remote.c | 4 +-
daemon/stream.c | 4 +-
src/conf/domain_event.c | 2 +-
src/driver.c | 2 +-
src/esx/esx_driver.c | 24 +++++-----
src/esx/esx_util.c | 2 +-
src/esx/esx_vi.c | 18 ++++----
src/esx/esx_vi_types.c | 2 +-
src/esx/esx_vmx.c | 6 +-
src/lxc/lxc_conf.c | 4 +-
src/lxc/lxc_controller.c | 2 +-
src/lxc/lxc_driver.c | 2 +-
src/nodeinfo.c | 2 +-
src/phyp/phyp_driver.c | 24 +++++-----
src/qemu/qemu_conf.c | 4 +-
src/qemu/qemu_driver.c | 72 ++++++++++++++++----------------
src/qemu/qemu_monitor_json.c | 24 +++++-----
src/remote/remote_driver.c | 26 ++++++------
src/security/security_selinux.c | 2 +-
src/storage/storage_backend_logical.c | 2 +-
src/uml/uml_conf.c | 2 +-
src/uml/uml_driver.c | 4 +-
src/util/hooks.c | 2 +-
src/util/json.c | 2 +-
src/util/pci.c | 4 +-
src/util/util.c | 2 +-
src/xen/proxy_internal.c | 4 +-
src/xenapi/xenapi_utils.c | 2 +-
29 files changed, 129 insertions(+), 129 deletions(-)
diff --git a/daemon/event.c b/daemon/event.c
index 6971409..77ecd5e 100644
--- a/daemon/event.c
+++ b/daemon/event.c
@@ -147,7 +147,7 @@ void virEventUpdateHandleImpl(int watch, int events) {
EVENT_DEBUG("Update handle w=%d e=%d", watch, events);
if (watch <= 0) {
- VIR_WARN("Ignoring invalid update watch %d", watch);
+ VIR_WARN(_("Ignoring invalid update watch %d"), watch);
return;
}
@@ -174,7 +174,7 @@ int virEventRemoveHandleImpl(int watch) {
EVENT_DEBUG("Remove handle w=%d", watch);
if (watch <= 0) {
- VIR_WARN("Ignoring invalid remove watch %d", watch);
+ VIR_WARN(_("Ignoring invalid remove watch %d"), watch);
return -1;
}
@@ -248,7 +248,7 @@ void virEventUpdateTimeoutImpl(int timer, int frequency) {
EVENT_DEBUG("Updating timer %d timeout with %d ms freq", timer, frequency);
if (timer <= 0) {
- VIR_WARN("Ignoring invalid update timer %d", timer);
+ VIR_WARN(_("Ignoring invalid update timer %d"), timer);
return;
}
@@ -282,7 +282,7 @@ int virEventRemoveTimeoutImpl(int timer) {
EVENT_DEBUG("Remove timer %d", timer);
if (timer <= 0) {
- VIR_WARN("Ignoring invalid remove timer %d", timer);
+ VIR_WARN(_("Ignoring invalid remove timer %d"), timer);
return -1;
}
diff --git a/daemon/remote.c b/daemon/remote.c
index c54565c..307a265 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -337,7 +337,7 @@ static int remoteRelayDomainEventGraphics(virConnectPtr conn ATTRIBUTE_UNUSED,
data.subject.subject_len = subject->nidentity;
if (VIR_ALLOC_N(data.subject.subject_val, data.subject.subject_len) < 0) {
- VIR_WARN0("cannot allocate memory for graphics event subject");
+ VIR_WARN0(_("cannot allocate memory for graphics event subject"));
return -1;
}
for (i = 0 ; i < data.subject.subject_len ; i++) {
@@ -5296,7 +5296,7 @@ remoteDispatchDomainEventSend (struct qemud_client *client,
goto xdr_error;
if (!(proc)(&xdr, data)) {
- VIR_WARN("Failed to serialize domain event %d", procnr);
+ VIR_WARN(_("Failed to serialize domain event %d"), procnr);
goto xdr_error;
}
diff --git a/daemon/stream.c b/daemon/stream.c
index d64fe73..86c894d 100644
--- a/daemon/stream.c
+++ b/daemon/stream.c
@@ -77,7 +77,7 @@ remoteStreamEvent(virStreamPtr st, int events, void *opaque)
stream = remoteFindClientStream(client, st);
if (!stream) {
- VIR_WARN("event for client=%p stream st=%p, but missing stream state", client, st);
+ VIR_WARN(_("event for client=%p stream st=%p, but missing stream state"), client, st);
virStreamEventRemoveCallback(st);
goto cleanup;
}
@@ -467,7 +467,7 @@ remoteStreamHandleAbort(struct qemud_client *client,
if (msg->hdr.status == REMOTE_ERROR)
remoteDispatchFormatError(&rerr, "%s", _("stream aborted at client request"));
else {
- VIR_WARN("unexpected stream status %d", msg->hdr.status);
+ VIR_WARN(_("unexpected stream status %d"), msg->hdr.status);
remoteDispatchFormatError(&rerr, _("stream aborted with unexpected status %d"),
msg->hdr.status);
}
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index e88aafe..0599c94 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -924,7 +924,7 @@ void virDomainEventDispatchDefaultFunc(virConnectPtr conn,
break;
default:
- VIR_WARN("Unexpected event ID %d", event->eventID);
+ VIR_WARN(_("Unexpected event ID %d"), event->eventID);
break;
}
diff --git a/src/driver.c b/src/driver.c
index e6f3aaa..e153e9d 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -58,7 +58,7 @@ virDriverLoadModule(const char *name)
return NULL;
if (access(modfile, R_OK) < 0) {
- VIR_WARN("Module %s not accessible", modfile);
+ VIR_WARN(_("Module %s not accessible"), modfile);
goto cleanup;
}
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 8e55fc6..5c83dc4 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -122,7 +122,7 @@ esxSupportsLongMode(esxPrivate *priv)
break;
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
@@ -274,7 +274,7 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
if (conn->uri->path != NULL && STRNEQ(conn->uri->path, "") &&
STRNEQ(conn->uri->path, "/")) {
- VIR_WARN("Ignoring unexpected path '%s' in URI", conn->uri->path);
+ VIR_WARN(_("Ignoring unexpected path '%s' in URI"), conn->uri->path);
}
/* Allocate per-connection private data */
@@ -399,7 +399,7 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
}
if (dynamicProperty->val->boolean == esxVI_Boolean_True) {
- VIR_WARN0("The server is in maintenance mode");
+ VIR_WARN0(_("The server is in maintenance mode"));
}
break;
@@ -617,7 +617,7 @@ esxSupportsVMotion(esxPrivate *priv)
priv->supportsVMotion = dynamicProperty->val->boolean;
break;
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
@@ -737,7 +737,7 @@ esxGetHostname(virConnectPtr conn)
domainName = dynamicProperty->val->string;
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
@@ -899,7 +899,7 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
goto failure;
}
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
@@ -1559,7 +1559,7 @@ esxDomainGetMaxMemory(virDomainPtr domain)
break;
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
@@ -1765,7 +1765,7 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
memory_limit *= 1024; /* Scale from megabyte to kilobyte */
}
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
@@ -1851,7 +1851,7 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
}
if (priv->usedCpuTimeCounterId < 0) {
- VIR_WARN0("Could not find 'used CPU time' performance counter");
+ VIR_WARN0(_("Could not find 'used CPU time' performance counter"));
}
}
@@ -2054,7 +2054,7 @@ esxDomainGetMaxVcpus(virDomainPtr domain)
priv->maxVcpus = dynamicProperty->val->int32;
break;
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
@@ -2812,7 +2812,7 @@ esxDomainGetSchedulerParameters(virDomainPtr domain,
mask |= 1 << 2;
++i;
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
@@ -3188,7 +3188,7 @@ esxNodeGetFreeMemory(virConnectPtr conn)
break;
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
index 51c9afc..8aa8c98 100644
--- a/src/esx/esx_util.c
+++ b/src/esx/esx_util.c
@@ -131,7 +131,7 @@ esxUtil_ParseQuery(xmlURIPtr uri, char **transport, char **vCenter,
goto failure;
}
} else {
- VIR_WARN("Ignoring unexpected query parameter '%s'",
+ VIR_WARN(_("Ignoring unexpected query parameter '%s'"),
queryParam->name);
}
}
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 966ef85..2f41c58 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -465,7 +465,7 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
goto failure;
}
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
@@ -1348,7 +1348,7 @@ esxVI_EnsureSession(esxVI_Context *ctx)
break;
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
@@ -1567,7 +1567,7 @@ esxVI_LookupNumberOfDomainsByPowerState(esxVI_Context *ctx,
numberOfDomains++;
}
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
}
@@ -1868,7 +1868,7 @@ esxVI_LookupResourcePoolByHostSystem
break;
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
@@ -1902,7 +1902,7 @@ esxVI_LookupResourcePoolByHostSystem
break;
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
@@ -2277,7 +2277,7 @@ esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name,
goto cleanup;
}
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
}
@@ -2340,7 +2340,7 @@ int esxVI_LookupTaskInfoByTask(esxVI_Context *ctx,
break;
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
@@ -2499,7 +2499,7 @@ esxVI_LookupRootSnapshotTreeList
break;
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
@@ -2560,7 +2560,7 @@ esxVI_LookupCurrentSnapshotTree
goto failure;
}
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index 7d2c02c..3e41108 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -271,7 +271,7 @@
\
_deserialize \
\
- VIR_WARN("Unexpected '%s' property", childNode->name); \
+ VIR_WARN(_("Unexpected '%s' property"), childNode->name); \
} \
\
if (esxVI_##_type##_Validate(*ptrptr) < 0) { \
diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
index 142f2f7..f1c612d 100644
--- a/src/esx/esx_vmx.c
+++ b/src/esx/esx_vmx.c
@@ -637,7 +637,7 @@ esxVMX_AbsolutePathToDatastoreRelatedPath(esxVI_Context *ctx,
} else if (STREQ(dynamicProperty->name, "summary.url")) {
/* Ignore it */
} else {
- VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+ VIR_WARN(_("Unexpected '%s' property"), dynamicProperty->name);
}
}
}
@@ -1221,7 +1221,7 @@ esxVMX_ParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def)
(*def)->data.vnc.autoport = 1;
} else {
if (port < 5900 || port > 5964) {
- VIR_WARN("VNC port %lld it out of [5900..5964] range", port);
+ VIR_WARN(_("VNC port %lld it out of [5900..5964] range"), port);
}
(*def)->data.vnc.port = port;
@@ -2477,7 +2477,7 @@ esxVMX_FormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer)
"VNC port cannot be read back");
} else {
if (def->data.vnc.port < 5900 || def->data.vnc.port > 5964) {
- VIR_WARN("VNC port %d it out of [5900..5964] range",
+ VIR_WARN(_("VNC port %d it out of [5900..5964] range"),
def->data.vnc.port);
}
diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c
index 8d7f69e..ad9a814 100644
--- a/src/lxc/lxc_conf.c
+++ b/src/lxc/lxc_conf.c
@@ -56,7 +56,7 @@ virCapsPtr lxcCapsInit(void)
*/
if (nodeCapsInitNUMA(caps) < 0) {
virCapabilitiesFreeNUMAInfo(caps);
- VIR_WARN0("Failed to query host NUMA topology, disabling NUMA capabilities");
+ VIR_WARN0(_("Failed to query host NUMA topology, disabling NUMA capabilities"));
}
/* XXX shouldn't 'borrow' KVM's prefix */
@@ -120,7 +120,7 @@ int lxcLoadDriverConfig(lxc_driver_t *driver)
p = virConfGetValue(conf, "log_with_libvirtd");
if (p) {
if (p->type != VIR_CONF_LONG)
- VIR_WARN0("lxcLoadDriverConfig: invalid setting: log_with_libvirtd");
+ VIR_WARN0(_("lxcLoadDriverConfig: invalid setting: log_with_libvirtd"));
else
driver->log_libvirtd = p->l;
}
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index c120b8e..6c89375 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -576,7 +576,7 @@ lxcControllerRun(virDomainDefPtr def,
}
if (access(devptmx, R_OK) < 0) {
- VIR_WARN0("Kernel does not support private devpts, using shared devpts");
+ VIR_WARN0(_("Kernel does not support private devpts, using shared devpts"));
VIR_FREE(devptmx);
}
}
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 8c3bbd3..840aeda 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1878,7 +1878,7 @@ static int lxcStartup(int privileged)
rc = virCgroupForDriver("lxc", &lxc_driver->cgroup, privileged, 1);
if (rc < 0) {
char buf[1024];
- VIR_WARN("Unable to create cgroup for driver: %s",
+ VIR_WARN(_("Unable to create cgroup for driver: %s"),
virStrerror(-rc, buf, sizeof(buf)));
}
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 5ec1bcf..e6fbee1 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -336,7 +336,7 @@ nodeCapsInitNUMA(virCapsPtr caps)
int i;
int ncpus;
if (numa_node_to_cpus(n, mask, mask_n_bytes) < 0) {
- VIR_WARN("NUMA topology for cell %d of %d not available, ignoring",
+ VIR_WARN(_("NUMA topology for cell %d of %d not available, ignoring"),
n, numa_max_node());
continue;
}
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index cec99b1..0e32a18 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1344,15 +1344,15 @@ phypDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
if ((info->maxMem =
phypGetLparMem(dom->conn, managed_system, dom->id, 0)) == 0)
- VIR_WARN("%s", "Unable to determine domain's max memory.");
+ VIR_WARN(_("%s"), "Unable to determine domain's max memory.");
if ((info->memory =
phypGetLparMem(dom->conn, managed_system, dom->id, 1)) == 0)
- VIR_WARN("%s", "Unable to determine domain's memory.");
+ VIR_WARN(_("%s"), "Unable to determine domain's memory.");
if ((info->nrVirtCpu =
phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0)
- VIR_WARN("%s", "Unable to determine domain's CPU.");
+ VIR_WARN(_("%s"), "Unable to determine domain's CPU.");
return 0;
}
@@ -1416,14 +1416,14 @@ phypDomainCreateAndStart(virConnectPtr conn,
/* checking if this name already exists on this system */
if (phypGetLparID(session, managed_system, def->name, conn) == -1) {
- VIR_WARN("%s", "LPAR name already exists.");
+ VIR_WARN(_("%s"), "LPAR name already exists.");
goto err;
}
/* checking if ID or UUID already exists on this system */
for (i = 0; i < uuid_table->nlpars; i++) {
if (lpars[i]->id == def->id || lpars[i]->uuid == def->uuid) {
- VIR_WARN("%s", "LPAR ID or UUID already exists.");
+ VIR_WARN(_("%s"), "LPAR ID or UUID already exists.");
goto err;
}
}
@@ -1782,7 +1782,7 @@ phypUUIDTable_ReadFile(virConnectPtr conn)
int id;
if ((fd = open(local_file, O_RDONLY)) == -1) {
- VIR_WARN("%s", "Unable to write information to local file.");
+ VIR_WARN(_("%s"), "Unable to write information to local file.");
goto err;
}
@@ -1798,14 +1798,14 @@ phypUUIDTable_ReadFile(virConnectPtr conn)
}
uuid_table->lpars[i]->id = id;
} else {
- VIR_WARN("%s",
+ VIR_WARN(_("%s"),
"Unable to read from information to local file.");
goto err;
}
rc = read(fd, uuid_table->lpars[i]->uuid, VIR_UUID_BUFLEN);
if (rc != VIR_UUID_BUFLEN) {
- VIR_WARN("%s",
+ VIR_WARN(_("%s"),
"Unable to read information to local file.");
goto err;
}
@@ -1909,7 +1909,7 @@ phypUUIDTable_Init(virConnectPtr conn)
uuid_table->lpars[i]->id = ids[i];
if (virUUIDGenerate(uuid_table->lpars[i]->uuid) < 0)
- VIR_WARN("%s %d", "Unable to generate UUID for domain",
+ VIR_WARN(_("%s %d", "Unable to generate UUID for domain"),
ids[i]);
}
} else {
@@ -1968,12 +1968,12 @@ phypUUIDTable_Push(virConnectPtr conn)
char local_file[] = "./uuid_table";
if (stat(local_file, &local_fileinfo) == -1) {
- VIR_WARN0("Unable to stat local file.");
+ VIR_WARN0(_("Unable to stat local file."));
goto err;
}
if (!(fd = fopen(local_file, "rb"))) {
- VIR_WARN0("Unable to open local file.");
+ VIR_WARN0(_("Unable to open local file."));
goto err;
}
@@ -2083,7 +2083,7 @@ phypUUIDTable_Pull(virConnectPtr conn)
rc = libssh2_channel_read(channel, buffer, amount);
if (rc > 0) {
if (safewrite(fd, buffer, rc) != rc)
- VIR_WARN("%s",
+ VIR_WARN(_("%s"),
"Unable to write information to local file.");
got += rc;
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 5fa8c0a..4cc49bf 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1069,12 +1069,12 @@ virCapsPtr qemudCapsInit(virCapsPtr old_caps) {
*/
if (nodeCapsInitNUMA(caps) < 0) {
virCapabilitiesFreeNUMAInfo(caps);
- VIR_WARN0("Failed to query host NUMA topology, disabling NUMA capabilities");
+ VIR_WARN0(_("Failed to query host NUMA topology, disabling NUMA capabilities"));
}
if (old_caps == NULL || old_caps->host.cpu == NULL) {
if (qemudCapsInitCPU(caps, utsname.machine) < 0)
- VIR_WARN0("Failed to get host CPU");
+ VIR_WARN0(_("Failed to get host CPU"));
}
else {
caps->host.cpu = old_caps->host.cpu;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 9d23191..d830860 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -928,7 +928,7 @@ qemuHandleDomainStop(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
- VIR_WARN("Unable to save status on vm %s after IO error", vm->def->name);
+ VIR_WARN(_("Unable to save status on vm %s after IO error"), vm->def->name);
}
virDomainObjUnlock(vm);
@@ -958,7 +958,7 @@ qemuHandleDomainRTCChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
vm->def->clock.data.adjustment = offset;
if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
- VIR_WARN0("unable to save domain status with RTC change");
+ VIR_WARN0(_("unable to save domain status with RTC change"));
virDomainObjUnlock(vm);
@@ -994,7 +994,7 @@ qemuHandleDomainWatchdog(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
VIR_DOMAIN_EVENT_SUSPENDED_WATCHDOG);
if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
- VIR_WARN("Unable to save status on vm %s after IO error", vm->def->name);
+ VIR_WARN(_("Unable to save status on vm %s after IO error"), vm->def->name);
}
virDomainObjUnlock(vm);
@@ -1050,7 +1050,7 @@ qemuHandleDomainIOError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
VIR_DOMAIN_EVENT_SUSPENDED_IOERROR);
if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
- VIR_WARN("Unable to save status on vm %s after IO error", vm->def->name);
+ VIR_WARN(_("Unable to save status on vm %s after IO error"), vm->def->name);
}
virDomainObjUnlock(vm);
@@ -1580,7 +1580,7 @@ qemudStartup(int privileged) {
rc = virCgroupForDriver("qemu", &qemu_driver->cgroup, privileged, 1);
if (rc < 0) {
char buf[1024];
- VIR_WARN("Unable to create cgroup for driver: %s",
+ VIR_WARN(_("Unable to create cgroup for driver: %s"),
virStrerror(-rc, buf, sizeof(buf)));
}
@@ -3077,7 +3077,7 @@ static int qemuSetupCgroup(struct qemud_driver *driver,
rc = virCgroupDenyAllDevices(cgroup);
if (rc != 0) {
if (rc == -EPERM) {
- VIR_WARN0("Group devices ACL is not accessible, disabling whitelisting");
+ VIR_WARN0(_("Group devices ACL is not accessible, disabling whitelisting"));
goto done;
}
@@ -3711,7 +3711,7 @@ retry:
usleep(200*1000);
goto retry;
}
- VIR_WARN("Failed to remove cgroup for %s",
+ VIR_WARN(_("Failed to remove cgroup for %s"),
vm->def->name);
}
@@ -3944,7 +3944,7 @@ static int qemudGetProcessInfo(unsigned long long *cpuTime, int *lastCpu, int pi
"%*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %*d %d",
&usertime, &systime, &cpu) != 3) {
fclose(pidinfo);
- VIR_WARN0("cannot parse process status data");
+ VIR_WARN0(_("cannot parse process status data"));
errno = -EINVAL;
return -1;
}
@@ -4662,13 +4662,13 @@ qemuDomainWaitForMigrationComplete(struct qemud_driver *driver, virDomainObjPtr
rc = qemuMonitorMigrateCancel(priv->mon);
qemuDomainObjExitMonitorWithDriver(driver, vm);
if (rc < 0) {
- VIR_WARN0("Unable to cancel migration");
+ VIR_WARN0(_("Unable to cancel migration"));
}
} else if (priv->jobSignals & QEMU_JOB_SIGNAL_SUSPEND) {
priv->jobSignals ^= QEMU_JOB_SIGNAL_SUSPEND;
VIR_DEBUG0("Pausing domain for non-live migration");
if (qemuDomainMigrateOffline(driver, vm) < 0)
- VIR_WARN0("Unable to pause domain");
+ VIR_WARN0(_("Unable to pause domain"));
} else if (priv->jobSignals & QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME) {
unsigned long long ms = priv->jobSignalsData.migrateDowntime;
@@ -4679,7 +4679,7 @@ qemuDomainWaitForMigrationComplete(struct qemud_driver *driver, virDomainObjPtr
rc = qemuMonitorSetMigrationDowntime(priv->mon, ms);
qemuDomainObjExitMonitorWithDriver(driver, vm);
if (rc < 0)
- VIR_WARN0("Unable to set migration downtime");
+ VIR_WARN0(_("Unable to set migration downtime"));
}
qemuDomainObjEnterMonitorWithDriver(driver, vm);
@@ -5102,12 +5102,12 @@ static int qemudDomainSaveFlag(virDomainPtr dom, const char *path,
driver->securityDriver &&
driver->securityDriver->domainRestoreSavedStateLabel &&
driver->securityDriver->domainRestoreSavedStateLabel(vm, path) == -1)
- VIR_WARN("failed to restore save state label on %s", path);
+ VIR_WARN(_("failed to restore save state label on %s"), path);
if (cgroup != NULL) {
rc = virCgroupDenyDevicePath(cgroup, path);
if (rc != 0)
- VIR_WARN("Unable to deny device %s for %s %d",
+ VIR_WARN(_("Unable to deny device %s for %s %d"),
path, vm->def->name, rc);
}
@@ -5133,7 +5133,7 @@ endjob:
rc = qemuMonitorStartCPUs(priv->mon, dom->conn);
qemuDomainObjExitMonitorWithDriver(driver, vm);
if (rc < 0)
- VIR_WARN0("Unable to resume guest CPUs after save failure");
+ VIR_WARN0(_("Unable to resume guest CPUs after save failure"));
else
vm->state = VIR_DOMAIN_RUNNING;
}
@@ -5141,7 +5141,7 @@ endjob:
if (cgroup != NULL) {
rc = virCgroupDenyDevicePath(cgroup, path);
if (rc != 0)
- VIR_WARN("Unable to deny device %s for %s: %d",
+ VIR_WARN(_("Unable to deny device %s for %s: %d"),
path, vm->def->name, rc);
}
@@ -5149,7 +5149,7 @@ endjob:
driver->securityDriver &&
driver->securityDriver->domainRestoreSavedStateLabel &&
driver->securityDriver->domainRestoreSavedStateLabel(vm, path) == -1)
- VIR_WARN("failed to restore save state label on %s", path);
+ VIR_WARN(_("failed to restore save state label on %s"), path);
}
if (qemuDomainObjEndJob(vm) == 0)
@@ -6177,7 +6177,7 @@ static int qemudDomainRestore(virConnectPtr conn,
qemuDomainObjExitMonitorWithDriver(driver, vm);
vm->state = VIR_DOMAIN_RUNNING;
if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0) {
- VIR_WARN("Failed to save status on vm %s", vm->def->name);
+ VIR_WARN(_("Failed to save status on vm %s"), vm->def->name);
goto endjob;
}
}
@@ -6529,7 +6529,7 @@ static int qemudDomainStart(virDomainPtr dom) {
ret = qemudDomainRestore(dom->conn, managed_save);
if (unlink(managed_save) < 0) {
- VIR_WARN("Failed to remove the managed state %s", managed_save);
+ VIR_WARN(_("Failed to remove the managed state %s"), managed_save);
}
if (ret == 0) {
@@ -6847,7 +6847,7 @@ static int qemudDomainChangeEjectableMedia(struct qemud_driver *driver,
if (driver->securityDriver &&
driver->securityDriver->domainRestoreSecurityImageLabel &&
driver->securityDriver->domainRestoreSecurityImageLabel(vm, origdisk) < 0)
- VIR_WARN("Unable to restore security label on ejected image %s", origdisk->src);
+ VIR_WARN(_("Unable to restore security label on ejected image %s"), origdisk->src);
VIR_FREE(origdisk->src);
origdisk->src = disk->src;
@@ -6865,7 +6865,7 @@ error:
if (driver->securityDriver &&
driver->securityDriver->domainRestoreSecurityImageLabel &&
driver->securityDriver->domainRestoreSecurityImageLabel(vm, disk) < 0)
- VIR_WARN("Unable to restore security label on new media %s", disk->src);
+ VIR_WARN(_("Unable to restore security label on new media %s"), disk->src);
return -1;
}
@@ -6954,12 +6954,12 @@ error:
if ((qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) &&
(disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &disk->info) < 0)
- VIR_WARN("Unable to release PCI address on %s", disk->src);
+ VIR_WARN(_("Unable to release PCI address on %s"), disk->src);
if (driver->securityDriver &&
driver->securityDriver->domainRestoreSecurityImageLabel &&
driver->securityDriver->domainRestoreSecurityImageLabel(vm, disk) < 0)
- VIR_WARN("Unable to restore security label on %s", disk->src);
+ VIR_WARN(_("Unable to restore security label on %s"), disk->src);
return -1;
}
@@ -7023,7 +7023,7 @@ cleanup:
(qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) &&
(controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &controller->info) < 0)
- VIR_WARN0("Unable to release PCI address on controller");
+ VIR_WARN0(_("Unable to release PCI address on controller"));
VIR_FREE(devstr);
return ret;
@@ -7177,7 +7177,7 @@ error:
if (driver->securityDriver &&
driver->securityDriver->domainRestoreSecurityImageLabel &&
driver->securityDriver->domainRestoreSecurityImageLabel(vm, disk) < 0)
- VIR_WARN("Unable to restore security label on %s", disk->src);
+ VIR_WARN(_("Unable to restore security label on %s"), disk->src);
return -1;
}
@@ -7260,7 +7260,7 @@ error:
if (driver->securityDriver &&
driver->securityDriver->domainRestoreSecurityImageLabel &&
driver->securityDriver->domainRestoreSecurityImageLabel(vm, disk) < 0)
- VIR_WARN("Unable to restore security label on %s", disk->src);
+ VIR_WARN(_("Unable to restore security label on %s"), disk->src);
return -1;
}
@@ -7419,7 +7419,7 @@ cleanup:
(qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) &&
(net->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &net->info) < 0)
- VIR_WARN0("Unable to release PCI address on NIC");
+ VIR_WARN0(_("Unable to release PCI address on NIC"));
if (ret != 0)
virNWFilterTearNWFilter(net);
@@ -7545,7 +7545,7 @@ error:
if ((qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) &&
(hostdev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &hostdev->info) < 0)
- VIR_WARN0("Unable to release PCI address on host device");
+ VIR_WARN0(_("Unable to release PCI address on host device"));
VIR_FREE(devstr);
pciDeviceListDel(driver->activePciHostdevs, pci);
@@ -7658,7 +7658,7 @@ error:
if (driver->securityDriver &&
driver->securityDriver->domainRestoreSecurityHostdevLabel &&
driver->securityDriver->domainRestoreSecurityHostdevLabel(vm, hostdev) < 0)
- VIR_WARN0("Unable to restore host device labelling on hotplug fail");
+ VIR_WARN0(_("Unable to restore host device labelling on hotplug fail"));
return -1;
}
@@ -7757,7 +7757,7 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
}
if (ret != 0 && cgroup) {
if (qemuTeardownDiskCgroup(cgroup, vm, dev->data.disk) < 0)
- VIR_WARN("Failed to teardown cgroup for disk path %s",
+ VIR_WARN(_("Failed to teardown cgroup for disk path %s"),
NULLSTR(dev->data.disk->src));
}
} else if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER) {
@@ -7980,7 +7980,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
if (ret != 0 && cgroup) {
if (qemuTeardownDiskCgroup(cgroup, vm, dev->data.disk) < 0)
- VIR_WARN("Failed to teardown cgroup for disk path %s",
+ VIR_WARN(_("Failed to teardown cgroup for disk path %s"),
NULLSTR(dev->data.disk->src));
}
break;
@@ -8103,11 +8103,11 @@ static int qemudDomainDetachPciDiskDevice(struct qemud_driver *driver,
if (driver->securityDriver &&
driver->securityDriver->domainRestoreSecurityImageLabel &&
driver->securityDriver->domainRestoreSecurityImageLabel(vm, dev->data.disk) < 0)
- VIR_WARN("Unable to restore security label on %s", dev->data.disk->src);
+ VIR_WARN(_("Unable to restore security label on %s"), dev->data.disk->src);
if (cgroup != NULL) {
if (qemuTeardownDiskCgroup(cgroup, vm, dev->data.disk) < 0)
- VIR_WARN("Failed to teardown cgroup for disk path %s",
+ VIR_WARN(_("Failed to teardown cgroup for disk path %s"),
NULLSTR(dev->data.disk->src));
}
@@ -8166,11 +8166,11 @@ static int qemudDomainDetachSCSIDiskDevice(struct qemud_driver *driver,
if (driver->securityDriver &&
driver->securityDriver->domainRestoreSecurityImageLabel &&
driver->securityDriver->domainRestoreSecurityImageLabel(vm, dev->data.disk) < 0)
- VIR_WARN("Unable to restore security label on %s", dev->data.disk->src);
+ VIR_WARN(_("Unable to restore security label on %s"), dev->data.disk->src);
if (cgroup != NULL) {
if (qemuTeardownDiskCgroup(cgroup, vm, dev->data.disk) < 0)
- VIR_WARN("Failed to teardown cgroup for disk path %s",
+ VIR_WARN(_("Failed to teardown cgroup for disk path %s"),
NULLSTR(dev->data.disk->src));
}
@@ -8247,7 +8247,7 @@ static int qemudDomainDetachPciControllerDevice(struct qemud_driver *driver,
}
if (qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &detach->info) < 0) {
- VIR_WARN0("Unable to release PCI address on controller");
+ VIR_WARN0(_("Unable to release PCI address on controller"));
}
virDomainControllerDefFree(detach);
@@ -8585,7 +8585,7 @@ static int qemudDomainDetachHostDevice(struct qemud_driver *driver,
if (driver->securityDriver &&
driver->securityDriver->domainRestoreSecurityHostdevLabel &&
driver->securityDriver->domainRestoreSecurityHostdevLabel(vm, dev->data.hostdev) < 0)
- VIR_WARN0("Failed to restore host device labelling");
+ VIR_WARN0(_("Failed to restore host device labelling"));
return ret;
}
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 3c0a823..4404ad8 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -83,7 +83,7 @@ qemuMonitorJSONIOProcessEvent(qemuMonitorPtr mon,
type = virJSONValueObjectGetString(obj, "event");
if (!type) {
- VIR_WARN0("missing event type in message");
+ VIR_WARN0(_("missing event type in message"));
errno = EINVAL;
return -1;
}
@@ -536,7 +536,7 @@ static void qemuMonitorJSONHandleRTCChange(qemuMonitorPtr mon, virJSONValuePtr d
{
long long offset = 0;
if (virJSONValueObjectGetNumberLong(data, "offset", &offset) < 0) {
- VIR_WARN0("missing offset in RTC change event");
+ VIR_WARN0(_("missing offset in RTC change event"));
offset = 0;
}
qemuMonitorEmitRTCChange(mon, offset);
@@ -551,11 +551,11 @@ static void qemuMonitorJSONHandleWatchdog(qemuMonitorPtr mon, virJSONValuePtr da
const char *action;
int actionID;
if (!(action = virJSONValueObjectGetString(data, "action"))) {
- VIR_WARN0("missing action in watchdog event");
+ VIR_WARN0(_("missing action in watchdog event"));
}
if (action) {
if ((actionID = qemuMonitorWatchdogActionTypeFromString(action)) < 0) {
- VIR_WARN("unknown action %s in watchdog event", action);
+ VIR_WARN(_("unknown action %s in watchdog event"), action);
actionID = VIR_DOMAIN_EVENT_WATCHDOG_NONE;
}
} else {
@@ -581,21 +581,21 @@ static void qemuMonitorJSONHandleIOError(qemuMonitorPtr mon, virJSONValuePtr dat
to the application */
if ((action = virJSONValueObjectGetString(data, "action")) == NULL) {
- VIR_WARN0("Missing action in disk io error event");
+ VIR_WARN0(_("Missing action in disk io error event"));
action = "ignore";
}
if ((device = virJSONValueObjectGetString(data, "device")) == NULL) {
- VIR_WARN0("missing device in disk io error event");
+ VIR_WARN0(_("missing device in disk io error event"));
}
if ((reason = virJSONValueObjectGetString(data, "reason")) == NULL) {
- VIR_WARN0("missing reason in disk io error event");
+ VIR_WARN0(_("missing reason in disk io error event"));
reason = "";
}
if ((actionID = qemuMonitorIOErrorActionTypeFromString(action)) < 0) {
- VIR_WARN("unknown disk io error action '%s'", action);
+ VIR_WARN(_("unknown disk io error action '%s'"), action);
actionID = VIR_DOMAIN_EVENT_IO_ERROR_NONE;
}
@@ -617,11 +617,11 @@ static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, i
virJSONValuePtr server;
if (!(client = virJSONValueObjectGet(data, "client"))) {
- VIR_WARN0("missing client info in VNC event");
+ VIR_WARN0(_("missing client info in VNC event"));
return;
}
if (!(server = virJSONValueObjectGet(data, "server"))) {
- VIR_WARN0("missing server info in VNC event");
+ VIR_WARN0(_("missing server info in VNC event"));
return;
}
@@ -639,11 +639,11 @@ static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, i
x509dname = virJSONValueObjectGetString(client, "x509_dname");
if ((localFamilyID = qemuMonitorGraphicsAddressFamilyTypeFromString(localFamily)) < 0) {
- VIR_WARN("unknown address family '%s'", localFamily);
+ VIR_WARN(_("unknown address family '%s'"), localFamily);
localFamilyID = VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV4;
}
if ((remoteFamilyID = qemuMonitorGraphicsAddressFamilyTypeFromString(remoteFamily)) < 0) {
- VIR_WARN("unknown address family '%s'", remoteFamily);
+ VIR_WARN(_("unknown address family '%s'"), remoteFamily);
remoteFamilyID = VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV4;
}
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 990bfce..387a8fd 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -8009,7 +8009,7 @@ remoteStreamHasError(virStreamPtr st) {
return 0;
}
- VIR_WARN0("Raising async error");
+ VIR_WARN0(_("Raising async error"));
virRaiseErrorFull(st->conn,
__FILE__, __FUNCTION__, __LINE__,
privst->err.domain,
@@ -9406,7 +9406,7 @@ processCallDispatchStream(virConnectPtr conn ATTRIBUTE_UNUSED,
privst = privst->next;
if (!privst) {
- VIR_WARN("No registered stream matching serial=%d, proc=%d",
+ VIR_WARN(_("No registered stream matching serial=%d, proc=%d"),
hdr->serial, hdr->proc);
return -1;
}
@@ -9426,7 +9426,7 @@ processCallDispatchStream(virConnectPtr conn ATTRIBUTE_UNUSED,
case REMOTE_CONTINUE: {
int avail = privst->incomingLength - privst->incomingOffset;
int need = priv->bufferLength - priv->bufferOffset;
- VIR_WARN0("Got a stream data packet");
+ VIR_WARN0(_("Got a stream data packet"));
/* XXX flag stream as complete somwhere if need==0 */
@@ -9434,7 +9434,7 @@ processCallDispatchStream(virConnectPtr conn ATTRIBUTE_UNUSED,
int extra = need - avail;
if (VIR_REALLOC_N(privst->incoming,
privst->incomingLength + extra) < 0) {
- VIR_WARN0("Out of memory");
+ VIR_WARN0(_("Out of memory"));
return -1;
}
privst->incomingLength += extra;
@@ -9446,18 +9446,18 @@ processCallDispatchStream(virConnectPtr conn ATTRIBUTE_UNUSED,
privst->incomingOffset += (priv->bufferLength - priv->bufferOffset);
if (thecall && thecall->want_reply) {
- VIR_WARN("Got sync data packet offset=%d", privst->incomingOffset);
+ VIR_WARN(_("Got sync data packet offset=%d"), privst->incomingOffset);
thecall->mode = REMOTE_MODE_COMPLETE;
} else {
- VIR_WARN("Got aysnc data packet offset=%d", privst->incomingOffset);
+ VIR_WARN(_("Got aysnc data packet offset=%d"), privst->incomingOffset);
}
return 0;
}
case REMOTE_OK:
- VIR_WARN0("Got a synchronous confirm");
+ VIR_WARN0(_("Got a synchronous confirm"));
if (!thecall) {
- VIR_WARN0("Got unexpected stream finish confirmation");
+ VIR_WARN0(_("Got unexpected stream finish confirmation"));
return -1;
}
thecall->mode = REMOTE_MODE_COMPLETE;
@@ -9465,7 +9465,7 @@ processCallDispatchStream(virConnectPtr conn ATTRIBUTE_UNUSED,
case REMOTE_ERROR:
if (thecall && thecall->want_reply) {
- VIR_WARN0("Got a synchronous error");
+ VIR_WARN0(_("Got a synchronous error"));
/* Give the error straight to this call */
memset (&thecall->err, 0, sizeof thecall->err);
if (!xdr_remote_error (xdr, &thecall->err)) {
@@ -9474,23 +9474,23 @@ processCallDispatchStream(virConnectPtr conn ATTRIBUTE_UNUSED,
}
thecall->mode = REMOTE_MODE_ERROR;
} else {
- VIR_WARN0("Got a asynchronous error");
+ VIR_WARN0(_("Got a asynchronous error"));
/* No call, so queue the error against the stream */
if (privst->has_error) {
- VIR_WARN0("Got unexpected duplicate stream error");
+ VIR_WARN0(_("Got unexpected duplicate stream error"));
return -1;
}
privst->has_error = 1;
memset (&privst->err, 0, sizeof privst->err);
if (!xdr_remote_error (xdr, &privst->err)) {
- VIR_WARN0("Failed to unmarshall error");
+ VIR_WARN0(_("Failed to unmarshall error"));
return -1;
}
}
return 0;
default:
- VIR_WARN("Stream with unexpected serial=%d, proc=%d, status=%d",
+ VIR_WARN(_("Stream with unexpected serial=%d, proc=%d, status=%d"),
hdr->serial, hdr->proc, hdr->status);
return -1;
}
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 669ef42..e61d235 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -768,7 +768,7 @@ SELinuxSetSecurityAllLabel(virDomainObjPtr vm)
for (i = 0 ; i < vm->def->ndisks ; i++) {
/* XXX fixme - we need to recursively label the entire tree :-( */
if (vm->def->disks[i]->type == VIR_DOMAIN_DISK_TYPE_DIR) {
- VIR_WARN("Unable to relabel directory tree %s for disk %s",
+ VIR_WARN(_("Unable to relabel directory tree %s for disk %s"),
vm->def->disks[i]->src, vm->def->disks[i]->dst);
continue;
}
diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index 06238d1..7263487 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -331,7 +331,7 @@ virStorageBackendLogicalFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED,
* worst that happens is that scanning doesn't pick everything up
*/
if (virRun(scanprog, &exitstatus) < 0) {
- VIR_WARN0("Failure when running vgscan to refresh physical volumes");
+ VIR_WARN0(_("Failure when running vgscan to refresh physical volumes"));
}
memset(&sourceList, 0, sizeof(sourceList));
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index a10bca0..ba55b50 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -70,7 +70,7 @@ virCapsPtr umlCapsInit(void) {
*/
if (nodeCapsInitNUMA(caps) < 0) {
virCapabilitiesFreeNUMAInfo(caps);
- VIR_WARN0("Failed to query host NUMA topology, disabling NUMA capabilities");
+ VIR_WARN0(_("Failed to query host NUMA topology, disabling NUMA capabilities"));
}
if ((guest = virCapabilitiesAddGuest(caps,
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index ffb87c8..15dd505 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -318,10 +318,10 @@ reread:
dom->state = VIR_DOMAIN_RUNNING;
if (umlOpenMonitor(driver, dom) < 0) {
- VIR_WARN0("Could not open monitor for new domain");
+ VIR_WARN0(_("Could not open monitor for new domain"));
umlShutdownVMDaemon(NULL, driver, dom);
} else if (umlIdentifyChrPTY(driver, dom) < 0) {
- VIR_WARN0("Could not identify charater devices for new domain");
+ VIR_WARN0(_("Could not identify charater devices for new domain"));
umlShutdownVMDaemon(NULL, driver, dom);
}
}
diff --git a/src/util/hooks.c b/src/util/hooks.c
index dec9223..a163f2c 100644
--- a/src/util/hooks.c
+++ b/src/util/hooks.c
@@ -113,7 +113,7 @@ virHookCheck(int no, const char *driver) {
} else {
if ((access(path, X_OK) != 0) || (!S_ISREG(sb.st_mode))) {
ret = 0;
- VIR_WARN("Non executable hook script %s", path);
+ VIR_WARN(_("Non executable hook script %s"), path);
} else {
ret = 1;
VIR_DEBUG("Found hook script %s", path);
diff --git a/src/util/json.c b/src/util/json.c
index f90594c..67b1421 100644
--- a/src/util/json.c
+++ b/src/util/json.c
@@ -922,7 +922,7 @@ cleanup:
if (parser.nstate) {
int i;
- VIR_WARN("cleanup state %d", parser.nstate);
+ VIR_WARN(_("cleanup state %d"), parser.nstate);
for (i = 0 ; i < parser.nstate ; i++) {
VIR_FREE(parser.state[i].key);
}
diff --git a/src/util/pci.c b/src/util/pci.c
index a1bd8e3..404a4d0 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -277,7 +277,7 @@ pciIterDevices(pciIterPredicate predicate,
dir = opendir(PCI_SYSFS "devices");
if (!dir) {
- VIR_WARN0("Failed to open " PCI_SYSFS "devices");
+ VIR_WARN0(_("Failed to open " PCI_SYSFS "devices"));
return -1;
}
@@ -299,7 +299,7 @@ pciIterDevices(pciIterPredicate predicate,
virStrToLong_ui(tmp + 1, &tmp, 16, &slot) < 0 || *tmp != '.' ||
/* function */
virStrToLong_ui(tmp + 1, NULL, 16, &function) < 0) {
- VIR_WARN("Unusual entry in " PCI_SYSFS "devices: %s", entry->d_name);
+ VIR_WARN(_("Unusual entry in " PCI_SYSFS "devices: %s"), entry->d_name);
continue;
}
diff --git a/src/util/util.c b/src/util/util.c
index e937d39..f623234 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -292,7 +292,7 @@ static int virClearCapabilities(void)
# else
static int virClearCapabilities(void)
{
-// VIR_WARN0("libcap-ng support not compiled in, unable to clear capabilities");
+// VIR_WARN0(_("libcap-ng support not compiled in, unable to clear capabilities"));
return 0;
}
# endif
diff --git a/src/xen/proxy_internal.c b/src/xen/proxy_internal.c
index 1efdb83..96091dc 100644
--- a/src/xen/proxy_internal.c
+++ b/src/xen/proxy_internal.c
@@ -147,7 +147,7 @@ virProxyForkServer(void)
const char *proxyarg[2];
if (!proxyPath) {
- VIR_WARN0("failed to find libvirt_proxy");
+ VIR_WARN0(_("failed to find libvirt_proxy"));
return(-1);
}
@@ -271,7 +271,7 @@ retry:
VIR_DEBUG("read socket %d interrupted", fd);
goto retry;
}
- VIR_WARN("Failed to read socket %d", fd);
+ VIR_WARN(_("Failed to read socket %d"), fd);
return(-1);
}
diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
index 4eb17fa..1cd24c7 100644
--- a/src/xenapi/xenapi_utils.c
+++ b/src/xenapi/xenapi_utils.c
@@ -312,7 +312,7 @@ getCpuBitMapfromString(char *mask, unsigned char *cpumap, int maplen)
if (virStrToLong_i(num, NULL, 10, &pos) < 0)
return;
if (pos < 0 || pos > max_bits - 1)
- VIR_WARN ("number in str %d exceeds cpumap's max bits %d", pos, max_bits);
+ VIR_WARN (_("number in str %d exceeds cpumap's max bits %d"), pos, max_bits);
else
(cpumap)[pos / 8] |= (1 << (pos % 8));
num = strtok_r(NULL, ",", &bp);
--
1.7.1.250.g7d1e8
>From 1e2f998851c82487bf915da76de1a652ab6823e6 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 18 May 2010 16:37:23 +0200
Subject: [PATCH 2/3] maint: mark more translatable strings, now manually
* po/POTFILES.in: Add three file names.
Mark translatable strings in the following, manually fixing
bogus uses of VIR_WARN and VIR_WARN0:
* src/esx/esx_vi.c (esxVI_GetVirtualMachineIdentity): Likewise.
* src/esx/esx_vmx.c (esxVMX_AbsolutePathToDatastoreRelatedPath):
(esxVMX_ParseVNC, esxVMX_ParseDisk, esxVMX_FormatVNC): Likewise.
* src/phyp/phyp_driver.c (phypDomainGetInfo): Likewise.
(phypDomainCreateAndStart, phypUUIDTable_ReadFile) Likewise.
(phypUUIDTable_Init, phypUUIDTable_Pull): Likewise.
* src/util/pci.c (pciIterDevices): Likewise.
---
po/POTFILES.in | 7 +++++--
src/esx/esx_vi.c | 4 ++--
src/esx/esx_vmx.c | 16 ++++++++--------
src/phyp/phyp_driver.c | 24 ++++++++++--------------
src/util/pci.c | 5 +++--
5 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 88218bd..3346654 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,4 +1,5 @@
daemon/dispatch.c
+daemon/event.c
daemon/libvirtd.c
daemon/remote.c
daemon/stream.c
@@ -18,6 +19,7 @@ src/cpu/cpu_generic.c
src/cpu/cpu_map.c
src/cpu/cpu_x86.c
src/datatypes.c
+src/driver.c
src/esx/esx_driver.c
src/esx/esx_util.c
src/esx/esx_vi.c
@@ -27,6 +29,7 @@ src/esx/esx_vmx.c
src/interface/netcf_driver.c
src/internal.h
src/libvirt.c
+src/lxc/lxc_conf.c
src/lxc/lxc_container.c
src/lxc/lxc_controller.c
src/lxc/lxc_driver.c
@@ -53,8 +56,8 @@ src/qemu/qemu_monitor_text.c
src/qemu/qemu_security_dac.c
src/remote/remote_driver.c
src/secret/secret_driver.c
-src/security/security_driver.c
src/security/security_apparmor.c
+src/security/security_driver.c
src/security/security_selinux.c
src/security/virt-aa-helper.c
src/storage/storage_backend.c
@@ -89,10 +92,10 @@ src/util/xml.c
src/vbox/vbox_driver.c
src/vbox/vbox_tmpl.c
src/xen/proxy_internal.c
-src/xen/xend_internal.c
src/xen/xen_driver.c
src/xen/xen_hypervisor.c
src/xen/xen_inotify.c
+src/xen/xend_internal.c
src/xen/xm_internal.c
src/xen/xs_internal.c
src/xenapi/xenapi_driver.c
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 2f41c58..d005a47 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -1679,8 +1679,8 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
} else {
memset(uuid, 0, VIR_UUID_BUFLEN);
- VIR_WARN0("Cannot access UUID, because 'configStatus' property "
- "indicates a config problem");
+ VIR_WARN0(_("Cannot access UUID, because 'configStatus' property "
+ "indicates a config problem"));
}
}
diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
index f1c612d..fa5fec9 100644
--- a/src/esx/esx_vmx.c
+++ b/src/esx/esx_vmx.c
@@ -643,8 +643,8 @@ esxVMX_AbsolutePathToDatastoreRelatedPath(esxVI_Context *ctx,
}
if (datastoreName == NULL) {
- VIR_WARN("Could not retrieve datastore name for absolute "
- "path '%s', falling back to preliminary name '%s'",
+ VIR_WARN(_("Could not retrieve datastore name for absolute "
+ "path '%s', falling back to preliminary name '%s'"),
absolutePath, preliminaryDatastoreName);
datastoreName = preliminaryDatastoreName;
@@ -1214,8 +1214,8 @@ esxVMX_ParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def)
}
if (port < 0) {
- VIR_WARN0("VNC is enabled but VMX entry 'RemoteDisplay.vnc.port' "
- "is missing, the VNC port is unknown");
+ VIR_WARN0(_("VNC is enabled but VMX entry 'RemoteDisplay.vnc.port' "
+ "is missing, the VNC port is unknown"));
(*def)->data.vnc.port = 0;
(*def)->data.vnc.autoport = 1;
@@ -1558,8 +1558,8 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
* the default based on the guestOS. The mechanism to
* obtain the default is currently missing
*/
- VIR_WARN0("No explicit SCSI driver specified in VMX config, "
- "cannot represent explicit specified cachemode");
+ VIR_WARN0(_("No explicit SCSI driver specified in VMX config, "
+ "cannot represent explicit specified cachemode"));
}
(*def)->type = VIR_DOMAIN_DISK_TYPE_FILE;
@@ -2473,8 +2473,8 @@ esxVMX_FormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer)
virBufferVSprintf(buffer, "RemoteDisplay.vnc.enabled = \"true\"\n");
if (def->data.vnc.autoport) {
- VIR_WARN0("VNC autoport is enabled, but the automatically assigned "
- "VNC port cannot be read back");
+ VIR_WARN0(_("VNC autoport is enabled, but the automatically assigned "
+ "VNC port cannot be read back"));
} else {
if (def->data.vnc.port < 5900 || def->data.vnc.port > 5964) {
VIR_WARN(_("VNC port %d it out of [5900..5964] range"),
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 0e32a18..c2fb839 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1344,15 +1344,15 @@ phypDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
if ((info->maxMem =
phypGetLparMem(dom->conn, managed_system, dom->id, 0)) == 0)
- VIR_WARN(_("%s"), "Unable to determine domain's max memory.");
+ VIR_WARN0(_("Unable to determine domain's max memory."));
if ((info->memory =
phypGetLparMem(dom->conn, managed_system, dom->id, 1)) == 0)
- VIR_WARN(_("%s"), "Unable to determine domain's memory.");
+ VIR_WARN0(_("Unable to determine domain's memory."));
if ((info->nrVirtCpu =
phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0)
- VIR_WARN(_("%s"), "Unable to determine domain's CPU.");
+ VIR_WARN0(_("Unable to determine domain's CPU."));
return 0;
}
@@ -1416,14 +1416,14 @@ phypDomainCreateAndStart(virConnectPtr conn,
/* checking if this name already exists on this system */
if (phypGetLparID(session, managed_system, def->name, conn) == -1) {
- VIR_WARN(_("%s"), "LPAR name already exists.");
+ VIR_WARN0(_("LPAR name already exists."));
goto err;
}
/* checking if ID or UUID already exists on this system */
for (i = 0; i < uuid_table->nlpars; i++) {
if (lpars[i]->id == def->id || lpars[i]->uuid == def->uuid) {
- VIR_WARN(_("%s"), "LPAR ID or UUID already exists.");
+ VIR_WARN0(_("LPAR ID or UUID already exists."));
goto err;
}
}
@@ -1782,7 +1782,7 @@ phypUUIDTable_ReadFile(virConnectPtr conn)
int id;
if ((fd = open(local_file, O_RDONLY)) == -1) {
- VIR_WARN(_("%s"), "Unable to write information to local file.");
+ VIR_WARN0(_("Unable to write information to local file."));
goto err;
}
@@ -1798,15 +1798,13 @@ phypUUIDTable_ReadFile(virConnectPtr conn)
}
uuid_table->lpars[i]->id = id;
} else {
- VIR_WARN(_("%s"),
- "Unable to read from information to local file.");
+ VIR_WARN0(_("Unable to read from information to local file."));
goto err;
}
rc = read(fd, uuid_table->lpars[i]->uuid, VIR_UUID_BUFLEN);
if (rc != VIR_UUID_BUFLEN) {
- VIR_WARN(_("%s"),
- "Unable to read information to local file.");
+ VIR_WARN0(_("Unable to read information to local file."));
goto err;
}
}
@@ -1909,8 +1907,7 @@ phypUUIDTable_Init(virConnectPtr conn)
uuid_table->lpars[i]->id = ids[i];
if (virUUIDGenerate(uuid_table->lpars[i]->uuid) < 0)
- VIR_WARN(_("%s %d", "Unable to generate UUID for domain"),
- ids[i]);
+ VIR_WARN(_("Unable to generate UUID for domain %d"), ids[i]);
}
} else {
virReportOOMError();
@@ -2083,8 +2080,7 @@ phypUUIDTable_Pull(virConnectPtr conn)
rc = libssh2_channel_read(channel, buffer, amount);
if (rc > 0) {
if (safewrite(fd, buffer, rc) != rc)
- VIR_WARN(_("%s"),
- "Unable to write information to local file.");
+ VIR_WARN0(_("Unable to write information to local file."));
got += rc;
total += rc;
diff --git a/src/util/pci.c b/src/util/pci.c
index 404a4d0..ab0c4ac 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -277,7 +277,7 @@ pciIterDevices(pciIterPredicate predicate,
dir = opendir(PCI_SYSFS "devices");
if (!dir) {
- VIR_WARN0(_("Failed to open " PCI_SYSFS "devices"));
+ VIR_WARN(_("Failed to open %s devices"), PCI_SYSFS);
return -1;
}
@@ -299,7 +299,8 @@ pciIterDevices(pciIterPredicate predicate,
virStrToLong_ui(tmp + 1, &tmp, 16, &slot) < 0 || *tmp != '.' ||
/* function */
virStrToLong_ui(tmp + 1, NULL, 16, &function) < 0) {
- VIR_WARN(_("Unusual entry in " PCI_SYSFS "devices: %s"), entry->d_name);
+ VIR_WARN(_("Unusual entry in %s devices: %s"),
+ PCI_SYSFS, entry->d_name);
continue;
}
--
1.7.1.250.g7d1e8
>From 525e752c3bd078263713aa33355c840777c6485b Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 18 May 2010 16:10:50 +0200
Subject: [PATCH 3/3] maint: add VIR_WARN{,0} to the list of diag-printing functions
* cfg.mk (msg_gen_function): Add VIR_WARN and VIR_WARN0, so
that "make syntax-check" ensures their diagnostics are marked
for translation.
---
cfg.mk | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 96d6953..49300a0 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -358,6 +358,8 @@ msg_gen_function += virXendError
msg_gen_function += xenapiSessionErrorHandler
msg_gen_function += xenUnifiedError
msg_gen_function += xenXMError
+msg_gen_function += VIR_WARN
+msg_gen_function += VIR_WARN0
# Uncomment the following and run "make syntax-check" to see diagnostics
# that are not yet marked for translation, but that need to be rewritten
--
1.7.1.250.g7d1e8
3
5
19 May '10
This is a repost of this previously posted patch. I'd like someone to
ACK it or let me know how to proceed with it. Thanks. Stefan
Below is David Alan's original patch with lots of changes.
In particular, it now parses the following two XML descriptions, one
for 802.1Qbg and 802.1Qbh and stored the data internally. The actual
triggering of the switch setup protocol has not been implemented
here but the relevant code to do that should go into the functions
associatePortProfileId() and disassociatePortProfileId().
<interface type='direct'>
<source dev='static' mode='vepa'/>
<model type='virtio'/>
<vsi type='802.1Qbg'>
<parameters managerid='12' typeid='0x123456' typeidversion='1'
instanceid='fa9b7fff-b0a0-4893-8e0e-beef4ff18f8f'/>
</vsi>
<filterref filter='clean-traffic'/>
</interface>
<interface type='direct'>
<source dev='static' mode='vepa'/>
<model type='virtio'/>
<vsi type='802.1Qbh'>
<parameters profileid='my_profile'/>
</vsi>
</interface>
I'd suggest to use this patch as a base for triggering the setup
protocol with the 802.1Qb{g|h} switch.
Changes from V2 to V3:
- if instance ID UUID is not supplied it will automatically be generated
- adapted schema to make instance ID UUID optional
- added test case
Some of the changes from V1 to V2:
- parser and XML generator have been separated into their own
functions so they can be re-used elsewhere (passthrough case
for example)
- Adapted XML parser and generator support the above shown type
(802.1Qbg, 802.1Qbh).
- Adapted schema to above XML
- Adapted test XML to above XML
- Passing through the VM's UUID which seems to be necessary for
802.1Qbh -- sorry no host UUID
- adding virtual function ID to association function, in case it's
necessary to use (for SR-IOV)
Signed-off-by: Stefan Berger <stefanb(a)us.ibm.com>
>From a945107f047c7cd71f9c1b74fd74c47d8cdc3670 Mon Sep 17 00:00:00 2001
From: David Allan <dallan(a)redhat.com>
Date: Fri, 12 Mar 2010 13:25:04 -0500
Subject: [PATCH 1/1] POC of port profile id support
* Modified schema per DanPB's feedback
* Added test for modified schema
---
docs/schemas/domain.rng | 69 ++++++++++++++
src/conf/domain_conf.c | 155 +++++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 35 +++++++
src/qemu/qemu_conf.c | 17 +--
src/qemu/qemu_conf.h | 5 -
src/qemu/qemu_driver.c | 17 +--
src/util/macvtap.c | 150 ++++++++++++++++++++++++++++---
src/util/macvtap.h | 10 +-
tests/domainschemadata/portprofile.xml | 36 +++++++
9 files changed, 446 insertions(+), 48 deletions(-)
create mode 100644 tests/domainschemadata/portprofile.xml
Index: libvirt-acl/docs/schemas/domain.rng
===================================================================
--- libvirt-acl.orig/docs/schemas/domain.rng
+++ libvirt-acl/docs/schemas/domain.rng
@@ -817,6 +817,9 @@
</optional>
<empty/>
</element>
+ <optional>
+ <ref name="vsiProfile"/>
+ </optional>
<ref name="interface-options"/>
</interleave>
</group>
@@ -902,6 +905,45 @@
</optional>
</interleave>
</define>
+ <define name="vsiProfile">
+ <choice>
+ <group>
+ <element name="vsi">
+ <attribute name="type">
+ <value>802.1Qbg</value>
+ </attribute>
+ <element name="parameters">
+ <attribute name="managerid">
+ <ref name="uint8range"/>
+ </attribute>
+ <attribute name="typeid">
+ <ref name="uint24range"/>
+ </attribute>
+ <attribute name="typeidversion">
+ <ref name="uint8range"/>
+ </attribute>
+ <optional>
+ <attribute name="instanceid">
+ <ref name="UUID"/>
+ </attribute>
+ </optional>
+ </element>
+ </element>
+ </group>
+ <group>
+ <element name="vsi">
+ <attribute name="type">
+ <value>802.1Qbh</value>
+ </attribute>
+ <element name="parameters">
+ <attribute name="profileid">
+ <ref name="vsiProfileID"/>
+ </attribute>
+ </element>
+ </element>
+ </group>
+ </choice>
+ </define>
<!--
An emulator description is just a path to the binary used for the task
-->
@@ -1769,4 +1811,31 @@
<param name="pattern">[a-zA-Z0-9_\.:]+</param>
</data>
</define>
+ <define name="uint8range">
+ <choice>
+ <data type="string">
+ <param name="pattern">0x[0-9a-fA-F]{1,2}</param>
+ </data>
+ <data type="int">
+ <param name="minInclusive">0</param>
+ <param name="maxInclusive">255</param>
+ </data>
+ </choice>
+ </define>
+ <define name="uint24range">
+ <choice>
+ <data type="string">
+ <param name="pattern">0x[0-9a-fA-F]{1,6}</param>
+ </data>
+ <data type="int">
+ <param name="minInclusive">0</param>
+ <param name="maxInclusive">16777215</param>
+ </data>
+ </choice>
+ </define>
+ <define name="vsiProfileID">
+ <data type="string">
+ <param name="maxLength">39</param>
+ </data>
+ </define>
</grammar>
Index: libvirt-acl/src/conf/domain_conf.c
===================================================================
--- libvirt-acl.orig/src/conf/domain_conf.c
+++ libvirt-acl/src/conf/domain_conf.c
@@ -242,6 +242,11 @@ VIR_ENUM_IMPL(virDomainNetdevMacvtap, VI
"private",
"bridge")
+VIR_ENUM_IMPL(virVSI, VIR_VSI_TYPE_LAST,
+ "none",
+ "802.1Qbg",
+ "802.1Qbh")
+
VIR_ENUM_IMPL(virDomainClockOffset, VIR_DOMAIN_CLOCK_OFFSET_LAST,
"utc",
"localtime",
@@ -1807,6 +1812,145 @@ isValidIfname(const char *ifname) {
}
+static void
+virVSIProfileDefParseXML(xmlNodePtr node,
+ virVSIProfileDefPtr vsi)
+{
+ char *vsiType;
+ char *vsiManagerID = NULL;
+ char *vsiTypeID = NULL;
+ char *vsiTypeIDVersion = NULL;
+ char *vsiInstanceID = NULL;
+ char *vsiProfileID = NULL;
+ xmlNodePtr cur = node->children;
+
+ vsiType = virXMLPropString(node, "type");
+ if (!vsiType)
+ return;
+
+ while (cur != NULL) {
+ if (xmlStrEqual(cur->name, BAD_CAST "parameters")) {
+
+ vsiManagerID = virXMLPropString(cur, "managerid");
+ vsiTypeID = virXMLPropString(cur, "typeid");
+ vsiTypeIDVersion = virXMLPropString(cur, "typeidversion");
+ vsiInstanceID = virXMLPropString(cur, "instanceid");
+ vsiProfileID = virXMLPropString(cur, "profileid");
+
+ break;
+ }
+
+ cur = cur->next;
+ }
+
+ vsi->vsiType = VIR_VSI_NONE;
+
+ switch (virVSITypeFromString(vsiType)) {
+
+ case VIR_VSI_8021QBG:
+ if (vsiManagerID != NULL && vsiTypeID != NULL &&
+ vsiTypeIDVersion != NULL) {
+ unsigned int val;
+
+ if ((virStrToLong_ui(vsiManagerID, NULL, 10, &val) &&
+ virStrToLong_ui(vsiManagerID, NULL, 16, &val) ) ||
+ val > 0xff)
+ break;
+
+ vsi->u.vsi8021Qbg.managerID = (uint8_t)val;
+
+ if ((virStrToLong_ui(vsiTypeID, NULL, 10, &val) &&
+ virStrToLong_ui(vsiTypeID, NULL, 16, &val) ) ||
+ val > 0xffffff)
+ break;
+
+ vsi->u.vsi8021Qbg.typeID = (uint32_t)val;
+
+ if ((virStrToLong_ui(vsiTypeIDVersion, NULL, 10, &val) &&
+ virStrToLong_ui(vsiTypeIDVersion, NULL, 16, &val) ) ||
+ val > 0xff)
+ break;
+
+ vsi->u.vsi8021Qbg.typeIDVersion = (uint8_t)val;
+
+ if (vsiInstanceID != NULL) {
+ if (virUUIDParse(vsiInstanceID, vsi->u.vsi8021Qbg.instanceID))
+ break;
+ } else {
+ if (virUUIDGenerate(vsi->u.vsi8021Qbg.instanceID))
+ break;
+ }
+
+ vsi->vsiType = VIR_VSI_8021QBG;
+ }
+ break;
+
+ case VIR_VSI_8021QBH:
+ if (vsiProfileID != NULL) {
+ if (virStrcpyStatic(vsi->u.vsi8021Qbh.profileID,
+ vsiProfileID) != NULL)
+ vsi->vsiType = VIR_VSI_8021QBH;
+ }
+ break;
+
+
+ default:
+ case VIR_VSI_NONE:
+ case VIR_VSI_TYPE_LAST:
+ break;
+ }
+
+ VIR_FREE(vsiManagerID);
+ VIR_FREE(vsiTypeID);
+ VIR_FREE(vsiTypeIDVersion);
+ VIR_FREE(vsiInstanceID);
+ VIR_FREE(vsiProfileID);
+ VIR_FREE(vsiType);
+}
+
+
+static void
+virVSIProfileFormat(virBufferPtr buf, virVSIProfileDefPtr vsi,
+ const char *indent)
+{
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+ if (vsi->vsiType == VIR_VSI_NONE)
+ return;
+
+ virBufferVSprintf(buf, "%s<vsi type='%s'>\n",
+ indent, virVSITypeToString(vsi->vsiType));
+
+ switch (vsi->vsiType) {
+ case VIR_VSI_NONE:
+ case VIR_VSI_TYPE_LAST:
+ break;
+
+ case VIR_VSI_8021QBG:
+ virUUIDFormat(vsi->u.vsi8021Qbg.instanceID,
+ uuidstr);
+ virBufferVSprintf(buf,
+ "%s <parameters managerid='%d' typeid='%d' "
+ "typeidversion='%d' instanceid='%s'/>\n",
+ indent,
+ vsi->u.vsi8021Qbg.managerID,
+ vsi->u.vsi8021Qbg.typeID,
+ vsi->u.vsi8021Qbg.typeIDVersion,
+ uuidstr);
+ break;
+
+ case VIR_VSI_8021QBH:
+ virBufferVSprintf(buf,
+ "%s <parameters profileid='%s'/>\n",
+ indent,
+ vsi->u.vsi8021Qbh.profileID);
+ break;
+ }
+
+ virBufferVSprintf(buf, "%s</vsi>\n", indent);
+}
+
+
/* Parse the XML definition for a network interface
* @param node XML nodeset to parse for net definition
* @return 0 on success, -1 on failure
@@ -1832,6 +1976,8 @@ virDomainNetDefParseXML(virCapsPtr caps,
char *devaddr = NULL;
char *mode = NULL;
virNWFilterHashTablePtr filterparams = NULL;
+ virVSIProfileDef vsi;
+ bool vsiParsed = false;
if (VIR_ALLOC(def) < 0) {
virReportOOMError();
@@ -1873,6 +2019,11 @@ virDomainNetDefParseXML(virCapsPtr caps,
xmlStrEqual(cur->name, BAD_CAST "source")) {
dev = virXMLPropString(cur, "dev");
mode = virXMLPropString(cur, "mode");
+ } else if ((vsiParsed == false) &&
+ (def->type == VIR_DOMAIN_NET_TYPE_DIRECT) &&
+ xmlStrEqual(cur->name, BAD_CAST "vsi")) {
+ virVSIProfileDefParseXML(cur, &vsi);
+ vsiParsed = true;
} else if ((network == NULL) &&
((def->type == VIR_DOMAIN_NET_TYPE_SERVER) ||
(def->type == VIR_DOMAIN_NET_TYPE_CLIENT) ||
@@ -2049,6 +2200,8 @@ virDomainNetDefParseXML(virCapsPtr caps,
} else
def->data.direct.mode = VIR_DOMAIN_NETDEV_MACVTAP_MODE_VEPA;
+ def->data.direct.vsiProfile = vsi;
+
def->data.direct.linkdev = dev;
dev = NULL;
@@ -5141,6 +5294,8 @@ virDomainNetDefFormat(virBufferPtr buf,
virBufferVSprintf(buf, " mode='%s'",
virDomainNetdevMacvtapTypeToString(def->data.direct.mode));
virBufferAddLit(buf, "/>\n");
+ virVSIProfileFormat(buf, &def->data.direct.vsiProfile,
+ " ");
break;
case VIR_DOMAIN_NET_TYPE_USER:
Index: libvirt-acl/src/conf/domain_conf.h
===================================================================
--- libvirt-acl.orig/src/conf/domain_conf.h
+++ libvirt-acl/src/conf/domain_conf.h
@@ -259,6 +259,39 @@ enum virDomainNetdevMacvtapType {
};
+enum virVSIType {
+ VIR_VSI_NONE,
+ VIR_VSI_8021QBG,
+ VIR_VSI_8021QBH,
+
+ VIR_VSI_TYPE_LAST,
+};
+
+# ifdef IFLA_VF_PORT_PROFILE_MAX
+# define LIBVIRT_IFLA_VF_PORT_PROFILE_MAX IFLA_VF_PORT_PROFILE_MAX
+# else
+# define LIBVIRT_IFLA_VF_PORT_PROFILE_MAX 40
+# endif
+
+/* profile data for macvtap (VEPA) */
+typedef struct _virVSIProfileDef virVSIProfileDef;
+typedef virVSIProfileDef *virVSIProfileDefPtr;
+struct _virVSIProfileDef {
+ enum virVSIType vsiType;
+ union {
+ struct {
+ uint8_t managerID;
+ uint32_t typeID; // 24 bit valid
+ uint8_t typeIDVersion;
+ unsigned char instanceID[VIR_UUID_BUFLEN];
+ } vsi8021Qbg;
+ struct {
+ char profileID[LIBVIRT_IFLA_VF_PORT_PROFILE_MAX];
+ } vsi8021Qbh;
+ } u;
+};
+
+
/* Stores the virtual network interface configuration */
typedef struct _virDomainNetDef virDomainNetDef;
typedef virDomainNetDef *virDomainNetDefPtr;
@@ -290,6 +323,7 @@ struct _virDomainNetDef {
struct {
char *linkdev;
int mode;
+ virVSIProfileDef vsiProfile;
} direct;
} data;
char *ifname;
@@ -1089,6 +1123,7 @@ VIR_ENUM_DECL(virDomainSeclabel)
VIR_ENUM_DECL(virDomainClockOffset)
VIR_ENUM_DECL(virDomainNetdevMacvtap)
+VIR_ENUM_DECL(virVSI)
VIR_ENUM_DECL(virDomainTimerName)
VIR_ENUM_DECL(virDomainTimerTrack)
Index: libvirt-acl/src/util/macvtap.c
===================================================================
--- libvirt-acl.orig/src/util/macvtap.c
+++ libvirt-acl/src/util/macvtap.c
@@ -43,6 +43,7 @@
# include "util.h"
# include "memory.h"
+# include "logging.h"
# include "macvtap.h"
# include "interface.h"
# include "conf/domain_conf.h"
@@ -570,36 +571,127 @@ configMacvtapTap(int tapfd, int vnet_hdr
/**
+ * associatePortProfile
+ *
+ * @linkdev: the link dev in case of macvtap
+ * @mac: the MAC address of the interface
+ * @mode: The vepa mode (private, bridge or vepa)
+ * @vsi: pointer to the object holding port profile parameters
+ * @vf: virtual function number, -1 if to be ignored
+ * @vmuuid : the UUID of the virtual machine
+ *
+ * Associate a port on a swtich with a profile. This function
+ * may notify a kernel driver or an external daemon to run
+ * the setup protocol. If profile parameters were not supplied
+ * by the user, then this function returns without doing
+ * anything.
+ *
+ * Returns 0 in case of success, != 0 otherwise with error
+ * having been reported.
+ */
+static int
+associatePortProfileId(const char *linkdev,
+ const unsigned char *mac,
+ int mode,
+ const virVSIProfileDefPtr vsi,
+ int vf,
+ const unsigned char *vmuuid)
+{
+ int rc = 0;
+ VIR_DEBUG("Associating port profile '%p' on link device '%s' mode %d ",
+ vsi, linkdev, mode);
+ (void)mac;
+ (void)vf;
+ (void)vmuuid;
+
+ switch (vsi->vsiType) {
+ case VIR_VSI_NONE:
+ case VIR_VSI_TYPE_LAST:
+ break;
+
+ case VIR_VSI_8021QBG:
+ rc = -1;
+ break;
+
+ case VIR_VSI_8021QBH:
+ rc = -1;
+ break;
+ }
+
+ return rc;
+}
+
+
+/**
+ * disassociatePortProfile
+ *
+ * @linkdev: The link dev in case of a macvtap device
+ * @mac: The MAC address of the interface
+ * @vsi: point to object holding port profile parameters
+ *
+ * Returns 0 in case of success, != 0 otherwise with error
+ * having been reported.
+ */
+static int
+disassociatePortProfileId(const char *linkdev,
+ const unsigned char *mac,
+ const virVSIProfileDefPtr vsi)
+{
+ int rc = 0;
+ VIR_DEBUG("Disassociating port profile id '%p' on link device '%s' ",
+ vsi, linkdev);
+ (void)mac;
+
+ switch (vsi->vsiType) {
+ case VIR_VSI_NONE:
+ case VIR_VSI_TYPE_LAST:
+ break;
+
+ case VIR_VSI_8021QBG:
+ rc = -1;
+ break;
+
+ case VIR_VSI_8021QBH:
+ rc = -1;
+ break;
+ }
+
+ return rc;
+}
+
+
+/**
* openMacvtapTap:
* Create an instance of a macvtap device and open its tap character
* device.
* @tgifname: Interface name that the macvtap is supposed to have. May
* be NULL if this function is supposed to choose a name
- * @macaddress: The MAC address for the macvtap device
- * @linkdev: The interface name of the NIC to connect to the external bridge
- * @mode_str: String describing the mode. Valid are 'bridge', 'vepa' and
- * 'private'.
+ * @net: pointer to the virDomainNetDef object describing the direct
+ * type if an interface
* @res_ifname: Pointer to a string pointer where the actual name of the
* interface will be stored into if everything succeeded. It is up
* to the caller to free the string.
+ * @vnet_hdr: Whether to enable IFF_VNET_HDR on the interface
+ * @vmuuid: The (raw) UUID of the VM
*
* Returns file descriptor of the tap device in case of success,
* negative value otherwise with error reported.
*
+ * Open a macvtap device and trigger the switch setup protocol
+ * if valid port profile parameters were provided.
*/
int
openMacvtapTap(const char *tgifname,
- const unsigned char *macaddress,
- const char *linkdev,
- int mode,
+ virDomainNetDefPtr net,
char **res_ifname,
- int vnet_hdr)
+ int vnet_hdr,
+ const unsigned char *vmuuid)
{
const char *type = "macvtap";
int c, rc;
char ifname[IFNAMSIZ];
int retries, do_retry = 0;
- uint32_t macvtapMode = macvtapModeFromInt(mode);
+ uint32_t macvtapMode = macvtapModeFromInt(net->data.direct.mode);
const char *cr_ifname;
int ifindex;
@@ -616,7 +708,7 @@ openMacvtapTap(const char *tgifname,
return -1;
}
cr_ifname = tgifname;
- rc = link_add(type, macaddress, 6, tgifname, linkdev,
+ rc = link_add(type, net->mac, 6, tgifname, net->data.direct.linkdev,
macvtapMode, &do_retry);
if (rc)
return -1;
@@ -626,7 +718,8 @@ create_name:
for (c = 0; c < 8192; c++) {
snprintf(ifname, sizeof(ifname), MACVTAP_NAME_PATTERN, c);
if (ifaceGetIndex(false, ifname, &ifindex) == ENODEV) {
- rc = link_add(type, macaddress, 6, ifname, linkdev,
+ rc = link_add(type, net->mac, 6, ifname,
+ net->data.direct.linkdev,
macvtapMode, &do_retry);
if (rc == 0)
break;
@@ -639,6 +732,15 @@ create_name:
cr_ifname = ifname;
}
+ rc = associatePortProfileId(net->data.direct.linkdev,
+ net->mac,
+ net->data.direct.mode,
+ &net->data.direct.vsiProfile,
+ -1,
+ vmuuid);
+ if (rc != 0)
+ goto link_del_exit;
+
rc = ifaceUp(cr_ifname);
if (rc != 0) {
virReportSystemError(errno,
@@ -647,7 +749,7 @@ create_name:
"MAC address"),
cr_ifname);
rc = -1;
- goto link_del_exit;
+ goto disassociate_exit;
}
rc = openTap(cr_ifname, 10);
@@ -656,14 +758,19 @@ create_name:
if (configMacvtapTap(rc, vnet_hdr) < 0) {
close(rc);
rc = -1;
- goto link_del_exit;
+ goto disassociate_exit;
}
*res_ifname = strdup(cr_ifname);
} else
- goto link_del_exit;
+ goto disassociate_exit;
return rc;
+disassociate_exit:
+ disassociatePortProfileId(net->data.direct.linkdev,
+ net->mac,
+ &net->data.direct.vsiProfile);
+
link_del_exit:
link_del(cr_ifname);
@@ -673,14 +780,21 @@ link_del_exit:
/**
* delMacvtap:
- * @ifname : The name of the macvtap interface
+ * @net: pointer to virDomainNetDef object
*
- * Delete an interface given its name.
+ * Delete an interface given its name. Disassociate
+ * it with the switch if port profile parameters
+ * were provided.
*/
void
-delMacvtap(const char *ifname)
+delMacvtap(virDomainNetDefPtr net)
{
- link_del(ifname);
+ if (net->ifname) {
+ disassociatePortProfileId(net->data.direct.linkdev,
+ net->mac,
+ &net->data.direct.vsiProfile);
+ link_del(net->ifname);
+ }
}
#endif
Index: libvirt-acl/src/util/macvtap.h
===================================================================
--- libvirt-acl.orig/src/util/macvtap.h
+++ libvirt-acl/src/util/macvtap.h
@@ -27,15 +27,15 @@
# if defined(WITH_MACVTAP)
# include "internal.h"
+# include "conf/domain_conf.h"
int openMacvtapTap(const char *ifname,
- const unsigned char *macaddress,
- const char *linkdev,
- int mode,
+ virDomainNetDefPtr net,
char **res_ifname,
- int vnet_hdr);
+ int vnet_hdr,
+ const unsigned char *vmuuid);
-void delMacvtap(const char *ifname);
+void delMacvtap(virDomainNetDefPtr net);
# endif /* WITH_MACVTAP */
Index: libvirt-acl/tests/domainschemadata/portprofile.xml
===================================================================
--- /dev/null
+++ libvirt-acl/tests/domainschemadata/portprofile.xml
@@ -0,0 +1,36 @@
+<domain type='lxc'>
+ <name>portprofile</name>
+ <uuid>00000000-0000-0000-0000-000000000000</uuid>
+ <memory>1048576</memory>
+ <os>
+ <type>exe</type>
+ <init>/sh</init>
+ </os>
+ <devices>
+ <interface type='direct'>
+ <source dev='eth0' mode='vepa'/>
+ <vsi type='802.1Qbg'>
+ <parameters managerid='12' typeid='1193046' typeidversion='1'
+ instanceid='fa9b7fff-b0a0-4893-8e0e-beef4ff18f8f'/>
+ </vsi>
+ </interface>
+ <interface type='direct'>
+ <source dev='eth0' mode='vepa'/>
+ <vsi type='802.1Qbg'>
+ <parameters managerid='12' typeid='1193046' typeidversion='1'/>
+ </vsi>
+ </interface>
+ <interface type='direct'>
+ <source dev='eth0' mode='vepa'/>
+ <vsi type='802.1Qbh'>
+ <parameters profileid='my_profile'/>
+ </vsi>
+ </interface>
+ <interface type='direct'>
+ <source dev='eth0' mode='vepa'/>
+ </interface>
+ <interface type='direct'>
+ <source dev='eth0' mode='vepa'/>
+ </interface>
+ </devices>
+</domain>
Index: libvirt-acl/src/qemu/qemu_conf.h
===================================================================
--- libvirt-acl.orig/src/qemu/qemu_conf.h
+++ libvirt-acl/src/qemu/qemu_conf.h
@@ -271,9 +271,8 @@ qemudOpenVhostNet(virDomainNetDefPtr net
int qemudPhysIfaceConnect(virConnectPtr conn,
struct qemud_driver *driver,
virDomainNetDefPtr net,
- char *linkdev,
- int brmode,
- unsigned long long qemuCmdFlags);
+ unsigned long long qemuCmdFlags,
+ const unsigned char *vmuuid);
int qemudProbeMachineTypes (const char *binary,
virCapsGuestMachinePtr **machines,
Index: libvirt-acl/src/qemu/qemu_driver.c
===================================================================
--- libvirt-acl.orig/src/qemu/qemu_driver.c
+++ libvirt-acl/src/qemu/qemu_driver.c
@@ -3585,10 +3585,8 @@ static void qemudShutdownVMDaemon(struct
def = vm->def;
for (i = 0; i < def->nnets; i++) {
virDomainNetDefPtr net = def->nets[i];
- if (net->type == VIR_DOMAIN_NET_TYPE_DIRECT) {
- if (net->ifname)
- delMacvtap(net->ifname);
- }
+ if (net->type == VIR_DOMAIN_NET_TYPE_DIRECT)
+ delMacvtap(net);
}
#endif
@@ -7175,9 +7173,8 @@ static int qemudDomainAttachNetDevice(vi
}
if ((tapfd = qemudPhysIfaceConnect(conn, driver, net,
- net->data.direct.linkdev,
- net->data.direct.mode,
- qemuCmdFlags)) < 0)
+ qemuCmdFlags,
+ vm->def->uuid)) < 0)
return -1;
}
@@ -8146,10 +8143,8 @@ qemudDomainDetachNetDevice(struct qemud_
virNWFilterTearNWFilter(detach);
#if WITH_MACVTAP
- if (detach->type == VIR_DOMAIN_NET_TYPE_DIRECT) {
- if (detach->ifname)
- delMacvtap(detach->ifname);
- }
+ if (detach->type == VIR_DOMAIN_NET_TYPE_DIRECT)
+ delMacvtap(detach);
#endif
if ((driver->macFilter) && (detach->ifname != NULL)) {
Index: libvirt-acl/src/qemu/qemu_conf.c
===================================================================
--- libvirt-acl.orig/src/qemu/qemu_conf.c
+++ libvirt-acl/src/qemu/qemu_conf.c
@@ -1465,9 +1465,8 @@ int
qemudPhysIfaceConnect(virConnectPtr conn,
struct qemud_driver *driver,
virDomainNetDefPtr net,
- char *linkdev,
- int brmode,
- unsigned long long qemuCmdFlags)
+ unsigned long long qemuCmdFlags,
+ const unsigned char *vmuuid)
{
int rc;
#if WITH_MACVTAP
@@ -1479,8 +1478,7 @@ qemudPhysIfaceConnect(virConnectPtr conn
net->model && STREQ(net->model, "virtio"))
vnet_hdr = 1;
- rc = openMacvtapTap(net->ifname, net->mac, linkdev, brmode,
- &res_ifname, vnet_hdr);
+ rc = openMacvtapTap(net->ifname, net, &res_ifname, vnet_hdr, vmuuid);
if (rc >= 0) {
VIR_FREE(net->ifname);
net->ifname = res_ifname;
@@ -1500,15 +1498,13 @@ qemudPhysIfaceConnect(virConnectPtr conn
if (err) {
close(rc);
rc = -1;
- delMacvtap(net->ifname);
+ delMacvtap(net);
}
}
}
#else
(void)conn;
(void)net;
- (void)linkdev;
- (void)brmode;
(void)qemuCmdFlags;
(void)driver;
qemuReportError(VIR_ERR_INTERNAL_ERROR,
@@ -4130,9 +4126,8 @@ int qemudBuildCommandLine(virConnectPtr
goto no_memory;
} else if (net->type == VIR_DOMAIN_NET_TYPE_DIRECT) {
int tapfd = qemudPhysIfaceConnect(conn, driver, net,
- net->data.direct.linkdev,
- net->data.direct.mode,
- qemuCmdFlags);
+ qemuCmdFlags,
+ def->uuid);
if (tapfd < 0)
goto error;
3
3
[libvirt] [PATCH] correct typo: s/VIR_MIGRATE_TUNNELLED/VIR_MIGRATE_TUNNELED/, ...
by Jim Meyering 19 May '10
by Jim Meyering 19 May '10
19 May '10
I noticed a typo in a public interface.
IMHO it's well worth fixing, so propose this:
(imagine someone searching for all occurrences of "tunneled"
with the proper spelling. They would miss this symbol.)
>From b9a1ea6c9e3d4e5150c39868b430f184c10b2660 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 18 May 2010 18:28:17 +0200
Subject: [PATCH] correct typo: s/VIR_MIGRATE_TUNNELLED/VIR_MIGRATE_TUNNELED/, ...
in public interface, but retain the original name for compatibility
Correct all uses.
* include/libvirt/libvirt.h.in [enum virDomainMigrateFlags]
(VIR_MIGRATE_TUNNELED): Rename from spelling-error VIR_MIGRATE_TUNNELLED.
(VIR_MIGRATE_TUNNELLED): Define, to map misspelled name to the new name.
* src/libvirt.c (virDomainMigrate): Use correct spelling.
* src/qemu/qemu_driver.c: Likewise.
* tools/virsh.c (cmdMigrate): Likewise.
---
include/libvirt/libvirt.h.in | 7 +++++--
src/libvirt.c | 10 +++++-----
src/qemu/qemu_driver.c | 10 +++++-----
tools/virsh.c | 2 +-
4 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 838028d..6e8e52e 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -4,7 +4,7 @@
* Description: Provides the interfaces of the libvirt library to handle
* virtualized domains
*
- * Copy: Copyright (C) 2005,2006 Red Hat, Inc.
+ * Copy: Copyright (C) 2005,2006,2010 Red Hat, Inc.
*
* See COPYING.LIB for the License of this software
*
@@ -407,7 +407,7 @@ typedef enum {
typedef enum {
VIR_MIGRATE_LIVE = (1 << 0), /* live migration */
VIR_MIGRATE_PEER2PEER = (1 << 1), /* direct source -> dest host control channel */
- VIR_MIGRATE_TUNNELLED = (1 << 2), /* tunnel migration data over libvirtd connection */
+ VIR_MIGRATE_TUNNELED = (1 << 2), /* tunnel migration data over libvirtd connection */
VIR_MIGRATE_PERSIST_DEST = (1 << 3), /* persist the VM on the destination */
VIR_MIGRATE_UNDEFINE_SOURCE = (1 << 4), /* undefine the VM on the source */
VIR_MIGRATE_PAUSED = (1 << 5), /* pause on remote side */
@@ -417,6 +417,9 @@ typedef enum {
} virDomainMigrateFlags;
+/* Legacy typo. */
+#define VIR_MIGRATE_TUNNELLED VIR_MIGRATE_TUNNELED
+
/* Domain migration. */
virDomainPtr virDomainMigrate (virDomainPtr domain, virConnectPtr dconn,
unsigned long flags, const char *dname,
diff --git a/src/libvirt.c b/src/libvirt.c
index eb05337..c10db19 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -3421,14 +3421,14 @@ virDomainMigrateDirect (virDomainPtr domain,
* Flags may be one of more of the following:
* VIR_MIGRATE_LIVE Do not pause the VM during migration
* VIR_MIGRATE_PEER2PEER Direct connection between source & destination hosts
- * VIR_MIGRATE_TUNNELLED Tunnel migration data over the libvirt RPC channel
+ * VIR_MIGRATE_TUNNELED Tunnel migration data over the libvirt RPC channel
* VIR_MIGRATE_PERSIST_DEST If the migration is successful, persist the domain
* on the destination host.
* VIR_MIGRATE_UNDEFINE_SOURCE If the migration is successful, undefine the
* domain on the source host.
* VIR_MIGRATE_PAUSED Leave the domain suspended on the remote side.
*
- * VIR_MIGRATE_TUNNELLED requires that VIR_MIGRATE_PEER2PEER be set.
+ * VIR_MIGRATE_TUNNELED requires that VIR_MIGRATE_PEER2PEER be set.
* Applications using the VIR_MIGRATE_PEER2PEER flag will probably
* prefer to invoke virDomainMigrateToURI, avoiding the need to
* open connection to the destination host themselves.
@@ -3530,7 +3530,7 @@ virDomainMigrate (virDomainPtr domain,
goto error;
}
} else {
- if (flags & VIR_MIGRATE_TUNNELLED) {
+ if (flags & VIR_MIGRATE_TUNNELED) {
virLibConnError(domain->conn, VIR_ERR_OPERATION_INVALID,
_("cannot perform tunnelled migration without using peer2peer flag"));
goto error;
@@ -3579,7 +3579,7 @@ error:
* Flags may be one of more of the following:
* VIR_MIGRATE_LIVE Do not pause the VM during migration
* VIR_MIGRATE_PEER2PEER Direct connection between source & destination hosts
- * VIR_MIGRATE_TUNNELLED Tunnel migration data over the libvirt RPC channel
+ * VIR_MIGRATE_TUNNELED Tunnel migration data over the libvirt RPC channel
* VIR_MIGRATE_PERSIST_DEST If the migration is successful, persist the domain
* on the destination host.
* VIR_MIGRATE_UNDEFINE_SOURCE If the migration is successful, undefine the
@@ -3598,7 +3598,7 @@ error:
* must be a valid libvirt connection URI, by which the source
* libvirt driver can connect to the destination libvirt.
*
- * VIR_MIGRATE_TUNNELLED requires that VIR_MIGRATE_PEER2PEER be set.
+ * VIR_MIGRATE_TUNNELED requires that VIR_MIGRATE_PEER2PEER be set.
*
* If a hypervisor supports renaming domains during migration,
* the dname parameter specifies the new name for the domain.
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 609fabe..246ad9e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -9880,7 +9880,7 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn,
"%s", _("no domain XML passed"));
goto cleanup;
}
- if (!(flags & VIR_MIGRATE_TUNNELLED)) {
+ if (!(flags & VIR_MIGRATE_TUNNELED)) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("PrepareTunnel called but no TUNNELLED flag set"));
goto cleanup;
@@ -10038,9 +10038,9 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
*uri_out = NULL;
qemuDriverLock(driver);
- if (flags & VIR_MIGRATE_TUNNELLED) {
+ if (flags & VIR_MIGRATE_TUNNELED) {
/* this is a logical error; we never should have gotten here with
- * VIR_MIGRATE_TUNNELLED set
+ * VIR_MIGRATE_TUNNELED set
*/
qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Tunnelled migration requested but invalid RPC method called"));
@@ -10604,7 +10604,7 @@ static int doPeer2PeerMigrate(virDomainPtr dom,
goto cleanup;
}
- if (flags & VIR_MIGRATE_TUNNELLED)
+ if (flags & VIR_MIGRATE_TUNNELED)
ret = doTunnelMigrate(dom, driver, dconn, vm, dom_xml, uri, flags, dname, resource);
else
ret = doNonTunnelMigrate(dom, driver, dconn, vm, dom_xml, uri, flags, dname, resource);
@@ -10665,7 +10665,7 @@ qemudDomainMigratePerform (virDomainPtr dom,
goto endjob;
}
- if ((flags & (VIR_MIGRATE_TUNNELLED | VIR_MIGRATE_PEER2PEER))) {
+ if ((flags & (VIR_MIGRATE_TUNNELED | VIR_MIGRATE_PEER2PEER))) {
if (doPeer2PeerMigrate(dom, driver, vm, uri, flags, dname, resource) < 0)
/* doPeer2PeerMigrate already set the error, so just get out */
goto endjob;
diff --git a/tools/virsh.c b/tools/virsh.c
index 4930ad7..9d9cf5d 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -2898,7 +2898,7 @@ cmdMigrate (vshControl *ctl, const vshCmd *cmd)
if (vshCommandOptBool (cmd, "p2p"))
flags |= VIR_MIGRATE_PEER2PEER;
if (vshCommandOptBool (cmd, "tunnelled"))
- flags |= VIR_MIGRATE_TUNNELLED;
+ flags |= VIR_MIGRATE_TUNNELED;
if (vshCommandOptBool (cmd, "persistent"))
flags |= VIR_MIGRATE_PERSIST_DEST;
--
1.7.1.250.g7d1e8
3
4
I was wondering after watching this mailing list fro the last few
weeks if you guys have maybe thought about using something like
reviewboard. We have been using it for our team for the past several
months and have really liked it.
I imagine it would cut down on the volume of traffic and make giving
inline comments easier. It also tests to make sure the patch still
applies when you go to review it.
Here is a link to the instance that we use for our project:
http://reviews.mono-a11y.org/dashboard/
Cheers,
Stephen
1
0
[libvirt] [PATCH] Fix NULL dereference in remoteDomainMigratePrepare2
by jdenemarï¼ redhat.com 19 May '10
by jdenemarï¼ redhat.com 19 May '10
19 May '10
From: Jiri Denemark <jdenemar(a)redhat.com>
---
src/remote/remote_driver.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 990bfce..c62e3d6 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2849,8 +2849,12 @@ remoteDomainMigratePrepare2 (virConnectPtr dconn,
goto done;
if (ret.cookie.cookie_len > 0) {
- *cookie = ret.cookie.cookie_val; /* Caller frees. */
- *cookielen = ret.cookie.cookie_len;
+ if (cookie && cookielen) {
+ *cookie = ret.cookie.cookie_val; /* Caller frees. */
+ *cookielen = ret.cookie.cookie_len;
+ } else {
+ VIR_FREE(ret.cookie.cookie_val);
+ }
}
if (ret.uri_out)
*uri_out = *ret.uri_out; /* Caller frees. */
--
1.7.1
4
6
19 May '10
---
src/cpu/cpu_map.xml | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index 30c28d7..084b879 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -126,6 +126,12 @@
<feature name='dca'> <!-- CPUID_EXT_DCA -->
<cpuid function='0x00000001' ecx='0x00040000'/>
</feature>
+ <feature name='sse4.1'> <!-- CPUID_EXT_SSE41 -->
+ <cpuid function='0x00000001' ecx='0x00080000'/>
+ </feature>
+ <feature name='sse4.2'> <!-- CPUID_EXT_SSE42 -->
+ <cpuid function='0x00000001' ecx='0x00100000'/>
+ </feature>
<feature name='x2apic'> <!-- CPUID_EXT_X2APIC -->
<cpuid function='0x00000001' ecx='0x00200000'/>
</feature>
--
1.7.1
2
2
I've pushed these:
ebiptablesWriteToTempFile: don't close a negative file descriptor
virDomainNetDefParseXML: avoid leak upon multiple "filterref"
linuxNodeInfoCPUPopulate: avoid used-uninitialized via a test
virNWFilterDefParseXML: avoid leak on error paths
qemuMonitorTextMigrate: avoid leak on OOM-error path
tests: do not ignore virInitialize failure
python: don't ignore virInitialize failure in module initialization
qemudDomainRestore: handle a case of virDomainSaveStatus failure
ebtablesAddRemoveRule, iptablesAddRemoveRule: don't skip va_end
do not ignore qemuMonitorAddDrive failure; make uses identical
1
0
[libvirt] [PATCH] virDomainNetDefParseXML: avoid leak upon multiple "filterref"
by Jim Meyering 19 May '10
by Jim Meyering 19 May '10
19 May '10
The offending code below appears in this loop:
virNWFilterHashTablePtr filterparams = NULL;
...
cur = node->children;
while (cur != NULL) {
...
}
so the first assignment works fine, but second and subsequent
ones leak the buffer returned by each preceding
virNWFilterParseParamAttributes call.
>From 8659fb1ae879befe360e1ec7b8b62434c22698cd Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 18 May 2010 10:19:30 +0200
Subject: [PATCH] virDomainNetDefParseXML: avoid leak upon multiple "filterref"
* src/conf/domain_conf.c (virDomainNetDefParseXML): Don't leak
memory when parsing two or more "filterref" elements.
---
src/conf/domain_conf.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3e45f79..0c717f2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1905,6 +1905,7 @@ virDomainNetDefParseXML(virCapsPtr caps,
model = virXMLPropString(cur, "type");
} else if (xmlStrEqual (cur->name, BAD_CAST "filterref")) {
filter = virXMLPropString(cur, "filter");
+ free(filterparams);
filterparams = virNWFilterParseParamAttributes(cur);
} else if ((flags & VIR_DOMAIN_XML_INTERNAL_STATUS) &&
xmlStrEqual(cur->name, BAD_CAST "state")) {
--
1.7.1.250.g7d1e8
3
3
Simple...
>From f5ee09ed08473478b3ea3135d51125fbf687e402 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 18 May 2010 12:32:39 +0200
Subject: [PATCH] tests: do not ignore virInitialize failure
* tests/nodeinfotest.c (mymain): Do not ignore virInitialize failure.
Most other callers of virInitialize test for failure.
---
tests/nodeinfotest.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c
index ff056b9..d3c500d 100644
--- a/tests/nodeinfotest.c
+++ b/tests/nodeinfotest.c
@@ -106,7 +106,8 @@ mymain(int argc, char **argv)
return(EXIT_FAILURE);
}
- virInitialize();
+ if (virInitialize() < 0)
+ return EXIT_FAILURE;
for (i = 0 ; i < ARRAY_CARDINALITY(nodeData); i++)
if (virtTestRun(nodeData[i], 1, linuxTestNodeInfo, nodeData[i]) != 0)
--
1.7.1.250.g7d1e8
3
5
[libvirt] [PATCH] ebtablesAddRemoveRule, iptablesAddRemoveRule: don't skip va_end
by Jim Meyering 19 May '10
by Jim Meyering 19 May '10
19 May '10
Coverity spotted two missing uses of va_end:
>From 4baa4228a74f640fe789914bd034e4c5b805cdfb Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 18 May 2010 14:42:33 +0200
Subject: [PATCH] ebtablesAddRemoveRule, iptablesAddRemoveRule: don't skip va_end
* src/util/ebtables.c (ebtablesAddRemoveRule): Don't skip
va_end(args) on an error path.
* src/util/iptables.c (iptablesAddRemoveRule): Identical change.
---
src/util/ebtables.c | 7 +++++--
src/util/iptables.c | 7 +++++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/util/ebtables.c b/src/util/ebtables.c
index e2b9608..f707756 100644
--- a/src/util/ebtables.c
+++ b/src/util/ebtables.c
@@ -207,15 +207,18 @@ ebtablesAddRemoveRule(ebtRules *rules, int action, const char *arg, ...)
if (!(argv[n++] = strdup(arg)))
goto error;
va_start(args, arg);
- while ((s = va_arg(args, const char *)))
- if (!(argv[n++] = strdup(s)))
+ while ((s = va_arg(args, const char *))) {
+ if (!(argv[n++] = strdup(s))) {
+ va_end(args);
goto error;
+ }
+ }
va_end(args);
if (!(rule = virArgvToString(&argv[command_idx])))
goto error;
diff --git a/src/util/iptables.c b/src/util/iptables.c
index 4f95a02..d06b857 100644
--- a/src/util/iptables.c
+++ b/src/util/iptables.c
@@ -134,15 +134,18 @@ iptablesAddRemoveRule(iptRules *rules, int action, const char *arg, ...)
if (!(argv[n++] = strdup(arg)))
goto error;
va_start(args, arg);
- while ((s = va_arg(args, const char *)))
- if (!(argv[n++] = strdup(s)))
+ while ((s = va_arg(args, const char *))) {
+ if (!(argv[n++] = strdup(s))) {
+ va_end(args);
goto error;
+ }
+ }
va_end(args);
if (virRun(argv, NULL) < 0) {
retval = errno;
goto error;
--
1.7.1.250.g7d1e8
2
1