Commit b05d4a7d authored by Krzysztof Karas's avatar Krzysztof Karas Committed by Tomasz Zawadzki
Browse files

scheduler: add scheduler subsystem JSON configuration



Added writing out JSON configuration for the scheduler
subsystem.

Signed-off-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
Signed-off-by: default avatarTomasz 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: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent a86e40f3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)
+32 −0
Original line number Diff line number Diff line
@@ -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);
+4 −0
Original line number Diff line number Diff line
@@ -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:
+1 −0
Original line number Diff line number Diff line
@@ -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())