7044533 cud_ai: ERROR: an exception occurred : 'naccessible'
authorDrew Fisher <drew.fisher@oracle.com>
Tue, 17 May 2011 06:40:11 -0600
changeset 1128 a401bf4396fc
parent 1127 c60a71b130a0
child 1129 e8fa7dfb2df2
7044533 cud_ai: ERROR: an exception occurred : 'naccessible' 7044816 Logical.py __copy__ methods should not be copying self
usr/src/lib/install_target/discovery.py
usr/src/lib/install_target/logical.py
--- a/usr/src/lib/install_target/discovery.py	Mon May 16 17:24:57 2011 -0700
+++ b/usr/src/lib/install_target/discovery.py	Tue May 17 06:40:11 2011 -0600
@@ -43,6 +43,7 @@
 from solaris_install.target.libbe import be
 from solaris_install.target.libdevinfo import devinfo
 from solaris_install.target.libdiskmgt import const, diskmgt
+from solaris_install.target.libdiskmgt.attributes import DMMediaAttr
 from solaris_install.target.logical import BE, Filesystem, Logical, Zpool, Zvol
 from solaris_install.target.physical import Disk, DiskProp, DiskGeometry, \
     DiskKeyword, Iscsi, IP, Partition, Slice
@@ -63,6 +64,12 @@
 DISK_RE = "c\d+(?:t\d+)?d\d+"
 
 
+class DiskLabelMissingError(Exception):
+    """ Disk is unusable for install due to missing label
+    """
+    pass
+
+
 class TargetDiscovery(Checkpoint):
     """ Discover all logical and physical devices on the system.
     """
@@ -233,6 +240,14 @@
         """
         new_geometry = None
 
+        # If a disk is missing some basic attributes then it most likely has
+        # no disk label.  This requires manual resolution to fix so raise
+        # an error.
+        if not DMMediaAttr.NACCESSIBLE in dma or \
+           not DMMediaAttr.BLOCKSIZE in dma:
+            raise DiskLabelMissingError("Disk %s appears to be missing a "
+                "label and needs to be labelled manually." % new_disk.ctd)
+
         # If the disk has a GPT label (or no label), ncylinders will be
         # None
         if dma.ncylinders is None:
--- a/usr/src/lib/install_target/logical.py	Mon May 16 17:24:57 2011 -0700
+++ b/usr/src/lib/install_target/logical.py	Tue May 17 06:40:11 2011 -0600
@@ -122,7 +122,7 @@
         We want the _children list to be a shadow list instead of a flat list
         """
         new_copy = super(Logical, self).__copy__()
-        new_copy._children = ShadowZpool(self)
+        new_copy._children = ShadowZpool(new_copy)
         return new_copy
 
     def __repr__(self):
@@ -355,7 +355,7 @@
         We want the _children list to be a shadow list instead of a flat list
         """
         new_copy = super(Zpool, self).__copy__()
-        new_copy._children = ShadowLogical(self)
+        new_copy._children = ShadowLogical(new_copy)
         return new_copy
 
     def __repr__(self):