[libvirt] [PATCH] test_driver: implement virConnectGetLibVersion
by Ilias Stamatis
Signed-off-by: Ilias Stamatis <stamatis.iliass(a)gmail.com>
---
src/test/test_driver.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 1aa79ce898..dc267b6ecd 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1453,6 +1453,14 @@ static char *testConnectGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED)
}
+static int testConnectGetLibVersion(virConnectPtr conn ATTRIBUTE_UNUSED,
+ unsigned long *libVer)
+{
+ *libVer = LIBVIR_VERSION_NUMBER;
+ return 0;
+}
+
+
static int testConnectIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED)
{
return 1;
@@ -6988,6 +6996,7 @@ static virHypervisorDriver testHypervisorDriver = {
.connectClose = testConnectClose, /* 0.1.1 */
.connectGetVersion = testConnectGetVersion, /* 0.1.1 */
.connectGetHostname = testConnectGetHostname, /* 0.6.3 */
+ .connectGetLibVersion = testConnectGetLibVersion, /* 5.5.0 */
.connectGetMaxVcpus = testConnectGetMaxVcpus, /* 0.3.2 */
.nodeGetInfo = testNodeGetInfo, /* 0.1.1 */
.nodeGetCPUStats = testNodeGetCPUStats, /* 2.3.0 */
--
2.21.0
5 years, 5 months
[libvirt] [PATCHv2] virt-xml-validate: Allow input to be read from stdin
by Johannes Holmberg
Signed-off-by: Johannes Holmberg <johannes.holmberg(a)dataductus.se>
---
Changes from v1:
- Quotes around $TMPFILE everywhere.
- Explicit -n checks in if statements
- Fixed one instance of incorrect indentation
- Signed-off-by line in commit message
tools/virt-xml-validate.in | 46 ++++++++++++++++++++++++++++----------
1 file changed, 34 insertions(+), 12 deletions(-)
diff --git a/tools/virt-xml-validate.in b/tools/virt-xml-validate.in
index 64aeaaaa33..5cb7dcd276 100644
--- a/tools/virt-xml-validate.in
+++ b/tools/virt-xml-validate.in
@@ -16,7 +16,17 @@
set -e
-case $1 in
+TMPFILE=
+
+cleanup() {
+ if [ -n "$TMPFILE" ]; then
+ rm -f "$TMPFILE"
+ fi
+}
+
+trap cleanup EXIT
+
+case "$1" in
-h | --h | --he | --hel | --help)
cat <<EOF
Usage:
@@ -34,7 +44,7 @@ $0 (libvirt) @VERSION@
EOF
exit ;;
--) shift ;;
- -*)
+ -?*)
echo "$0: unrecognized option '$1'" >&2
exit 1 ;;
esac
@@ -42,18 +52,27 @@ esac
XMLFILE="$1"
TYPE="$2"
-if [ -z "$XMLFILE" ]; then
- echo "syntax: $0 XMLFILE [TYPE]" >&2
- exit 1
-fi
+if [ "$XMLFILE" = "-" ]; then
+ TMPFILE=`mktemp --tmpdir virt-xml.XXXX`
+ cat > "$TMPFILE"
+else
+ if [ -z "$XMLFILE" ]; then
+ echo "syntax: $0 XMLFILE [TYPE]" >&2
+ exit 1
+ fi
-if [ ! -f "$XMLFILE" ]; then
- echo "$0: document $XMLFILE does not exist" >&2
- exit 2
+ if [ ! -f "$XMLFILE" ]; then
+ echo "$0: document $XMLFILE does not exist" >&2
+ exit 2
+ fi
fi
if [ -z "$TYPE" ]; then
- ROOT=`xmllint --stream --debug "$XMLFILE" 2>/dev/null | grep "^0 1 " | awk '{ print $3 }'`
+ if [ -n "$TMPFILE" ]; then
+ ROOT=`xmllint --stream --debug - < "$TMPFILE" 2>/dev/null | grep "^0 1 " | awk '{ print $3 }'`
+ else
+ ROOT=`xmllint --stream --debug "$XMLFILE" 2>/dev/null | grep "^0 1 " | awk '{ print $3 }'`
+ fi
case "$ROOT" in
*domainsnapshot*) # Must come first, since *domain* is a substring
TYPE="domainsnapshot"
@@ -101,6 +120,9 @@ if [ ! -f "$SCHEMA" ]; then
exit 4
fi
-xmllint --noout --relaxng "$SCHEMA" "$XMLFILE"
-
+if [ -n "$TMPFILE" ]; then
+ xmllint --noout --relaxng "$SCHEMA" - < "$TMPFILE"
+else
+ xmllint --noout --relaxng "$SCHEMA" "$XMLFILE"
+fi
exit
--
2.17.1
5 years, 5 months
[libvirt] [PATCH 8.5/13] qemu: Rename qemuDomainSnapshotDiskDataFree to qemuDomainSnapshotDiskDataCleanup
by Peter Krempa
In commit cbb4d229de30b5 I named the function with 'free' suffix, but at
that time it already did some non-freeing tasks. Rename it to make it
obvious that it's not just memory managemet.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_driver.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 9736933143..f1886e37b6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15035,10 +15035,10 @@ typedef qemuDomainSnapshotDiskData *qemuDomainSnapshotDiskDataPtr;
static void
-qemuDomainSnapshotDiskDataFree(qemuDomainSnapshotDiskDataPtr data,
- size_t ndata,
- virQEMUDriverPtr driver,
- virDomainObjPtr vm)
+qemuDomainSnapshotDiskDataCleanup(qemuDomainSnapshotDiskDataPtr data,
+ size_t ndata,
+ virQEMUDriverPtr driver,
+ virDomainObjPtr vm)
{
size_t i;
@@ -15145,7 +15145,7 @@ qemuDomainSnapshotDiskDataCollect(virQEMUDriverPtr driver,
ret = 0;
cleanup:
- qemuDomainSnapshotDiskDataFree(data, ndata, driver, vm);
+ qemuDomainSnapshotDiskDataCleanup(data, ndata, driver, vm);
return ret;
}
@@ -15322,7 +15322,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
ret = -1;
cleanup:
- qemuDomainSnapshotDiskDataFree(diskdata, ndiskdata, driver, vm);
+ qemuDomainSnapshotDiskDataCleanup(diskdata, ndiskdata, driver, vm);
virErrorRestore(&orig_err);
return ret;
--
2.21.0
5 years, 5 months
[libvirt] [PATCH 1/2] test_driver: implement virConnectDomainXMLToNative
by Ilias Stamatis
Since this is the test driver, we can pretend that the native hypervisor
representation is the same as libvirt's domain XML.
Signed-off-by: Ilias Stamatis <stamatis.iliass(a)gmail.com>
---
src/test/test_driver.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 1aa79ce898..ec1d3cacbc 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1563,6 +1563,39 @@ static int testConnectNumOfDomains(virConnectPtr conn)
return count;
}
+
+# define TEST_CONFIG_FORMAT_ARGV "test-test"
+
+
+static char *testConnectDomainXMLToNative(virConnectPtr conn,
+ const char *format,
+ const char *dxml,
+ unsigned int flags)
+{
+ char *ret = NULL;
+ virDomainDefPtr def = NULL;
+ testDriverPtr privconn = conn->privateData;
+
+ virCheckFlags(0, NULL);
+
+ if (STRNEQ(format, TEST_CONFIG_FORMAT_ARGV)) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Unsupported config format '%s'"), format);
+ return NULL;
+ }
+
+ if ((def = virDomainDefParseString(dxml, privconn->caps, privconn->xmlopt, NULL,
+ VIR_DOMAIN_DEF_PARSE_INACTIVE)) == NULL)
+ goto cleanup;
+
+ ret = virDomainDefFormat(def, privconn->caps, 0);
+
+ cleanup:
+ virDomainDefFree(def);
+ return ret;
+}
+
+
static int testDomainIsActive(virDomainPtr dom)
{
virDomainObjPtr obj;
@@ -6998,6 +7031,7 @@ static virHypervisorDriver testHypervisorDriver = {
.connectGetType = testConnectGetType, /* 2.3.0 */
.connectListDomains = testConnectListDomains, /* 0.1.1 */
.connectNumOfDomains = testConnectNumOfDomains, /* 0.1.1 */
+ .connectDomainXMLToNative = testConnectDomainXMLToNative, /* 5.5.0 */
.connectListAllDomains = testConnectListAllDomains, /* 0.9.13 */
.domainCreateXML = testDomainCreateXML, /* 0.1.4 */
.domainLookupByID = testDomainLookupByID, /* 0.1.1 */
--
2.21.0
5 years, 5 months
[libvirt] [PATCH] qemu: check if numa cell's cpu range match with cpu topology count
by Maxiwell S. Garcia
If the XML doesn't have numa cells, this check is not necessary. But
if numa cells are present, it must match with cpu topology count.
Signed-off-by: Maxiwell S. Garcia <maxiwell(a)linux.ibm.com>
---
src/qemu/qemu_domain.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 4d3a8868b2..ab81b9a5be 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4173,15 +4173,24 @@ qemuDomainDefValidate(const virDomainDef *def,
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS)) {
unsigned int topologycpus;
unsigned int granularity;
+ unsigned int numacpus;
/* Starting from QEMU 2.5, max vCPU count and overall vCPU topology
* must agree. We only actually enforce this with QEMU 2.7+, due
* to the capability check above */
- if (virDomainDefGetVcpusTopology(def, &topologycpus) == 0 &&
- topologycpus != virDomainDefGetVcpusMax(def)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("CPU topology doesn't match maximum vcpu count"));
- goto cleanup;
+ if (virDomainDefGetVcpusTopology(def, &topologycpus) == 0) {
+ if (topologycpus != virDomainDefGetVcpusMax(def)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("CPU topology doesn't match maximum vcpu count"));
+ goto cleanup;
+ }
+
+ numacpus = virDomainNumaGetCPUCountTotal(def->numa);
+ if ((numacpus != 0) && (topologycpus != numacpus)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("CPU topology doesn't match numa CPU count"));
+ goto cleanup;
+ }
}
/* vCPU hotplug granularity must be respected */
--
2.20.1
5 years, 5 months
[libvirt] [PATCH] Fix regression in lxcOpenNamespace
by Sergei Turchanov
This fixes regression caused by the 1d39dbaf637db03f6e597ed56b96aa065710b4a1
fdlist[i] erroneously was replaced by fdlist[1] which caused
lxcOpenNamespace to return a list with identical elements.
---
libvirt-lxc-override.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libvirt-lxc-override.c b/libvirt-lxc-override.c
index 60c2e48..d7af154 100644
--- a/libvirt-lxc-override.c
+++ b/libvirt-lxc-override.c
@@ -83,7 +83,7 @@ libvirt_lxc_virDomainLxcOpenNamespace(PyObject *self ATTRIBUTE_UNUSED,
goto error;
for (i = 0; i < c_retval; i++)
- VIR_PY_LIST_APPEND_GOTO(py_retval, libvirt_intWrap(fdlist[1]), error);
+ VIR_PY_LIST_APPEND_GOTO(py_retval, libvirt_intWrap(fdlist[i]), error);
cleanup:
VIR_FREE(fdlist);
--
2.17.1
5 years, 5 months
[libvirt] [PATCH 00/13] qemu: External disk snapshot code refactors/cleanups (blockdev-add saga)
by Peter Krempa
Few cleanups to the snapshot code extracted from my blockdev branch.
Peter Krempa (13):
qemu: snapshot: Pass 'cfg' to external snapshot functions
qemu: Use VIR_AUTOPTR in qemuDomainSnapshotCreateDiskActive
qemu: Use virErrorPreserveLast in qemuDomainSnapshotCreateDiskActive
qemu: Use VIR_AUTO* in qemuDomainSnapshotCreateActiveExternal
qemu: snapshot: Remove unused cleanup section in
qemuDomainSnapshotCreateSingleDiskActive
qemu: snapshot: Always save status and config after
qemuDomainSnapshotCreateDiskActive
qemu: snapshot: Always save config XML after
qemuDomainSnapshotCreateDiskActive
qemu: snapshot: Densely pack data in qemuDomainSnapshotDiskDataCollect
qemu: snapshot: Move all cleanup of snapshot disk data to
qemuDomainSnapshotDiskDataFree
qemu: snapshot: Don't overload 'ret' in
qemuDomainSnapshotCreateDiskActive
qemu: snapshot: Unify 'cleanup' and 'error' in
qemuDomainSnapshotCreateDiskActive
qemu: snapshot: Return early if there's nothing to snapshot
qemu: snapshot: Remove unnecessary 'do_transaction' logic in
qemuDomainSnapshotCreateDiskActive
src/qemu/qemu_driver.c | 189 +++++++++++++++++------------------------
1 file changed, 79 insertions(+), 110 deletions(-)
--
2.21.0
5 years, 5 months
[libvirt] [PATCH 0/4] tests: qemu: Allow QMP schema testing with qemuMonitorTestProcessCommandVerbatim
by Peter Krempa
Allow more tests to be run against QMP schema checker.
Peter Krempa (4):
tests: Refactor cleanup in qemuMonitorTestProcessCommandVerbatim
tests: qemu: Add QMP schema checking in
qemuMonitorTestProcessCommandVerbatim
tests: Allow QMP schema testing in qemuMonitorTestNewFromFileFull
tests: qemuhotplug: Use schema testing with
qemuMonitorTestNewFromFileFull
tests/qemucapabilitiestest.c | 3 ++-
tests/qemuhotplugtest.c | 21 +++++++++++++++++----
tests/qemumonitortestutils.c | 34 +++++++++++++++++++++++++---------
tests/qemumonitortestutils.h | 3 ++-
4 files changed, 46 insertions(+), 15 deletions(-)
--
2.21.0
5 years, 5 months
[libvirt] [PATCH 0/2] gitdm: Add gitdm configuration
by Andrea Bolognani
See the commit message for patch 2/2 for more information; patch
1/2 merely addresses some minor issues in .mailmap that I spotted
while working on the gitdm configuration.
Andrea Bolognani (2):
mailmap: Remove some duplicates
gitdm: Add gitdm configuration
.mailmap | 4 ++
docs/gitdm/aliases | 25 +++++++++
docs/gitdm/companies/canonical | 11 ++++
docs/gitdm/companies/datto | 2 +
docs/gitdm/companies/dreamhost | 4 ++
docs/gitdm/companies/nec | 2 +
docs/gitdm/companies/others | 98 ++++++++++++++++++++++++++++++++++
docs/gitdm/companies/redhat | 6 +++
docs/gitdm/companies/suse | 7 +++
docs/gitdm/companies/virtuozzo | 2 +
docs/gitdm/groups/education | 17 ++++++
docs/gitdm/groups/opensource | 12 +++++
docs/gitdm/groups/unaffiliated | 83 ++++++++++++++++++++++++++++
gitdm.config | 37 +++++++++++++
14 files changed, 310 insertions(+)
create mode 100644 docs/gitdm/aliases
create mode 100644 docs/gitdm/companies/canonical
create mode 100644 docs/gitdm/companies/datto
create mode 100644 docs/gitdm/companies/dreamhost
create mode 100644 docs/gitdm/companies/nec
create mode 100644 docs/gitdm/companies/others
create mode 100644 docs/gitdm/companies/redhat
create mode 100644 docs/gitdm/companies/suse
create mode 100644 docs/gitdm/companies/virtuozzo
create mode 100644 docs/gitdm/groups/education
create mode 100644 docs/gitdm/groups/opensource
create mode 100644 docs/gitdm/groups/unaffiliated
create mode 100644 gitdm.config
--
2.21.0
5 years, 5 months
[libvirt] [PATCH] test_driver: implement virDomainSendKey
by Ilias Stamatis
Validate @keycodes and sleep for @holdtime before successfully
returning.
Signed-off-by: Ilias Stamatis <stamatis.iliass(a)gmail.com>
---
src/test/test_driver.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 2f58a1da95..51ded256be 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -64,6 +64,7 @@
#include "virinterfaceobj.h"
#include "virhostcpu.h"
#include "virdomainsnapshotobjlist.h"
+#include "virkeycode.h"
#define VIR_FROM_THIS VIR_FROM_TEST
@@ -5980,6 +5981,44 @@ testDomainScreenshot(virDomainPtr dom ATTRIBUTE_UNUSED,
return ret;
}
+static int
+testDomainSendKey(virDomainPtr domain,
+ unsigned int codeset,
+ unsigned int holdtime,
+ unsigned int *keycodes,
+ int nkeycodes,
+ unsigned int flags)
+{
+ int ret = -1;
+ size_t i;
+ virDomainObjPtr vm = NULL;
+
+ virCheckFlags(0, -1);
+
+ if (!(vm = testDomObjFromDomain(domain)))
+ goto cleanup;
+
+ if (virDomainObjCheckActive(vm) < 0)
+ goto cleanup;
+
+ for (i = 0; i < nkeycodes; i++) {
+ if (virKeycodeValueTranslate(codeset, codeset, keycodes[i]) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("invalid keycode %u of %s codeset"),
+ keycodes[i],
+ virKeycodeSetTypeToString(codeset));
+ goto cleanup;
+ }
+ }
+
+ usleep(holdtime * 1000);
+ ret = 0;
+
+ cleanup:
+ virDomainObjEndAPI(&vm);
+ return ret;
+}
+
static int
testConnectGetCPUModelNames(virConnectPtr conn ATTRIBUTE_UNUSED,
const char *archName,
@@ -7000,6 +7039,7 @@ static virHypervisorDriver testHypervisorDriver = {
.nodeGetCPUMap = testNodeGetCPUMap, /* 1.0.0 */
.domainRename = testDomainRename, /* 4.1.0 */
.domainScreenshot = testDomainScreenshot, /* 1.0.5 */
+ .domainSendKey = testDomainSendKey, /* 5.5.0 */
.domainGetMetadata = testDomainGetMetadata, /* 1.1.3 */
.domainSetMetadata = testDomainSetMetadata, /* 1.1.3 */
.connectGetCPUModelNames = testConnectGetCPUModelNames, /* 1.1.3 */
--
2.21.0
5 years, 5 months