test/lvol: Replace stop/start vhost with add/delete bdev
Change-Id: Ic960f2fe6966ae6eeb027a7c6a1d6929c741080d Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com> Reviewed-on: https://review.gerrithub.io/388642 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
8b76ace55f
commit
56905c3877
@ -139,3 +139,7 @@ class Commands_Rpc(object):
|
|||||||
if bdev["product_name"] == "Logical Volume":
|
if bdev["product_name"] == "Logical Volume":
|
||||||
output.append(bdev)
|
output.append(bdev)
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
def construct_nvme_bdev(self, nvme_name, trtype, traddr):
|
||||||
|
print("INFO: Add NVMe bdev {nvme}".format(nvme=nvme_name))
|
||||||
|
self.rpc.construct_nvme_bdev("-b", nvme_name, "-t", trtype, "-a", traddr)
|
||||||
|
@ -75,6 +75,7 @@ class TestCases(object):
|
|||||||
self.app_path = app_path
|
self.app_path = app_path
|
||||||
self.lvs_name = "lvs_test"
|
self.lvs_name = "lvs_test"
|
||||||
self.lbd_name = "lbd_test"
|
self.lbd_name = "lbd_test"
|
||||||
|
self.vhost_config_path = path.join(path.dirname(sys.argv[0]), 'vhost.conf')
|
||||||
|
|
||||||
def _gen_lvs_uudi(self):
|
def _gen_lvs_uudi(self):
|
||||||
return str(uuid4())
|
return str(uuid4())
|
||||||
@ -141,6 +142,17 @@ class TestCases(object):
|
|||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
def _find_traddress_for_nvme(self, nvme_name):
|
||||||
|
with open(self.vhost_config_path) as file:
|
||||||
|
for line in file:
|
||||||
|
if nvme_name in line and "TransportID" in line:
|
||||||
|
for word in line.split(" "):
|
||||||
|
if word.startswith("traddr"):
|
||||||
|
return word.split(":", 1)[1].replace("\"", "")
|
||||||
|
|
||||||
|
print("INFO: Traddr not found for Nvme {nvme}".format(nvme=nvme_name))
|
||||||
|
return -1
|
||||||
|
|
||||||
# positive tests
|
# positive tests
|
||||||
def test_case1(self):
|
def test_case1(self):
|
||||||
header(1)
|
header(1)
|
||||||
@ -503,11 +515,7 @@ class TestCases(object):
|
|||||||
def test_case255(self):
|
def test_case255(self):
|
||||||
header(255)
|
header(255)
|
||||||
base_path = path.dirname(sys.argv[0])
|
base_path = path.dirname(sys.argv[0])
|
||||||
vhost_path = path.join(self.app_path, 'vhost')
|
|
||||||
config_path = path.join(base_path, 'vhost.conf')
|
|
||||||
pid_path = path.join(base_path, 'vhost.pid')
|
|
||||||
base_name = "Nvme0n1"
|
base_name = "Nvme0n1"
|
||||||
self.c.destroy_lvol_store(self.lvs_name)
|
|
||||||
uuid_store = self.c.construct_lvol_store(base_name,
|
uuid_store = self.c.construct_lvol_store(base_name,
|
||||||
self.lvs_name,
|
self.lvs_name,
|
||||||
self.cluster_size)
|
self.cluster_size)
|
||||||
@ -515,12 +523,12 @@ class TestCases(object):
|
|||||||
self.cluster_size)
|
self.cluster_size)
|
||||||
if self.c.destroy_lvol_store(self.lvs_name) != 0:
|
if self.c.destroy_lvol_store(self.lvs_name) != 0:
|
||||||
fail_count += 1
|
fail_count += 1
|
||||||
fail_count += self._stop_vhost(pid_path)
|
traddr = self._find_traddress_for_nvme("Nvme0")
|
||||||
remove(pid_path)
|
if traddr != -1:
|
||||||
if self._start_vhost(vhost_path, config_path, pid_path) != 0:
|
self.c.delete_bdev(base_name)
|
||||||
|
self.c.construct_nvme_bdev("Nvme0", "PCIe", traddr)
|
||||||
|
else:
|
||||||
fail_count += 1
|
fail_count += 1
|
||||||
footer(255)
|
|
||||||
return fail_count
|
|
||||||
ret_value = self.c.check_get_lvol_stores(base_name, uuid_store,
|
ret_value = self.c.check_get_lvol_stores(base_name, uuid_store,
|
||||||
self.cluster_size)
|
self.cluster_size)
|
||||||
if ret_value == 0:
|
if ret_value == 0:
|
||||||
@ -773,22 +781,18 @@ class TestCases(object):
|
|||||||
|
|
||||||
def test_case651(self):
|
def test_case651(self):
|
||||||
header(651)
|
header(651)
|
||||||
base_path = path.dirname(sys.argv[0])
|
|
||||||
vhost_path = path.join(self.app_path, 'vhost')
|
|
||||||
config_path = path.join(base_path, 'vhost.conf')
|
|
||||||
pid_path = path.join(base_path, 'vhost.pid')
|
|
||||||
base_name = "Nvme0n1"
|
base_name = "Nvme0n1"
|
||||||
uuid_store = self.c.construct_lvol_store(base_name,
|
uuid_store = self.c.construct_lvol_store(base_name,
|
||||||
self.lvs_name,
|
self.lvs_name,
|
||||||
self.cluster_size)
|
self.cluster_size)
|
||||||
fail_count = self.c.check_get_lvol_stores(base_name, uuid_store,
|
fail_count = self.c.check_get_lvol_stores(base_name, uuid_store,
|
||||||
self.cluster_size)
|
self.cluster_size)
|
||||||
fail_count += self._stop_vhost(pid_path)
|
traddr = self._find_traddress_for_nvme("Nvme0")
|
||||||
remove(pid_path)
|
if traddr != -1:
|
||||||
if self._start_vhost(vhost_path, config_path, pid_path) != 0:
|
self.c.delete_bdev(base_name)
|
||||||
|
self.c.construct_nvme_bdev("Nvme0", "PCIe", traddr)
|
||||||
|
else:
|
||||||
fail_count += 1
|
fail_count += 1
|
||||||
footer(651)
|
|
||||||
return fail_count
|
|
||||||
if self.c.check_get_lvol_stores(base_name, uuid_store,
|
if self.c.check_get_lvol_stores(base_name, uuid_store,
|
||||||
self.cluster_size) != 0:
|
self.cluster_size) != 0:
|
||||||
fail_count += 1
|
fail_count += 1
|
||||||
|
@ -341,11 +341,13 @@ Positive test for removing lvol store persistently
|
|||||||
Steps:
|
Steps:
|
||||||
- construct_lvol_store on NVMe bdev
|
- construct_lvol_store on NVMe bdev
|
||||||
- destroy lvol store
|
- destroy lvol store
|
||||||
- restart vhost
|
- delete NVMe bdev
|
||||||
|
- add NVMe bdev
|
||||||
- check if destroyed lvol store does not exist on NVMe bdev
|
- check if destroyed lvol store does not exist on NVMe bdev
|
||||||
|
|
||||||
Expected result:
|
Expected result:
|
||||||
- get_lvol_stores should not report any existsing lvol stores in configuration after restarting Vhost instance
|
- get_lvol_stores should not report any existsing lvol stores in configuration
|
||||||
|
after deleting and adding NVMe bdev
|
||||||
- no other operation fails
|
- no other operation fails
|
||||||
|
|
||||||
### destroy_lvol_store - negative tests
|
### destroy_lvol_store - negative tests
|
||||||
@ -595,8 +597,8 @@ Positive test for tasting lvol store.
|
|||||||
Steps:
|
Steps:
|
||||||
- run vhost app with NVMe bdev
|
- run vhost app with NVMe bdev
|
||||||
- construct lvol store on NVMe bdev
|
- construct lvol store on NVMe bdev
|
||||||
- stop vhost
|
- delete NVMe bdev
|
||||||
- start vhost
|
- add NVMe bdev
|
||||||
- check if lvol store still exists in vhost configuration
|
- check if lvol store still exists in vhost configuration
|
||||||
- destroy lvol store from NVMe bdev
|
- destroy lvol store from NVMe bdev
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user