[libvirt] [libvirt-glib 1/2] Follow glib conventions for SimpleAsyncResult source tag
by Christophe Fergeau
g_simple_async_result_is_valid() API documentation says that the
source tag field for SimpleAsyncResult objects "by convention, is a
pointer to the _async function corresponding to the _finish function from
which this function is called"
The stream functions were already following this convention, but
other places were using the sync function name as the source tag.
This commit uses the async function name everywhere.
---
libvirt-gobject/libvirt-gobject-connection.c | 12 ++++++------
libvirt-gobject/libvirt-gobject-domain.c | 4 ++--
libvirt-gobject/libvirt-gobject-storage-pool.c | 12 ++++++------
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
index 483533d..70d1adc 100644
--- a/libvirt-gobject/libvirt-gobject-connection.c
+++ b/libvirt-gobject/libvirt-gobject-connection.c
@@ -478,7 +478,7 @@ void gvir_connection_open_async(GVirConnection *conn,
res = g_simple_async_result_new(G_OBJECT(conn),
callback,
user_data,
- gvir_connection_open);
+ gvir_connection_open_async);
g_simple_async_result_run_in_thread(res,
gvir_connection_open_helper,
G_PRIORITY_DEFAULT,
@@ -501,7 +501,7 @@ gboolean gvir_connection_open_finish(GVirConnection *conn,
if (G_IS_SIMPLE_ASYNC_RESULT(result)) {
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(result);
- g_warn_if_fail (g_simple_async_result_get_source_tag(simple) == gvir_connection_open);
+ g_warn_if_fail (g_simple_async_result_get_source_tag(simple) == gvir_connection_open_async);
if (g_simple_async_result_propagate_error(simple, err))
return FALSE;
}
@@ -886,7 +886,7 @@ void gvir_connection_fetch_domains_async(GVirConnection *conn,
res = g_simple_async_result_new(G_OBJECT(conn),
callback,
user_data,
- gvir_connection_fetch_domains);
+ gvir_connection_fetch_domains_async);
g_simple_async_result_run_in_thread(res,
gvir_connection_fetch_domains_helper,
G_PRIORITY_DEFAULT,
@@ -908,7 +908,7 @@ gboolean gvir_connection_fetch_domains_finish(GVirConnection *conn,
if (G_IS_SIMPLE_ASYNC_RESULT(result)) {
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(result);
- g_warn_if_fail (g_simple_async_result_get_source_tag(simple) == gvir_connection_fetch_domains);
+ g_warn_if_fail (g_simple_async_result_get_source_tag(simple) == gvir_connection_fetch_domains_async);
if (g_simple_async_result_propagate_error(simple, err))
return FALSE;
}
@@ -947,7 +947,7 @@ void gvir_connection_fetch_storage_pools_async(GVirConnection *conn,
res = g_simple_async_result_new(G_OBJECT(conn),
callback,
user_data,
- gvir_connection_fetch_storage_pools);
+ gvir_connection_fetch_storage_pools_async);
g_simple_async_result_run_in_thread(res,
gvir_connection_fetch_pools_helper,
G_PRIORITY_DEFAULT,
@@ -970,7 +970,7 @@ gboolean gvir_connection_fetch_storage_pools_finish(GVirConnection *conn,
if (G_IS_SIMPLE_ASYNC_RESULT(result)) {
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(result);
g_warn_if_fail (g_simple_async_result_get_source_tag(simple) ==
- gvir_connection_fetch_storage_pools);
+ gvir_connection_fetch_storage_pools_async);
if (g_simple_async_result_propagate_error(simple, err))
return FALSE;
}
diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
index 9ab6b06..4148a78 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -788,7 +788,7 @@ void gvir_domain_save_async (GVirDomain *dom,
res = g_simple_async_result_new(G_OBJECT(dom),
callback,
user_data,
- gvir_domain_save);
+ gvir_domain_save_async);
g_simple_async_result_set_op_res_gpointer (res, data, (GDestroyNotify) domain_save_data_free);
g_simple_async_result_run_in_thread(res,
gvir_domain_save_helper,
@@ -817,7 +817,7 @@ gboolean gvir_domain_save_finish (GVirDomain *dom,
if (G_IS_SIMPLE_ASYNC_RESULT(result)) {
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(result);
g_warn_if_fail (g_simple_async_result_get_source_tag(simple) ==
- gvir_domain_save);
+ gvir_domain_save_async);
if (g_simple_async_result_propagate_error(simple, err))
return FALSE;
}
diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.c b/libvirt-gobject/libvirt-gobject-storage-pool.c
index 0ba1768..488f146 100644
--- a/libvirt-gobject/libvirt-gobject-storage-pool.c
+++ b/libvirt-gobject/libvirt-gobject-storage-pool.c
@@ -437,7 +437,7 @@ void gvir_storage_pool_refresh_async(GVirStoragePool *pool,
res = g_simple_async_result_new(G_OBJECT(pool),
callback,
user_data,
- gvir_storage_pool_refresh);
+ gvir_storage_pool_refresh_async);
g_simple_async_result_run_in_thread(res,
gvir_storage_pool_refresh_helper,
G_PRIORITY_DEFAULT,
@@ -460,7 +460,7 @@ gboolean gvir_storage_pool_refresh_finish(GVirStoragePool *pool,
if (G_IS_SIMPLE_ASYNC_RESULT(result)) {
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(result);
g_warn_if_fail (g_simple_async_result_get_source_tag(simple) ==
- gvir_storage_pool_refresh);
+ gvir_storage_pool_refresh_async);
if (g_simple_async_result_propagate_error(simple, err))
return FALSE;
}
@@ -627,7 +627,7 @@ void gvir_storage_pool_build_async (GVirStoragePool *pool,
res = g_simple_async_result_new(G_OBJECT(pool),
callback,
user_data,
- gvir_storage_pool_build);
+ gvir_storage_pool_build_async);
g_object_set_data(G_OBJECT(res), "StoragePoolBuildData", data);
g_simple_async_result_run_in_thread(res,
gvir_storage_pool_build_helper,
@@ -654,7 +654,7 @@ gboolean gvir_storage_pool_build_finish(GVirStoragePool *pool,
if (G_IS_SIMPLE_ASYNC_RESULT(result)) {
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(result);
g_warn_if_fail (g_simple_async_result_get_source_tag(simple) ==
- gvir_storage_pool_build);
+ gvir_storage_pool_build_async);
if (g_simple_async_result_propagate_error(simple, err))
return FALSE;
}
@@ -727,7 +727,7 @@ void gvir_storage_pool_start_async (GVirStoragePool *pool,
res = g_simple_async_result_new(G_OBJECT(pool),
callback,
user_data,
- gvir_storage_pool_start);
+ gvir_storage_pool_start_async);
g_object_set_data(G_OBJECT(res), "StoragePoolBuildData", data);
g_simple_async_result_run_in_thread(res,
gvir_storage_pool_start_helper,
@@ -754,7 +754,7 @@ gboolean gvir_storage_pool_start_finish(GVirStoragePool *pool,
if (G_IS_SIMPLE_ASYNC_RESULT(result)) {
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(result);
g_warn_if_fail (g_simple_async_result_get_source_tag(simple) ==
- gvir_storage_pool_start);
+ gvir_storage_pool_start_async);
if (g_simple_async_result_propagate_error(simple, err))
return FALSE;
}
--
1.7.7.5
12 years, 10 months
[libvirt] [PATCH 0/4 0/1 0/1 V2] Add new public API virDomainGetPcpusUsage() and pcpuinfo command in virsh
by Lai Jiangshan
"virt-top -1" can call virDomainGetPcpusUsage() periodically and get
the CPU activities per CPU. (See the last patch in this series).
virsh is also added a pcpuinfo command which calls virDomainGetPcpusUsage(),
it gets information about the physic CPUs, such as the usage of
CPUs, the current attached vCPUs.
# virsh pcpuinfo rhel6
CPU: 0
Curr VCPU: -
Usage: 47.3
CPU: 1
Curr VCPU: 1
Usage: 46.8
CPU: 2
Curr VCPU: 0
Usage: 52.7
CPU: 3
Curr VCPU: -
Usage: 44.1
Patch for libvirt(4 patches):
daemon/remote.c | 68 ++++++++++++++++++++++++++++++
include/libvirt/libvirt.h.in | 5 ++
python/generator.py | 1 +
src/driver.h | 7 +++
src/libvirt.c | 51 +++++++++++++++++++++++
src/libvirt_public.syms | 5 ++
src/qemu/qemu.conf | 5 +-
src/qemu/qemu_conf.c | 3 +-
src/qemu/qemu_driver.c | 74 +++++++++++++++++++++++++++++++++
src/remote/remote_driver.c | 51 +++++++++++++++++++++++
src/remote/remote_protocol.x | 17 +++++++-
src/remote_protocol-structs | 13 ++++++
src/util/cgroup.c | 7 +++
src/util/cgroup.h | 1 +
tools/virsh.c | 93 ++++++++++++++++++++++++++++++++++++++++++
tools/virsh.pod | 5 ++
16 files changed, 402 insertions(+), 4 deletions(-)
Patch for ocaml-libvirt (1 patch):
libvirt/libvirt.ml | 1 +
libvirt/libvirt.mli | 4 ++++
libvirt/libvirt_c_oneoffs.c | 25 +++++++++++++++++++++++++
3 files changed, 30 insertions(+), 0 deletions(-)
Patch for virt-top (1 patch):
virt-top/virt_top.ml | 75 +++++++++++++++++--------------------------------
1 files changed, 26 insertions(+), 49 deletions(-)
--
1.7.4.4
12 years, 10 months
[libvirt] [PATCH] config: report error when script given for inappropriate interface type
by Laine Stump
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=638633
Although scripts are not used by interfaces of type other than
"ethernet" in qemu, due to the fact that the parser stores the script
name in a union that is only valid when type is ethernet or bridge,
there is no way for anyone except the parser itself to catch the
problem of specifying an interface script for an inappropriate
interface type (by the time the parsed data gets back to the code that
called the parser, all evidence that a script was specified is
forgotten).
Since the parser itself should be agnostic to which type of interface
allows scripts (an example of why: a script specified for an interface
of type bridge is valid for xen domains, but not for qemu domains),
the solution here is to move the script out of the union(s) in the
DomainNetDef, always populate it when specified (regardless of
interface type), and let the driver decide whether or not it is
appropriate.
Currently the qemu, xen, libxml, and uml drivers recognize the script
parameter and do something with it (the uml driver only to report that
it isn't supported). Those drivers have been updated to log a
CONFIG_UNSUPPORTED error when a script is specified for an interface
type that's inappropriate for that particular hypervisor.
(NB: There was earlier discussion of solving this problem by adding a
VALIDATE flag to all libvirt APIs that accept XML, which would cause
the XML to be validated against the RNG files. One statement during
that discussion was that the RNG shouldn't contain hypervisor-specific
things, though, and a proper solution to this problem would require
that (again, because a script for an interface of type "bridge" is
accepted by xen, but not by qemu).
---
src/conf/domain_conf.c | 25 +++++++------------------
src/conf/domain_conf.h | 3 +--
src/libxl/libxl_conf.c | 11 +++++++++--
src/qemu/qemu_command.c | 18 +++++++++++++-----
src/qemu/qemu_domain.c | 10 ++++++----
src/qemu/qemu_driver.c | 10 +++++-----
src/qemu/qemu_hotplug.c | 2 +-
src/uml/uml_conf.c | 11 ++++++-----
src/vbox/vbox_tmpl.c | 2 +-
src/xenxs/xen_sxpr.c | 20 ++++++++++++++------
src/xenxs/xen_xm.c | 14 ++++++--------
11 files changed, 69 insertions(+), 57 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7327667..0190a81 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -956,7 +956,6 @@ void virDomainNetDefFree(virDomainNetDefPtr def)
switch (def->type) {
case VIR_DOMAIN_NET_TYPE_ETHERNET:
VIR_FREE(def->data.ethernet.dev);
- VIR_FREE(def->data.ethernet.script);
VIR_FREE(def->data.ethernet.ipaddr);
break;
@@ -975,7 +974,6 @@ void virDomainNetDefFree(virDomainNetDefPtr def)
case VIR_DOMAIN_NET_TYPE_BRIDGE:
VIR_FREE(def->data.bridge.brname);
- VIR_FREE(def->data.bridge.script);
VIR_FREE(def->data.bridge.ipaddr);
break;
@@ -993,6 +991,7 @@ void virDomainNetDefFree(virDomainNetDefPtr def)
break;
}
+ VIR_FREE(def->script);
VIR_FREE(def->ifname);
virDomainDeviceInfoClear(&def->info);
@@ -3764,8 +3763,6 @@ virDomainNetDefParseXML(virCapsPtr caps,
xmlStrEqual(cur->name, BAD_CAST "link")) {
linkstate = virXMLPropString(cur, "state");
} else if ((script == NULL) &&
- (def->type == VIR_DOMAIN_NET_TYPE_ETHERNET ||
- def->type == VIR_DOMAIN_NET_TYPE_BRIDGE) &&
xmlStrEqual(cur->name, BAD_CAST "script")) {
script = virXMLPropString(cur, "path");
} else if (xmlStrEqual (cur->name, BAD_CAST "model")) {
@@ -3854,11 +3851,6 @@ virDomainNetDefParseXML(virCapsPtr caps,
break;
case VIR_DOMAIN_NET_TYPE_ETHERNET:
-
- if (script != NULL) {
- def->data.ethernet.script = script;
- script = NULL;
- }
if (dev != NULL) {
def->data.ethernet.dev = dev;
dev = NULL;
@@ -3877,10 +3869,6 @@ virDomainNetDefParseXML(virCapsPtr caps,
}
def->data.bridge.brname = bridge;
bridge = NULL;
- if (script != NULL) {
- def->data.bridge.script = script;
- script = NULL;
- }
if (address != NULL) {
def->data.bridge.ipaddr = address;
address = NULL;
@@ -3957,6 +3945,10 @@ virDomainNetDefParseXML(virCapsPtr caps,
break;
}
+ if (script != NULL) {
+ def->script = script;
+ script = NULL;
+ }
if (ifname != NULL) {
def->ifname = ifname;
ifname = NULL;
@@ -10340,8 +10332,6 @@ virDomainNetDefFormat(virBufferPtr buf,
if (def->data.ethernet.ipaddr)
virBufferAsprintf(buf, " <ip address='%s'/>\n",
def->data.ethernet.ipaddr);
- virBufferEscapeString(buf, " <script path='%s'/>\n",
- def->data.ethernet.script);
break;
case VIR_DOMAIN_NET_TYPE_BRIDGE:
@@ -10350,8 +10340,6 @@ virDomainNetDefFormat(virBufferPtr buf,
if (def->data.bridge.ipaddr)
virBufferAsprintf(buf, " <ip address='%s'/>\n",
def->data.bridge.ipaddr);
- virBufferEscapeString(buf, " <script path='%s'/>\n",
- def->data.bridge.script);
break;
case VIR_DOMAIN_NET_TYPE_SERVER:
@@ -10387,7 +10375,8 @@ virDomainNetDefFormat(virBufferPtr buf,
break;
}
-
+ virBufferEscapeString(buf, " <script path='%s'/>\n",
+ def->script);
if (def->ifname &&
!((flags & VIR_DOMAIN_XML_INACTIVE) &&
(STRPREFIX(def->ifname, VIR_NET_GENERATED_PREFIX)))) {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index cd882bb..03aa5b6 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -574,7 +574,6 @@ struct _virDomainNetDef {
union {
struct {
char *dev;
- char *script;
char *ipaddr;
} ethernet;
struct {
@@ -597,7 +596,6 @@ struct _virDomainNetDef {
} network;
struct {
char *brname;
- char *script;
char *ipaddr;
} bridge;
struct {
@@ -613,6 +611,7 @@ struct _virDomainNetDef {
bool sndbuf_specified;
unsigned long sndbuf;
} tune;
+ char *script;
char *ifname;
int bootIndex;
virDomainDeviceInfo info;
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index e94e06b..24830e8 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -618,11 +618,18 @@ libxlMakeNic(virDomainDefPtr def, virDomainNetDefPtr l_nic,
virReportOOMError();
return -1;
}
- if (l_nic->data.bridge.script &&
- (x_nic->script = strdup(l_nic->data.bridge.script)) == NULL) {
+ if (l_nic->script &&
+ (x_nic->script = strdup(l_nic->script)) == NULL) {
virReportOOMError();
return -1;
}
+ } else {
+ if (l_nic->script) {
+ libxlError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("scripts are not supported on interfaces of type %s"),
+ virDomainNetTypeToString(l_nic->type));
+ return -1;
+ }
}
return 0;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ea1b763..27db980 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2418,8 +2418,16 @@ qemuBuildHostNetStr(virDomainNetDefPtr net,
{
bool is_tap = false;
virBuffer buf = VIR_BUFFER_INITIALIZER;
+ enum virDomainNetType netType = virDomainNetGetActualType(net);
- switch (virDomainNetGetActualType(net)) {
+ if (net->script && netType != VIR_DOMAIN_NET_TYPE_ETHERNET) {
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("scripts are not supported on interfaces of type %s"),
+ virDomainNetTypeToString(netType));
+ return NULL;
+ }
+
+ switch (netType) {
case VIR_DOMAIN_NET_TYPE_NETWORK:
case VIR_DOMAIN_NET_TYPE_BRIDGE:
case VIR_DOMAIN_NET_TYPE_DIRECT:
@@ -2435,9 +2443,9 @@ qemuBuildHostNetStr(virDomainNetDefPtr net,
virBufferAsprintf(&buf, "%cifname=%s", type_sep, net->ifname);
type_sep = ',';
}
- if (net->data.ethernet.script) {
+ if (net->script) {
virBufferAsprintf(&buf, "%cscript=%s", type_sep,
- net->data.ethernet.script);
+ net->script);
type_sep = ',';
}
is_tap = true;
@@ -2447,7 +2455,7 @@ qemuBuildHostNetStr(virDomainNetDefPtr net,
case VIR_DOMAIN_NET_TYPE_SERVER:
case VIR_DOMAIN_NET_TYPE_MCAST:
virBufferAddLit(&buf, "socket");
- switch (virDomainNetGetActualType(net)) {
+ switch (netType) {
case VIR_DOMAIN_NET_TYPE_CLIENT:
virBufferAsprintf(&buf, "%cconnect=%s:%d",
type_sep,
@@ -6253,7 +6261,7 @@ qemuParseCommandLineNet(virCapsPtr caps,
}
} else if (def->type == VIR_DOMAIN_NET_TYPE_ETHERNET &&
STREQ(keywords[i], "script") && STRNEQ(values[i], "")) {
- def->data.ethernet.script = values[i];
+ def->script = values[i];
values[i] = NULL;
} else if (def->type == VIR_DOMAIN_NET_TYPE_ETHERNET &&
STREQ(keywords[i], "ifname")) {
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c5b08f9..6b03c62 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1167,10 +1167,12 @@ void qemuDomainObjCheckNetTaint(struct qemud_driver *driver,
virDomainNetDefPtr net,
int logFD)
{
- if ((net->type == VIR_DOMAIN_NET_TYPE_ETHERNET &&
- net->data.ethernet.script != NULL) ||
- (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE &&
- net->data.bridge.script != NULL))
+ /* script is only useful for NET_TYPE_ETHERNET (qemu) and
+ * NET_TYPE_BRIDGE (xen), but could be (incorrectly) specified for
+ * any interface type. In any case, it's adding user sauce into
+ * the soup, so it should taint the domain.
+ */
+ if (net->script != NULL)
qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_SHELL_SCRIPTS, logFD);
}
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 110c31b..8966cdc 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4470,8 +4470,8 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
memset(net, 0, sizeof *net);
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
+ net->script = NULL;
net->data.ethernet.dev = brnamecopy;
- net->data.ethernet.script = NULL;
net->data.ethernet.ipaddr = NULL;
} else {
/* actualType is either NETWORK or DIRECT. In either
@@ -4481,8 +4481,8 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
memset(net, 0, sizeof *net);
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
+ net->script = NULL;
net->data.ethernet.dev = NULL;
- net->data.ethernet.script = NULL;
net->data.ethernet.ipaddr = NULL;
}
} else if (net->type == VIR_DOMAIN_NET_TYPE_DIRECT) {
@@ -4492,19 +4492,19 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
memset(net, 0, sizeof *net);
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
+ net->script = NULL;
net->data.ethernet.dev = NULL;
- net->data.ethernet.script = NULL;
net->data.ethernet.ipaddr = NULL;
} else if (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE) {
+ char *script = net->script;
char *brname = net->data.bridge.brname;
- char *script = net->data.bridge.script;
char *ipaddr = net->data.bridge.ipaddr;
memset(net, 0, sizeof *net);
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
+ net->script = script;
net->data.ethernet.dev = brname;
- net->data.ethernet.script = script;
net->data.ethernet.ipaddr = ipaddr;
}
net->bootIndex = bootIndex;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index f3597a1..99f53d5 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1219,7 +1219,7 @@ int qemuDomainChangeNet(struct qemud_driver *driver,
case VIR_DOMAIN_NET_TYPE_ETHERNET:
if (STRNEQ_NULLABLE(olddev->data.ethernet.dev, dev->data.ethernet.dev) ||
- STRNEQ_NULLABLE(olddev->data.ethernet.script, dev->data.ethernet.script) ||
+ STRNEQ_NULLABLE(olddev->script, dev->script) ||
STRNEQ_NULLABLE(olddev->data.ethernet.ipaddr, dev->data.ethernet.ipaddr)) {
qemuReportError(VIR_ERR_NO_SUPPORT,
_("cannot modify ethernet network device configuration"));
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index 86ca191..316d558 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -193,11 +193,6 @@ umlBuildCommandLineNet(virConnectPtr conn,
_("IP address not supported for ethernet interface"));
goto error;
}
- if (def->data.ethernet.script) {
- umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("script execution not supported for ethernet interface"));
- goto error;
- }
break;
case VIR_DOMAIN_NET_TYPE_SERVER:
@@ -265,6 +260,12 @@ umlBuildCommandLineNet(virConnectPtr conn,
break;
}
+ if (def->script) {
+ umlReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("interface script execution not supported by this driver"));
+ goto error;
+ }
+
virBufferAsprintf(&buf, ",%02x:%02x:%02x:%02x:%02x:%02x",
def->mac[0], def->mac[1], def->mac[2],
def->mac[3], def->mac[4], def->mac[5]);
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 9909d13..b3267a9 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -4364,7 +4364,7 @@ vboxAttachNetwork(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
VIR_DEBUG("NIC(%d): NAT.", i);
} else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_BRIDGE) {
VIR_DEBUG("NIC(%d): brname: %s", i, def->nets[i]->data.bridge.brname);
- VIR_DEBUG("NIC(%d): script: %s", i, def->nets[i]->data.bridge.script);
+ VIR_DEBUG("NIC(%d): script: %s", i, def->nets[i]->script);
VIR_DEBUG("NIC(%d): ipaddr: %s", i, def->nets[i]->data.bridge.ipaddr);
}
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index 124c369..04ba5aa 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -549,7 +549,7 @@ xenParseSxprNets(virDomainDefPtr def,
goto no_memory;
if (tmp2 &&
net->type == VIR_DOMAIN_NET_TYPE_BRIDGE &&
- !(net->data.bridge.script = strdup(tmp2)))
+ !(net->script = strdup(tmp2)))
goto no_memory;
tmp = sexpr_node(node, "device/vif/ip");
if (tmp &&
@@ -558,7 +558,7 @@ xenParseSxprNets(virDomainDefPtr def,
} else {
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
if (tmp2 &&
- !(net->data.ethernet.script = strdup(tmp2)))
+ !(net->script = strdup(tmp2)))
goto no_memory;
tmp = sexpr_node(node, "device/vif/ip");
if (tmp &&
@@ -1786,6 +1786,14 @@ xenFormatSxprNet(virConnectPtr conn,
_("unsupported network type %d"), def->type);
return -1;
}
+ if (def->script &&
+ def->type != VIR_DOMAIN_NET_TYPE_BRIDGE &&
+ def->type != VIR_DOMAIN_NET_TYPE_ETHERNET) {
+ XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("scripts are not supported on interfaces of type %s"),
+ virDomainNetTypeToString(def->type));
+ return -1;
+ }
if (!isAttach)
virBufferAddLit(buf, "(device ");
@@ -1800,8 +1808,8 @@ xenFormatSxprNet(virConnectPtr conn,
switch (def->type) {
case VIR_DOMAIN_NET_TYPE_BRIDGE:
virBufferEscapeSexpr(buf, "(bridge '%s')", def->data.bridge.brname);
- if (def->data.bridge.script)
- script = def->data.bridge.script;
+ if (def->script)
+ script = def->script;
virBufferEscapeSexpr(buf, "(script '%s')", script);
if (def->data.bridge.ipaddr != NULL)
@@ -1835,9 +1843,9 @@ xenFormatSxprNet(virConnectPtr conn,
break;
case VIR_DOMAIN_NET_TYPE_ETHERNET:
- if (def->data.ethernet.script)
+ if (def->script)
virBufferEscapeSexpr(buf, "(script '%s')",
- def->data.ethernet.script);
+ def->script);
if (def->data.ethernet.ipaddr != NULL)
virBufferEscapeSexpr(buf, "(ip '%s')", def->data.ethernet.ipaddr);
break;
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index b415ce8..0aa04f3 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -708,21 +708,19 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
if (bridge[0] &&
!(net->data.bridge.brname = strdup(bridge)))
goto no_memory;
- if (script[0] &&
- !(net->data.bridge.script = strdup(script)))
- goto no_memory;
if (ip[0] &&
!(net->data.bridge.ipaddr = strdup(ip)))
goto no_memory;
} else {
- if (script && script[0] &&
- !(net->data.ethernet.script = strdup(script)))
- goto no_memory;
if (ip[0] &&
!(net->data.ethernet.ipaddr = strdup(ip)))
goto no_memory;
}
+ if (script && script[0] &&
+ !(net->script = strdup(script)))
+ goto no_memory;
+
if (model[0] &&
!(net->model = strdup(model)))
goto no_memory;
@@ -1282,8 +1280,8 @@ static int xenFormatXMNet(virConnectPtr conn,
break;
case VIR_DOMAIN_NET_TYPE_ETHERNET:
- if (net->data.ethernet.script)
- virBufferAsprintf(&buf, ",script=%s", net->data.ethernet.script);
+ if (net->script)
+ virBufferAsprintf(&buf, ",script=%s", net->script);
if (net->data.ethernet.ipaddr)
virBufferAsprintf(&buf, ",ip=%s", net->data.ethernet.ipaddr);
break;
--
1.7.7.4
12 years, 10 months
[libvirt] [PATCHv2 0/3] helper functions for virTypedParameters
by Eric Blake
v1 was: https://www.redhat.com/archives/libvir-list/2012-January/msg00102.html
New in v2: more cleanups to lxc, and rebase to post-release tree
Eric Blake (3):
lxc: use live/config helper
util: add new file for virTypedParameter utils
util: use new virTypedParameter helpers
daemon/remote.c | 1 +
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/esx/esx_driver.c | 83 +++----
src/libvirt_private.syms | 20 +-
src/libxl/libxl_driver.c | 48 +---
src/lxc/lxc_driver.c | 370 +++++++--------------------
src/qemu/qemu_driver.c | 656 ++++++++++++++--------------------------------
src/test/test_driver.c | 29 +--
src/util/util.c | 16 +-
src/util/util.h | 4 +-
src/util/virtypedparam.c | 187 +++++++++++++
src/util/virtypedparam.h | 37 +++
src/xen/xen_hypervisor.c | 51 ++--
tools/virsh.c | 3 +-
15 files changed, 623 insertions(+), 884 deletions(-)
create mode 100644 src/util/virtypedparam.c
create mode 100644 src/util/virtypedparam.h
--
1.7.7.5
12 years, 10 months
[libvirt] [PATCH] qemu: one more client to live/config helper
by Eric Blake
Commit ae523427 missed one pair of functions that could use
the helper routine.
* src/qemu/qemu_driver.c (qemuSetSchedulerParametersFlags)
(qemuGetSchedulerParametersFlags): Simplify.
---
src/qemu/qemu_driver.c | 73 +++++++----------------------------------------
1 files changed, 11 insertions(+), 62 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ad592d6..5d50940 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6996,7 +6996,6 @@ static int qemuSetSchedulerParametersFlags(virDomainPtr dom,
virDomainObjPtr vm = NULL;
virDomainDefPtr vmdef = NULL;
int ret = -1;
- bool isActive;
int rc;
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
@@ -7012,22 +7011,11 @@ static int qemuSetSchedulerParametersFlags(virDomainPtr dom,
goto cleanup;
}
- isActive = virDomainObjIsActive(vm);
-
- if (flags == VIR_DOMAIN_AFFECT_CURRENT) {
- if (isActive)
- flags = VIR_DOMAIN_AFFECT_LIVE;
- else
- flags = VIR_DOMAIN_AFFECT_CONFIG;
- }
+ if (virDomainLiveConfigHelperMethod(driver->caps, vm, &flags,
+ &vmdef) < 0)
+ goto cleanup;
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
- if (!vm->persistent) {
- qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot change persistent config of a transient domain"));
- goto cleanup;
- }
-
/* Make a copy for updated domain. */
vmdef = virDomainObjCopyPersistentDef(driver->caps, vm);
if (!vmdef)
@@ -7035,12 +7023,6 @@ static int qemuSetSchedulerParametersFlags(virDomainPtr dom,
}
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
- if (!isActive) {
- qemuReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
- goto cleanup;
- }
-
if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
qemuReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("cgroup CPU controller is not mounted"));
@@ -7238,9 +7220,9 @@ qemuGetSchedulerParametersFlags(virDomainPtr dom,
long long quota;
int ret = -1;
int rc;
- bool isActive;
bool cpu_bw_status = false;
int saved_nparams = 0;
+ virDomainDefPtr persistentDef;
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
VIR_DOMAIN_AFFECT_CONFIG |
@@ -7266,52 +7248,19 @@ qemuGetSchedulerParametersFlags(virDomainPtr dom,
goto cleanup;
}
- isActive = virDomainObjIsActive(vm);
-
- if (flags == VIR_DOMAIN_AFFECT_CURRENT) {
- if (isActive)
- flags = VIR_DOMAIN_AFFECT_LIVE;
- else
- flags = VIR_DOMAIN_AFFECT_CONFIG;
- }
+ if (virDomainLiveConfigHelperMethod(driver->caps, vm, &flags,
+ &persistentDef) < 0)
+ goto cleanup;
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
- if (!vm->persistent) {
- qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot query persistent config of a transient domain"));
- goto cleanup;
- }
-
- if (isActive) {
- virDomainDefPtr persistentDef;
-
- persistentDef = virDomainObjGetPersistentDef(driver->caps, vm);
- if (!persistentDef) {
- qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("can't get persistentDef"));
- goto cleanup;
- }
- shares = persistentDef->cputune.shares;
- if (*nparams > 1 && cpu_bw_status) {
- period = persistentDef->cputune.period;
- quota = persistentDef->cputune.quota;
- }
- } else {
- shares = vm->def->cputune.shares;
- if (*nparams > 1 && cpu_bw_status) {
- period = vm->def->cputune.period;
- quota = vm->def->cputune.quota;
- }
+ shares = persistentDef->cputune.shares;
+ if (*nparams > 1 && cpu_bw_status) {
+ period = persistentDef->cputune.period;
+ quota = persistentDef->cputune.quota;
}
goto out;
}
- if (!isActive) {
- qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("domain is not running"));
- goto cleanup;
- }
-
if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
qemuReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("cgroup CPU controller is not mounted"));
--
1.7.7.4
12 years, 10 months
[libvirt] Release of libvirt-0.9.9
by Daniel Veillard
As expected, I made the release of 0.9.9 today, it is tagged in git and
available at:
ftp://libvirt.org/libvirt/
Apparently some people expect the next one to be 1.0.0, but more
realistically it should be 0.9.10 and occuring in a month from today :-)
So this realease is a relatively light one with around 150 commits
i.e. half the usual amount, I assume most people envoyed the end of year
vacations :-) . The content is in a large part focused on local
improvements and bug fixes though we have a few new features !
Features:
- Add new API virDomain{S,G}etInterfaceParameters (Hu Tao)
- Add new API virDomain{G, S}etNumaParameters (Hu Tao)
- Add support for ppc64 qemu (Prerna Saxena, Bharata B Rao, Michael Ellerman)
- Support Xen domctl v8 (Jim Fehlig)
Documentation:
- Fix typos in messages. (Yuri Chornoivan)
- docs: re-fix stray / (Eric Blake)
- virsh: move version command to host group (Lai Jiangshan)
- docs: Move 'echo' command description into the generic commands section (Satoru SATOH)
- docs: Move 'send-key' command description into the domain commands section (Satoru SATOH)
- docs: remove stray / (Eric Blake)
- docs: fix missing / in xml examples (Eric Blake)
- docs: improve virsh domxml-*-native command docs (Alex Jia)
- docs: document <qemu:commandline> xml (Eric Blake)
- Fix typo in storage pool documentation (Christophe Fergeau)
- docs: tweak 'virsh edit' wording (Eric Blake)
- docs: document <address> elements in one place (Eric Blake)
- threads: Document spurious wakeups on virCondWait (Michal Privoznik)
Portability:
- build: fix mingw virCommand build (Eric Blake)
- tests: avoid test failure on rawhide gnutls (Eric Blake)
- build: drop check for ANSI compiler (Eric Blake)
- Fix build on s390(x) and other stange arches (Daniel Veillard)
- Require avahi as an rpm dependancy (Daniel Veillard)
- Disable python explicitly in mingw32 autobuild (Daniel P. Berrange)
- build: disable dtrace on non-Linux builds (Eric Blake)
- build: let autobuild check more code (Eric Blake)
- maint: allow bootstrap in a sandbox (Eric Blake)
Bug Fixes:
- qemu: Avoid memory leaks on qemuParseRBDString (Alex Jia)
- qemu: fix a bug in numatune (Hu Tao)
- qemu: fix use-after-free regression (Eric Blake)
- seclabel: fix regression in libvirtd restart (Eric Blake)
- command: Discard FD_SETSIZE limit for opened files (Michal Privoznik)
- Fix xenstore serial console path for HVM guests (Jim Fehlig)
- schemas: Allow '.' in CPU feature name (Jiri Denemark)
- virCommand: Properly handle POLLHUP (Michal Privoznik)
- virCPUDefCopy forgot to copy NUMA topology (Jiri Denemark)
- qemu: fix block stat naming (Eric Blake)
- domiftune: clean up previous patches (Eric Blake)
- virsh: Fix checking for reconnect conditions (Peter Krempa)
- qemu: Fix bandwidth memory leak on failure (Alex Jia)
- qemu: fix blkio memory leak on failure (Eric Blake)
- remove a static limit on max domains in python bindings (Daniel Veillard)
- python: Fix problems of virDomain{Set, Get}BlockIoTune bindings (Alex Jia)
- qemu: fix inf-loop in blkio parameters (Eric Blake)
- qemu: Keep list of USB devices attached to domains (Michal Privoznik)
- qemu: Release the lock on domobj if fails on finding the disk path (Osier Yang)
- virsh: plug mem leaks in domxml-*-native (Alex Jia)
- console: plug memory leaks (Alex Jia)
- rpc: handle param_int, plug memory leaks (Eric Blake)
- python: plug memory leak on libvirt_virConnectOpenAuth (Alex Jia)
- Only add the timer when a callback is registered (Daniel P. Berrange)
- qemu: detect truncated file as invalid save image (Eric Blake)
- qemu: Don't drop hostdev config until security label restore (Michal Privoznik)
- Fix default migration speed in qemu driver (Jim Fehlig)
- qemu: Fix race between async and query jobs (Jiri Denemark)
- qemu: Do not free the device from activePciHostdevs if it's in use (Osier Yang)
- qemu: Honor the original properties of PCI device when detaching (Osier Yang)
- spec: fix inverted logic on sanlock (Wen Congyang)
- tests: plug memory leak on linuxTestNodeInfo (Alex Jia)
- storage: Fix a potential crash when creating vol object (Osier Yang)
- qemu: Disable EOF processing during qemuDomainDestroy (Jiri Denemark)
- virsh: Free returned MIME type string (Michal Privoznik)
- storage: Activate/deactivate logical volumes only on local node (Rommer)
- security: don't try to label network disks (Josh Durgin)
- test: replace deprecated "fedora-13" machine with "pc-0.13" (Laine Stump)
- network: don't add iptables rules for externally managed networks (Laine Stump)
- threadpool: Use while loop on virCondWait (Michal Privoznik)
- virsh: plug memory leak on cmdDomblklist (Alex Jia)
- fix error when parsing ppc64 models on x86 host (Stefan Berger)
- fix memory leak in src/nodeinfo.c (Stefan Berger)
- threadpool: Don't wait on condition if pool has no workers (Michal Privoznik)
- bridge: Fix forward delay APIs (Jiri Denemark)
- virsh: return correct value from cmdDomIfGetLink (Peter Krempa)
- virsh: plug memory leak on cmdDomIfGetLink() sucessful path (Alex Jia)
- virsh: plug memory leak on cmdBlkdeviotune() sucessful path (Alex Jia)
- test: fix potential lock corruption in test driver (Laine Stump)
- spec: fix logic bug in deciding to turn on cgconfig (Eric Blake)
- When checking nttyFDs to see if it is != 1, be sure to use '1' and not '-1' (Daniel P. Berrange)
- Fix installation of libvirt-guests.service (Daniel P. Berrange)
Improvements:
- Implement DNS SRV record into the bridge driver (Michal Novotny)
- seclabel: honor device override in selinux (Eric Blake)
- seclabel: allow a seclabel override on a disk src (Eric Blake)
- seclabel: extend XML to allow per-disk label overrides (Eric Blake)
- seclabel: move seclabel stuff earlier (Eric Blake)
- seclabel: refactor existing domain_conf usage (Eric Blake)
- schema: rewrite seclabel rng to match code (Eric Blake)
- domiftune: Enable the virDomain{S,G}etInterfaceParameters in virsh (Hu Tao)
- domiftune: Add virDomain{S,G}etInterfaceParameters support to qemu driver (Hu Tao)
- domiftune: Add a util function virDomainNetFind (Hu Tao)
- domiftune: Add support of new APIs to the remote driver (Hu Tao)
- domiftune: virDomain{S,G}etInterfaceParameters: the main entry points (Hu Tao)
- daemon: clean up daemonization (Eric Blake)
- tests: fix schema checks sorting (Eric Blake)
- qemu: Support for overriding NOFILE limit (Michal Privoznik)
- virsh: Use vshWatchJob in cmdManagedSave (Michal Privoznik)
- virsh: Use vshWatchJob in cmdSave (Michal Privoznik)
- virsh: Use vshWatchJob in cmdDump (Michal Privoznik)
- virsh: Move job watch code to a separate function (Michal Privoznik)
- qemuhelptest: Add new qemuCap flag (Michal Privoznik)
- qemu: Support readonly filesystem passthrough (Osier Yang)
- nwfilter: Do not require DHCP requests to be broadcasted (Stefan Berger)
- tests: run schema checks in sorted order (Eric Blake)
- tests: Add fake PPC64 emulator for QEMU testing (Michael Ellerman)
- qemu: Add spapr-vio address assignment (Michael Ellerman)
- Add New address type spapr-vio to domain.rng (Bharata B Rao)
- Add address type for SPAPR VIO devices (Michael Ellerman)
- qemu: Add a capability flag for -no-acpi (Michael Ellerman)
- add new command numatune to virsh (Hu Tao)
- Implement virDomain{G, S}etNumaParameters for the qemu driver (Hu Tao)
- Add virDomain{G, S}etNumaParameters support to the remote driver (Hu Tao)
- use cpuset to manage numa (Hu Tao)
- Add functions to set/get cgroup cpuset parameters (Hu Tao)
- virsh: simplify printing of typed parameters (Eric Blake)
- Hide use of timers for domain event dispatch (Daniel P. Berrange)
- Remove decl of all APIs related to domain event callbacks & queues (Daniel P. Berrange)
- Remove all domain event structs from header (Daniel P. Berrange)
- Convert drivers to thread safe APIs for adding callbacks (Daniel P. Berrange)
- Add APIs to allow management of callbacks purely with virDomainEventState (Daniel P. Berrange)
- Return count of callbacks when registering callbacks (Daniel P. Berrange)
- Convert Xen & VBox drivers to use virDomainEventState (Daniel P. Berrange)
- nwfilter: do not create ebtables chain unnecessarily (Stefan Berger)
- migration: Add more specific error code/message on migration abort (Peter Krempa)
- virsh: Add option to undefine storage with domains (Peter Krempa)
- python: Expose blockPeek and memoryPeek in Python binding (Osier Yang)
- virsh: support multifunction in attach-disk (KAMEZAWA Hiroyuki)
- python: Fix export of virDomainSnapshotListChildrenNames (Peter Krempa)
- Provide a helper method virDomainLiveConfigHelperMethod (Lei Li)
- virsh: Print error message if argument parsing fails for cmdNodesuspend (Peter Krempa)
- build: follow directory install conventions (Eric Blake)
- Fix make uninstall (Dave Allan)
- qemu: Prepare to cater for more general address assignment (Michael Ellerman)
- qemu: Add address in qemuBuildChrDeviceStr() on pseries (Michael Ellerman)
- qemu: Use spapr-vscsi on pseries machine type (Michael Ellerman)
- network: allow '-' in model name (Eric Blake)
- cpu: Add cpu flags supported by newest qemu (Peter Krempa)
- Pass the VM's UUID into the nwfilter subsystem (Stefan Berger)
- nwfilter: cleanup return codes in nwfilter subsystem (Stefan Berger)
- spec: make it easier to autoreconf when building rpm (Eric Blake)
- Ensure to prefix %{buildroot} when overriding systemd install location (Daniel P. Berrange)
- Add ppc64 specific definitions to domain.rng (Bharata B Rao)
- Clean up qemuBuildCommandLine to remove x86-specific (Prerna Saxena)
- Modify the tests/nodeinfotest.c to use sysfs in addition (Prerna Saxena)
- Use sysfs to gather host topology, in place of (Prerna Saxena)
Cleanups:
- network_conf: Fix whitespace to pass syntax-check (Peter Krempa)
So thanks for everybody who contributed for this first release of
2012, please continue to send reports, ideas and patches :-) !
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
12 years, 10 months
[libvirt] [PATCH] tests: work around pdwtags 1.9 failure
by Eric Blake
On rawhide, gcc is new enough to output new DWARF information that
pdwtags has not yet learned, but the resulting 'make check' output
was rather confusing:
$ make -C src check
...
GEN virkeepaliveprotocol-structs
die__process_function: DW_TAG_INVALID (0x4109) @ <0x58c> not handled!
WARNING: your pdwtags program is too old
WARNING: skipping the virkeepaliveprotocol-structs test
WARNING: install dwarves-1.3 or newer
...
$ pdwtags --version
v1.9
I've filed the pdwtags deficiency as
https://bugzilla.redhat.com/show_bug.cgi?id=772358
* src/Makefile.am (PDWTAGS): Don't leave -t file behind on version
mismatch. Soften warning message, since 1.9 is newer than 1.3.
Don't leak stderr from broken version.
---
Although this feels pretty trivial, it's not quite a build-breaker
(everything still worked), so I'll await a review before pushing.
src/Makefile.am | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 93bf54c..0a1221a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
-## Copyright (C) 2005-2011 Red Hat, Inc.
+## Copyright (C) 2005-2012 Red Hat, Inc.
## See COPYING.LIB for the License of this software
# No libraries with the exception of LIBXML should be listed
@@ -248,8 +248,12 @@ struct_prefix = (remote_|qemu_|virNet|keepalive_)
PDWTAGS = \
$(AM_V_GEN)if (pdwtags --help) > /dev/null 2>&1; then \
- pdwtags --verbose $(<:.lo=.$(OBJEXT)) \
- | perl -0777 -n \
+ pdwtags --verbose $(<:.lo=.$(OBJEXT)) > $(@F)-t1 2> $(@F)-t2; \
+ if test -s $(@F)-t2; then \
+ rm -rf $(@F)-t?; \
+ echo 'WARNING: pdwtags appears broken; skipping the $@ test' >&2;\
+ else \
+ perl -0777 -n \
-e 'foreach my $$p (split m!\n*(?:$(r1)|$(r2))\n!) {' \
-e ' if ($$p =~ /^(struct|enum) $(struct_prefix)/ ||' \
-e ' $$p =~ /^enum {/) {' \
@@ -272,9 +276,10 @@ PDWTAGS = \
-e ' exit 8;' \
-e ' }' \
-e '}' \
- > $(@F)-t; \
- case $$? in 8) exit 0;; 0) ;; *) exit 1;; esac; \
- diff -u $(@F)-t $@; st=$$?; rm -f $(@F)-t; exit $$st; \
+ < $(@F)-t1 > $(@F)-t3; \
+ case $$? in 8) rm -f $(@F)-t?; exit 0;; 0) ;; *) exit 1;; esac;\
+ diff -u $(@F)-t3 $@; st=$$?; rm -f $(@F)-t?; exit $$st; \
+ fi; \
else \
echo 'WARNING: you lack pdwtags; skipping the $@ test' >&2; \
echo 'WARNING: install the dwarves package to get pdwtags' >&2; \
--
1.7.7.5
12 years, 10 months
[libvirt] [PATCH] build: fix mingw build
by Eric Blake
Commit db371a2 mistakenly added new functions inside a #ifdef WIN32
guard, even though they are needed on all platforms.
* src/util/command.c (virCommandFDSet): Move outside WIN32
conditional.
---
Pushing under the build-breaker rule.
src/util/command.c | 54 ++++++++++++++++++++++++++--------------------------
1 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/src/util/command.c b/src/util/command.c
index 9e03a55..f05493e 100644
--- a/src/util/command.c
+++ b/src/util/command.c
@@ -1,7 +1,7 @@
/*
* command.c: Child command execution
*
- * Copyright (C) 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2010-2012 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -105,32 +105,6 @@ struct _virCommand {
bool reap;
};
-#ifndef WIN32
-
-# if HAVE_CAPNG
-static int virClearCapabilities(void)
-{
- int ret;
-
- capng_clear(CAPNG_SELECT_BOTH);
-
- if ((ret = capng_apply(CAPNG_SELECT_BOTH)) < 0) {
- virCommandError(VIR_ERR_INTERNAL_ERROR,
- _("cannot clear process capabilities %d"), ret);
- return -1;
- }
-
- return 0;
-}
-# else
-static int virClearCapabilities(void)
-{
-// VIR_WARN("libcap-ng support not compiled in, unable to clear "
-// "capabilities");
- return 0;
-}
-# endif
-
/*
* virCommandFDIsSet:
* @fd: FD to test
@@ -191,6 +165,32 @@ virCommandFDSet(int fd,
return 0;
}
+#ifndef WIN32
+
+# if HAVE_CAPNG
+static int virClearCapabilities(void)
+{
+ int ret;
+
+ capng_clear(CAPNG_SELECT_BOTH);
+
+ if ((ret = capng_apply(CAPNG_SELECT_BOTH)) < 0) {
+ virCommandError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot clear process capabilities %d"), ret);
+ return -1;
+ }
+
+ return 0;
+}
+# else
+static int virClearCapabilities(void)
+{
+// VIR_WARN("libcap-ng support not compiled in, unable to clear "
+// "capabilities");
+ return 0;
+}
+# endif
+
/**
* virFork:
* @pid - a pointer to a pid_t that will receive the return value from
--
1.7.7.5
12 years, 10 months