On Fri, Aug 28, 2015 at 01:47:41PM +0000, Eren Yagdiran wrote: > Provide a way to know which disk image to use for the sandbox depending on the used source > DockerSource will need to locate the topmost disk image among all the layers images > --- > virt-sandbox-image/sources/DockerSource.py | 16 ++++++++++++++++ > virt-sandbox-image/sources/Source.py | 4 ++++ > virt-sandbox-image/virt-sandbox-image.py | 9 +++++++++ > 3 files changed, 29 insertions(+) > > diff --git a/virt-sandbox-image/sources/DockerSource.py b/virt-sandbox-image/sources/DockerSource.py > index 3e0362b..87fbcf3 100644 > --- a/virt-sandbox-image/sources/DockerSource.py > +++ b/virt-sandbox-image/sources/DockerSource.py > @@ -372,6 +372,22 @@ class DockerSource(Source): > parent = None > imagetagid = parent > > + def get_disk(self,**args): > + name = args['name'] > + destdir = args['templatedir'] > + sandboxid = args['id'] > + imageList = self._get_image_list(name,destdir) > + toplayer = imageList[0] > + diskfile = destdir + "/" + toplayer + "/template.qcow2" > + configfile = destdir + "/" + toplayer + "/template.json" > + tempfile = destdir + "/" + toplayer + "/" + sandboxid + ".qcow2" This is storing the per-sandbox image file inside the template directory which is not what we want. We should be using the storage_dir instead of template_dir for the per instance image. > + cmd = ["qemu-img","create","-q","-f","qcow2"] > + cmd.append("-o") > + cmd.append("backing_fmt=qcow2,backing_file=%s" % diskfile) > + cmd.append(tempfile) > + subprocess.call(cmd) > + return (tempfile,configfile) > + > def get_command(self,configfile): > configParser = DockerConfParser(configfile) > commandToRun = configParser.getRunCommand() > +def requires_id(parser): > + randomid = ''.join(random.choice(string.lowercase) for i in range(10)) > + parser.add_argument("-d","--id", > + default=randomid, > + help=_("id of the running sandbox")) This is currently just used to form the per-instance image filename. We should also use this for the libvirt guest name too. So I'd suggest we just call this '-n' / '--name' to match the virt-sandbox arg syntax and have a prefix on it eg sandboxXXXXXXX where XXXXX is the random suffix 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 :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list