If one pastes from the output of virt-sansbox-image $ virt-sandbox-image list docker:/library/ubuntu?tag=17.04 docker:/library/debian?tag=latest verbatim $ virt-sandbox-image run -c qemu:///session docker:/library/debian?tag=latest This fails like Unable to start sandbox: Failed to create domain: XML error: name library/debian:qbeilwxard cannot contain '/' so don't allow invalid chars like '/' in domain names --- libvirt-sandbox/image/cli.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libvirt-sandbox/image/cli.py b/libvirt-sandbox/image/cli.py index 3a5ccfa..d5e624c 100644 --- a/libvirt-sandbox/image/cli.py +++ b/libvirt-sandbox/image/cli.py @@ -27,6 +27,7 @@ import hashlib import json import os import os.path +import re import shutil import sys import urllib2 @@ -81,6 +82,10 @@ def prepare(args): templatedir=get_template_dir(args), connect=args.connect) +def random_domain_name(tmpl): + randomid = ''.join(random.choice(string.lowercase) for i in range(10)) + return re.sub('[^a-z0-9-]', '_', tmpl.path[1:], re.I) + ":" + randomid + def run(args): if args.connect is not None: check_connect(args.connect) @@ -95,8 +100,7 @@ def run(args): name = args.name if name is None: - randomid = ''.join(random.choice(string.lowercase) for i in range(10)) - name = tmpl.path[1:] + ":" + randomid + name = random_domain_name(tmpl) diskfile = source.get_disk(template=tmpl, templatedir=template_dir, -- 2.11.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list