[Pkg-libvirt-commits] [libvirt-sandbox] 42/42: Unbreak running from URLs given by "virt-sandbox-image list"
Guido Guenther
agx at moszumanska.debian.org
Sat May 27 16:27:10 UTC 2017
This is an automated email from the git hooks/post-receive script.
agx pushed a commit to branch debian/experimental
in repository libvirt-sandbox.
commit db393db8356e18eff8150bbbfc261a32f2ebaba8
Author: Guido Günther <agx at sigxcpu.org>
Date: Sat May 27 18:26:54 2017 +0200
Unbreak running from URLs given by "virt-sandbox-image list"
---
...library-from-template-name-and-image-path.patch | 52 ++++++++++++++++++++++
.../docker-Don-t-ignore-qemu-img-errors.patch | 21 +++++++++
debian/patches/series | 2 +
3 files changed, 75 insertions(+)
diff --git a/debian/patches/Drop-library-from-template-name-and-image-path.patch b/debian/patches/Drop-library-from-template-name-and-image-path.patch
new file mode 100644
index 0000000..9852af1
--- /dev/null
+++ b/debian/patches/Drop-library-from-template-name-and-image-path.patch
@@ -0,0 +1,52 @@
+From: =?utf-8?q?Guido_G=C3=BCnther?= <agx at sigxcpu.org>
+Date: Sat, 27 May 2017 18:13:10 +0200
+Subject: Drop library/ from template name and image path
+
+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
+
+ /home/<usr>/.local/share/libvirt/images/library/debian:qbeilwxard.qcow2: Could not create file: No such file or directory
+ Unable to start sandbox: Failed to create domain: XML error: name library/debian:qbeilwxard cannot contain '/'
+ /usr/bin/virt-sandbox-image: [Errno 2] No such file or directory: '/home/<user>/.local/share/libvirt/images/library/debian:qbeilwxard.qcow2'
+
+so strip of any leading components.
+---
+ libvirt-sandbox/image/cli.py | 2 +-
+ libvirt-sandbox/image/sources/docker.py | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libvirt-sandbox/image/cli.py b/libvirt-sandbox/image/cli.py
+index 3a5ccfa..0f27a16 100644
+--- a/libvirt-sandbox/image/cli.py
++++ b/libvirt-sandbox/image/cli.py
+@@ -96,7 +96,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 = tmpl.path[1:].split('/')[-1] + ":" + randomid
+
+ diskfile = source.get_disk(template=tmpl,
+ templatedir=template_dir,
+diff --git a/libvirt-sandbox/image/sources/docker.py b/libvirt-sandbox/image/sources/docker.py
+index aa5675e..6ca086c 100755
+--- a/libvirt-sandbox/image/sources/docker.py
++++ b/libvirt-sandbox/image/sources/docker.py
+@@ -655,7 +655,7 @@ class DockerSource(base.Source):
+ def get_disk(self, template, templatedir, imagedir, sandboxname):
+ image = DockerImage.from_template(template)
+ configfile, diskfile = self._get_template_data(image, templatedir)
+- tempfile = imagedir + "/" + sandboxname + ".qcow2"
++ tempfile = imagedir + "/" + sandboxname.split('/')[-1] + ".qcow2"
+ if not os.path.exists(imagedir):
+ os.makedirs(imagedir)
+ cmd = ["qemu-img","create","-q","-f","qcow2"]
diff --git a/debian/patches/docker-Don-t-ignore-qemu-img-errors.patch b/debian/patches/docker-Don-t-ignore-qemu-img-errors.patch
new file mode 100644
index 0000000..407a954
--- /dev/null
+++ b/debian/patches/docker-Don-t-ignore-qemu-img-errors.patch
@@ -0,0 +1,21 @@
+From: =?utf-8?q?Guido_G=C3=BCnther?= <agx at sigxcpu.org>
+Date: Sat, 27 May 2017 18:16:46 +0200
+Subject: docker: Don't ignore qemu-img errors
+
+---
+ libvirt-sandbox/image/sources/docker.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libvirt-sandbox/image/sources/docker.py b/libvirt-sandbox/image/sources/docker.py
+index 43e9c32..aa5675e 100755
+--- a/libvirt-sandbox/image/sources/docker.py
++++ b/libvirt-sandbox/image/sources/docker.py
+@@ -662,7 +662,7 @@ class DockerSource(base.Source):
+ cmd.append("-o")
+ cmd.append("backing_fmt=qcow2,backing_file=%s" % diskfile)
+ cmd.append(tempfile)
+- subprocess.call(cmd)
++ subprocess.check_call(cmd)
+ return tempfile
+
+ def get_command(self, template, templatedir, userargs):
diff --git a/debian/patches/series b/debian/patches/series
index 186dade..8c8da31 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
mkinitrd-Add-missing-fscrypto-module.patch
+docker-Don-t-ignore-qemu-img-errors.patch
+Drop-library-from-template-name-and-image-path.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libvirt-sandbox.git
More information about the Pkg-libvirt-commits
mailing list