mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
vbox: Rewrite vboxDomainGetVcpusFlags
This commit is contained in:
parent
35cb445a51
commit
e9f17c5330
@ -2826,3 +2826,31 @@ int vboxDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
|
|||||||
{
|
{
|
||||||
return vboxDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_AFFECT_LIVE);
|
return vboxDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_AFFECT_LIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int vboxDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
|
||||||
|
{
|
||||||
|
VBOX_OBJECT_CHECK(dom->conn, int, -1);
|
||||||
|
ISystemProperties *systemProperties = NULL;
|
||||||
|
PRUint32 maxCPUCount = 0;
|
||||||
|
|
||||||
|
if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||||
|
virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Currently every domain supports the same number of max cpus
|
||||||
|
* as that supported by vbox and thus take it directly from
|
||||||
|
* the systemproperties.
|
||||||
|
*/
|
||||||
|
|
||||||
|
gVBoxAPI.UIVirtualBox.GetSystemProperties(data->vboxObj, &systemProperties);
|
||||||
|
if (systemProperties) {
|
||||||
|
gVBoxAPI.UISystemProperties.GetMaxGuestCPUCount(systemProperties, &maxCPUCount);
|
||||||
|
VBOX_RELEASE(systemProperties);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxCPUCount > 0)
|
||||||
|
ret = maxCPUCount;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@ -955,35 +955,6 @@ static virDomainState _vboxConvertState(PRUint32 state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
vboxDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
|
|
||||||
{
|
|
||||||
VBOX_OBJECT_CHECK(dom->conn, int, -1);
|
|
||||||
ISystemProperties *systemProperties = NULL;
|
|
||||||
PRUint32 maxCPUCount = 0;
|
|
||||||
|
|
||||||
if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
|
||||||
virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Currently every domain supports the same number of max cpus
|
|
||||||
* as that supported by vbox and thus take it directly from
|
|
||||||
* the systemproperties.
|
|
||||||
*/
|
|
||||||
|
|
||||||
data->vboxObj->vtbl->GetSystemProperties(data->vboxObj, &systemProperties);
|
|
||||||
if (systemProperties) {
|
|
||||||
systemProperties->vtbl->GetMaxGuestCPUCount(systemProperties, &maxCPUCount);
|
|
||||||
VBOX_RELEASE(systemProperties);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxCPUCount > 0)
|
|
||||||
ret = maxCPUCount;
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vboxDomainGetMaxVcpus(virDomainPtr dom)
|
vboxDomainGetMaxVcpus(virDomainPtr dom)
|
||||||
{
|
{
|
||||||
|
@ -441,6 +441,7 @@ int vboxDomainGetState(virDomainPtr dom, int *state,
|
|||||||
int vboxDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
int vboxDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
int vboxDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus);
|
int vboxDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus);
|
||||||
|
int vboxDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags);
|
||||||
|
|
||||||
/* Version specified functions for installing uniformed API */
|
/* Version specified functions for installing uniformed API */
|
||||||
void vbox22InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
|
void vbox22InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
|
||||||
|
Loading…
Reference in New Issue
Block a user