[Kimchi-devel] [PATCH] partitions: Fix when disk does not have extended partition

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Sun Mar 23 14:09:05 UTC 2014


From: Royce Lv <lvroyce at linux.vnet.ibm.com>

Disk may just have primary partitions,
this makes getExtendedPartition return none and
throw exception when refer to extended partition path.
Fix this by check whether extended partition exists.

Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
 src/kimchi/disks.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/kimchi/disks.py b/src/kimchi/disks.py
index cada869..ce0c5bb 100644
--- a/src/kimchi/disks.py
+++ b/src/kimchi/disks.py
@@ -86,8 +86,8 @@ def _is_dev_extended_partition(devType, devNodePath):
         return False
     diskPath = devNodePath.rstrip('0123456789')
     device = PDevice(diskPath)
-    disk = PDisk(device)
-    if disk.getExtendedPartition().path == devNodePath:
+    extended_part = PDisk(device).getExtendedPartition()
+    if extended_part and extended_part.path == devNodePath:
         return True
     return False
 
-- 
1.8.3.2




More information about the Kimchi-devel mailing list