On Tue, 2015-08-18 at 06:53 +0000, Eren Yagdiran wrote: > Run an already-built template > If there is no execution command specified by user, source.get_command will > find the command to invoke > --- > virt-sandbox-image/virt-sandbox-image.py | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/virt-sandbox-image/virt-sandbox-image.py b/virt-sandbox-image/virt-sandbox-image.py > index c46abd4..278d19a 100755 > --- a/virt-sandbox-image/virt-sandbox-image.py > +++ b/virt-sandbox-image/virt-sandbox-image.py > @@ -128,6 +128,31 @@ def check_connect(connectstr): > raise ValueError("%s is not supported by Virt-sandbox" %connectstr) > return True > > +def run(args): > + try: > + if args.connect is not None: > + check_connect(args.connect) > + source = dynamic_source_loader(args.source) > + diskfile,configfile = source.get_disk(name=args.name,templatedir=args.template_dir) This is the place where the temporary disk file would be created. Don't forget it's a per-sandbox disk layer. Compute the sandbox name here, use it to create the disk layer in the sandbox state directory... > + > + format = "qcow2" > + commandToRun = args.igniter > + if commandToRun is None: > + commandToRun = source.get_command(configfile) > + cmd = ['virt-sandbox'] ...and add --name parameter to virt-sandbox to define that name. -- Cedric > + if args.connect is not None: > + cmd.append("-c") > + cmd.append(args.connect) > + params = ['-m','host-image:/=%s,format=%s' %(diskfile,format), > + '--', > + commandToRun] > + cmd = cmd + params > + subprocess.call(cmd) > + subprocess.call(["rm", "-rf", diskfile]) Remove the temporary disk layer and the sandbox state directory here. -- Cedric > + except Exception,e: > + print "Run Error %s" % str(e) > + > def requires_name(parser): > parser.add_argument("name", > help=_("name of the template")) -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list