rpc: Rename add_ip_address to net_interface_add_ip_address
Change-Id: I6fba7f7c237497950d4f2c4e3a664fbb82e25fe7 Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468676 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
5e9cea267e
commit
b72455c851
@ -243,7 +243,7 @@ Example response:
|
|||||||
"get_scsi_devices",
|
"get_scsi_devices",
|
||||||
"get_interfaces",
|
"get_interfaces",
|
||||||
"delete_ip_address",
|
"delete_ip_address",
|
||||||
"add_ip_address",
|
"net_interface_add_ip_address",
|
||||||
"nbd_get_disks",
|
"nbd_get_disks",
|
||||||
"nbd_stop_disk",
|
"nbd_stop_disk",
|
||||||
"nbd_start_disk",
|
"nbd_start_disk",
|
||||||
|
@ -448,7 +448,7 @@ spdk_interface_destroy(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
spdk_interface_add_ip_address(int ifc_index, char *ip_addr)
|
spdk_interface_net_interface_add_ip_address(int ifc_index, char *ip_addr)
|
||||||
{
|
{
|
||||||
uint32_t addr;
|
uint32_t addr;
|
||||||
|
|
||||||
@ -485,7 +485,7 @@ spdk_interface_destroy(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
spdk_interface_add_ip_address(int ifc_index, char *ip_addr)
|
spdk_interface_net_interface_add_ip_address(int ifc_index, char *ip_addr)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ struct spdk_interface {
|
|||||||
*
|
*
|
||||||
* \return 0 on success, -1 on failure.
|
* \return 0 on success, -1 on failure.
|
||||||
*/
|
*/
|
||||||
int spdk_interface_add_ip_address(int ifc_index, char *ip_addr);
|
int spdk_interface_net_interface_add_ip_address(int ifc_index, char *ip_addr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete an ip address from the network interface.
|
* Delete an ip address from the network interface.
|
||||||
|
@ -58,8 +58,8 @@ static const struct spdk_json_object_decoder rpc_ip_address_decoders[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_rpc_add_ip_address(struct spdk_jsonrpc_request *request,
|
spdk_rpc_net_interface_add_ip_address(struct spdk_jsonrpc_request *request,
|
||||||
const struct spdk_json_val *params)
|
const struct spdk_json_val *params)
|
||||||
{
|
{
|
||||||
struct rpc_ip_address req = {};
|
struct rpc_ip_address req = {};
|
||||||
struct spdk_json_write_ctx *w;
|
struct spdk_json_write_ctx *w;
|
||||||
@ -74,7 +74,7 @@ spdk_rpc_add_ip_address(struct spdk_jsonrpc_request *request,
|
|||||||
goto invalid;
|
goto invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret_val = spdk_interface_add_ip_address(req.ifc_index, req.ip_address);
|
ret_val = spdk_interface_net_interface_add_ip_address(req.ifc_index, req.ip_address);
|
||||||
if (ret_val) {
|
if (ret_val) {
|
||||||
if (ret_val == -ENODEV) {
|
if (ret_val == -ENODEV) {
|
||||||
spdk_jsonrpc_send_error_response_fmt(request, SPDK_JSONRPC_ERROR_INVALID_STATE,
|
spdk_jsonrpc_send_error_response_fmt(request, SPDK_JSONRPC_ERROR_INVALID_STATE,
|
||||||
@ -96,7 +96,9 @@ spdk_rpc_add_ip_address(struct spdk_jsonrpc_request *request,
|
|||||||
invalid:
|
invalid:
|
||||||
free_rpc_ip_address(&req);
|
free_rpc_ip_address(&req);
|
||||||
}
|
}
|
||||||
SPDK_RPC_REGISTER("add_ip_address", spdk_rpc_add_ip_address, SPDK_RPC_RUNTIME)
|
SPDK_RPC_REGISTER("net_interface_add_ip_address", spdk_rpc_net_interface_add_ip_address,
|
||||||
|
SPDK_RPC_RUNTIME)
|
||||||
|
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(net_interface_add_ip_address, add_ip_address)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spdk_rpc_delete_ip_address(struct spdk_jsonrpc_request *request,
|
spdk_rpc_delete_ip_address(struct spdk_jsonrpc_request *request,
|
||||||
|
@ -1508,13 +1508,14 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
|
|||||||
p.set_defaults(func=nbd_get_disks)
|
p.set_defaults(func=nbd_get_disks)
|
||||||
|
|
||||||
# net
|
# net
|
||||||
def add_ip_address(args):
|
def net_interface_add_ip_address(args):
|
||||||
rpc.net.add_ip_address(args.client, ifc_index=args.ifc_index, ip_addr=args.ip_addr)
|
rpc.net.net_interface_add_ip_address(args.client, ifc_index=args.ifc_index, ip_addr=args.ip_addr)
|
||||||
|
|
||||||
p = subparsers.add_parser('add_ip_address', help='Add IP address')
|
p = subparsers.add_parser('net_interface_add_ip_address', aliases=['add_ip_address'],
|
||||||
|
help='Add IP address')
|
||||||
p.add_argument('ifc_index', help='ifc index of the nic device.', type=int)
|
p.add_argument('ifc_index', help='ifc index of the nic device.', type=int)
|
||||||
p.add_argument('ip_addr', help='ip address will be added.')
|
p.add_argument('ip_addr', help='ip address will be added.')
|
||||||
p.set_defaults(func=add_ip_address)
|
p.set_defaults(func=net_interface_add_ip_address)
|
||||||
|
|
||||||
def delete_ip_address(args):
|
def delete_ip_address(args):
|
||||||
rpc.net.delete_ip_address(args.client, ifc_index=args.ifc_index, ip_addr=args.ip_addr)
|
rpc.net.delete_ip_address(args.client, ifc_index=args.ifc_index, ip_addr=args.ip_addr)
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
def add_ip_address(client, ifc_index, ip_addr):
|
from .helpers import deprecated_alias
|
||||||
|
|
||||||
|
|
||||||
|
@deprecated_alias('add_ip_address')
|
||||||
|
def net_interface_add_ip_address(client, ifc_index, ip_addr):
|
||||||
"""Add IP address.
|
"""Add IP address.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -6,7 +10,7 @@ def add_ip_address(client, ifc_index, ip_addr):
|
|||||||
ip_addr: ip address will be added
|
ip_addr: ip address will be added
|
||||||
"""
|
"""
|
||||||
params = {'ifc_index': ifc_index, 'ip_address': ip_addr}
|
params = {'ifc_index': ifc_index, 'ip_address': ip_addr}
|
||||||
return client.call('add_ip_address', params)
|
return client.call('net_interface_add_ip_address', params)
|
||||||
|
|
||||||
|
|
||||||
def delete_ip_address(client, ifc_index, ip_addr):
|
def delete_ip_address(client, ifc_index, ip_addr):
|
||||||
|
@ -13,7 +13,7 @@ rpc_py="$rootdir/scripts/rpc.py"
|
|||||||
fio_py="$rootdir/scripts/fio.py"
|
fio_py="$rootdir/scripts/fio.py"
|
||||||
|
|
||||||
# Namespaces are NOT used here on purpose. This test requires changes to detect
|
# Namespaces are NOT used here on purpose. This test requires changes to detect
|
||||||
# ifc_index for interface that was put into namespace. Needed for add_ip_address.
|
# ifc_index for interface that was put into namespace. Needed for net_interface_add_ip_address.
|
||||||
ISCSI_APP="$rootdir/app/iscsi_tgt/iscsi_tgt"
|
ISCSI_APP="$rootdir/app/iscsi_tgt/iscsi_tgt"
|
||||||
NETMASK=127.0.0.0/24
|
NETMASK=127.0.0.0/24
|
||||||
MIGRATION_ADDRESS=127.0.0.2
|
MIGRATION_ADDRESS=127.0.0.2
|
||||||
@ -33,7 +33,7 @@ function rpc_config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function rpc_add_target_node() {
|
function rpc_add_target_node() {
|
||||||
$rpc_py -s $1 add_ip_address 1 $MIGRATION_ADDRESS
|
$rpc_py -s $1 net_interface_add_ip_address 1 $MIGRATION_ADDRESS
|
||||||
$rpc_py -s $1 iscsi_create_portal_group $PORTAL_TAG $MIGRATION_ADDRESS:$ISCSI_PORT
|
$rpc_py -s $1 iscsi_create_portal_group $PORTAL_TAG $MIGRATION_ADDRESS:$ISCSI_PORT
|
||||||
$rpc_py -s $1 iscsi_create_target_node target1 target1_alias 'Malloc0:0' $PORTAL_TAG:$INITIATOR_TAG 64 -d
|
$rpc_py -s $1 iscsi_create_target_node target1 target1_alias 'Malloc0:0' $PORTAL_TAG:$INITIATOR_TAG 64 -d
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ def verify_portal_groups_rpc_methods(rpc_py, rpc_param):
|
|||||||
nics = json.loads(rpc.get_interfaces())
|
nics = json.loads(rpc.get_interfaces())
|
||||||
for x in nics:
|
for x in nics:
|
||||||
if x["ifc_index"] == 'lo':
|
if x["ifc_index"] == 'lo':
|
||||||
rpc.add_ip_address(x["ifc_index"], lo_ip[1])
|
rpc.net_interface_add_ip_address(x["ifc_index"], lo_ip[1])
|
||||||
for idx, value in enumerate(lo_ip):
|
for idx, value in enumerate(lo_ip):
|
||||||
# The portal group tag must start at 1
|
# The portal group tag must start at 1
|
||||||
tag = idx + 1
|
tag = idx + 1
|
||||||
@ -428,7 +428,7 @@ def verify_add_delete_ip_address(rpc_py):
|
|||||||
for x in nics[:2]:
|
for x in nics[:2]:
|
||||||
faked_ip = "123.123.{}.{}".format(random.randint(1, 254), random.randint(1, 254))
|
faked_ip = "123.123.{}.{}".format(random.randint(1, 254), random.randint(1, 254))
|
||||||
ping_cmd = ns_cmd + " ping -c 1 -W 1 " + faked_ip
|
ping_cmd = ns_cmd + " ping -c 1 -W 1 " + faked_ip
|
||||||
rpc.add_ip_address(x["ifc_index"], faked_ip)
|
rpc.net_interface_add_ip_address(x["ifc_index"], faked_ip)
|
||||||
verify(faked_ip in help_get_interface_ip_list(rpc_py, x["name"]), 1,
|
verify(faked_ip in help_get_interface_ip_list(rpc_py, x["name"]), 1,
|
||||||
"add ip {} to nic {} failed.".format(faked_ip, x["name"]))
|
"add ip {} to nic {} failed.".format(faked_ip, x["name"]))
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user