rpc: Rename start_nbd_disk to nbd_start_disk
Change-Id: I46722176726076fd8bbcfa681eb7316e30ecb07d Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468580 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
0cbf1237c7
commit
0a993323f9
@ -258,11 +258,11 @@ The SPDK partition type GUID is `7c5222bd-8f5d-4087-9c00-bf9843c7b58c`. Existing
|
||||
can be exposed as Linux block devices via NBD and then ca be partitioned with
|
||||
standard partitioning tools. After partitioning, the bdevs will need to be deleted and
|
||||
attached again for the GPT bdev module to see any changes. NBD kernel module must be
|
||||
loaded first. To create NBD bdev user should use `start_nbd_disk` RPC command.
|
||||
loaded first. To create NBD bdev user should use `nbd_start_disk` RPC command.
|
||||
|
||||
Example command
|
||||
|
||||
`rpc.py start_nbd_disk Malloc0 /dev/nbd0`
|
||||
`rpc.py nbd_start_disk Malloc0 /dev/nbd0`
|
||||
|
||||
This will expose an SPDK bdev `Malloc0` under the `/dev/nbd0` block device.
|
||||
|
||||
@ -282,7 +282,7 @@ Example command
|
||||
|
||||
~~~
|
||||
# Expose bdev Nvme0n1 as kernel block device /dev/nbd0 by JSON-RPC
|
||||
rpc.py start_nbd_disk Nvme0n1 /dev/nbd0
|
||||
rpc.py nbd_start_disk Nvme0n1 /dev/nbd0
|
||||
|
||||
# Create GPT partition table.
|
||||
parted -s /dev/nbd0 mklabel gpt
|
||||
|
@ -246,7 +246,7 @@ Example response:
|
||||
"add_ip_address",
|
||||
"get_nbd_disks",
|
||||
"stop_nbd_disk",
|
||||
"start_nbd_disk",
|
||||
"nbd_start_disk",
|
||||
"get_log_flags",
|
||||
"clear_log_flag",
|
||||
"set_log_flag",
|
||||
@ -5518,7 +5518,7 @@ SPDK supports exporting bdevs through Linux nbd. These devices then appear as st
|
||||
|
||||
In order to export a device over nbd, first make sure the Linux kernel nbd driver is loaded by running 'modprobe nbd'.
|
||||
|
||||
## start_nbd_disk {#rpc_start_nbd_disk}
|
||||
## nbd_start_disk {#rpc_nbd_start_disk}
|
||||
|
||||
Start to export one SPDK bdev as NBD disk
|
||||
|
||||
@ -5544,7 +5544,7 @@ Example request:
|
||||
"bdev_name": "Malloc1"
|
||||
},
|
||||
"jsonrpc": "2.0",
|
||||
"method": "start_nbd_disk",
|
||||
"method": "nbd_start_disk",
|
||||
"id": 1
|
||||
}
|
||||
~~~
|
||||
|
@ -228,7 +228,7 @@ spdk_nbd_write_config_json(struct spdk_json_write_ctx *w)
|
||||
TAILQ_FOREACH(nbd, &g_spdk_nbd.disk_head, tailq) {
|
||||
spdk_json_write_object_begin(w);
|
||||
|
||||
spdk_json_write_named_string(w, "method", "start_nbd_disk");
|
||||
spdk_json_write_named_string(w, "method", "nbd_start_disk");
|
||||
|
||||
spdk_json_write_named_object_begin(w, "params");
|
||||
spdk_json_write_named_string(w, "nbd_device", spdk_nbd_disk_get_nbd_path(nbd));
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include "nbd_internal.h"
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
struct rpc_start_nbd_disk {
|
||||
struct rpc_nbd_start_disk {
|
||||
char *bdev_name;
|
||||
char *nbd_device;
|
||||
/* Used to search one available nbd device */
|
||||
@ -51,16 +51,16 @@ struct rpc_start_nbd_disk {
|
||||
};
|
||||
|
||||
static void
|
||||
free_rpc_start_nbd_disk(struct rpc_start_nbd_disk *req)
|
||||
free_rpc_nbd_start_disk(struct rpc_nbd_start_disk *req)
|
||||
{
|
||||
free(req->bdev_name);
|
||||
free(req->nbd_device);
|
||||
free(req);
|
||||
}
|
||||
|
||||
static const struct spdk_json_object_decoder rpc_start_nbd_disk_decoders[] = {
|
||||
{"bdev_name", offsetof(struct rpc_start_nbd_disk, bdev_name), spdk_json_decode_string},
|
||||
{"nbd_device", offsetof(struct rpc_start_nbd_disk, nbd_device), spdk_json_decode_string, true},
|
||||
static const struct spdk_json_object_decoder rpc_nbd_start_disk_decoders[] = {
|
||||
{"bdev_name", offsetof(struct rpc_nbd_start_disk, bdev_name), spdk_json_decode_string},
|
||||
{"nbd_device", offsetof(struct rpc_nbd_start_disk, nbd_device), spdk_json_decode_string, true},
|
||||
};
|
||||
|
||||
/* Return 0 to indicate the nbd_device might be available,
|
||||
@ -138,7 +138,7 @@ find_available_nbd_disk(int nbd_idx, int *next_nbd_idx)
|
||||
static void
|
||||
spdk_rpc_start_nbd_done(void *cb_arg, struct spdk_nbd_disk *nbd, int rc)
|
||||
{
|
||||
struct rpc_start_nbd_disk *req = cb_arg;
|
||||
struct rpc_nbd_start_disk *req = cb_arg;
|
||||
struct spdk_jsonrpc_request *request = req->request;
|
||||
struct spdk_json_write_ctx *w;
|
||||
|
||||
@ -165,25 +165,25 @@ spdk_rpc_start_nbd_done(void *cb_arg, struct spdk_nbd_disk *nbd, int rc)
|
||||
spdk_json_write_string(w, spdk_nbd_get_path(nbd));
|
||||
spdk_jsonrpc_end_result(request, w);
|
||||
|
||||
free_rpc_start_nbd_disk(req);
|
||||
free_rpc_nbd_start_disk(req);
|
||||
}
|
||||
|
||||
static void
|
||||
spdk_rpc_start_nbd_disk(struct spdk_jsonrpc_request *request,
|
||||
spdk_rpc_nbd_start_disk(struct spdk_jsonrpc_request *request,
|
||||
const struct spdk_json_val *params)
|
||||
{
|
||||
struct rpc_start_nbd_disk *req;
|
||||
struct rpc_nbd_start_disk *req;
|
||||
int rc;
|
||||
|
||||
req = calloc(1, sizeof(*req));
|
||||
if (req == NULL) {
|
||||
SPDK_ERRLOG("could not allocate start_nbd_disk request.\n");
|
||||
SPDK_ERRLOG("could not allocate nbd_start_disk request.\n");
|
||||
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR, "Out of memory");
|
||||
return;
|
||||
}
|
||||
|
||||
if (spdk_json_decode_object(params, rpc_start_nbd_disk_decoders,
|
||||
SPDK_COUNTOF(rpc_start_nbd_disk_decoders),
|
||||
if (spdk_json_decode_object(params, rpc_nbd_start_disk_decoders,
|
||||
SPDK_COUNTOF(rpc_nbd_start_disk_decoders),
|
||||
req)) {
|
||||
SPDK_ERRLOG("spdk_json_decode_object failed\n");
|
||||
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
|
||||
@ -228,10 +228,11 @@ spdk_rpc_start_nbd_disk(struct spdk_jsonrpc_request *request,
|
||||
return;
|
||||
|
||||
invalid:
|
||||
free_rpc_start_nbd_disk(req);
|
||||
free_rpc_nbd_start_disk(req);
|
||||
}
|
||||
|
||||
SPDK_RPC_REGISTER("start_nbd_disk", spdk_rpc_start_nbd_disk, SPDK_RPC_RUNTIME)
|
||||
SPDK_RPC_REGISTER("nbd_start_disk", spdk_rpc_nbd_start_disk, SPDK_RPC_RUNTIME)
|
||||
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(nbd_start_disk, start_nbd_disk)
|
||||
|
||||
struct rpc_stop_nbd_disk {
|
||||
char *nbd_device;
|
||||
|
@ -1461,15 +1461,16 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
|
||||
p.set_defaults(func=enable_vmd)
|
||||
|
||||
# nbd
|
||||
def start_nbd_disk(args):
|
||||
print(rpc.nbd.start_nbd_disk(args.client,
|
||||
def nbd_start_disk(args):
|
||||
print(rpc.nbd.nbd_start_disk(args.client,
|
||||
bdev_name=args.bdev_name,
|
||||
nbd_device=args.nbd_device))
|
||||
|
||||
p = subparsers.add_parser('start_nbd_disk', help='Export a bdev as a nbd disk')
|
||||
p = subparsers.add_parser('nbd_start_disk', aliases=['start_nbd_disk'],
|
||||
help='Export a bdev as a nbd disk')
|
||||
p.add_argument('bdev_name', help='Blockdev name to be exported. Example: Malloc0.')
|
||||
p.add_argument('nbd_device', help='Nbd device name to be assigned. Example: /dev/nbd0.', nargs='?')
|
||||
p.set_defaults(func=start_nbd_disk)
|
||||
p.set_defaults(func=nbd_start_disk)
|
||||
|
||||
def stop_nbd_disk(args):
|
||||
rpc.nbd.stop_nbd_disk(args.client,
|
||||
|
@ -1,10 +1,14 @@
|
||||
def start_nbd_disk(client, bdev_name, nbd_device):
|
||||
from .helpers import deprecated_alias
|
||||
|
||||
|
||||
@deprecated_alias('start_nbd_disk')
|
||||
def nbd_start_disk(client, bdev_name, nbd_device):
|
||||
params = {
|
||||
'bdev_name': bdev_name
|
||||
}
|
||||
if nbd_device:
|
||||
params['nbd_device'] = nbd_device
|
||||
return client.call('start_nbd_disk', params)
|
||||
return client.call('nbd_start_disk', params)
|
||||
|
||||
|
||||
def stop_nbd_disk(client, nbd_device):
|
||||
|
@ -7,7 +7,7 @@ function nbd_start_disks() {
|
||||
local i
|
||||
|
||||
for (( i=0; i<${#nbd_list[@]}; i++ )); do
|
||||
$rootdir/scripts/rpc.py -s $rpc_server start_nbd_disk ${bdev_list[$i]} ${nbd_list[$i]}
|
||||
$rootdir/scripts/rpc.py -s $rpc_server nbd_start_disk ${bdev_list[$i]} ${nbd_list[$i]}
|
||||
# Wait for nbd device ready
|
||||
waitfornbd $(basename ${nbd_list[$i]})
|
||||
done
|
||||
@ -20,7 +20,7 @@ function nbd_start_disks_without_nbd_idx() {
|
||||
local nbd_device
|
||||
|
||||
for (( i=0; i<${#bdev_list[@]}; i++ )); do
|
||||
nbd_device=$($rootdir/scripts/rpc.py -s $rpc_server start_nbd_disk ${bdev_list[$i]})
|
||||
nbd_device=$($rootdir/scripts/rpc.py -s $rpc_server nbd_start_disk ${bdev_list[$i]})
|
||||
# Wait for nbd device ready
|
||||
waitfornbd $(basename ${nbd_device})
|
||||
done
|
||||
|
@ -54,7 +54,7 @@ $rpc_py $ftl_construct_args
|
||||
|
||||
# Load the nbd driver
|
||||
modprobe nbd
|
||||
$rpc_py start_nbd_disk nvme0 /dev/nbd0
|
||||
$rpc_py nbd_start_disk nvme0 /dev/nbd0
|
||||
waitfornbd nbd0
|
||||
|
||||
$rpc_py save_config > $testdir/config/ftl.json
|
||||
|
@ -54,7 +54,7 @@ $rpc_py $ftl_construct_args
|
||||
|
||||
# Load the nbd driver
|
||||
modprobe nbd
|
||||
$rpc_py start_nbd_disk nvme0 /dev/nbd0
|
||||
$rpc_py nbd_start_disk nvme0 /dev/nbd0
|
||||
waitfornbd nbd0
|
||||
|
||||
$rpc_py save_config > $testdir/config/ftl.json
|
||||
|
@ -116,7 +116,7 @@ def clear_iscsi_subsystem(args, iscsi_config):
|
||||
|
||||
|
||||
def get_nbd_destroy_method(nbd):
|
||||
delete_method_map = {'start_nbd_disk': "stop_nbd_disk"
|
||||
delete_method_map = {'nbd_start_disk': "stop_nbd_disk"
|
||||
}
|
||||
return delete_method_map[nbd['method']]
|
||||
|
||||
|
@ -169,9 +169,9 @@ class Commands_Rpc(object):
|
||||
output, rc = self.rpc.bdev_lvol_set_read_only(uuid)
|
||||
return rc
|
||||
|
||||
def start_nbd_disk(self, bdev_name, nbd_name):
|
||||
print("INFO: RPC COMMAND start_nbd_disk")
|
||||
output, rc = self.rpc.start_nbd_disk(bdev_name, nbd_name)
|
||||
def nbd_start_disk(self, bdev_name, nbd_name):
|
||||
print("INFO: RPC COMMAND nbd_start_disk")
|
||||
output, rc = self.rpc.nbd_start_disk(bdev_name, nbd_name)
|
||||
return rc
|
||||
|
||||
def stop_nbd_disk(self, nbd_name):
|
||||
|
@ -38,7 +38,7 @@ current_fio_pid = -1
|
||||
# results.
|
||||
#
|
||||
# Tests with thin provisioned lvol bdevs, snapshots and clones are using nbd devices.
|
||||
# Before writing/reading to lvol bdev, bdev is installed with rpc start_nbd_disk.
|
||||
# Before writing/reading to lvol bdev, bdev is installed with rpc nbd_start_disk.
|
||||
# After finishing writing/reading, rpc stop_nbd_disk is used.
|
||||
|
||||
|
||||
@ -1491,7 +1491,7 @@ class TestCases(object):
|
||||
fail_count += 1
|
||||
lvol_bdev = self.c.get_lvol_bdev_with_name(bdev_name)
|
||||
nbd_name = "/dev/nbd0"
|
||||
fail_count += self.c.start_nbd_disk(bdev_name, nbd_name)
|
||||
fail_count += self.c.nbd_start_disk(bdev_name, nbd_name)
|
||||
|
||||
size = int(lvs['cluster_size'])
|
||||
# write data (lvs cluster size) to created lvol bdev starting from offset 0.
|
||||
@ -1573,9 +1573,9 @@ class TestCases(object):
|
||||
lvol_bdev0 = self.c.get_lvol_bdev_with_name(bdev_name0)
|
||||
lvol_bdev1 = self.c.get_lvol_bdev_with_name(bdev_name1)
|
||||
nbd_name0 = "/dev/nbd0"
|
||||
fail_count += self.c.start_nbd_disk(lvol_bdev0['name'], nbd_name0)
|
||||
fail_count += self.c.nbd_start_disk(lvol_bdev0['name'], nbd_name0)
|
||||
nbd_name1 = "/dev/nbd1"
|
||||
fail_count += self.c.start_nbd_disk(lvol_bdev1['name'], nbd_name1)
|
||||
fail_count += self.c.nbd_start_disk(lvol_bdev1['name'], nbd_name1)
|
||||
|
||||
size = bdev_size * MEGABYTE
|
||||
# fill the whole thick provisioned lvol bdev
|
||||
@ -1625,7 +1625,7 @@ class TestCases(object):
|
||||
|
||||
lvol_bdev = self.c.get_lvol_bdev_with_name(bdev_name)
|
||||
nbd_name = "/dev/nbd0"
|
||||
fail_count += self.c.start_nbd_disk(lvol_bdev['name'], nbd_name)
|
||||
fail_count += self.c.nbd_start_disk(lvol_bdev['name'], nbd_name)
|
||||
size = bdev_size * MEGABYTE
|
||||
# on the whole lvol bdev perform write operation with verification
|
||||
fail_count += self.run_fio_test(nbd_name, 0, size, "write", "0xcc")
|
||||
@ -1665,7 +1665,7 @@ class TestCases(object):
|
||||
fail_count += self.c.check_bdev_get_bdevs_methods(uuid_bdev, size)
|
||||
# Fill all free space of lvol bdev with data
|
||||
nbd_name = "/dev/nbd0"
|
||||
fail_count += self.c.start_nbd_disk(uuid_bdev, nbd_name)
|
||||
fail_count += self.c.nbd_start_disk(uuid_bdev, nbd_name)
|
||||
fail_count += self.run_fio_test(nbd_name, 0, size*MEGABYTE, "write", "0xcc", 0)
|
||||
fail_count += self.c.stop_nbd_disk(nbd_name)
|
||||
# Save number of free clusters for lvs
|
||||
@ -1688,7 +1688,7 @@ class TestCases(object):
|
||||
# Perform write operation with verification
|
||||
# to newly created free space of lvol bdev
|
||||
nbd_name = "/dev/nbd0"
|
||||
fail_count += self.c.start_nbd_disk(uuid_bdev, nbd_name)
|
||||
fail_count += self.c.nbd_start_disk(uuid_bdev, nbd_name)
|
||||
fail_count += self.run_fio_test(nbd_name, int(lbd_size * MEGABYTE / 2),
|
||||
int(lbd_size * MEGABYTE / 2), "write", "0xcc", 0)
|
||||
fail_count += self.c.stop_nbd_disk(nbd_name)
|
||||
@ -1752,8 +1752,8 @@ class TestCases(object):
|
||||
|
||||
nbd_name0 = "/dev/nbd0"
|
||||
nbd_name1 = "/dev/nbd1"
|
||||
fail_count += self.c.start_nbd_disk(lvol_bdev0['name'], nbd_name0)
|
||||
fail_count += self.c.start_nbd_disk(lvol_bdev1['name'], nbd_name1)
|
||||
fail_count += self.c.nbd_start_disk(lvol_bdev0['name'], nbd_name0)
|
||||
fail_count += self.c.nbd_start_disk(lvol_bdev1['name'], nbd_name1)
|
||||
|
||||
size = "75%"
|
||||
# fill first bdev to 75% of its space with specific pattern
|
||||
@ -1820,8 +1820,8 @@ class TestCases(object):
|
||||
# check if bdevs are available and size of every disk is equal to 70% of lvs size
|
||||
nbd_name0 = "/dev/nbd0"
|
||||
nbd_name1 = "/dev/nbd1"
|
||||
fail_count += self.c.start_nbd_disk(lvol_bdev0['name'], nbd_name0)
|
||||
fail_count += self.c.start_nbd_disk(lvol_bdev1['name'], nbd_name1)
|
||||
fail_count += self.c.nbd_start_disk(lvol_bdev0['name'], nbd_name0)
|
||||
fail_count += self.c.nbd_start_disk(lvol_bdev1['name'], nbd_name1)
|
||||
size = int(int(lvol_bdev0['num_blocks']) * int(lvol_bdev0['block_size']) * 0.7)
|
||||
# fill first disk with 70% of its size
|
||||
# check if operation didn't fail
|
||||
@ -2151,7 +2151,7 @@ class TestCases(object):
|
||||
fail_count += self.c.bdev_lvol_snapshot(lvol_bdev['name'], snapshot_name)
|
||||
snapshot_bdev = self.c.get_lvol_bdev_with_name(self.lvs_name + "/" + snapshot_name)
|
||||
|
||||
fail_count += self.c.start_nbd_disk(snapshot_bdev['name'], nbd_name0)
|
||||
fail_count += self.c.nbd_start_disk(snapshot_bdev['name'], nbd_name0)
|
||||
size = bdev_size * MEGABYTE
|
||||
# Try to perform write operation on created snapshot
|
||||
# Check if filling snapshot of lvol bdev fails
|
||||
@ -2203,12 +2203,12 @@ class TestCases(object):
|
||||
uuid_bdev1 = self.c.bdev_lvol_create(uuid_store,
|
||||
lbd_name1, size, thin=False)
|
||||
lvol_bdev0 = self.c.get_lvol_bdev_with_name(uuid_bdev0)
|
||||
fail_count += self.c.start_nbd_disk(lvol_bdev0['name'], nbd_name[0])
|
||||
fail_count += self.c.nbd_start_disk(lvol_bdev0['name'], nbd_name[0])
|
||||
fill_size = int(size * MEGABYTE / 2)
|
||||
# Fill thin provisoned lvol bdev with 50% of its space
|
||||
fail_count += self.run_fio_test(nbd_name[0], 0, fill_size, "write", "0xcc", 0)
|
||||
lvol_bdev1 = self.c.get_lvol_bdev_with_name(uuid_bdev1)
|
||||
fail_count += self.c.start_nbd_disk(lvol_bdev1['name'], nbd_name[1])
|
||||
fail_count += self.c.nbd_start_disk(lvol_bdev1['name'], nbd_name[1])
|
||||
fill_size = int(size * MEGABYTE)
|
||||
# Fill whole thic provisioned lvol bdev
|
||||
fail_count += self.run_fio_test(nbd_name[1], 0, fill_size, "write", "0xcc", 0)
|
||||
@ -2216,8 +2216,8 @@ class TestCases(object):
|
||||
# Create snapshots of lvol bdevs
|
||||
fail_count += self.c.bdev_lvol_snapshot(uuid_bdev0, snapshot_name0)
|
||||
fail_count += self.c.bdev_lvol_snapshot(uuid_bdev1, snapshot_name1)
|
||||
fail_count += self.c.start_nbd_disk(self.lvs_name + "/" + snapshot_name0, nbd_name[2])
|
||||
fail_count += self.c.start_nbd_disk(self.lvs_name + "/" + snapshot_name1, nbd_name[3])
|
||||
fail_count += self.c.nbd_start_disk(self.lvs_name + "/" + snapshot_name0, nbd_name[2])
|
||||
fail_count += self.c.nbd_start_disk(self.lvs_name + "/" + snapshot_name1, nbd_name[3])
|
||||
# Compare every lvol bdev with corresponding snapshot
|
||||
# and check that data are the same
|
||||
fail_count += self.compare_two_disks(nbd_name[0], nbd_name[2], 0)
|
||||
@ -2274,7 +2274,7 @@ class TestCases(object):
|
||||
size, thin=True)
|
||||
|
||||
lvol_bdev = self.c.get_lvol_bdev_with_name(uuid_bdev)
|
||||
fail_count += self.c.start_nbd_disk(lvol_bdev['name'], nbd_name)
|
||||
fail_count += self.c.nbd_start_disk(lvol_bdev['name'], nbd_name)
|
||||
fill_size = int(size * MEGABYTE)
|
||||
# Create thread that will run fio in background
|
||||
thread = FioThread(nbd_name, 0, fill_size, "write", "0xcc", 0,
|
||||
@ -2440,7 +2440,7 @@ class TestCases(object):
|
||||
lbd_name0, size, thin=False)
|
||||
lvol_bdev = self.c.get_lvol_bdev_with_name(uuid_bdev0)
|
||||
# Install lvol bdev on /dev/nbd0
|
||||
fail_count += self.c.start_nbd_disk(lvol_bdev['name'], nbd_name[0])
|
||||
fail_count += self.c.nbd_start_disk(lvol_bdev['name'], nbd_name[0])
|
||||
fill_size = size * MEGABYTE
|
||||
# Fill lvol bdev with 100% of its space
|
||||
fail_count += self.run_fio_test(nbd_name[0], 0, fill_size, "write", "0xcc", 0)
|
||||
@ -2453,14 +2453,14 @@ class TestCases(object):
|
||||
fail_count += self.c.bdev_lvol_clone(snapshot_bdev['name'], clone_name1)
|
||||
|
||||
lvol_clone0 = self.c.get_lvol_bdev_with_name(self.lvs_name + "/" + clone_name0)
|
||||
fail_count += self.c.start_nbd_disk(lvol_clone0['name'], nbd_name[1])
|
||||
fail_count += self.c.nbd_start_disk(lvol_clone0['name'], nbd_name[1])
|
||||
fill_size = int(size * MEGABYTE / 2)
|
||||
# Perform write operation to first clone
|
||||
# Change first half of its space
|
||||
fail_count += self.run_fio_test(nbd_name[1], 0, fill_size, "write", "0xaa", 0)
|
||||
fail_count += self.c.start_nbd_disk(self.lvs_name + "/" + snapshot_name, nbd_name[2])
|
||||
fail_count += self.c.nbd_start_disk(self.lvs_name + "/" + snapshot_name, nbd_name[2])
|
||||
lvol_clone1 = self.c.get_lvol_bdev_with_name(self.lvs_name + "/" + clone_name1)
|
||||
fail_count += self.c.start_nbd_disk(lvol_clone1['name'], nbd_name[3])
|
||||
fail_count += self.c.nbd_start_disk(lvol_clone1['name'], nbd_name[3])
|
||||
# Compare snapshot with second clone. Data on both bdevs should be the same
|
||||
time.sleep(1)
|
||||
fail_count += self.compare_two_disks(nbd_name[2], nbd_name[3], 0)
|
||||
@ -2604,7 +2604,7 @@ class TestCases(object):
|
||||
lvol_bdev = self.c.get_lvol_bdev_with_name(uuid_bdev0)
|
||||
|
||||
# Fill bdev with data of knonw pattern
|
||||
fail_count += self.c.start_nbd_disk(lvol_bdev['name'], nbd_name)
|
||||
fail_count += self.c.nbd_start_disk(lvol_bdev['name'], nbd_name)
|
||||
fill_size = size * MEGABYTE
|
||||
fail_count += self.run_fio_test(nbd_name, 0, fill_size, "write", "0xcc", 0)
|
||||
self.c.stop_nbd_disk(nbd_name)
|
||||
@ -2619,7 +2619,7 @@ class TestCases(object):
|
||||
fail_count += 1
|
||||
|
||||
# Fill part of clone with data of known pattern
|
||||
fail_count += self.c.start_nbd_disk(lvol_clone['name'], nbd_name)
|
||||
fail_count += self.c.nbd_start_disk(lvol_clone['name'], nbd_name)
|
||||
first_fill = 0
|
||||
second_fill = int(size * 3 / 4)
|
||||
fail_count += self.run_fio_test(nbd_name, first_fill * MEGABYTE,
|
||||
@ -2638,7 +2638,7 @@ class TestCases(object):
|
||||
fail_count += self.c.bdev_lvol_delete(snapshot_bdev['name'])
|
||||
|
||||
# Check data consistency
|
||||
fail_count += self.c.start_nbd_disk(lvol_clone['name'], nbd_name)
|
||||
fail_count += self.c.nbd_start_disk(lvol_clone['name'], nbd_name)
|
||||
fail_count += self.run_fio_test(nbd_name, first_fill * MEGABYTE,
|
||||
MEGABYTE, "read", "0xdd")
|
||||
fail_count += self.run_fio_test(nbd_name, (first_fill + 1) * MEGABYTE,
|
||||
@ -2767,7 +2767,7 @@ class TestCases(object):
|
||||
lvol_bdev = self.c.get_lvol_bdev_with_name(uuid_bdev0)
|
||||
|
||||
# Fill first four out of 5 culsters of clone with data of known pattern
|
||||
fail_count += self.c.start_nbd_disk(lvol_bdev['name'], nbd_name)
|
||||
fail_count += self.c.nbd_start_disk(lvol_bdev['name'], nbd_name)
|
||||
begin_fill = 0
|
||||
end_fill = int(size * 4 / 5)
|
||||
fail_count += self.run_fio_test(nbd_name, begin_fill * MEGABYTE,
|
||||
@ -2869,7 +2869,7 @@ class TestCases(object):
|
||||
fail_count += self.c.bdev_lvol_set_read_only(lvol_bdev['name'])
|
||||
|
||||
# Try to perform write operation on lvol marked as read only
|
||||
fail_count += self.c.start_nbd_disk(lvol_bdev['name'], nbd_name0)
|
||||
fail_count += self.c.nbd_start_disk(lvol_bdev['name'], nbd_name0)
|
||||
size = bdev_size * MEGABYTE
|
||||
fail_count += self.run_fio_test(nbd_name0, 0, size, "write", "0xcc", 1)
|
||||
|
||||
@ -2881,7 +2881,7 @@ class TestCases(object):
|
||||
clone_bdev = self.c.get_lvol_bdev_with_name(self.lvs_name + "/" + clone_name)
|
||||
|
||||
# Try to perform write operation on lvol clone
|
||||
fail_count += self.c.start_nbd_disk(clone_bdev['name'], nbd_name1)
|
||||
fail_count += self.c.nbd_start_disk(clone_bdev['name'], nbd_name1)
|
||||
size = bdev_size * MEGABYTE
|
||||
fail_count += self.run_fio_test(nbd_name1, 0, size, "write", "0xcc", 0)
|
||||
|
||||
@ -2930,7 +2930,7 @@ class TestCases(object):
|
||||
lvol_bdev = self.c.get_lvol_bdev_with_name(bdev_name)
|
||||
|
||||
# Perform write operation on lvol
|
||||
fail_count += self.c.start_nbd_disk(lvol_bdev['name'], nbd_name0)
|
||||
fail_count += self.c.nbd_start_disk(lvol_bdev['name'], nbd_name0)
|
||||
size = bdev_size * MEGABYTE
|
||||
fail_count += self.run_fio_test(nbd_name0, 0, size, "write", "0xcc")
|
||||
|
||||
@ -2947,7 +2947,7 @@ class TestCases(object):
|
||||
fail_count += self.run_fio_test(nbd_name0, 0, half_size-1, "write", "0xee")
|
||||
|
||||
# Check if snapshot was unchanged
|
||||
fail_count += self.c.start_nbd_disk(snapshot_bdev['name'], nbd_name1)
|
||||
fail_count += self.c.nbd_start_disk(snapshot_bdev['name'], nbd_name1)
|
||||
fail_count += self.run_fio_test(nbd_name1, 0, half_size-1, "read", "0xcc")
|
||||
|
||||
# Verify lvol bdev
|
||||
@ -3010,7 +3010,7 @@ class TestCases(object):
|
||||
lvol_bdev = self.c.get_lvol_bdev_with_name(bdev_name)
|
||||
|
||||
# Perform write operation on lvol
|
||||
fail_count += self.c.start_nbd_disk(lvol_bdev['name'], nbd_name0)
|
||||
fail_count += self.c.nbd_start_disk(lvol_bdev['name'], nbd_name0)
|
||||
size = bdev_size * MEGABYTE
|
||||
fail_count += self.run_fio_test(nbd_name0, 0, size-1, "write", "0xcc")
|
||||
|
||||
@ -3027,7 +3027,7 @@ class TestCases(object):
|
||||
fail_count += self.run_fio_test(nbd_name0, first_part, second_part-first_part, "write", "0xee")
|
||||
|
||||
# Check if snapshot was unchanged
|
||||
fail_count += self.c.start_nbd_disk(snapshot_bdev['name'], nbd_name1)
|
||||
fail_count += self.c.nbd_start_disk(snapshot_bdev['name'], nbd_name1)
|
||||
fail_count += self.run_fio_test(nbd_name1, 0, size-1, "read", "0xcc")
|
||||
|
||||
# Create second snapshot of lvol_bdev
|
||||
@ -3047,7 +3047,7 @@ class TestCases(object):
|
||||
|
||||
# Verify snapshots
|
||||
fail_count += self.run_fio_test(nbd_name1, 0, size-1, "read", "0xcc")
|
||||
fail_count += self.c.start_nbd_disk(snapshot_bdev2['name'], nbd_name2)
|
||||
fail_count += self.c.nbd_start_disk(snapshot_bdev2['name'], nbd_name2)
|
||||
fail_count += self.run_fio_test(nbd_name2, 0, first_part-1, "read", "0xcc")
|
||||
fail_count += self.run_fio_test(nbd_name2, first_part, second_part-first_part, "read", "0xee")
|
||||
fail_count += self.run_fio_test(nbd_name2, second_part, size-second_part, "read", "0xcc")
|
||||
|
Loading…
x
Reference in New Issue
Block a user