我目前正在编辑python脚本以在逻辑卷上调用lvremove。我的问题是;我可以在python中创建一个模拟逻辑卷以进行单元测试,或者我应该将其视为常规目录。原因是测试对lvrmove的调用 - 我的代码如下:
#check if lvm exists
if os.path.isfile(lvm_lv_name)
#then remove it
lvremove -vf lvm_lv_name
if os.path.isfile(lvm_lv_name)
self.log.error("Removal of logical volume ",lvm_lv_name," was not successful")
else:
self.log.info("Logical volume",lvm_lv_name," successfully removed")
else:
self.log.info("Logical volume ",lvm_lv_name," could not be found")