[libvirt] [PATCH sandbox v5 07/20] Image: Refactor create function

Daniel P. Berrange berrange at redhat.com
Wed Sep 9 11:58:54 UTC 2015


On Wed, Sep 09, 2015 at 01:53:06PM +0200, Cedric Bosdonnat wrote:
> On Tue, 2015-09-08 at 17:29 +0100, Daniel P. Berrange wrote:
> > From: Eren Yagdiran <erenyagdiran at gmail.com>
> > 
> > Move the docker-related code to the DockerSource and use
> > the Source mechanism
> > 
> > Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> > ---
> >  libvirt-sandbox/image/cli.py                  | 76 +++++-----------------
> >  libvirt-sandbox/image/sources/DockerSource.py | 90 +++++++++++++++++++++++++++
> >  libvirt-sandbox/image/sources/Source.py       | 15 +++++
> >  3 files changed, 122 insertions(+), 59 deletions(-)
> > 

> > +    def _extract_tarballs(self,directory,format,connect):
> > +        tempdir = "/mnt"
> 
> Is it safe to assume we'll be able to use /mnt as a temporary mount
> folder? I'ld be more inclined in using a really temporary folder.

Amuzingly that variable is set and then never used again, so
can just be deleted

> 
> --
> Cedric
> 
> > +        tarfile = directory + "tar.gz"
> > +        diskfile = directory + "qcow2"
> > +        cmd = ['virt-sandbox']
> > +        if connect is not None:
> > +            cmd.append("-c")
> > +            cmd.append(connect)
> > +        cmd.append("-p")
> > +        params = ['-m',
> > +                  'host-image:/mnt=%s,format=%s' %(diskfile,format),
> > +                  '--',
> > +                  '/bin/tar',
> > +                  'zxf',
> > +                  '%s' %tarfile,
> > +                  '-C',
> > +                  '/mnt']
> > +        cmd = cmd + params
> > +        subprocess.call(cmd)
> > +
> >  def debug(msg):
> >      sys.stderr.write(msg)

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list