Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.1:Update
libvirt-cim
vcpu-count.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File vcpu-count.patch of Package libvirt-cim
diff -r e043f46f299e -r 819ae6c97a07 libxkutil/misc_util.c --- a/libxkutil/misc_util.c Wed Oct 22 08:28:37 2008 -0700 +++ b/libxkutil/misc_util.c Tue Oct 28 08:22:04 2008 -0700 @@ -541,6 +541,45 @@ return result; } +int domain_vcpu_count(virDomainPtr dom) +{ + virVcpuInfoPtr info = NULL; + int max; + int count; + int actual = 0; + int i; + virConnectPtr conn = NULL; + + conn = virDomainGetConnect(dom); + if (conn == NULL) { + CU_DEBUG("Failed to get connection from domain"); + return -1; + } + + max = virConnectGetMaxVcpus(conn, virConnectGetType(conn)); + if (max <= 0) { + CU_DEBUG("Failed to get max vcpu count"); + return -1; + } + + info = calloc(max, sizeof(*info)); + if (info == NULL) { + CU_DEBUG("Failed to allocate %i vcpuinfo structures", max); + return -1; + } + + count = virDomainGetVcpus(dom, info, max, NULL, 0); + + for (i = 0; i < count; i++) { + if (info[i].cpu != -1) + actual++; + } + + free(info); + + return actual; +} + /* * Local Variables: * mode: C diff -r e043f46f299e -r 819ae6c97a07 libxkutil/misc_util.h --- a/libxkutil/misc_util.h Wed Oct 22 08:28:37 2008 -0700 +++ b/libxkutil/misc_util.h Tue Oct 28 08:22:04 2008 -0700 @@ -124,6 +124,8 @@ bool check_refs_pfx_match(const CMPIObjectPath *refa, const CMPIObjectPath *refb); +int domain_vcpu_count(virDomainPtr dom); + #define LIBVIRT_CIM_DEFAULT_MAKEREF() \ static CMPIInstance* make_ref(const CMPIObjectPath *source_ref, \ const CMPIInstance *target_inst, \
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor