[openstack-nova] Fix libguestfs support for specified partitions

Pádraig Brady pbrady at fedoraproject.org
Wed Jan 11 17:38:26 UTC 2012


commit 7511229dcc3d9f3ff9a081e30a1a1c080918c44c
Author: Pádraig Brady <P at draigBrady.com>
Date:   Wed Jan 11 17:22:30 2012 +0000

    Fix libguestfs support for specified partitions
    
    Support partitions specified as strings,
    which openstack does by default.

 ...estfs-operation-with-specified-partitions.patch |   43 ++++++++++++++++++++
 openstack-nova.spec                                |    7 +++-
 2 files changed, 49 insertions(+), 1 deletions(-)
---
diff --git a/0096-Fix-libguestfs-operation-with-specified-partitions.patch b/0096-Fix-libguestfs-operation-with-specified-partitions.patch
new file mode 100644
index 0000000..76261f9
--- /dev/null
+++ b/0096-Fix-libguestfs-operation-with-specified-partitions.patch
@@ -0,0 +1,43 @@
+From e988f431d86660318b46729dea6e772083f2248d Mon Sep 17 00:00:00 2001
+From: =?utf8?q?P=C3=A1draig=20Brady?= <pbrady at redhat.com>
+Date: Tue, 10 Jan 2012 10:54:21 +0000
+Subject: [PATCH] Fix libguestfs operation with specified partitions
+
+* nova/virt/disk/guestfs.py (mnt_dev): Convert the partition
+parameter to int, so we now support a "1" string passed from
+nova/virt/libvirt/connection.py.  Also diagnose any
+unconvertible strings.
+
+Change-Id: I744bd1fc3ea065891b5ce112dbe27f73086f302e
+---
+ nova/virt/disk/guestfs.py |   12 +++++++++---
+ 1 files changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/nova/virt/disk/guestfs.py b/nova/virt/disk/guestfs.py
+index 6323dc8..20e3eda 100644
+--- a/nova/virt/disk/guestfs.py
++++ b/nova/virt/disk/guestfs.py
+@@ -33,11 +33,17 @@ class Mount(mount.Mount):
+         self.mapped = False
+ 
+     def mnt_dev(self):
++        try:
++            partition = int(self.partition or 0)
++        except ValueError:
++            self.error = _('unsupported partition: %s') % self.partition
++            return False
++
+         args = ('guestmount', '--rw', '-a', self.image)
+-        if self.partition == -1:
++        if partition == -1:
+             args += ('-i',)  # find the OS partition
+-        elif self.partition:
+-            args += ('-m', '/dev/sda%d' % self.partition)
++        elif partition:
++            args += ('-m', '/dev/sda%d' % partition)
+         else:
+             # We don't resort to -i for this case yet,
+             # as some older versions of libguestfs
+-- 
+1.7.4.1
+
diff --git a/openstack-nova.spec b/openstack-nova.spec
index 791cc6b..d98e34c 100644
--- a/openstack-nova.spec
+++ b/openstack-nova.spec
@@ -2,7 +2,7 @@
 
 Name:             openstack-nova
 Version:          2011.3
-Release:          18%{?dist}
+Release:          19%{?dist}
 Summary:          OpenStack Compute (nova)
 
 Group:            Applications/System
@@ -133,6 +133,7 @@ Patch91:          0091-Refactor-ietadm-tgtadm-calls-out-into-helper-classes.patc
 Patch92:          0092-Fix-tgtadm-off-by-one-error.-Fixes-bug-871278.patch
 Patch93:          0093-Bug-898257-abstract-out-disk-image-access-methods.patch
 Patch94:          0094-Bug-898257-support-handling-images-with-libguestfs.patch
+Patch96:          0096-Fix-libguestfs-operation-with-specified-partitions.patch
 
 # This is Fedora specific and not upstream
 Patch95:          0095-Ensure-we-don-t-access-the-net-when-building-docs.patch
@@ -365,6 +366,7 @@ This package contains documentation files for nova.
 %patch93 -p1
 %patch94 -p1
 %patch95 -p1
+%patch96 -p1
 
 find . \( -name .gitignore -o -name .placeholder \) -delete
 
@@ -551,6 +553,9 @@ fi
 %endif
 
 %changelog
+* Wed Jan 11 2012 Pádraig Brady <P at draigBrady.com> - 2011.3-19
+- Fix libguestfs support for specified partitions
+
 * Fri Jan  6 2012 Mark McLoughlin <markmc at redhat.com> - 2011.3-18
 - Fix up recent patches which don't apply
 


More information about the scm-commits mailing list