xl: Add subcommand "xl sched-credit"
PATCH 1/1 xl: Add subcommand "xl sched-credit"
Hi Stefano,
Quoted 3 lines · Stefano Stabellini
Hi all,
this is a non comprehensive list of missing features in libxenlight and\or xl:
...snip...
Quoted 2 lines
- sched-* commands;
I add subcommand 'sched-credit', please refer to the following patch. This patch bases changeset 21236:9a1d7caa2024.
If it is difficult for you to resolve the conflict, I'll make it against the latest xen-unstable.hg after May Day.
###did some test###
# xl list Name ID Mem VCPUs State Time(s) Domain-0 0 1024 2 r-- 34.4 pvguest1 2 256 2 r-- 0.2 # xl sched-credit Name ID Weight Cap Domain-0 0 256 0 pvguest1 2 256 0 # xl sched-credit -d pvguest1 -w 512 -c 100 # xl sched-credit Name ID Weight Cap Domain-0 0 256 0 pvguest1 2 512 100 ######
Regards
Yu Zhiguo
-----------------------
Subcommand 'sched-credit' is missing now.
So add it by this fix.
tools/libxl/libxl.c +50 -0
@@ -2481,3 +2481,53 @@return ret;return sched; } + +int libxl_sched_credit_domain_get (struct libxl_ctx *ctx,uint32_t domid,struct libxl_sched_credit *scinfo) +{ +struct xen_domctl_sched_credit sdom; +int rc; + + rc =xc_sched_credit_domain_get (ctx->xch, domid, &sdom); +if (rc !=0 ) +return rc; + + scinfo->weight = sdom.weight; + scinfo->cap = sdom.cap; + +return 0 ; +} + +int libxl_sched_credit_domain_set (struct libxl_ctx *ctx,uint32_t domid,struct libxl_sched_credit *scinfo) +{ +struct xen_domctl_sched_credit sdom; +xc_domaininfo_t domaininfo; +int rc; + + rc =xc_domain_getinfolist (ctx->xch, domid,1 , &domaininfo); +if (rc !=1 || domaininfo.domain != domid) +return rc; + + +if (scinfo->weight <1 || scinfo->weight >65535 ) { +XL_LOG_ERRNOVAL (ctx,XL_LOG_ERROR , rc, +"Cpu weight out of range, valid values are within range from 1 to 65535" ); +return -1 ; + } + +if (scinfo->cap <0 || scinfo->cap > (domaininfo.max_vcpu_id +1 ) *100 ) { +XL_LOG_ERRNOVAL (ctx,XL_LOG_ERROR , rc, +"Cpu cap out of range, valid range is from 0 to %d for specified number of vcpus" , + ((domaininfo.max_vcpu_id +1 ) *100 )); +return -1 ; + } + + sdom.weight = scinfo->weight; + sdom.cap = scinfo->cap; + + rc =xc_sched_credit_domain_set (ctx->xch, domid, &sdom); +if (rc !=0 ) +return rc; + +return 0 ; +} +
tools/libxl/libxl.h +11 -0
@@ -459,5 +459,16 @@int libxl_set_vcpucount (struct libxl_ctx *ctx,uint32_t domid,uint32_t count);int libxl_get_sched_id (struct libxl_ctx *ctx); + + +struct libxl_sched_credit { +int weight; +int cap; +}; + +int libxl_sched_credit_domain_get (struct libxl_ctx *ctx,uint32_t domid, +struct libxl_sched_credit *scinfo); +int libxl_sched_credit_domain_set (struct libxl_ctx *ctx,uint32_t domid, +struct libxl_sched_credit *scinfo);#endif /* LIBXL_H */
tools/libxl/xl.c +114 -0
138 lines not on this page · raw message
Quoted 8 lines · Yu Zhiguo
Hi Stefano,
Quoted 3 lines · Stefano Stabellini
Hi all,
this is a non comprehensive list of missing features in libxenlight and\or xl:...snip...
Quoted 1 line
Quoted 7 lines
Quoted 1 line
- sched-* commands;
I add subcommand 'sched-credit', please refer to the following patch. This patch bases changeset 21236:9a1d7caa2024.
If it is difficult for you to resolve the conflict, I'll make it against the latest xen-unstable.hg after May Day.
Actually is Keir that is going to apply the patch, so I'll leave it to him to decide.
Meanwhile: