mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
Simplify the Xen get version driver method
The hypervisor driver is mandatory, so the the call to xenHypervisorGetVersion must always succeed. Thus there is no need to ever run xenDaemonGetVersion Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
1cdc465e0e
commit
dfda6e1161
@ -512,16 +512,7 @@ xenUnifiedConnectSupportsFeature(virConnectPtr conn ATTRIBUTE_UNUSED, int featur
|
|||||||
static int
|
static int
|
||||||
xenUnifiedConnectGetVersion(virConnectPtr conn, unsigned long *hvVer)
|
xenUnifiedConnectGetVersion(virConnectPtr conn, unsigned long *hvVer)
|
||||||
{
|
{
|
||||||
xenUnifiedPrivatePtr priv = conn->privateData;
|
return xenHypervisorGetVersion(conn, hvVer);
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
|
|
||||||
if (priv->opened[i] &&
|
|
||||||
drivers[i]->xenVersion &&
|
|
||||||
drivers[i]->xenVersion(conn, hvVer) == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,7 +93,6 @@ extern int xenRegister (void);
|
|||||||
* structure with direct calls in xen_unified.c.
|
* structure with direct calls in xen_unified.c.
|
||||||
*/
|
*/
|
||||||
struct xenUnifiedDriver {
|
struct xenUnifiedDriver {
|
||||||
virDrvConnectGetVersion xenVersion;
|
|
||||||
virDrvConnectGetHostname xenGetHostname;
|
virDrvConnectGetHostname xenGetHostname;
|
||||||
virDrvDomainSuspend xenDomainSuspend;
|
virDrvDomainSuspend xenDomainSuspend;
|
||||||
virDrvDomainResume xenDomainResume;
|
virDrvDomainResume xenDomainResume;
|
||||||
|
@ -880,7 +880,6 @@ typedef struct xen_op_v2_dom xen_op_v2_dom;
|
|||||||
static unsigned long long xenHypervisorGetMaxMemory(virDomainPtr domain);
|
static unsigned long long xenHypervisorGetMaxMemory(virDomainPtr domain);
|
||||||
|
|
||||||
struct xenUnifiedDriver xenHypervisorDriver = {
|
struct xenUnifiedDriver xenHypervisorDriver = {
|
||||||
.xenVersion = xenHypervisorGetVersion,
|
|
||||||
.xenDomainSuspend = xenHypervisorPauseDomain,
|
.xenDomainSuspend = xenHypervisorPauseDomain,
|
||||||
.xenDomainResume = xenHypervisorResumeDomain,
|
.xenDomainResume = xenHypervisorResumeDomain,
|
||||||
.xenDomainDestroyFlags = xenHypervisorDestroyDomainFlags,
|
.xenDomainDestroyFlags = xenHypervisorDestroyDomainFlags,
|
||||||
|
@ -1861,36 +1861,6 @@ xenDaemonNodeGetTopology(virConnectPtr conn, virCapsPtr caps)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* xenDaemonGetVersion:
|
|
||||||
* @conn: pointer to the Xen Daemon block
|
|
||||||
* @hvVer: return value for the version of the running hypervisor (OUT)
|
|
||||||
*
|
|
||||||
* Get the version level of the Hypervisor running.
|
|
||||||
*
|
|
||||||
* Returns -1 in case of error, 0 otherwise. if the version can't be
|
|
||||||
* extracted by lack of capacities returns 0 and @hvVer is 0, otherwise
|
|
||||||
* @hvVer value is major * 1,000,000 + minor * 1,000 + release
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
xenDaemonGetVersion(virConnectPtr conn, unsigned long *hvVer)
|
|
||||||
{
|
|
||||||
struct sexpr *root;
|
|
||||||
int major, minor;
|
|
||||||
unsigned long version;
|
|
||||||
|
|
||||||
root = sexpr_get(conn, "/xend/node/");
|
|
||||||
if (root == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
major = sexpr_int(root, "node/xen_major");
|
|
||||||
minor = sexpr_int(root, "node/xen_minor");
|
|
||||||
sexpr_free(root);
|
|
||||||
version = major * 1000000 + minor * 1000;
|
|
||||||
*hvVer = version;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xenDaemonListDomains:
|
* xenDaemonListDomains:
|
||||||
@ -3652,7 +3622,6 @@ xenDaemonDomainBlockPeek(virDomainPtr domain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct xenUnifiedDriver xenDaemonDriver = {
|
struct xenUnifiedDriver xenDaemonDriver = {
|
||||||
.xenVersion = xenDaemonGetVersion,
|
|
||||||
.xenDomainSuspend = xenDaemonDomainSuspend,
|
.xenDomainSuspend = xenDaemonDomainSuspend,
|
||||||
.xenDomainResume = xenDaemonDomainResume,
|
.xenDomainResume = xenDaemonDomainResume,
|
||||||
.xenDomainShutdown = xenDaemonDomainShutdown,
|
.xenDomainShutdown = xenDaemonDomainShutdown,
|
||||||
|
@ -98,7 +98,6 @@ xenDaemonDomainFetch(virConnectPtr xend,
|
|||||||
int xenDaemonOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
int xenDaemonOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
int xenDaemonClose(virConnectPtr conn);
|
int xenDaemonClose(virConnectPtr conn);
|
||||||
int xenDaemonGetVersion(virConnectPtr conn, unsigned long *hvVer);
|
|
||||||
int xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info);
|
int xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info);
|
||||||
int xenDaemonNodeGetTopology(virConnectPtr conn, virCapsPtr caps);
|
int xenDaemonNodeGetTopology(virConnectPtr conn, virCapsPtr caps);
|
||||||
int xenDaemonDomainSuspend(virDomainPtr domain);
|
int xenDaemonDomainSuspend(virDomainPtr domain);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user