[libvirt] [PATCHv2 0/3] bhyve: capabilities and CPU-capabilities support
by Wojciech Macek
Rebased onto master
Add following changes:
- support for connectBaselineCPU (required by OpenStack)
- move capabilites functions to separate file + API change
- implement connectCompareCPU
Wojciech Macek (3):
bhyve: support for connectBaselineCPU
bhyve: create capabilities submodule
bhyve: connectCompareCPU support
src/Makefile.am | 2 +
src/bhyve/bhyve_capabilities.c | 105 ++++++++++++++++++++++++++++++++++++++++
src/bhyve/bhyve_capabilities.h | 30 ++++++++++++
src/bhyve/bhyve_driver.c | 107 ++++++++++++++++++++++++++++++++---------
4 files changed, 222 insertions(+), 22 deletions(-)
create mode 100644 src/bhyve/bhyve_capabilities.c
create mode 100644 src/bhyve/bhyve_capabilities.h
--
1.9.0
10 years, 7 months
[libvirt] [PATCH] lxc conf2xml: don't let current vcpus at 0: define won't like it
by Cédric Bosdonnat
---
src/lxc/lxc_native.c | 1 +
tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml | 2 +-
tests/lxcconf2xmldata/lxcconf2xml-cpusettune.xml | 2 +-
tests/lxcconf2xmldata/lxcconf2xml-cputune.xml | 2 +-
tests/lxcconf2xmldata/lxcconf2xml-idmap.xml | 2 +-
tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork.xml | 2 +-
tests/lxcconf2xmldata/lxcconf2xml-memtune.xml | 2 +-
tests/lxcconf2xmldata/lxcconf2xml-nonenetwork.xml | 2 +-
tests/lxcconf2xmldata/lxcconf2xml-nonetwork.xml | 2 +-
tests/lxcconf2xmldata/lxcconf2xml-physnetwork.xml | 2 +-
tests/lxcconf2xmldata/lxcconf2xml-simple.xml | 2 +-
tests/lxcconf2xmldata/lxcconf2xml-vlannetwork.xml | 2 +-
12 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index 2b09fae..f4c4556 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -868,6 +868,7 @@ lxcParseConfigString(const char *config)
/* Value not handled by the LXC driver, setting to
* minimum required to make XML parsing pass */
vmdef->maxvcpus = 1;
+ vmdef->vcpus = 1;
vmdef->nfss = 0;
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml b/tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml
index 628798d..36b8e52 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-blkiotune.xml
@@ -18,7 +18,7 @@
<weight>300</weight>
</device>
</blkiotune>
- <vcpu placement='static' current='0'>1</vcpu>
+ <vcpu placement='static'>1</vcpu>
<os>
<type>exe</type>
<init>/sbin/init</init>
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-cpusettune.xml b/tests/lxcconf2xmldata/lxcconf2xml-cpusettune.xml
index 1b8fb0c..932ab61 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-cpusettune.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-cpusettune.xml
@@ -3,7 +3,7 @@
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>65536</memory>
<currentMemory unit='KiB'>0</currentMemory>
- <vcpu placement='static' cpuset='1-2,5-7' current='0'>1</vcpu>
+ <vcpu placement='static' cpuset='1-2,5-7'>1</vcpu>
<numatune>
<memory mode='strict' nodeset='1-4'/>
</numatune>
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-cputune.xml b/tests/lxcconf2xmldata/lxcconf2xml-cputune.xml
index a511dcf..1bab1c6 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-cputune.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-cputune.xml
@@ -3,7 +3,7 @@
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>65536</memory>
<currentMemory unit='KiB'>0</currentMemory>
- <vcpu placement='static' current='0'>1</vcpu>
+ <vcpu placement='static'>1</vcpu>
<cputune>
<shares>1024</shares>
<period>500000</period>
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-idmap.xml b/tests/lxcconf2xmldata/lxcconf2xml-idmap.xml
index 576c903..050ccd6 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-idmap.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-idmap.xml
@@ -3,7 +3,7 @@
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>65536</memory>
<currentMemory unit='KiB'>0</currentMemory>
- <vcpu placement='static' current='0'>1</vcpu>
+ <vcpu placement='static'>1</vcpu>
<os>
<type>exe</type>
<init>/sbin/init</init>
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork.xml b/tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork.xml
index aa0683a..996c0f7 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-macvlannetwork.xml
@@ -3,7 +3,7 @@
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>65536</memory>
<currentMemory unit='KiB'>0</currentMemory>
- <vcpu placement='static' current='0'>1</vcpu>
+ <vcpu placement='static'>1</vcpu>
<os>
<type>exe</type>
<init>/sbin/init</init>
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-memtune.xml b/tests/lxcconf2xmldata/lxcconf2xml-memtune.xml
index 0264356..b7c919e 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-memtune.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-memtune.xml
@@ -8,7 +8,7 @@
<soft_limit unit='KiB'>131072</soft_limit>
<swap_hard_limit unit='KiB'>2097152</swap_hard_limit>
</memtune>
- <vcpu placement='static' current='0'>1</vcpu>
+ <vcpu placement='static'>1</vcpu>
<os>
<type>exe</type>
<init>/sbin/init</init>
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-nonenetwork.xml b/tests/lxcconf2xmldata/lxcconf2xml-nonenetwork.xml
index eebcb4e..6d9e16d 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-nonenetwork.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-nonenetwork.xml
@@ -3,7 +3,7 @@
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>65536</memory>
<currentMemory unit='KiB'>0</currentMemory>
- <vcpu placement='static' current='0'>1</vcpu>
+ <vcpu placement='static'>1</vcpu>
<os>
<type>exe</type>
<init>/sbin/init</init>
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-nonetwork.xml b/tests/lxcconf2xmldata/lxcconf2xml-nonetwork.xml
index 511e3dd..101324a 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-nonetwork.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-nonetwork.xml
@@ -3,7 +3,7 @@
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>65536</memory>
<currentMemory unit='KiB'>0</currentMemory>
- <vcpu placement='static' current='0'>1</vcpu>
+ <vcpu placement='static'>1</vcpu>
<os>
<type>exe</type>
<init>/sbin/init</init>
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-physnetwork.xml b/tests/lxcconf2xmldata/lxcconf2xml-physnetwork.xml
index 35a2a96..5fe1b03 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-physnetwork.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-physnetwork.xml
@@ -3,7 +3,7 @@
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>65536</memory>
<currentMemory unit='KiB'>0</currentMemory>
- <vcpu placement='static' current='0'>1</vcpu>
+ <vcpu placement='static'>1</vcpu>
<os>
<type>exe</type>
<init>/sbin/init</init>
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-simple.xml b/tests/lxcconf2xmldata/lxcconf2xml-simple.xml
index 6ec0f17..b3c3659 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-simple.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-simple.xml
@@ -3,7 +3,7 @@
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>65536</memory>
<currentMemory unit='KiB'>0</currentMemory>
- <vcpu placement='static' current='0'>1</vcpu>
+ <vcpu placement='static'>1</vcpu>
<os>
<type arch='i686'>exe</type>
<init>/sbin/init</init>
diff --git a/tests/lxcconf2xmldata/lxcconf2xml-vlannetwork.xml b/tests/lxcconf2xmldata/lxcconf2xml-vlannetwork.xml
index 7d6d51b..45348ed 100644
--- a/tests/lxcconf2xmldata/lxcconf2xml-vlannetwork.xml
+++ b/tests/lxcconf2xmldata/lxcconf2xml-vlannetwork.xml
@@ -3,7 +3,7 @@
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>65536</memory>
<currentMemory unit='KiB'>0</currentMemory>
- <vcpu placement='static' current='0'>1</vcpu>
+ <vcpu placement='static'>1</vcpu>
<os>
<type>exe</type>
<init>/sbin/init</init>
--
1.8.4.5
10 years, 7 months
[libvirt] [PATCH 0/3] Couple of bhyve driver cleanups
by Michal Privoznik
*** BLURB HERE ***
Michal Privoznik (3):
bhyve_capabilities: Add Semihalf to Copyright
Simplify bhyveDriverGetCapabilities()
bhyveConnectGetCapabilities: Fix double caps unref
src/bhyve/bhyve_capabilities.c | 1 +
src/bhyve/bhyve_driver.c | 25 +++++++++++--------------
2 files changed, 12 insertions(+), 14 deletions(-)
--
1.9.0
10 years, 7 months
[libvirt] [PATCH] hash: add common utility functions
by Eric Blake
I almost wrote a hash value free function that just called
VIR_FREE, then realized I couldn't be the first person to
do that. Sure enough, it was worth factoring into a common
helper routine.
Furthermore, in a few places we were passing raw free() as
the cleanup function; whereas going through VIR_FREE() ensures
that any (temporary) tracing or other memory stress testing
that we add to viralloc.c will not be bypassed.
* src/util/virhash.h (virHashValueFree): New function.
* src/util/virhash.c (virHashValueFree): Implement it.
* src/util/virobject.h (virObjectFreeHashData): New function.
* src/libvirt_private.syms (virhash.h, virobject.h): Export them.
* src/nwfilter/nwfilter_learnipaddr.c (virNWFilterLearnInit): Use
common function.
* src/qemu/qemu_capabilities.c (virQEMUCapsCacheNew): Likewise.
* src/qemu/qemu_command.c (qemuDomainCCWAddressSetCreate):
Likewise.
* src/qemu/qemu_monitor.c (qemuMonitorGetBlockInfo): Likewise.
* src/qemu/qemu_process.c (qemuProcessWaitForMonitor): Likewise.
* src/util/virclosecallbacks.c (virCloseCallbacksNew): Likewise.
* src/util/virkeyfile.c (virKeyFileParseGroup): Likewise.
* tests/qemumonitorjsontest.c
(testQemuMonitorJSONqemuMonitorJSONGetBlockInfo): Likewise.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
It turns out I may end up not using the common helper in my
code after all, but the cleanup is still worth posting.
src/libvirt_private.syms | 2 ++
src/nwfilter/nwfilter_learnipaddr.c | 9 +--------
src/qemu/qemu_capabilities.c | 9 +--------
src/qemu/qemu_command.c | 8 +-------
src/qemu/qemu_monitor.c | 2 +-
src/qemu/qemu_process.c | 6 +-----
src/util/virclosecallbacks.c | 11 ++---------
src/util/virhash.c | 9 ++++++++-
src/util/virhash.h | 5 ++++-
src/util/virkeyfile.c | 9 ++-------
src/util/virobject.c | 17 ++++++++++++++++-
src/util/virobject.h | 3 ++-
tests/qemumonitorjsontest.c | 6 +++---
13 files changed, 44 insertions(+), 52 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 2d12105..6b68a43 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1290,6 +1290,7 @@ virHashSize;
virHashSteal;
virHashTableSize;
virHashUpdateEntry;
+virHashValueFree;
# util/virhook.h
@@ -1628,6 +1629,7 @@ virClassIsDerivedFrom;
virClassName;
virClassNew;
virObjectFreeCallback;
+virObjectFreeHashData;
virObjectIsClass;
virObjectLock;
virObjectLockableNew;
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index 0eb5e7e..1ffed78 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -188,13 +188,6 @@ virNWFilterLockIface(const char *ifname)
}
-static void
-freeIfaceLock(void *payload, const void *name ATTRIBUTE_UNUSED)
-{
- VIR_FREE(payload);
-}
-
-
void
virNWFilterUnlockIface(const char *ifname)
{
@@ -818,7 +811,7 @@ virNWFilterLearnInit(void)
return -1;
}
- ifaceLockMap = virHashCreate(0, freeIfaceLock);
+ ifaceLockMap = virHashCreate(0, virHashValueFree);
if (!ifaceLockMap) {
virNWFilterLearnShutdown();
return -1;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index e1d04ff..2c8ec10 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3288,13 +3288,6 @@ bool virQEMUCapsIsValid(virQEMUCapsPtr qemuCaps)
}
-static void
-virQEMUCapsHashDataFree(void *payload, const void *key ATTRIBUTE_UNUSED)
-{
- virObjectUnref(payload);
-}
-
-
virQEMUCapsCachePtr
virQEMUCapsCacheNew(const char *libDir,
const char *cacheDir,
@@ -3313,7 +3306,7 @@ virQEMUCapsCacheNew(const char *libDir,
return NULL;
}
- if (!(cache->binaries = virHashCreate(10, virQEMUCapsHashDataFree)))
+ if (!(cache->binaries = virHashCreate(10, virObjectFreeHashData)))
goto error;
if (VIR_STRDUP(cache->libDir, libDir) < 0)
goto error;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 37841d1..cc45828 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1102,12 +1102,6 @@ qemuCCWAdressIncrement(virDomainDeviceCCWAddressPtr addr)
return 0;
}
-static void
-qemuDomainCCWAddressSetFreeEntry(void *payload,
- const void *name ATTRIBUTE_UNUSED)
-{
- VIR_FREE(payload);
-}
int qemuDomainCCWAddressAssign(virDomainDeviceInfoPtr dev,
qemuDomainCCWAddressSetPtr addrs,
@@ -1264,7 +1258,7 @@ qemuDomainCCWAddressSetCreate(void)
if (VIR_ALLOC(addrs) < 0)
goto error;
- if (!(addrs->defined = virHashCreate(10, qemuDomainCCWAddressSetFreeEntry)))
+ if (!(addrs->defined = virHashCreate(10, virHashValueFree)))
goto error;
/* must use cssid = 0xfe (254) for virtio-ccw devices */
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 205002b..5a5a59b 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1678,7 +1678,7 @@ qemuMonitorGetBlockInfo(qemuMonitorPtr mon)
return NULL;
}
- if (!(table = virHashCreate(32, (virHashDataFree) free)))
+ if (!(table = virHashCreate(32, virHashValueFree)))
return NULL;
if (mon->json)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ca9e15c..0afad9d 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1871,10 +1871,6 @@ qemuProcessFindCharDevicePTYs(virDomainObjPtr vm,
return 0;
}
-static void qemuProcessFreePtyPath(void *payload, const void *name ATTRIBUTE_UNUSED)
-{
- VIR_FREE(payload);
-}
static int
qemuProcessWaitForMonitor(virQEMUDriverPtr driver,
@@ -1911,7 +1907,7 @@ qemuProcessWaitForMonitor(virQEMUDriverPtr driver,
* reliable if it's available.
* Note that the monitor itself can be on a pty, so we still need to try the
* log output method. */
- paths = virHashCreate(0, qemuProcessFreePtyPath);
+ paths = virHashCreate(0, virHashValueFree);
if (paths == NULL)
goto cleanup;
diff --git a/src/util/virclosecallbacks.c b/src/util/virclosecallbacks.c
index d62fd89..4f26172 100644
--- a/src/util/virclosecallbacks.c
+++ b/src/util/virclosecallbacks.c
@@ -1,7 +1,7 @@
/*
* virclosecallbacks.c: Connection close callbacks routines
*
- * Copyright (C) 2013 Red Hat, Inc.
+ * Copyright (C) 2013-2014 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
@@ -67,13 +67,6 @@ static int virCloseCallbacksOnceInit(void)
VIR_ONCE_GLOBAL_INIT(virCloseCallbacks)
-static void
-virCloseCallbacksFreeData(void *payload,
- const void *name ATTRIBUTE_UNUSED)
-{
- VIR_FREE(payload);
-}
-
virCloseCallbacksPtr
virCloseCallbacksNew(void)
{
@@ -85,7 +78,7 @@ virCloseCallbacksNew(void)
if (!(closeCallbacks = virObjectLockableNew(virCloseCallbacksClass)))
return NULL;
- closeCallbacks->list = virHashCreate(5, virCloseCallbacksFreeData);
+ closeCallbacks->list = virHashCreate(5, virHashValueFree);
if (!closeCallbacks->list) {
virObjectUnref(closeCallbacks);
return NULL;
diff --git a/src/util/virhash.c b/src/util/virhash.c
index 9ef3554..e3c1880 100644
--- a/src/util/virhash.c
+++ b/src/util/virhash.c
@@ -3,7 +3,7 @@
*
* Reference: Your favorite introductory book on algorithms
*
- * Copyright (C) 2005-2013 Red Hat, Inc.
+ * Copyright (C) 2005-2014 Red Hat, Inc.
* Copyright (C) 2000 Bjorn Reese and Daniel Veillard.
*
* Permission to use, copy, modify, and distribute this software for any
@@ -99,6 +99,13 @@ static void virHashStrFree(void *name)
}
+void
+virHashValueFree(void *value, const void *name ATTRIBUTE_UNUSED)
+{
+ VIR_FREE(value);
+}
+
+
static size_t
virHashComputeKey(const virHashTable *table, const void *name)
{
diff --git a/src/util/virhash.h b/src/util/virhash.h
index 4de9a14..a137137 100644
--- a/src/util/virhash.h
+++ b/src/util/virhash.h
@@ -3,7 +3,7 @@
* Description: This module implements the hash table and allocation and
* deallocation of domains and connections
*
- * Copyright (C) 2005-2013 Red Hat, Inc.
+ * Copyright (C) 2005-2014 Red Hat, Inc.
* Copyright (C) 2000 Bjorn Reese and Daniel Veillard.
*
* Author: Bjorn Reese <bjorn.reese(a)systematic.dk>
@@ -184,4 +184,7 @@ ssize_t virHashRemoveSet(virHashTablePtr table, virHashSearcher iter, const void
void *virHashSearch(const virHashTable *table, virHashSearcher iter,
const void *data);
+/* Convenience for when VIR_FREE(value) is sufficient as a data freer. */
+void virHashValueFree(void *value, const void *name);
+
#endif /* ! __VIR_HASH_H__ */
diff --git a/src/util/virkeyfile.c b/src/util/virkeyfile.c
index 742fb37..da06425 100644
--- a/src/util/virkeyfile.c
+++ b/src/util/virkeyfile.c
@@ -1,7 +1,7 @@
/*
* virkeyfile.c: "ini"-style configuration file handling
*
- * Copyright (C) 2012-2013 Red Hat, Inc.
+ * Copyright (C) 2012-2014 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
@@ -103,11 +103,6 @@ virKeyFileErrorHelper(const char *file, const char *func, size_t line,
}
-static void virKeyFileValueFree(void *value, const void *name ATTRIBUTE_UNUSED)
-{
- VIR_FREE(value);
-}
-
static int virKeyFileParseGroup(virKeyFileParserCtxtPtr ctxt)
{
int ret = -1;
@@ -130,7 +125,7 @@ static int virKeyFileParseGroup(virKeyFileParserCtxtPtr ctxt)
NEXT;
- if (!(ctxt->group = virHashCreate(10, virKeyFileValueFree)))
+ if (!(ctxt->group = virHashCreate(10, virHashValueFree)))
goto cleanup;
if (virHashAddEntry(ctxt->conf->groups, ctxt->groupname, ctxt->group) < 0)
diff --git a/src/util/virobject.c b/src/util/virobject.c
index c8bc193..6cb84b4 100644
--- a/src/util/virobject.c
+++ b/src/util/virobject.c
@@ -1,7 +1,7 @@
/*
* virobject.c: libvirt reference counted object
*
- * Copyright (C) 2012-2013 Red Hat, Inc.
+ * Copyright (C) 2012-2014 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
@@ -390,3 +390,18 @@ void virObjectFreeCallback(void *opaque)
{
virObjectUnref(opaque);
}
+
+
+/**
+ * virObjectFreeHashData:
+ * @opaque: a pointer to a virObject instance
+ * @name: ignored, name of the hash key being deleted
+ *
+ * Provides identical functionality to virObjectUnref,
+ * but with the signature matching the virHashDataFree
+ * typedef.
+ */
+void virObjectFreeHashData(void *opaque, const void *name ATTRIBUTE_UNUSED)
+{
+ virObjectUnref(opaque);
+}
diff --git a/src/util/virobject.h b/src/util/virobject.h
index d571b5c..ad1f0c1 100644
--- a/src/util/virobject.h
+++ b/src/util/virobject.h
@@ -1,7 +1,7 @@
/*
* virobject.h: libvirt reference counted object
*
- * Copyright (C) 2012-2013 Red Hat, Inc.
+ * Copyright (C) 2012-2014 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
@@ -89,6 +89,7 @@ bool virObjectIsClass(void *obj,
ATTRIBUTE_NONNULL(2);
void virObjectFreeCallback(void *opaque);
+void virObjectFreeHashData(void *opaque, const void *name);
void *virObjectLockableNew(virClassPtr klass)
ATTRIBUTE_NONNULL(1);
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index f80d03e..47d7481 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc.
+ * Copyright (C) 2011-2014 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
@@ -1356,8 +1356,8 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const void *data)
if (!test)
return -1;
- if (!(blockDevices = virHashCreate(32, (virHashDataFree) free)) ||
- !(expectedBlockDevices = virHashCreate(32, (virHashDataFree) (free))))
+ if (!(blockDevices = virHashCreate(32, virHashValueFree)) ||
+ !(expectedBlockDevices = virHashCreate(32, virHashValueFree)))
goto cleanup;
if (VIR_ALLOC(info) < 0)
--
1.9.0
10 years, 7 months
[libvirt] [PATCH] interface: dumpx inactive xml when interface isn't active
by Laine Stump
Other drivers in libvirt (e.g. network, qemu) will automatically
return the "inactive" (persistent configuration) XML of an object when
that object is inactive. The netcf backend of the interface driver
would always try to return the live status XML of the interface, even
when it was down. Although netcf does return valid XML in that case,
for bond interfaces it is missing almost all of its content, including
the <bond> subelement itself, leading to this error message from
"virsh iface-dumpxml" of a bond interface that is inactive:
error: XML error: bond interface misses the bond element
(this is because libvirt's validation of the XML returned by netcf
always requires a <bond> element be present).
This patch modifies the interface driver netcf backend to check if the
interface is inactive, and in that case always return the inactive XML
(which will always have a <bond> element, thus eliminating the error
message, as well as making operation more in line with other drivers.
This fixes the following bug:
https://bugzilla.redhat.com/show_bug.cgi?id=878394
---
src/interface/interface_backend_netcf.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c
index 4d55653..36a50bd 100644
--- a/src/interface/interface_backend_netcf.c
+++ b/src/interface/interface_backend_netcf.c
@@ -801,6 +801,7 @@ static char *netcfInterfaceGetXMLDesc(virInterfacePtr ifinfo,
char *xmlstr = NULL;
virInterfaceDefPtr ifacedef = NULL;
char *ret = NULL;
+ bool active;
virCheckFlags(VIR_INTERFACE_XML_INACTIVE, NULL);
@@ -812,7 +813,10 @@ static char *netcfInterfaceGetXMLDesc(virInterfacePtr ifinfo,
goto cleanup;
}
- if ((flags & VIR_INTERFACE_XML_INACTIVE)) {
+ if (netcfInterfaceObjIsActive(iface, &active) < 0)
+ goto cleanup;
+
+ if ((flags & VIR_INTERFACE_XML_INACTIVE) || !active) {
xmlstr = ncf_if_xml_desc(iface);
} else {
xmlstr = ncf_if_xml_state(iface);
--
1.9.0
10 years, 7 months
[libvirt] [PATCH] tests: build viridentitytest only WITH_ATTR.
by Jincheng Miao
Commit d7c4e0036 assumed all SELinux tests depended upon
securityselinuxhelper need xattr support, but forgot to
move viridentitytest under WITH_ATTR.
Reported-by: Nehal J Wani <nehaljw.kkd1(a)gmail.com>
Signed-off-by: Jincheng Miao <jmiao(a)redhat.com>
---
tests/Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6e15af8..7a15295 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -146,7 +146,6 @@ test_programs = virshtest sockettest \
virpcitest \
virendiantest \
virfiletest \
- viridentitytest \
viriscsitest \
virkeycodetest \
virlockspacetest \
@@ -188,7 +187,8 @@ endif WITH_DBUS
if WITH_SECDRIVER_SELINUX
if WITH_ATTR
-test_programs += securityselinuxtest
+test_programs += securityselinuxtest \
+ viridentitytest
if WITH_QEMU
test_programs += securityselinuxlabeltest
endif WITH_QEMU
--
1.8.3.1
10 years, 7 months
[libvirt] [PATCH libvirt-python 0/2] fix build dependency & increment version
by Laine Stump
Although they're trivial and one is a build breaker, I haven't pushed
either in case I've made incorrect assumptions about something.
Laine Stump (2):
build: add BuildRequires for python-lxml and python3-lxml
increment version post-release
libvirt-python.spec.in | 2 ++
setup.py | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
--
1.9.0
10 years, 7 months
[libvirt] [PATCHv2] maint: Correctly detect wether "gluster" cli tool is accessible
by Peter Krempa
The configure definition previously always defined the GLUSTER_CLI macro
and thus the code needing it wasn't compiled out if the tool wasn't
accessible.
---
Notes:
Version 2:
Simplify check.
configure.ac | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index e68f5f6..52c50df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1939,8 +1939,10 @@ AM_CONDITIONAL([WITH_STORAGE_GLUSTER], [test "$with_storage_gluster" = "yes"])
if test "$with_storage_fs" = "yes" ||
test "$with_storage_gluster" = "yes"; then
AC_PATH_PROG([GLUSTER_CLI], [gluster], [], [$PATH:/sbin:/usr/sbin])
- AC_DEFINE_UNQUOTED([GLUSTER_CLI], ["$GLUSTER_CLI"],
- [Location or name of the gluster command line tool])
+ if test "x$GLUSTER_CLI" != "x"; then
+ AC_DEFINE_UNQUOTED([GLUSTER_CLI], ["$GLUSTER_CLI"],
+ [Location or name of the gluster command line tool])
+ fi
fi
LIBPARTED_CFLAGS=
--
1.9.1
10 years, 7 months
[libvirt] [PATCH] libvirt-guests: avoid bashism
by Guido Günther
At least Debian uses dash to run the init scripts
---
tools/libvirt-guests.sh.in | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in
index 4bbd4e4..a158b62 100644
--- a/tools/libvirt-guests.sh.in
+++ b/tools/libvirt-guests.sh.in
@@ -89,13 +89,15 @@ test_connect()
{
uri=$1
- for ((i = 0; i < ${CONNECT_RETRIES}; i++)); do
+ i=${CONNECT_RETRIES}
+ while [ $i -gt 0 ]; do
run_virsh "$uri" connect 2>/dev/null
if [ $? -eq 0 ]; then
return 0;
fi
sleep ${RETRIES_SLEEP}
eval_gettext "Unable to connect to libvirt currently. Retrying .. \$i"
+ i=$(($i-1))
done
eval_gettext "Can't connect to \$uri. Skipping."
echo
--
1.9.1
10 years, 7 months