- lvr = subprocess.Popen(['lvrename', 'xenvg', src, dest],
- stderr=subprocess.PIPE,
- stdout=getOutput()['stdout'])
- ret = lvr.wait()
- if not ret:
- return 0
- stderr = lvr.stderr.read()
- if 'not found in volume group' in stderr:
- return 0
- else:
- if verbosity > 0:
- print stderr
- return ret
+ subprocess.run(['lvchange', '-an', f'xenvg/{src}'],
+ check_output=True, encoding='utf-8', check=True)
+
+ subprocess.run(['lvrename', f'xenvg/{src}', f'xenvg/{dest}'],
+ check_output=True, encoding='utf-8', check=True)
+
+ subprocess.run(['lvchange', '-ay', f'xenvg/{dest}'],
+ check_output=True, encoding='utf-8', check=True)