Re: [PATCH] Check result of qemu-img

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



John Levon wrote:
> Check result of qemu-img
> 
> If qemu-img convert fails, report an error and exit.
> 
> Signed-off-by: John Levon <john.levon@xxxxxxx>
> 
> diff --git a/virt-unpack b/virt-unpack
> --- a/virt-unpack
> +++ b/virt-unpack
> @@ -237,8 +237,9 @@ def convert_disks(disks_list, options):
>          if not os.path.isabs(outfile):
>              outfile = os.path.join(options.output_dir, outfile)
>          convert_cmd="qemu-img convert %s -O raw %s" % (infile, outfile)
> -        ret = os.system(convert_cmd)
> -        print ret
> +        if os.system(convert_cmd) != 0:
> +            logging.error("Converting disk %s failed.\n" % infile)
> +            sys.exit(1)
>  
>  
>  def main():
> 

Is just exiting the right choice here? Seems like we should do some cleanup.

Also for future reference it might be a good idea to iterate through the
list of disks and try 'qemu-img info' to make sure the disk at least appears
to be in the correct format before we convert.

- Cole

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux