def remove_vg(self): for ssh, node in zip(self.conn.list_ssh, self.conn.cluster['node']): lvm = action.LVM(ssh) vol = node['lvm_device'].split("/") vg = vol[0] result = lvm.remove_vg(vg) if result: print(result)
def create_dirver_pool(self): pv_list = [] for ssh, node in zip(self.conn.list_ssh, self.conn.cluster['node']): lvm = action.LVM(ssh) pv_list.append(lvm.pv_create(node['pool_disk'])) for r, node in zip(pv_list, self.conn.cluster['node']): if not r: print( f"{node['pool_disk']} is not on {node['hostname']} or it has been used" ) sys.exit() for ssh, node in zip(self.conn.list_ssh, self.conn.cluster['node']): lvm = action.LVM(ssh) vol = node['lvm_device'].split("/") if len(vol) == 1: vg = vol[0] lvm.vg_create(vg, node['pool_disk']) elif len(vol) == 2: vg, lv = vol lvm.vg_create(vg, node['pool_disk']) lvm.thinpool_create(vg, lv)
def uninstall_lvm2(self): for ssh in self.conn.list_ssh: handler = action.LVM(ssh) handler.uninstall()