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":
|
||||
output.append(bdev)
|
||||
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.lvs_name = "lvs_test"
|
||||
self.lbd_name = "lbd_test"
|
||||
self.vhost_config_path = path.join(path.dirname(sys.argv[0]), 'vhost.conf')
|
||||
|
||||
def _gen_lvs_uudi(self):
|
||||
return str(uuid4())
|
||||
@ -141,6 +142,17 @@ class TestCases(object):
|
||||
return 1
|
||||
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
|
||||
def test_case1(self):
|
||||
header(1)
|
||||
@ -503,11 +515,7 @@ class TestCases(object):
|
||||
def test_case255(self):
|
||||
header(255)
|
||||
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"
|
||||
self.c.destroy_lvol_store(self.lvs_name)
|
||||
uuid_store = self.c.construct_lvol_store(base_name,
|
||||
self.lvs_name,
|
||||
self.cluster_size)
|
||||
@ -515,12 +523,12 @@ class TestCases(object):
|
||||
self.cluster_size)
|
||||
if self.c.destroy_lvol_store(self.lvs_name) != 0:
|
||||
fail_count += 1
|
||||
fail_count += self._stop_vhost(pid_path)
|
||||
remove(pid_path)
|
||||
if self._start_vhost(vhost_path, config_path, pid_path) != 0:
|
||||
traddr = self._find_traddress_for_nvme("Nvme0")
|
||||
if traddr != -1:
|
||||
self.c.delete_bdev(base_name)
|
||||
self.c.construct_nvme_bdev("Nvme0", "PCIe", traddr)
|
||||
else:
|
||||
fail_count += 1
|
||||
footer(255)
|
||||
return fail_count
|
||||
ret_value = self.c.check_get_lvol_stores(base_name, uuid_store,
|
||||
self.cluster_size)
|
||||
if ret_value == 0:
|
||||
@ -773,22 +781,18 @@ class TestCases(object):
|
||||
|
||||
def test_case651(self):
|
||||
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"
|
||||
uuid_store = self.c.construct_lvol_store(base_name,
|
||||
self.lvs_name,
|
||||
self.cluster_size)
|
||||
fail_count = self.c.check_get_lvol_stores(base_name, uuid_store,
|
||||
self.cluster_size)
|
||||
fail_count += self._stop_vhost(pid_path)
|
||||
remove(pid_path)
|
||||
if self._start_vhost(vhost_path, config_path, pid_path) != 0:
|
||||
traddr = self._find_traddress_for_nvme("Nvme0")
|
||||
if traddr != -1:
|
||||
self.c.delete_bdev(base_name)
|
||||
self.c.construct_nvme_bdev("Nvme0", "PCIe", traddr)
|
||||
else:
|
||||
fail_count += 1
|
||||
footer(651)
|
||||
return fail_count
|
||||
if self.c.check_get_lvol_stores(base_name, uuid_store,
|
||||
self.cluster_size) != 0:
|
||||
fail_count += 1
|
||||
|
@ -341,11 +341,13 @@ Positive test for removing lvol store persistently
|
||||
Steps:
|
||||
- construct_lvol_store on NVMe bdev
|
||||
- destroy lvol store
|
||||
- restart vhost
|
||||
- delete NVMe bdev
|
||||
- add NVMe bdev
|
||||
- check if destroyed lvol store does not exist on NVMe bdev
|
||||
|
||||
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
|
||||
|
||||
### destroy_lvol_store - negative tests
|
||||
@ -595,8 +597,8 @@ Positive test for tasting lvol store.
|
||||
Steps:
|
||||
- run vhost app with NVMe bdev
|
||||
- construct lvol store on NVMe bdev
|
||||
- stop vhost
|
||||
- start vhost
|
||||
- delete NVMe bdev
|
||||
- add NVMe bdev
|
||||
- check if lvol store still exists in vhost configuration
|
||||
- destroy lvol store from NVMe bdev
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user