[libvirt] [PATCH 0/3] qemu: Fix two block-job related regressions (blockdev-add saga)
by Peter Krempa
Peter Krempa (3):
qemu: domain: Fix logic bug in qemuDomainStorageSourceAccessAllow
qemu: domain: Allow overriding images to read-write in
qemuDomainStorageSourceAccessAllow
qemu: Use proper block job name when reconnecting to VM
src/qemu/qemu_domain.c | 21 ++++++++++++++-------
src/qemu/qemu_migration.c | 2 +-
src/qemu/qemu_monitor.c | 7 ++++---
src/qemu/qemu_monitor.h | 3 ++-
src/qemu/qemu_monitor_json.c | 12 ++++++++----
src/qemu/qemu_monitor_json.h | 3 ++-
src/qemu/qemu_process.c | 2 +-
7 files changed, 32 insertions(+), 18 deletions(-)
--
2.21.0
5 years, 6 months
[libvirt] [PATCH v2 0/4] test_driver: implement virDomainSaveImageGetXMLDesc and virDomainSaveImageDefineXML
by Ilias Stamatis
Changed in v2:
* in testDomainSaveImageDefineXML check first that a saved image already
exists before parsing the new file
* reordered the arguments of testDomainSaveImageWrite in order for its
signature to be consistent with testDomainSaveImageOpen
While implementing virDomainSaveImageGetXMLDesc and
virDomainSaveImageDefineXML for the test driver, I realized that there
exists already code for saving and loading test images which can be
reused. However, it needed to be extracted from testDomainSaveFlags and
testDomainRestoreFlags into separate functions. The new functions are
inspired by the corresponding QEMU driver code where e.g.
qemuDomainSaveImageOpen serves as a helper used by other functions.
This series of patches initially extracts the code mentioned above into
separate functions and then provides the test driver with
implementations for virDomainSaveImageGetXMLDesc and
virDomainSaveImageDefineXML which make use of the newly introduced
functions.
Ilias Stamatis (4):
test_driver: extract image saving code into a separate function
test_driver: extract image loading code into a separate function
test_driver: implement virDomainSaveImageDefineXML
test_driver: implement virDomainSaveImageGetXMLDesc
src/test/test_driver.c | 293 ++++++++++++++++++++++++++++-------------
1 file changed, 205 insertions(+), 88 deletions(-)
--
2.21.0
5 years, 6 months
[libvirt] [jenkins-ci PATCH] lcitool: Don't warn when using package manager directly
by Andrea Bolognani
We only do this when performing operations that the
corresponding Ansible module doesn't support, so we know
what we're doing and don't want warnings to show up.
Note that while only the dnf and yum modules complain at
the moment, we might as well use warn=no everywhere so that
we're already covered in case in the future the pkgng module
starts detecting this as well.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/playbooks/update/tasks/base.yml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/guests/playbooks/update/tasks/base.yml b/guests/playbooks/update/tasks/base.yml
index 8fe114e..e0efe5d 100644
--- a/guests/playbooks/update/tasks/base.yml
+++ b/guests/playbooks/update/tasks/base.yml
@@ -52,11 +52,15 @@
- name: Update installed packages
shell: '{{ package_manager }} update && {{ package_manager }} upgrade -y'
+ args:
+ warn: no
when:
- package_format == 'pkg'
- name: Clean up packages after update
shell: '{{ package_manager }} clean packages -y && {{ package_manager }} autoremove -y'
+ args:
+ warn: no
when:
- package_format == 'rpm'
@@ -69,6 +73,8 @@
- name: Clean up packages after update
shell: '{{ package_manager }} clean -y && {{ package_manager }} autoremove -y'
+ args:
+ warn: no
when:
- package_format == 'pkg'
--
2.21.0
5 years, 6 months
Re: [libvirt] [Qemu-devel] PCI(e): Documentation "io-reserve" and related properties?
by Andrea Bolognani
On Thu, 2019-06-06 at 14:20 -0400, Michael S. Tsirkin wrote:
> On Thu, Jun 06, 2019 at 06:19:43PM +0200, Kashyap Chamarthy wrote:
> > Hi folks,
> >
> > Today I learnt about some obscure PCIe-related properties, in context of
> > the adding PCIe root ports to a guest, namely:
> >
> > io-reserve
> > mem-reserve
> > bus-reserve
> > pref32-reserve
> > pref64-reserve
> >
> > Unfortunately, the commit[*] that added them provided no documentation
> > whatsover.
> >
> > In my scenario, I was specifically wondering about what does
> > "io-reserve" mean, in what context to use it, etc. (But documentation
> > about other properties is also welcome.)
> >
> > Anyone more well-versed in this area care to shed some light?
> >
> >
> > [*] 6755e618d0 (hw/pci: add PCI resource reserve capability to legacy
> > PCI bridge, 2018-08-21)
>
> So normally bios would reserve just enough io space to satisfy all
> devices behind a bridge. What if you intend to hotplug more devices?
> These properties allow you to ask bios to reserve extra space.
Is it fair to say that setting io-reserve=0 for a pcie-root-port
would be a way to implement the requirements set forth in
https://bugzilla.redhat.com/show_bug.cgi?id=1408810
? I tested this on aarch64 and it seems to work as expected, but
then again without documentation it's hard to tell.
More specifically, I created an aarch64/virt guest with several
pcie-root-ports and it couldn't boot much further than GRUB when
the number of ports exceeded 24, but as soon as I added the
io-reserve=0 option I could get the same guest to boot fine with
32 or even 64 pcie-root-ports. I'm attaching the boot log for
reference: there are a bunch of messages about the topic but they
would appear to be benign.
Hotplug seemed to work too: I tried with a single virtio-net-pci
and I could access the network. My understanding is that PCIe
devices are required to work without IO space, so this behavior
matches my expectations.
I wonder, though, what would happen if I had something like
-device pcie-root-port,io-reserve=0,id=pci.1
-device pcie-pci-bridge,bus=pci.1
Would I be able to hotplug conventional PCI devices into the
pcie-pci-bridge, or would the lack of IO space reservation for
the pcie-root-port cause issues with that?
--
Andrea Bolognani / Red Hat / Virtualization
5 years, 6 months
[libvirt] Question about Windows builds
by Christopher Loyd Nugent
My name is Christopher Nugent. This is my first time posting to the
mailing list, and I am still adjusting to the community norms. If I do
anything out of line, please let me know. Anyway, on to the question:
I am attempting to use libvirt in a Windows application I am developing,
and came upon the following in the documentation:
Libvirt is known to work as a client (not server) on Windows XP
(32-bit), and Windows 7 (64-bit).
I am a bit confused as to what this means. Does it mean that I won't be
able to use libvirt in a host configuration, Hyper-V acting as the
underlying hypervisor?
I am posting to the development list because, if I am right, I would
like to donate my time to amend the situation. My application will be
cross-platform and will
support multiple hypervisors, so using libvirt will help me not have to
duplicate functionality.
Thank you for your time.
--Chris Nugent.
5 years, 6 months
[libvirt] [PATCH]daemon: Fix a crash during virNetlinkEventServiceStopAll
by Liu Haitao
The virNetlinkEventServiceStopAll() should be executed behind virStateCleanup(),
for some important resources like(static virNetlinkEventSrvPrivatePtr server)
are freed unexpected. However virStateCleanup() need to use this
variable(server).
The call trace of virNetlinkEventServiceStopAll:
virNetlinkEventServiceStopAll()
--> virNetlinkEventServiceStop()
--> server[protocol] = NULL; // set server to null
The call trace of virStateCleanup():
virStateCleanup()
-->qemuStateCleanup()
-->qemuProcessStop()
-->virNetDevMacVLanDeleteWithVPortProfile()
-->virNetlinkEventRemoveClient()
--> srv = server[protocol]
In virNetlinkEventRemoveClient() the variable server is used again, but now it
is null that is freed by virNetlinkEventServiceStopAll().So it would case a crash .
The call trace of crash:
(gdb) bt
0 __GI___pthread_mutex_lock (mutex=0x0) at /usr/src/debug/glibc/2.24-r0/git/nptl/pthread_mutex_lock.c:67
1 0x00007fb0d555d0f9 in virNetlinkEventRemoveClient () from /usr/lib64/libvirt.so.0
2 0x00007fb0d55551df in virNetDevMacVLanDeleteWithVPortProfile () from /usr/lib64/libvirt.so.0
3 0x00007fb0c1131251 in qemuProcessStop () from /usr/lib64/libvirt/connection-driver/libvirt_driver_qemu.so
4 0x00007fb0c11995ea in ?? () from /usr/lib64/libvirt/connection-driver/libvirt_driver_qemu.so
5 0x00007fb0d5588c5b in ?? () from /usr/lib64/libvirt.so.0
6 0x00007fb0d5587fe8 in ?? () from /usr/lib64/libvirt.so.0
7 0x00007fb0d19533f4 in start_thread (arg=0x7fb0be17b700) at /usr/src/debug/glibc/2.24-r0/git/nptl/pthread_create.c:456
8 0x00007fb0d128f10f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:105
Signed-off-by: Liu Haitao <haitao.liu(a)windriver.com>
---
src/remote/remote_daemon.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index c3782971f1..7da20a6644 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -1464,8 +1464,6 @@ int main(int argc, char **argv) {
/* Keep cleanup order in inverse order of startup */
virNetDaemonClose(dmn);
- virNetlinkEventServiceStopAll();
-
if (driversInitialized) {
/* NB: Possible issue with timing window between driversInitialized
* setting if virNetlinkEventServerStart fails */
@@ -1473,6 +1471,8 @@ int main(int argc, char **argv) {
virStateCleanup();
}
+ virNetlinkEventServiceStopAll();
+
virObjectUnref(adminProgram);
virObjectUnref(srvAdm);
virObjectUnref(qemuProgram);
--
2.21.0
5 years, 6 months
[libvirt] [PATCH 0/4] incremental backup: QMP interactions
by Eric Blake
I'm trying to break my incremental backup work into smaller pieces so
I can make progress and actually get some code committed, while I
continue to hammer away at preparing a v9 series that addresses even
more review comments and things learned during testing. These few
patches represent the bulk of 14-15/21 from v8, except that the
operation to update Checkpoint size must come later in the series when
checkpoint_conf.h is ready.
Another reason to commit this now, even without the incremental backup
clients of the new capabilities, is that capability additions tend to
be a conflict magnet, so I'd rather stabilize this and reduce the
amount of rebase work I have been doing.
Changes from v8:
- improve testing of nbd-server-start
- split up QMP changes into more manageable pieces
- address formatting review comments
Eric Blake (4):
backup: Prepare for Unix sockets in QMP nbd-server-start
backup: Add two new qemu capabilities
backup: Add new qemu monitor bitmap
backup: Add new parameters to qemu monitor nbd-server-add
src/qemu/qemu_capabilities.h | 4 +
src/qemu/qemu_monitor.h | 29 +++-
src/qemu/qemu_monitor_json.h | 24 ++-
src/qemu/qemu_capabilities.c | 6 +
src/qemu/qemu_migration.c | 9 +-
src/qemu/qemu_monitor.c | 74 ++++++++-
src/qemu/qemu_monitor_json.c | 149 +++++++++++++++++-
.../caps_4.0.0.aarch64.xml | 2 +
.../qemucapabilitiesdata/caps_4.0.0.ppc64.xml | 2 +
.../caps_4.0.0.riscv32.xml | 2 +
.../caps_4.0.0.riscv64.xml | 2 +
.../qemucapabilitiesdata/caps_4.0.0.s390x.xml | 2 +
.../caps_4.0.0.x86_64.xml | 2 +
tests/qemumonitorjsontest.c | 60 ++++++-
14 files changed, 341 insertions(+), 26 deletions(-)
--
2.20.1
5 years, 6 months
[libvirt] [RFC PATCH] qemumonitorjsontest: Use VIR_AUTOPTR for test cleanup
by Eric Blake
Everywhere else is switching, we might as well use it here, too.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Partial patch - is it worth me continuing the cleanups on the rest of
the file?
---
tests/qemumonitortestutils.h | 3 +++
tests/qemumonitorjsontest.c | 35 +++++++++++++++--------------------
2 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h
index 8461c80caa..a2d2d30820 100644
--- a/tests/qemumonitortestutils.h
+++ b/tests/qemumonitortestutils.h
@@ -24,6 +24,7 @@
# include "qemu/qemu_conf.h"
# include "qemu/qemu_monitor.h"
# include "qemu/qemu_agent.h"
+# include "virautoclean.h"
typedef struct _qemuMonitorTest qemuMonitorTest;
typedef qemuMonitorTest *qemuMonitorTestPtr;
@@ -102,4 +103,6 @@ qemuMonitorPtr qemuMonitorTestGetMonitor(qemuMonitorTestPtr test);
qemuAgentPtr qemuMonitorTestGetAgent(qemuMonitorTestPtr test);
virDomainObjPtr qemuMonitorTestGetDomainObj(qemuMonitorTestPtr test);
+VIR_DEFINE_AUTOPTR_FUNC(qemuMonitorTest, qemuMonitorTestFree);
+
#endif /* LIBVIRT_QEMUMONITORTESTUTILS_H */
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index a7f64058d4..10bffce2a3 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -152,12 +152,11 @@ testQemuMonitorJSONGetStatus(const void *opaque)
{
const testGenericData *data = opaque;
virDomainXMLOptionPtr xmlopt = data->xmlopt;
- qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
- int ret = -1;
+ VIR_AUTOPTR(qemuMonitorTest) test = NULL;
bool running = false;
virDomainPausedReason reason = 0;
- if (!test)
+ if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
return -1;
if (qemuMonitorTestAddItem(test, "query-status",
@@ -168,7 +167,7 @@ testQemuMonitorJSONGetStatus(const void *opaque)
" \"running\": true "
" } "
"}") < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorTestAddItem(test, "query-status",
"{ "
" \"return\": { "
@@ -176,7 +175,7 @@ testQemuMonitorJSONGetStatus(const void *opaque)
" \"running\": false "
" } "
"}") < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorTestAddItem(test, "query-status",
"{ "
" \"return\": { "
@@ -185,61 +184,57 @@ testQemuMonitorJSONGetStatus(const void *opaque)
" \"running\": false "
" } "
"}") < 0)
- goto cleanup;
+ return -1;
if (qemuMonitorGetStatus(qemuMonitorTestGetMonitor(test),
&running, &reason) < 0)
- goto cleanup;
+ return -1;
if (!running) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"Running was not true");
- goto cleanup;
+ return -1;
}
if (reason != VIR_DOMAIN_PAUSED_UNKNOWN) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"Reason was unexpectedly set to %d", reason);
- goto cleanup;
+ return -1;
}
if (qemuMonitorGetStatus(qemuMonitorTestGetMonitor(test),
&running, &reason) < 0)
- goto cleanup;
+ return -1;
if (running) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"Running was not false");
- goto cleanup;
+ return -1;
}
if (reason != VIR_DOMAIN_PAUSED_UNKNOWN) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"Reason was unexpectedly set to %d", reason);
- goto cleanup;
+ return -1;
}
if (qemuMonitorGetStatus(qemuMonitorTestGetMonitor(test),
&running, &reason) < 0)
- goto cleanup;
+ return -1;
if (running) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"Running was not false");
- goto cleanup;
+ return -1;
}
if (reason != VIR_DOMAIN_PAUSED_MIGRATION) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"Reason was unexpectedly set to %d", reason);
- goto cleanup;
+ return -1;
}
- ret = 0;
-
- cleanup:
- qemuMonitorTestFree(test);
- return ret;
+ return 0;
}
static int
--
2.20.1
5 years, 6 months
[libvirt] [PATCH] qemumonitorjsontest: Validate more commands against schema
by Eric Blake
The DO_TEST() macro in qemumonitorjsontest.c was not passing the
schema through, which meant that we were not validating any of those
tests for correct usage according to the schema.
Tested by using this hack, where the test mistakenly passed pre-patch,
but correctly diagnosed the garbage post-patch:
| diff --git i/src/qemu/qemu_monitor_json.c w/src/qemu/qemu_monitor_json.c
| index 53a7de8b77..86d8450814 100644
| --- i/src/qemu/qemu_monitor_json.c
| +++ w/src/qemu/qemu_monitor_json.c
| @@ -1532,7 +1532,8 @@ qemuMonitorJSONGetStatus(qemuMonitorPtr mon,
| if (reason)
| *reason = VIR_DOMAIN_PAUSED_UNKNOWN;
|
| - if (!(cmd = qemuMonitorJSONMakeCommand("query-status", NULL)))
| + if (!(cmd = qemuMonitorJSONMakeCommand("query-status",
| + "s:garbage", "foo", NULL)))
| return -1;
|
| if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
Suggested-by: Peter Krempa <pkrempa(a)redhat.com>
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
tests/qemumonitorjsontest.c | 251 +++++++++++++++++++++---------------
1 file changed, 149 insertions(+), 102 deletions(-)
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 0894e748ae..a7f64058d4 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -48,6 +48,12 @@ struct _testQemuMonitorJSONSimpleFuncData {
virHashTablePtr schema;
};
+typedef struct _testGenericData testGenericData;
+struct _testGenericData {
+ virDomainXMLOptionPtr xmlopt;
+ virHashTablePtr schema;
+};
+
const char *queryBlockReply =
"{"
" \"return\": ["
@@ -142,10 +148,11 @@ const char *queryBlockReply =
"}";
static int
-testQemuMonitorJSONGetStatus(const void *data)
+testQemuMonitorJSONGetStatus(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
bool running = false;
virDomainPausedReason reason = 0;
@@ -236,10 +243,11 @@ testQemuMonitorJSONGetStatus(const void *data)
}
static int
-testQemuMonitorJSONGetVersion(const void *data)
+testQemuMonitorJSONGetVersion(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
int major;
int minor;
@@ -339,10 +347,11 @@ testQemuMonitorJSONGetVersion(const void *data)
}
static int
-testQemuMonitorJSONGetMachines(const void *data)
+testQemuMonitorJSONGetMachines(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
qemuMonitorMachineInfoPtr *info;
int ninfo = 0;
@@ -421,10 +430,11 @@ testQemuMonitorJSONGetMachines(const void *data)
static int
-testQemuMonitorJSONGetCPUDefinitions(const void *data)
+testQemuMonitorJSONGetCPUDefinitions(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
qemuMonitorCPUDefInfoPtr *cpus = NULL;
int ncpus = 0;
@@ -504,10 +514,11 @@ testQemuMonitorJSONGetCPUDefinitions(const void *data)
static int
-testQemuMonitorJSONGetCommands(const void *data)
+testQemuMonitorJSONGetCommands(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
char **commands = NULL;
int ncommands = 0;
@@ -569,10 +580,11 @@ testQemuMonitorJSONGetCommands(const void *data)
static int
-testQemuMonitorJSONGetTPMModels(const void *data)
+testQemuMonitorJSONGetTPMModels(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
char **tpmmodels = NULL;
int ntpmmodels = 0;
@@ -622,10 +634,11 @@ testQemuMonitorJSONGetTPMModels(const void *data)
static int
-testQemuMonitorJSONGetCommandLineOptionParameters(const void *data)
+testQemuMonitorJSONGetCommandLineOptionParameters(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
char **params = NULL;
int nparams = 0;
@@ -776,6 +789,7 @@ testQemuMonitorJSONAttachChardev(const void *opaque)
static int
qemuMonitorJSONTestAttachOneChardev(virDomainXMLOptionPtr xmlopt,
+ virHashTablePtr schema,
const char *label,
virDomainChrSourceDefPtr chr,
const char *expectargs,
@@ -801,7 +815,7 @@ qemuMonitorJSONTestAttachOneChardev(virDomainXMLOptionPtr xmlopt,
data.chr = chr;
data.fail = fail;
data.expectPty = expectPty;
- if (!(data.test = qemuMonitorTestNewSimple(true, xmlopt)))
+ if (!(data.test = qemuMonitorTestNewSchema(xmlopt, schema)))
goto cleanup;
if (qemuMonitorTestAddItemExpect(data.test, "chardev-add",
@@ -821,14 +835,15 @@ qemuMonitorJSONTestAttachOneChardev(virDomainXMLOptionPtr xmlopt,
}
static int
-qemuMonitorJSONTestAttachChardev(virDomainXMLOptionPtr xmlopt)
+qemuMonitorJSONTestAttachChardev(virDomainXMLOptionPtr xmlopt,
+ virHashTablePtr schema)
{
virDomainChrSourceDef chr;
int ret = 0;
#define CHECK(label, fail, expectargs) \
- if (qemuMonitorJSONTestAttachOneChardev(xmlopt, label, &chr, expectargs, \
- NULL, NULL, fail) < 0) \
+ if (qemuMonitorJSONTestAttachOneChardev(xmlopt, schema, label, &chr, \
+ expectargs, NULL, NULL, fail) < 0) \
ret = -1
chr = (virDomainChrSourceDef) { .type = VIR_DOMAIN_CHR_TYPE_NULL };
@@ -840,7 +855,7 @@ qemuMonitorJSONTestAttachChardev(virDomainXMLOptionPtr xmlopt)
"{'id':'alias','backend':{'type':'null','data':{}}}");
chr = (virDomainChrSourceDef) { .type = VIR_DOMAIN_CHR_TYPE_PTY };
- if (qemuMonitorJSONTestAttachOneChardev(xmlopt, "pty", &chr,
+ if (qemuMonitorJSONTestAttachOneChardev(xmlopt, schema, "pty", &chr,
"{'id':'alias',"
"'backend':{'type':'pty',"
"'data':{}}}",
@@ -938,10 +953,11 @@ qemuMonitorJSONTestAttachChardev(virDomainXMLOptionPtr xmlopt)
static int
-testQemuMonitorJSONDetachChardev(const void *data)
+testQemuMonitorJSONDetachChardev(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
if (!test)
@@ -971,10 +987,11 @@ testQemuMonitorJSONDetachChardev(const void *data)
* {"name": "type", "type": "string"}]}
*/
static int
-testQemuMonitorJSONGetListPaths(const void *data)
+testQemuMonitorJSONGetListPaths(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
qemuMonitorJSONListPathPtr *paths;
int npaths = 0;
@@ -1049,10 +1066,11 @@ testQemuMonitorJSONGetListPaths(const void *data)
* {"return": true}
*/
static int
-testQemuMonitorJSONGetObjectProperty(const void *data)
+testQemuMonitorJSONGetObjectProperty(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
qemuMonitorJSONObjectProperty prop;
@@ -1092,10 +1110,11 @@ testQemuMonitorJSONGetObjectProperty(const void *data)
* false is not a good idea...
*/
static int
-testQemuMonitorJSONSetObjectProperty(const void *data)
+testQemuMonitorJSONSetObjectProperty(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
qemuMonitorJSONObjectProperty prop;
@@ -1144,10 +1163,11 @@ testQemuMonitorJSONSetObjectProperty(const void *data)
static int
-testQemuMonitorJSONGetDeviceAliases(const void *data)
+testQemuMonitorJSONGetDeviceAliases(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
char **aliases = NULL;
const char **alias;
@@ -1204,10 +1224,11 @@ testQemuMonitorJSONGetDeviceAliases(const void *data)
}
static int
-testQemuMonitorJSONCPU(const void *data)
+testQemuMonitorJSONCPU(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
bool running = false;
virDomainPausedReason reason = 0;
@@ -1407,10 +1428,11 @@ testQEMUMonitorJSONqemuMonitorJSONQueryCPUsHelper(qemuMonitorTestPtr test,
static int
-testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const void *data)
+testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
struct qemuMonitorQueryCpusEntry expect_slow[] = {
{0, 17622, (char *) "/machine/unattached/device[0]", true},
@@ -1501,10 +1523,11 @@ testQemuMonitorJSONqemuMonitorJSONQueryCPUs(const void *data)
}
static int
-testQemuMonitorJSONqemuMonitorJSONGetBalloonInfo(const void *data)
+testQemuMonitorJSONqemuMonitorJSONGetBalloonInfo(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
unsigned long long currmem;
@@ -1537,10 +1560,11 @@ testQemuMonitorJSONqemuMonitorJSONGetBalloonInfo(const void *data)
}
static int
-testQemuMonitorJSONqemuMonitorJSONGetVirtType(const void *data)
+testQemuMonitorJSONqemuMonitorJSONGetVirtType(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
virDomainVirtType virtType;
@@ -1614,10 +1638,11 @@ testHashEqualQemuDomainDiskInfo(const void *value1, const void *value2)
}
static int
-testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const void *data)
+testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
virHashTablePtr blockDevices = NULL, expectedBlockDevices = NULL;
struct qemuDomainDiskInfo *info;
@@ -1693,10 +1718,11 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const void *data)
}
static int
-testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInfo(const void *data)
+testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInfo(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
virHashTablePtr blockstats = NULL;
qemuBlockStatsPtr stats;
int ret = -1;
@@ -1855,10 +1881,11 @@ testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInfo(const void *data)
static int
-testQemuMonitorJSONqemuMonitorJSONGetMigrationCacheSize(const void *data)
+testQemuMonitorJSONqemuMonitorJSONGetMigrationCacheSize(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
unsigned long long cacheSize;
@@ -1891,10 +1918,11 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCacheSize(const void *data)
}
static int
-testQemuMonitorJSONqemuMonitorJSONGetMigrationStats(const void *data)
+testQemuMonitorJSONqemuMonitorJSONGetMigrationStats(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
qemuMonitorMigrationStats stats, expectedStats;
char *error = NULL;
@@ -1986,10 +2014,11 @@ testHashEqualChardevInfo(const void *value1, const void *value2)
static int
-testQemuMonitorJSONqemuMonitorJSONGetChardevInfo(const void *data)
+testQemuMonitorJSONqemuMonitorJSONGetChardevInfo(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
virHashTablePtr info = NULL, expectedInfo = NULL;
qemuMonitorChardevInfo info0 = { NULL, VIR_DOMAIN_CHR_DEVICE_STATE_DEFAULT };
@@ -2107,10 +2136,11 @@ testValidateGetBlockIoThrottle(const virDomainBlockIoTuneInfo *info,
static int
-testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle(const void *data)
+testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
virDomainBlockIoTuneInfo info, expectedInfo;
@@ -2162,10 +2192,11 @@ testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle(const void *data)
}
static int
-testQemuMonitorJSONqemuMonitorJSONGetTargetArch(const void *data)
+testQemuMonitorJSONqemuMonitorJSONGetTargetArch(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
char *arch;
@@ -2199,10 +2230,11 @@ testQemuMonitorJSONqemuMonitorJSONGetTargetArch(const void *data)
}
static int
-testQemuMonitorJSONqemuMonitorJSONGetMigrationCapabilities(const void *data)
+testQemuMonitorJSONqemuMonitorJSONGetMigrationCapabilities(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
const char *cap;
char **caps = NULL;
@@ -2259,10 +2291,11 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCapabilities(const void *data)
}
static int
-testQemuMonitorJSONqemuMonitorJSONSendKey(const void *data)
+testQemuMonitorJSONqemuMonitorJSONSendKey(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
unsigned int keycodes[] = {43, 26, 46, 32};
@@ -2284,10 +2317,11 @@ testQemuMonitorJSONqemuMonitorJSONSendKey(const void *data)
}
static int
-testQemuMonitorJSONqemuMonitorJSONSendKeyHoldtime(const void *data)
+testQemuMonitorJSONqemuMonitorJSONSendKeyHoldtime(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
unsigned int keycodes[] = {43, 26, 46, 32};
@@ -2316,10 +2350,11 @@ testQemuMonitorJSONqemuMonitorJSONSendKeyHoldtime(const void *data)
}
static int
-testQemuMonitorJSONqemuMonitorSupportsActiveCommit(const void *data)
+testQemuMonitorJSONqemuMonitorSupportsActiveCommit(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
const char *error1 =
"{"
@@ -2362,10 +2397,11 @@ testQemuMonitorJSONqemuMonitorSupportsActiveCommit(const void *data)
}
static int
-testQemuMonitorJSONqemuMonitorJSONGetDumpGuestMemoryCapability(const void *data)
+testQemuMonitorJSONqemuMonitorJSONGetDumpGuestMemoryCapability(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
int ret = -1;
int cap;
const char *reply =
@@ -2407,6 +2443,7 @@ testQemuMonitorJSONqemuMonitorJSONGetDumpGuestMemoryCapability(const void *data)
struct testCPUData {
const char *name;
virDomainXMLOptionPtr xmlopt;
+ virHashTablePtr schema;
};
@@ -2414,7 +2451,8 @@ static int
testQemuMonitorJSONGetCPUData(const void *opaque)
{
const struct testCPUData *data = opaque;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, data->xmlopt);
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(data->xmlopt,
+ data->schema);
virCPUDataPtr cpuData = NULL;
char *jsonFile = NULL;
char *dataFile = NULL;
@@ -2480,8 +2518,9 @@ testQemuMonitorJSONGetCPUData(const void *opaque)
static int
testQemuMonitorJSONGetNonExistingCPUData(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr) opaque;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
virCPUDataPtr cpuData = NULL;
int rv, ret = -1;
@@ -2522,10 +2561,11 @@ testQemuMonitorJSONGetNonExistingCPUData(const void *opaque)
}
static int
-testQemuMonitorJSONGetIOThreads(const void *data)
+testQemuMonitorJSONGetIOThreads(const void *opaque)
{
- virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
+ const testGenericData *data = opaque;
+ virDomainXMLOptionPtr xmlopt = data->xmlopt;
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(xmlopt, data->schema);
qemuMonitorIOThreadInfoPtr *info;
int ninfo = 0;
int ret = -1;
@@ -2596,6 +2636,7 @@ struct testCPUInfoData {
size_t maxvcpus;
virDomainXMLOptionPtr xmlopt;
bool fast;
+ virHashTablePtr schema;
};
@@ -2664,7 +2705,8 @@ static int
testQemuMonitorCPUInfo(const void *opaque)
{
const struct testCPUInfoData *data = opaque;
- qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, data->xmlopt);
+ qemuMonitorTestPtr test = qemuMonitorTestNewSchema(data->xmlopt,
+ data->schema);
virDomainObjPtr vm = NULL;
char *queryCpusFile = NULL;
char *queryHotpluggableFile = NULL;
@@ -2921,8 +2963,11 @@ mymain(void)
}
#define DO_TEST(name) \
- if (virTestRun(# name, testQemuMonitorJSON ## name, driver.xmlopt) < 0) \
- ret = -1
+ do { \
+ testGenericData data = { driver.xmlopt, qapiData.schema }; \
+ if (virTestRun(# name, testQemuMonitorJSON ## name, &data) < 0) \
+ ret = -1; \
+ } while (0)
#define DO_TEST_SIMPLE(CMD, FNC, ...) \
simpleFunc = (testQemuMonitorJSONSimpleFuncData) {.cmd = CMD, .func = FNC, \
@@ -2941,7 +2986,7 @@ mymain(void)
#define DO_TEST_CPU_DATA(name) \
do { \
- struct testCPUData data = { name, driver.xmlopt }; \
+ struct testCPUData data = { name, driver.xmlopt, qapiData.schema }; \
const char *label = "GetCPUData(" name ")"; \
if (virTestRun(label, testQemuMonitorJSONGetCPUData, &data) < 0) \
ret = -1; \
@@ -2949,7 +2994,8 @@ mymain(void)
#define DO_TEST_CPU_INFO(name, maxvcpus) \
do { \
- struct testCPUInfoData data = {name, maxvcpus, driver.xmlopt, false}; \
+ struct testCPUInfoData data = {name, maxvcpus, driver.xmlopt, false, \
+ qapiData.schema}; \
if (virTestRun("GetCPUInfo(" name ")", testQemuMonitorCPUInfo, \
&data) < 0) \
ret = -1; \
@@ -2957,7 +3003,8 @@ mymain(void)
#define DO_TEST_CPU_INFO_FAST(name, maxvcpus) \
do { \
- struct testCPUInfoData data = {name, maxvcpus, driver.xmlopt, true}; \
+ struct testCPUInfoData data = {name, maxvcpus, driver.xmlopt, true, \
+ qapiData.schema }; \
if (virTestRun("GetCPUInfo(" name ")", testQemuMonitorCPUInfo, \
&data) < 0) \
ret = -1; \
@@ -2970,7 +3017,7 @@ mymain(void)
DO_TEST(GetCommands);
DO_TEST(GetTPMModels);
DO_TEST(GetCommandLineOptionParameters);
- if (qemuMonitorJSONTestAttachChardev(driver.xmlopt) < 0)
+ if (qemuMonitorJSONTestAttachChardev(driver.xmlopt, qapiData.schema) < 0)
ret = -1;
DO_TEST(DetachChardev);
DO_TEST(GetListPaths);
--
2.20.1
5 years, 6 months