mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
hyperv: implement domainGetScheduler*
Co-authored-by: Sri Ramanujam <sramanujam@datto.com> Signed-off-by: Matt Coleman <matt@datto.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
16fb99c7a1
commit
08aed0888f
@ -1354,6 +1354,86 @@ hypervDomainSetAutostart(virDomainPtr domain, int autostart)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static char *
|
||||||
|
hypervDomainGetSchedulerType(virDomainPtr domain G_GNUC_UNUSED, int *nparams)
|
||||||
|
{
|
||||||
|
if (nparams)
|
||||||
|
*nparams = 3; /* reservation, limit, weight */
|
||||||
|
|
||||||
|
return g_strdup("allocation");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
hypervDomainGetSchedulerParametersFlags(virDomainPtr domain,
|
||||||
|
virTypedParameterPtr params,
|
||||||
|
int *nparams, unsigned int flags)
|
||||||
|
{
|
||||||
|
hypervPrivate *priv = domain->conn->privateData;
|
||||||
|
Msvm_ComputerSystem *computerSystem = NULL;
|
||||||
|
Msvm_VirtualSystemSettingData *vssd = NULL;
|
||||||
|
Msvm_ProcessorSettingData *proc_sd = NULL;
|
||||||
|
char uuid_string[VIR_UUID_STRING_BUFLEN];
|
||||||
|
int saved_nparams = 0;
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
|
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
|
||||||
|
|
||||||
|
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
/* get info from host */
|
||||||
|
virUUIDFormat(domain->uuid, uuid_string);
|
||||||
|
|
||||||
|
if (hypervGetMsvmVirtualSystemSettingDataFromUUID(priv, uuid_string, &vssd) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (hypervGetProcessorSD(priv, vssd->data->InstanceID, &proc_sd) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
/* parse it all out */
|
||||||
|
if (virTypedParameterAssign(¶ms[0], VIR_DOMAIN_SCHEDULER_LIMIT,
|
||||||
|
VIR_TYPED_PARAM_LLONG, proc_sd->data->Limit) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
saved_nparams++;
|
||||||
|
|
||||||
|
if (*nparams > saved_nparams) {
|
||||||
|
if (virTypedParameterAssign(¶ms[1], VIR_DOMAIN_SCHEDULER_RESERVATION,
|
||||||
|
VIR_TYPED_PARAM_LLONG, proc_sd->data->Reservation) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
saved_nparams++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*nparams > saved_nparams) {
|
||||||
|
if (virTypedParameterAssign(¶ms[2], VIR_DOMAIN_SCHEDULER_WEIGHT,
|
||||||
|
VIR_TYPED_PARAM_UINT, proc_sd->data->Weight) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
saved_nparams++;
|
||||||
|
}
|
||||||
|
|
||||||
|
*nparams = saved_nparams;
|
||||||
|
|
||||||
|
result = 0;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
hypervFreeObject(priv, (hypervObject *)computerSystem);
|
||||||
|
hypervFreeObject(priv, (hypervObject *)vssd);
|
||||||
|
hypervFreeObject(priv, (hypervObject *)proc_sd);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
hypervDomainGetSchedulerParameters(virDomainPtr domain,
|
||||||
|
virTypedParameterPtr params,
|
||||||
|
int *nparams)
|
||||||
|
{
|
||||||
|
return hypervDomainGetSchedulerParametersFlags(domain, params, nparams,
|
||||||
|
VIR_DOMAIN_AFFECT_CURRENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static unsigned long long
|
static unsigned long long
|
||||||
hypervNodeGetFreeMemory(virConnectPtr conn)
|
hypervNodeGetFreeMemory(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
@ -1802,6 +1882,9 @@ static virHypervisorDriver hypervHypervisorDriver = {
|
|||||||
.domainCreateWithFlags = hypervDomainCreateWithFlags, /* 0.9.5 */
|
.domainCreateWithFlags = hypervDomainCreateWithFlags, /* 0.9.5 */
|
||||||
.domainGetAutostart = hypervDomainGetAutostart, /* 6.9.0 */
|
.domainGetAutostart = hypervDomainGetAutostart, /* 6.9.0 */
|
||||||
.domainSetAutostart = hypervDomainSetAutostart, /* 6.9.0 */
|
.domainSetAutostart = hypervDomainSetAutostart, /* 6.9.0 */
|
||||||
|
.domainGetSchedulerType = hypervDomainGetSchedulerType, /* 6.10.0 */
|
||||||
|
.domainGetSchedulerParameters = hypervDomainGetSchedulerParameters, /* 6.10.0 */
|
||||||
|
.domainGetSchedulerParametersFlags = hypervDomainGetSchedulerParametersFlags, /* 6.10.0 */
|
||||||
.nodeGetFreeMemory = hypervNodeGetFreeMemory, /* 6.9.0 */
|
.nodeGetFreeMemory = hypervNodeGetFreeMemory, /* 6.9.0 */
|
||||||
.connectIsEncrypted = hypervConnectIsEncrypted, /* 0.9.5 */
|
.connectIsEncrypted = hypervConnectIsEncrypted, /* 0.9.5 */
|
||||||
.connectIsSecure = hypervConnectIsSecure, /* 0.9.5 */
|
.connectIsSecure = hypervConnectIsSecure, /* 0.9.5 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user