Re: [PATCH 6/8] Add domainGetSchedulerType to libxl driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Markus Groß wrote:
> ---
>  src/libxl/libxl_driver.c |   64 +++++++++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 63 insertions(+), 1 deletions(-)
>
> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index b05cd77..c72a570 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -55,6 +55,11 @@
>  
>  #define LIBXL_CONFIG_FORMAT_XM "xen-xm"
>  
> +/* Number of Xen scheduler parameters */
> +#define XEN_SCHED_SEDF_NPARAM     5
>   

I assume the similar definition in xend_internal.c is wrong since it is
counting the domid as well.  Is that correct?  If so, we should fix it
in xend_internal.c.

> +#define XEN_SCHED_CREDIT_NPARAM   2
> +#define XEN_SCHED_CREDIT2_NPARAM  1
> +
>  static libxlDriverPrivatePtr libxl_driver = NULL;
>  
>  
> @@ -1918,6 +1923,63 @@ libxlDomainEventDeregister(virConnectPtr conn,
>      return ret;
>  }
>  
> +static char *
> +libxlDomainGetSchedulerType(virDomainPtr dom, int *nparams)
> +{
> +    libxlDriverPrivatePtr driver = dom->conn->privateData;
> +    libxlDomainObjPrivatePtr priv;
> +    virDomainObjPtr vm;
> +    char * ret = NULL;
> +    int sched_id;
> +
> +    libxlDriverLock(driver);
> +    vm = virDomainFindByUUID(&driver->domains, dom->uuid);
> +    libxlDriverUnlock(driver);
> +
> +    if (!vm) {
> +        libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
> +        goto cleanup;
> +    }
> +
> +    priv = vm->privateData;
> +    if ((sched_id = libxl_get_sched_id(&priv->ctx)) < 0) {
> +        libxlError(VIR_ERR_INTERNAL_ERROR,
> +                   _("Failed to get scheduler id for domain '%d'"
> +                     " with libxenlight"), dom->id);
> +        goto cleanup;
> +    }
> +
> +    switch(sched_id) {
> +    case XEN_SCHEDULER_SEDF:
> +        ret = strdup("sedf");
> +        *nparams = XEN_SCHED_SEDF_NPARAM;
> +        break;
> +    case XEN_SCHEDULER_CREDIT:
> +        ret = strdup("credit");
> +        *nparams = XEN_SCHED_CREDIT_NPARAM;
> +        break;
> +    case XEN_SCHEDULER_CREDIT2:
> +        ret = strdup("credit2");
> +        *nparams = XEN_SCHED_CREDIT2_NPARAM;
> +        break;
> +    case XEN_SCHEDULER_ARINC653:
> +        ret = strdup("arinc653");
> +        *nparams = 0;
> +        break;
>   

Hmm, seems these last two should be added to the xen-unified driver as
well - but that obviously doesn't affect this patch.

ACK, depending on the answer to my question above.

Regards,
Jim

> +    default:
> +        *nparams = 0;
> +        goto cleanup;
> +    }
> +
> +    if (!ret)
> +        virReportOOMError();
> +
> +cleanup:
> +    if (vm)
> +        virDomainObjUnlock(vm);
> +    return ret;
> +}
> +
>  static unsigned long long
>  libxlNodeGetFreeMemory(virConnectPtr conn)
>  {
> @@ -2083,7 +2145,7 @@ static virDriver libxlDriver = {
>      NULL,                       /* domainUpdateDeviceFlags */
>      NULL,                       /* domainGetAutostart */
>      NULL,                       /* domainSetAutostart */
> -    NULL,                       /* domainGetSchedulerType */
> +    libxlDomainGetSchedulerType,/* domainGetSchedulerType */
>      NULL,                       /* domainGetSchedulerParameters */
>      NULL,                       /* domainSetSchedulerParameters */
>      NULL,                       /* domainMigratePrepare */
>   

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]