You need to sign in or sign up before continuing.
提交 f90857b3 编写于 作者: G Giuseppe Scrivano 提交者: Eric Blake

libvirt: add new public API virConnectGetCPUModelNames

The new function virConnectGetCPUModelNames allows to retrieve the list
of CPU models known by the hypervisor for a specific architecture.
Signed-off-by: NGiuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: NEric Blake <eblake@redhat.com>
上级 b0d9207b
...@@ -4006,6 +4006,10 @@ int virConnectCompareCPU(virConnectPtr conn, ...@@ -4006,6 +4006,10 @@ int virConnectCompareCPU(virConnectPtr conn,
const char *xmlDesc, const char *xmlDesc,
unsigned int flags); unsigned int flags);
int virConnectGetCPUModelNames(virConnectPtr conn,
const char *arch,
char ***models,
unsigned int flags);
/** /**
* virConnectBaselineCPUFlags * virConnectBaselineCPUFlags
......
...@@ -366,6 +366,7 @@ foreign_encoding_args = ( ...@@ -366,6 +366,7 @@ foreign_encoding_args = (
# Class methods which are written by hand in libvirt.c but the Python-level # Class methods which are written by hand in libvirt.c but the Python-level
# code is still automatically generated (so they are not in skip_function()). # code is still automatically generated (so they are not in skip_function()).
skip_impl = ( skip_impl = (
"virConnectGetCPUModelNames",
'virConnectGetVersion', 'virConnectGetVersion',
'virConnectGetLibVersion', 'virConnectGetLibVersion',
'virConnectListDomainsID', 'virConnectListDomainsID',
......
...@@ -681,6 +681,12 @@ typedef char * ...@@ -681,6 +681,12 @@ typedef char *
unsigned int ncpus, unsigned int ncpus,
unsigned int flags); unsigned int flags);
typedef int
(*virDrvConnectGetCPUModelNames)(virConnectPtr conn,
const char *args,
char ***models,
unsigned int flags);
typedef int typedef int
(*virDrvDomainGetJobInfo)(virDomainPtr domain, (*virDrvDomainGetJobInfo)(virDomainPtr domain,
virDomainJobInfoPtr info); virDomainJobInfoPtr info);
...@@ -1332,6 +1338,7 @@ struct _virDriver { ...@@ -1332,6 +1338,7 @@ struct _virDriver {
virDrvDomainMigratePerform3Params domainMigratePerform3Params; virDrvDomainMigratePerform3Params domainMigratePerform3Params;
virDrvDomainMigrateFinish3Params domainMigrateFinish3Params; virDrvDomainMigrateFinish3Params domainMigrateFinish3Params;
virDrvDomainMigrateConfirm3Params domainMigrateConfirm3Params; virDrvDomainMigrateConfirm3Params domainMigrateConfirm3Params;
virDrvConnectGetCPUModelNames connectGetCPUModelNames;
}; };
......
...@@ -18524,6 +18524,57 @@ error: ...@@ -18524,6 +18524,57 @@ error:
} }
/**
* virConnectGetCPUModelNames:
*
* @conn: virConnect connection
* @arch: Architecture
* @models: Pointer to a variable to store the NULL-terminated array of the
* CPU models supported for the specified architecture. Each element
* and the array itself must be freed by the caller with free. Pass
* NULL if only the list length is needed.
* @flags: extra flags; not used yet, so callers should always pass 0.
*
* Get the list of supported CPU models for a specific architecture.
*
* Returns -1 on error, number of elements in @models on success.
*/
int
virConnectGetCPUModelNames(virConnectPtr conn, const char *arch, char ***models,
unsigned int flags)
{
VIR_DEBUG("conn=%p, arch=%s, models=%p, flags=%x",
conn, arch, models, flags);
virResetLastError();
if (models)
*models = NULL;
if (!VIR_IS_CONNECT(conn)) {
virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
virDispatchError(NULL);
return -1;
}
virCheckNonNullArgReturn(arch, -1);
if (conn->driver->connectGetCPUModelNames) {
int ret;
ret = conn->driver->connectGetCPUModelNames(conn, arch, models, flags);
if (ret < 0)
goto error;
return ret;
}
virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
error:
virDispatchError(conn);
return -1;
}
/** /**
* virConnectBaselineCPU: * virConnectBaselineCPU:
* *
......
...@@ -634,4 +634,9 @@ LIBVIRT_1.1.1 { ...@@ -634,4 +634,9 @@ LIBVIRT_1.1.1 {
virDomainSetMemoryStatsPeriod; virDomainSetMemoryStatsPeriod;
} LIBVIRT_1.1.0; } LIBVIRT_1.1.0;
LIBVIRT_1.1.3 {
global:
virConnectGetCPUModelNames;
} LIBVIRT_1.1.1;
# .... define new API here using predicted next version number .... # .... define new API here using predicted next version number ....
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册