| 952 | print('time {}'.format(self.seconds_to_hms(ellapsed_seconds))) |
| 953 | |
| 954 | def raw_to_qcow2(self, prebuilt=False, reverse=False): |
| 955 | if prebuilt or not os.path.exists(self.env['qemu_img_executable']): |
| 956 | disable_trace = [] |
| 957 | qemu_img_executable = self.env['qemu_img_basename'] |
| 958 | else: |
| 959 | # Prevent qemu-img from generating trace files like QEMU. Disgusting. |
| 960 | disable_trace = ['-T', 'pr_manager_run,file=/dev/null', LF] |
| 961 | qemu_img_executable = self.env['qemu_img_executable'] |
| 962 | infmt = 'raw' |
| 963 | outfmt = 'qcow2' |
| 964 | infile = self.env['rootfs_raw_file'] |
| 965 | outfile = self.env['qcow2_file'] |
| 966 | if reverse: |
| 967 | tmp = infmt |
| 968 | infmt = outfmt |
| 969 | outfmt = tmp |
| 970 | tmp = infile |
| 971 | infile = outfile |
| 972 | outfile = tmp |
| 973 | self.sh.run_cmd( |
| 974 | [ |
| 975 | qemu_img_executable, LF, |
| 976 | ] + |
| 977 | disable_trace + |
| 978 | [ |
| 979 | 'convert', LF, |
| 980 | '-f', infmt, LF, |
| 981 | '-O', outfmt, LF, |
| 982 | infile, LF, |
| 983 | outfile, LF, |
| 984 | ] |
| 985 | ) |
| 986 | |
| 987 | @staticmethod |
| 988 | def resolve_args(defaults, args, extra_args): |