[PATCH 1/2] Add support for creating qcow2 images

Brian C. Lane bcl at redhat.com
Thu Mar 13 15:13:50 UTC 2014


On Thu, Mar 13, 2014 at 08:07:11AM +0100, Vratislav Podzimek wrote:
> On Wed, 2014-03-12 at 16:42 -0700, Brian C. Lane wrote:
> > ---
> >  src/pylorax/imgutils.py | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> > 
> > diff --git a/src/pylorax/imgutils.py b/src/pylorax/imgutils.py
> > index 1a6c788..6d79b73 100644
> > --- a/src/pylorax/imgutils.py
> > +++ b/src/pylorax/imgutils.py
> > @@ -75,6 +75,19 @@ def mksparse(outfile, size):
> >      fobj = open(outfile, "w")
> >      os.ftruncate(fobj.fileno(), size)
> >  
> > +def mkqcow2(outfile, size, options=None):
> > +    '''use qemu-img to create a file of the given size.
> > +       options is a list of options passed to qemu-img
> > +
> > +       Default format is qcow2, override by passing "-f", fmt
> > +       in options.
> > +    '''
> > +    if not options:
> > +        options = []
> This could be 'options = options or []' if you like it more. Both
> variants are okay and so are both these patches. ACK.

Yeah, that's the one variation of the inline style that I do like.
Thanks.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)


More information about the anaconda-patches mailing list