mirror of https://gitee.com/openkylin/libvirt.git
Xen: Fake versions in xencapstest
virInitialize() → xenRegister() → xenhypervisorInit() determines the version of the Hypervisor. This breaks xencapstest when building as root on a dom0 system, since xenHypervisorBuildCapabilities() adds the "hap" and "viridian" features based on the detected version. Add an optional parameter to xenhypervisorInit() to disable automatic detection of the Hypervisor version. The passed in arguments are used instead. Signed-off-by: Philipp Hahn <hahn@univention.de>
This commit is contained in:
parent
618758c9b4
commit
435b9d99cc
|
@ -2272,7 +2272,7 @@ int
|
|||
xenRegister (void)
|
||||
{
|
||||
/* Ignore failures here. */
|
||||
(void) xenHypervisorInit ();
|
||||
(void) xenHypervisorInit (NULL);
|
||||
|
||||
#ifdef WITH_LIBVIRTD
|
||||
if (virRegisterStateDriver (&state_driver) == -1) return -1;
|
||||
|
|
|
@ -1951,12 +1951,16 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt,
|
|||
|
||||
/**
|
||||
* xenHypervisorInit:
|
||||
* @override_versions: pointer to optional struct xenHypervisorVersions with
|
||||
* version information used instead of automatic version detection.
|
||||
*
|
||||
* Initialize the hypervisor layer. Try to detect the kind of interface
|
||||
* used i.e. pre or post changeset 10277
|
||||
*
|
||||
* Returns 0 or -1 in case of failure
|
||||
*/
|
||||
int
|
||||
xenHypervisorInit(void)
|
||||
xenHypervisorInit(struct xenHypervisorVersions *override_versions)
|
||||
{
|
||||
int fd, ret, cmd, errcode;
|
||||
hypercall_t hc;
|
||||
|
@ -2007,6 +2011,12 @@ xenHypervisorInit(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (override_versions) {
|
||||
hv_versions = *override_versions;
|
||||
in_init = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Xen hypervisor version detection begins. */
|
||||
ret = open(XEN_HYPERVISOR_SOCKET, O_RDWR);
|
||||
if (ret < 0) {
|
||||
|
@ -2188,7 +2198,7 @@ xenHypervisorOpen(virConnectPtr conn,
|
|||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
||||
|
||||
if (initialized == 0)
|
||||
if (xenHypervisorInit() == -1)
|
||||
if (xenHypervisorInit(NULL) == -1)
|
||||
return -1;
|
||||
|
||||
priv->handle = -1;
|
||||
|
|
|
@ -26,7 +26,7 @@ struct xenHypervisorVersions {
|
|||
};
|
||||
|
||||
extern struct xenUnifiedDriver xenHypervisorDriver;
|
||||
int xenHypervisorInit (void);
|
||||
int xenHypervisorInit(struct xenHypervisorVersions *override_versions);
|
||||
|
||||
virCapsPtr xenHypervisorMakeCapabilities (virConnectPtr conn);
|
||||
|
||||
|
|
|
@ -145,11 +145,21 @@ static int testXenppc64(const void *data ATTRIBUTE_UNUSED) {
|
|||
}
|
||||
|
||||
|
||||
/* Fake initialization data for xenHypervisorInit(). Must be initialized
|
||||
* explicitly before the implicit call via virInitialize(). */
|
||||
static struct xenHypervisorVersions hv_versions = {
|
||||
.hv = 0,
|
||||
.hypervisor = 2,
|
||||
.sys_interface = -1,
|
||||
.dom_interface = -1,
|
||||
};
|
||||
|
||||
static int
|
||||
mymain(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
xenHypervisorInit(&hv_versions);
|
||||
virInitialize();
|
||||
|
||||
if (virtTestRun("Capabilities for i686, no PAE, no HVM",
|
||||
|
|
Loading…
Reference in New Issue