[libvirt] [PATCH 0/2] RFC: make QEMU timeout monitor replies
by Daniel P. Berrange
This is an experimental patch to make QEMU timeout on monitor
replies after 30 seconds. I have only tested it to the extent
of booting a guest. Interested in whether people can get a
bogus timeout to occur in any testing they perform.
By 'bogus timeout', I mean libvirt reporting a timeout when
QEMU is still working correctly. Ideally we only timeout when
QEMU has been sent SIGSTOP, or has live-locked itself.
13 years, 6 months
[libvirt] Confusing valgrind error in virDomainLookupByUUIDString or virReportErrorHelper
by Richard W.M. Jones
libvirt-0.9.2-2.fc16.x86_64
Here's the error from valgrind:
==24953== Conditional jump or move depends on uninitialised value(s)
==24953== at 0x3DF68844BB: __GI___strcasecmp_l (strcmp.S:243)
==24953== by 0x3DF68221E1: __gconv_open (gconv_open.c:70)
==24953== by 0x3DF682F3E9: _nl_find_msg (dcigettext.c:974)
==24953== by 0x3DF682FB84: __dcigettext (dcigettext.c:640)
==24953== by 0x36BBE5A063: virReportErrorHelper (virterror.c:1215)
==24953== by 0x36BBEA3804: virDomainLookupByUUIDString (libvirt.c:2005)
==24953== by 0x4C9174C: guestfs__add_domain (virt.c:122)
==24953== by 0x4C4862B: guestfs_add_domain_argv (actions.c:2951)
==24953== by 0x42635A: add_libvirt_drives (virt.c:54)
==24953== by 0x4260D8: add_drives (options.c:69)
==24953== by 0x40B1F6: main (fish.c:422)
It appears to originate from this code:
src/libvirt.c:virDomainLookupByUUIDString:
if (virUUIDParse(uuidstr, uuid) < 0) {
2005 ** virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto error;
}
The macro at line 2005 expands to:
virReportErrorHelper(VIR_FROM_NONE, VIR_ERR_INVALID_ARG, __FILE__, \
__FUNCTION__, __LINE__, __FUNCTION__);
Apparently __FUNCTION__ is deprecated[1].
When virReportErrorHelper is called, the problem appears to be at this
line (virterror.c:1215):
virerr = virErrorMsg(errcode, (errorMessage[0] ? errorMessage : NULL));
Here, errcode == VIR_ERR_INVALID_ARG and errorMessage is presumably
the function name.
That's as far as I've got for today. Just letting people know ...
Rich.
[1] http://gcc.gnu.org/onlinedocs/gcc/Function-Names.html
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
13 years, 6 months
[libvirt] [PATCH] build: rename Vcpupin to VcpuPin
by Eric Blake
We already have a public virDomainPinVcpu, which implies that
Pin and Vcpu are treated as separate words. Commit e261987c
introduced virDomainGetVcpupinInfo as the first public API
that used Vcpupin, although we had prior internal uses of that
spelling. For consistency, change the spelling to be two
words everywhere, regardless of whether pin comes first or last.
* daemon/remote.c: Treat vcpu and pin as separate words.
* include/libvirt/libvirt.h.in: Likewise.
* src/conf/domain_conf.c: Likewise.
* src/conf/domain_conf.h: Likewise.
* src/driver.h: Likewise.
* src/libvirt.c: Likewise.
* src/libvirt_private.syms: Likewise.
* src/libvirt_public.syms: Likewise.
* src/libxl/libxl_driver.c: Likewise.
* src/qemu/qemu_driver.c: Likewise.
* src/remote/remote_driver.c: Likewise.
* src/xen/xend_internal.c: Likewise.
* tools/virsh.c: Likewise.
* src/remote/remote_protocol.x: Likewise.
* src/remote_protocol-structs: Likewise.
Suggested by Matthias Bolte.
---
In response to http://www.redhat.com/archives/libvir-list/2011-June/msg01292.html
daemon/remote.c | 8 ++++----
include/libvirt/libvirt.h.in | 2 +-
src/conf/domain_conf.c | 40 ++++++++++++++++++++--------------------
src/conf/domain_conf.h | 16 ++++++++--------
src/driver.h | 4 ++--
src/libvirt.c | 12 ++++++------
src/libvirt_private.syms | 8 ++++----
src/libvirt_public.syms | 2 +-
src/libxl/libxl_driver.c | 2 +-
src/qemu/qemu_driver.c | 14 +++++++-------
src/remote/remote_driver.c | 16 ++++++++--------
src/remote/remote_protocol.x | 6 +++---
src/remote_protocol-structs | 4 ++--
src/xen/xend_internal.c | 2 +-
tools/virsh.c | 10 +++++-----
15 files changed, 73 insertions(+), 73 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index aa726cf..56361ea 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1048,13 +1048,13 @@ cleanup:
}
static int
-remoteDispatchDomainGetVcpupinInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
+remoteDispatchDomainGetVcpuPinInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
- remote_domain_get_vcpupin_info_args *args,
- remote_domain_get_vcpupin_info_ret *ret)
+ remote_domain_get_vcpu_pin_info_args *args,
+ remote_domain_get_vcpu_pin_info_ret *ret)
{
virDomainPtr dom = NULL;
unsigned char *cpumaps = NULL;
@@ -1085,7 +1085,7 @@ remoteDispatchDomainGetVcpupinInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
VIR_ALLOC_N(cpumaps, args->ncpumaps * args->maplen) < 0)
goto no_memory;
- if ((num = virDomainGetVcpupinInfo(dom,
+ if ((num = virDomainGetVcpuPinInfo(dom,
args->ncpumaps,
cpumaps,
args->maplen,
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 4f9f158..82e15f2 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1266,7 +1266,7 @@ int virDomainPinVcpuFlags (virDomainPtr domain,
int maplen,
unsigned int flags);
-int virDomainGetVcpupinInfo (virDomainPtr domain,
+int virDomainGetVcpuPinInfo (virDomainPtr domain,
int ncpumaps,
unsigned char *cpumaps,
int maplen,
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3d290fb..60e0318 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -981,7 +981,7 @@ virDomainClockDefClear(virDomainClockDefPtr def)
}
static void
-virDomainVcpupinDefFree(virDomainVcpupinDefPtr *def,
+virDomainVcpuPinDefFree(virDomainVcpuPinDefPtr *def,
int nvcpupin)
{
int i;
@@ -1089,7 +1089,7 @@ void virDomainDefFree(virDomainDefPtr def)
virCPUDefFree(def->cpu);
- virDomainVcpupinDefFree(def->cputune.vcpupin, def->cputune.nvcpupin);
+ virDomainVcpuPinDefFree(def->cputune.vcpupin, def->cputune.nvcpupin);
VIR_FREE(def->numatune.memory.nodemask);
@@ -5647,13 +5647,13 @@ cleanup:
}
/* Parse the XML definition for a vcpupin */
-static virDomainVcpupinDefPtr
-virDomainVcpupinDefParseXML(const xmlNodePtr node,
+static virDomainVcpuPinDefPtr
+virDomainVcpuPinDefParseXML(const xmlNodePtr node,
xmlXPathContextPtr ctxt,
int maxvcpus,
int flags ATTRIBUTE_UNUSED)
{
- virDomainVcpupinDefPtr def;
+ virDomainVcpuPinDefPtr def;
xmlNodePtr oldnode = ctxt->node;
unsigned int vcpuid;
char *tmp = NULL;
@@ -5895,13 +5895,13 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
}
for (i = 0 ; i < n ; i++) {
- virDomainVcpupinDefPtr vcpupin = NULL;
- vcpupin = virDomainVcpupinDefParseXML(nodes[i], ctxt, def->maxvcpus, 0);
+ virDomainVcpuPinDefPtr vcpupin = NULL;
+ vcpupin = virDomainVcpuPinDefParseXML(nodes[i], ctxt, def->maxvcpus, 0);
if (!vcpupin)
goto error;
- if (virDomainVcpupinIsDuplicate(def->cputune.vcpupin,
+ if (virDomainVcpuPinIsDuplicate(def->cputune.vcpupin,
def->cputune.nvcpupin,
vcpupin->vcpuid)) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
@@ -8118,7 +8118,7 @@ virDomainCpuSetParse(const char **str, char sep,
/* Check if vcpupin with same vcpuid already exists.
* Return 1 if exists, 0 if not. */
int
-virDomainVcpupinIsDuplicate(virDomainVcpupinDefPtr *def,
+virDomainVcpuPinIsDuplicate(virDomainVcpuPinDefPtr *def,
int nvcpupin,
int vcpu)
{
@@ -8135,8 +8135,8 @@ virDomainVcpupinIsDuplicate(virDomainVcpupinDefPtr *def,
return 0;
}
-virDomainVcpupinDefPtr
-virDomainVcpupinFindByVcpu(virDomainVcpupinDefPtr *def,
+virDomainVcpuPinDefPtr
+virDomainVcpuPinFindByVcpu(virDomainVcpuPinDefPtr *def,
int nvcpupin,
int vcpu)
{
@@ -8154,13 +8154,13 @@ virDomainVcpupinFindByVcpu(virDomainVcpupinDefPtr *def,
}
int
-virDomainVcpupinAdd(virDomainDefPtr def,
+virDomainVcpuPinAdd(virDomainDefPtr def,
unsigned char *cpumap,
int maplen,
int vcpu)
{
- virDomainVcpupinDefPtr *vcpupin_list = NULL;
- virDomainVcpupinDefPtr vcpupin = NULL;
+ virDomainVcpuPinDefPtr *vcpupin_list = NULL;
+ virDomainVcpuPinDefPtr vcpupin = NULL;
char *cpumask = NULL;
int i;
@@ -8202,10 +8202,10 @@ virDomainVcpupinAdd(virDomainDefPtr def,
def->cputune.vcpupin = vcpupin_list;
} else {
- if (virDomainVcpupinIsDuplicate(def->cputune.vcpupin,
+ if (virDomainVcpuPinIsDuplicate(def->cputune.vcpupin,
def->cputune.nvcpupin,
vcpu)) {
- vcpupin = virDomainVcpupinFindByVcpu(def->cputune.vcpupin,
+ vcpupin = virDomainVcpuPinFindByVcpu(def->cputune.vcpupin,
def->cputune.nvcpupin,
vcpu);
vcpupin->vcpuid = vcpu;
@@ -8236,11 +8236,11 @@ cleanup:
}
int
-virDomainVcpupinDel(virDomainDefPtr def, int vcpu)
+virDomainVcpuPinDel(virDomainDefPtr def, int vcpu)
{
int n;
bool deleted = false;
- virDomainVcpupinDefPtr *vcpupin_list = def->cputune.vcpupin;
+ virDomainVcpuPinDefPtr *vcpupin_list = def->cputune.vcpupin;
/* No vcpupin exists yet */
if (!def->cputune.nvcpupin) {
@@ -8253,7 +8253,7 @@ virDomainVcpupinDel(virDomainDefPtr def, int vcpu)
VIR_FREE(vcpupin_list[n]);
memmove(&vcpupin_list[n],
&vcpupin_list[n+1],
- (def->cputune.nvcpupin - n - 1) * sizeof(virDomainVcpupinDef *));
+ (def->cputune.nvcpupin - n - 1) * sizeof(virDomainVcpuPinDef *));
deleted = true;
break;
}
@@ -8263,7 +8263,7 @@ virDomainVcpupinDel(virDomainDefPtr def, int vcpu)
return 0;
if (--def->cputune.nvcpupin == 0) {
- virDomainVcpupinDefFree(def->cputune.vcpupin, 0);
+ virDomainVcpuPinDefFree(def->cputune.vcpupin, 0);
} else {
if (VIR_REALLOC_N(def->cputune.vcpupin, def->cputune.nvcpupin) < 0) {
virReportOOMError();
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index aa25e36..e81977c 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1101,18 +1101,18 @@ void virDomainSnapshotObjListRemove(virDomainSnapshotObjListPtr snapshots,
int virDomainSnapshotHasChildren(virDomainSnapshotObjPtr snap,
virDomainSnapshotObjListPtr snapshots);
-typedef struct _virDomainVcpupinDef virDomainVcpupinDef;
-typedef virDomainVcpupinDef *virDomainVcpupinDefPtr;
-struct _virDomainVcpupinDef {
+typedef struct _virDomainVcpuPinDef virDomainVcpuPinDef;
+typedef virDomainVcpuPinDef *virDomainVcpuPinDefPtr;
+struct _virDomainVcpuPinDef {
int vcpuid;
char *cpumask;
};
-int virDomainVcpupinIsDuplicate(virDomainVcpupinDefPtr *def,
+int virDomainVcpuPinIsDuplicate(virDomainVcpuPinDefPtr *def,
int nvcpupin,
int vcpu);
-virDomainVcpupinDefPtr virDomainVcpupinFindByVcpu(virDomainVcpupinDefPtr *def,
+virDomainVcpuPinDefPtr virDomainVcpuPinFindByVcpu(virDomainVcpuPinDefPtr *def,
int nvcpupin,
int vcpu);
@@ -1171,7 +1171,7 @@ struct _virDomainDef {
struct {
unsigned long shares;
int nvcpupin;
- virDomainVcpupinDefPtr *vcpupin;
+ virDomainVcpuPinDefPtr *vcpupin;
} cputune;
virDomainNumatuneDef numatune;
@@ -1406,12 +1406,12 @@ int virDomainCpuSetParse(const char **str,
char *virDomainCpuSetFormat(char *cpuset,
int maxcpu);
-int virDomainVcpupinAdd(virDomainDefPtr def,
+int virDomainVcpuPinAdd(virDomainDefPtr def,
unsigned char *cpumap,
int maplen,
int vcpu);
-int virDomainVcpupinDel(virDomainDefPtr def, int vcpu);
+int virDomainVcpuPinDel(virDomainDefPtr def, int vcpu);
int virDomainDiskIndexByName(virDomainDefPtr def, const char *name);
int virDomainDiskInsert(virDomainDefPtr def,
diff --git a/src/driver.h b/src/driver.h
index c15d0dd..60cd556 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -240,7 +240,7 @@ typedef int
int maplen,
unsigned int flags);
typedef int
- (*virDrvDomainGetVcpupinInfo) (virDomainPtr domain,
+ (*virDrvDomainGetVcpuPinInfo) (virDomainPtr domain,
int ncpumaps,
unsigned char *cpumaps,
int maplen,
@@ -713,7 +713,7 @@ struct _virDriver {
virDrvDomainGetVcpusFlags domainGetVcpusFlags;
virDrvDomainPinVcpu domainPinVcpu;
virDrvDomainPinVcpuFlags domainPinVcpuFlags;
- virDrvDomainGetVcpupinInfo domainGetVcpupinInfo;
+ virDrvDomainGetVcpuPinInfo domainGetVcpuPinInfo;
virDrvDomainGetVcpus domainGetVcpus;
virDrvDomainGetMaxVcpus domainGetMaxVcpus;
virDrvDomainGetSecurityLabel domainGetSecurityLabel;
diff --git a/src/libvirt.c b/src/libvirt.c
index 46a448b..a3f3267 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -7061,7 +7061,7 @@ error:
* just live or both live and persistent state is changed.
* Not all hypervisors can support all flag combinations.
*
- * See also virDomainGetVcpupinInfo for querying this information.
+ * See also virDomainGetVcpuPinInfo for querying this information.
*
* Returns 0 in case of success, -1 in case of failure.
*
@@ -7112,7 +7112,7 @@ error:
}
/**
- * virDomainGetVcpupinInfo:
+ * virDomainGetVcpuPinInfo:
* @domain: pointer to domain object, or NULL for Domain0
* @ncpumaps: the number of cpumap (listed first to match virDomainGetVcpus)
* @cpumaps: pointer to a bit map of real CPUs for all vcpus of this
@@ -7136,7 +7136,7 @@ error:
* -1 in case of failure.
*/
int
-virDomainGetVcpupinInfo (virDomainPtr domain, int ncpumaps,
+virDomainGetVcpuPinInfo (virDomainPtr domain, int ncpumaps,
unsigned char *cpumaps, int maplen, unsigned int flags)
{
virConnectPtr conn;
@@ -7160,9 +7160,9 @@ virDomainGetVcpupinInfo (virDomainPtr domain, int ncpumaps,
conn = domain->conn;
- if (conn->driver->domainGetVcpupinInfo) {
+ if (conn->driver->domainGetVcpuPinInfo) {
int ret;
- ret = conn->driver->domainGetVcpupinInfo (domain, ncpumaps,
+ ret = conn->driver->domainGetVcpuPinInfo (domain, ncpumaps,
cpumaps, maplen, flags);
if (ret < 0)
goto error;
@@ -7197,7 +7197,7 @@ error:
* and also in cpumaps if this pointer isn't NULL. This call may fail
* on an inactive domain.
*
- * See also virDomainGetVcpupinInfo for querying just cpumaps, including on
+ * See also virDomainGetVcpuPinInfo for querying just cpumaps, including on
* an inactive domain.
*
* Returns the number of info filled in case of success, -1 in case of failure.
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index afe9835..054c074 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -366,10 +366,10 @@ virDomainTimerTickpolicyTypeFromString;
virDomainTimerTickpolicyTypeToString;
virDomainTimerTrackTypeFromString;
virDomainTimerTrackTypeToString;
-virDomainVcpupinAdd;
-virDomainVcpupinDel;
-virDomainVcpupinFindByVcpu;
-virDomainVcpupinIsDuplicate;
+virDomainVcpuPinAdd;
+virDomainVcpuPinDel;
+virDomainVcpuPinFindByVcpu;
+virDomainVcpuPinIsDuplicate;
virDomainVideoDefFree;
virDomainVideoDefaultRAM;
virDomainVideoDefaultType;
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index c7dc3c5..5f2541a 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -453,7 +453,7 @@ LIBVIRT_0.9.2 {
LIBVIRT_0.9.3 {
global:
virDomainGetControlInfo;
- virDomainGetVcpupinInfo;
+ virDomainGetVcpuPinInfo;
virDomainPinVcpuFlags;
virDomainSendKey;
virEventAddHandle;
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 5a5951f..7fd257d 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -2393,7 +2393,7 @@ libxlDomainPinVcpu(virDomainPtr dom, unsigned int vcpu, unsigned char *cpumap,
goto cleanup;
}
- if (virDomainVcpupinAdd(vm->def, cpumap, maplen, vcpu) < 0) {
+ if (virDomainVcpuPinAdd(vm->def, cpumap, maplen, vcpu) < 0) {
libxlError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to update or add vcpupin xml"));
goto cleanup;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d9099d5..c291e16 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3109,14 +3109,14 @@ qemudDomainPinVcpuFlags(virDomainPtr dom,
}
if (canResetting) {
- if (virDomainVcpupinDel(vm->def, vcpu) < 0) {
+ if (virDomainVcpuPinDel(vm->def, vcpu) < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("failed to delete vcpupin xml of "
"a running domain"));
goto cleanup;
}
} else {
- if (virDomainVcpupinAdd(vm->def, cpumap, maplen, vcpu) < 0) {
+ if (virDomainVcpuPinAdd(vm->def, cpumap, maplen, vcpu) < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("failed to update or add vcpupin xml of "
"a running domain"));
@@ -3129,14 +3129,14 @@ qemudDomainPinVcpuFlags(virDomainPtr dom,
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
if (canResetting) {
- if (virDomainVcpupinDel(persistentDef, vcpu) < 0) {
+ if (virDomainVcpuPinDel(persistentDef, vcpu) < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("failed to delete vcpupin xml of "
"a persistent domain"));
goto cleanup;
}
} else {
- if (virDomainVcpupinAdd(persistentDef, cpumap, maplen, vcpu) < 0) {
+ if (virDomainVcpuPinAdd(persistentDef, cpumap, maplen, vcpu) < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("failed to update or add vcpupin xml of "
"a persistent domain"));
@@ -3166,7 +3166,7 @@ qemudDomainPinVcpu(virDomainPtr dom,
}
static int
-qemudDomainGetVcpupinInfo(virDomainPtr dom,
+qemudDomainGetVcpuPinInfo(virDomainPtr dom,
int ncpumaps,
unsigned char *cpumaps,
int maplen,
@@ -3180,7 +3180,7 @@ qemudDomainGetVcpupinInfo(virDomainPtr dom,
bool isActive;
int maxcpu, hostcpus, vcpu, pcpu;
int n;
- virDomainVcpupinDefPtr *vcpupin_list;
+ virDomainVcpuPinDefPtr *vcpupin_list;
char *cpumask = NULL;
unsigned char *cpumap;
@@ -8446,7 +8446,7 @@ static virDriver qemuDriver = {
.domainGetVcpusFlags = qemudDomainGetVcpusFlags, /* 0.8.5 */
.domainPinVcpu = qemudDomainPinVcpu, /* 0.4.4 */
.domainPinVcpuFlags = qemudDomainPinVcpuFlags, /* 0.9.3 */
- .domainGetVcpupinInfo = qemudDomainGetVcpupinInfo, /* 0.9.3 */
+ .domainGetVcpuPinInfo = qemudDomainGetVcpuPinInfo, /* 0.9.3 */
.domainGetVcpus = qemudDomainGetVcpus, /* 0.4.4 */
.domainGetMaxVcpus = qemudDomainGetMaxVcpus, /* 0.4.4 */
.domainGetSecurityLabel = qemudDomainGetSecurityLabel, /* 0.6.1 */
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 84a5eab..ac00128 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2142,7 +2142,7 @@ done:
}
static int
-remoteDomainGetVcpupinInfo (virDomainPtr domain,
+remoteDomainGetVcpuPinInfo (virDomainPtr domain,
int ncpumaps,
unsigned char *cpumaps,
int maplen,
@@ -2150,8 +2150,8 @@ remoteDomainGetVcpupinInfo (virDomainPtr domain,
{
int rv = -1;
int i;
- remote_domain_get_vcpupin_info_args args;
- remote_domain_get_vcpupin_info_ret ret;
+ remote_domain_get_vcpu_pin_info_args args;
+ remote_domain_get_vcpu_pin_info_ret ret;
struct private_data *priv = domain->conn->privateData;
remoteDriverLock(priv);
@@ -2178,10 +2178,10 @@ remoteDomainGetVcpupinInfo (virDomainPtr domain,
memset (&ret, 0, sizeof ret);
- if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_VCPUPIN_INFO,
- (xdrproc_t) xdr_remote_domain_get_vcpupin_info_args,
+ if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_VCPU_PIN_INFO,
+ (xdrproc_t) xdr_remote_domain_get_vcpu_pin_info_args,
(char *) &args,
- (xdrproc_t) xdr_remote_domain_get_vcpupin_info_ret,
+ (xdrproc_t) xdr_remote_domain_get_vcpu_pin_info_ret,
(char *) &ret) == -1)
goto done;
@@ -2207,7 +2207,7 @@ remoteDomainGetVcpupinInfo (virDomainPtr domain,
rv = ret.num;
cleanup:
- xdr_free ((xdrproc_t) xdr_remote_domain_get_vcpupin_info_ret, (char *) &ret);
+ xdr_free ((xdrproc_t) xdr_remote_domain_get_vcpu_pin_info_ret, (char *) &ret);
done:
remoteDriverUnlock(priv);
@@ -6465,7 +6465,7 @@ static virDriver remote_driver = {
.domainGetVcpusFlags = remoteDomainGetVcpusFlags, /* 0.8.5 */
.domainPinVcpu = remoteDomainPinVcpu, /* 0.3.0 */
.domainPinVcpuFlags = remoteDomainPinVcpuFlags, /* 0.9.3 */
- .domainGetVcpupinInfo = remoteDomainGetVcpupinInfo, /* 0.9.3 */
+ .domainGetVcpuPinInfo = remoteDomainGetVcpuPinInfo, /* 0.9.3 */
.domainGetVcpus = remoteDomainGetVcpus, /* 0.3.0 */
.domainGetMaxVcpus = remoteDomainGetMaxVcpus, /* 0.3.0 */
.domainGetSecurityLabel = remoteDomainGetSecurityLabel, /* 0.6.1 */
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index ee08b82..65a4432 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -903,14 +903,14 @@ struct remote_domain_pin_vcpu_flags_args {
unsigned int flags;
};
-struct remote_domain_get_vcpupin_info_args {
+struct remote_domain_get_vcpu_pin_info_args {
remote_nonnull_domain dom;
int ncpumaps;
int maplen;
unsigned int flags;
};
-struct remote_domain_get_vcpupin_info_ret {
+struct remote_domain_get_vcpu_pin_info_ret {
opaque cpumaps<REMOTE_CPUMAPS_MAX>;
int num;
};
@@ -2392,7 +2392,7 @@ enum remote_procedure {
REMOTE_PROC_NODE_GET_CPU_STATS = 227, /* skipgen skipgen */
REMOTE_PROC_NODE_GET_MEMORY_STATS = 228, /* skipgen skipgen */
REMOTE_PROC_DOMAIN_GET_CONTROL_INFO = 229, /* autogen autogen */
- REMOTE_PROC_DOMAIN_GET_VCPUPIN_INFO = 230 /* skipgen skipgen */
+ REMOTE_PROC_DOMAIN_GET_VCPU_PIN_INFO = 230 /* skipgen skipgen */
/*
* Notice how the entries are grouped in sets of 10 ?
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index be98135..c07ba81 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -580,13 +580,13 @@ struct remote_domain_pin_vcpu_flags_args {
} cpumap;
u_int flags;
};
-struct remote_domain_get_vcpupin_info_args {
+struct remote_domain_get_vcpu_pin_info_args {
remote_nonnull_domain dom;
int ncpumaps;
int maplen;
u_int flags;
};
-struct remote_domain_get_vcpupin_info_ret {
+struct remote_domain_get_vcpu_pin_info_ret {
struct {
u_int cpumaps_len;
char * cpumaps_val;
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index f94dd8b..d418847 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -2332,7 +2332,7 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
goto cleanup;
if (ret == 0) {
- if (virDomainVcpupinAdd(def, cpumap, maplen, vcpu) < 0) {
+ if (virDomainVcpuPinAdd(def, cpumap, maplen, vcpu) < 0) {
virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to add vcpupin xml entry"));
return (-1);
diff --git a/tools/virsh.c b/tools/virsh.c
index 31fbeb7..8e6439f 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -2962,11 +2962,11 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
}
} else {
if (info.state == VIR_DOMAIN_SHUTOFF &&
- (ncpus = virDomainGetVcpupinInfo(dom, info.nrVirtCpu,
+ (ncpus = virDomainGetVcpuPinInfo(dom, info.nrVirtCpu,
cpumaps, cpumaplen,
VIR_DOMAIN_AFFECT_CONFIG)) >= 0) {
- /* fallback plan to use virDomainGetVcpupinInfo */
+ /* fallback plan to use virDomainGetVcpuPinInfo */
for (n = 0; n < ncpus; n++) {
vshPrint(ctl, "%-15s %d\n", _("VCPU:"), n);
@@ -3015,7 +3015,7 @@ static const vshCmdOptDef opts_vcpupin[] = {
};
static bool
-cmdVcpupin(vshControl *ctl, const vshCmd *cmd)
+cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
{
virDomainInfo info;
virDomainPtr dom;
@@ -3101,7 +3101,7 @@ cmdVcpupin(vshControl *ctl, const vshCmd *cmd)
flags = VIR_DOMAIN_AFFECT_CURRENT;
cpumaps = vshMalloc(ctl, info.nrVirtCpu * cpumaplen);
- if ((ncpus = virDomainGetVcpupinInfo(dom, info.nrVirtCpu,
+ if ((ncpus = virDomainGetVcpuPinInfo(dom, info.nrVirtCpu,
cpumaps, cpumaplen, flags)) >= 0) {
vshPrint(ctl, "%s %s\n", _("VCPU:"), _("CPU Affinity"));
@@ -11674,7 +11674,7 @@ static const vshCmdDef domManagementCmds[] = {
info_update_device, 0},
{"vcpucount", cmdVcpucount, opts_vcpucount, info_vcpucount, 0},
{"vcpuinfo", cmdVcpuinfo, opts_vcpuinfo, info_vcpuinfo, 0},
- {"vcpupin", cmdVcpupin, opts_vcpupin, info_vcpupin, 0},
+ {"vcpupin", cmdVcpuPin, opts_vcpupin, info_vcpupin, 0},
{"version", cmdVersion, opts_version, info_version, 0},
{"vncdisplay", cmdVNCDisplay, opts_vncdisplay, info_vncdisplay, 0},
{NULL, NULL, NULL, NULL, 0}
--
1.7.4.4
13 years, 6 months
[libvirt] [PATCH] Only include parthelper if built with storage_disk
by Ruben Kerkhof
Parthelper is only compiled if both --with-libvirtd
and --with-storage-disk are set.
Signed-off-by: Ruben Kerkhof <ruben(a)rubenkerkhof.com>
---
libvirt.spec.in | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 11b8591..0111519 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1016,7 +1016,10 @@ fi
%attr(0755, root, root) %{_libexecdir}/libvirt_lxc
%endif
+%if %{with_storage_disk}
%attr(0755, root, root) %{_libexecdir}/libvirt_parthelper
+%endif
+
%attr(0755, root, root) %{_libexecdir}/libvirt_iohelper
%attr(0755, root, root) %{_sbindir}/libvirtd
--
1.7.5.4
13 years, 6 months
[libvirt] sysinfo: cleanup function/struct names.
by Minoru Usui
Fix lack of 'virSysinfo' prefix of functions/structs in src/util/sysinfo.[ch]
diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
index fab4f06..3ff834e 100644
Signed-off-by: Minoru Usui <usui(a)mxm.nes.nec.co.jp>
---
src/util/sysinfo.c | 44 ++++++++++++++++++++++++--------------------
src/util/sysinfo.h | 16 ++++++++--------
2 files changed, 32 insertions(+), 28 deletions(-)
diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
index fab4f06..31ebdc2 100644
--- a/src/util/sysinfo.c
+++ b/src/util/sysinfo.c
@@ -128,7 +128,7 @@ virSysinfoRead(void) {
#else /* !WIN32 */
static char *
-parseBIOSInfo(char *base, virSysinfoDefPtr ret)
+virSysinfoParseBIOS(char *base, virSysinfoDefPtr ret)
{
char *cur, *eol;
@@ -164,7 +164,7 @@ no_memory:
}
static char *
-parseSystemInfo(char *base, virSysinfoDefPtr ret)
+virSysinfoParseSystem(char *base, virSysinfoDefPtr ret)
{
char *cur, *eol;
@@ -222,10 +222,10 @@ no_memory:
}
static char *
-parseProcessorInfo(char *base, virSysinfoDefPtr ret)
+virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
{
char *cur, *eol, *tmp_base;
- virProcessorinfoDefPtr processor;
+ virSysinfoProcessorDefPtr processor;
while((tmp_base = strstr(base, "Processor Information")) != NULL) {
base = tmp_base;
@@ -323,10 +323,10 @@ no_memory:
}
static char *
-parseMemoryDeviceInfo(char *base, virSysinfoDefPtr ret)
+virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
{
char *cur, *eol, *tmp_base;
- virMemoryDeviceinfoDefPtr memory;
+ virSysinfoMemoryDefPtr memory;
while ((tmp_base = strstr(base, "Memory Device")) != NULL) {
base = tmp_base;
@@ -452,20 +452,20 @@ virSysinfoRead(void) {
base = outbuf;
- if ((base = parseBIOSInfo(base, ret)) == NULL)
+ if ((base = virSysinfoParseBIOS(base, ret)) == NULL)
goto no_memory;
- if ((base = parseSystemInfo(base, ret)) == NULL)
+ if ((base = virSysinfoParseSystem(base, ret)) == NULL)
goto no_memory;
ret->nprocessor = 0;
ret->processor = NULL;
- if ((base = parseProcessorInfo(base, ret)) == NULL)
+ if ((base = virSysinfoParseProcessor(base, ret)) == NULL)
goto no_memory;
ret->nmemory = 0;
ret->memory = NULL;
- if ((base = parseMemoryDeviceInfo(base, ret)) == NULL)
+ if ((base = virSysinfoParseMemory(base, ret)) == NULL)
goto no_memory;
cleanup:
@@ -484,7 +484,8 @@ no_memory:
#endif /* !WIN32 */
static void
-BIOSInfoFormat(virSysinfoDefPtr def, const char *prefix, virBufferPtr buf)
+virSysinfoBIOSFormat(virSysinfoDefPtr def, const char *prefix,
+ virBufferPtr buf)
{
int len = strlen(prefix);
@@ -522,7 +523,8 @@ BIOSInfoFormat(virSysinfoDefPtr def, const char *prefix, virBufferPtr buf)
}
static void
-SystemInfoFormat(virSysinfoDefPtr def, const char *prefix, virBufferPtr buf)
+virSysinfoSystemFormat(virSysinfoDefPtr def, const char *prefix,
+ virBufferPtr buf)
{
int len = strlen(prefix);
@@ -580,11 +582,12 @@ SystemInfoFormat(virSysinfoDefPtr def, const char *prefix, virBufferPtr buf)
}
static void
-ProcessorInfoFormat(virSysinfoDefPtr def, const char *prefix, virBufferPtr buf)
+virSysinfoProcessorFormat(virSysinfoDefPtr def, const char *prefix,
+ virBufferPtr buf)
{
int i;
int len = strlen(prefix);
- virProcessorinfoDefPtr processor;
+ virSysinfoProcessorDefPtr processor;
for (i = 0; i < def->nprocessor; i++) {
processor = &def->processor[i];
@@ -675,11 +678,12 @@ ProcessorInfoFormat(virSysinfoDefPtr def, const char *prefix, virBufferPtr buf)
}
static void
-MemoryDeviceInfoFormat(virSysinfoDefPtr def, const char *prefix, virBufferPtr buf)
+virSysinfoMemoryFormat(virSysinfoDefPtr def, const char *prefix,
+ virBufferPtr buf)
{
int i;
int len = strlen(prefix);
- virMemoryDeviceinfoDefPtr memory;
+ virSysinfoMemoryDefPtr memory;
for (i = 0; i < def->nmemory; i++) {
memory = &def->memory[i];
@@ -785,10 +789,10 @@ virSysinfoFormat(virSysinfoDefPtr def, const char *prefix)
virBufferAsprintf(&buf, "%s<sysinfo type='%s'>\n", prefix, type);
- BIOSInfoFormat(def, prefix, &buf);
- SystemInfoFormat(def, prefix, &buf);
- ProcessorInfoFormat(def, prefix, &buf);
- MemoryDeviceInfoFormat(def, prefix, &buf);
+ virSysinfoBIOSFormat(def, prefix, &buf);
+ virSysinfoSystemFormat(def, prefix, &buf);
+ virSysinfoProcessorFormat(def, prefix, &buf);
+ virSysinfoMemoryFormat(def, prefix, &buf);
virBufferAsprintf(&buf, "%s</sysinfo>\n", prefix);
diff --git a/src/util/sysinfo.h b/src/util/sysinfo.h
index a15c5ac..86fd20f 100644
--- a/src/util/sysinfo.h
+++ b/src/util/sysinfo.h
@@ -33,9 +33,9 @@ enum virSysinfoType {
VIR_SYSINFO_LAST
};
-typedef struct _virProcessorinfoDef virProcessorinfoDef;
-typedef virProcessorinfoDef *virProcessorinfoDefPtr;
-struct _virProcessorinfoDef {
+typedef struct _virSysinfoProcessorDef virSysinfoProcessorDef;
+typedef virSysinfoProcessorDef *virSysinfoProcessorDefPtr;
+struct _virSysinfoProcessorDef {
char *processor_socket_destination;
char *processor_type;
char *processor_family;
@@ -49,9 +49,9 @@ struct _virProcessorinfoDef {
char *processor_part_number;
};
-typedef struct _virMemoryDeviceinfoDef virMemoryDeviceinfoDef;
-typedef virMemoryDeviceinfoDef *virMemoryDeviceinfoDefPtr;
-struct _virMemoryDeviceinfoDef {
+typedef struct _virSysinfoMemoryDef virSysinfoMemoryDef;
+typedef virSysinfoMemoryDef *virSysinfoMemoryDefPtr;
+struct _virSysinfoMemoryDef {
char *memory_size;
char *memory_form_factor;
char *memory_locator;
@@ -83,10 +83,10 @@ struct _virSysinfoDef {
char *system_family;
size_t nprocessor;
- virProcessorinfoDefPtr processor;
+ virSysinfoProcessorDefPtr processor;
size_t nmemory;
- virMemoryDeviceinfoDefPtr memory;
+ virSysinfoMemoryDefPtr memory;
};
virSysinfoDefPtr virSysinfoRead(void);
--
1.7.1
--
Minoru Usui <usui(a)mxm.nes.nec.co.jp>
13 years, 6 months
[libvirt] sysinfo: fix lack of error check in virSysinfoFormat().
by Minoru Usui
Fix lack of error check in virSysinfoFormat().
Signed-off-by: Minoru Usui <usui(a)mxm.nes.nec.co.jp>
---
src/util/sysinfo.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
index 31ebdc2..bff1cb8 100644
--- a/src/util/sysinfo.c
+++ b/src/util/sysinfo.c
@@ -796,6 +796,11 @@ virSysinfoFormat(virSysinfoDefPtr def, const char *prefix)
virBufferAsprintf(&buf, "%s</sysinfo>\n", prefix);
+ if (virBufferError(&buf)) {
+ virReportOOMError();
+ return NULL;
+ }
+
return virBufferContentAndReset(&buf);
}
--
1.7.1
--
Minoru Usui <usui(a)mxm.nes.nec.co.jp>
13 years, 6 months
[libvirt] [PATCH v2] tests: Partly fix networkxml2argvtest being configure result dependent
by Matthias Bolte
Convert networkDnsmasqLeaseFileName to a replaceable function pointer
that allow the testsuite to use a version of that function that is not
depending on configure --localstatedir.
This fixes 5 of 6 test failures, when configure --localstatedir isn't
set to /var.
---
The last failure is related to networkBuildDhcpDaemonCommandLine
trying to indirectly write dnsmasq config files to disk. This needs
a larger rewrite to separate the config file writing out of
networkBuildDhcpDaemonCommandLine.
src/network/bridge_driver.c | 5 ++++-
src/network/bridge_driver.h | 5 +++++
tests/networkxml2argvtest.c | 13 +++++++++++++
3 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 1b11132..d009627 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -108,7 +108,7 @@ static void networkReloadIptablesRules(struct network_driver *driver);
static struct network_driver *driverState = NULL;
static char *
-networkDnsmasqLeaseFileName(const char *netname)
+networkDnsmasqLeaseFileNameDefault(const char *netname)
{
char *leasefile;
@@ -117,6 +117,9 @@ networkDnsmasqLeaseFileName(const char *netname)
return leasefile;
}
+networkDnsmasqLeaseFileNameFunc networkDnsmasqLeaseFileName =
+ networkDnsmasqLeaseFileNameDefault;
+
static char *
networkRadvdPidfileBasename(const char *netname)
{
diff --git a/src/network/bridge_driver.h b/src/network/bridge_driver.h
index 8d82b67..a106e3d 100644
--- a/src/network/bridge_driver.h
+++ b/src/network/bridge_driver.h
@@ -34,4 +34,9 @@
int networkRegister(void);
int networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network, virCommandPtr *cmdout, char *pidfile);
+typedef char *(*networkDnsmasqLeaseFileNameFunc)(const char *netname);
+
+/* this allows the testsuite to replace the lease filename resolver function */
+extern networkDnsmasqLeaseFileNameFunc networkDnsmasqLeaseFileName;
+
#endif /* __VIR_NETWORK__DRIVER_H */
diff --git a/tests/networkxml2argvtest.c b/tests/networkxml2argvtest.c
index 16d57a9..62de191 100644
--- a/tests/networkxml2argvtest.c
+++ b/tests/networkxml2argvtest.c
@@ -85,11 +85,24 @@ cleanup:
return result;
}
+static char *
+testDnsmasqLeaseFileName(const char *netname)
+{
+ char *leasefile;
+
+ virAsprintf(&leasefile, "/var/lib/libvirt/dnsmasq/%s.leases",
+ netname);
+
+ return leasefile;
+}
+
static int
mymain(void)
{
int ret = 0;
+ networkDnsmasqLeaseFileName = testDnsmasqLeaseFileName;
+
#define DO_TEST(name) \
if (virtTestRun("Network XML-2-Argv " name, \
1, testCompareXMLToArgvHelper, (name)) < 0) \
--
1.7.0.4
13 years, 6 months
[libvirt] [PATCH] qemu: Remove bogus error codes for NUMA memory tuning
by Osier Yang
This is no code between virSaveLastError and virGetLastError will
set an error, remove the bogus codes.
---
src/qemu/qemu_process.c | 33 ---------------------------------
1 files changed, 0 insertions(+), 33 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index bb83be0..6c2492a 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1251,8 +1251,6 @@ static int
qemuProcessInitNumaMemoryPolicy(virDomainObjPtr vm)
{
nodemask_t mask;
- virErrorPtr orig_err = NULL;
- virErrorPtr err = NULL;
int mode = -1;
int node = -1;
int ret = -1;
@@ -1291,23 +1289,12 @@ qemuProcessInitNumaMemoryPolicy(virDomainObjPtr vm)
}
}
- orig_err = virSaveLastError();
mode = vm->def->numatune.memory.mode;
if (mode == VIR_DOMAIN_NUMATUNE_MEM_STRICT) {
numa_set_bind_policy(1);
numa_set_membind(&mask);
numa_set_bind_policy(0);
-
- err = virGetLastError();
- if ((err && (err->code != orig_err->code)) ||
- (err && !orig_err)) {
- qemuReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to bind memory to specified nodeset: %s"),
- err ? err->message : _("unknown error"));
- virResetLastError();
- goto cleanup;
- }
} else if (mode == VIR_DOMAIN_NUMATUNE_MEM_PREFERRED) {
int nnodes = 0;
for (i = 0; i < NUMA_NUM_NODES; i++) {
@@ -1326,28 +1313,8 @@ qemuProcessInitNumaMemoryPolicy(virDomainObjPtr vm)
numa_set_bind_policy(0);
numa_set_preferred(node);
-
- err = virGetLastError();
- if ((err && (err->code != orig_err->code)) ||
- (err && !orig_err)) {
- qemuReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to set memory policy as preferred to specified "
- "node: %s"), err ? err->message : _("unknown error"));
- virResetLastError();
- goto cleanup;
- }
} else if (mode == VIR_DOMAIN_NUMATUNE_MEM_INTERLEAVE) {
numa_set_interleave_mask(&mask);
-
- err = virGetLastError();
- if ((err && (err->code != orig_err->code)) ||
- (err && !orig_err)) {
- qemuReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to interleave memory to specified nodeset: %s"),
- err ? err->message : _("unknown error"));
- virResetLastError();
- goto cleanup;
- }
} else {
/* XXX: Shouldn't go here, as we already do checking when
* parsing domain XML.
--
1.7.4
13 years, 6 months
[libvirt] [PATCH] network: fix indentation in networkBuildDnsmasqArgv
by Laine Stump
This block was inadvertently added with the wrong indentation.
---
src/network/bridge_driver.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 1b11132..f15a7a6 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -614,14 +614,13 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
if (ipdef->nranges || ipdef->nhosts)
virCommandAddArg(cmd, "--dhcp-no-override");
- if ((dctx = networkSaveDnsmasqHostsfile(ipdef, network->def->dns, network->def->name, false))) {
- if (dctx->hostsfile->nhosts)
- virCommandAddArgPair(cmd, "--dhcp-hostsfile",
- dctx->hostsfile->path);
- if (dctx->addnhostsfile->nhosts)
- virCommandAddArgPair(cmd, "--addn-hosts",
- dctx->addnhostsfile->path);
-
+ if ((dctx = networkSaveDnsmasqHostsfile(ipdef, network->def->dns, network->def->name, false))) {
+ if (dctx->hostsfile->nhosts)
+ virCommandAddArgPair(cmd, "--dhcp-hostsfile",
+ dctx->hostsfile->path);
+ if (dctx->addnhostsfile->nhosts)
+ virCommandAddArgPair(cmd, "--addn-hosts",
+ dctx->addnhostsfile->path);
dnsmasqContextFree(dctx);
}
--
1.7.3.4
13 years, 6 months
[libvirt] [PATCH] tests: Handle networkxml2argvtest being configure --localstatedir dependant
by Matthias Bolte
networkxml2argvtest indirectly calls networkDnsmasqLeaseFileName
that depends on configure --localstatedir. Therefore, the .argv
files used in the test have to be created with this localstatedir.
Move the .argv to .argv.in files with a @localstatedir@ placeholder.
---
tests/.gitignore | 1 +
tests/Makefile.am | 13 ++++++++++++-
...lated-network.argv => isolated-network.argv.in} | 2 +-
...ns-hosts.argv => nat-network-dns-hosts.argv.in} | 2 +-
...ord.argv => nat-network-dns-txt-record.argv.in} | 2 +-
.../{nat-network.argv => nat-network.argv.in} | 2 +-
...etboot-network.argv => netboot-network.argv.in} | 2 +-
...-network.argv => netboot-proxy-network.argv.in} | 2 +-
...{routed-network.argv => routed-network.argv.in} | 0
9 files changed, 19 insertions(+), 7 deletions(-)
rename tests/networkxml2argvdata/{isolated-network.argv => isolated-network.argv.in} (68%)
rename tests/networkxml2argvdata/{nat-network-dns-hosts.argv => nat-network-dns-hosts.argv.in} (64%)
rename tests/networkxml2argvdata/{nat-network-dns-txt-record.argv => nat-network-dns-txt-record.argv.in} (84%)
rename tests/networkxml2argvdata/{nat-network.argv => nat-network.argv.in} (83%)
rename tests/networkxml2argvdata/{netboot-network.argv => netboot-network.argv.in} (80%)
rename tests/networkxml2argvdata/{netboot-proxy-network.argv => netboot-proxy-network.argv.in} (79%)
rename tests/networkxml2argvdata/{routed-network.argv => routed-network.argv.in} (100%)
diff --git a/tests/.gitignore b/tests/.gitignore
index 7f26dd7..be8d321 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -10,6 +10,7 @@ conftest
esxutilstest
eventtest
interfacexml2xmltest
+networkxml2argvdata/*.argv
networkxml2xmltest
nodedevxml2xmltest
nodeinfotest
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7db9d1f..3c4b7ee 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -50,7 +50,8 @@ EXTRA_DIST = \
networkschematest \
networkxml2xmlin \
networkxml2xmlout \
- networkxml2argvdata \
+ $(wildcard networkxml2argvdata/*.argv.in) \
+ $(wildcard networkxml2argvdata/*.xml) \
nodedevschemadata \
nodedevschematest \
nodeinfodata \
@@ -358,10 +359,20 @@ networkxml2xmltest_SOURCES = \
testutils.c testutils.h
networkxml2xmltest_LDADD = $(LDADDS)
+networkxml2argvdata_argv_in = $(wildcard networkxml2argvdata/*.argv.in)
+networkxml2argvdata_argv = $(networkxml2argvdata_argv_in:%.argv.in=%.argv)
+
networkxml2argvtest_SOURCES = \
networkxml2argvtest.c \
testutils.c testutils.h
networkxml2argvtest_LDADD = ../src/libvirt_driver_network.la $(LDADDS)
+networkxml2argvtest_DEPENDENCIES = $(networkxml2argvdata_argv)
+
+$(srcdir)/networkxml2argvdata/%.argv: $(srcdir)/networkxml2argvdata/%.argv.in
+ $(AM_V_GEN)sed \
+ -e 's![@]localstatedir[@]!$(localstatedir)!g' \
+ < $< > $@-t && \
+ mv $@-t $@
nwfilterxml2xmltest_SOURCES = \
nwfilterxml2xmltest.c \
diff --git a/tests/networkxml2argvdata/isolated-network.argv b/tests/networkxml2argvdata/isolated-network.argv.in
similarity index 68%
rename from tests/networkxml2argvdata/isolated-network.argv
rename to tests/networkxml2argvdata/isolated-network.argv.in
index f801396..c05768d 100644
--- a/tests/networkxml2argvdata/isolated-network.argv
+++ b/tests/networkxml2argvdata/isolated-network.argv.in
@@ -1,5 +1,5 @@
/usr/sbin/dnsmasq --strict-order --bind-interfaces --conf-file= \
--except-interface lo --dhcp-option=3 --listen-address 192.168.152.1 \
--dhcp-range 192.168.152.2,192.168.152.254 \
---dhcp-leasefile=/var/lib/libvirt/dnsmasq/private.leases --dhcp-lease-max=253 \
+--dhcp-leasefile=@localstatedir(a)/lib/libvirt/dnsmasq/private.leases --dhcp-lease-max=253 \
--dhcp-no-override\
diff --git a/tests/networkxml2argvdata/nat-network-dns-hosts.argv b/tests/networkxml2argvdata/nat-network-dns-hosts.argv.in
similarity index 64%
rename from tests/networkxml2argvdata/nat-network-dns-hosts.argv
rename to tests/networkxml2argvdata/nat-network-dns-hosts.argv.in
index dce075b..5545f9f 100644
--- a/tests/networkxml2argvdata/nat-network-dns-hosts.argv
+++ b/tests/networkxml2argvdata/nat-network-dns-hosts.argv.in
@@ -1,3 +1,3 @@
/usr/sbin/dnsmasq --strict-order --bind-interfaces --conf-file= \
--except-interface lo --listen-address 192.168.122.1 \
---addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts\
+--addn-hosts=@localstatedir(a)/lib/libvirt/dnsmasq/default.addnhosts\
diff --git a/tests/networkxml2argvdata/nat-network-dns-txt-record.argv b/tests/networkxml2argvdata/nat-network-dns-txt-record.argv.in
similarity index 84%
rename from tests/networkxml2argvdata/nat-network-dns-txt-record.argv
rename to tests/networkxml2argvdata/nat-network-dns-txt-record.argv.in
index 9d74543..f799634 100644
--- a/tests/networkxml2argvdata/nat-network-dns-txt-record.argv
+++ b/tests/networkxml2argvdata/nat-network-dns-txt-record.argv.in
@@ -4,5 +4,5 @@
--listen-address 2001:db8:ac10:fe01::1 \
--listen-address 2001:db8:ac10:fd01::1 --listen-address 10.24.10.1 \
--dhcp-range 192.168.122.2,192.168.122.254 \
---dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases \
+--dhcp-leasefile=@localstatedir(a)/lib/libvirt/dnsmasq/default.leases \
--dhcp-lease-max=253 --dhcp-no-override\
diff --git a/tests/networkxml2argvdata/nat-network.argv b/tests/networkxml2argvdata/nat-network.argv.in
similarity index 83%
rename from tests/networkxml2argvdata/nat-network.argv
rename to tests/networkxml2argvdata/nat-network.argv.in
index 181623f..680241b 100644
--- a/tests/networkxml2argvdata/nat-network.argv
+++ b/tests/networkxml2argvdata/nat-network.argv.in
@@ -3,5 +3,5 @@
--listen-address 192.168.123.1 --listen-address 2001:db8:ac10:fe01::1 \
--listen-address 2001:db8:ac10:fd01::1 --listen-address 10.24.10.1 \
--dhcp-range 192.168.122.2,192.168.122.254 \
---dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases \
+--dhcp-leasefile=@localstatedir(a)/lib/libvirt/dnsmasq/default.leases \
--dhcp-lease-max=253 --dhcp-no-override\
diff --git a/tests/networkxml2argvdata/netboot-network.argv b/tests/networkxml2argvdata/netboot-network.argv.in
similarity index 80%
rename from tests/networkxml2argvdata/netboot-network.argv
rename to tests/networkxml2argvdata/netboot-network.argv.in
index 27ffaa1..57cda0e 100644
--- a/tests/networkxml2argvdata/netboot-network.argv
+++ b/tests/networkxml2argvdata/netboot-network.argv.in
@@ -1,6 +1,6 @@
/usr/sbin/dnsmasq --strict-order --bind-interfaces --domain example.com \
--conf-file= --except-interface lo --listen-address 192.168.122.1 \
--dhcp-range 192.168.122.2,192.168.122.254 \
---dhcp-leasefile=/var/lib/libvirt/dnsmasq/netboot.leases \
+--dhcp-leasefile=@localstatedir(a)/lib/libvirt/dnsmasq/netboot.leases \
--dhcp-lease-max=253 --dhcp-no-override --enable-tftp \
--tftp-root /var/lib/tftproot --dhcp-boot pxeboot.img\
diff --git a/tests/networkxml2argvdata/netboot-proxy-network.argv b/tests/networkxml2argvdata/netboot-proxy-network.argv.in
similarity index 79%
rename from tests/networkxml2argvdata/netboot-proxy-network.argv
rename to tests/networkxml2argvdata/netboot-proxy-network.argv.in
index 3e0c5a5..723539e 100644
--- a/tests/networkxml2argvdata/netboot-proxy-network.argv
+++ b/tests/networkxml2argvdata/netboot-proxy-network.argv.in
@@ -1,5 +1,5 @@
/usr/sbin/dnsmasq --strict-order --bind-interfaces --domain example.com \
--conf-file= --except-interface lo --listen-address 192.168.122.1 \
--dhcp-range 192.168.122.2,192.168.122.254 \
---dhcp-leasefile=/var/lib/libvirt/dnsmasq/netboot.leases \
+--dhcp-leasefile=@localstatedir(a)/lib/libvirt/dnsmasq/netboot.leases \
--dhcp-lease-max=253 --dhcp-no-override --dhcp-boot pxeboot.img,,10.20.30.40\
diff --git a/tests/networkxml2argvdata/routed-network.argv b/tests/networkxml2argvdata/routed-network.argv.in
similarity index 100%
rename from tests/networkxml2argvdata/routed-network.argv
rename to tests/networkxml2argvdata/routed-network.argv.in
--
1.7.0.4
13 years, 6 months