def format_storage_volume(img, filesystem, partition="mbr"): """ format data disk with virt-format :param img: qemuImg object will be format :param filesystem: filesystem want to make :param partition: partition type MBR or GPT """ selinux_mode = process.getoutput("getenforce", shell=True) try: process.system("setenforce 0", shell=True) utils_libguestfs.virt_format(img.image_filename, filesystem=filesystem, image_format=img.image_format, partition="mbr") finally: process.system("setenforce %s" % selinux_mode, shell=True)
def format_disk(self, disk_path=None, filesystem=None, partition=None, lvm=None): """ :param disk_path: None for additional disk by update_vm_disk() only """ if disk_path is None: disk_path = self.params.get("added_disk_path") result = lgf.virt_format(disk_path, filesystem, lvm=lvm, partition=partition, debug=True, ignore_status=True) return result