mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
test_driver: Implement virConnectGetDomainCapabilities()
Our test driver lacks implementation for virConnectGetDomainCapabilities(). Provide one, though a trivial one. Mostly so that something else than VIR_ERR_NO_SUPPORT error is returned. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
19484ccac5
commit
e45240d37f
@ -66,7 +66,8 @@ The root element that emulator capability XML document starts with has name
|
||||
</domainCapabilities>
|
||||
|
||||
``path``
|
||||
The full path to the emulator binary.
|
||||
The full path to the emulator binary. Since not every hypervisor has a
|
||||
notion of emulator binary this element might be omitted in such drivers.
|
||||
``domain``
|
||||
Describes the `virtualization type <formatdomain.html#element-and-attribute-overview>`__ (or so
|
||||
called domain type).
|
||||
|
@ -11,9 +11,11 @@
|
||||
<define name="domainCapabilities">
|
||||
<element name="domainCapabilities">
|
||||
<interleave>
|
||||
<element name="path">
|
||||
<ref name="absFilePath"/>
|
||||
</element>
|
||||
<optional>
|
||||
<element name="path">
|
||||
<ref name="absFilePath"/>
|
||||
</element>
|
||||
</optional>
|
||||
<element name="domain">
|
||||
<text/>
|
||||
</element>
|
||||
|
@ -10000,6 +10000,41 @@ testNetworkSetMetadata(virNetworkPtr net,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *
|
||||
testConnectGetDomainCapabilities(virConnectPtr conn G_GNUC_UNUSED,
|
||||
const char *emulatorbin,
|
||||
const char *arch_str,
|
||||
const char *machine,
|
||||
const char *virttype_str,
|
||||
unsigned int flags)
|
||||
{
|
||||
g_autoptr(virDomainCaps) domCaps = NULL;
|
||||
virArch arch = VIR_ARCH_I686;
|
||||
int virttype = VIR_DOMAIN_VIRT_TEST;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
if (arch_str &&
|
||||
(arch = virArchFromString(arch_str)) == VIR_ARCH_NONE) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("unknown architecture: %1$s"), arch_str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (virttype_str &&
|
||||
(virttype = virDomainVirtTypeFromString(virttype_str)) < 0) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("unknown virttype: %1$s"), virttype_str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(domCaps = virDomainCapsNew(emulatorbin, machine, arch, virttype)))
|
||||
return NULL;
|
||||
|
||||
return virDomainCapsFormat(domCaps);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Test driver
|
||||
*/
|
||||
@ -10167,6 +10202,7 @@ static virHypervisorDriver testHypervisorDriver = {
|
||||
.domainCheckpointGetParent = testDomainCheckpointGetParent, /* 5.6.0 */
|
||||
.domainCheckpointDelete = testDomainCheckpointDelete, /* 5.6.0 */
|
||||
.domainGetMessages = testDomainGetMessages, /* 7.6.0 */
|
||||
.connectGetDomainCapabilities = testConnectGetDomainCapabilities, /* 9.8.0 */
|
||||
};
|
||||
|
||||
static virNetworkDriver testNetworkDriver = {
|
||||
|
Loading…
Reference in New Issue
Block a user