[Pkg-libvirt-commits] [SCM] Virtinst Debian packaging branch, master, updated. debian/0.500.0-3

Guido Günther agx at sigxcpu.org
Sat Nov 21 13:40:23 UTC 2009


The following commit has been merged in the master branch:
commit 7b2d9d50290fb6580d420ba97214fa2b25732e6b
Author: Guido Günther <agx at sigxcpu.org>
Date:   Sat Nov 21 14:21:43 2009 +0100

    Add error handling to VirtualDisk._clone_local
    
    Closes: #555748

diff --git a/debian/patches/0004-Add-error-handling-to-VirtualDisk._clone_local.patch b/debian/patches/0004-Add-error-handling-to-VirtualDisk._clone_local.patch
new file mode 100644
index 0000000..9a0f398
--- /dev/null
+++ b/debian/patches/0004-Add-error-handling-to-VirtualDisk._clone_local.patch
@@ -0,0 +1,69 @@
+From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx at sigxcpu.org>
+Date: Sat, 21 Nov 2009 14:06:41 +0100
+Subject: [PATCH] Add error handling to VirtualDisk._clone_local
+
+Closes: #555748
+---
+ virtinst/VirtualDisk.py |   46 +++++++++++++++++++++++++---------------------
+ 1 files changed, 25 insertions(+), 21 deletions(-)
+
+diff --git a/virtinst/VirtualDisk.py b/virtinst/VirtualDisk.py
+index 67e2d03..781b11e 100644
+--- a/virtinst/VirtualDisk.py
++++ b/virtinst/VirtualDisk.py
+@@ -859,29 +859,33 @@ class VirtualDisk(VirtualDevice):
+ 
+         zeros = '\0' * 4096
+ 
++        src_fd, dst_fd = None, None
+         try:
+-            src_fd = os.open(self.clone_path, os.O_RDONLY)
+-            dst_fd = os.open(self.path, os.O_WRONLY | os.O_CREAT)
+-
+-            i=0
+-            while 1:
+-                l = os.read(src_fd, clone_block_size)
+-                s = len(l)
+-                if s == 0:
+-                    meter.end(size_bytes)
+-                    break
+-                # check sequence of zeros
+-                if sparse and zeros == l:
+-                    os.lseek(dst_fd, s, 1)
+-                else:
+-                    b = os.write(dst_fd, l)
+-                    if s != b:
+-                        meter.end(i)
++            try:
++                src_fd = os.open(self.clone_path, os.O_RDONLY)
++                dst_fd = os.open(self.path, os.O_WRONLY | os.O_CREAT)
++
++                i=0
++                while 1:
++                    l = os.read(src_fd, clone_block_size)
++                    s = len(l)
++                    if s == 0:
++                        meter.end(size_bytes)
+                         break
+-                i += s
+-                if i < size_bytes:
+-                    meter.update(i)
+-
++                    # check sequence of zeros
++                    if sparse and zeros == l:
++                        os.lseek(dst_fd, s, 1)
++                    else:
++                        b = os.write(dst_fd, l)
++                        if s != b:
++                            meter.end(i)
++                            break
++                    i += s
++                    if i < size_bytes:
++                        meter.update(i)
++            except OSError, e:
++                raise RuntimeError(_("Error cloning diskimage %s to %s: %s") %
++                                       (self.clone_path, self.path, str(e)))
+         finally:
+             if src_fd is not None:
+                 os.close(src_fd)
+-- 
diff --git a/debian/patches/series b/debian/patches/series
index acae32a..f2a1370 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 0001-fix-path-to-hvmloader.patch
 0002-Fix-path-to-pygrub.patch
 0003-Don-t-use-virtio-for-cdrom-floppy-devices.patch
+0004-Add-error-handling-to-VirtualDisk._clone_local.patch

-- 
Virtinst Debian packaging



More information about the Pkg-libvirt-commits mailing list