iscsi: Set cpumask to all available CPUs when PG is created JSON-RPC

Currently the default setting of cpumask of network portal is
different between iSCSI.conf and JSON-RPC.

When a network portal is created by iSCSI.conf, its cpumask is
set to all available CPUs by default. However when it is created
by JSON-RPC, its cpumask is set to 0 by default.

Auto test 'test/iscsi_tgt/idle_migration creates a network portal
by JSON-RPC. Hence the auto test cannot test the load balancing
function of iSCSI target.

Change-Id: I2685172cb9259b643f6d18d4660a8425dcef3f5d
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391898
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Shuhei Matsumoto 2017-12-15 14:36:01 +09:00 committed by Jim Harris
parent 4395093b97
commit 28ff7a0da7

View File

@ -40,6 +40,7 @@
#include "spdk/rpc.h"
#include "spdk/util.h"
#include "spdk/event.h"
#include "spdk_internal/log.h"
@ -809,6 +810,7 @@ spdk_rpc_add_portal_group(struct spdk_jsonrpc_request *request,
struct rpc_portal_group req = {};
struct spdk_iscsi_portal *portal_list[MAX_PORTAL] = {};
struct spdk_json_write_ctx *w;
uint64_t cpumask;
size_t i = 0;
int rc = -1;
@ -819,9 +821,11 @@ spdk_rpc_add_portal_group(struct spdk_jsonrpc_request *request,
goto out;
}
cpumask = spdk_app_get_core_mask();
for (i = 0; i < req.portal_list.num_portals; i++) {
portal_list[i] = spdk_iscsi_portal_create(req.portal_list.portals[i].host,
req.portal_list.portals[i].port, 0);
req.portal_list.portals[i].port, cpumask);
if (portal_list[i] == NULL) {
SPDK_ERRLOG("portal_list allocation failed\n");
goto out;