scheduler: add scheduler subsystem JSON configuration

Added writing out JSON configuration for the scheduler
subsystem.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I51b1f94b3f56d0bfb8a87127163c8e248d6846b6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7119
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Krzysztof Karas 2021-03-25 11:46:22 +01:00 committed by Tomasz Zawadzki
parent a86e40f320
commit b05d4a7d19
4 changed files with 38 additions and 1 deletions

View File

@ -175,7 +175,7 @@ DEPDIRS-event_vmd := init vmd $(JSON_LIBS) log thread
DEPDIRS-event_bdev := init bdev event_accel event_vmd event_sock
DEPDIRS-event_scheduler := event init
DEPDIRS-event_scheduler := event init json log
DEPDIRS-event_nbd := init nbd event_bdev
DEPDIRS-event_nvmf := init nvmf event_bdev event_scheduler event_sock thread log bdev util $(JSON_LIBS)

View File

@ -63,10 +63,42 @@ scheduler_subsystem_fini(void)
spdk_subsystem_fini_next();
}
static void
scheduler_write_config_json(struct spdk_json_write_ctx *w)
{
struct spdk_scheduler *scheduler;
uint64_t scheduler_period;
assert(w != NULL);
scheduler = spdk_scheduler_get();
if (scheduler == NULL) {
SPDK_ERRLOG("Unable to get scheduler info\n");
return;
}
scheduler_period = spdk_scheduler_get_period();
spdk_json_write_array_begin(w);
spdk_json_write_object_begin(w);
spdk_json_write_named_string(w, "method", "framework_set_scheduler");
spdk_json_write_named_object_begin(w, "params");
spdk_json_write_named_string(w, "name", scheduler->name);
if (scheduler_period != 0) {
spdk_json_write_named_uint32(w, "period", scheduler_period);
}
spdk_json_write_object_end(w);
spdk_json_write_object_end(w);
spdk_json_write_array_end(w);
}
static struct spdk_subsystem g_spdk_subsystem_scheduler = {
.name = "scheduler",
.init = scheduler_subsystem_init,
.fini = scheduler_subsystem_fini,
.write_config_json = scheduler_write_config_json,
};
SPDK_SUBSYSTEM_REGISTER(g_spdk_subsystem_scheduler);

View File

@ -161,6 +161,10 @@ def clear_sock_subsystem(args, sock_config):
pass
def clear_scheduler_subsystem(args, scheduler_config):
pass
def call_test_cmd(func):
def rpc_test_cmd(*args, **kwargs):
try:

View File

@ -35,6 +35,7 @@ def filter_methods(do_remove_global_rpcs):
'bdev_nvme_set_hotplug',
'sock_impl_set_options',
'sock_set_default_impl',
'framework_set_scheduler',
]
data = json.loads(sys.stdin.read())